User:Jens Ingels/common.js

$( document ).ready(function {

$( "div#exclusive_hybrid_navigation" ).replaceWith( '  -   -   - <img id="extab-nature" alt="Element Nature" src="http://static2.wikia.nocookie.net/__cb20130301145814/dragoncity/images/thumb/1/1d/Element_Nature.png/15px-Element_Nature.png" data-image-name="Element Nature.png" data-image-key="Element_Nature.png" data-src="http://static2.wikia.nocookie.net/__cb20130301145814/dragoncity/images/thumb/1/1d/Element_Nature.png/15px-Element_Nature.png" class="lzyPlcHld lzyTrns lzyLoaded" onload="if(typeof ImgLzy==&quot;object&quot;){ImgLzy.load(this)}" height="30" width="15">  - <img id="extab-electric" alt="Element Electric" src="http://static1.wikia.nocookie.net/__cb20130301145733/dragoncity/images/thumb/8/8a/Element_Electric.png/15px-Element_Electric.png" data-image-name="Element Electric.png" data-image-key="Element_Electric.png" data-src="http://static1.wikia.nocookie.net/__cb20130301145733/dragoncity/images/thumb/8/8a/Element_Electric.png/15px-Element_Electric.png" class="lzyPlcHld lzyTrns lzyLoaded" onload="if(typeof ImgLzy==&quot;object&quot;){ImgLzy.load(this)}" height="30" width="15">  -   -   -   -  <img id="extab-light" alt="Element Light" src="http://static1.wikia.nocookie.net/__cb20130601000120/dragoncity/images/thumb/4/44/Element_Light.png/15px-Element_Light.png" width="15" height="30" data-image-name="Element Light.png" data-image-key="Element_Light.png" /> - <img id="extab-war" alt="Element War" src="http://static1.wikia.nocookie.net/__cb20130810101750/dragoncity/images/thumb/d/de/Element_War.png/15px-Element_War.png" data-image-name="Element War.png" data-image-key="Element_War.png" data-src="http://static1.wikia.nocookie.net/__cb20130810101750/dragoncity/images/thumb/d/de/Element_War.png/15px-Element_War.png" class="lzyPlcHld lzyTrns lzyLoaded" onload="if(typeof ImgLzy==&quot;object&quot;){ImgLzy.load(this)}" height="30" width="15"> <img id="extab-war" alt="Element War" src="http://static1.wikia.nocookie.net/__cb20130810101750/dragoncity/images/thumb/d/de/Element_War.png/15px-Element_War.png" width="15" height="30" data-image-name="Element War.png" data-image-key="Element_War.png" /> - <img id="extab-pure" alt="Element Pure" src="http://static2.wikia.nocookie.net/__cb20130729011348/dragoncity/images/thumb/5/56/Element_Pure.png/15px-Element_Pure.png" data-image-name="Element Pure.png" data-image-key="Element_Pure.png" data-src="http://static2.wikia.nocookie.net/__cb20130729011348/dragoncity/images/thumb/5/56/Element_Pure.png/15px-Element_Pure.png" class="lzyPlcHld lzyTrns lzyLoaded" onload="if(typeof ImgLzy==&quot;object&quot;){ImgLzy.load(this)}" height="30" width="15"> <img id="extab-pure" alt="Element Pure" src="http://static2.wikia.nocookie.net/__cb20130729011348/dragoncity/images/thumb/5/56/Element_Pure.png/15px-Element_Pure.png" width="15" height="30" data-image-name="Element Pure.png" data-image-key="Element_Pure.png" /> ' );

});

