prettier map.js

This commit is contained in:
Edward Betts 2021-05-11 17:46:05 +02:00
parent 5857260398
commit 74c34dbf76

View file

@ -119,7 +119,6 @@ function update_wikidata(check_for_missing = true) {
if (missing_qids.length) { if (missing_qids.length) {
var params = { qids: missing_qids.join(",") }; var params = { qids: missing_qids.join(",") };
axios.get(missing_url, { params: params }).then((response) => { axios.get(missing_url, { params: params }).then((response) => {
response.data.isa_count.forEach((isa) => { response.data.isa_count.forEach((isa) => {
isa_labels[isa.qid] = isa.label; isa_labels[isa.qid] = isa.label;
if (isa_count[isa.qid] === undefined) { if (isa_count[isa.qid] === undefined) {
@ -289,25 +288,32 @@ function mouseover(item) {
item.outline.setStyle({ fillOpacity: 0.2, weight: 6 }); item.outline.setStyle({ fillOpacity: 0.2, weight: 6 });
} }
if (item.lines) { if (item.lines) {
item.lines.forEach((line) => { line.setStyle({ weight: 6}); }); item.lines.forEach((line) => {
line.setStyle({ weight: 6 });
});
} }
}
};
function mouseout(item) { function mouseout(item) {
if (item.outline) { if (item.outline) {
item.outline.setStyle({ fillOpacity: 0, weight: 3 }); item.outline.setStyle({ fillOpacity: 0, weight: 3 });
} }
if (item.lines) { if (item.lines) {
item.lines.forEach((line) => { line.setStyle({ weight: 3}); }); item.lines.forEach((line) => {
line.setStyle({ weight: 3 });
});
} }
}; }
function mouse_events(marker, qid) { function mouse_events(marker, qid) {
items[qid] ||= {}; items[qid] ||= {};
var item = items[qid]; var item = items[qid];
marker.on("mouseover", function() { mouseover(item); }); marker.on("mouseover", function () {
marker.on("mouseout", function() { mouseout(item); }); mouseover(item);
});
marker.on("mouseout", function () {
mouseout(item);
});
item.markers ||= []; item.markers ||= [];
item.markers.push(marker); item.markers.push(marker);
@ -340,7 +346,6 @@ function process_wikidata_items(load_items) {
if (items[qid] === undefined) items[qid] = {}; if (items[qid] === undefined) items[qid] = {};
items[qid].isa_list = item.isa_list; items[qid].isa_list = item.isa_list;
}); });
} }