Harry-Potter-Lexikon
Registrieren
Advertisement
Harry-Potter-Lexikon

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
// <pre><nowiki>
/* Any JavaScript here will be loaded for all users on every page load. */
/* MainPages.js
 * 
 * This script is used to customize the appearance of the Commons main page and its translations.
 * In particular, it is used to hide the page title and to change the tab text from "Gallery" to
 * "Main page" or a translated version thereof.
 * This script supersedes the [[MediaWiki:MainPages.css]] style sheet.
 *
 * Maintainer(s): [[User:Ilmari Karonen]]
 */

/* Any JavaScript here will be loaded for all users on every page load. */

// List of all main page translations on Commons and their respective language codes, from [[Template:Lang-mp]]
// (The script does not currently use the language code for anything, it just checks that a value is present.)
var localizedMainPageTitles = {
    "Tuisblad": 'af',
        "Houptsyte": 'als',
        "Hēafodsīde": 'ang',
        "الصفحة الرئيسية": 'ar',
        "Portalada": 'an',
        "Entamu": 'ast',
        "Hauptsaitn": 'bar',
        "Першая старонка": 'be',
        "Галоўная старонка": 'be-tarask',
        "Halaman Utama": 'id',
        "Laman Utama": 'ms',
        "Tepas": 'su',
        "প্রধান পাতা": 'bn',
        "Početna strana": 'bs',
        "Degemer": 'br',
        "Начална страница": 'bg',
        "Pàgina principal": 'ca',
        "Hlavní strana": 'cs',
        "Hafan": 'cy',
        "Forside": 'da',
        "Hauptseite": 'de',
        "Esileht": 'et',
        "Κύρια Σελίδα": 'el',
        "Main Page": 'en',
        "Portada": 'es',
        "Ĉefpaĝo": 'eo',
        "Páhina prencipal": 'ext',
        "Azala": 'eu',
        "صفحهٔ اصلی": 'fa',
        "Forsíða/fo": 'fo',
        "Accueil": 'fr',
        "Príomhleathanach": 'ga',
        "Portada galega": 'gl',
        "મુખપૃષ્ઠ": 'gu',
        "עמוד ראשי": 'he',
        "मुख्य पृष्ठ": 'hi',
        "Glavna stranica": 'hr',
        "Գլխավոր Էջ": 'hy',
        "Pagina principal": 'ia',
        "Forsíða/is": 'is',
        "Pagina principale": 'it',
        "Pamuklat": 'pam',
        "მთავარი გვერდი": 'ka',
        "Басты бет": 'kk',
        "ទំព័រដើម": 'km',
        "ಮುಖ್ಯ ಪುಟ": 'kn',
        "대문": 'ko',
        "Pagina prima": 'la',
        "Haaptsäit": 'lb',
        "Pagrindinis puslapis": 'lt',
        "Sākumlapa": 'lv',
        "Kezdőlap": 'hu',
        "Главна страница": 'mk',
        "പ്രധാന താൾ": 'ml',
        "Паджина принчипалэ": 'mo',
        "मुखपृष्ठ": 'mr',
        "Il-Paġna prinċipali": 'mt',
        "Páigina percipal": 'mwl',
        "گت ولگ]]": 'mzn',
        "Hoofdpagina": 'nl',
        "Veurpagina": 'nds-nl',
        "メインページ": 'ja',
        "Calīxatl": 'nah',
        "गृह पृष्ठ": 'ne',
        "Hovedside": 'no',
        "Hovudside": 'nn',
        "Acuèlh": 'oc',
        "Hööftsiet": 'nds',
        "Strona główna": 'pl',
        "لومړی مخ": 'ps',
        "Página principal": 'pt',
        "Qhapaq p'anqa": 'qu',
        "Pagina principală": 'ro',
        "Заглавная страница": 'ru',
        "Haudsiede Commons": 'stq',
        "Faqja Kryesore": 'sq',
        "මුල් පිටුව": 'si',
        "Simple English": 'en-simple',
        "Hlavná stránka": 'sk',
        "Glavna stran": 'sl',
        "Главна страна": 'sr',
        "Glavna stranica - Главна страница": 'sh',
        "Etusivu": 'fi',
        "Huvudsida": 'sv',
        "Unang Pahina": 'tl',
        "முதன்மைப் பக்கம்": 'ta',
        "หน้าหลัก": 'th',
        "Trang Chính": 'vi',
        "Ana Sayfa": 'tr',
        "Головна сторінка": 'uk',
        "Pajina prinsipałe": 'vec',
        "Cifapad": 'vo',
        "Syahan nga Pakli": 'war',
        "ערשטע זײַט": 'yi',
        "Ojúewé Àkọ́kọ́": 'yo',
        "頭版": 'yue',
        "卷首": 'zh-classical',
        "首页": 'zh-hans',
        "首頁": 'zh-hant'
};

