Jump to content

User:Davidgothberg/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Davidgothberg (talk | contribs) at 22:51, 4 November 2008 (The "join" function worked as it should. (That is, in the last test it failed to load, but in the test before that it did load).). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/************************************************************
    Note! Old JavaScript code is stored on the talk page. 
*************************************************************/

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


/* Works! */
/*
importStylesheet( 'User:Bob/externals.css' );
importStylesheetURI( 'http://localhost:8080/wikipediatest.css' );
*/


/*******************************************************
   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.
importScript( "User:Davidgothberg/clock.js" );


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



// [[User:Lupin/popups.js]]

document.write('<script type="text/javascript" src="' 
  + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
  + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

// 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;

// PopupStructure can be 'original', 'fancy', 'fancy2', 'menus', 'shortmenus', 'lite', 'nostalgia'
// popupStructure='original';



// [[User:Gerbrant/edit/top.js]]

// This will add an [edit] link at the top of all pages except preview pages and the main page.
// Originally by [[User:Pile0nades]], modified by [[User:Gerbrant]].
// [[User:Davidgothberg]] added a [purge] link.

// Add an [edit] link to pages
hookEvent("load", function ()
{
	if(window.location.href.indexOf("/wiki/Special:") != -1) return;
	if(document.getElementById("wikiPreview")) return;
	if(document.getElementById("histlegend‎")) return;
	if(document.getElementById("difference‎")) return;
	if(document.getElementById("watchdetails")) return;
	if(document.getElementById("mainpage")) return;

	if(window.location.href.indexOf("&action=edit") == -1)
	{
		var pageTitle = document.title.split(" - ")[0].replace(" ", "_");
		var divContainer = document.createElement("div");


		divContainer.innerHTML = '<div class="editsection" style="float:right; margin-top:0px;">\
[<a href="/w/index.php?title=' + pageTitle + '&action=purge" \
title="' + pageTitle + '">purge</a>]<br/>[<a href="/w/index.php?title=' + pageTitle + '&action=edit&section=0" \
title="' + pageTitle + '">edit</a>]</div>';


		var coos = document.getElementById("coordinates");
		if(coos) coos.style.right = "4.5em";
		document.getElementById("content").insertBefore(
			divContainer, document.getElementsByTagName("h1")[0]);
	}
	else if(window.location.href.indexOf("&action=edit&section=0") != -1)
	{
		e = document.getElementById("wpSummary");
		if(e) e.value = "/* Intro */ ";
	}
});



/* Adding the "My sandbox" or "Sandbox" link. */
/*
addOnloadHook( function () {

  if( wgUserName ) {
    addPortletLink( 'p-personal', wgArticlePath.replace("$1", "Special:Mypage/sandbox"), 'My sandbox', 'pt-sandbox', 'Your personal sandbox', null, document.getElementById('pt-preferences'));
  }
  else {
    addPortletLink( 'p-personal', wgArticlePath.replace("$1", "Wikipedia:Sandbox"), 'Sandbox', 'pt-sandbox', 'A sandbox where you can experiment' );
  }
} );
*/



/* Add "Extended search" to the "navigation" menu. */
addOnloadHook( function() {

  /* Add an "Extended search" link to the "navigation" menu". */
  addPortletLink( 'p-navigation', wgArticlePath.replace("$1", "Special:Search"), 'Extended search', 'pt-search', 'More search options' );

} );



/*******************************************************
   Note! The DavidClock has been moved to 
   [[User:Davidgothberg/clock.js]]. See code and usage
   explanation there.
********************************************************/