MediaWiki:Common.js

From BIONICLEsector01
Revision as of 02:39, 18 May 2016 by Swert (talk | contribs) (hmm...)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
//<source lang="javascript">

/* Autorefresh */
importScript('MediaWiki:Common.js/countdown.js');
importScript('MediaWiki:Common.js/replacetext.js');
importScript('MediaWiki:Common.js/jqueryui.js');

/* Era template fix for vector-based skins */
if(skin.indexOf('vector') != -1) {
   $('.topicons').addClass('topicons-vector');
}


/* Scripts specific to Internet Explorer */

if (navigator.appName == "Microsoft Internet Explorer")
{
    /** Internet Explorer bug fix **************************************************
     *
     *  Description: Fixes IE horizontal scrollbar bug
     *  Maintainers: [[User:Tom-]]?
     */

    var oldWidth;
    var docEl = document.documentElement;

    function fixIEScroll()
    {
        if (!oldWidth || docEl.clientWidth > oldWidth)
            doFixIEScroll();
        else
            setTimeout(doFixIEScroll, 1);

        oldWidth = docEl.clientWidth;
    }

    function doFixIEScroll() {
        docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
    }

    document.attachEvent("onreadystatechange", fixIEScroll);
    document.attachEvent("onresize", fixIEScroll);


    /**
     * Remove need for CSS hacks regarding MSIE and IPA.
     */
    if (document.createStyleSheet) {
        document.createStyleSheet().addRule('.IPA', 'font-family: "Doulos SIL", "Charis SIL", Gentium, "DejaVu Sans", Code2000, "TITUS Cyberbit Basic", "Arial Unicode MS", "Lucida Sans Unicode", "Chrysanthi Unicode";');
    }

    // In print IE (7?) does not like line-height
    appendCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}');

    // IE overflow bug
    appendCSS('div.overflowbugx { overflow-x: scroll !important; overflow-y: hidden !important; } div.overflowbugy { overflow-y: scroll !important; overflow-x: hidden !important; }');

    //Import scripts specific to Internet Explorer 6
    if (navigator.appVersion.substr(22, 1) == "6") {
        importScript("MediaWiki:Common.js/IE60Fixes.js")
    }
}


/* Test if an element has a certain class **************************************
 *
 * Description: Uses regular expressions and caching for better performance.
 * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
 */

var hasClass = (function () {
    var reCache = {};
    return function (element, className) {
        return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
    };
})();


/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
 */

var autoCollapse = 2;
var collapseCaption = "hide";
var expandCaption = "show";

function collapseTable( tableIndex )
{
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );

    if ( !Table || !Button ) {
        return false;
    }

    var Rows = Table.rows;

    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}

function createCollapseButtons()
{
    var tableIndex = 0;
    var NavigationBoxes = new Object();
    var Tables = document.getElementsByTagName( "table" );

    for ( var i = 0; i < Tables.length; i++ ) {
        if ( hasClass( Tables[i], "collapsible" ) ) {

            /* only add button and increment count if there is a header row to work with */
            var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
            if (!HeaderRow) continue;
            var Header = HeaderRow.getElementsByTagName( "th" )[0];
            if (!Header) continue;

            NavigationBoxes[ tableIndex ] = Tables[i];
            Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );

            var Button     = document.createElement( "span" );
            var ButtonLink = document.createElement( "a" );
            var ButtonText = document.createTextNode( collapseCaption );

            Button.className = "collapseButton";  //Styles are declared in Common.css

            ButtonLink.style.color = Header.style.color;
            ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
            ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
            ButtonLink.appendChild( ButtonText );

            Button.appendChild( document.createTextNode( "[" ) );
            Button.appendChild( ButtonLink );
            Button.appendChild( document.createTextNode( "]" ) );

            Header.insertBefore( Button, Header.childNodes[0] );
            tableIndex++;
        }
    }

    for ( var i = 0;  i < tableIndex; i++ ) {
        if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
            collapseTable( i );
        }
        else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
            var element = NavigationBoxes[i];
            while (element = element.parentNode) {
                if ( hasClass( element, "outercollapse" ) ) {
                    collapseTable ( i );
                    break;
                }
            }
        }
    }
}

addOnloadHook( createCollapseButtons );


/** Dynamic Navigation Bars (experimental) *************************************
 *
 *  Description: See [[Wikipedia:NavFrame]].
 *  Maintainers: UNMAINTAINED
 */

// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';

// shows and hides content and picture (if available) of navigation bars
// Parameters:
//     indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
{
    var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
    var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);

    if (!NavFrame || !NavToggle) {
        return false;
    }

    // if shown now
    if (NavToggle.firstChild.data == NavigationBarHide) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if ( hasClass( NavChild, 'NavPic' ) ) {
                NavChild.style.display = 'none';
            }
            if ( hasClass( NavChild, 'NavContent') ) {
                NavChild.style.display = 'none';
            }
        }
    NavToggle.firstChild.data = NavigationBarShow;

    // if hidden now
    } else if (NavToggle.firstChild.data == NavigationBarShow) {
        for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
            if (hasClass(NavChild, 'NavPic')) {
                NavChild.style.display = 'block';
            }
            if (hasClass(NavChild, 'NavContent')) {
                NavChild.style.display = 'block';
            }
        }
        NavToggle.firstChild.data = NavigationBarHide;
    }
}

// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
    var indexNavigationBar = 0;
    // iterate over all < div >-elements
    var divs = document.getElementsByTagName("div");
    for (var i = 0; NavFrame = divs[i]; i++) {
        // if found a navigation bar
        if (hasClass(NavFrame, "NavFrame")) {

            indexNavigationBar++;
            var NavToggle = document.createElement("a");
            NavToggle.className = 'NavToggle';
            NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
            NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');

            var isCollapsed = hasClass( NavFrame, "collapsed" );
            /*
             * Check if any children are already hidden.  This loop is here for backwards compatibility:
             * the old way of making NavFrames start out collapsed was to manually add style="display:none"
             * to all the NavPic/NavContent elements.  Since this was bad for accessibility (no way to make
             * the content visible without JavaScript support), the new recommended way is to add the class
             * "collapsed" to the NavFrame itself, just like with collapsible tables.
             */
            for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
                if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                    if ( NavChild.style.display == 'none' ) {
                        isCollapsed = true;
                    }
                }
            }
            if (isCollapsed) {
                for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
                    if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
                        NavChild.style.display = 'none';
                    }
                }
            }
            var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
            NavToggle.appendChild(NavToggleText);

            // Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
            for(var j=0; j < NavFrame.childNodes.length; j++) {
                if (hasClass(NavFrame.childNodes[j], "NavHead")) {
                    NavFrame.childNodes[j].appendChild(NavToggle);
                }
            }
            NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
        }
    }
}

addOnloadHook( createNavigationBarToggleButton );





/** Table sorting fixes ************************************************
  *
  *  Description: Disables code in table sorting routine to set classes on even/odd rows
  *  Maintainers: [[User:Random832]]
  */

ts_alternate_row_colors = false;


/***** uploadwizard_newusers ********
 * Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
 *
 *  Maintainers: [[User:Krimpet]]
 ****/
function uploadwizard_newusers() {
  if (wgNamespaceNumber == 4 && wgTitle == "Upload" && wgAction == "view") {
    var oldDiv = document.getElementById("autoconfirmedusers"),
        newDiv = document.getElementById("newusers");
    if (oldDiv && newDiv) {
      if (typeof wgUserGroups == "object" && wgUserGroups) {
        for (i = 0; i < wgUserGroups.length; i++) {
          if (wgUserGroups[i] == "autoconfirmed") {
            oldDiv.style.display = "block";
            newDiv.style.display = "none";
            return;
          }
        }
      }
      oldDiv.style.display = "none";
      newDiv.style.display = "block";
      return;
    }
  }
}
addOnloadHook(uploadwizard_newusers);


/** IPv6 AAAA connectivity testing **/

var __ipv6wwwtest_factor = 100;
var __ipv6wwwtest_done = 0;
if ((wgServer != "https://secure.wikimedia.org") && (Math.floor(Math.random()*__ipv6wwwtest_factor)==42)) {
    importScript("MediaWiki:Common.js/IPv6.js");
}

/** Magic editintros ****************************************************
 *
 *  Description: Adds editintros on disambiguation pages and BLP pages.
 *  Maintainers: [[User:RockMFR]]
 */