// Build an inverted language look-up table
var localizedMainPageTitlesBack = {};
for (var key in localizedMainPageTitles) {
    localizedMainPageTitlesBack[localizedMainPageTitles[key]] = key;
}

// Callback function used for tab text translation
function setMainPageTabTextAPI(json) {
    var title = json.query.allmessages[0]['*'];
    if (title) addOnloadHook(function () {
        var tab = document.getElementById('ca-nstab-main');
        if (tab) tab = tab.getElementsByTagName('a')[0];
        while (tab && tab.firstChild) tab = tab.firstChild;
        if (tab) tab.nodeValue = title;
    });
}

if (wgNamespaceNumber < 2 && localizedMainPageTitles[wgTitle]) {
    // Replace the main page tab title with the [[MediaWiki:Mainpage-description]] message
    importScriptURI(wgScriptPath + "/api.php?format=json&callback=setMainPageTabTextAPI&maxage=2592000&smaxage=2592000&action=query&meta=allmessages&ammessages=mainpage-description&amlang=" + wgUserLanguage);

    // Hide title when viewing the main page (but not when editing it or viewing the talk page)
    if (wgNamespaceNumber === 0 && (wgAction == "view" || wgAction == "purge")) {
        appendCSS("#firstHeading { display: none; }");
    }
}

function suggestMainpageLang() {
    // look-up welcome box on mainpage
    var mwb = document.getElementById('mainpage-welcome-box');
    if (mwb) {
        // determine browser language
        var lang = navigator.userLanguage || navigator.language || navigator.browserLanguage;

        // now use reverse loop-up table to find the correct page (try up to first dash if full code is not found) 
        var page = localizedMainPageTitlesBack[lang] || localizedMainPageTitlesBack[lang.substr(0, lang.indexOf('-'))];

        if (page && page !== wgTitle) {
            mwb.innerHTML += '<br/><img src="http://bits.wikimedia.org/skins-1.5/common/images/redirectltr.png">' + '<span class="redirectText"><a href="/wiki/' + page + '">' + page + '</a></span>';
        }
    }
}
if (wgUserName === null) addOnloadHook(suggestMainpageLang);

// </source>

/* Any JavaScript here will be loaded for all users on every page load. */

/* Replaces {{BENUTZERNAME}} with the name of the user browsing the page.
   Requires copying Template:USERNAME. */

