MediaWiki:Common.js: Difference between revisions

From Tardis Wiki, the free Doctor Who reference
(-ajax batch delete)
 
(197 intermediate revisions by 6 users not shown)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
console.log("Common.js is running");
//importScriptPage('ShowHide/code.js', 'dev');
/* ================
//importScriptPage('EditIntroButton/code.js', 'dev' );
  TABLE stuff
//importScriptPage('AjaxBatchDelete/code.js', 'dev');
  ================ */
//importScriptPage('DisableArchiveEdit/code.js', 'dev');
importScriptPage('DupImageList/code.js', 'dev');
// importScriptPage('AdvancedOasisUI/code.js', 'dev'); violates Wikia TOU but is okay for individual users to use
//importScriptPage('PurgeButton/code.js', 'dev');
//importScriptPage('ShowAdsButton/code.js', 'dev');


//$("tr:odd").addClass("zebra-stripe"); (adversely affects TOCs for a reason I've not yet determined)


/*
$("table").delegate('td','mouseover mouseleave', function(e) {
* Copyright © 2009, Daniel Friesen
    if (e.type == 'mouseover') {
* All rights reserved.
      $(this).parent().addClass("hover");
*
      $("colgroup").eq($(this).index()).addClass("hover2");
* Redistribution and use in source and binary forms, with or without
    }
* modification, are permitted provided that the following conditions are met:
    else {
*    * Redistributions of source code must retain the above copyright
      $(this).parent().removeClass("hover");
*      notice, this list of conditions and the following disclaimer.
      $("colgroup").eq($(this).index()).removeClass("hover2");
*    * Redistributions in binary form must reproduce the above copyright
    }
*      notice, this list of conditions and the following disclaimer in the
});
*      documentation and/or other materials provided with the distribution.
/* ================
*    * Neither the name of the script nor the
  ROTATING PICS
*      names of its contributors may be used to endorse or promote products
  helps with infobox
*      derived from this software without specific prior written permission.
  images of characters
*
  with mulitple
* THIS SOFTWARE IS PROVIDED BY DANIEL FRIESEN ''AS IS'' AND ANY
  actors, principally
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  [[The Doctor]] and
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  [[The Master]].
* DISCLAIMED. IN NO EVENT SHALL DANIEL FRIESEN BE LIABLE FOR ANY
 
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  Also has some helper
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  CSS elsewhere.
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  ================
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  globals defaults:true, window:false, $:false
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
if (skin == "monaco" || skin == "monobook" || skin == "oasis" || skin == "wikia") {
  (function($) {
      // Configuration
      var config = window.ArchiveToolConfig = $.extend(true, {
        archiveListTemplate: window.archiveListTemplate || 'ArchiveList',
        archivePageTemplate: window.archivePageTemplate || 'ArchivePage',
        archiveSubpage: 'Archive',
        userLang: true,
        // Deutsch
        de: {
            buttonArchiveTool: "Archivieren",
            buttonArchiveToolTooltip: "Seite archivieren",
            buttonSelectAll: "Alle auswählen",
            buttonDeselectAll: "Keine auswählen",
            buttonSaveArchive: "Archiv speichern",
            buttonAbort: "Abbrechen",
            labelLines: "Zeilen",
            labelSections: "Abschnitte",
            summaryArchiveFrom: "ArchiveTool: Archiviert von",
            summaryArchiveTo: "ArchiveTool: Archiviert als"
        },
        // English
        en: {
            buttonArchiveTool: "Archive",
            buttonArchiveToolTooltip: "Archive this page",
            buttonSelectAll: "Select all",
            buttonDeselectAll: "Deselect all",
            buttonSaveArchive: "Save archive",
            buttonAbort: "Abort",
            labelLines: "Lines",
            labelSections: "Sections",
            summaryArchiveFrom: "ArchiveTool: Archiving from",
            summaryArchiveTo: "ArchiveTool: Archiving to"
        }
      }, window.ArchiveToolConfig || {});
      // Function for multi-language support
      function msg(name) {
        if ( config.userLang && wgUserLanguage in config && name in config[wgUserLanguage] )
            return config[wgUserLanguage][name];
        if ( wgContentLanguage in config && name in config[wgContentLanguage] )
            return config[wgContentLanguage][name];
        return config.en[name];
      }
      if ( wgNamespaceNumber % 2 === 1 && ( wgAction === "view" || wgAction === "purge" ) ) {
        var pageBody, pageControls, pageControlHTML;
        var buttonPrimary = buttonSecondary = ['', ''];
        importStylesheetPage('ArchiveTool/code.css', 'dev');
        switch(skin) {
            case 'monaco':
              pageBody = '#bodyContent';
              pageControls = '#page_controls';
              pageControlHTML = '<li id="control_archive"><img src="/skins/common/blank.gif" class="sprite move" /><a id="ca-archive" title="' + msg('buttonArchiveToolTooltip') + '" href="#" rel="nofollow">' + msg('buttonArchiveTool') + '</a></li>';
              buttonPrimary = ['<a class="wikia-button">', '</a>'];
              buttonSecondary = ['<a class="wikia-button secondary">', '</a>'];
              break;
            case 'monobook':
              pageBody = '#bodyContent';
              pageControls = '#p-cactions > div > ul';
              pageControlHTML = '<li id="control_archive"><a id="ca-archive" title="' + msg('buttonArchiveToolTooltip') + '" href="#" rel="nofollow">' + msg('buttonArchiveTool') + '</a></li>';
              buttonPrimary = ['<input type="submit" style="font-weight: bold;" value="', '" />'];
              buttonSecondary = ['<input type="submit" value="', '" />'];
              break;
            case 'oasis':
            case 'wikia':
              pageBody = '#WikiaArticle';
              pageControls = (wgNamespaceNumber == 3) ? '#WikiaUserPagesHeader > ul.wikia-menu-button > li > ul' : '#WikiaPageHeader > ul.wikia-menu-button > li > ul';
              pageControlHTML = '<li id="control_archive"><a id="ca-archive" rel="nofollow">' + msg('buttonArchiveTool') + '</a></li>';
              buttonPrimary = ['<a class="wikia-button">', '</a>'];
              buttonSecondary = ['<a class="wikia-button secondary">', '</a>'];
              break;
        }
        $(function() {
            function api(q, fn) {
              q.format = 'json';
              return $.post(wgScriptPath + '/api.php', q, fn, "json");
            }
            function token(page, fn) {
              api({
                  action: 'query',
                  query: 'prop',
                  prop: 'info',
                  titles: page,
                  intoken: 'edit'
              }, function(q) {
                  for ( var k in q.query.pages )
                    return fn(q.query.pages[k]);
              });
            }
            function startArchiving() {
              var c = config.archiveListTemplate.substr(0,1);
              var archiveListRegex = '['+c.toUpperCase()+c.toLowerCase()+']'+config.archiveListTemplate.substr(1);
              var bc = $(pageBody).addClass('archiving').empty();
              $('<img class="ajax" alt="Loading..." />')
                  .attr({src: stylepath+'/common/progress-wheel.gif'}).appendTo(bc);
              api({
                  action: 'query',
                  prop: 'revisions',
                  titles: wgPageName,
                  rvprop: 'timestamp|content'
              }, function(q) {
                  bc.empty();
                  var rev = q.query.pages[wgArticleId].revisions[0];
                  var time = rev.timestamp;
                  var talkToken, tokenTime;
                  var content = rev['*'];
                  token(wgPageName, function(p) {
                    talkToken = p.edittoken;
                    tokenTime = p.starttimestamp;
                  });
                  var lines = content.split('\n');
                  var table = $('<table style="margin: 10px 0;"><thead><tr><th>' + msg('labelLines') + '</th><th title="' + msg('labelSections') + '">{&hellip;}</th></tr></thead></table>').appendTo(bc);
                  var ul = $('<tbody/>').appendTo(table);
                  for ( var l = 0; l < lines.length; l++ ) {
                    var line = lines[l];
                    $('<tr/>').toggleClass('noarchive', (new RegExp('^\\{\\{'+archiveListRegex+'\}\}')).test(line))
                        .attr({line:line})
                        .append( $('<td class=line />').text(line).append('&nbsp;') ).appendTo(ul);
                  }
                  var sections = [];
                  var sectionEnd = lines.length-1;
                  for ( var l = lines.length-1; l >= 0; l-- ) {
                    var line = lines[l];
                    if ( /^=.+?=/.test(line) || l === 0 ) {
                        var section = { start: l, end: sectionEnd };
                        section.length = section.end - section.start + 1;
                        sections.unshift(section);
                        sectionEnd = l-1;
                    }
                  }
                  var section;
                  while( section = sections.shift() ) {
                    var tr = ul.children().eq(section.start);
                    $('<td class=section />').attr({rowspan: section.length}).appendTo(tr);
                  }
                  $('<div class="buttons" style="text-align: right;" />').append(
                    $(buttonSecondary[0] + msg('buttonSelectAll') + buttonSecondary[1]).click(function(e) {
                        e.preventDefault();
                        ul.children('tr').addClass('archive');
                    }), ' ',
                    $(buttonSecondary[0] + msg('buttonDeselectAll') + buttonSecondary[1]).click(function(e) {
                        e.preventDefault();
                        ul.children('tr').removeClass('archive');
                    }), ' ',
                    $(buttonPrimary[0] + msg('buttonSaveArchive') + buttonPrimary[1]).click(function(e) {
                        archive();
                    }), ' ',
                    $(buttonPrimary[0] + msg('buttonAbort') + buttonPrimary[1]).click(function(e) {
                        bc.find('.ajax').remove();
                        location = wgServer+wgScript+'?title='+encodeURI(wgPageName)+'&action=purge';
                    })
                  ).prependTo(bc).clone(true).appendTo(bc);
                  var click = false;
                  var add;
                  table.mousedown(function(e) {
                    e.preventDefault();
                    var $li = $(e.target).closest('tr');
                    if(!$li.length) return;
                    var $section = $(e.target).closest('.section');
                    if ( $section.length ) {
                        var slist = $li.nextAll(':lt('+(parseInt($section.attr('rowspan'),10)-1)+')').andSelf();
                        var sadd = slist.filter(function() { return !$(this).hasClass('archive') }).length;
                        slist.toggleClass('archive', !!sadd);
                        return;
                    }
                    click = true;
                    add = !$li.hasClass('archive');
                    $li.toggleClass('archive', !!add);
                  });
                  table.mouseover(function(e) {
                    if (!click) return;
                    var $li = $(e.target).closest('tr');
                    if(!$li.length) return;
                    $li.toggleClass('archive', !!add);
                  });
                  $('body').mouseup(function(e) {
                    click = false;
                  });
                  function archive() {
                    var talkLines = [];
                    var archiveLines = [];
                    ul.children().each(function() {
                        var arr = $(this).hasClass('noarchive') || !$(this).hasClass('archive')
                          ? talkLines : archiveLines;
                        arr.push( $(this).attr('line') );
                    });
                    if ( !(new RegExp('^\\{\\{'+archiveListRegex+'\}\}')).test(talkLines[0]) )
                        talkLines = ['{{'+config.archiveListTemplate+'}}', ''].concat(talkLines);
                    archiveLines = ['{{'+config.archivePageTemplate+'}}', ''].concat(archiveLines);
                    bc.empty();
                    $('<img class="ajax" alt="Loading..." />')
                        .attr({src: stylepath+'/common/progress-wheel.gif'}).appendTo(bc);
                    //$('<pre/>').text(talkLines.join('\n')).appendTo(bc);
                    //$('<pre/>').text(archiveLines.join('\n')).appendTo(bc);
                    runArchive(talkLines.join('\n'), archiveLines.join('\n'));
                  }
                  var archiveTitle;
                  function runArchive(talkContent, archiveContent) {
                    var archiveNo;
                    function findArchives() {
                        var m = $('<p>Finding archive id: </p>').appendTo(bc);
                        api({
                          action: 'query',
                          list: 'allpages',
                          apnamespace: wgNamespaceNumber,
                          apprefix: wgTitle+'/'+config.archiveSubpage,
                          aplimit: 1,
                          apdir: 'descending'
                        }, function(q) {
                          archiveNo = q.query.allpages.length ?
                              parseInt(q.query.allpages[0].title.substr(wgPageName.length+("/"+config.archiveSubpage).length),10)+1 :
                              1;
                          archiveTitle = wgPageName+'/'+config.archiveSubpage+' '+archiveNo;
                          m.append('done... (using '+archiveNo+')');
                          saveArchive();
                        });
                    }
                    function saveArchive() {
                        var m = $('<p>Finding token for '+archiveTitle+': </p>').appendTo(bc);
                        token(archiveTitle, function(p) {
                          m.append('done...');
                          m = $('<p>Saving archive page: </p>').appendTo(bc);
                          api({
                              action: 'edit',
                              title: archiveTitle,
                              text: archiveContent,
                              token: p.edittoken,
                              summary: "''"+ msg('summaryArchiveFrom') + " [["+wgPageName+"]].''",
                              minor: true,
                              createonly: true
                          }, function(q) {
                              if ( q.error && q.error.code === "articleexists" ) {
                                m.append('failed...');
                                bc.append("<p>The archive page we tried to create already exists.</p>");
                                return abort();
                              }
                              m.append('done...');
                              saveTalk();
                          });
                        });
                    }
                    function saveTalk() {
                        var m = $('<p>Finding token for '+wgPageName+': </p>').appendTo(bc);
                        m.append('done...');
                        m = $('<p>Updating talk page: </p>').appendTo(bc);
                        api({
                          action: 'edit',
                          title: wgPageName,
                          text: talkContent,
                          token: talkToken,
                          summary: "''" + msg('summaryArchiveTo') + " [["+archiveTitle+"]].''",
                          minor: true,
                          basetimestamp: time,
                          starttimestamp: tokenTime
                        }, function(q) {
                          if ( q.edit.result === "Success" ) {
                              m.append('done...');
                              bc.find('.ajax').remove();
                              location = wgServer+wgScript+'?title='+encodeURI(wgPageName)+'&action=purge';
                          } else {
                              m.append('failed...');
                              bc.append("<p>Failed to update talkpage, you may wish to have the archive subpage we just created deleted.</p>");
                              return abort();
                          }
                        });
                    }
                    function abort() {
                        bc.find('.ajax').remove();
                        bc.append("<p>Aborting...</p>");
                        $("<p>You may want to </p>")
                          .append( $('<a>refresh</a>').attr({href: wgServer+wgArticlePath.replace('$1', encodeURI(wgPageName))}) )
                          .append(' and try again.')
                          .appendTo(bc);
                    }
                    // start
                    findArchives();
                  }
              });
            }
            $(pageControlHTML)
              .click(startArchiving)
              .appendTo(pageControls);
        });
      }
  })(jQuery);
}
 
/*This comes from [[starwars:User:Sikon/preload.js]] and implements the preloadable template system at bottom of input page*/