function addEditIntro(name)
{
  var el = document.getElementById('ca-edit');
  if (!el)
    return;
  el = el.getElementsByTagName('a')[0];
  if (el)
    el.href += '&editintro=' + name;
}


if (wgNamespaceNumber == 0) {
  addOnloadHook(function(){
    if (document.getElementById('disambigbox'))
      addEditIntro('Template:Disambig_editintro');
  });

  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:Living people' || cats[i].title == 'Category:Possibly living people') {
        addEditIntro('Template:BLP_editintro');
        break;
      }
    }
  });
}

function mpslide( type, id ){
    if(type==='to'){
        var $toContent = $("#toContent"),
            w = $toContent.width();
        $toContent
            .load("/wiki/index.php/Template:MP"+id+"?action=render", function(){
                $("<div>")
                    .css({
                        'cursor':'pointer',
                        'position':'relative',
                        'float':'right'
                    })
                    .append(
                        $("<img>")
                            .prop("src","http://biosector01.com/images/mpnav/backbutton.png")
                            .prop("id", "BackButtonId")
                    )
                    .prependTo("#toContent")
                    .closest("#toContent")
                    .on("click", "div img", function(){
                        mpslide();
                    });
                $(this)
                    .closest("#flow-content")
                    .animate({'marginLeft':'-' + w},400);
            });
    } else {
        $("#flow-content")
            .animate({
                'marginLeft':'0'
            }, 400, function(){
                $(this)
                    .find("#toContent")
                    .text("");
            });
    }
}

$(function(){
if (document.body.ontouchstart === undefined) {
    $("#bodyContent").on("mousedown", "#toContent", function(e){
        var $this = $(this),
            downX = e.clientX;
        $("#bodyContent").on("mousemove", function(e){
            var moveX = e.clientX - downX,
                w = $this.width(),
                realX = -w + moveX;
            if(moveX > w/4){
                $("#flow-content")
                    .animate({'marginLeft':'0'}, 400, function(){
                        $this.text("");
                    });
                $("#bodyContent").off("mousemove");
            } else if (moveX < 0) {
                $("#bodyContent").off("mousemove");
            } else {
                $("#flow-content")
                    .css("margin-left",realX);
            }
        });
    }).on("mouseup", function(){
        $("#bodyContent").off("mousemove");
    });
} else {
    $("#bodyContent").on("touchstart", "#toContent", function(event){
        var $this = $(this),
            e = event.originalEvent,
            downX = e.changedTouches[0].clientX;
        $("#bodyContent").on("touchmove", function(event){
            var e = event.originalEvent,
                moveX = e.changedTouches[0].clientX - downX,
                w = $this.width(),
                realX = -w + moveX;
            if(moveX > w/4){
                $("#flow-content")
                    .animate({'marginLeft':'0'}, 400, function(){
                        $this.text("");
                    });
                $("#bodyContent").off("touchmove");
            } else if (moveX < 0) {
                $("#bodyContent").off("touchmove");
            } else {
                $("#flow-content")
                    .css("margin-left",realX);
            }
        });
    }).on("touchend", function(){
        $("#bodyContent").off("touchmove");
    });
}
});


//$("#pt-anonlogin").html("<a href='http://hf.biosector01.com/hf/index.php?title=Special:UserLogin&returnto=Main+Page' title='You are encouraged to log in; however, it is not mandatory [ctrl-option-o]' accesskey='o'>Head to HS01 to Login/Create Account</a>");

//</source>

