User:Ultimate Dark Carnage/wikia.js

/* Creating a sidebar navigation */ function createSidebar(heading, items){ var sidebar = '' + sidebar_content + ' '; if (!sidebar_content){ // If the variable "sidebar-content" is not available... var sidebar_content = '' + heading + ' ' + ''; if (items.length > -1){ for (var i = 0; i < items.length; i++){ var item_title = items[i].title, item_link = items[i].link, item_tooltip = '' || items[i].tooltip; sidebar_content += '' + item_title + ' ' + item_tooltip + ' '; }       }        sidebar_content += ''; }   $(document.body).append(sidebar); }

if (!$('.custom-sidebar').length){ // There can only be one sidebar. if (wgCanonicalSpecialPageName != "Chat" || wgPageName == "Special:Chat"){ createSidebar('Menu',            [{ title: 'Chat', link: wgServer + '/wiki/Special:Chat', tooltip: 'Enter Chat'},             { title: 'Forum', link: wgServer + '/wiki/Special:Forum', tooltip: 'Forum'},             { title: 'Report', link: 'javascript:goToReport;', tooltip: 'Report to VSTF'},             { title: 'Contact', link: 'javascript:goToContact;', tooltip: 'Contact Staff'},             { title: 'Edit', link: encodeURI(wgPageName) + '?action=edit', tooltip: 'Edit this page'},             {},             {},             {}]); } }

if (!sidebar_styles.length){ var sidebar_styles = []; }

function changeGlobalNav{ var globalNav = $('.global-navigation'), startAWikiButton = globalNav.find('.start-wikia'); startAWikiButton.text('Start a wiki'); startAWikiButton.attr('title', 'Start a wiki'); }

window.onload = changeGlobalNav;

if (typeof wgUserName != 'undefined'){ var onTheWikiNav = '' + 'VSTF' + '' + '' + 'Report Wiki' + '</li>' + '</ul>' + '</li>' + '' + '<a href="/wiki/Special:Contact" title="Contact Staff" class="subnav-2a">Contact<img class="chevron" src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D"/></a>' + '<ul class="subnav-3 subnav">' + '' + '<a href="/wiki/Special:Contact/bug">Bug</a>' + '</li>' + '</ul>' + '</li>'; $('.WikiHeader > nav.WikiNav .marked').children('.firstChild').append(onTheWikiNav); }

function addNewLinks(link, link_title){ var l = '<a href="' + link + '">' + link_title + '</a></li>'; $('.WikiaBarWrapper #my-tools-menu').append(l); }

function insertLinks{ addNewLinks('/wiki/Special:Chat', 'Chat'); addNewLinks('/wiki/Special:Forum', 'Forum'); addNewLinks('/wiki/Help:CSS', 'CSS'); addNewLinks('/wiki/Blog:Recent_posts', 'Recent Blogs'); addNewLinks('http://vstf.wikia.com/wiki/Report:Spam', 'Report Spam'); addNewLinks('http://vstf.wikia.com/wiki/Report:Vandalism', 'Report Vandalism'); addNewLinks('javascript:test;', 'Test'); }

addOnloadHook(insertLinks);

function test{ if (wgCanonicalSpecialPageName != WikiActivity){ window.location.href+="?action=edit"; } }

function addAccountNavigationLinks(link, link_title){ var l = '<a href="' + link + '">' + link_title + '</a></li>'; $('#AccountNavigation .subnav').prepend(l); }

function insertAccountNavigationLinks{ addAccountNavigationLinks('/wiki/Special:MyPage/Sandbox', 'Sandbox'); addAccountNavigationLinks('/wiki/Special:Contributions', 'Contributions'); addAccountNavigationLinks('/wiki/Special:Editcount/Ultimate_Dark_Carnage', 'Editcount'); addAccountNavigationLinks('/wiki/Special:Following', 'Following'); }

addOnloadHook(insertAccountNavigationLinks);

function addButton(link, button_message){ var b = '<a href="' + link + '" class="wikia-button wikia-single-button">' + button_message + '</a> '; $('#WikiaPageHeader .tally').before(b); }

function insertButtons(add){ if (add === "true"){ addButton('?useskin=monobook', 'Monobook'); addButton('?useskin=wikiamobile', 'Mobile'); }   else if (add === "false"){ } }

window.onload = insertButtons('true');

function addTab(link, link_name, id){ var tab_links = { tablocation: link, title: link_name, dataid: id   }; $('.WikiaUserPagesHeader .tabs-container .tabs').append('<a href="' + tab_links.tablocation + '">' + tab_links.title + '</a></li>'); }

function configure(value){ if (value === "true"){ addTab('/wiki/User:' + encodeURI($('#UserProfileMasthead hgroup').children('h1').text) + '/Sandbox', 'Sandbox', 'sandbox'); addTab('/wiki/Special:Editcount/' + encodeURI($('#UserProfileMasthead hgroup').children('h1').text), 'Editcount', 'editcount'); } }

configure("true");