function UserNameReplace() {
    if (typeof (disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName === null) return;
    $("span.insertusername").html(wgUserName);
}
addOnloadHook(UserNameReplace);

/* End of the {{BENUTZERNAME}} replacement */

function addHideButtons() {
    if (typeof getElementsByClass != 'function') {
        return;
    }
    var hidables = getElementsByClass('hidable');

    for (var i = 0; i < hidables.length; i++) {
        var box = hidables[i];
        var button = getElementsByClass('hidable-button', box, 'span');

        if (button !== null && button.length > 0) {
            button = button[0];

            button.onclick = toggleHidable;
            button.appendChild(document.createTextNode('[Versteckt]'));

            if (new ClassTester('start-hidden').isMatch(box)) button.onclick('bypass');
        }
    }
}

function toggleHidable(bypassStorage) {
    if (typeof getElementsByClass != 'function') {
        return;
    }

    var parent = getParentByClass('hidable', this);
    var content = getElementsByClass('hidable-content', parent);
    var nowShown;

    if (content !== null && content.length > 0) {
        content = content[0];

        if (content.style.display == 'none') {
            content.style.display = content.oldDisplayStyle;
            this.firstChild.nodeValue = '[Versteckt]';
            nowShown = true;
        } else {
            content.oldDisplayStyle = content.style.display;
            content.style.display = 'none';
            this.firstChild.nodeValue = '[Zeige]';
            nowShown = false;
        }

        if (window.storagePresent && (typeof (bypassStorage) == 'undefined' || bypassStorage != 'bypass')) {
            var page = window.pageName.replace(/\W/g, '_');
            var items = getElementsByClass('hidable');
            var item = -1;

            for (var i = 0; i < items.length; i++) {
                if (items[i] == parent) {
                    item = i;
                    break;
                }
            }

            if (item == -1) {
                return;
            }

            var storage = globalStorage[window.location.hostname];
            storage.setItem('hidableshow-' + item + '_' + page, nowShown);
        }
    }
}

$(function rewriteTitle() {
    if (typeof (window.SKIP_TITLE_REWRITE) != 'undefined' && window.SKIP_TITLE_REWRITE) {
        return;
    }

    if ($('#title-meta').length === 0) {
        return;
    }

    var newTitle = $('#title-meta').html();
    if (skin == "oasis") {
        $('header.WikiaPageHeader > h1').html('<div id="title-meta" style="display: inline;">' + newTitle + '</div>');
        $('header.WikiaPageHeader > h1').attr('style', 'text-align:' + $('#title-align').html() + ';');
    } else {
        $('.firstHeading').html('<div id="title-meta" style="display: inline;">' + newTitle + '</div>');
        $('.firstHeading').attr('style', 'text-align:' + $('#title-align').html() + ';');
    }
});
/* Substitute Vorlage:Information into upload page */
$(document).ready(function() {

	if (wgPageName != 'Special:Upload') {
		return;
	}

	$('#wpUploadDescription').text("==Zusammenfassung==\r\n{{Information\r\n|Beachten=\r\n|Beschreibung=\r\n|Quelle=\r\n|Autor=\r\n|Dateispezis=\r\n|Lizenzg=\r\n|Andere Versionen=\r\n|Kategorien=\r\n}}");

});

// onload stuff
var firstRun = true;

function loadFunc() {
    if (firstRun) {
        firstRun = false;
    } else {
        return;
    }

    window.pageName = wgPageName;
    window.storagePresent = (typeof (globalStorage) != 'undefined');

    addHideButtons();

    fillPreloads();

    substUsername();
    substUsernameTOC();
    rewriteTitle();
    addAlternatingRowColors();

    var body = document.getElementsByTagName('body')[0];
    var bodyClass = body.className;

    if (!bodyClass || (bodyClass.indexOf('page-') == -1)) {
        var page = window.pageName.replace(/\W/g, '_');
        body.className += ' page-' + page;
    }

    if (typeof (onPageLoad) != "undefined") {
        onPageLoad();
    }
}

function infoboxToggle() {
    var page = window.pageName.replace(/\W/g, '_');
    var nowShown;

    if (document.getElementById('infoboxtoggle').innerHTML == '[Hide]') {
        document.getElementById('infoboxinternal').style.display = 'none';
        document.getElementById('infoboxtoggle').innerHTML = '[Show]';
        nowShown = false;
    } else {
        document.getElementById('infoboxinternal').style.display = 'block';
        document.getElementById('infoboxtoggle').innerHTML = '[Hide]';
        nowShown = true;
    }

    if (window.storagePresent) {
        var storage = globalStorage[window.location.hostname];
        storage.setItem('infoboxshow-' + page, nowShown);
    }
}

/**
 * jQuery version of fillPreloads
 * @author Grunny
 */
function fillPreloads() {

    if (!$('#lf-preload').length) {
        return;
    }
    var preloadOptionsHtml = '',
        $preloadOptionsList;

    $('#lf-preload').attr('style', 'display: block');

    $.get(wgScript, {
        title: 'Template:Stdpreloads',
        action: 'raw',
        ctype: 'text/plain'
    }, function (data) {
        var lines = data.split('\n');
        for (var i in lines) {
            var value = (lines[i].indexOf('-- ') === 0) ? lines[i].substring(3) : "";
            preloadOptionsHtml += '<option value="' + value + '">' + lines[i] + '</option>';
        }
        $preloadOptionsList = $('<select />').attr('id', 'stdSummaries').html(preloadOptionsHtml).change(function () {
            var value = $(this).val();
            if (value !== '') {
                value = 'Template:' + value + '/preload';
                value = value.replace(' ', '_');
                $.get(wgScript, {
                    title: value,
                    action: 'raw',
                    ctype: 'text/plain'
                }, function (data) {
                    insertAtCursor(document.getElementById('wpTextbox1'), data);
                });
            }
        });

        $('#lf-preload-cbox').html($preloadOptionsList);
    });

    $('#lf-preload-pagename').html('<input type="text" class="textbox" />');
    $('#lf-preload-button').html('<input type="button" class="button" value="Insert" onclick="doCustomPreload()" />');

}

function doCustomPreload() {
    doPreload(document.getElementById('lf-preload-pagename').getElementsByTagName('input')[0].value);
}

function addAlternatingRowColors() {
    var infoboxes = getElementsByClass('infobox', document.getElementById('content'));

    if (infoboxes.length === 0) return;

    for (var k = 0; k < infoboxes.length; k++) {
        var infobox = infoboxes[k];

        var rows = infobox.getElementsByTagName('tr');
        var changeColor = false;

        for (var i = 0; i < rows.length; i++) {
            if (rows[i].className.indexOf('infoboxstopalt') != -1) break;

            var ths = rows[i].getElementsByTagName('th');

            if (ths.length > 0) {
                continue;
            }

            if (changeColor) rows[i].style.backgroundColor = '#f9f9f9';
            changeColor = !changeColor;
        }
    }
}

/*
    Replaces {{USERNAME}} with the name of the user browsing the page.
    Requires copying Template:USERNAME.
*/
function substUsername() {
    $('.insertusername').text(wgUserName);
}

function substUsernameTOC() {
    if (typeof getElementsByClass != 'function') {
        return;
    }

    var toc = document.getElementById('toc');
    var userpage = document.getElementById('pt-userpage');

    if (!userpage || !toc) return;

    var username = userpage.firstChild.firstChild.nodeValue;
    var elements = getElementsByClass('toctext', toc, 'span');

    for (var i = 0; i < elements.length; i++)
    elements[i].firstChild.nodeValue = elements[i].firstChild.nodeValue.replace('<insert name here>', username);
}

/************************************************************
 * Functions.js stuff
 * Deprecated, most of these functions will be removed slowly
 ************************************************************/

/*
    Source: http://www.dustindiaz.com/getelementsbyclass/
    getElementsByClass, which complements getElementById and getElementsByTagName, returns an array of all subelements of ''node'' that are tagged with a specific CSS class (''searchClass'') and are of the tag name ''tag''. If tag is null, it searches for any suitable elements regardless of the tag name.
    Example: getElementsByClass('infobox', document.getElementById('content'), 'div') selects the same elements as the CSS declaration #content div.infobox
*/
function getElementsByClass(searchClass, node, tag) {
    var classElements = [];

    if (node === null) node = document;

    if (tag === null) tag = '*';

    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var tester = new ClassTester(searchClass);

    for (i = 0, j = 0; i < elsLen; i++) {
        if (tester.isMatch(els[i])) {
            classElements[j] = els[i];
            j++;
        }
    }

    return classElements;
}

function ClassTester(className) {
    this.regex = new RegExp("(^|\\s)" + className + "(\\s|$)");
}

ClassTester.prototype.isMatch = function (element) {
    return this.regex.test(element.className);
};
/*
    end getElementsByClass
*/

function insertAtCursor(myField, myValue) {
    //IE support
    if (document.selection) {
        myField.focus();
        sel = document.selection.createRange();
        sel.text = myValue;
    }
    //MOZILLA/NETSCAPE support
    else if (myField.selectionStart || myField.selectionStart == '0') {
        var startPos = myField.selectionStart;
        var endPos = myField.selectionEnd;
        myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
    } else {
        myField.value += myValue;
    }
}

function getFirstHeading() {
    var elements = getElementsByClass('firstHeading', document.getElementById('content'), 'h1');
    return (elements !== null && elements.length > 0) ? elements[0] : null;
}

/*
    Returns the element's nearest parent that has the specified CSS class.
*/
function getParentByClass(className, element) {
    var tester = new ClassTester(className);
    var node = element.parentNode;

    while (node !== null && node != document) {
        if (tester.isMatch(node)) return node;

        node = node.parentNode;
    }

    return null;
}

/*
    Performs dynamic hover class rewriting to work around the IE6 :hover bug
    (needs CSS changes as well)
*/
function rewriteHover() {
    var gbl = document.getElementById("hover-global");

    if (gbl === null) return;

    var nodes = getElementsByClass("hoverable", gbl);

    for (var i = 0; i < nodes.length; i++) {
        nodes[i].onmouseover = function () {
            this.className += " over";
        };
        nodes[i].onmouseout = function () {
            this.className = this.className.replace(new RegExp(" over\\b"), "");
        };
    }
}
/************************************************************
 * End old Functions.js stuff
 * Deprecated, most of these functions will be removed slowly
 ************************************************************/

$(loadFunc);

///////////////////////////////////////////////////////////////////////////////////////////////////////////

// ADVANCED AJAX AUTO-REFRESHING ARTICLES
// Code originally by "pcj" of Wowpedia
// Maintenance, cleanup, style and bug fixes by Grunny (http://starwars.wikia.com/wiki/User:Grunny)

///////////////////////////////////////////////////////////////////////////////////////////////////////////

var ajaxIndicator = 'http://images2.wikia.nocookie.net/dev/images/8/82/Facebook_throbber.gif',
    ajaxTimer,
    ajaxRefresh = 60000,
    refreshText = 'Auto-Aktualisierung',
    refreshHover = 'Enable auto-refreshing page loads',
    doRefresh = true;

if (!window.ajaxPages) {
    var ajaxPages = new Array('Special:RecentChanges', 'Special:Watchlist', 'Special:Log', 'Special:NewFiles');
}
if (!window.ajaxCallAgain) {
    var ajaxCallAgain = [];
}
if (typeof AjaxRCRefreshText == "string") {
    refreshText = AjaxRCRefreshText;
}
if (typeof AjaxRCRefreshHoverText == "string") {
    refreshHover = AjaxRCRefreshHoverText;
}

/**
 * Sets the cookie
 * @param c_name string Name of the cookie
 * @param value string 'on' or 'off'
 * @param expiredays integer Expiry time of the cookie in days
 */
function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) + ((expiredays === null) ? "" : ";expires=" + exdate.toGMTString());
}

