User:Handheld/global.js

if ( document.cookie.indexOf("useskin=chick") != -1 ) {// START CHIC

function work(ref) { "use strict"; var anchor = ""; if (ref.indexOf("#")!= -1) { ref = ref.split("#"); anchor = "#" + ref[1]; ref = ref[0]; }   if (ref.indexOf("useskin=") == -1) { if (ref.indexOf("?")!= -1) { return ref + "&useskin=chick" + anchor; } else return ref + "?useskin=chick" + anchor; } else return ref + anchor; }

if ( window.location.href.indexOf( "useskin" ) == -1 && window.location.href.indexOf("action=submit") == -1 ) window.location.replace( wgServer + "/wiki/" + encodeURI(wgPageName) + "?useskin=chick" ); window.onload = (function {   "use strict";    var links = document.links;    var worknode = document.createElement("input");

worknode.setAttribute( "type", "hidden" ); worknode.setAttribute( "name", "useskin" ); worknode.setAttribute( "value", "chick" );

for (var i = 0; i < links.length; ++i) if ( links[i].href.indexOf("/wiki/")!= -1 ) links[i].href = work(links[i].href); var forms = document.forms; for (var i = 0; i < forms.length; ++i) forms[i].appendChild(worknode.cloneNode); });

}// END CHIC

var hereUserHandheld = encodeURI(wgPageName);

if ( document.cookie.indexOf("useskin=oasis") != -1 ) { var skinButton = document.createElement("a"); skinButton.setAttribute("class", "wikia-button secondary"); skinButton.setAttribute("href", "javascript:document.cookie = 'useskin=chick;domain=.wikia.com;path=/;'; window.location.replace('/wiki/' + hereUserHandheld + '?useskin=chick');" ); skinButton.innerHTML = "chic"; document.getElementById("WikiaPageHeader").appendChild(skinButton); }

document.getElementById("searchform").addEventListener ("submit", function(event) { "use strict";  var suchText = document.getElementById("searchInput").value;  if (suchText.indexOf(":") != -1) {    event.preventDefault;    //event.stopPropagation;    window.location = '/wiki/' + encodeURI(suchText) + '?useskin=chick';  } });

addPortletLink ('p-cactions', "javascript:document.cookie = 'useskin=monobook;domain=.wikia.com;path=/;'; window.location.replace('/wiki/' + hereUserHandheld + '?useskin=monobook');", 'mono'); addPortletLink ('p-cactions', "javascript:document.cookie = 'useskin=chick;domain=.wikia.com;path=/;'; window.location.replace('/wiki/' + hereUserHandheld + '?useskin=chick');", 'chic'); addPortletLink ('p-cactions', "javascript:document.cookie = 'useskin=wikiamobile;domain=.wikia.com;path=/;'; window.location.replace('/wiki/' + hereUserHandheld + '?useskin=wikiamobile');", 'mob'); addPortletLink ('p-cactions', "javascript:document.cookie = 'useskin=oasis;domain=.wikia.com;path=/;'; window.location.replace('/wiki/' + hereUserHandheld + '?useskin=oasis');", 'oasis'); addPortletLink ('p-cactions', "javascript:document.cookie = 'useskin=wubwub;expires=Fri, 31 Dec 1999 23:59:59 GMT;'; ", 'clear');

var uplink = document.createElement("img"); uplink.setAttribute( "onclick", "window.scrollTo(0, 0);" ); uplink.setAttribute( "alt", "↑" ); uplink.setAttribute( "src", "http://img2.wikia.nocookie.net/__cb20140413102022/mh3u/de/images/a/a1/Uplink.png" ); document.body.appendChild(uplink); document.body.setAttribute( "onscroll", 'uplink.setAttribute( "style" , "position:absolute; left:"+( window.pageXOffset + window.innerWidth / 10 * 7 )+"px; top:"+( window.pageYOffset + window.innerHeight / 7 * 6 )+"px; z-index:8;" );' );