User:Jens Ingels/common.js

$(document).ready(function {

/* Eggs page- 1# Nesting Tabs */ var name = "exclusive_hybrid"; var elem = [ "terra", "flame", "sea", "nature", "electric", "ice", "metal", "dark", "light", "war" ];

$.each(elem, function( i, val ) {

$("td#h-" + name + "-" + val).each(function(index) {       $(this).parent.addClass( "ttab-content " + name + "-" + val + " content-" + index )        $(this).parent.next.addClass( "ttab-content " + name + "-" + val + " content-" + index )        $(this).parent.next.next.addClass( "ttab-content " + name + "-" + val + " content-" + index )        $(this).parent.next.next.next.addClass( "ttab-content " + name + "-" + val + " content-" + index )        $(this).css( "padding", "0px" )      });

$("table#unbreedable-" + name + " td#h-" + name + "-" + val).append(" ")

var countEggs = $('table#unbreedable-' + name + ' tr.' + name + "-" + val).length; for ( var i = 1; i < countEggs / 4; i++ ) { $("table#unbreedable-" + name + "-" + val + " tr").append(" ") }

});

/* Eggs page- 2# Tab Action */ var elem = "terra";

tab-exclusive_hybrid-terra $("td#tab-exclusive_hybrid-flame").click(function{  var elem = "flame";

$(".tab-" + name + "-" + elem + ".tab-0").click(function{     $("table#unbreedable-" + name + "-" + elem + " td").removeClass("active");      $(".tab-" + name + "-" + elem + ".tab-0").addClass("active");      $("tr." + name + "-" + elem).removeClass("active");     $("tr." + name + "-" + elem + ".content-0").addClass("active");  });

$(".tab-" + name + "-" + elem + ".tab-1").click(function{     $("table#unbreedable-" + name + "-" + elem + " td").removeClass("active");      $(".tab-" + name + "-" + elem + ".tab-1").addClass("active");      $("tr." + name + "-" + elem).removeClass("active");     $("tr." + name + "-" + elem + ".content-1").addClass("active");  });

$(".tab-" + name + "-" + elem + ".tab-2").click(function{     $("table#unbreedable-" + name + "-" + elem + " td").removeClass("active");      $(".tab-" + name + "-" + elem + ".tab-2").addClass("active");      $("tr." + name + "-" + elem).removeClass("active");     $("tr." + name + "-" + elem + ".content-2").addClass("active");  });

$(".tab-" + name + "-" + elem + ".tab-3").click(function{     $("table#unbreedable-" + name + "-" + elem + " td").removeClass("active");      $(".tab-" + name + "-" + elem + ".tab-3").addClass("active");      $("tr." + name + "-" + elem).removeClass("active");     $("tr." + name + "-" + elem + ".content-3").addClass("active");  });

$(".tab-" + name + "-" + elem + ".tab-4").click(function{     $("table#unbreedable-" + name + "-" + elem + " td").removeClass("active");      $(".tab-" + name + "-" + elem + ".tab-4").addClass("active");      $("tr." + name + "-" + elem).removeClass("active");     $("tr." + name + "-" + elem + ".content-4").addClass("active");  });

});

});

//Special CSS controller $(document).ready(function {

if (mw.config.get('wgPageName') === 'Special:CSS') { $( ".css-editor-wrapper" ).clone.prependTo( ".css-editor" ); $( ".css-editor" ).prepend( " 100% " ); };  (function  {     var countcss = 0;     $("#buttom-css").click(function  { countcss += 1; if (countcss == 1) { $( ".css-editor-wrapper" ).css( "width", "100%" ); $( ".css-side-bar" ).css( "display", "none" ); $( ".ace_gutter" ).css( "display", "none" ); $( ".ace_scroller" ).css( "left", "0px" ); }      if (countcss == 2) { $( ".css-editor-wrapper" ).css( "width", "auto" ); $( ".css-side-bar" ).css( "display", "block" ); $( ".ace_gutter" ).css( "display", "block" ); $( ".ace_scroller" ).css( "left", "49px" ); countcss = 0 }    });   }); });