document.write('<script type="text/javascript" src="'
  First of all we need to detect whether browser
    + '/index.php?title=MediaWiki:Functions.js&action=raw&ctype=text/javascript"></script>');
  supports animation natively or it needs a javascript
  polyfill.


function fillPreloads()
  The detection code by the courtesy of Christian Heilmann
{
  http://hacks.mozilla.org/2011/09/detecting-and-generating-css-animations-in-javascript/ */
    var div = document.getElementById("lf-preload");


     if(div == null)
var animation = false,
        return;
     elm = document.createElement('detect'),
    animationstring = 'animation',
    keyframeprefix = '',
    domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
    pfx  = '';


    div.style.display = 'block';
    var span = document.getElementById('lf-preload-cbox');


    var comboString = "<select id='stdPreloads' onchange='onPreloadChange()'>";
if( elm.style.animationName ) { animation = true; }
    comboString += "</select>";
    span.innerHTML = comboString;
   
    span = document.getElementById('lf-preload-pagename');
    span.innerHTML = '<input type="text" class="textbox" />';
    span = document.getElementById('lf-preload-button');
    span.innerHTML = '<input type="button" class="button" value="Insert" onclick="doCustomPreload()" />';


     requestComboFill('stdPreloads', "Template:Stdpreloads");
if( animation === false ) {
  for( var i = 0; i < domPrefixes.length; i++ ) {
     if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) {
      pfx = domPrefixes[ i ];
      animationstring = pfx + 'Animation';
      keyframeprefix = '-' + pfx.toLowerCase() + '-';
      animation = true;
      break;
    }
  }
}
}


