User:Pecoes/global.js

//var talkNameSpaces = [1,3,5,7,9,11,13,15,110,111,401,500,501,502,503];

var menu = [ ['JE Modding', 'http://jadeempire-modding.wikia.com/', ['Sandbox', 'http://jadeempire-modding.wikia.com/wiki/User:Pecoes/Sandbox'], ['Wikia.css', 'http://jadeempire-modding.wikia.com/wiki/MediaWiki:Wikia.css'], ['Common.js', 'http://jadeempire-modding.wikia.com/wiki/MediaWiki:Common.js'] ],   ['Community Central', 'http://community.wikia.com/', ['Admin Forum', 'http://community.wikia.com/wiki/Admin_Central:Forum'], ['Community Forum', 'http://community.wikia.com/wiki/Forum:Community_Central_Forum'] ],   ['Dev', 'http://dev.wikia.com/'] ];

function renderMenu (menu) { if (undefined == window.wgUserName) return ''; var html = ''; html += ''; html += ''; html += ''; if (undefined != menu && menu instanceof Array) { html += ''; for (var i = 0; i < menu.length; i++) { html += renderMenuLevelOne(menu[i]); }       html += ""; }   html += ''; return html; }

function renderMenuLevelOne (menu) { var url, title, html; title = undefined != menu[0] && typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = undefined != menu[1] && typeof menu[1] == 'string' ? menu[1] : 'undefined'; html = ''; html += '' + title; if (menu.length > 2) { html += ''; html += ''; html += ''; for (var i = 2; i < menu.length; i++) { html += renderMenuLevelTwo(menu[i]); }       html += ""; }   else html += ''; html += ''; return html; }

function renderMenuLevelTwo (menu) { var url, title, html; title = undefined != menu[0] && typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = undefined != menu[1] && typeof menu[1] == 'string' ? menu[1] : 'undefined'; html = '<a class="subnav-3a" href="' + url + '">' + title + '</a></li>'; return html; }

$('#WikiHeader nav ul:first').append(renderMenu(menu)); $('#WikiHeader > nav').css({ width: "580" }); var navWidth = 0; $('#WikiHeader > nav > ul > li').each(function { navWidth += $(this).width; }); if (560 < navWidth) $('#WikiHeader > nav > ul > li > a').css({ paddingLeft: "11px", paddingRight: "11px" });

$(function {

/*   // wikimarks: if (undefined != extraMenu) { $('#WikiHeader nav ul:first').append(addExtraMenu(extraMenu)); }   */

/*   if (undefined != window.wgNamespaceNumber && -1 < $.inArray(wgNamespaceNumber, talkNameSpaces)) { function appendSignature { var edits = $('#cke_contents_wpTextbox1 iframe').contents.find('#bodyContent :last-child'); $(edits[edits.length-1]).before(' -- &#126;~'); }       $('#editform').submit(appendSignature); $('#publish').click(appendSignature); }   */    });