/*Tabs for infobox templates

info1t = info2subtab2 (out of 2 tabs total, 2 subtabs total)
info2t = info3subtab2 (out of 3 tabs total, 2 subtabs total)
info3t1 = info3subtab2 (out of 3 tabs total, 3 subtabs total)
info3t2 = info3subtab3 (out of 3 subtabs total, 3 subtabs total)

3 tabs total, tab 1 has 2 subtabs: tab1a, tab2a
3 tabs total, tab 1 has 3 subtabs: tab1a, tab2a, tab3a
2 tabs total, tab 2 has 2 subtabs: tab1i, tab2i
3 tabs total, tab 3 has 3 subtabs: tab1s, tab2s, tab3s
3 tabs total, tab 3 has 2 subtabs: tab1n, tab2n
*/
$(".tab1").attr("onclick", "$('#info2').hide();$('#info1t').hide();$('#info2t').hide();$('#info3t1').hide();$('#info3t2').hide();$('#info3').hide();$('#info4').hide();$('#info1subtab2').hide();$('#info1subtab3').hide();$('#info1').show();");
$(".tab2").attr("onclick", "$('#info1').hide();$('#info1t').hide();$('#info2t').hide();$('#info3t1').hide();$('#info3t2').hide();$('#info3').hide();$('#info4').hide();$('#info1subtab2').hide();$('#info1subtab3').hide();$('#info2').show();");
$(".tab3").attr("onclick", "$('#info2').hide();$('#info1t').hide();$('#info2t').hide();$('#info3t1').hide();$('#info3t2').hide();$('#info1').hide();$('#info4').hide();$('#info1subtab2').hide();$('#info1subtab3').hide();$('#info3').show();");
$(".tab4").attr("onclick", "$('#info2').hide();$('#info1t').hide();$('#info2t').hide();$('#info3t1').hide();$('#info3t2').hide();$('#info1').hide();$('#info3').hide();$('#info1subtab2').hide();$('#info1subtab3').hide();$('#info4').show();");
$(".tab1a").attr("onclick", "$('#info1subtab2').hide();$('#info1subtab3').hide();$('#info1').show();");
$(".tab2a").attr("onclick", "$('#info1').hide();$('#info1subtab3').hide();$('#info1subtab2').show();");
$(".tab3a").attr("onclick", "$('#info1').hide();$('#info1subtab2').hide();$('#info1subtab3').show();");
$(".tab1n").attr("onclick", "$('#info1').hide();$('#info2').hide();$('#info4').hide();$('#info1t').hide();$('#info2t').hide();$('#info3t1').hide();$('#info3t2').hide();$('info1subtab2').hide();$('info1subtab3').hide();$('#info3').show();");
$(".tab2n").attr("onclick", "$('#info1').hide();$('#info3').hide();$('#info4').hide();$('#info2').hide();$('#info2t').show();");
$(".tab1i").attr("onclick", "$('#info1').hide();$('#info1t').hide();$('#info2').show();");
$(".tab2i").attr("onclick", "$('#info1').hide();$('#info2').hide();$('#info1t').show();");
$(".tab1s").attr("onclick", "$('#info1').hide();$('#info2').hide();$('#info3t1').hide();$('#info3t2').hide();$('#info3').show();");
$(".tab2s").attr("onclick", "$('#info1').hide();$('#info2').hide();$('#info3').hide();$('#info3t2').hide();$('#info3t1').show();");
$(".tab3s").attr("onclick", "$('#info1').hide();$('#info2').hide();$('#info3').hide();$('#info3t1').hide();$('#info3t2').show();");
if($("#infoStart").html() == 1){
$("#info2").hide();$("#info1t").hide();$("#info2t").hide();$("#info3t1").hide();$("#info3t2").hide();$("#info3").hide();$("#info4").hide();$("#info1").show();
}else if($("#infoStart").html() == 2){
$("#info1").hide();$("#info1t").hide();$("#info2t").hide();$("#info3t1").hide();$("#info3t2").hide();$("#info3").hide();$("#info4").hide();$("#info2").show();
}else if($("#infoStart").html() == 3){
$("#info2").hide();$("#info1t").hide();$("#info2t").hide();$("#info3t1").hide();$("#info3t2").hide();$("#info1").hide();$("#info4").hide();$("#info3").show();
}else if($("#infoStart").html() == 4){
$("#info2").hide();$("#info1t").hide();$("#info2t").hide();$("#info3t1").hide();$("#info3t2").hide();$("#info1").hide();$("#info3").hide();$("#info4").show();
}else{
$("#info2").hide();$("#info1t").hide();$("#info2t").hide();$("#info3t1").hide();$("#info3t2").hide();$("#info3").hide();$("#info4").hide();$("#info1").show();
}

/*!
 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
 * http://cherne.net/brian/resources/jquery.hoverIntent.html
 *
 * You may use hoverIntent under the terms of the MIT license.
 * Copyright 2007, 2013 Brian Cherne
 */
