Jump to content

User:Gracenotes/monobook.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Gracenotes (talk | contribs) at 02:51, 23 May 2007 (remove code I do not want; actually show minor edit button). 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.
//<pre>
if (wgNamespaceNumber == 6)
  importScript('User:Gracenotes/wpPicmark.js');
importScript('User:Gracenotes/changesSince.js');
importScript('User:Gracenotes/fixStuff.js');
importScript('User:Gracenotes/amelvand.js');
if (wgPageName == 'Wikipedia:WikiProject_Vandalism_studies/Query')
  importScript('User:Gracenotes/vandinfo.js');

if (wgPageName == 'Special:Search') {
addOnloadHook (function() {
var psElem = document.getElementById('powersearch');
var psLabels = psElem.getElementsByTagName('label').length - 1;

for (i = 0; i <= psLabels; i++) {
var tempCon = psElem.getElementsByTagName('label')[i];
tempCon.appendChild(document.createElement('br'));
}
});
}

//could be done with css, eh
//make edit box pretty, make table transparent
addOnloadHook(function() {
  if (document.getElementById('wpTextbox1')) {
  document.getElementById('wpTextbox1').style.background='#E3DDD9';
  document.getElementById('wpTextbox1').style.color='#540'
  }
 var xx = getElementsByClassName(document, 'table', 'diff');
 if (xx[0]) {
   xx[0].style.background = 'transparent';
   xx[0].getElementsByTagName('td')[0].style.background = 'transparent';
   xx[0].getElementsByTagName('td')[1].style.background = 'transparent';
}
});

function replaceWithPoem(textbox) {
  var textbox = document.getElementById('wpTextbox1');
  var substr = textbox.value.substring(textbox.selectionStart, textbox.selectionEnd);
  if (substr.length == 0) return false;
  var substr2 = '<poem style="margin-left: 2em">\n' + substr.replace(/^:/gm, '').replace(/\<br.*?\>/g, '') + '\n</poem>';
  document.getElementById('wpTextbox1').value = textbox.value.replace(substr, substr2);
}

//who uses related changes on edit pages anyway?
addOnloadHook(function() {
  var textbox = document.getElementById('wpTextbox1');
  if (!textbox) return false;
  document.getElementById('t-recentchangeslinked').firstChild.href = "javascript:replaceWithPoem();"
});


importScript('User:Voice_of_All/UTCclock.js')
 

if (wgPageName == "Special:Search") {
 var searchEngines = [];
 addOnloadHook(SpecialSearchEnhanced);
}

function SpecialSearchEnhanced() {
 var createOption = function(site, action, mainQ, addQ, addV) {
 var opt = document.createElement('option');
 opt.appendChild(document.createTextNode(site));
 searchEngines[searchEngines.length] = [action, mainQ, addQ, addV];
 return opt;
 }
 var searchForm = document.forms['search'];
 var selectBox = document.createElement('select');
 selectBox.id = 'searchEngine';
 searchForm.onsubmit = function() {
 var optSelected = searchEngines[document.getElementById('searchEngine').selectedIndex];
 searchForm.action = optSelected[0];
 searchForm.lsearchbox.name = optSelected[1];
 searchForm.title.value = optSelected[3];
 searchForm.title.name = optSelected[2];
 searchForm.fulltext.name = "";
 }
 selectBox.appendChild(createOption('MediaWiki search', '/w/index.php', 'search', 'title', 'Special:Search'));
 selectBox.appendChild(createOption('Google', 'http://www.google.com/search', 'q', 'as_sitesearch', 'en.wikipedia.org'));
 selectBox.appendChild(createOption('Yahoo', 'http://search.yahoo.com/search', 'p', 'vs', 'en.wikipedia.org'));
 selectBox.appendChild(createOption('Windows Live', 'http://search.live.com/results.aspx', 'q', 'q1', 'site:http://en.wikipedia.org'));

 searchForm.lsearchbox.style.marginLeft = '0px';
 document.getElementById('loadStatus').appendChild(selectBox);
}