forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
a2dd79c4ec
commit
7b792af261
101 changed files with 2196 additions and 22043 deletions
|
|
@ -78,7 +78,7 @@ export default class AllImageProviders {
|
|||
return undefined
|
||||
}
|
||||
const id = tags?.data?.id
|
||||
if(this._cachedImageStores[id]){
|
||||
if (this._cachedImageStores[id]) {
|
||||
return this._cachedImageStores[id]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ export default abstract class ImageProvider {
|
|||
|
||||
public abstract apiUrls(): string[]
|
||||
|
||||
public static async offerImageAsDownload(image: ProvidedImage){
|
||||
public static async offerImageAsDownload(image: ProvidedImage) {
|
||||
const response = await fetch(image.url_hd ?? image.url)
|
||||
const blob = await response.blob()
|
||||
Utils.offerContentsAsDownloadableFile(blob, new URL(image.url).pathname.split("/").at(-1), {
|
||||
|
|
|
|||
|
|
@ -138,12 +138,19 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
}
|
||||
return data?.some(
|
||||
(img) =>
|
||||
img?.status !== undefined && img?.status !== "ready" && img?.status !== "broken" && img?.status !== "hidden"
|
||||
img?.status !== undefined &&
|
||||
img?.status !== "ready" &&
|
||||
img?.status !== "broken" &&
|
||||
img?.status !== "hidden"
|
||||
)
|
||||
}
|
||||
|
||||
Stores.Chronic(1500, () => hasLoading(source.data)).addCallback((_) => {
|
||||
console.log("Testing panoramax URLS again as some were loading", source.data, hasLoading(source.data))
|
||||
console.log(
|
||||
"Testing panoramax URLS again as some were loading",
|
||||
source.data,
|
||||
hasLoading(source.data)
|
||||
)
|
||||
super.getRelevantUrlsFor(tags, prefixes).then((data) => {
|
||||
source.set(data)
|
||||
return !hasLoading(data)
|
||||
|
|
@ -170,12 +177,12 @@ export default class PanoramaxImageProvider extends ImageProvider {
|
|||
return ["https://panoramax.mapcomplete.org", "https://panoramax.xyz"]
|
||||
}
|
||||
|
||||
public static getPanoramaxInstance (host: string){
|
||||
public static getPanoramaxInstance(host: string) {
|
||||
host = new URL(host).host
|
||||
if(new URL(this.defaultPanoramax.host).host === host){
|
||||
if (new URL(this.defaultPanoramax.host).host === host) {
|
||||
return this.defaultPanoramax
|
||||
}
|
||||
if(new URL(this.xyz.host).host === host){
|
||||
if (new URL(this.xyz.host).host === host) {
|
||||
return this.xyz
|
||||
}
|
||||
return new Panoramax(host)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,42 @@
|
|||
import { Utils } from "../../Utils"
|
||||
/** This code is autogenerated - do not edit. Edit ./assets/layers/usersettings/usersettings.json instead */
|
||||
export class ThemeMetaTagging {
|
||||
public static readonly themeName = "usersettings"
|
||||
public static readonly themeName = "usersettings"
|
||||
|
||||
public metaTaggging_for_usersettings(feat: {properties: Record<string, string>}) {
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_md', () => feat.properties._description.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)?.at(1) )
|
||||
Utils.AddLazyProperty(feat.properties, '_d', () => feat.properties._description?.replace(/</g,'<')?.replace(/>/g,'>') ?? '' )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate_a', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.href.match(/mastodon|en.osm.town/) !== null)[0]?.href }) (feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_link', () => (feat => {const e = document.createElement('div');e.innerHTML = feat.properties._d;return Array.from(e.getElementsByTagName("a")).filter(a => a.getAttribute("rel")?.indexOf('me') >= 0)[0]?.href})(feat) )
|
||||
Utils.AddLazyProperty(feat.properties, '_mastodon_candidate', () => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a )
|
||||
feat.properties['__current_backgroun'] = 'initial_value'
|
||||
}
|
||||
}
|
||||
public metaTaggging_for_usersettings(feat: { properties: Record<string, string> }) {
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_md", () =>
|
||||
feat.properties._description
|
||||
.match(/\[[^\]]*\]\((.*(mastodon|en.osm.town).*)\).*/)
|
||||
?.at(1)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_d",
|
||||
() => feat.properties._description?.replace(/</g, "<")?.replace(/>/g, ">") ?? ""
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_candidate_a", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.href.match(/mastodon|en.osm.town/) !== null
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(feat.properties, "_mastodon_link", () =>
|
||||
((feat) => {
|
||||
const e = document.createElement("div")
|
||||
e.innerHTML = feat.properties._d
|
||||
return Array.from(e.getElementsByTagName("a")).filter(
|
||||
(a) => a.getAttribute("rel")?.indexOf("me") >= 0
|
||||
)[0]?.href
|
||||
})(feat)
|
||||
)
|
||||
Utils.AddLazyProperty(
|
||||
feat.properties,
|
||||
"_mastodon_candidate",
|
||||
() => feat.properties._mastodon_candidate_md ?? feat.properties._mastodon_candidate_a
|
||||
)
|
||||
feat.properties["__current_backgroun"] = "initial_value"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,10 +127,9 @@ export class RegexTag extends TagsFilter {
|
|||
return `${this.key}${invert}~${v}`
|
||||
}
|
||||
return `${this.key}${invert}~i~${v}`
|
||||
|
||||
}
|
||||
|
||||
const key :string = RegexTag.source(this.key, false)
|
||||
const key: string = RegexTag.source(this.key, false)
|
||||
return `${key}${invert}~${caseInvariant ? "i~" : ""}~${v}`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,12 +102,12 @@ export class TagUtils {
|
|||
"~i~~": {
|
||||
name: "Key and value should match a given regex; value is case-invariant",
|
||||
overpassSupport: true,
|
||||
docs: "Similar to ~~, except that the value is case-invariant"
|
||||
docs: "Similar to ~~, except that the value is case-invariant",
|
||||
},
|
||||
"!~i~~": {
|
||||
name: "Key and value should match a given regex; value is case-invariant",
|
||||
overpassSupport: true,
|
||||
docs: "Similar to !~~, except that the value is case-invariant"
|
||||
docs: "Similar to !~~, except that the value is case-invariant",
|
||||
},
|
||||
":=": {
|
||||
name: "Substitute `... {some_key} ...` and match `key`",
|
||||
|
|
@ -802,7 +802,7 @@ export class TagUtils {
|
|||
|
||||
if (tag.indexOf("~~") >= 0 || tag.indexOf("~i~~") >= 0) {
|
||||
const caseInvariant = tag.indexOf("~i~~") >= 0
|
||||
const split = Utils.SplitFirst(tag, caseInvariant ? "~i~~" : "~~")
|
||||
const split = Utils.SplitFirst(tag, caseInvariant ? "~i~~" : "~~")
|
||||
let keyRegex: RegExp
|
||||
if (split[0] === "*") {
|
||||
keyRegex = new RegExp(".+", "i")
|
||||
|
|
@ -813,7 +813,7 @@ export class TagUtils {
|
|||
if (split[1] === "*") {
|
||||
valueRegex = new RegExp(".+", "s")
|
||||
} else {
|
||||
valueRegex = new RegExp("^(" + split[1] + ")$",caseInvariant ? "si": "s" )
|
||||
valueRegex = new RegExp("^(" + split[1] + ")$", caseInvariant ? "si" : "s")
|
||||
}
|
||||
return new RegexTag(keyRegex, valueRegex)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export class Stores {
|
|||
const source = new UIEventSource<Date>(undefined)
|
||||
|
||||
function run() {
|
||||
if(asLong !== undefined && !asLong()){
|
||||
if (asLong !== undefined && !asLong()) {
|
||||
return
|
||||
}
|
||||
source.setData(new Date())
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export class LocalStorageSource {
|
|||
}
|
||||
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key)
|
||||
|
||||
if(!Utils.runningFromConsole){
|
||||
if (!Utils.runningFromConsole) {
|
||||
source.addCallback((data) => {
|
||||
if (data === undefined || data === "" || data === null) {
|
||||
localStorage.removeItem(key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue