other changes
This commit is contained in:
49
dist/index.js
vendored
49
dist/index.js
vendored
@@ -1,17 +1,17 @@
|
||||
|
||||
var svg = document.querySelector("#svg"),
|
||||
page = document.querySelector("#page"),
|
||||
iframe = document.querySelector("iframe#wikiframe"),
|
||||
cats = document.querySelector("#cats"),
|
||||
cats_contents = document.querySelector("#cats .body"),
|
||||
// cats_thumb = document.querySelector("#cats .thumb"),
|
||||
allcatscb = document.querySelector("input#allcats"),
|
||||
historycb = document.querySelector("input#history"),
|
||||
// current_title = null,
|
||||
// loaded = false,
|
||||
wikibaseurl,
|
||||
wikibasepat;
|
||||
|
||||
map = new app.Map({
|
||||
apiurl: "/mw/api.php",
|
||||
symbols: "src/legend.json",
|
||||
svg: "#svg",
|
||||
categorylabel: "Catégorie",
|
||||
categorydiv: "#cats .body",
|
||||
zoom: 2.0
|
||||
}),
|
||||
zoom_in = document.querySelector(".leaflet-control-zoom-in"),
|
||||
zoom_out = document.querySelector(".leaflet-control-zoom-out"),
|
||||
cats = document.querySelector("#cats");
|
||||
|
||||
window.addEventListener("resize", resize);
|
||||
function resize() {
|
||||
@@ -28,29 +28,14 @@ function resize() {
|
||||
// Match size of parent
|
||||
svg.setAttribute("width", page.clientWidth);
|
||||
svg.setAttribute("height", page.clientHeight);
|
||||
|
||||
}
|
||||
resize();
|
||||
|
||||
var map = new app.Map({
|
||||
apiurl: "/mw/api.php",
|
||||
symbols: "src/legend.json",
|
||||
svg: "#svg",
|
||||
categorylabel: "Catégorie",
|
||||
categorydiv: "#cats .body"
|
||||
});
|
||||
|
||||
async function doload () {
|
||||
resize();
|
||||
console.log("map.init");
|
||||
await map.init();
|
||||
console.log("map.init: done");
|
||||
|
||||
// await map.load_json("data/sitemap.json");
|
||||
// console.log("loading categories");
|
||||
// await map.load_cats("data/cats.json", cats_contents);
|
||||
// await map.load_legend("src/legend.json", cats_contents);
|
||||
// loaded = true;
|
||||
|
||||
map.on("page", function (page) {
|
||||
// console.log("map.page", page.title);
|
||||
var url = page.url();
|
||||
@@ -59,8 +44,18 @@ async function doload () {
|
||||
iframe.src = url;
|
||||
}
|
||||
})
|
||||
zoom_in.addEventListener("click", (e) => {
|
||||
map.zoom_in();
|
||||
})
|
||||
zoom_out.addEventListener("click", (e) => {
|
||||
map.zoom_out();
|
||||
})
|
||||
}
|
||||
window.addEventListener("DOMContentLoaded", doload);
|
||||
iframe.addEventListener("load", function () {
|
||||
map.set_active_url(iframe.contentWindow.location.href);
|
||||
});
|
||||
|
||||
cats.addEventListener("click", e => {
|
||||
cats.classList.toggle("expanded");
|
||||
})
|
||||
Reference in New Issue
Block a user