Add binoculars theme, auto reformat everything

This commit is contained in:
Pieter Vander Vennet 2021-09-09 00:05:51 +02:00
parent 38dea806c5
commit 78d6482c88
586 changed files with 115573 additions and 111842 deletions

View file

@ -48,7 +48,7 @@ export default class Hash {
}
hash.setData(newValue)
}
window.addEventListener('popstate', _ => {
let newValue = window.location.hash.substr(1);
if (newValue === "") {

View file

@ -24,7 +24,7 @@ export default class LiveQueryHandler {
const source = new UIEventSource({});
LiveQueryHandler[url] = source;
console.log("Fetching live data from a third-party (unknown) API:",url)
console.log("Fetching live data from a third-party (unknown) API:", url)
Utils.downloadJson(url).then(data => {
for (const shorthandDescription of shorthandsSet) {

View file

@ -4,19 +4,19 @@ import {UIEventSource} from "../UIEventSource";
* UIEventsource-wrapper around localStorage
*/
export class LocalStorageSource {
static GetParsed<T>(key: string, defaultValue : T) : UIEventSource<T>{
static GetParsed<T>(key: string, defaultValue: T): UIEventSource<T> {
return LocalStorageSource.Get(key).map(
str => {
if(str === undefined){
if (str === undefined) {
return defaultValue
}
try{
try {
return JSON.parse(str)
}catch{
} catch {
return defaultValue
}
}, [],
}, [],
value => JSON.stringify(value)
)
}
@ -24,17 +24,17 @@ export class LocalStorageSource {
static Get(key: string, defaultValue: string = undefined): UIEventSource<string> {
try {
const saved = localStorage.getItem(key);
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:"+key);
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key);
source.addCallback((data) => {
try{
try {
localStorage.setItem(key, data);
}catch(e){
} catch (e) {
// Probably exceeded the quota with this item!
// Lets nuke everything
localStorage.clear()
}
});
return source;
} catch (e) {

View file

@ -69,6 +69,10 @@ export class QueryParameters {
return docs.join("\n\n");
}
public static wasInitialized(key: string): boolean {
return QueryParameters._wasInitialized.has(key)
}
private static addOrder(key) {
if (this.order.indexOf(key) < 0) {
this.order.push(key)
@ -104,10 +108,6 @@ export class QueryParameters {
console.log(QueryParameters.GenerateQueryParameterDocs())
}
}
public static wasInitialized(key: string) : boolean{
return QueryParameters._wasInitialized.has(key)
}
private static Serialize() {
const parts = []