MediaWiki:Mobile.js

/* Any JavaScript here will be loaded for users using the mobile site */

/* Any JavaScript here will be loaded for users using the mobile site */

/* Curse ads (temporary solution) */

function currentPageIsContentArticle { var isArticle = mw.config.get("wgIsArticle"); //returns "false" for page histories, special pages, edit views, etc.   var contentNamespaces = mw.config.get("wgContentNamespaces"); var currentNamespaceID = mw.config.get("wgNamespaceNumber"); var isContentNamespace = contentNamespaces.indexOf(currentNamespaceID) != -1;

return isArticle && isContentNamespace && !isMainPage; }

function isMainPage { return mw.config.get("wgPageName") == "Main_Page" }

$(document).ready( function {    $("body").addClass("site-zeldawiki");    $("body").append(" "); // Ads will not function without this before the tag.

if (mw.config.get("wgUserName") != null) {   $(".curse-ad").css("display","none"); //remove ad from Main Page }   else { $("#content_wrapper").prepend("  "); //header ad        $("#content_wrapper").append("   "); // footer ad        if(currentPageIsContentArticle) { var articleHasInfobox = $(".infobox-curse-ad").length != 0; if(articleHasInfobox) { $(".infobox-curse-ad").append("    "); }           else { $("  ").insertBefore("h2:first-of-type"); }       }        else if(isMainPage) { $("#mf-incontentad").append(" ").addClass("curse-ad-mobile"); }   } });

// - // copy of the needed parts of `mediawiki.legacy.wikibits` – begin // -

var loadedScripts = {}; function importScript(page) { var uri = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode(page) + '&action=raw&ctype=text/javascript'; return importScriptURI(uri); } function importScriptURI(url) { if (loadedScripts[url]) { return null ; }	loadedScripts[url] = true; var s = document.createElement('script'); s.setAttribute('src', url); s.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); return s; } function importStylesheet(page) { var uri = mw.config.get('wgScript') + '?title=' + mw.util.wikiUrlencode(page) + '&action=raw&ctype=text/css'; return importStylesheetURI(uri); } function importStylesheetURI(url, media) { var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = url; if (media) { l.media = media; }	document.getElementsByTagName('head')[0].appendChild(l); return l; } // - // copy of the needed parts of `mediawiki.legacy.wikibits` – end // -

// inject the JavaScripts for the tabs importScript('MediaWiki:Tabs.js');