User:Skizzerz/Scripts

This is a repository of various javascript tools that may be useful to you when editing and such. To get these tools, put the javascript in your user js (usually Special:Mypage/BlueCloud.js), then clear your browser cache.

Edit section link for the top section
Adds an edit link that lets you section edit the very top section. /****************************************** if (wgAction == 'view' && wgNamespaceNumber >=0) addOnloadHook(function{ var h2s = document.getElementsByTagName('H2');  var h2 = h2s[0];  if (!h2) return;  if (h2.parentNode.id == 'toctitle') h2 = h2s[1];  if (!h2) return;  var span = h2.firstChild;  if (!span || span.className != 'editsection') return;  var zero = span.cloneNode(true);  if (document.getElementById('featured_icon')) zero.style.marginRight = '30px'  var parent = document.getElementsByTagName('H1')[0];  parent.insertBefore(zero, parent.firstChild);  var a = zero.getElementsByTagName('A')[0];  a.title = a.title.replace(/:.*$/,': 0');  a.setAttribute('href', a.href.replace(/&section=1/,'&section=0')); })
 * Add Section Edit link for top section **

Auto-edit script
Enables an auto-clicking script /******************** document.write(' ');
 * AutoEdit Script **

Find-and-replace script
Enables a search-and-replace function for the edit box, including regular expression searches. A small magnifying glass icon will appear on the left side of the macro buttons (the lightblue images above the edit box). /**************************** document.write(' ');
 * Find and Replace Script **

Edit Summary Extender
Adds a string of text when an edit summary is too short. I actually wrote this one by mahself ^_^ /******************************* function check_edit_summary(event) { var summary=document.getElementById('wpSummary').value; if(summary.length<3) document.getElementById('wpSummary').value += '/* Edit Summary Extender v1.0 */'; }
 * Edit Summary Extender v1.0 **

QuickDelete
Changes the link of the 'delete' tab from the confirmation page to a javascript prompt for faster deletion. /********************************** function quickDeleteSetup { var tab = document.getElementById('ca-delete'); if(!tab) return; var link = tab.getElementsByTagName('a')[0]; link.href = 'javascript:quickDelete;'; }
 * QuickDelete Script for Sysops **

function quickDelete { var reason = window.prompt('Reason'); if(reason == null) return; window.location = ugPage + '&action=delete&wpReason=' + reason + '&submitdelete=true'; }

addOnloadHook(quickDeleteSetup);

function checkDelete { if(queryString("submitdelete")=="true") document.getElementById('deleteconfirm').wpConfirmB.click }

addOnloadHook(checkDelete);

function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { }	}	return null; }

More?
Want something that's not listed here? Try searching for it on Google or some other search engine and if you still can't find it, feel free to drop a message on my talk page and I'll attempt to write it :)