local change
This commit is contained in:
84
index.00.html
Normal file
84
index.00.html
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title></title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="controls">
|
||||||
|
<a href="http://localhost/mw/api.php" id="mediawikiapi"></a><input id="startpage" value="Bienvenue à l’erg" autofocus /><button id="button">ok</button>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
||||||
|
</div>
|
||||||
|
<div id="wiki">
|
||||||
|
<iframe src="http://localhost/mw/"></iframe>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript" src="dist/wikimap.js"></script>
|
||||||
|
<script>
|
||||||
|
var mediawikiapi = document.querySelector("#mediawikiapi").href,
|
||||||
|
startpage = document.querySelector("#startpage"),
|
||||||
|
button = document.querySelector("#button"),
|
||||||
|
svg = document.querySelector("#svg"),
|
||||||
|
iframe = document.querySelector("iframe");
|
||||||
|
|
||||||
|
window.addEventListener("resize", resize);
|
||||||
|
function resize() {
|
||||||
|
var w = window,
|
||||||
|
d = document,
|
||||||
|
e = d.documentElement,
|
||||||
|
g = d.getElementsByTagName('body')[0],
|
||||||
|
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||||
|
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
||||||
|
svg.setAttribute("width", x);
|
||||||
|
svg.setAttribute("height", y);
|
||||||
|
console.log("resize", x, y);
|
||||||
|
}
|
||||||
|
resize();
|
||||||
|
// console.log("mediawikiapi", mediawikiapi);
|
||||||
|
var map = new wikimap.Map(mediawikiapi);
|
||||||
|
map.init_svg("#svg");
|
||||||
|
map.on("page", function (title) {
|
||||||
|
console.log("map.page", title);
|
||||||
|
var url = wiki_title_to_url(title);
|
||||||
|
iframe.src = url;
|
||||||
|
})
|
||||||
|
async function doload() {
|
||||||
|
map.set_active_node(startpage.value);
|
||||||
|
}
|
||||||
|
var URLPAT = new RegExp("http://localhost/mw/index.php/(.+)");
|
||||||
|
function strip_fragment (href) {
|
||||||
|
var spos = href.indexOf("#");
|
||||||
|
if (spos >= 0) {
|
||||||
|
return href.substr(0, href.indexOf("#"))
|
||||||
|
}
|
||||||
|
return href;
|
||||||
|
}
|
||||||
|
function url_to_wiki_title (href) {
|
||||||
|
href = strip_fragment(href);
|
||||||
|
var m = URLPAT.exec(href);
|
||||||
|
if (m !== null) {
|
||||||
|
return decodeURI(m[1]).replace(/_/g, " ");
|
||||||
|
}
|
||||||
|
console.log("m", m);
|
||||||
|
}
|
||||||
|
function wiki_title_to_url (title) {
|
||||||
|
return "http://localhost/mw/index.php/"+encodeURI(title.replace(/ /g, "_"));
|
||||||
|
}
|
||||||
|
// window.addEventListener("DOMContentLoaded", doload);
|
||||||
|
button.addEventListener("click", doload);
|
||||||
|
iframe.addEventListener("load", function () {
|
||||||
|
var href = strip_fragment(iframe.contentWindow.location.href);
|
||||||
|
console.log("iframe loaded", href);
|
||||||
|
var title = url_to_wiki_title(href);
|
||||||
|
console.log("title", title);
|
||||||
|
if (title) {
|
||||||
|
map.set_active_title(title);
|
||||||
|
}
|
||||||
|
// attempt to map url to wiki page title and update the map if it is one
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</html>
|
||||||
93
index.html
93
index.html
@@ -4,25 +4,50 @@
|
|||||||
<title></title>
|
<title></title>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
<style>
|
||||||
|
#wiki {
|
||||||
|
left: 66%;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<a href="http://localhost/mw/api.php" id="mediawikiapi"></a><input id="startpage" value="Bienvenue à l’erg" autofocus /><button id="button">ok</button>
|
<a href="http://mw/api.php" id="mediawikiapi"></a><input id="startpage" value="Bienvenue à l’erg" autofocus /><button id="button">ok</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
||||||
</div>
|
</div>
|
||||||
<div id="wiki">
|
<div id="wiki">
|
||||||
<iframe src="http://localhost/mw/"></iframe>
|
<iframe src="/mw/"></iframe>
|
||||||
|
</div>
|
||||||
|
<div id="cats" class="expanded">
|
||||||
|
<div class="ocontents">
|
||||||
|
<div class="contents">
|
||||||
|
<div class="head">Liste des catégories</div>
|
||||||
|
<div class="body"></div>
|
||||||
|
<div class="foot"><input id="allcats" type="checkbox"><label for="allcats">Afficher tous</label></div>
|
||||||
|
<hr>
|
||||||
|
<div class="history"><input id="history" type="checkbox"><label for="history">Histoire</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="botright"><div class="thumb"></div></div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script type="text/javascript" src="dist/wikimap.js"></script>
|
<script type="text/javascript" src="dist/wikimaptotal.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var mediawikiapi = document.querySelector("#mediawikiapi").href,
|
var mediawikiapi = document.querySelector("#mediawikiapi").href,
|
||||||
startpage = document.querySelector("#startpage"),
|
startpage = document.querySelector("#startpage"),
|
||||||
button = document.querySelector("#button"),
|
button = document.querySelector("#button"),
|
||||||
svg = document.querySelector("#svg"),
|
svg = document.querySelector("#svg"),
|
||||||
iframe = document.querySelector("iframe");
|
iframe = document.querySelector("iframe"),
|
||||||
|
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;
|
||||||
|
|
||||||
window.addEventListener("resize", resize);
|
window.addEventListener("resize", resize);
|
||||||
function resize() {
|
function resize() {
|
||||||
@@ -38,17 +63,39 @@
|
|||||||
}
|
}
|
||||||
resize();
|
resize();
|
||||||
// console.log("mediawikiapi", mediawikiapi);
|
// console.log("mediawikiapi", mediawikiapi);
|
||||||
var map = new wikimap.Map(mediawikiapi);
|
var symbols = {
|
||||||
|
"Orientations": "symbols.svg#Orientations",
|
||||||
|
"Ateliers pluridisciplinaires": "symbols.svg#Ateliers_pluridisciplinaires",
|
||||||
|
"Cours de soutien à l'orientation": "symbols.svg#Cours_de_soutien_a_l'orientation",
|
||||||
|
"Cours de soutien spécifique": "symbols.svg#Cours_de_soutien_specifique",
|
||||||
|
"Cours techniques": "symbols.svg#Cours_techniques",
|
||||||
|
"Cours théoriques": "symbols.svg#Cours_theoriques",
|
||||||
|
"Enseignants": "symbols.svg#Enseignants",
|
||||||
|
"default": "symbols.svg#Main"
|
||||||
|
};
|
||||||
|
var map = new wikimap.SimpleMap(symbols);
|
||||||
map.init_svg("#svg");
|
map.init_svg("#svg");
|
||||||
|
async function doload () {
|
||||||
|
console.log("loading map");
|
||||||
|
await map.load_json("sitemap.json");
|
||||||
|
console.log("loading categories");
|
||||||
|
await map.load_cats("cats.json", cats_contents);
|
||||||
|
console.log("LOADED!");
|
||||||
|
loaded = true;
|
||||||
|
if (current_title) {
|
||||||
|
map.set_active_title(current_title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
map.on("page", function (title) {
|
map.on("page", function (title) {
|
||||||
console.log("map.page", title);
|
console.log("map.page", title);
|
||||||
var url = wiki_title_to_url(title);
|
var url = wiki_title_to_url(title);
|
||||||
iframe.src = url;
|
iframe.src = url;
|
||||||
})
|
})
|
||||||
async function doload() {
|
// async function doload() {
|
||||||
map.set_active_node(startpage.value);
|
// map.set_active_node(startpage.value);
|
||||||
}
|
// }
|
||||||
var URLPAT = new RegExp("http://localhost/mw/index.php/(.+)");
|
var URLPAT = new RegExp("http://wiki.erg.be/mw/index.php/(.+)");
|
||||||
function strip_fragment (href) {
|
function strip_fragment (href) {
|
||||||
var spos = href.indexOf("#");
|
var spos = href.indexOf("#");
|
||||||
if (spos >= 0) {
|
if (spos >= 0) {
|
||||||
@@ -65,20 +112,42 @@
|
|||||||
console.log("m", m);
|
console.log("m", m);
|
||||||
}
|
}
|
||||||
function wiki_title_to_url (title) {
|
function wiki_title_to_url (title) {
|
||||||
return "http://localhost/mw/index.php/"+encodeURI(title.replace(/ /g, "_"));
|
return "http://wiki.erg.be/mw/index.php/"+encodeURI(title.replace(/ /g, "_"));
|
||||||
}
|
}
|
||||||
// window.addEventListener("DOMContentLoaded", doload);
|
window.addEventListener("DOMContentLoaded", doload);
|
||||||
button.addEventListener("click", doload);
|
|
||||||
iframe.addEventListener("load", function () {
|
iframe.addEventListener("load", function () {
|
||||||
var href = strip_fragment(iframe.contentWindow.location.href);
|
var href = strip_fragment(iframe.contentWindow.location.href);
|
||||||
console.log("iframe loaded", href);
|
console.log("iframe loaded", href);
|
||||||
var title = url_to_wiki_title(href);
|
var title = url_to_wiki_title(href);
|
||||||
console.log("title", title);
|
console.log("title", title);
|
||||||
if (title) {
|
if (title) {
|
||||||
|
current_title = title;
|
||||||
|
if (loaded) {
|
||||||
map.set_active_title(title);
|
map.set_active_title(title);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// attempt to map url to wiki page title and update the map if it is one
|
// attempt to map url to wiki page title and update the map if it is one
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
cats_thumb.addEventListener("click", function () {
|
||||||
|
cats.classList.toggle("expanded");
|
||||||
|
});
|
||||||
|
// allcats checkbox
|
||||||
|
// match current state & respond to change events
|
||||||
|
// console.log("setting checked to", cats.classList.contains("showall"))
|
||||||
|
allcatscb.checked = cats.classList.contains("showall");
|
||||||
|
allcatscb.addEventListener("change", function () {
|
||||||
|
// console.log("allcats", allcatscb);
|
||||||
|
if (allcatscb.checked) {
|
||||||
|
cats.classList.add("showall")
|
||||||
|
} else {
|
||||||
|
cats.classList.remove("showall")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
historycb.addEventListener("change", function () {
|
||||||
|
// console.log("history", historycb.checked);
|
||||||
|
map.set_show_history(historycb.checked);
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
153
map.html
153
map.html
@@ -1,153 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
|
||||||
<style>
|
|
||||||
#wiki {
|
|
||||||
left: 66%;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="controls">
|
|
||||||
<a href="http://mw/api.php" id="mediawikiapi"></a><input id="startpage" value="Bienvenue à l’erg" autofocus /><button id="button">ok</button>
|
|
||||||
</div>
|
|
||||||
<div id="content">
|
|
||||||
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
|
|
||||||
</div>
|
|
||||||
<div id="wiki">
|
|
||||||
<iframe src="/mw/"></iframe>
|
|
||||||
</div>
|
|
||||||
<div id="cats" class="expanded">
|
|
||||||
<div class="ocontents">
|
|
||||||
<div class="contents">
|
|
||||||
<div class="head">Liste des catégories</div>
|
|
||||||
<div class="body"></div>
|
|
||||||
<div class="foot"><input id="allcats" type="checkbox"><label for="allcats">Afficher tous</label></div>
|
|
||||||
<hr>
|
|
||||||
<div class="history"><input id="history" type="checkbox"><label for="history">Histoire</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="botright"><div class="thumb"></div></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<script type="text/javascript" src="dist/wikimaptotal.js"></script>
|
|
||||||
<script>
|
|
||||||
var mediawikiapi = document.querySelector("#mediawikiapi").href,
|
|
||||||
startpage = document.querySelector("#startpage"),
|
|
||||||
button = document.querySelector("#button"),
|
|
||||||
svg = document.querySelector("#svg"),
|
|
||||||
iframe = document.querySelector("iframe"),
|
|
||||||
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;
|
|
||||||
|
|
||||||
window.addEventListener("resize", resize);
|
|
||||||
function resize() {
|
|
||||||
var w = window,
|
|
||||||
d = document,
|
|
||||||
e = d.documentElement,
|
|
||||||
g = d.getElementsByTagName('body')[0],
|
|
||||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
|
||||||
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
|
||||||
svg.setAttribute("width", x);
|
|
||||||
svg.setAttribute("height", y);
|
|
||||||
console.log("resize", x, y);
|
|
||||||
}
|
|
||||||
resize();
|
|
||||||
// console.log("mediawikiapi", mediawikiapi);
|
|
||||||
var symbols = {
|
|
||||||
"Orientations": "symbols.svg#Orientations",
|
|
||||||
"Ateliers pluridisciplinaires": "symbols.svg#Ateliers_pluridisciplinaires",
|
|
||||||
"Cours de soutien à l'orientation": "symbols.svg#Cours_de_soutien_a_l'orientation",
|
|
||||||
"Cours de soutien spécifique": "symbols.svg#Cours_de_soutien_specifique",
|
|
||||||
"Cours techniques": "symbols.svg#Cours_techniques",
|
|
||||||
"Cours théoriques": "symbols.svg#Cours_theoriques",
|
|
||||||
"Enseignants": "symbols.svg#Enseignants",
|
|
||||||
"default": "symbols.svg#Main"
|
|
||||||
};
|
|
||||||
var map = new wikimap.SimpleMap(symbols);
|
|
||||||
map.init_svg("#svg");
|
|
||||||
async function doload () {
|
|
||||||
console.log("loading map");
|
|
||||||
await map.load_json("sitemap.json");
|
|
||||||
console.log("loading categories");
|
|
||||||
await map.load_cats("cats.json", cats_contents);
|
|
||||||
console.log("LOADED!");
|
|
||||||
loaded = true;
|
|
||||||
if (current_title) {
|
|
||||||
map.set_active_title(current_title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
map.on("page", function (title) {
|
|
||||||
console.log("map.page", title);
|
|
||||||
var url = wiki_title_to_url(title);
|
|
||||||
iframe.src = url;
|
|
||||||
})
|
|
||||||
// async function doload() {
|
|
||||||
// map.set_active_node(startpage.value);
|
|
||||||
// }
|
|
||||||
var URLPAT = new RegExp("http://wiki.erg.be/mw/index.php/(.+)");
|
|
||||||
function strip_fragment (href) {
|
|
||||||
var spos = href.indexOf("#");
|
|
||||||
if (spos >= 0) {
|
|
||||||
return href.substr(0, href.indexOf("#"))
|
|
||||||
}
|
|
||||||
return href;
|
|
||||||
}
|
|
||||||
function url_to_wiki_title (href) {
|
|
||||||
href = strip_fragment(href);
|
|
||||||
var m = URLPAT.exec(href);
|
|
||||||
if (m !== null) {
|
|
||||||
return decodeURI(m[1]).replace(/_/g, " ");
|
|
||||||
}
|
|
||||||
console.log("m", m);
|
|
||||||
}
|
|
||||||
function wiki_title_to_url (title) {
|
|
||||||
return "http://wiki.erg.be/mw/index.php/"+encodeURI(title.replace(/ /g, "_"));
|
|
||||||
}
|
|
||||||
window.addEventListener("DOMContentLoaded", doload);
|
|
||||||
iframe.addEventListener("load", function () {
|
|
||||||
var href = strip_fragment(iframe.contentWindow.location.href);
|
|
||||||
console.log("iframe loaded", href);
|
|
||||||
var title = url_to_wiki_title(href);
|
|
||||||
console.log("title", title);
|
|
||||||
if (title) {
|
|
||||||
current_title = title;
|
|
||||||
if (loaded) {
|
|
||||||
map.set_active_title(title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// attempt to map url to wiki page title and update the map if it is one
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
cats_thumb.addEventListener("click", function () {
|
|
||||||
cats.classList.toggle("expanded");
|
|
||||||
});
|
|
||||||
// allcats checkbox
|
|
||||||
// match current state & respond to change events
|
|
||||||
// console.log("setting checked to", cats.classList.contains("showall"))
|
|
||||||
allcatscb.checked = cats.classList.contains("showall");
|
|
||||||
allcatscb.addEventListener("change", function () {
|
|
||||||
// console.log("allcats", allcatscb);
|
|
||||||
if (allcatscb.checked) {
|
|
||||||
cats.classList.add("showall")
|
|
||||||
} else {
|
|
||||||
cats.classList.remove("showall")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
historycb.addEventListener("change", function () {
|
|
||||||
// console.log("history", historycb.checked);
|
|
||||||
map.set_show_history(historycb.checked);
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user