Full code cleanup

This commit is contained in:
Pieter Vander Vennet 2022-01-26 21:40:38 +01:00
parent 3a4a2a2016
commit fa971ffbbf
300 changed files with 16352 additions and 19284 deletions

View file

@ -12,8 +12,10 @@ export default class FileSelectorButton extends InputElement<FileList> {
private readonly allowMultiple: boolean;
constructor(label: BaseUIElement, options?:
{ acceptType: "image/*" | string,
allowMultiple: true | boolean}) {
{
acceptType: "image/*" | string,
allowMultiple: true | boolean
}) {
super();
this._label = label;
this._acceptType = options?.acceptType ?? "image/*";

View file

@ -17,9 +17,9 @@ export default class InputElementWrapper<T> extends InputElement<T> {
mapping.set(key, inputElement)
// Bit of a hack: the SubstitutedTranslation expects a special rendering, but those are formatted '{key()}' instead of '{key}', so we substitute it first
const newTranslations ={}
const newTranslations = {}
for (const lang in translation.translations) {
newTranslations[lang] = translation.translations[lang].replace("{"+key+"}", "{"+key+"()}")
newTranslations[lang] = translation.translations[lang].replace("{" + key + "}", "{" + key + "()}")
}
this._renderElement = new SubstitutedTranslation(new Translation(newTranslations), tags, state, mapping)
}

View file

@ -25,6 +25,8 @@ export default class LocationInput extends InputElement<Loc> implements MinimapO
public readonly snappedOnto: UIEventSource<any> = new UIEventSource<any>(undefined)
public readonly _matching_layer: LayerConfig;
public readonly leafletMap: UIEventSource<any>
public readonly bounds;
public readonly location;
private _centerLocation: UIEventSource<Loc>;
private readonly mapBackground: UIEventSource<BaseLayer>;
/**
@ -38,8 +40,6 @@ export default class LocationInput extends InputElement<Loc> implements MinimapO
private readonly _snappedPointTags: any;
private readonly _bounds: UIEventSource<BBox>;
private readonly map: BaseUIElement & MinimapObj;
public readonly bounds;
public readonly location;
private readonly clickLocation: UIEventSource<Loc>;
private readonly _minZoom: number;

View file

@ -73,7 +73,7 @@ export class RadioButton<T> extends InputElement<T> {
elements[i]?.onClick(() => {
selectedElementIndex.setData(i);
});
elements[i].GetValue().addCallback(() => {
selectedElementIndex.setData(i);
});

View file

@ -236,9 +236,9 @@ class UrlTextfieldDef implements TextFieldDef {
"fbclid",// Oh god, how I hate the fbclid. Let it burn, burn in hell!
"gclid",
"cmpid", "agid", "utm", "utm_source", "utm_medium",
"campaignid","campaign","AdGroupId","AdGroup","TargetId","msclkid"]
"campaignid", "campaign", "AdGroupId", "AdGroup", "TargetId", "msclkid"]
for (const dontLike of blacklistedTrackingParams) {
url.searchParams.delete(dontLike.toLowerCase() )
url.searchParams.delete(dontLike.toLowerCase())
}
let cleaned = url.toString();
if (cleaned.endsWith("/") && !str.endsWith("/")) {
@ -265,7 +265,7 @@ class UrlTextfieldDef implements TextFieldDef {
}
const url = new URL(str);
const dotIndex = url.host.indexOf(".")
return dotIndex > 0 && url.host[url.host.length - 1 ] !== ".";
return dotIndex > 0 && url.host[url.host.length - 1] !== ".";
} catch (e) {
return false;
}