/**
 * Gets the cookie
 * @param c_name string Cookie name
 * @return The cookie name or empty string
 */
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        var c_start = document.cookie.indexOf(c_name + "=");
        if (c_start !== -1) {
            c_start = c_start + c_name.length + 1;
            var c_end = document.cookie.indexOf(";", c_start);
            if (c_end === -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}

/**
 * Main function to start the Auto-refresh process
 */
function preloadAJAXRL() {
    var ajaxRLCookie = (getCookie("ajaxload-" + wgPageName) == "on") ? true : false,
        appTo = ($('#WikiaPageHeader').length) ? $('#WikiaPageHeader') : ($('#AdminDashboardHeader').length ? $('#AdminDashboardHeader > h1') : $('.firstHeading'));
    appTo.append('&nbsp;<span style="font-size: xx-small; line-height: 100%;" id="ajaxRefresh"><span style="border-bottom: 1px dotted; cursor: help;" id="ajaxToggleText" title="' + refreshHover + '">' + refreshText + ':</span><input type="checkbox" style="margin-bottom: 0;" id="ajaxToggle"><span style="display: none;" id="ajaxLoadProgress"><img src="' + ajaxIndicator + '" style="vertical-align: baseline; float: none;" border="0" alt="Refreshing page" /></span></span>');
    $('#ajaxLoadProgress').ajaxSend(function (event, xhr, settings) {
        if (location.href == settings.url) {
            $(this).show();
        }
    }).ajaxComplete(function (event, xhr, settings) {
        if (location.href == settings.url) {
            $(this).hide();
            for (var i in ajaxCallAgain) {
                ajaxCallAgain[i]();
            }
        }
    });
    $('#ajaxToggle').click(toggleAjaxReload);
    $('#ajaxToggle').attr('checked', ajaxRLCookie);
    if (getCookie("ajaxload-" + wgPageName) == "on") {
        loadPageData();
    }
}

/**
 * Turn refresh on and off by toggling the checkbox
 */
function toggleAjaxReload() {
    if ($('#ajaxToggle').prop('checked') === true) {
        setCookie("ajaxload-" + wgPageName, "on", 30);
        doRefresh = true;
        loadPageData();
    } else {
        setCookie("ajaxload-" + wgPageName, "off", 30);
        doRefresh = false;
        clearTimeout(ajaxTimer);
    }
}

/**
 * Does the actual refresh
 */
function loadPageData() {
    var cC = ($('#WikiaArticle').length) ? '#WikiaArticle' : '#bodyContent';
    $(cC).load(location.href + " " + cC + " > *", function (data) {
        if (doRefresh) {
            ajaxTimer = setTimeout("loadPageData();", ajaxRefresh);
        }
    });
}

/**
 * Load the script on specific pages
 */
$(function () {
    for (var x in ajaxPages) {
        if (wgPageName == ajaxPages[x] && $('#ajaxToggle').length === 0) {
            preloadAJAXRL();
        }
    }
});

///////////////////////////////////////////////////////////////////////////////////////////////////////////

// END OF AJAX AUTO-REFRESH

///////////////////////////////////////////////////////////////////////////////////////////////////////////

/* Magic edit intro. Copied from Wikipedia's MediaWiki:Common.js
 * Modified by [[User:Grunny]] and [[User:Sikon]] for use in both Monobook and Monaco on Wikia
 * Added section edit functionality by [[User:Green tentacle]]
 * Fix for new edit button next to the title by [[User:Grunny]]
 * New Wikia skin support by [[User:Grunny]]
 */
function addEditIntro(name) {
    // Top link
    if (skin == 'oasis') {
        $('a[data-id="edit"]').attr('href', $('a[data-id="edit"]').attr('href') + '&editintro=' + name);
        $('span.editsection > a').each(function () {
            $(this).attr('href', $(this).attr('href') + '&editintro=' + name);
        });
    } else {
        var el = document.getElementById('ca-edit');

        if (typeof (el.href) == 'undefined') {
            el = el.getElementsByTagName('a')[0];
        }

        if (el) el.href += '&editintro=' + name;

        // Section links
        var spans = document.getElementsByTagName('span');
        for (var i = 0; i < spans.length; i++) {
            el = null;

            if (spans[i].className == 'editsection') {
                el = spans[i].getElementsByTagName('a')[0];
                if (el) el.href += '&editintro=' + name;
            } else if (spans[i].className == 'editsection-upper') {
                el = spans[i].getElementsByTagName('a')[0];
                if (el) el.href += '&editintro=' + name;
            }
        }
    }
}

if (wgNamespaceNumber === 0) {
    addOnloadHook(function () {
        var cats = document.getElementById('mw-normal-catlinks');
        if (!cats) return;
        cats = cats.getElementsByTagName('a');
        for (var i = 0; i < cats.length; i++) {
            if (cats[i].title == 'Category:Harry Potter Wiki Featured articles') {
                addEditIntro('Template:Featured_editintro');
                break;
            }
        }
    });
}

// [[Main Page]] JS transform. Originally from [[Wikipedia:MediaWiki:Monobook.js]]/[[Wikipedia:MediaWiki:Common.js]]
//and may be further modified for local use.
function mainPageRenameNamespaceTab() {
    try {
        var Node = document.getElementById('ca-nstab-main').firstChild;
        if (Node.textContent) { // Per DOM Level 3
            Node.textContent = 'Main Page';
        } else if (Node.innerText) { // IE doesn't handle .textContent
            Node.innerText = 'Main Page';
        } else { // Fallback
            Node.replaceChild(Node.firstChild, document.createTextNode('Main Page'));
        }
    } catch (e) {
        // bailing out!
    }
}

if (wgTitle == 'Main Page' && (wgNamespaceNumber === 0 || wgNamespaceNumber == 1)) {
    addOnloadHook(mainPageRenameNamespaceTab);
}

/** Archive edit tab disabling *************************************
 * Disables the edit tab on old forum topic pages to stop inexperienced users bumping old topics.
 * Page can still be edited by going via the edit tab on the history etc, or by 
 * typing the edit address manually.
 * By [[User:Spang|Spang]]
 * Monaco support by [[User:Uberfuzzy|]]
 * Oasis support by [[User:Uberfuzzy|]]
 * Removal of section edit buttons and new section tab on talk pages added by [[User:Grunny|Grunny]]
 * User:/User talk: support and styling in new skin by [[User:Grunny|Grunny]]
 */
function disableOldForumEdit() {
    if (typeof (enableOldForumEdit) != 'undefined' && enableOldForumEdit) {
        return;
    }
    if (!document.getElementById('old-forum-warning')) {
        return;
    }

    if (skin == 'oasis') {
        if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) {
            $("#WikiaUserPagesHeader .wikia-menu-button li a:first").html('Archived').removeAttr('href').attr('style', 'color: darkgray;');
            $('span.editsection').remove();
            return;
        } else {
            $("#WikiaPageHeader .wikia-menu-button li a:first").html('Archived').removeAttr('href').attr('style', 'color: darkgray;');
            $('span.editsection').remove();
            return;
        }
    }

    if (!document.getElementById('ca-edit')) {
        return;
    }

    if (skin == 'monaco') {
        editLink = document.getElementById('ca-edit');
    } else if (skin == 'monobook') {
        editLink = document.getElementById('ca-edit').firstChild;
    } else {
        return;
    }

    editLink.removeAttribute('href', 0);
    editLink.removeAttribute('title', 0);
    editLink.style.color = 'gray';
    editLink.innerHTML = 'Archived';

    $('span.editsection-upper').remove();
    $('span.editsection').remove();

    appendCSS('#control_addsection, #ca-addsection { display: none !important; }');
}
addOnloadHook(disableOldForumEdit);

