User:Pecoes/global.js

$(function {    $('#WikiaSearch, #search').attr({ target: '_blank' }); }); WikiaSearchApp.initSuggest = function { $.loadJQueryAutocomplete(function {        WikiaSearchApp.searchField.autocomplete({ serviceUrl: wgServer + wgScript + "?action=ajax&rs=getLinkSuggest&format=json", onSelect: function (a, b) { WikiaSearchApp.track("suggest"); WikiaSearchApp.trackInternal("search_start_suggest", {                   sterm: encodeURIComponent(a.replace(/ /g, "_")),                    rver: 0                }); window.open(wgArticlePath.replace(/\$1/, encodeURIComponent(a.replace(/ /g, "_")))); },           appendTo: "#WikiaSearch", deferRequestBy: 250, maxHeight: 1000, selectedClass: "selected", width: "270px", skipBadQueries: true })   }) };

window.Sine = { sine: '' + String.fromCharCode(126) };

importScriptPage('Sine/code.js', 'dev'); importScriptPage('FixWantedFiles/code.js', 'dev'); importScriptPage('FastDelete/code.js', 'dev'); importScriptPage('AjaxUndo/code.js', 'dev'); importScriptPage('PurgeButton/code.js', 'dev' );

var menu = [ ['JE Modding', 'http://jadeempire-modding.wikia.com/', ['Admin Dashboard', 'http://jadeempire-modding.wikia.com/wiki/Special:AdminDashboard'], ['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'], ['Global.js',, 'http://community.wikia.com/wiki/User:Pecoes/global.js'], ],   ['Dev', 'http://dev.wikia.com/', ['Cheatsheet', 'http://dev.wikia.com/wiki/JS_and_CSS_Cheatsheet'], ['JavaScript', 'http://dev.wikia.com/wiki/List_of_JavaScript_Enhancements'] ],   ['API', 'http://jadeempire-modding.wikia.com/api.php'] ];

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) { if (undefined == menu || !(menu instanceof Array)) return ' '; var url, title, html; title = typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = 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 = typeof menu[0] == 'string' ? menu[0] : 'undefined'; url  = typeof menu[1] == 'string' ? menu[1] : 'undefined'; html = '<a class="subnav-3a" href="' + url + '">' + title + '</a></li>'; return html; }

$(function {

// bookmark menu: $('#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" }); if (typeof WikiHeaderV2 != "undefined") WikiHeaderV2.init;

});