mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 11:16:36 +02:00
remove wiki.js
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
iD.wiki = function() {
|
||||
var wiki = {},
|
||||
endpoint = 'http://wiki.openstreetmap.org/w/api.php';
|
||||
// ?action=query&prop=imageinfo&titles=Image:Residential.jpg&iiprop=url%7Ccontent&format=json&callback=foo',
|
||||
|
||||
wiki.image = function(img, callback) {
|
||||
d3.jsonp(endpoint + '?' +
|
||||
iD.util.qsString({
|
||||
action: 'query',
|
||||
prop: 'imageinfo',
|
||||
titles: img,
|
||||
iiprop: 'url',
|
||||
format: 'json',
|
||||
callback: '{callback}'
|
||||
}), function(d) {
|
||||
try {
|
||||
callback(null,
|
||||
d.query.pages[Object.keys(d.query.pages)[0]].imageinfo[0].url);
|
||||
} catch(e) {
|
||||
callback(new Error('Image not found'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
wiki.endpoint = function(_) {
|
||||
if (!arguments.length) return endpoint;
|
||||
endpoint = _;
|
||||
return wiki;
|
||||
};
|
||||
|
||||
return wiki;
|
||||
};
|
||||
@@ -27,14 +27,10 @@ iD.tagReference = function(selection) {
|
||||
.text('Description');
|
||||
|
||||
if (selection.datum().image) {
|
||||
iD.wiki().image(selection.datum().image, function(err, src) {
|
||||
if (!err) {
|
||||
referenceBody
|
||||
.append('img')
|
||||
.attr('class', 'wiki-image')
|
||||
.attr('src', src);
|
||||
}
|
||||
});
|
||||
referenceBody
|
||||
.append('img')
|
||||
.attr('class', 'wiki-image')
|
||||
.attr('src', selection.datum().image.image_url);
|
||||
}
|
||||
|
||||
referenceBody
|
||||
|
||||
Reference in New Issue
Block a user