function doCustomPreload()
(function ($) {
{
    $.slowEach = function (array, interval, callback) {
    doPreload(document.getElementById('lf-preload-pagename').getElementsByTagName('input')[0].value);
        if (!array.length) {
}
            return;
 
        }
function onPreloadChange()
        var i = 0;
{
        function next() {
    var combo = document.getElementById("stdPreloads");
            if (callback.call(array[i], i, array[i]) !== false) {
    var value = combo.options[combo.selectedIndex].value;
                if (++i < array.length) {
                    setTimeout(next, interval);
                }
            }
        }
        next();
        return array;
    };
    $.fn.dissolve = function (options) {
        var op = $.extend(defaults, options),
            $that = $(this),
            interval = op.visibleItemDuration + op.transitionDuration;
        return $.slowEach(this, interval, function () {
            var $this = $(this);
            $this
                .animate({
                    opacity: 1
                }, op.transitionDuration, function () {
                    function initCarousel() {
                        $that.dissolve(options);
                    }
                    if ($this.is(':last-child')) {
                        setTimeout(initCarousel, op.visibleItemDuration);
                    }
                })
                .delay(op.visibleItemDuration)
                .animate({
                    opacity: 0
                }, op.transitionDuration);
        });
    };
    var defaults = {
        visibleItemDuration: 4000,
        transitionDuration: 1000
    };
}(window.jQuery));


     if(value == "")
$(function () {
         return;
     if( animation === false ) {
         $('.dissolve .item').dissolve({
            // TUNE YOUR CAROUSEL HERE


    value = "Template:" + value + "/preload";
            // duration of an item being visible in miliseconds
    value = value.replace(" ", "_");
            visibleItemDuration: 4000,
    doPreload(value);
}


addOnloadHook(fillPreloads);
            // duration of a transition between items in miliseconds
            transitionDuration: 1000
        });
    }
});


