From Wiki-UX.info

Common.js
Jump to: navigation, search

MediaWiki:Common.js

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh); Konqueror: click Reload or press F5; Opera: clear the cache in Tools → Preferences; Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

/* Any JavaScript here will be loaded for all users on every page load. */
/* Custom Edit Buttons */
 if (mwCustomEditButtons) {
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/Btn_toolbar_tt.png",
     "speedTip": "Fixed width text",
     "tagOpen": "<tt>\'\'\'",
     "tagClose": "\'\'\'</tt>",
     "sampleText": "Insert text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/Btn_infotexto.png",
     "speedTip": "Add Note",
     "tagOpen": "\{\{note|",
     "tagClose": "\}\}",
     "sampleText": "Insert note text here"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/GR8.png",
     "speedTip": "GR8",
     "tagOpen": "[http://gr8.mvlabs.corp.hp.com/gr8/stable/callEdit.pl?call&#x3d;",
     "tagClose": "]",
     "sampleText": "GR8 ID"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/Q_icon.png",
     "speedTip": "Meta Description",
     "tagOpen": "<metadesc>",
     "tagClose": "</metadesc>",
     "sampleText": "Article Meta Description"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/Button_SAW.png",
     "speedTip": "SAW link",
     "tagOpen": "[http://sawpro.atlanta.hp.com/km/saw/view.do?docId&#x3d;",
     "tagClose": "]",
     "sampleText": "articleID"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/ITRC_patch.png",
     "speedTip": "ITRC Patch",
     "tagOpen": "[http://www11.itrc.hp.com/service/patch/patchDetail.do?patchid&#x3d;",
     "tagClose": "]",
     "sampleText": "PatchID"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/text-document.png",
     "speedTip": "Text quote",
     "tagOpen": "<source lang=\"text\">\n",
     "tagClose": "\n</source>",
     "sampleText": "Insert text"};
 
   mwCustomEditButtons[mwCustomEditButtons.length] = {
     "imageFile": "http://" + document.location.host + "/w/skins/common/images/terminal.png",
     "speedTip": "Terminal Snapshot",
     "tagOpen": "<source lang=\"hpterminal\">\n",
     "tagClose": "\n</source>",
     "sampleText": "Insert Terminal"}
  }
 
/* Custom Site Pulldown Menus */
// Copyright 2006-2007 javascript-array.com
 
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
 
// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();
 
	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
 
	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
 
}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
 
// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}
 
// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
 
// close layer when click-out
document.onclick = mclose;
This page was last modified on 16 July 2010, at 02:31. This page has been accessed 596 times.