//Removes the "Featured on:" line on File pages -- By Grunny
addOnloadHook(function () {
    if (wgNamespaceNumber == 6 && $('#file').length !== 0) {
        $('#file').html($('#file').html().replace(/Featured on\:(.*?)<br>/, ''));
    }
});

/* Substitute Template:Information into upload page */
$(document).ready(function () {
    if (wgPageName != 'Special:Upload') { return; }

    $('#wpUploadDescription').text("==Summary==\r\n{{Information\r\n|attention=\r\n|description=\r\n|source=\r\n|author=\r\n|filespecs=\r\n|licensing=\r\n|other versions=\r\n|categories=\r\n}}");

});

/* Temporary fix for the duration of the giveaway to let others use talk pages 
$( function () {
	if( wgTitle == 'Wizarding World Giveaway' || wgTitle == 'Deathly Hallows Premiere Event' ) {
		return;
	}
	if( wgNamespaceNumber == 0 ) {
		if( skin == 'oasis' ) {
			$('ul.commentslikes > li.comments > a').text('Talk').attr('href','/wiki/Talk:'+ encodeURIComponent (wgPageName));
			$('section#WikiaArticleComments').remove();
		} else {
			$('#p-cactions > .pBody > ul > #ca-nstab-main').after('<li id="ca-talk"><a accesskey="t" title="Discussion about the content page [t]" href="/wiki/Talk:'+ encodeURIComponent (wgPageName) +'">Discussion</a></li>');
			$('div#article-comments-wrapper').remove();
		}
	}
} ); */

