User talk:Bookofjude/header cleanup

Copy to User:Danny/monobook.js:

/* */ addOnloadHook(function  {	if(document.forms.editform) {		addLink('p-cactions', 'javascript:replace', 'replace', 'ca-replace', 'Regexp replace for the edit window', , 'ca-history');                addLink('p-cactions', 'javascript:changeSummary', 'summary', 'ca-summary', 'Change the summary of the page and save', , 'ca-replace');	}	}); addOnloadHook(changekeys);

function changeSummary{ document.editform.wpSummary.value = "cleaned up the header - header cleanup info"; document.editform.submit; } function addlilink(tabs, url, name, id){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; } function addLink(where, url, name, id, title, key, after){ //* where is the id of the toolbar where the button should be added; //  i.e. one of "p-cactions", "p-personal", "p-navigation", or "p-tb". //	//* url is the URL which will be called when the button is clicked. //  javascript: urls can be used to do more complex things. //	//* name is what will appear as the name of the button. //	//* id is the id of the button; it's best to define one. //  Use a prefix to make sure its unique. Optional. //	//* title is the tooltip title that gives a longer description //  of the button; if you define a accesskey, mention it here. Optional. //	//* key is the char you want for the accesskey. Optional. //	//* after is the id of the button you want to follow this one. Optional. //	var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); var tabs = document.getElementById(where).getElementsByTagName('ul')[0]; if(after) { tabs.insertBefore(li,document.getElementById(after)); } else { tabs.appendChild(li); }	if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title];} }	// re-render the title and accesskeys from existing code in wikibits.js	akeytt; return li; } function replace { var s = prompt("Search regexp?"); if(s) { var r = prompt("Replace regexp?"); if(!r && r != '') return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } }

/**** Add tab as menu ****/ function addlimenu(tabs, name, id) {	var na = document.createElement('a'); na.href = '#'; var mn = document.createElement('ul'); na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.className = 'tabmenu'; li.appendChild(na); li.appendChild(mn); tabs.appendChild(li); return li; }

/*** Add tab wrapper for addlilink ***/ function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlilink(tabs, url, name, id, title, key); }

// global scope function replace2(s, r) { if(s) { if(!r && r != '') return; var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } } function replWS{ replace2('(\\n)', '$1$1'); } function moonlitReplace{ replace2(prompt("Regexp?"), ''); } function unlitReplace{ replace2("{{EBD1897 entry\\|([^|]*)\\|([^|]*)\\|([^}]*)}}", ""); } function moonlitReplace2{ replace2("<div[\\s\\S\\n\\R]*\\[\\[EBD1897:([^|]*)" + "\\|[^\\]]*\\]\\][\\s\\S\\n\\R]*\\[\\[EBD1897:([^|]*)" + "\\|[^\\]]*\\]\\][\\s\\S\\n\\R]*\\[\\[w:([^|]*)\\|[^\\]]*" + "\\]\\][\\s\\S\\n\\R]* ", ""); } function ebdReplace{ replace2("\\[\\[EBD1897:", "\\*)\\]\\]", "$1"); } function edHeader{ replace2(" ", ""); } function moveCategory{ replace2("^(\\[\\Cc]ategory:[^\\*\\]\\](?:\\n)?" + "\\[\\Cc]ategory:[^\\*\\]\\](?:\\n)?)([\\S\\s\\r\\n]*)", "$2$1"); } function cleanDickinson{ replace2(" \\n ", ""); replace2("\\n\\n\\n", ""); replace2(" (\\n)({{Emily)", "$1$1$2"); } function convertTable{ replace2(" ", "|}"); replace2("", ""); } function removedBreaks{ replace2("", ""); } function setupReplacements { if(document.forms.editform) { var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];  addlimenu(tabs, 'replace', 'replf');  var replf = document.getElementById('replf').getElementsByTagName('ul')[0];  addlilink(replf, 'javascript:replWS', 'Double whitespace', ); //  addlilink(replf, 'javascript:moonlitReplace', 'EBD subst Header', ); //  addlilink(replf, 'javascript:moonlitReplace2', 'EBD subst Header 2', ); //  addlilink(replf, 'javascript:unlitReplace', 'EBD unsubst Header', ); //  addlilink(replf, 'javascript:ebdReplace', 'EBD interlinks', ); //  addlilink(replf, 'javascript:ebdIndex', 'EBD index to relative', );  addlilink(replf, 'javascript:pipeLinks', 'Pipe relative links', );  addlilink(replf, 'javascript:edHeader', 'Emily Dickinson header', );  addlilink(replf, 'javascript:moveCategory', 'Move categories', );  addlilink(replf, 'javascript:cleanDickinson', 'Clean line breaks', );  addlilink(replf, 'javascript:convertTable', 'Convert to Wikitable');  addlilink(replf, 'javascript:removeBreaks', 'Remove line breaks'); }} addOnloadHook(setupReplacements);

function changekeys { ta['ca-replace'] = ['r', 'Find and replace']; ta['ca-summary'] = ['k', 'Auto-edit summary and save']; ta['replf'] = ['q', 'Find and replace drop down']; ta['ca-next'] = ['g', 'Go to the next page']; ta['ca-previous'] = ['b', 'Go to the previous page']; akeytt; } /* &lt;/nowiki>&lt;/pre> */ Copy to User:Danny/monobook.css:

/* */

/* ################################### */ /* Start of requirements for menu tabs */ padding-left: 0.4em; padding-right: 0.4em; }
 * 1) p-cactions #ca-edit-0 a {

{   position: relative; float: left; }
 * 1) p-cactions li

.tabmenu ul { display: none; z-index: 2; position: relative; top: -2px; border-top: 1px solid #aaaaaa; padding: 0px; margin: 0px; background: #FFFFF0; background-color: #FFFFF0; clear:both; }

/* Menu tab IDs. If you add a new menu, you need to add its ID here too */ {   float: none; border: 1px solid #aaaaaa; border-top: none; text-align: center; background: #F8FCFF; background-color: #FFFFF0; clear:both; display: block; }
 * 1) afda ul li, #dbm ul li, #mystatus ul li, #talkm ul li

.tabmenu:hover ul { display: block; }

.tabmenu a { padding: 0pt 0.8em !important; background: #F8FCFF; background-color: #FFFFF0; }

.tabmenu ul a:hover {   font-weight: bold; }

/* End of requirements for menu tabs */ /* ################################# */ /* &lt;/nowiki>&lt;/pre>

After copying, press Control-F5 to force a cache refresh on both pages.