/* Preload system ends */
/* ================
  ARCHIVE TOOL
  customisation
  ================ */
var ArchiveToolConfig = {
  archiveListTemplate: 'ArchCat',
  archivePageTemplate: 'ArchPage',
  archiveSubpage: 'Archive',
  userLang: true
};


/* The following Facebook box builder comes from Improvaganza Wiki. It's sort of cool, but it may not be something
/* ================
we keep around. It creates a little box allowing you to like whatever thing appears after "id="
  {{pullout}}
  below. At present, it's using the id for Doctor Who on Facebook. You can see an example of what it
  Accesability
  does at [[user:CzechOut/Sandbox10]]. Might be an idea to rotate it every once in a while, putting up the id of
  tweaks
  whatever's the "hottest" thing in the DWU at the moment.
  ================ */
 
$(document).ready(function(){
  The IDs of some other shows:
$('.pullout-content').each(function(i, obj) {
 
    $(obj).attr("aria-hidden","false");
  Torchwood: 113521238658450
    var toggle = $(".pullout-handle");
  The Sarah Jane Adventures: 109282012424173
    $(toggle).attr("aria-controls","mw-customcollapsible-pullout");
  Doctor Who:  127031120644257
$(toggle).attr("title","Hide editor notices");
  Big Finish: 109833429043462 */
$(toggle).attr("aria-label","Hide editor notices");
 
});
function fBox() {
});
$('#fbox').append('<iframe marginheight="0" marginwidth="0" src="http://www.facebook.com/connect/connect.php?id=127031120644257&amp;connections=10" align="top" frameborder="0" width="300" height="90" scrolling="no" />');
$(".pullout-content").on("afterExpand.mw-collapsible", function() {
}
$(this).attr("aria-hidden","false");
var toggle = $(".pullout-handle");
$(toggle).attr("aria-expanded","true");
$(toggle).attr("title","Hide editor notices");
$(toggle).attr("aria-label","Hide editor notices");
});
$(".pullout-content").on("afterCollapse.mw-collapsible", function() {
$(this).attr("aria-hidden","true");
var toggle = $(".pullout-handle");
$(toggle).attr("aria-expanded","false");
$(toggle).attr("title","Show editor notices");
$(toggle).attr("aria-label","Show editor notices");
});


