From RuneGlory
Line 1: | Line 1: | ||
− | / | + | /********** Any JavaScript here will be loaded for all users on every page load **********/ |
+ | |||
+ | // Allow Jquery | ||
jquery = document.createElement( "script" ); | jquery = document.createElement( "script" ); | ||
Line 11: | Line 13: | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /********** Structure **********/ | ||
+ | |||
+ | // Remove unnecessary elements | ||
$( "div#mw-page-base, div#mw-head-base" ).remove(); | $( "div#mw-page-base, div#mw-head-base" ).remove(); | ||
+ | |||
+ | // Wrap the content | ||
+ | |||
$( "div#content, div#mw-navigation" ).wrapAll( "<div id='wrap'></div>" ); | $( "div#content, div#mw-navigation" ).wrapAll( "<div id='wrap'></div>" ); | ||
− | $( "nav" ).insertBefore( "div#wrap" ); | + | |
+ | // Insert the header | ||
+ | |||
+ | $( "<nav> | ||
+ | <ul> | ||
+ | <li id='n-Home'> | ||
+ | <a href='https://www.grinderscape.org/'>Home</a> | ||
+ | </li> | ||
+ | <li id='n-Forums'> | ||
+ | <a href='http://forum.grinderscape.org/'>Forums</a> | ||
+ | </li> | ||
+ | <li id='n-Wiki'> | ||
+ | <a href='https://newwiki.grinderscape.org/Main_Page'>Wiki</a> | ||
+ | </li> | ||
+ | <li id='n-Vote'> | ||
+ | <a href='https://www.grinderscape.org/vote/status'>Vote</a> | ||
+ | </li> | ||
+ | <li id='n-Donate'> | ||
+ | <a href='https://www.grinderscape.org/donate'>Donate</a> | ||
+ | </li> | ||
+ | <li id='n-Marketplace'> | ||
+ | <a href='https://www.grinderscape.org/marketplace/all'>Marketplace</a> | ||
+ | </li> | ||
+ | <li id='n-Highscores'> | ||
+ | <a href='https://www.grinderscape.org/highscores/mode/regular'>Highscores</a> | ||
+ | </li> | ||
+ | <li id='n-Webclient'> | ||
+ | <a href='http://www.grinderscape.org/play'>Webclient</a> | ||
+ | </li> | ||
+ | <li id='n-Download'> | ||
+ | <a href='https://www.grinderscape.org/play/download'>Download</a> | ||
+ | </li> | ||
+ | </ul> | ||
+ | </nav>" ).insertBefore( "div#wrap" ); | ||
+ | |||
+ | // Insert the footer | ||
+ | |||
+ | $( "<div id='customFooter'> | ||
+ | <p>Theme developed by <a href='http://forum.grinderscape.org/members/56905'>Jplayer</a>.</p> | ||
+ | <p>GrinderScape is not affiliated with Jagex or Runescape in any way.</p> | ||
+ | </div>" ).insertBefore( "ul#footer-places" ); | ||
+ | |||
+ | // Organize the elements | ||
$( "div#mw-navigation" ).insertBefore( "div#content" ); | $( "div#mw-navigation" ).insertBefore( "div#content" ); | ||
− | |||
$( "div#content" ).wrap( "<div id='content-sidebar-wrap'></div>" ); | $( "div#content" ).wrap( "<div id='content-sidebar-wrap'></div>" ); | ||
$( "div#mw-panel" ).insertBefore( "div#content" ); | $( "div#mw-panel" ).insertBefore( "div#content" ); | ||
Line 27: | Line 80: | ||
$( "div#contentSub, div#content" ).wrapAll( "<div id='content-contentSub-wrap'></div>" ); | $( "div#contentSub, div#content" ).wrapAll( "<div id='content-contentSub-wrap'></div>" ); | ||
$( "div#siteNotice" ).insertAfter( "div#mw-navigation" ); | $( "div#siteNotice" ).insertAfter( "div#mw-navigation" ); | ||
+ | |||
+ | // Set up the breadcrumb | ||
+ | |||
if ( $( "span.subpages" ).length ) { | if ( $( "span.subpages" ).length ) { | ||
$( "span.subpages" ).html( $( "span.subpages" ).children() ); | $( "span.subpages" ).html( $( "span.subpages" ).children() ); | ||
Line 38: | Line 94: | ||
} | } | ||
− | $( "div | + | // Remove href from selected tabs |
+ | |||
+ | $.each( $( "div.vectorTabs li.selected" ), function() { | ||
+ | $( this ).find( "a" ).removeAttr( "href" ); | ||
+ | }); | ||
+ | |||
+ | // Remove title from links | ||
+ | |||
+ | $( "a" ).removeAttr( "title" ); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | /********** Specific Pages **********/ | ||
+ | |||
+ | |||
+ | // Set up the index | ||
$( "div#index" ).insertAfter( "div#content-contentSub-wrap" ); | $( "div#index" ).insertAfter( "div#content-contentSub-wrap" ); | ||
Line 63: | Line 141: | ||
}); | }); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 15:07, 20 March 2016
/********** Any JavaScript here will be loaded for all users on every page load **********/ // Allow Jquery jquery = document.createElement( "script" ); jquery.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"; document.getElementsByTagName( "head" )[0].appendChild( jquery ); /********** Structure **********/ // Remove unnecessary elements $( "div#mw-page-base, div#mw-head-base" ).remove(); // Wrap the content $( "div#content, div#mw-navigation" ).wrapAll( "<div id='wrap'></div>" ); // Insert the header $( "<nav> <ul> <li id='n-Home'> <a href='https://www.grinderscape.org/'>Home</a> </li> <li id='n-Forums'> <a href='http://forum.grinderscape.org/'>Forums</a> </li> <li id='n-Wiki'> <a href='https://newwiki.grinderscape.org/Main_Page'>Wiki</a> </li> <li id='n-Vote'> <a href='https://www.grinderscape.org/vote/status'>Vote</a> </li> <li id='n-Donate'> <a href='https://www.grinderscape.org/donate'>Donate</a> </li> <li id='n-Marketplace'> <a href='https://www.grinderscape.org/marketplace/all'>Marketplace</a> </li> <li id='n-Highscores'> <a href='https://www.grinderscape.org/highscores/mode/regular'>Highscores</a> </li> <li id='n-Webclient'> <a href='http://www.grinderscape.org/play'>Webclient</a> </li> <li id='n-Download'> <a href='https://www.grinderscape.org/play/download'>Download</a> </li> </ul> </nav>" ).insertBefore( "div#wrap" ); // Insert the footer $( "<div id='customFooter'> <p>Theme developed by <a href='http://forum.grinderscape.org/members/56905'>Jplayer</a>.</p> <p>GrinderScape is not affiliated with Jagex or Runescape in any way.</p> </div>" ).insertBefore( "ul#footer-places" ); // Organize the elements $( "div#mw-navigation" ).insertBefore( "div#content" ); $( "div#content" ).wrap( "<div id='content-sidebar-wrap'></div>" ); $( "div#mw-panel" ).insertBefore( "div#content" ); $( "div#content" ).wrap( "<div id='content-wrap'></div>" ); $( "div#contentSub" ).insertBefore( "div#content" ); $( "<div id='navigation'></div>" ).insertBefore( "div#contentSub" ); $( "div#right-navigation" ).appendTo( "div#navigation" ); $( "div#left-navigation" ).appendTo( "div#navigation" ); $( "div#contentSub, div#content" ).wrapAll( "<div id='content-contentSub-wrap'></div>" ); $( "div#siteNotice" ).insertAfter( "div#mw-navigation" ); // Set up the breadcrumb if ( $( "span.subpages" ).length ) { $( "span.subpages" ).html( $( "span.subpages" ).children() ); var title = $( "h1#firstHeading" ).html().split('/'); $( "<span>" + title[ title.length - 1 ] + "</span>" ).appendTo( "span.subpages" ); $( "<span> / </span>" ).insertAfter( "span.subpages > a" ); } else { $( "div#contentSub" ).prepend( "<span class='subpages'></span>" ); var title = $( "h1#firstHeading" ).html().split('/'); $( "<span>" + title[ title.length - 1 ] + "</span>" ).appendTo( "span.subpages" ); } // Remove href from selected tabs $.each( $( "div.vectorTabs li.selected" ), function() { $( this ).find( "a" ).removeAttr( "href" ); }); // Remove title from links $( "a" ).removeAttr( "title" ); /********** Specific Pages **********/ // Set up the index $( "div#index" ).insertAfter( "div#content-contentSub-wrap" ); $.each( $( "div#index a" ), function() { var split = $( this ).html().split('/'); $( this ).html( split[ split.length - 1 ] ); }); $.each( $( "div.index-item" ), function() { $( this ).wrap( "<a></a>" ); var href = $( this ).find( "a" ).attr( "href" ); var title = $( this ).find( "a" ).attr( "title" ); $( this ).parent().attr( "href", href ).attr( "title", title ); }); $.each( $( "div#index img" ), function() { $( this ).attr( "draggable", "false" ); });