/*

$("#mw-content-text h2").each(function {       if ($('#mw-content-text th#h-edit.insert-heading').length ==1) {                $(this).appendTo( $('#mw-content-text th#h-edit.insert-heading') );               $(this).children(".editsection").remove;        } });



/* test */

function sortUsingNestedText(parent, childSelector, keySelector) { var items = parent.children(childSelector).sort(function(a, b) {       var vA = $(keySelector, a).text;        var vB = $(keySelector, b).text;        return (vA < vB) ? -1 : (vA > vB) ? 1 : 0;    }); parent.append(items); }

/* setup sort attributes */ $('div#but-name').data("sortKey", "span.name");

/* sort on button click */ $("div.btnSort").click(function {  sortUsingNestedText($('.eggs-filter'), "div", $(this).data("sortKey")); });

/* testing */

$( "div#but-id" ).click(function { function sortAlpha(a,b){     return a.innerHTML.toLowerCase > b.innerHTML.toLowerCase ? 1 : -1;  };  $('div#id div').sort(sortAlpha).appendTo('div#id'); });

/* other */

$(document).ready(function {   var pageName = $('div#tooltip-link').text;

$('div#tooltip-link').load('http://dragoncity.wikia.com/wiki/' + pageName + '' + '#tooltip-content'); });

/* Test */ $("value","140881").prepend(' ');

$('ul.WikiaMenuElement').append( $(' ').attr({'name':'notify-admin', 'id':'notify-admin','type':'checkbox'}) ) .append( $(' ').text( $.msg('wall-action-all-confirm-notify') ) );

importArticles({   type: "script",    articles: [        "User:Jens_Ingels/common.js/test.js",        "external:dev:HideRail/code.js",        "external:dev:MessageBlocker/code.js"    ] });

/* Add JS buttom to Account Navigation in the Wikia skin */ $('[name="destinationBoardId"]').children('option[value="130215"]').css('display','none');

$(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( 'JS  PersonalWiki-wide</ul></li>' ); });

/* Add CSS buttom to Account Navigation in the Wikia skin */ $(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( '<li id="CSS-USER">CSS<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"> </a> <li id="CSS">Personal</a></li><li id="WIKI-CSS">Wiki-wide</a></li></ul></li>' ); });

/* Add SANDBOX buttom to Account Navigation in the Wikia skin */ $(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( '<li id="SANDBOX-USER"">SANDBOX<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"> </a> <li id="SANDBOX">10</a></li><li id="SANDBOX11">11</a></li><li id="SANDBOX12">12</a></li><li id="SANDBOX13">13</a></li><li id="SANDBOX14">14</a></li><li id="SANDBOX15">15</a></li><li id="SANDBOX16">16</a></li><li id="SANDBOX17">17</a></li></ul></li>' ); });

/* Add Infobox project buttom to Account Navigation in the Wikia skin */ $(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( '<li id="PROJECT">PROJECT</a></li>' ); });

/* Add test js to Account Navigation in the Wikia skin */ $(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( '<li id="TEST JS"">TEST JS</a></li>' ); });

// Adding links to On the Wiki tab // Modified to add links to the end of the tab instead of the beginning by Sactage // Please note that he in no way endorses this code and is not liable for any issues which may arise from its use, legal or otherwise // Per http://runescape.wikia.com/wiki/User_talk:Ryan_PM?diff=prev&oldid=4890582 $(function {   if ( skin == 'oasis' ) {        $('.WikiHeaderRestyle nav ul li.marked ul').append('About</a></li>');    } });

/* Add SANDBOX3 buttom to Account Navigation in the Wikia skin */ $(document).ready(function {   if ( skin == 'oasis' )        $( 'UL#AccountNavigation' ).prepend( '<li id="SANDBOX9"><a href="/wiki/Special:Mypage/Sandbox/9" style="font-size:12px">SANDBOX9</a></li>' ); });