User:Ze miguel/monobook.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
// <nowiki> function addlilink(tabs, url, name, id) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); li.id = id; li.appendChild(na); tabs.appendChild(li); return li; } function addlilink2(tabs, url, name, id, title) { var l=addlilink(tabs,url,name,id); l.lastChild.title=title; return l; } function addLink(top, url, id, desc) { var na = document.createElement('a'); na.href = url; na.id = id; na.appendChild(document.createTextNode(desc)); var li = document.createElement('li'); li.id = id; li.appendChild(na); top.appendChild(li); li.lastChild.title=desc; return li; } function addTag(tag, summary, place) { var form = document.editform; if (place == 'top') { form.wpTextbox1.value = tag + "\r\n" + form.wpTextbox1.value; } else { form.wpTextbox1.value = form.wpTextbox1.value + "\r\n" + tag; } form.wpSummary.value += summary; } function quickEditLinks (container) { var wp = document.getElementById(container); var ul = document.createElement('ul'); ul.id = "ok"; wp.appendChild(ul); addLink(ul, "javascript:addTag('{{d}}', 'Speedy deletion requested ', 'top')", 'd',"Speedy delete"); addLink(ul, "javascript:addTag('{{empty}}', 'Article is empty ', 'top')", 'empty',"Speedy delete: Article is empty"); addLink(ul, "javascript:addTag('{{nonsense}}', 'Article is nonsense ', 'top')", 'nonsense',"Speedy delete: Article is nonsense"); addLink(ul, "javascript:addTag('{{db-bio}}', 'Article is non-notable biography ', 'top')", 'db-bio',"Speedy delete: Article is non-notable bio"); addLink(ul, "javascript:addTag('{{AfD}}', 'Article tagged for Deletion ', 'top')", 'AfD',"Tag article for Deletion procedure"); } function searchCopyvio (container) { var wp = document.getElementById(container); addLink(wp, "javascript:googleCopyvio()", 'copyvio',"Check copyvio"); } function googleCopyvio () { var text = document.editform.wpTextbox1.value; text = text.replace(/[\r\n]/mg,' '); text = text.replace(/[\[\]]/mg,''); // var reg = /(.+?\s+.+?\s+.+?\s+.+?\s+.+?\s+.+?\s+)/gm; var reg = /(.+?\s+){7}/gm; var ar; var matches = new Array(); var i = 0; while (ar = reg.exec(text)) { matches[i] = new String(ar[0]); i++; } index = Math.floor(Math.random() * matches.length); window.open ("http://www.google.com/search?&q=\"" + matches[index] + "\""); } //***************************************************************************************** window.onload = Main; function Main() { quickEditLinks('jump-to-nav'); searchCopyvio('jump-to-nav'); } // </nowiki>