User:Davidgothberg/vector.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin is at User:Davidgothberg/vector.css. |
/* 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" );
}
} );
// [[Wikipedia: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 = "<span>" + item.firstChild.innerHTML + "</span>";
}
$( 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]);
} )
*/