//edit buttons
if (mwCustomEditButtons) {
    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png",
            "speedTip": "Redirect",
            "tagOpen": "#REDIRECT [[",
            "tagClose": "]]",
            "sampleText": "Insert page"
    };

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://images.wikia.com/central/images/c/c9/Button_strike.png",
            "speedTip": "Strike",
            "tagOpen": "<s>",
            "tagClose": "</s>",
            "sampleText": "Strike-through text"
    };

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://images.wikia.com/central/images/1/13/Button_enter.png",
            "speedTip": "Line break",
            "tagOpen": "<br />",
            "tagClose": "",
            "sampleText": ""
    };

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png",
            "speedTip": "Comment visible only for editors",
            "tagOpen": "<!-- ",
            "tagClose": " -->",
            "sampleText": "Insert comment here"
    };
}

/* Variablen für das Skript AjaxRC (siehe http://dev.wikia.com/wiki/AjaxRC) */
ajaxPages = ['Spezial:Letzte_Änderungen'];
AjaxRCRefreshText = 'Auto-Aktualisierung';
AjaxRCRefreshHoverText = 'automatische Aktualisierung ohne Neuladen der kompletten Seite';

/* Import verschiedener Skripts */

importArticles({
    type: "script",
    articles: [
        "w:c:dev:ShowHide/code.js",
        "w:c:dev:AjaxRC/code.js",
        "w:c:dev:Countdown/code.js"]
}, {
    type: "style",
    article: "MediaWiki:Wikiaprojekt.css"
});


