Usuário:Leonardo.stabile/monobook.js
Origem: Wikipédia, a enciclopédia livre.
Nota: Após salvar, terá de limpar a cache do seu navegador para ver as alterações: Mozilla: clique Reload (ou Ctrl-R), IE / Opera: Ctrl-F5, Safari: Cmd-R, Konqueror Ctrl-R.
/* ==Anti-vandal tool== */ // Filter changes live // [[en:User:Lupin/Anti-vandal tool]] - please include this line //avtUser = 'Leonardo.stabile'; //document.write('<script type="text/javascript" src="' // + 'http://pt.wikipedia.org/w/index.php?title=Wikipedia:Software/antivandaltool.js' // + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* ==MyOwnEditButtons== */ //var div=document.getElementById('editpage-specialchars'); //if ( div ) { // //} window.AddMyOwnButton=function(tbar, caption, href, imgsrc) { var ba = document.createElement('a'); ba.href = href; var img = document.createElement('img'); img.src = imgsrc; img.alt = caption; ba.appendChild(img); tbar.appendChild(ba); } window.myOwnEditButtons=function() { var tbdiv=document.getElementById('toolbar'); if ( tbdiv ) { tbdiv.appendChild(document.createTextNode(' ')); // Botao:{{ }} AddMyOwnButton(tbdiv, 'txt2predef', 'javascript:insertTags(\'{{\',\'}}\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/2/29/Template_icon.png'); // Botao:{Bem vindo ip} AddMyOwnButton(tbdiv, 'Bem vindo IP', 'javascript:document.editform.wpSummary.value=\'\{\{bem vindo ip\}\}\';insertTags(\'\{\{Bem-vindo IP}} \~\~\~\~\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/5/54/Bvip_icon.png'); // Botao:{Bem vindo} AddMyOwnButton(tbdiv, '{{bem vindo}}', 'javascript:document.editform.wpSummary.value=\'\{\{subst:bem vindo\}\}\';insertTags(\'\{\{bem vindo}} \~\~\~\~\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/3/30/Bv_icon.png'); // Botao:{aviso} AddMyOwnButton(tbdiv, '{{aviso}}', 'javascript:document.editform.wpSummary.value=\'\{\{aviso\}\}\';insertTags(\'\{\{aviso}}\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/e/ec/Button_aviso.png'); // Botao:{lixo} AddMyOwnButton(tbdiv, 'Lixo', 'javascript:document.editform.wpSummary.value=\'\{\{lixo\}\}\';document.editform.wpTextbox1.value=\'\';insertTags(\'\{\{lixo|\~\~\~\~}}\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/e/e4/Bouton_Vandale3.png'); // Botao:{impróprio} AddMyOwnButton(tbdiv, 'Impróprio', 'javascript:document.editform.wpSummary.value=\'\{\{impróprio\}\}\';document.editform.wpTextbox1.value=\'\';insertTags(\'\{\{impróprio|\~\~\~\~}}\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/f/f0/Bouton_Vandale0.png'); // Botao:<tt> AddMyOwnButton(tbdiv, '<tt></tt>', 'javascript:insertTags(\'<tt>\',\'</tt>\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/3/30/Tt_icon.png'); // Botao:<small> AddMyOwnButton(tbdiv, '<small></small>', 'javascript:insertTags(\'<small>\',\'</small>\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/5/58/Button_small.png'); // Botao:<strike> AddMyOwnButton(tbdiv, '<s></s>', 'javascript:insertTags(\'<s>\',\'</s>\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png'); // Botao:autoDisambig AddMyOwnButton(tbdiv, 'desambigtxt', 'javascript:document.editform.wpSummary.value=\'v1\';insertTags(\'\{\{desambiguação\}\}\\n\\nPor \\\'\\\'\\\'\{\{subst:PAGENAME}}\\\'\\\'\\\' pode estar à procura de:\\n* \',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/6/62/Button_desambig.png'); // Botao:LicencaIncompleta AddMyOwnButton(tbdiv, '\{\{SemInfo\}\}', 'javascript:document.editform.wpSummary.value=\'Aviso: Licença Incompleta\';insertTags(\';Descrição\\n:(informar aqui, por favor)\\n;Fonte\\n:(informar aqui, por favor)\\n;Licença\\n:\{\{subst:\Cd2}} <\!-- troque esta predefinição pela tag do respectivo copyright -->\\n\[\[Categoria:Imagens de origem desconhecida\]\] <\!-- remova esta categoria após indicar a fonte -->\\n\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/d/de/Button_image.png'); // Botao:CaixaSucessao AddMyOwnButton(tbdiv, 'Caixa de sucessão', 'javascript:document.editform.wpSummary.value=\'+cxsucc\';insertTags(\'\{\{Começa caixa\}\}\\n\{\{Caixa de sucessão\|\\n\|título = \\n\|anos = \\n\|antes = \\n\|depois = \\n\}\}\\n\{\{Termina caixa\}\}\\n\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/8/8f/Cs_icon.png'); // Botao:Gerador de tabelas AddMyOwnButton(tbdiv, 'Gerador de tabelas', 'javascript:popupTabela();', 'http://upload.wikimedia.org/wikipedia/fr/0/04/Button_array.png'); // Botao:Ver tambem AddMyOwnButton(tbdiv, 'VT', 'javascript:document.editform.wpSummary.value=document.editform.wpSummary.value+\'+vt \';insertTags(\'=={{Ver também}}==\\n\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/fr/0/04/Ver_tambem.png'); // Botao:Ligações externas AddMyOwnButton(tbdiv, 'LE', 'javascript:document.editform.wpSummary.value=document.editform.wpSummary.value+\'+le \';insertTags(\'=={{Ligações externas}}==\\n\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/fr/0/04/Links_externos.png'); } } /* ==Portal== */ window.mynav_addlilink=function(tabs, url, name, id, title, key){ 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); tabs.appendChild(li); if(id) { if(key && title) ta[id] = [key, title]; else if(key) ta[id] = [key, '']; else if(title) ta[id] = ['', title]; } //akeytt(); return li; } window.showPortalIfTagged=function(){ var ppdiv=document.getElementById('n-portal-teste'); if (ppdiv) { var plet = document.getElementById('p-navigation').getElementsByTagName('ul')[0]; if (plet) { mynav_addlilink(plet, 'http://pt.wikipedia.org/wiki/Portal:' + ppdiv.childNodes[0].nodeValue, 'Portal:'+ ppdiv.childNodes[0].nodeValue, 'n-portal-tematico'); } } } /* ==Load up== */ window.myAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); } myAddOnload(myOwnEditButtons); myAddOnload(showPortalIfTagged); //============================================================ // Gerador de tabelas //============================================================ /** * * English: Generate an array using Mediawiki syntax. * * @author: fr:user:dake * @version: 0.1 */ function geraTabela(nbCol, nbRow, border, styleHeader, styleLine) { var code = "\n"; code += '{| border="' + border + '"\n'; code += '|+ Título da tabela\n'; for (var i=0;i<nbCol;i++) code += '! en-tête ' + i + '\n' for (var j=0;j<nbRow;j++) { if ((j+1)%2==0 && styleLine==1) { code += '|-{'+'color="#C0C0C0"'+'}\n' } else { code += '|-----\n' } for (var i=0;i<nbCol;i++) code += '| elemento\n'; } code += '|}'; insertTags('','', code); } /** * * English: Open a popup with parameters to generate an array. * The number of rows/columns can be modified. Some additional * parameters are related to templates available on :fr * * @author: fr:user:dake * @version: 0.1 */ function popupTabela() { var popup = window.open('','name','height=400,width=500'); javaCode = '<script type="text\/javascript">function insertCode(){'; javaCode += 'var row = parseInt(document.paramForm.inputRow.value); ' javaCode += 'var col = parseInt(document.paramForm.inputCol.value); ' javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); ' javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; ' javaCode += 'var styleLine = document.paramForm.inputLine.checked; ' javaCode += 'window.opener.geraTabela(col,row,bord,styleHeader,styleLine); ' javaCode += '}<\/script>'; popup.document.write('<html><head><title>Parâmetros da tabela</title>'); popup.document.write('<script type="text\/javascript" src="\/skins-1.5\/common\/wikibits.js"><!-- wikibits js --><\/script>'); popup.document.write('<style type="text\/css" media="screen,projection">/*<![CDATA[*/ @import "\/skins-1.5\/monobook\/main.css?5"; /*]]>*/<\/style>'); popup.document.write(javaCode); popup.document.write('</head><body>'); popup.document.write('<p>Insira os parâmetros da tabela : </p>'); popup.document.write('<form name="paramForm">'); popup.document.write('Número de linhas : <input type="text" name="inputRow" value="3" ><p>'); popup.document.write('Número de colunas : <input type="text" name="inputCol" value="3" ><p>'); popup.document.write('Largura do bordo : <input type="text" name="inputBorder" value="1" ><p>'); popup.document.write('Alteração de linhas a cinzento: <input type="checkbox" name="inputLine" checked="1" ><p>'); popup.document.write('</form">'); popup.document.write('<p><a href="javascript:insertCode();"> Inserir o código na janela de edição</a></p>'); popup.document.write('<p><a href="javascript:self.close()"> Fechar</a></p>'); popup.document.write('</body></html>'); popup.document.close(); }