User:Davidgothberg/vector.js

/* A JavaScript file loaded from my local web server for testing. */ mw.loader.load( 'http://localhost:8080/wikipediatest.js' );

/****** Changing the user interface *************************/

/*******************************************************  Note! The DavidClock has been moved to   User:Davidgothberg/clock.js. See code and usage explanation there. window.davidClock = 300;   //Static + ticking clock, every 5 minutes. //window.davidClockDate = 0; //Don't show the date. importScript( "User:Davidgothberg/clock.js" );

/* New messages history */ //importScript( "User:Davidgothberg/newmessageshistory.js" );

// Add some links in the navigation and toolbox menus // on the left side of the page. // NOTE! My code here should be updated with new function names et.c., // see message at User talk:Davidgothberg/vector.js. $( function { // Add an "Extended search" link to the "navigation" menu".  mw.util.addPortletLink( 'p-navigation', mw.config.get('wgArticlePath').replace("$1", "Special:Search"), 'Extended search', 'pt-search', 'More search options' );  // List subpages of the current page.  mw.util.addPortletLink( "p-tb", mw.config.get('wgScript') + "?title=Special:PrefixIndex/" + mw.config.get('wgPageName') + "/",     "Subpages", "pt-subpages", "Subpages" );  // List template transclusion count of the current template page.  if ( mw.config.get('wgNamespaceNumber') == 10 || mw.config.get('wgNamespaceNumber') == 11 ) {    mw.util.addPortletLink( "p-tb",       "http://toolserver.org/~jarry/templatecount/index.php?lang=en&name="       + mw.config.get('wgTitle') + "#bottom",       "Template transclusions", "pt-transclusion-count", "Transclusion count" );  } } );

// Tools/Navigation popups // Loaded through "my preferences - Gadgets - Navigation popups".

// When true prevents loading of preview data for the popup. simplePopups=true;

// When false makes it so the "actions" menu instead // goes under the page link instead of as a separate menu. popupActionsMenu=false;

/* Makes the "compare selected revisions" button on history pages into a link (allows diffs in new windows, tabs, etc.) User:Superm401/Compare link.js (Stopped working when they redesigned the history pages.) */ //importScript("User:Superm401/Compare link.js");

/* Colour matching brackets in a copy of the edit box. User:ais523/bracketmatch.js (Stopped working when they redesigned the edit box.)*/ //importScript("User:ais523/bracketmatch.js");

/* Shows both "preview" and "changes" with Ajax, much faster than standard preview/changes buttons. User:Js/ajaxPreview  */

importScript("User:Js/ajaxPreview.js"); ajaxPreviewButton = 'P';   // "Preview" button text, when above. ajaxDiffButton = 'D';      // "Changes" button text, when above. ajaxPreviewPos = 'bottom'; // Buttons on the bottom, replacing standard. // Code to execute after each preview update. ajaxPreviewExec = function(previewArea) { if (window.setupTooltips) setupTooltips(previewArea);  // Restart the Navigation popups. }

/****** End, changing the user interface *************************/ /****** Start, experimenting *************************************/

/* Changes the drop-down menu in Vector into tabs. Works but the tabs overlap due to my low screen resolution. */ // importScript( "User:Svick/DropDownToTabs.js" );

// Changes the drop-down menu in Vector into tabs. // This modified version of Svick's script didn't work. /* function fixTab(item) { var node = item.firstChild.firstChild; if (node.nodeType != 1 || node.tagName.toLowerCase != 'span') item.firstChild.innerHTML = " " + item.firstChild.innerHTML + " "; }

$( function { // document.getElementById('p-cactions').className = 'vectorTabs';  var elems = document.getElementById('p-cactions').getElementsByTagName('li');  for (var i = 0; i < elems.length; i++)    fixTab(elems[i]); } )