User:Gargaj/monobook.js

popupFixRedirs 	= true; popupFixDabs 	= true;

function replaceRegexp(replaceWhat, replaceWith, modifiers) {	if (modifiers == null) modifiers = ""; var pattern = new RegExp(replaceWhat, modifiers); var obj_ta = document.editform.wpTextbox1; obj_ta.value = obj_ta.value.replace(pattern, replaceWith); } // Replace all occurences of a user-entered regexp with a user entered replacement function customReplaceForm { var form = 'Replace:  ' + 'With:  (tag with $1) ' + ' casesense :: ' + 'perform'; insertCustomForm(form); document.getElementById('customReplaceThis').focus; }

function performCustomReplace { var replaceThis = document.getElementById('customReplaceThis'); var replaceWith = document.getElementById('customReplaceWith'); var cs = document.getElementById('customReplaceCS'); var flags = "gm"; if (!cs.checked) { flags += "i"; } replaceRegexp(replaceThis.value, replaceWith.value, flags); }

function insertCustomForm(formText) { var customBar = document.getElementById('editpage-specialchars'); if (customBar == null) return;

var customForm = document.createElement('div'); customForm.setAttribute('id', 'customForm'); customForm.setAttribute('style', 'margin-bottom:2px;border:1px solid #aaaaaa;padding:3px'); customForm.innerHTML = '' + formText; var oldForm = document.getElementById('customForm'); if (oldForm != null) { customBar.parentNode.replaceChild(customForm, oldForm); } else { customBar.parentNode.insertBefore(customForm, customBar); } }

function deleteCustomForm { var customForm = document.getElementById('customForm'); if (customForm != null) customForm.parentNode.removeChild(customForm); }

function myOnloadHook { var specChars = document.getElementById('editpage-specialchars'); if (specChars) specChars.innerHTML += " "+     "regexp replace" + " "; }

if (window.addEventListener != null) window.addEventListener("load", myOnloadHook, false); else if (window.attachEvent) window.attachEvent("onload", myOnloadHook);

//importScript('User:Lupin/popups.js'); importScript('User:Cacycle/wikEd.js');