forked from MapComplete/MapComplete
Decrese dependency on jquery
This commit is contained in:
parent
e3f2c56d3e
commit
d0997480c0
8 changed files with 43 additions and 60 deletions
|
@ -4,6 +4,7 @@ import ImageAttributionSource from "./ImageAttributionSource";
|
|||
import BaseUIElement from "../../UI/BaseUIElement";
|
||||
import {UIEventSource} from "../UIEventSource";
|
||||
import Svg from "../../Svg";
|
||||
import {Utils} from "../../Utils";
|
||||
|
||||
export class Mapillary extends ImageAttributionSource {
|
||||
|
||||
|
@ -43,7 +44,7 @@ export class Mapillary extends ImageAttributionSource {
|
|||
const key = Mapillary.ExtractKeyFromURL(url)
|
||||
const metadataURL = `https://a.mapillary.com/v3/images/${key}?client_id=TXhLaWthQ1d4RUg0czVxaTVoRjFJZzowNDczNjUzNmIyNTQyYzI2`
|
||||
const source = new UIEventSource<LicenseInfo>(undefined)
|
||||
$.getJSON(metadataURL, function (data) {
|
||||
Utils.downloadJson(metadataURL).then(data => {
|
||||
const license = new LicenseInfo();
|
||||
license.artist = data.properties?.username;
|
||||
license.licenseShortName = "CC BY-SA 4.0";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import * as $ from "jquery"
|
||||
import ImageAttributionSource from "./ImageAttributionSource";
|
||||
import BaseUIElement from "../../UI/BaseUIElement";
|
||||
import Svg from "../../Svg";
|
||||
|
@ -43,7 +42,7 @@ export class Wikimedia extends ImageAttributionSource {
|
|||
}
|
||||
const self = this;
|
||||
console.log("Loading a wikimedia category: ", url)
|
||||
$.getJSON(url, (response) => {
|
||||
Utils.downloadJson(url).then((response) => {
|
||||
let imageOverview = new ImagesInCategory();
|
||||
let members = response.query?.categorymembers;
|
||||
if (members === undefined) {
|
||||
|
@ -78,7 +77,7 @@ export class Wikimedia extends ImageAttributionSource {
|
|||
|
||||
static GetWikiData(id: number, handleWikidata: ((Wikidata) => void)) {
|
||||
const url = "https://www.wikidata.org/wiki/Special:EntityData/Q" + id + ".json";
|
||||
$.getJSON(url, (response) => {
|
||||
Utils.downloadJson(url).then (response => {
|
||||
const entity = response.entities["Q" + id];
|
||||
const commons = entity.sitelinks.commonswiki;
|
||||
const wd = new Wikidata();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue