User:Amelia/monobook.js

/* */ /* Deprecated, add new stuff to MediaWiki:Common.js */

/* tooltips and access keys */ ta = {}; ta['pt-userpage'] = ['.','My user page']; ta['pt-anonuserpage'] = ['.','The user page for the ip you\'re editing as']; ta['pt-mytalk'] = ['n','My talk page']; ta['pt-anontalk'] = ['n','Discussion about edits from this ip address']; ta['pt-preferences'] = ['','My preferences']; ta['pt-watchlist'] = ['l','The list of pages you\'re monitoring for changes.']; ta['pt-mycontris'] = ['y','List of my contributions']; ta['pt-login'] = ['o','You are encouraged to log in, it is not mandatory however.']; ta['pt-anonlogin'] = ['o','You are encouraged to log in, it is not mandatory however.']; ta['pt-logout'] = ['o','Log out']; ta['ca-talk'] = ['t','Discussion about the content page']; ta['ca-edit'] = ['e','You can edit this page. Please use the preview button before saving.']; ta['ca-addsection'] = ['+','Add a comment to this discussion.']; ta['ca-viewsource'] = ['e','This page is protected. You can view its source.']; ta['ca-history'] = ['h','Past versions of this page.']; ta['ca-protect'] = ['=','Protect this page']; ta['ca-delete'] = ['d','Delete this page']; ta['ca-undelete'] = ['d','Restore the edits done to this page before it was deleted']; ta['ca-move'] = ['m','Move this page']; ta['ca-watch'] = ['w','Add this page to your watchlist']; ta['ca-unwatch'] = ['w','Remove this page from your watchlist']; ta['search'] = ['f','Search this wiki']; ta['p-logo'] = ['','Main Page']; ta['n-mainpage'] = ['z','Visit the Main Page']; ta['n-senate'] = ['s','Discuss Wookieepedia topics']; ta['n-portal'] = ['','About the project, what you can do, where to find things']; ta['n-currentevents'] = ['','Find background information on current events']; ta['n-recentchanges'] = ['r','The list of recent changes in the wiki']; ta['n-randompage'] = ['x','Load a random page']; ta['n-help'] = ['','The place to find out']; ta['n-FAQ'] = ['','Frequently Asked Questions']; ta['n-chat'] = ['','Join the IRC channel']; ta['n-sitesupport'] = ['','Support us']; ta['t-whatlinkshere'] = ['j','List of all wiki pages that link here']; ta['t-recentchangeslinked'] = ['k','Recent changes in pages linked from this page']; ta['feed-rss'] = ['','RSS feed for this page']; ta['feed-atom'] = ['','Atom feed for this page']; ta['t-contributions'] = ['','View the list of contributions of this user']; ta['t-emailuser'] = ['','Send a mail to this user']; ta['t-upload'] = ['u','Upload images or media files']; ta['t-specialpages'] = ['q','List of all special pages']; ta['ca-nstab-main'] = ['c','View the content page']; ta['ca-nstab-user'] = ['c','View the user page']; ta['ca-nstab-media'] = ['c','View the media page']; ta['ca-nstab-special'] = ['','This is a special page, you can\'t edit the page itself.']; ta['ca-nstab-wp'] = ['a','View the project page']; ta['ca-nstab-image'] = ['c','View the image page']; ta['ca-nstab-mediawiki'] = ['c','View the system message']; ta['ca-nstab-template'] = ['c','View the template']; ta['ca-nstab-help'] = ['c','View the help page']; ta['ca-nstab-category'] = ['c','View the category page'];

// Search icons function replaceSearchIcon { $("#searchBody").find("form").wrapInner(' ') var innerDiv;

var searchbox = document.getElementById( 'searchBody' );

if( searchbox ) { innerDiv = searchbox.getElementsByTagName('div')[0]; var link = innerDiv.getElementsByTagName('a')[0];

if( link ) { innerDiv.removeChild( link ); }   	}

onSearchIconsArrival( innerDiv ); }

function rand( n ) { return Math.round( Math.random * n ); }

// silly legacy name :P // Please note that defining the array here prevents us from having to fetch the article // and so is much faster. Plus, JS files are cached, which makes it even faster. Yay! // --TOR  function Icon(article, imageurl, displaytitle) { this.article = article; this.imageurl = "https://images.wikia.nocookie.net/starwars/images/" + imageurl; this.displaytitle = typeof displaytitle === 'undefined' ? article : displaytitle; }

function onSearchIconsArrival( searchDiv ) { var lines = [ new Icon("Optimus Prime", "1/14/FID_Cover_RI_B-by-Bethany-McGuire-Smith.jpg"), ]; // Please add new search icons in proper alphabetical order by the actual title of the linked article!

var line = lines[rand( lines.length - 1 )];

var link = document.createElement( 'div' ); link.id = 'search-icon-wrapper'; var img = document.createElement( 'img' ); img.alt = 'Search'; img.src = line.imageurl; link.appendChild( img );

searchDiv.insertBefore( link, searchDiv.firstChild );

var div = document.createElement( 'div' ); div.id = 'search-popup'; div.style.display = 'none'; var ul = document.createElement( 'ul' );

var li; var a;

li = document.createElement( 'li' ); a = document.createElement( 'a' ); a.href = mw.config.get('wgScriptPath') + '/index.php?title=Special:Search&adv=1'; a.appendChild( document.createTextNode( 'Advanced search' ) ); li.appendChild( a ); ul.appendChild( li );

li = document.createElement( 'li' ); a = document.createElement( 'a' ); a.href = '/wiki/' + line.article.replace(' ', '_'); a.appendChild( document.createTextNode( "What's this? (" + line.displaytitle + ')' ) ); li.appendChild( a ); ul.appendChild( li );

li = document.createElement( 'li' ); a = document.createElement( 'a' ); a.href = 'javascript:closeSearchPopup'; a.appendChild( document.createTextNode( 'Close' ) ); li.appendChild( a ); ul.appendChild( li );

var container = document.getElementById( 'globalWrapper' ); if( !container ) { container = document.getElementById( 'container' ); }

div.appendChild( ul ); container.appendChild( div );

link.onclick = openSearchPopup; }

function openSearchPopup( event ) { var div = document.getElementById( 'search-popup' ); var e = event || window.event;

div.style.display = ( div.style.display === 'none' ) ? 'block' : 'none'; div.style.left = e.clientX + 'px'; div.style.top = ( e.clientY + document.documentElement.scrollTop ) + 'px'; }

function closeSearchPopup { document.getElementById( 'search-popup' ).style.display = 'none'; }

function replacePIImageLink { var imageName, $piImageLink = $('.portable-infobox').find('.pi-image > a.image');

if ($piImageLink.length) { imageName = $piImageLink.children('.pi-image-thumbnail').data('image-name'); $piImageLink.attr('href', '/wiki/File:' + encodeURIComponent(imageName)); } }

$(function {	replaceSearchIcon;

// Patch for MWSggest, broken by Wikia if (!window.os_MWSuggestInit) { importScriptURI(stylepath+'/common/mwsuggest.js?'+wgStyleVersion); }	// Move interwiki language links template to sidebar if( document.getElementById("p-lang") ) { document.getElementById("column-one").appendChild(document.getElementById("p-lang")); // Replace div with h5 to pick up formatting var pLangContent = $("#p-lang").children.first.html; $("#p-lang").children.first.replaceWith(" " + pLangContent + " "); }	replacePIImageLink; });

/* */