Kategorien
MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
KKeine Bearbeitungszusammenfassung |
Bwoebi (Diskussion | Beiträge) (Favicon wird direkt in der Mediawiki Konfiguration gesetzt nun) |
||
(85 dazwischenliegende Versionen von 7 Benutzern werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
/* | /*********************************************************************/ | ||
== | /* Common.js enthält gemeinsamen JavaScript-Code für alle Benutzer. */ | ||
/* Jedes JavaScript, dass sich in dieser Seite befindet, wird für */ | |||
/* alle Benutzer geladen. Daher bitte mit Vorsicht bearbeiten! */ | |||
/*****************************************************************/ | |||
//============================================================= | |||
/*** BEGIN: Anpassung für die Navigationsleisten ***/ | |||
// Sprachdefinition | |||
var NavigationBarHide = 'Einklappen'; | |||
var NavigationBarShow = 'Ausklappen'; | |||
/** | |||
* Maximale Anzahl an Navigationsleisten pro Seite. | |||
* Gibt es auf einer Seite mehr, werden diese automatisch versteckt! | |||
* var NavigationBarShowDefault = 0; // Alle Navigationsleisten werden versteckt | |||
* var NavigationBarShowDefault = 1; // Alle außer die erste Navigationsleiste werden versteckt | |||
**/ | |||
var NavigationBarShowDefault = 1; | |||
/** | |||
* Zeigt und versteckt den Inhalt und das Bild der Navigationsleiste | |||
* Parameter: | |||
* indexNavigationBar: Index der Navigationsleiste | |||
**/ | |||
function toggleNavigationBar(indexNavigationBar) { | |||
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); | |||
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); | |||
if (!NavFrame || !NavToggle) { | |||
return false; | |||
} | |||
// Verstecken, wenn die Leiste derzeit gezeigt wird | |||
if (NavToggle.firstChild.data == NavigationBarHide) { | |||
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { | |||
if (NavChild.className == 'NavPic') { | |||
NavChild.style.display = 'none'; | |||
} | |||
if (NavChild.className == 'NavContent') { | |||
NavChild.style.display = 'none'; | |||
} | |||
if (NavChild.className == 'NavToggle') { | |||
NavChild.firstChild.data = NavigationBarShow; | |||
} | |||
} | |||
// Anzeigen, wenn die Leiste derzeit versteckt ist | |||
} else if (NavToggle.firstChild.data == NavigationBarShow) { | |||
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { | |||
if (NavChild.className == 'NavPic') { | |||
NavChild.style.display = 'block'; | |||
} | |||
if (NavChild.className == 'NavContent') { | |||
NavChild.style.display = 'block'; | |||
} | |||
if (NavChild.className == 'NavToggle') { | |||
NavChild.firstChild.data = NavigationBarHide; | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* Fügt Anzeigen/Verstecken-Link zur Navigationsleiste hinzu | |||
*/ | */ | ||
function createNavigationBarToggleButton() { | |||
var indexNavigationBar = 0; | |||
// Auf alle div-Elemente anwenden | |||
for (var i = 0; NavFrame = document.getElementsByTagName("div")[i]; i++) { | |||
// Wenn eine Navigationsleiste gefunden wurde | |||
if (NavFrame.className == "NavFrame") { | |||
indexNavigationBar++; | |||
var NavToggle = document.createElement("a"); | |||
NavToggle.className = 'NavToggle'; | |||
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); | |||
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); | |||
var NavToggleText = document.createTextNode(NavigationBarHide); | |||
NavToggle.appendChild(NavToggleText); | |||
// Füge die Links als erstes div-Element hinzu | |||
NavFrame.insertBefore(NavToggle, NavFrame.firstChild); | |||
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); | |||
} | |||
} | |||
// Wenn mehrere Navigationsleisten gefunden wurden, dann wird versteckt | |||
if (NavigationBarShowDefault < indexNavigationBar) { | |||
for (var i = 1; i <= indexNavigationBar; i++) { | |||
toggleNavigationBar(i); | |||
} | |||
} | |||
} | |||
// Lade createNavigationBarToggleButton() nach Laden der Seite | |||
jQuery( document ).ready( function( $ ) { | |||
createNavigationBarToggleButton(); | |||
} ); | |||
//addOnloadHook(createNavigationBarToggleButton); | |||
/*** ENDE: Anpassung für die Navigationsleisten ***/ | |||
//============================================================= | |||
/*** Kampfrechner ***/ | |||
// Ist in [[MediaWiki:Kampfrechner.js]] ausgelagert | |||
// Wird nur auf der Seite [[Kampfrechner]] aufgerufen | |||
if (mw.config.get('wgTitle') === 'Kampfrechner') { | |||
mw.loader.load('/index.php?title=MediaWiki:Kampfrechner.js&action=raw&ctype=text/javascript'); | |||
//importScript("MediaWiki:Kampfrechner.js"); | |||
} | |||
/*** ENDE: Kampfrechner ***/ | |||
/*** Kartenspezifisches ***/ | |||
// Gesamtkarten-Funktionen | |||
// Autorouter: Ist in [[MediaWiki:Autorouter.js]] ausgelagert | |||
// Gesamtkarte-Funktionen: Sind in [[MediaWiki:Gesamtkarte.js]] ausgelagert | |||
// Werden nur auf der Seite [[Gesamtkarte]] aufgerufen | |||
if (mw.config.get('wgTitle') === 'Gesamtkarte') { | |||
mw.loader.load('/index.php?title=MediaWiki:Gesamtkarte.js&action=raw&ctype=text/javascript'); | |||
//importScript("MediaWiki:Gesamtkarte.js"); | |||
mw.loader.load('/index.php?title=MediaWiki:Autorouter.js&action=raw&ctype=text/javascript'); | |||
//importScript("MediaWiki:Autorouter.js"); | |||
} | |||
/** | |||
* Zeigt/Versteckt Questpassage auf interkativer Karte | |||
* Parameter: | |||
* bool: Wenn wahr, Questpassage anzeigen, wenn falsch, dann nicht | |||
*/ | |||
function showQP(bool) { | |||
if (bool) { | |||
document.cookie = "tiramon_deShowQP=1"; | |||
} else { | |||
document.cookie = "tiramon_deShowQP=0"; | |||
} | |||
location.reload(); | |||
} | |||
/** | |||
* Generalfunktion, arbeitet an allen Questpassagen | |||
*/ | */ | ||
function work_on_questpassages() { | |||
// Fügt den Anzeigen/Verstecken-Link zur Map hinzu | |||
findmenu = document.getElementById("QPinout"); | |||
if (findmenu) { | |||
showlink = document.createElement("a"); | |||
showlink.setAttribute("href","Javascript:showQP(true)"); | |||
showlink.appendChild(document.createTextNode('anzeigen')); | |||
hidelink = document.createElement("a"); | |||
hidelink.setAttribute("href","Javascript:showQP(false)"); | |||
hidelink.appendChild(document.createTextNode('verbergen')); | |||
findmenu.appendChild(showlink); | |||
findmenu.appendChild(document.createTextNode('/')); | |||
findmenu.appendChild(hidelink); | |||
} | |||
// Questpassagen anzeigen, wenn gewünscht | |||
for (var i = 0; foundspan = document.getElementsByTagName("span")[i]; i++) { | |||
var tiramon_deShowQP = document.cookie; | |||
if (tiramon_deShowQP.indexOf("tiramon_deShowQP=")=="-1") return(-1); | |||
if (tiramon_deShowQP.charAt(tiramon_deShowQP.indexOf("tiramon_deShowQP=")+17) != "1") return(-1); | |||
if (foundspan.className == "QP") { | |||
foundspan.setAttribute("style", "display:inline;"); | |||
} | |||
} | |||
} | |||
// Starte work_on_questpassages() nach Laden der Seite | |||
jQuery( document ).ready( function( $ ) { | |||
work_on_questpassages(); | |||
} ); | |||
//addOnloadHook(work_on_questpassages); | |||
/*** ENDE: Kartenspezifisches ***/ | |||
//============================================================= | |||
/*** NPC-Bilder ***/ | |||
/** | |||
* Zeigt/Versteckt NPC-Bilder | |||
* Parameter: | |||
* bool: Wenn wahr, NPC-Bilder anzeigen, wenn falsch, dann nicht | |||
*/ | |||
function showNI(bool) | |||
{ | |||
var DaysToExpire = 300; // Cookie wird nach so vielen Tagen gelöscht | |||
var ExpireDate = new Date(); | |||
ExpireDate.setTime((ExpireDate.getTime() + DaysToExpire * 24 * 60 * 60 * 1000)); | |||
if (bool) { | |||
document.cookie="tiramon_deShowNI=1; expires=" + ExpireDate.toGMTString(); | |||
} else { | |||
document.cookie="tiramon_deShowNI=0; expires=" + ExpireDate.toGMTString(); | |||
} | |||
location.reload(); | |||
} | |||
function | /** | ||
* Generalfunktion, arbeitet an allen NPC-Bildern | |||
*/ | |||
function work_on_npcimages() | |||
{ | |||
// Füge Anzeigen/Verstecken-Link hinzu | |||
findmenu = document.getElementById("NIinout"); | |||
if (findmenu) { | |||
showlink=document.createElement("a"); | |||
showlink.setAttribute("href","Javascript:showNI(true)"); | |||
showlink.appendChild(document.createTextNode('anzeigen')); | |||
hidelink=document.createElement("a"); | |||
hidelink.setAttribute("href","Javascript:showNI(false)"); | |||
hidelink.appendChild(document.createTextNode('verbergen')); | |||
findmenu.appendChild(showlink); | |||
findmenu.appendChild(document.createTextNode('/')); | |||
findmenu.appendChild(hidelink); | |||
} | |||
// Standardwert des Anzeigemodus | |||
var NIDisplaymode = "inline"; | |||
// Frage gespeicherten Anzeigemodus ab | |||
var tiramon_deShowNI=document.cookie; | |||
if (tiramon_deShowNI.indexOf("tiramon_deShowNI=") != "-1") { | |||
if (tiramon_deShowNI.charAt(tiramon_deShowNI.indexOf("tiramon_deShowNI=")+17)!="1") NIDisplaymode = "none"; | |||
} | |||
for (var i = 0; foundspan = document.getElementsByTagName("span")[i]; i++) { | |||
if (foundspan.className == "NI") { | |||
foundspan.setAttribute("style", "display:" + NIDisplaymode +";"); | |||
} | |||
} | |||
} | } | ||
// Starte work_on_npcimages() nach Laden der Seite | |||
jQuery( document ).ready( function( $ ) { | |||
work_on_npcimages(); | |||
} ); | |||
//addOnloadHook(work_on_npcimages); | |||
/*** ENDE: NPC-Bilder ***/ | |||
//============================================================= | |||
/*** Charakterfähigkeiten ***/ | |||
// Ist in [[MediaWiki:CFoptions.js]] ausgelagert | |||
mw.loader.load('/index.php?title=MediaWiki:CFoptions.js&action=raw&ctype=text/javascript'); | |||
//importScript("MediaWiki:CFoptions.js"); | |||
/*** ENDE: Charakterfähigkeiten ***/ | |||
//============================================================= | |||
/*** Vertikale Tabs ***/ | |||
// Variablendefinition | |||
var shownTab = Array(); | |||
var disabledLink = Array(); | |||
/** | |||
* Änderung des aktuell ausgewählten Tabs | |||
*/ | */ | ||
function showVTab(area, tab) { | |||
var div = document.getElementById('VTabContent_' + String(area) + '_' + String(tab)); | |||
var a = document.getElementById('VTabLink_' + String(area) + '_' + String(tab)); | |||
if (!div || !a) return; | |||
div.style.height = 'auto'; | |||
if (shownTab[area]) shownTab[area].style.height = '0'; | |||
shownTab[area] = div; | |||
var strong = document.getElementById('VTabStrong_' + String(area)); | |||
if (!strong) { | |||
strong = document.createElement('strong'); | |||
strong.id = 'VTabStrong_' + String(area); | |||
strong.className = 'selflink'; | |||
} | |||
if (disabledLink[area]) { | |||
disabledLink[area].appendChild(strong.firstChild); | |||
strong.parentNode.appendChild(disabledLink[area]); | |||
} | |||
strong.appendChild(a.firstChild); | |||
a.parentNode.appendChild(strong); | |||
a.parentNode.removeChild(a); | |||
disabledLink[area] = a; | |||
} | |||
/** | |||
* Initialisiert vertikale Tabs | |||
*/ | */ | ||
function initVTabs() { | |||
var indexVTabs = 0; | |||
for (var i = 0; table = document.getElementsByTagName('table')[i]; i++) { | |||
if (table.className != 'VTabs') continue; | |||
table.id = 'VTabs_' + String(++indexVTabs); | |||
shownTab[indexVTabs] = disabledLink[indexVTabs] = 0; | |||
var numTabs = 0; | |||
var contents; | |||
for (var j = 0; tr = table.getElementsByTagName('tr')[j]; j++) { | |||
var caption = tr.getElementsByTagName('td')[0]; | |||
caption.className = 'VTabCaption'; | |||
caption.id = 'VTabCaption_' + String(indexVTabs) + '_' + String(++numTabs); | |||
var a = document.createElement('a'); | |||
a.id = 'VTabLink_' + String(indexVTabs) + '_' + String(++numTabs); | |||
a.href = 'javascript:showVTab(' + String(indexVTabs) + ', ' + String(numTabs) + ');'; | |||
a.appendChild(caption.firstChild); | |||
caption.appendChild(a); | |||
var content = tr.getElementsByTagName('td')[1]; | |||
var div = document.createElement('div'); | |||
div.className = 'VTabContent'; | |||
div.id = 'VTabContent_' + String(indexVTabs) + '_' + String(numTabs); | |||
while (content.childNodes.length) { | |||
div.appendChild(content.childNodes[0]); | |||
} | |||
if (contents) { | |||
tr.removeChild(content); | |||
} else { | |||
contents = content | |||
} | |||
contents.rowSpan = numTabs; | |||
contents.appendChild(div); | |||
} | |||
} | |||
} | |||
// Starte initVTabs() nach Laden der Seite | |||
jQuery( document ).ready( function( $ ) { | |||
initVTabs(); | |||
} ); | |||
//addOnloadHook(initVTabs); | |||
/*** ENDE: Vertikale Tabs ***/ | |||
/* 8. ANFANG: NPC Filter für Karten */ | |||
function resetNPCBordersOnMap () | |||
{ | |||
/* Entferne Klasse und setze somit CSS-Einstellungen wieder zurück */ | |||
$("body.ns-108 .maplink div.noIE > a").parent().parent().removeClass("MapNPCBorder"); | |||
} | |||
function showNPCBordersOnMap (npcName) | |||
{ | |||
/* Vergleiche NPC-Name mit jedem einzelnen NPC-Namen der in der Karte eingetragen ist, falls ja, dann zeiche Rahmen um das entsprechende Feld mittels der Klasse MapNPCBorder */ | |||
var NPCMapCounter = 0; | |||
$("body.ns-108 .maplink div.noIE > a > span.NPC").each(function(){ | |||
if ($(this).text().toLowerCase() == npcName.toLowerCase()) // Case-Insensitive Prüfung | |||
{ | |||
$(this).parent().parent().parent().addClass("MapNPCBorder"); | |||
NPCMapCounter++; | |||
} | |||
}); | |||
/* Zeige zur zusätzlichen Information, wie viele Rahmen bzw. NPCs es jetzt auf dieser Karte gibt */ | |||
$("#map_redZK #mapNPCCount").text(NPCMapCounter); | |||
} | |||
function initNPCBordersAndLinks () | |||
{ | |||
/* Füge Links mit Kugelsymbol hinzu (NPC-Artikel) */ | |||
$("body.ns-0 .layout_npc .layout_npc_location > p > b:contains('Vorkommen:')").parent().parent().find("p + ul > li, p:first-child ~ p").each(function(){ | |||
if ($(this).find("a").hasClass("new")) | |||
return; | |||
switch ($(this).find("a").attr("title")) | |||
{ | |||
case "Welt": case "Oberfläche": case "Dungeon": | |||
return; | |||
default: | |||
$(this).append("<span class='linktomap'><a href='/index.php/Karte:"+$(this).find("a").attr("title").replace(/ /g, "_") + "#MapNPCFilter_" + $("#firstHeading").text()+"' style='display: inline-block; height: 12px; width: 12px; overflow:hidden;'> </a></span>"); | |||
} | |||
}); | |||
/* Erstelle Eingabefeld (Karten-Artikel) */ | |||
$("body.ns-108 #map_redZK").append("<br /><input type='text' name='findeNPC' /> <a href='#'>NPC suchen</a><br /><span id='mapNPCCount'>0</span> NPCs wurden gefunden"); | |||
/* Starte NPC-Suche, bei Klick auf den NPC-Suchen-Link */ | |||
$("body.ns-108 #map_redZK > input[name='findeNPC'] + a").click(function(){ | |||
var NPCname = $(this).parent().find("input[name='findeNPC']").val(); | |||
resetNPCBordersOnMap(); | |||
showNPCBordersOnMap(NPCname); | |||
$(this).attr("href","#MapNPCFilter_"+NPCname); | |||
}); | |||
/* Automatisches Absenden des Forms mit der Enter-Taste */ | |||
$("body.ns-108 #map_redZK > input[name='findeNPC']").keypress(function(e) { | |||
if(e && e.which == 13) | |||
{ | |||
$(this).next().click(); | |||
window.location.replace("#MapNPCFilter_"+$(this).val()); | |||
} | |||
}); | |||
/* Wenn der Hash schon zum Ladezeitpunkt mit "#MapNPCFilter_" beginnt, direkt nach NPC suchen und im Formular eintragen */ | |||
if (window.location.hash.substr(0,14) == "#MapNPCFilter_") | |||
{ | |||
var NPCname = window.location.hash.substr(14); | |||
/* NPC-Namen in URLs können kodiert sein, z.B. wird Leerzeichen zu %20*/ | |||
NPCname = decodeURI(NPCname); | |||
showNPCBordersOnMap(NPCname); | |||
$("body.ns-108 #map_redZK > input[name='findeNPC']").val(NPCname); | |||
} | |||
} | |||
jQuery( document ).ready( function( $ ) { | |||
initNPCBordersAndLinks(); | |||
} ); | |||
//addOnloadHook(initNPCBordersAndLinks); | |||
/* ENDE: NPC Filter für Karten */ | |||
//==Schnee== | |||
// Outsourced to [[MediaWiki:Schnee.js]] | |||
/* DEAKTIVIERT (für Weihnachtszeit gedacht) | |||
if (mw.config.get('wgTitle') === 'Hauptseite') { | |||
mw.loader.load('/index.php?title=MediaWiki:Schnee.js&action=raw&ctype=text/javascript'); | |||
//importScript("MediaWiki:Schnee.js"); | |||
} | |||
*/ |
Aktuelle Version vom 11. Dezember 2023, 17:01 Uhr
/*********************************************************************/ /* Common.js enthält gemeinsamen JavaScript-Code für alle Benutzer. */ /* Jedes JavaScript, dass sich in dieser Seite befindet, wird für */ /* alle Benutzer geladen. Daher bitte mit Vorsicht bearbeiten! */ /*****************************************************************/ //============================================================= /*** BEGIN: Anpassung für die Navigationsleisten ***/ // Sprachdefinition var NavigationBarHide = 'Einklappen'; var NavigationBarShow = 'Ausklappen'; /** * Maximale Anzahl an Navigationsleisten pro Seite. * Gibt es auf einer Seite mehr, werden diese automatisch versteckt! * var NavigationBarShowDefault = 0; // Alle Navigationsleisten werden versteckt * var NavigationBarShowDefault = 1; // Alle außer die erste Navigationsleiste werden versteckt **/ var NavigationBarShowDefault = 1; /** * Zeigt und versteckt den Inhalt und das Bild der Navigationsleiste * Parameter: * indexNavigationBar: Index der Navigationsleiste **/ function toggleNavigationBar(indexNavigationBar) { var NavToggle = document.getElementById("NavToggle" + indexNavigationBar); var NavFrame = document.getElementById("NavFrame" + indexNavigationBar); if (!NavFrame || !NavToggle) { return false; } // Verstecken, wenn die Leiste derzeit gezeigt wird if (NavToggle.firstChild.data == NavigationBarHide) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'none'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'none'; } if (NavChild.className == 'NavToggle') { NavChild.firstChild.data = NavigationBarShow; } } // Anzeigen, wenn die Leiste derzeit versteckt ist } else if (NavToggle.firstChild.data == NavigationBarShow) { for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) { if (NavChild.className == 'NavPic') { NavChild.style.display = 'block'; } if (NavChild.className == 'NavContent') { NavChild.style.display = 'block'; } if (NavChild.className == 'NavToggle') { NavChild.firstChild.data = NavigationBarHide; } } } } /** * Fügt Anzeigen/Verstecken-Link zur Navigationsleiste hinzu */ function createNavigationBarToggleButton() { var indexNavigationBar = 0; // Auf alle div-Elemente anwenden for (var i = 0; NavFrame = document.getElementsByTagName("div")[i]; i++) { // Wenn eine Navigationsleiste gefunden wurde if (NavFrame.className == "NavFrame") { indexNavigationBar++; var NavToggle = document.createElement("a"); NavToggle.className = 'NavToggle'; NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar); NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');'); var NavToggleText = document.createTextNode(NavigationBarHide); NavToggle.appendChild(NavToggleText); // Füge die Links als erstes div-Element hinzu NavFrame.insertBefore(NavToggle, NavFrame.firstChild); NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar); } } // Wenn mehrere Navigationsleisten gefunden wurden, dann wird versteckt if (NavigationBarShowDefault < indexNavigationBar) { for (var i = 1; i <= indexNavigationBar; i++) { toggleNavigationBar(i); } } } // Lade createNavigationBarToggleButton() nach Laden der Seite jQuery( document ).ready( function( $ ) { createNavigationBarToggleButton(); } ); //addOnloadHook(createNavigationBarToggleButton); /*** ENDE: Anpassung für die Navigationsleisten ***/ //============================================================= /*** Kampfrechner ***/ // Ist in [[MediaWiki:Kampfrechner.js]] ausgelagert // Wird nur auf der Seite [[Kampfrechner]] aufgerufen if (mw.config.get('wgTitle') === 'Kampfrechner') { mw.loader.load('/index.php?title=MediaWiki:Kampfrechner.js&action=raw&ctype=text/javascript'); //importScript("MediaWiki:Kampfrechner.js"); } /*** ENDE: Kampfrechner ***/ /*** Kartenspezifisches ***/ // Gesamtkarten-Funktionen // Autorouter: Ist in [[MediaWiki:Autorouter.js]] ausgelagert // Gesamtkarte-Funktionen: Sind in [[MediaWiki:Gesamtkarte.js]] ausgelagert // Werden nur auf der Seite [[Gesamtkarte]] aufgerufen if (mw.config.get('wgTitle') === 'Gesamtkarte') { mw.loader.load('/index.php?title=MediaWiki:Gesamtkarte.js&action=raw&ctype=text/javascript'); //importScript("MediaWiki:Gesamtkarte.js"); mw.loader.load('/index.php?title=MediaWiki:Autorouter.js&action=raw&ctype=text/javascript'); //importScript("MediaWiki:Autorouter.js"); } /** * Zeigt/Versteckt Questpassage auf interkativer Karte * Parameter: * bool: Wenn wahr, Questpassage anzeigen, wenn falsch, dann nicht */ function showQP(bool) { if (bool) { document.cookie = "tiramon_deShowQP=1"; } else { document.cookie = "tiramon_deShowQP=0"; } location.reload(); } /** * Generalfunktion, arbeitet an allen Questpassagen */ function work_on_questpassages() { // Fügt den Anzeigen/Verstecken-Link zur Map hinzu findmenu = document.getElementById("QPinout"); if (findmenu) { showlink = document.createElement("a"); showlink.setAttribute("href","Javascript:showQP(true)"); showlink.appendChild(document.createTextNode('anzeigen')); hidelink = document.createElement("a"); hidelink.setAttribute("href","Javascript:showQP(false)"); hidelink.appendChild(document.createTextNode('verbergen')); findmenu.appendChild(showlink); findmenu.appendChild(document.createTextNode('/')); findmenu.appendChild(hidelink); } // Questpassagen anzeigen, wenn gewünscht for (var i = 0; foundspan = document.getElementsByTagName("span")[i]; i++) { var tiramon_deShowQP = document.cookie; if (tiramon_deShowQP.indexOf("tiramon_deShowQP=")=="-1") return(-1); if (tiramon_deShowQP.charAt(tiramon_deShowQP.indexOf("tiramon_deShowQP=")+17) != "1") return(-1); if (foundspan.className == "QP") { foundspan.setAttribute("style", "display:inline;"); } } } // Starte work_on_questpassages() nach Laden der Seite jQuery( document ).ready( function( $ ) { work_on_questpassages(); } ); //addOnloadHook(work_on_questpassages); /*** ENDE: Kartenspezifisches ***/ //============================================================= /*** NPC-Bilder ***/ /** * Zeigt/Versteckt NPC-Bilder * Parameter: * bool: Wenn wahr, NPC-Bilder anzeigen, wenn falsch, dann nicht */ function showNI(bool) { var DaysToExpire = 300; // Cookie wird nach so vielen Tagen gelöscht var ExpireDate = new Date(); ExpireDate.setTime((ExpireDate.getTime() + DaysToExpire * 24 * 60 * 60 * 1000)); if (bool) { document.cookie="tiramon_deShowNI=1; expires=" + ExpireDate.toGMTString(); } else { document.cookie="tiramon_deShowNI=0; expires=" + ExpireDate.toGMTString(); } location.reload(); } /** * Generalfunktion, arbeitet an allen NPC-Bildern */ function work_on_npcimages() { // Füge Anzeigen/Verstecken-Link hinzu findmenu = document.getElementById("NIinout"); if (findmenu) { showlink=document.createElement("a"); showlink.setAttribute("href","Javascript:showNI(true)"); showlink.appendChild(document.createTextNode('anzeigen')); hidelink=document.createElement("a"); hidelink.setAttribute("href","Javascript:showNI(false)"); hidelink.appendChild(document.createTextNode('verbergen')); findmenu.appendChild(showlink); findmenu.appendChild(document.createTextNode('/')); findmenu.appendChild(hidelink); } // Standardwert des Anzeigemodus var NIDisplaymode = "inline"; // Frage gespeicherten Anzeigemodus ab var tiramon_deShowNI=document.cookie; if (tiramon_deShowNI.indexOf("tiramon_deShowNI=") != "-1") { if (tiramon_deShowNI.charAt(tiramon_deShowNI.indexOf("tiramon_deShowNI=")+17)!="1") NIDisplaymode = "none"; } for (var i = 0; foundspan = document.getElementsByTagName("span")[i]; i++) { if (foundspan.className == "NI") { foundspan.setAttribute("style", "display:" + NIDisplaymode +";"); } } } // Starte work_on_npcimages() nach Laden der Seite jQuery( document ).ready( function( $ ) { work_on_npcimages(); } ); //addOnloadHook(work_on_npcimages); /*** ENDE: NPC-Bilder ***/ //============================================================= /*** Charakterfähigkeiten ***/ // Ist in [[MediaWiki:CFoptions.js]] ausgelagert mw.loader.load('/index.php?title=MediaWiki:CFoptions.js&action=raw&ctype=text/javascript'); //importScript("MediaWiki:CFoptions.js"); /*** ENDE: Charakterfähigkeiten ***/ //============================================================= /*** Vertikale Tabs ***/ // Variablendefinition var shownTab = Array(); var disabledLink = Array(); /** * Änderung des aktuell ausgewählten Tabs */ function showVTab(area, tab) { var div = document.getElementById('VTabContent_' + String(area) + '_' + String(tab)); var a = document.getElementById('VTabLink_' + String(area) + '_' + String(tab)); if (!div || !a) return; div.style.height = 'auto'; if (shownTab[area]) shownTab[area].style.height = '0'; shownTab[area] = div; var strong = document.getElementById('VTabStrong_' + String(area)); if (!strong) { strong = document.createElement('strong'); strong.id = 'VTabStrong_' + String(area); strong.className = 'selflink'; } if (disabledLink[area]) { disabledLink[area].appendChild(strong.firstChild); strong.parentNode.appendChild(disabledLink[area]); } strong.appendChild(a.firstChild); a.parentNode.appendChild(strong); a.parentNode.removeChild(a); disabledLink[area] = a; } /** * Initialisiert vertikale Tabs */ function initVTabs() { var indexVTabs = 0; for (var i = 0; table = document.getElementsByTagName('table')[i]; i++) { if (table.className != 'VTabs') continue; table.id = 'VTabs_' + String(++indexVTabs); shownTab[indexVTabs] = disabledLink[indexVTabs] = 0; var numTabs = 0; var contents; for (var j = 0; tr = table.getElementsByTagName('tr')[j]; j++) { var caption = tr.getElementsByTagName('td')[0]; caption.className = 'VTabCaption'; caption.id = 'VTabCaption_' + String(indexVTabs) + '_' + String(++numTabs); var a = document.createElement('a'); a.id = 'VTabLink_' + String(indexVTabs) + '_' + String(++numTabs); a.href = 'javascript:showVTab(' + String(indexVTabs) + ', ' + String(numTabs) + ');'; a.appendChild(caption.firstChild); caption.appendChild(a); var content = tr.getElementsByTagName('td')[1]; var div = document.createElement('div'); div.className = 'VTabContent'; div.id = 'VTabContent_' + String(indexVTabs) + '_' + String(numTabs); while (content.childNodes.length) { div.appendChild(content.childNodes[0]); } if (contents) { tr.removeChild(content); } else { contents = content } contents.rowSpan = numTabs; contents.appendChild(div); } } } // Starte initVTabs() nach Laden der Seite jQuery( document ).ready( function( $ ) { initVTabs(); } ); //addOnloadHook(initVTabs); /*** ENDE: Vertikale Tabs ***/ /* 8. ANFANG: NPC Filter für Karten */ function resetNPCBordersOnMap () { /* Entferne Klasse und setze somit CSS-Einstellungen wieder zurück */ $("body.ns-108 .maplink div.noIE > a").parent().parent().removeClass("MapNPCBorder"); } function showNPCBordersOnMap (npcName) { /* Vergleiche NPC-Name mit jedem einzelnen NPC-Namen der in der Karte eingetragen ist, falls ja, dann zeiche Rahmen um das entsprechende Feld mittels der Klasse MapNPCBorder */ var NPCMapCounter = 0; $("body.ns-108 .maplink div.noIE > a > span.NPC").each(function(){ if ($(this).text().toLowerCase() == npcName.toLowerCase()) // Case-Insensitive Prüfung { $(this).parent().parent().parent().addClass("MapNPCBorder"); NPCMapCounter++; } }); /* Zeige zur zusätzlichen Information, wie viele Rahmen bzw. NPCs es jetzt auf dieser Karte gibt */ $("#map_redZK #mapNPCCount").text(NPCMapCounter); } function initNPCBordersAndLinks () { /* Füge Links mit Kugelsymbol hinzu (NPC-Artikel) */ $("body.ns-0 .layout_npc .layout_npc_location > p > b:contains('Vorkommen:')").parent().parent().find("p + ul > li, p:first-child ~ p").each(function(){ if ($(this).find("a").hasClass("new")) return; switch ($(this).find("a").attr("title")) { case "Welt": case "Oberfläche": case "Dungeon": return; default: $(this).append("<span class='linktomap'><a href='/index.php/Karte:"+$(this).find("a").attr("title").replace(/ /g, "_") + "#MapNPCFilter_" + $("#firstHeading").text()+"' style='display: inline-block; height: 12px; width: 12px; overflow:hidden;'> </a></span>"); } }); /* Erstelle Eingabefeld (Karten-Artikel) */ $("body.ns-108 #map_redZK").append("<br /><input type='text' name='findeNPC' /> <a href='#'>NPC suchen</a><br /><span id='mapNPCCount'>0</span> NPCs wurden gefunden"); /* Starte NPC-Suche, bei Klick auf den NPC-Suchen-Link */ $("body.ns-108 #map_redZK > input[name='findeNPC'] + a").click(function(){ var NPCname = $(this).parent().find("input[name='findeNPC']").val(); resetNPCBordersOnMap(); showNPCBordersOnMap(NPCname); $(this).attr("href","#MapNPCFilter_"+NPCname); }); /* Automatisches Absenden des Forms mit der Enter-Taste */ $("body.ns-108 #map_redZK > input[name='findeNPC']").keypress(function(e) { if(e && e.which == 13) { $(this).next().click(); window.location.replace("#MapNPCFilter_"+$(this).val()); } }); /* Wenn der Hash schon zum Ladezeitpunkt mit "#MapNPCFilter_" beginnt, direkt nach NPC suchen und im Formular eintragen */ if (window.location.hash.substr(0,14) == "#MapNPCFilter_") { var NPCname = window.location.hash.substr(14); /* NPC-Namen in URLs können kodiert sein, z.B. wird Leerzeichen zu %20*/ NPCname = decodeURI(NPCname); showNPCBordersOnMap(NPCname); $("body.ns-108 #map_redZK > input[name='findeNPC']").val(NPCname); } } jQuery( document ).ready( function( $ ) { initNPCBordersAndLinks(); } ); //addOnloadHook(initNPCBordersAndLinks); /* ENDE: NPC Filter für Karten */ //==Schnee== // Outsourced to [[MediaWiki:Schnee.js]] /* DEAKTIVIERT (für Weihnachtszeit gedacht) if (mw.config.get('wgTitle') === 'Hauptseite') { mw.loader.load('/index.php?title=MediaWiki:Schnee.js&action=raw&ctype=text/javascript'); //importScript("MediaWiki:Schnee.js"); } */