Usuário:Jazzmelody/monobook.js
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
/**** quick image delete ****/
document.write('<script type="text/javascript"' +
'src="http://pt.wikipedia.org/w/index.php?title=Usuário:Rei-artur/quickimgdelete.js' +
'&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*<pre>*/
/*Returns the name of the page. For example, if you were browsing the "[[foo]]" WP page, getPname() would return "foo".*/
function getPname() {
return wgPageName.replace(/_/g, ' ');
}
/*</pre>
/*<pre>*/
//A helper function to add a button to one of the toolbars in the interface.
//An improved(I hope) version of [[Wikipedia:WikiProject User scripts/Scripts/Add LI link|addlilink]].
//[[User:JesseW/sig|JesseW, the juggling janitor]] 05:33, 8 November *2005 (UTC)
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;
}
/*</pre>[[Categoria:!Software para a Wikipédia]]*/
//fim de ferramenta de marcação de imagens
/*
==MyOwnEditButtons==
*/
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/9/97/Template_button.png');
// Botao:{Bem vindo ip}
AddMyOwnButton(tbdiv, 'Bem vindo ip', 'javascript:document.editform.wpSummary.value=\'\{\{bem vindo\}\}\';insertTags(\'\{\{bem vindo ip}} \~\~\~\~\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/5/54/Bvip_icon.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:{lixo}
AddMyOwnButton(tbdiv, 'Lixo', 'javascript:document.editform.wpSummary.value=\'\{\{lixo\}\}\';insertTags(\'\{\{lixo|\~\~\~\~\}}\',\'\',\'\');document.editform.submit();', 'http://upload.wikimedia.org/wikipedia/commons/e/e4/Bouton_Vandale3.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: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:redirect
AddMyOwnButton(tbdiv, 'redirect', 'javascript:document.editform.wpSummary.value=\'\';insertTags(\'#\REDIRECT\[\[\',\']]\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/c/c8/Button_redirect.png');
// Botao:categoria
AddMyOwnButton(tbdiv, 'categoria', 'javascript:document.editform.wpSummary.value=\'\+cat\';insertTags(\'[\[Categoria:\',\']]\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/1/11/Button_category.png');
// Botao:{aviso}
AddMyOwnButton(tbdiv, 'av', 'javascript:document.editform.wpSummary.value=\'\{\{aviso\}\}\';insertTags(\'\{\{aviso1|}}\{\{subst:Usuário:Rei-artur/ass}}\\~\~\~\~\~\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/e/ec/Button_aviso.png');
// Botao:correlatos
AddMyOwnButton(tbdiv, 'correlatos', 'javascript:document.editform.wpSummary.value=\'\+correlato\';insertTags(\'{\{Começa correlatos}\}\\n\{\{Correlato\|\commons\|}\}\\n\{\{Correlato\|\wikiquote\|}\}\\n\{\{Correlato\|\wikcionário\|}\}\\n\{\{Correlato\|\wikilivros\|}\}\\n\{\{Correlato\|\wikinotícias\|}\}\\n\{\{Correlato\|\wikisource\|}\}\\n\{\{Correlato\|\wikispecies\|}\}\\n\{\{Correlato\|\meta\|}\}\\n\{\{Termina correlatos}\}\\n\',\'\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/3/35/Sister_icon.png');
// Botao:{img}
AddMyOwnButton(tbdiv, 'img', 'javascript:document.editform.wpSummary.value=\'\+img \[\[Usuário\:Rei-artur\/stats\/imagens\|MI\]\]\';insertTags(\'\[\[Imagem\:\',\'\|thumb\|250px\|right\|descrição\]\]\',\'\');', 'http://upload.wikimedia.org/wikipedia/commons/1/1c/Button_advanced_image.png');
}
}
/*
==Load up==
*/
window.myAddOnload=function(f) {
if (window.addEventListener) window.addEventListener("load", f, false);
else if (window.attachEvent) window.attachEvent("onload",f);
}
myAddOnload(myOwnEditButtons);
/*
==editor==
*/
// install [[User:Cacycle/diff]] text diff code
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/diff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// install [[User:Pilaf/Live_Preview]] page preview tool
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Pilaf/livepreview.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
// install [[User:Cacycle/editor]] edit tool
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/editor.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
==Get_it==
*/
/*
* Add tab for Avatar's "CheckUsage", "block" and "purge"
* Rename "página de usuário" to "utilizador"
* Rename "minhas contribuições" to "contribuições"
* Based on Duesentrieb's, Dbenbenn's and Essjay's monobook.js code.
@author: Duesentrieb, [[User:Duesentrieb/monobook.js]], Dbenbenn, [[User:Dbenbenn/monobook.js]], Essjay [[User:Essjay/monobook.js]], ABCD [[User:ABCD/monobook.js]], JesseW [[User:JesseW/monobook.js]]
@license: Dual licensed under the GFDL and GPL
*/
// Returns <li><a href="url">name</a></li>
function addlilink(url, name)
{
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
return li;
}
// Gets the URL version of the page title.
function get_tidy_title()
{
var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
// cut everything up to "title=" from the start and everything past "&action=edit" from the end
editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit'));
return editlk;
}
// Adds "block" and "blocklog" tabs to User: and User talk: pages.
function add_block_tab()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// use the "edit this page" tab to get already-tidied url
var editlk = get_tidy_title();
editlk = editlk.substring(editlk.indexOf(':') + 1);
var slloc = editlk.indexOf('/');
if (slloc > 0)
editlk = editlk.substring(0, slloc);
// add "block" tab
tabs.appendChild(addlilink('/w/index.php?title=Special%3ABlockip&ip=' + editlk, 'Bloquear'));
// add "blocklog" tab
//tabs.appendChild(addlilink('/w/index.php?title=Special%3ALog&type=block&user=&page=User%3A' + editlk, 'blocklog'));
}
// Tab for Move-to-commons assistant
function add_image_tabs()
{
var imagetitle = get_tidy_title();
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// tabs.appendChild(addlilink('http://en.wikipedia.org/wiki/' + imagetitle, 'en'));
tabs.appendChild(addlilink('http://tools.wikimedia.de/~magnus/commonshelper.php?lang=pt&image=' + imagetitle, 'M2C'));
tabs.appendChlid(addlilink('1', '1'));
imagetitle = imagetitle.substring(6, imagetitle.length());
tabs.appendChlid(addlilink('2', '2'));
var i = 0;
while (imagetitle[i] >= '1' && imagetitle[i] <= '9')
i++;
tabs.appendChlid(addlilink(imagetitle + ' ' + i, imagetitle + ' ' + i));
if (i > 0 && imagetitle.substring(3) == 'px-') {
imagetitle = imagetitle.substring(i + 3, imagetitle.length());
tabs.appendChild(addlilink('http://commons.wikimedia.org/wiki/Image:' + imagetitle, 'unthumb'));
}
}
// Adds "purge" tab to pages.
function add_purge_tab()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
// use the "edit this page" tab to get already-tidied url
var editlk = get_tidy_title();
var editlko = get_tidy_title();
editlk = editlk.substring(editlk.indexOf(':') + 1);
var slloc = editlk.indexOf('/');
if (slloc > 0)
editlk = editlk.substring(0, slloc);
// add "purge" tab
tabs.appendChild(addlilink('/w/index.php?title=' + editlko + '&action=purge', 'A'));
// add "it" tab
tabs.appendChild(addlilink('/w/index.php?title=' + editlko + '&action=edit&fakeaction=mnx_warn&target=en&type=mnx_iw', 'en'));
// add "it" tab
tabs.appendChild(addlilink('/w/index.php?title=' + editlko + '&action=edit&fakeaction=mnx_warn&target=es&type=mnx_iw', 'es'));
// add "it" tab
tabs.appendChild(addlilink('/w/index.php?title=' + editlko + '&action=edit&fakeaction=mnx_warn&target=it&type=mnx_iw', 'it'));
}
function do_onload()
{
var title = get_tidy_title();
if (document.title.indexOf('Image:') == 0
|| document.title.indexOf('Imagem:') == 0)
{
add_image_tabs();
add_image_tabs2();
}
if (document.title.indexOf('User:') == 0
|| document.title.indexOf('User talk:') == 0
|| document.title.indexOf('Usuário:Rei-artur') == 1
|| document.title.indexOf('Usuário Discussão:Rei-artur') == 1
|| document.title.indexOf('Usuário:') == 0
|| document.title.indexOf('Usuário Discussão:') == 0)
{
add_block_tab();
}
add_purge_tab();
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
window.attachEvent("onload", do_onload);
if ( document.createElement && window.addEventListener )
{
function SoFixItInit() // pre-load
{
}
function SoFixItLoad() // post-load
{
UserMenu = new PortletMenu( 'p-personal' );
PageMenu = new PortletMenu( 'p-cactions' );
NavMenu = new PortletMenu( 'p-navigation' );
//ToolMenu = new PortletMenu( 'p-tb' );
// This is inefficient and not particularly robust.
// This comes first, I want this link to come up as
// fast as possible.
//
function GetByClass( sElem, sClass )
{ var i, a2 = [], a = document.getElementsByTagName( sElem );
for ( i = 0; i < a.length; i++ )
if ( a[ i ].className == sClass )
a2.push( a[ i ] );
return a2;
}
var a, td = GetByClass( 'td', 'diff-otitle' );
if ( ( td = td[ 0 ] ) && ( a = td.getElementsByTagName( 'a' )[ 0 ] ) )
a.href = a.href + '&action=edit'; // need to change text, later
var userName = UserMenu.getText( 'pt-userpage' );
UserMenu.setText( 'pt-mycontris' , 'Contribuições' );
PageMenu.setText( 'ca-nstab-user' , 'Utilizador' );
var x = 1;
NavMenu.append( 'n-' + x++, 'Esplanada', '/w/index.php?title=Wikipedia%3AEsplanada&action=purge' );
}
function PortletMenu( id ) // constructor
{
this.menu = document.getElementById( id );
this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc.
// sigh...as far as I can figure, there is empty whitespace being treated
// as TextNodes....
//
var LIs = this.list.getElementsByTagName( 'li' );
for ( var i = 0; i < LIs.length; i++ )
{
this[ LIs[ i ].id ] = LIs[ i ];
}
this.newItem = function( id, txt, url )
{ var li = document.createElement( 'li' ); li.id = id;
var a = document.createElement( 'a' ); a.href = url;
a.appendChild( document.createTextNode( txt ) );
li.appendChild( a );
this[ id ] = li; // watch this!!!
return li;
}
this.append = function( id, txt, url )
{ this.list.appendChild( this.newItem( id, txt, url ) );
}
this.insertBefore = function( old, id, txt, url )
{ this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );
}
// the ByTagName here is a bit annoying, but in Safari, I was picking
// up TextNodes by using this[ id ].firstChild.firstChild
//
this.getText = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
this.setText = function( id, txt ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }
this.getHref = function( id ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href }
this.setHref = function( id, url ) { this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }
}
SoFixItInit();
window.addEventListener( 'load', SoFixItLoad, false );
}
/*
==Barra de Navegação==
*/
// set up the words in your language
var NavigationBarHide = '▲ Esconder';
var NavigationBarShow = '▼ Expandir';