jQuery.fn.eggsTabs = function { var o = /* hide flame */ $( "table.wikitable.dc-dot td#h-exclusive_flame" ).parents.addClass( "hide-flame" ); $( "table.wikitable.dc-dot td#h-exclusive_flame" ).parents.next.addClass( "hide-flame" ); $( "table.wikitable.dc-dot td#h-exclusive_flame" ).parents.next.next.addClass( "hide-flame" ); $( "table.wikitable.dc-dot td#h-exclusive_flame" ).parents.next.next.next.addClass( "hide-flame" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-flame" );

/* hide sea*/ $( "table.wikitable.dc-dot td#h-exclusive_sea" ).parents.addClass( "hide-sea" ); $( "table.wikitable.dc-dot td#h-exclusive_sea" ).parents.next.addClass( "hide-sea" ); $( "table.wikitable.dc-dot td#h-exclusive_sea" ).parents.next.next.addClass( "hide-sea" ); $( "table.wikitable.dc-dot td#h-exclusive_sea" ).parents.next.next.next.addClass( "hide-sea" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-sea" );

/* hide nature*/ $( "table.wikitable.dc-dot td#h-exclusive_nature" ).parents.addClass( "hide-nature" ); $( "table.wikitable.dc-dot td#h-exclusive_nature" ).parents.next.addClass( "hide-nature" ); $( "table.wikitable.dc-dot td#h-exclusive_nature" ).parents.next.next.addClass( "hide-nature" ); $( "table.wikitable.dc-dot td#h-exclusive_nature" ).parents.next.next.next.addClass( "hide-nature" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-nature" );

/* hide electric*/ $( "table.wikitable.dc-dot td#h-exclusive_electric" ).parents.addClass( "hide-electric" ); $( "table.wikitable.dc-dot td#h-exclusive_electric" ).parents.next.addClass( "hide-electric" ); $( "table.wikitable.dc-dot td#h-exclusive_electric" ).parents.next.next.addClass( "hide-electric" ); $( "table.wikitable.dc-dot td#h-exclusive_electric" ).parents.next.next.next.addClass( "hide-electric" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-electric" );

/* hide ice*/ $( "table.wikitable.dc-dot td#h-exclusive_ice" ).parents.addClass( "hide-ice" ); $( "table.wikitable.dc-dot td#h-exclusive_ice" ).parents.next.addClass( "hide-ice" ); $( "table.wikitable.dc-dot td#h-exclusive_ice" ).parents.next.next.addClass( "hide-ice" ); $( "table.wikitable.dc-dot td#h-exclusive_ice" ).parents.next.next.next.addClass( "hide-ice" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-ice" );

/* hide metal*/ $( "table.wikitable.dc-dot td#h-exclusive_metal" ).parents.addClass( "hide-metal" ); $( "table.wikitable.dc-dot td#h-exclusive_metal" ).parents.next.addClass( "hide-metal" ); $( "table.wikitable.dc-dot td#h-exclusive_metal" ).parents.next.next.addClass( "hide-metal" ); $( "table.wikitable.dc-dot td#h-exclusive_metal" ).parents.next.next.next.addClass( "hide-metal" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-metal" );

/* hide dark*/ $( "table.wikitable.dc-dot td#h-exclusive_dark" ).parents.addClass( "hide-dark" ); $( "table.wikitable.dc-dot td#h-exclusive_dark" ).parents.next.addClass( "hide-dark" ); $( "table.wikitable.dc-dot td#h-exclusive_dark" ).parents.next.next.addClass( "hide-dark" ); $( "table.wikitable.dc-dot td#h-exclusive_dark" ).parents.next.next.next.addClass( "hide-dark" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-dark" );

/* hide light*/ $( "table.wikitable.dc-dot td#h-exclusive_light" ).parents.addClass( "hide-light" ); $( "table.wikitable.dc-dot td#h-exclusive_light" ).parents.next.addClass( "hide-light" ); $( "table.wikitable.dc-dot td#h-exclusive_light" ).parents.next.next.addClass( "hide-light" ); $( "table.wikitable.dc-dot td#h-exclusive_light" ).parents.next.next.next.addClass( "hide-light" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-light" );

/* hide war */ $( "table.wikitable.dc-dot td#h-exclusive_war" ).parents.addClass( "hide-war" ); $( "table.wikitable.dc-dot td#h-exclusive_war" ).parents.next.addClass( "hide-war" ); $( "table.wikitable.dc-dot td#h-exclusive_war" ).parents.next.next.addClass( "hide-war" ); $( "table.wikitable.dc-dot td#h-exclusive_war" ).parents.next.next.next.addClass( "hide-war" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-war" );

/* hide pure */ $( "table.wikitable.dc-dot td#h-exclusive_pure" ).parents.addClass( "hide-pure" ); $( "table.wikitable.dc-dot td#h-exclusive_pure" ).parents.next.addClass( "hide-pure" ); $( "table.wikitable.dc-dot td#h-exclusive_pure" ).parents.next.next.addClass( "hide-pure" ); $( "table.wikitable.dc-dot td#h-exclusive_pure" ).parents.next.next.next.addClass( "hide-pure" ); $( "table.wikitable.dc-dot tbody" ).removeClass( "hide-pure" );

};

$( "img#extab-terra" ).click(function { $( document ).eggsTabs; $( "table.wikitable.dc-dot" ).removeClass( "hide-terra" ); });

/* var ttb0 = $( "table.wikitable.dc-dot td.bg-war" ).parents, ttb1 = $( "table.wikitable.dc-dot td.bg-war" ).parents.next, ttb2 = $( "table.wikitable.dc-dot td.bg-war" ).parents.next.next, ttb3 = $( "table.wikitable.dc-dot td.bg-war" ).parents.next.next.next;

$( document ).ready(function { $(ttb0, ttb1, ttb2, ttb3).wrap( "<tbody class='hide-war' />"); });



/*

$("#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('<img src="http://images3.wikia.nocookie.net/dragoncity/images/9/9c/Ic-news_smaller.png" alt="i"> ');

$('ul.WikiaMenuElement').append( $('<li> </li>').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( '<li id="JS-USER"><a href="/wiki/Special:Mypage/common.js" style="font-size:12px">JS<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"> </a> <li id="JS"><a href="/wiki/Special:Mypage/common.js" style="font-size:12px">Personal</a></li><li id="WIKI-JS"><a href="/wiki/MediaWiki:Common.js" style="font-size:12px">Wiki-wide</a></li></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"><a href="/wiki/Special:Mypage/common.css" style="font-size:12px">CSS<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"> </a> <li id="CSS"><a href="/wiki/Special:Mypage/common.css" style="font-size:12px">Personal</a></li><li id="WIKI-CSS"><a href="/wiki/MediaWiki:Wikia.css" style="font-size:12px">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""><a href="/wiki/Special:Mypage/Sandbox" style="font-size:12px">SANDBOX<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"> </a> <li id="SANDBOX"><a href="/wiki/Special:Mypage/Sandbox/10" style="font-size:12px">10</a></li><li id="SANDBOX11"><a href="/wiki/Special:Mypage/Sandbox/11" style="font-size:12px">11</a></li><li id="SANDBOX12"><a href="/wiki/Special:Mypage/Sandbox/12" style="font-size:12px">12</a></li><li id="SANDBOX13"><a href="/wiki/Special:Mypage/Sandbox/13" style="font-size:12px">13</a></li><li id="SANDBOX14"><a href="/wiki/Special:Mypage/Sandbox/14" style="font-size:12px">14</a></li><li id="SANDBOX15"><a href="/wiki/Special:Mypage/Sandbox/15" style="font-size:12px">15</a></li><li id="SANDBOX16"><a href="/wiki/Special:Mypage/Sandbox/16" style="font-size:12px">16</a></li><li id="SANDBOX17"><a href="/wiki/Special:Mypage/Sandbox/17" style="font-size:12px">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"><a href="/wiki/Template:Infobox_Dragons/5" style="font-size:12px">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""><a href="/wiki/Special:Mypage/common.js/test.js" style="font-size:12px">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('<li><a class="subnav-2a" href="/wiki/Dragon_City">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>' ); });