(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:7,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.abs(u-s)+Math.abs(a-o)<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=1;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=0;return i.out.apply(t,[e])};var h=function(t){var n=jQuery.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type=="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(r.hoverIntent_s!=1){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s==1){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery)
$("#infoBoxContainer").hoverIntent(
  function() {
    switchFont("metrumatoran");
  }, function() {
    switchFont("GoudyTrajan");
  }
);

function switchFont(font) {
        $(".infoLight  tr:first-of-type td:first-of-type").fadeOut(100);
    setTimeout(function () {
        $(".infoLight  tr:first-of-type td:first-of-type").css("font-family", font);
    }, 100);
    $(".infoLight  tr:first-of-type td:first-of-type").fadeIn(200);
}


/* User specific functions, for a future feature. */

//Test
if($('#pt-userpage > a').html() == "Swert"){}

//Snippet API for en.brickimedia.org
/*var brickisnip = $('.brickisnippet');
var brickinumber = brickisnip.text();
$.ajax({type:"GET",url:"http://en.brickimedia.org/api.php?action=snippet&set=" + brickinumber + "&format=json",dataType:"jsonp",success:function(data){brickisnippet=data.snippet.snippet;brickisnip.replaceWith(brickisnippet);}});*/

//When Swert needs to get in the hole.
//$('body').html($('body').html().replace(/Swert/g, 'Edgar'));

$(".setListImage:contains('?')").each(function() {
    var $this = $(this);
    $this.html($this.parent().children('.partImage').html());
});

$(".setListImage:contains('?')").each(function() {
    var $this = $(this);
    $this.html($this.parent().children('.partImage').html());
});

$(".wikitable td:contains('-1')").each(function() {
    var $this = $(this);
    $this.html("Design ID:" + $this.parent().children('.designID').html());
    $this.parent().children("td:contains('a')").children("a:contains('View piece on Brickset')").remove();
    $this.parent().children("td:contains('a')").children("br").remove();
});

// @preserve jQuery.floatThead 1.2.8 - http://mkoryak.github.io/floatThead/ - Copyright (c) 2012 - 2014 Misha Koryak
// @license MIT
!function(a){function b(a,b,c){if(8==g){var d=j.width(),e=f.debounce(function(){var a=j.width();d!=a&&(d=a,c())},a);j.on(b,e)}else j.on(b,f.debounce(c,a))}function c(a){window.console&&window.console&&window.console.log&&window.console.log(a)}function d(){var b=a('<div style="width:50px;height:50px;overflow-y:scroll;position:absolute;top:-200px;left:-200px;"><div style="height:100px;width:100%"></div>');a("body").append(b);var c=b.innerWidth(),d=a("div",b).innerWidth();return b.remove(),c-d}function e(a){if(a.dataTableSettings)for(var b=0;b<a.dataTableSettings.length;b++){var c=a.dataTableSettings[b].nTable;if(a[0]==c)return!0}return!1}a.floatThead=a.floatThead||{},a.floatThead.defaults={cellTag:"th:visible",zIndex:1001,debounceResizeMs:10,useAbsolutePositioning:!0,scrollingTop:0,scrollingBottom:0,scrollContainer:function(){return a([])},getSizingRow:function(a){return a.find("tbody tr:visible:first>*")},floatTableClass:"floatThead-table",floatWrapperClass:"floatThead-wrapper",floatContainerClass:"floatThead-container",copyTableClass:!0,debug:!1};var f=window._,g=function(){for(var a=3,b=document.createElement("b"),c=b.all||[];a=1+a,b.innerHTML="<!--[if gt IE "+a+"]><i><![endif]-->",c[0];);return a>4?a:document.documentMode}(),h=null,i=function(){if(g)return!1;var b=a("<table><colgroup><col></colgroup><tbody><tr><td style='width:10px'></td></tbody></table>");a("body").append(b);var c=b.find("col").width();return b.remove(),0==c},j=a(window),k=0;a.fn.floatThead=function(l){if(l=l||{},!f&&(f=window._||a.floatThead._,!f))throw new Error("jquery.floatThead-slim.js requires underscore. You should use the non-lite version since you do not have underscore.");if(8>g)return this;if(null==h&&(h=i(),h&&(document.createElement("fthtr"),document.createElement("fthtd"),document.createElement("fthfoot"))),f.isString(l)){var m=l,n=this;return this.filter("table").each(function(){var b=a(this).data("floatThead-attached");if(b&&f.isFunction(b[m])){var c=b[m]();"undefined"!=typeof c&&(n=c)}}),n}var o=a.extend({},a.floatThead.defaults||{},l);return a.each(l,function(b){b in a.floatThead.defaults||!o.debug||c("jQuery.floatThead: used ["+b+"] key to init plugin, but that param is not an option for the plugin. Valid options are: "+f.keys(a.floatThead.defaults).join(", "))}),this.filter(":not(."+o.floatTableClass+")").each(function(){function c(a){return a+".fth-"+y+".floatTHead"}function i(){var b=0;A.find("tr:visible").each(function(){b+=a(this).outerHeight(!0)}),Z.outerHeight(b),$.outerHeight(b)}function l(){var a=z.outerWidth(),b=I.width()||a;if(X.width(b-F.vertical),O){var c=100*a/(b-F.vertical);S.css("width",c+"%")}else S.outerWidth(a)}function m(){C=(f.isFunction(o.scrollingTop)?o.scrollingTop(z):o.scrollingTop)||0,D=(f.isFunction(o.scrollingBottom)?o.scrollingBottom(z):o.scrollingBottom)||0}function n(){var b,c;if(V?b=U.find("col").length:(c=A.find("tr:first>"+o.cellTag),b=0,c.each(function(){b+=parseInt(a(this).attr("colspan")||1,10)})),b!=H){H=b;for(var d=[],e=[],f=[],g=0;b>g;g++)d.push('<th class="floatThead-col"/>'),e.push("<col/>"),f.push("<fthtd style='display:table-cell;height:0;width:auto;'/>");e=e.join(""),d=d.join(""),h&&(f=f.join(""),W.html(f),bb=W.find("fthtd")),Z.html(d),$=Z.find("th"),V||U.html(e),_=U.find("col"),T.html(e),ab=T.find("col")}return b}function p(){if(!E){if(E=!0,J){var a=z.width(),b=Q.width();a>b&&z.css("minWidth",a)}z.css(db),S.css(db),S.append(A),B.before(Y),i()}}function q(){E&&(E=!1,J&&z.width(fb),Y.detach(),z.prepend(A),z.css(eb),S.css(eb))}function r(a){J!=a&&(J=a,X.css({position:J?"absolute":"fixed"}))}function s(a,b,c,d){return h?c:d?o.getSizingRow(a,b,c):b}function t(){var a,b=n();return function(){var c=s(z,_,bb,g);if(c.length==b&&b>0){if(!V)for(a=0;b>a;a++)_.eq(a).css("width","");q();var d=[];for(a=0;b>a;a++)d[a]=c.get(a).offsetWidth;for(a=0;b>a;a++)ab.eq(a).width(d[a]),_.eq(a).width(d[a]);p()}else S.append(A),z.css(eb),S.css(eb),i()}}function u(a){var b=I.css("border-"+a+"-width"),c=0;return b&&~b.indexOf("px")&&(c=parseInt(b,10)),c}function v(){var a,b=I.scrollTop(),c=0,d=L?K.outerHeight(!0):0,e=M?d:-d,f=X.height(),g=z.offset(),i=0;if(O){var k=I.offset();c=g.top-k.top+b,L&&M&&(c+=d),c-=u("top"),i=u("left")}else a=g.top-C-f+D+F.horizontal;var l=j.scrollTop(),m=j.scrollLeft(),n=I.scrollLeft();return b=I.scrollTop(),function(k){if("windowScroll"==k?(l=j.scrollTop(),m=j.scrollLeft()):"containerScroll"==k?(b=I.scrollTop(),n=I.scrollLeft()):"init"!=k&&(l=j.scrollTop(),m=j.scrollLeft(),b=I.scrollTop(),n=I.scrollLeft()),!h||!(0>l||0>m)){if(R)r("windowScrollDone"==k?!0:!1);else if("windowScrollDone"==k)return null;g=z.offset(),L&&M&&(g.top+=d);var o,s,t=z.outerHeight();if(O&&J){if(c>=b){var u=c-b;o=u>0?u:0}else o=P?0:b;s=i}else!O&&J?(l>a+t+e?o=t-f+e:g.top>l+C?(o=0,q()):(o=C+l-g.top+c+(M?d:0),p()),s=0):O&&!J?(c>b||b-c>t?(o=g.top-l,q()):(o=g.top+b-l-c,p()),s=g.left+n-m):O||J||(l>a+t+e?o=t+C-l+a+e:g.top>l+C?(o=g.top-l,p()):o=C,s=g.left-m);return{top:o,left:s}}}}function w(){var a=null,b=null,c=null;return function(d,e,f){null==d||a==d.top&&b==d.left||(X.css({top:d.top,left:d.left}),a=d.top,b=d.left),e&&l(),f&&i();var g=I.scrollLeft();J&&c==g||(X.scrollLeft(g),c=g)}}function x(){if(I.length){var a=I.width(),b=I.height(),c=z.height(),d=z.width(),e=d>a?G:0,f=c>b?G:0;F.horizontal=d>a-f?G:0,F.vertical=c>b-e?G:0}}var y=k,z=a(this);if(z.data("floatThead-attached"))return!0;if(!z.is("table"))throw new Error('jQuery.floatThead must be run on a table element. ex: $("table").floatThead();');var A=z.find("thead:first"),B=z.find("tbody:first");if(0==A.length)throw new Error("jQuery.floatThead must be run on a table that contains a <thead> element");var C,D,E=!1,F={vertical:0,horizontal:0},G=d(),H=0,I=o.scrollContainer(z)||a([]),J=o.useAbsolutePositioning;null==J&&(J=o.scrollContainer(z).length);var K=z.find("caption"),L=1==K.length;if(L)var M="top"===(K.css("caption-side")||K.attr("align")||"top");var N=a('<fthfoot style="display:table-footer-group;"/>'),O=I.length>0,P=!1,Q=a([]),R=9>=g&&!O&&J,S=a("<table/>"),T=a("<colgroup/>"),U=z.find("colgroup:first"),V=!0;0==U.length&&(U=a("<colgroup/>"),V=!1);var W=a('<fthrow style="display:table-row;height:0;"/>'),X=a('<div style="overflow: hidden;"></div>'),Y=a("<thead/>"),Z=a('<tr class="size-row"/>'),$=a([]),_=a([]),ab=a([]),bb=a([]);if(Y.append(Z),z.prepend(U),h&&(N.append(W),z.append(N)),S.append(T),X.append(S),o.copyTableClass&&S.attr("class",z.attr("class")),S.attr({cellpadding:z.attr("cellpadding"),cellspacing:z.attr("cellspacing"),border:z.attr("border")}),S.css({borderCollapse:z.css("borderCollapse"),border:z.css("border")}),S.addClass(o.floatTableClass).css("margin",0),J){var cb=function(a,b){var c=a.css("position"),d="relative"==c||"absolute"==c;if(!d||b){var e={paddingLeft:a.css("paddingLeft"),paddingRight:a.css("paddingRight")};X.css(e),a=a.wrap("<div class='"+o.floatWrapperClass+"' style='position: relative; clear:both;'></div>").parent(),P=!0}return a};O?(Q=cb(I,!0),Q.append(X)):(Q=cb(z),z.after(X))}else z.after(X);X.css({position:J?"absolute":"fixed",marginTop:0,top:J?0:"auto",zIndex:o.zIndex}),X.addClass(o.floatContainerClass),m();var db={"table-layout":"fixed"},eb={"table-layout":z.css("tableLayout")||"auto"},fb=z[0].style.width||"";x();var gb,hb=function(){(gb=t())()};hb();var ib=v(),jb=w();jb(ib("init"),!0);var kb=f.debounce(function(){jb(ib("windowScrollDone"),!1)},300),lb=function(){jb(ib("windowScroll"),!1),kb()},mb=function(){jb(ib("containerScroll"),!1)},nb=function(){m(),x(),hb(),ib=v(),(jb=w())(ib("resize"),!0,!0)},ob=f.debounce(function(){x(),m(),hb(),ib=v(),jb(ib("reflow"),!0)},1);O?J?I.on(c("scroll"),mb):(I.on(c("scroll"),mb),j.on(c("scroll"),lb)):j.on(c("scroll"),lb),j.on(c("load"),ob),b(o.debounceResizeMs,c("resize"),nb),z.on("reflow",ob),e(z)&&z.on("filter",ob).on("sort",ob).on("page",ob),z.data("floatThead-attached",{destroy:function(){var a=".fth-"+y;q(),z.css(eb),U.remove(),h&&N.remove(),Y.parent().length&&Y.replaceWith(A),z.off("reflow"),I.off(a),P&&I.unwrap(),X.remove(),z.data("floatThead-attached",!1),j.off(a)},reflow:function(){ob()},setHeaderHeight:function(){i()},getFloatContainer:function(){return X},getRowGroups:function(){return E?X.find("thead").add(z.find("tbody,tfoot")):z.find("thead,tbody,tfoot")}}),k++}),this}}(jQuery),function(a){a.floatThead=a.floatThead||{},a.floatThead._=window._||function(){var b={},c=Object.prototype.hasOwnProperty,d=["Arguments","Function","String","Number","Date","RegExp"];return b.has=function(a,b){return c.call(a,b)},b.keys=function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[];for(var d in a)b.has(a,d)&&c.push(d);return c},a.each(d,function(){var a=this;b["is"+a]=function(b){return Object.prototype.toString.call(b)=="[object "+a+"]"}}),b.debounce=function(a,b,c){var d,e,f,g,h;return function(){f=this,e=arguments,g=new Date;var i=function(){var j=new Date-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e)))},j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e)),h}},b}()}(jQuery);