// Import [[MediaWiki:Onlyifuploading.js]] 

if (wgCanonicalSpecialPageName == "Upload") {
    document.write('<script type="text/javascript" src="/index.php?title=MediaWiki:Onlyifuploading.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
}

//================================================================================
// alles mit class='jstest' ist dragbar

/***********************************************
 * Drag and Drop Script: © Dynamic Drive (http://www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit http://www.dynamicdrive.com/ for this script and 100s more.
 ***********************************************/

var dragobject = {
    z: 0,
    x: 0,
    y: 0,
    offsetx: null,
    offsety: null,
    targetobj: null,
    dragapproved: 0,
    initialize: function () {
        document.onmousedown = this.drag;
        document.onmouseup = function () {
            this.dragapproved = 0;
        };
    },
    drag: function (e) {
        var evtobj = window.event ? window.event : e;
        this.targetobj = window.event ? event.srcElement : e.target;
        if (this.targetobj.className == "jstest") {
            this.dragapproved = 1;
            if (isNaN(parseInt(this.targetobj.style.left))) {
                this.targetobj.style.left = 0;
            }
            if (isNaN(parseInt(this.targetobj.style.top))) {
                this.targetobj.style.top = 0;
            }
            this.offsetx = parseInt(this.targetobj.style.left);
            this.offsety = parseInt(this.targetobj.style.top);
            this.x = evtobj.clientX;
            this.y = evtobj.clientY;
            if (evtobj.preventDefault) evtobj.preventDefault();
            document.onmousemove = dragobject.moveit;
        }
    },
    moveit: function (e) {
        var evtobj = window.event ? window.event : e;
        if (this.dragapproved == 1) {
            this.targetobj.style.left = this.offsetx + evtobj.clientX - this.x + "px";
            this.targetobj.style.top = this.offsety + evtobj.clientY - this.y + "px";
            return false;
        }
    }
};

dragobject.initialize();

/** Username replace function
 * Inserts user name into 
 * By Splarka
 */

function UserNameReplace() {
    if (typeof (disableUsernameReplace) != 'undefined' && disableUsernameReplace) return;
    $('span.insertusername').text(wgUserName);
}
$(UserNameReplace);

/***********************/
/*  ReferencePopups,   */
/* Navigation expanded */
/***********************/
importArticles({
    type: 'script',
    articles: [
        'w:c:dev:ReferencePopups/code.js',
        'u:dev:ExtendedNavigation/code.js']
});

/* Sachen, die nur Administratoren und Helfern angezeigt werden (sysop.js ist ausschließlich den Administratoren vorbehalten) */

if (wgUserGroups) {
    for (var g = 0; g < wgUserGroups.length; ++g) {
        if (wgUserGroups[g] == "sysop") {
            importStylesheet("MediaWiki:Sysop.css");
            $(function () {
                if (!window.disableSysopJS) {
                    importScript("MediaWiki:Sysop.js");
                }
            });
        } else if (wgUserGroups[g] == "helper") {
            importStylesheet("MediaWiki:Sysop.css");
        }
    }
}

//</nowiki> </pre>


/* 
 * include other pages extension
 * syntax: <div class="getPageContent" id="pageToFetch"></div>
 * example: <div class="getPageContent" id="Spezial:Forum"></div>
 */
(function () {
    var doChange = true;
    $('body').bind('DOMNodeInserted', function () {
        if ($('.getPageContent').length !== 0 && doChange) {
            $('.getPageContent').each(function () {
                var self = this;
                doChange = false;
                $.ajax('/wiki/' + encodeURIComponent($(self).attr('id'))).done(function (data) {
                    $(self).replaceWith($(data).find('#mw-content-text'));
                    doChange = true;
                });

            });
        }
    }).trigger('DOMNodeInserted');
})()

/* Why can't wikia make their own code work? */
$(document).ready(function(){
    JSSnippets.init();
});
Advertisement