User:Effan R/common.js

/* mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/DebugModeToggle.js&action=raw&ctype=text/javascript');



/*mw.hook("wikipage.content").add(function($content) {   console.log("LocHash:" + location.hash + "\n" + $content.find('.mw-headline').first.attr('id')); });*/

require(['wikia.window', 'jquery', 'mw'], function (window, $, mw) {

/*;(function (window, $, mw) {*/   'use strict';

window.AnchorInTabber = window.AnchorInTabber || {}; if (typeof window.AnchorInTabber.Load !== 'undefined'           || $('body').hasClass('editor')) { return; // prevent second load. }   window.AnchorInTabber = $.extend({        Load: true,    }, window.AnchorInTabber); // if location contains hash anchor // check and open tab with same heading

console.log("Anchor:" + location.hash);

if (location.hash !== "") { var res = location.hash.match(/^#(.+?)(?:(?:[\.%]2F|\/)(.+))?$/i); var loc = res[1]; var sect = res[2]; console.log("loc:" + loc + "\nsect:" + sect); if (loc !== "") { loc = loc.replace(/[\.%][\da-f]{2}/gi, function(x) {               return String.fromCharCode(x.replace(/[\.%]/, "0x"));            }).replace(/_/g, " "); console.log("Tab Name: " + loc); $(".tabber .tabbernav").first.find("a").filter(function {               return ($(this).attr("title") == loc);            }).click; if (sect !== undefined) { var elem = document.getElementById(sect); if (elem !== null) { console.log(elem.id + " Found"); elem.scrollIntoView(true); }           }        }    } }); /*}(window, jQuery, mediaWiki));*/