$(fBox);
/* ================
  {{nwlh}}
  ================
  re-instate if external links are set to open in new tabs
$(document).ready(function(){
$('NWLH').children("a").each(function(i, obj) {
$(obj).removeAttr("target");
});
}); */

Latest revision as of 21:10, 9 April 2024

console.log("Common.js is running");
/* ================
   TABLE stuff 
   ================ */

//$("tr:odd").addClass("zebra-stripe"); (adversely affects TOCs for a reason I've not yet determined)

$("table").delegate('td','mouseover mouseleave', function(e) {
    if (e.type == 'mouseover') {
      $(this).parent().addClass("hover");
      $("colgroup").eq($(this).index()).addClass("hover2");
    }
    else {
      $(this).parent().removeClass("hover");
      $("colgroup").eq($(this).index()).removeClass("hover2");
    }
});
/* ================
   ROTATING PICS
   helps with infobox
   images of characters
   with mulitple 
   actors, principally
   [[The Doctor]] and
   [[The Master]].
   
   Also has some helper
   CSS elsewhere.
   ================
   
   globals defaults:true, window:false, $:false

   First of all we need to detect whether browser
   supports animation natively or it needs a javascript
   polyfill.

   The detection code by the courtesy of Christian Heilmann
   http://hacks.mozilla.org/2011/09/detecting-and-generating-css-animations-in-javascript/ */

