Kategorie:Hauptkategorie: Unterschied zwischen den Versionen
Aus ZELDA RPG
Zeile 2: | Zeile 2: | ||
{{Kategorien-Index}} | {{Kategorien-Index}} | ||
− | {{ | + | function addlilink(url, name) |
+ | { | ||
+ | var na = document.createElement('a'); | ||
+ | na.setAttribute('href', url); | ||
+ | |||
+ | var txt = document.createTextNode(name); | ||
+ | na.appendChild(txt); | ||
+ | |||
+ | var li = document.createElement('li'); | ||
+ | li.appendChild(na); | ||
+ | return li; | ||
+ | } | ||
+ | |||
+ | // Gets the URL version of the page title. | ||
+ | function get_tidy_title() | ||
+ | { | ||
+ | var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; | ||
+ | // cut everything up to "title=" from the start and everything past "&action=edit" from the end | ||
+ | editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); | ||
+ | |||
+ | return editlk; | ||
+ | } | ||
+ | |||
+ | // Adds "catgraph" tabs to pages. | ||
+ | function add_category_tab() | ||
+ | { | ||
+ | var c1 = document.getElementById('column-one'); | ||
+ | var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; | ||
+ | |||
+ | // use the "edit this page" tab to get already-tidied url | ||
+ | var editlk = get_tidy_title(); | ||
+ | var editlko = get_tidy_title(); | ||
+ | |||
+ | editlk = editlk.substring(editlk.indexOf(':') + 1); | ||
+ | var slloc = editlk.indexOf('/'); | ||
+ | if (slloc > 0) | ||
+ | editlk = editlk.substring(0, slloc); | ||
+ | |||
+ | // add "Obergraph" tab | ||
+ | // [http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat={{BASEPAGENAMEE}}&format=png&links=1 png] | ||
+ | tabs.appendChild(addlilink('http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat=' + editlk + '&format=svg&links=wiki', 'Obergraph')); | ||
+ | |||
+ | // add "untergraph" tab | ||
+ | //[http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat={{BASEPAGENAMEE}}&format=png&links=1&sub=1 svg] | ||
+ | tabs.appendChild(addlilink('http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat=' + editlk + '&format=svg&links=wiki&sub=1', 'Untergraph')); | ||
+ | |||
+ | } | ||
+ | |||
+ | // Add links on load | ||
+ | function do_onload() | ||
+ | { | ||
+ | var title = get_tidy_title(); | ||
+ | if (document.title.indexOf('Category:') == 0 | ||
+ | || document.title.indexOf('Kategorie:') == 0) | ||
+ | { | ||
+ | add_category_tab(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Hock on load function | ||
+ | if (window.addEventListener) | ||
+ | window.addEventListener("load", do_onload, false); | ||
+ | else if (window.attachEvent) | ||
+ | window.attachEvent("onload", do_onload); |
Version vom 24. März 2019, 17:06 Uhr
Mit dem Dreieck kannst du einen Kategorienbaum zu den Hauptkategorien öffnen.
function addlilink(url, name) {
var na = document.createElement('a'); na.setAttribute('href', url); var txt = document.createTextNode(name); na.appendChild(txt); var li = document.createElement('li'); li.appendChild(na); return li;
}
// Gets the URL version of the page title. function get_tidy_title() {
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; // cut everything up to "title=" from the start and everything past "&action=edit" from the end editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); return editlk;
}
// Adds "catgraph" tabs to pages. function add_category_tab() {
var c1 = document.getElementById('column-one'); var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; // use the "edit this page" tab to get already-tidied url var editlk = get_tidy_title(); var editlko = get_tidy_title(); editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if (slloc > 0) editlk = editlk.substring(0, slloc); // add "Obergraph" tab // png tabs.appendChild(addlilink('http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat=' + editlk + '&format=svg&links=wiki', 'Obergraph'));
// add "untergraph" tab //svg tabs.appendChild(addlilink('http://tools.wikimedia.de/~dapete/catgraph/graph.php?wiki=dewiki&cat=' + editlk + '&format=svg&links=wiki&sub=1', 'Untergraph'));
}
// Add links on load function do_onload() {
var title = get_tidy_title(); if (document.title.indexOf('Category:') == 0 || document.title.indexOf('Kategorie:') == 0) { add_category_tab(); }
}
// Hock on load function if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);
Unterkategorien
Diese Kategorie enthält die folgende 12 Unterkategorien, von 12 insgesamt.