//Wrap floatThead table's first tr with thead for use with floatThead (MediaWiki doesn't support thead elements by default)
$( '.fixedheader tr:first-of-type' ).wrap( '<thead></thead>' );

$( 'table.fixedheader' ).floatThead({useAbsolutePositioning: false}); //specifically request a table element so it doesn't run if the user gives something else the .fixedheader class

$('#SliderButton').click(function() {alert("Hi!");  });

$("#p-BS01_Pages").append("<iframe src=\'//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FBIONICLEsector01&amp;width&amp;height=80&amp;colorscheme=light&amp;layout=button&amp;show_faces=true&amp;appId=144449248908285\' scrolling=\'no\' frameborder=\'0\' style=\'width:100px; border:none; overflow:hidden; height:20px;\' allowTransparency=\'true\'></iframe>");
$("#p-BS01_Pages").append("<a href=\'https://twitter.com/BS01LUG\' class=\'twitter-follow-button\' data-show-count=\'false\' data-show-screen-name=\'false\'>Follow @BS01LUG</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>");

/* Twitter stuffs */
function twit(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}
twit(document,"script","twitter-wjs");
$('<a class="twitter-timeline" href="https://twitter.com/BS01LUG" data-widget-id="537044828773969920" width="520" height="500" data-theme="dark" data-link-color="#1A97AF">Tweets by @BS01LUG</a>').appendTo('#twitter-timeline');
// twttr.widgets.load(); // force the thing to load because it doesn't want to otherwise
/*$('#twitter-widget-1').ready(function() {
$( 'iframe#twitter-widget-1' ).css( {'width': '100%'} ); //If width:100% !important is placed in Common.css, the widget loads without using its small CSS and the format breaks (the "tweet @BS01LUG" box is cut off). This tricks it into loading the small version and then making it larger so the small CSS is used and everything is formatted correctly. jQuery doesn't understand !important, but it works if you just set the width to 100% without it. (Maybe it's not needed because the CSS is applied after everything else loads?)
});*/

/* Spoilers */
$( document ).ready(function() {
  $( '.hidden-spoilers a' ).attr( 'disabled', 'disabled' ); /* disable links on page load */
});

$( '.spoilers' ).click(function() {
  $( this ).toggleClass( 'hidden-spoilers' );
  if ( $( this ).hasClass( 'hidden-spoilers' ) ) {
    $( this ).find( 'a' ).attr( 'disabled', 'disabled' ); /* disable links (attribute does it for IE, CSS does it for other browsers) */
  } else {
    $( this ).find( 'a' ).removeAttr( 'disabled' ); /* enable links */
  }
});