var animation = false,
    elm = document.createElement('detect'),
    animationstring = 'animation',
    keyframeprefix = '',
    domPrefixes = 'Webkit Moz O ms Khtml'.split(' '),
    pfx  = '';


if( elm.style.animationName ) { animation = true; }

if( animation === false ) {
  for( var i = 0; i < domPrefixes.length; i++ ) {
    if( elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined ) {
      pfx = domPrefixes[ i ];
      animationstring = pfx + 'Animation';
      keyframeprefix = '-' + pfx.toLowerCase() + '-';
      animation = true;
      break;
    }
  }
}

(function ($) {
    $.slowEach = function (array, interval, callback) {
        if (!array.length) {
            return;
        }
        var i = 0;
        function next() {
            if (callback.call(array[i], i, array[i]) !== false) {
                if (++i < array.length) {
                    setTimeout(next, interval);
                }
            }
        }
        next();
        return array;
    };
    $.fn.dissolve = function (options) {
        var op = $.extend(defaults, options),
            $that = $(this),
            interval = op.visibleItemDuration + op.transitionDuration;
        return $.slowEach(this, interval, function () {
            var $this = $(this);
            $this
                .animate({
                    opacity: 1
                }, op.transitionDuration, function () {
                    function initCarousel() {
                        $that.dissolve(options);
                    }
                    if ($this.is(':last-child')) {
                        setTimeout(initCarousel, op.visibleItemDuration);
                    }
                })
                .delay(op.visibleItemDuration)
                .animate({
                    opacity: 0
                }, op.transitionDuration);
        });
    };
    var defaults = {
        visibleItemDuration: 4000,
        transitionDuration: 1000
    };
}(window.jQuery));

$(function () {
    if( animation === false ) {
        $('.dissolve .item').dissolve({
            // TUNE YOUR CAROUSEL HERE

            // duration of an item being visible in miliseconds
            visibleItemDuration: 4000,

            // duration of a transition between items in miliseconds
            transitionDuration: 1000
        });
    }
});

/* ================
   ARCHIVE TOOL
   customisation 
   ================ */
var ArchiveToolConfig = { 
   archiveListTemplate: 'ArchCat',
   archivePageTemplate: 'ArchPage',
   archiveSubpage: 'Archive',
   userLang: true
};

/* ================
   {{pullout}}
   Accesability
   tweaks
   ================ */
$(document).ready(function(){
	$('.pullout-content').each(function(i, obj) {
	    $(obj).attr("aria-hidden","false");
	    var toggle = $(".pullout-handle");
	    $(toggle).attr("aria-controls","mw-customcollapsible-pullout");
		$(toggle).attr("title","Hide editor notices");
		$(toggle).attr("aria-label","Hide editor notices");
	});
}); 
$(".pullout-content").on("afterExpand.mw-collapsible", function() {
	$(this).attr("aria-hidden","false");
	var toggle = $(".pullout-handle");
	$(toggle).attr("aria-expanded","true");
	$(toggle).attr("title","Hide editor notices");
	$(toggle).attr("aria-label","Hide editor notices");
});
$(".pullout-content").on("afterCollapse.mw-collapsible", function() {
	$(this).attr("aria-hidden","true");
	var toggle = $(".pullout-handle");
	$(toggle).attr("aria-expanded","false");
	$(toggle).attr("title","Show editor notices");
	$(toggle).attr("aria-label","Show editor notices");
});

/* ================
   {{nwlh}}
   ================
   re-instate if external links are set to open in new tabs
$(document).ready(function(){
	$('NWLH').children("a").each(function(i, obj) {
		$(obj).removeAttr("target");
	});
}); */