MediaWiki:Gadget-fastbuttons.js e Ajuda:Página de testes/1: diferenças entre as páginas
(Diferenças entre páginas)
Conteúdo apagado Conteúdo adicionado
m Uso de jQuery para manipular elementos HTML; +prefix nos ids; -tabela e fb.ajax (usavam códigos obsoletos); fusão de fb.esbOk() e fb.ESRok; divisão de fb.api em fb.callAPI e fb.processAPI (agora usa JSON em vez de XML); +simplificações |
|||
Linha 8: | Linha 8: | ||
window.fb = { |
window.fb = { |
||
//Replace this string by 5~ before saving: |
//Replace this string by 5~ before saving: |
||
version: ' |
version: '01h01min de 29 de julho de 2011 (UTC)', |
||
prefix: 'fast-buttons-', |
|||
namespace: mw.config.get('wgNamespaceNumber'), |
|||
ns: mw.config.get('wgNamespaceNumber'), |
|||
title: mw.config.get('wgTitle'), |
title: mw.config.get('wgTitle'), |
||
catScanUrl: 'http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php' + |
catScanUrl: 'http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php' + |
||
$.param( { |
|||
'?wikilang=pt&wikifam=.wikipedia.org&userlang=pt&basecat=' + |
|||
'wikilang': 'pt', |
|||
encodeURIComponent( mw.config.get('wgTitle') ) + '&basedeep=1&go=Examinar&format=html&mode=', |
|||
'wikifam': '.wikipedia.org', |
|||
menu: document.createElement('div'), |
|||
'userlang': 'pt', |
|||
submenu: document.createElement('div') |
|||
'basecat': mw.config.get('wgTitle'), |
|||
'basedeep': '1', |
|||
'go': 'Examinar', |
|||
'format': 'html', |
|||
'mode': '' |
|||
} ), |
|||
submenu: {}, |
|||
$menu: $( '<div/>' ), |
|||
$submenu: $( '<div/>' ) |
|||
}; |
}; |
||
Linha 37: | Linha 47: | ||
}; |
}; |
||
fb.submenu = { |
|||
/*** Menu [ER] ***/ |
|||
/*** Submenu [ER] ***/ |
|||
fb.ER = "Regra:"; |
|||
ER: "Regra: 1 " + [ |
|||
fb.link("ER|5", "5", "Aparecimento recorrente (se o conteúdo for igual" + |
fb.link("ER|5", "5", "Aparecimento recorrente (se o conteúdo for igual" + |
||
" ao eliminado por votação)"), |
" ao eliminado por votação)"), |
||
(($.inArray(fb. |
(($.inArray(fb.ns, [0, 102]) !== -1) ? |
||
fb.link("ER|6", "6", "Título é spam") : |
fb.link("ER|6", "6", "Título é spam") : |
||
" 6 "), |
" 6 "), |
||
Linha 52: | Linha 62: | ||
fb.link("ER|9", "9", "Eliminar redirect, página sem histórico relevante" |
fb.link("ER|9", "9", "Eliminar redirect, página sem histórico relevante" |
||
+ " (mover página redirecionada para cá)"), |
+ " (mover página redirecionada para cá)"), |
||
((fb. |
((fb.ns === 0) ? |
||
fb.link("ER|10", "10", "Namespaces que não existem (WikipÉdia, AjUda)") : |
fb.link("ER|10", "10", "Namespaces que não existem (WikipÉdia, AjUda)") : |
||
" 10 " ), |
" 10 " ), |
||
fb.link("ER|11", "11", "Má configuração do teclado (Página," + |
fb.link("ER|11", "11", "Má configuração do teclado (Página," + |
||
" Usuário:Sicrano)"), |
" Usuário:Sicrano)"), |
||
(fb. |
(fb.ns == 6) ? |
||
fb.link("ER|12", "12", "Imagens, somente por quem a carregou") : |
fb.link("ER|12", "12", "Imagens, somente por quem a carregou") : |
||
" 12 ", |
" 12 ", |
||
($.inArray(fb. |
($.inArray(fb.ns, [0, 102]) !== -1) ? |
||
fb.link("ER|13", "13", "Páginas sem histórico relevante que são" + |
fb.link("ER|13", "13", "Páginas sem histórico relevante que são" + |
||
" violações flagrantes de direitos autorais de outras páginas" + |
" violações flagrantes de direitos autorais de outras páginas" + |
||
" na internet.") : |
" na internet.") : |
||
" 13 ", |
" 13 ", |
||
(fb. |
(fb.ns == 6) ? |
||
fb.link("ER|14", "14", "Ficheiros (arquivos) duplicados") : |
fb.link("ER|14", "14", "Ficheiros (arquivos) duplicados") : |
||
" 14 ", |
" 14 ", |
||
fb.link("ER|17", "17", "Salto de domínio"), |
fb.link("ER|17", "17", "Salto de domínio"), |
||
(fb. |
(fb.ns == 1) ? |
||
fb.link("ER|18", "18", "Discussão cujos artigos não existem") : |
fb.link("ER|18", "18", "Discussão cujos artigos não existem") : |
||
" 18 ", |
" 18 ", |
||
(fb. |
(fb.ns == 6) ? |
||
fb.link("ER|19", "19", "Ficheiros (domínio Ficheiro:) que não são som," + |
fb.link("ER|19", "19", "Ficheiros (domínio Ficheiro:) que não são som," + |
||
" imagem ou vídeo") : |
" imagem ou vídeo") : |
||
Linha 81: | Linha 91: | ||
" passados 6 meses da última votação") : |
" passados 6 meses da última votação") : |
||
" 21 ", |
" 21 ", |
||
($.inArray(fb. |
($.inArray(fb.ns, [0, 102]) !== -1) ? |
||
fb.link("ER|A1", "A1", "Páginas com o título malformatado, absurdo," + |
fb.link("ER|A1", "A1", "Páginas com o título malformatado, absurdo," + |
||
" com palavras que não o são, com erros devidos à má configuração" + |
" com palavras que não o são, com erros devidos à má configuração" + |
||
Linha 87: | Linha 97: | ||
" domínios que não existem.") : |
" domínios que não existem.") : |
||
" A1 ", |
" A1 ", |
||
(fb. |
(fb.ns == 14) ? |
||
fb.link("ER|C1", "C1", "Categorias vazias, desnecessárias ou substituídas") : |
fb.link("ER|C1", "C1", "Categorias vazias, desnecessárias ou substituídas") : |
||
" C1 ", |
" C1 ", |
||
(fb. |
(fb.ns % 2 == 1) ? |
||
fb.link("ER|D1", "D1", "Discussões de páginas inexistentes") : |
fb.link("ER|D1", "D1", "Discussões de páginas inexistentes") : |
||
" D1 ", |
" D1 ", |
||
(fb. |
(fb.ns % 2 == 1) ? |
||
fb.link("ER|D2", "D2", "Discussões de páginas para eliminação ou com" + |
fb.link("ER|D2", "D2", "Discussões de páginas para eliminação ou com" + |
||
" histórico irrelevante") : |
" histórico irrelevante") : |
||
" D2 ", |
" D2 ", |
||
($.inArray(fb. |
($.inArray(fb.ns, [2, 3]) !== -1) ? |
||
fb.link("ER|U1", "U1", "Uso impróprio da página de usuário") : |
fb.link("ER|U1", "U1", "Uso impróprio da página de usuário") : |
||
" U1 ", |
" U1 ", |
||
(fb. |
(fb.ns == 2) ? |
||
fb.link("ER|U2", "U2", "PU criada por outro usuário") : |
fb.link("ER|U2", "U2", "PU criada por outro usuário") : |
||
" U2 ", |
" U2 ", |
||
(fb. |
(fb.ns == 10) ? |
||
fb.link("ER|P1", "P1", "Predefinições vazias, desnecessárias ou" + |
fb.link("ER|P1", "P1", "Predefinições vazias, desnecessárias ou" + |
||
" substituídas") : |
" substituídas") : |
||
Linha 109: | Linha 119: | ||
fb.link("ER|R1", "R1", "Redirecionamento indevido, desnecessário, sem" + |
fb.link("ER|R1", "R1", "Redirecionamento indevido, desnecessário, sem" + |
||
" afluentes, para páginas inexistente ou eliminadas"), |
" afluentes, para páginas inexistente ou eliminadas"), |
||
(fb. |
(fb.ns % 2 == 1) ? |
||
fb.link("ER|R2", "R2", "Redirecionamento de página de discussão") : |
fb.link("ER|R2", "R2", "Redirecionamento de página de discussão") : |
||
" R2 " |
" R2 " |
||
].join('|') |
].join('|'), |
||
/*** Submenu [ESR] ***/ |
|||
ESR: fb.link("subst:ESR-banda|1=~~" + "~~", "banda", "Artigo sobre banda sem fontes e sem notoriedade") |
|||
/*** Menu [ESR] ***/ |
|||
// FIXME: Update deprecated attributes to CSS: cellspacing --> border-spacing, valign --> vertical-align |
|||
fb.ESR = "<table cellspacing=0 style=\"color:#7D7D7D\"><tr><td valign=top>" |
|||
+ fb.link("subst:ESR-banda|1=~~" + "~~", "banda", "Artigo sobre banda sem fontes e sem notoriedade") |
|||
+ "|" + fb.link("subst:ESR-bio|1=~~" + "~~", "biografia", "Biografia sem fontes e sem notoriedade") |
+ "|" + fb.link("subst:ESR-bio|1=~~" + "~~", "biografia", "Biografia sem fontes e sem notoriedade") |
||
+ "|" + fb.link("subst:ESR-empresa|1=~~" + "~~", "empresa", "Empresa sem fontes e sem notoriedade") |
+ "|" + fb.link("subst:ESR-empresa|1=~~" + "~~", "empresa", "Empresa sem fontes e sem notoriedade") |
||
+ "| outra: |
+ "| outra: <input type=\"text\" id=\"" + fb.prefix + "esr-input\" onKeyPress=\"fb.ok(event, 'ESR')\" size=55/>" |
||
+ "<input type=\"button\" onMouseDown='fb.ok(\"ok\", \"ESR\")' value=\"OK\"/>", |
|||
/*** Submenu [esboço] ***/ |
|||
esb: fb.link("mínimo", "mínimo", "Artigo com apenas uma frase") + |
|||
/*** Menu [esboço] ***/ |
|||
// FIXME: Update deprecated attributes to CSS: cellspacing --> border-spacing, valign --> vertical-align |
|||
fb.esb = "<table cellspacing=0 style=\"color:#7D7D7D\">" + |
|||
"<tr><td valign=top>" + |
|||
fb.link("mínimo", "mínimo", "Artigo com apenas uma frase") + |
|||
"|" + fb.link("esboço", "esboço", "Artigo ainda pouco desenvolvido") + |
"|" + fb.link("esboço", "esboço", "Artigo ainda pouco desenvolvido") + |
||
"| <span style=\"color:black;\">esboço-</span>" + |
"| <span style=\"color:black;\">esboço-</span>" + |
||
"<input id=\"" + fb.prefix + "esb-input\" onkeyup='fb.callAPI(\"esb\")'" + |
|||
" onKeyPress=\"fb. |
" onKeyPress=\"fb.ok(event, 'esb')\" size=14/>" + |
||
"<input type=\"button\" onMouseDown='fb. |
"<input type=\"button\" onMouseDown='fb.ok(\"ok\", \"esb\")' value=\"OK\"/>", |
||
/*** Submenu [manuteção] ***/ |
|||
"</td></tr></table>"; |
|||
man: [ |
|||
/*** Menu [manuteção] ***/ |
|||
fb.man = [ |
|||
fb.link("subst:wkf", "wikificar", "Não está formatado de acordo com o livro" + |
fb.link("subst:wkf", "wikificar", "Não está formatado de acordo com o livro" + |
||
" de estilo"), |
" de estilo"), |
||
Linha 158: | Linha 160: | ||
fb.link("subst:fpr", "fonte primária", "Artigo necessita de fontes" + |
fb.link("subst:fpr", "fonte primária", "Artigo necessita de fontes" + |
||
" secundárias fiáveis publicadas por terceiros") |
" secundárias fiáveis publicadas por terceiros") |
||
].join('|') |
].join('|'), |
||
/*** Submenu [busca] ***/ |
|||
search: [ |
|||
/*** Menu [busca] ***/ |
|||
"<span class=\"plainlinks\"><a href=\"http://www.google.com/search?&as_eq=wikipedia&as_epq=", |
|||
if (fb.title.indexOf(" ") > -1){ |
|||
"\" class=\"external text\">Google</a> — <a href=\"http://news.google.com/archivesearch?&as_src=-newswire+-wire+-presswire+-PR+-press+-release&as_epq=", |
|||
fb.title = "\"" + fb.title + "\""; |
|||
"\" class=\"external text\">notícias</a>, <a href=\"http://books.google.com/books?&as_brr=0&as_epq=", |
|||
} |
|||
"\" class=\"external text\">livros</a>, <a href=\"http://scholar.google.com/scholar?as_epq=", |
|||
fb.title = encodeURIComponent(fb.title); |
|||
"\" class=\"external text\">acadêmico</a> — <a href=\"http://www.scirus.com/srsapp/search?q=", |
|||
"&t=all&sort=0&g=s\" class=\"external text\">Scirus</a></span>" |
|||
+ fb.title + "\" class=\"external text\">Google</a> — <a href=\"http://news.google.com/archivesearch?&as_src=-newswire+-wire+-presswire+-PR+-press+-release&as_epq=" |
|||
].join( encodeURIComponent( ( fb.title.indexOf( ' ' ) > -1 ) ? '"' + fb.title + '"': fb.title ) ), |
|||
+ fb.title + "\" class=\"external text\">notícias</a>, <a href=\"http://books.google.com/books?&as_brr=0&as_epq=" |
|||
+ fb.title + "\" class=\"external text\">livros</a>, <a href=\"http://scholar.google.com/scholar?as_epq=" |
|||
+ fb.title + "\" class=\"external text\">acadêmico</a> — <a href=\"http://www.scirus.com/srsapp/search?q=" |
|||
+ fb.title + "&t=all&sort=0&g=s\" class=\"external text\">Scirus</a></span>"; |
|||
/*** |
/*** Submenu [aviso] ***/ |
||
warn: [fb.link("subst:bem-vindo IP", "BV-IP", |
|||
"Boas-vindas para usuário(a) não registrado(a)"), |
"Boas-vindas para usuário(a) não registrado(a)"), |
||
fb.link("subst:bem-vindo", "BV", "Bem-vindo(a) à Wikipédia"), |
fb.link("subst:bem-vindo", "BV", "Bem-vindo(a) à Wikipédia"), |
||
Linha 226: | Linha 225: | ||
fb.link("subst:autobiografia", "autobiografia", "Não crie autobiografias", |
fb.link("subst:autobiografia", "autobiografia", "Não crie autobiografias", |
||
"Qual autobiografia foi criada?") |
"Qual autobiografia foi criada?") |
||
].join('|') |
].join('|'), |
||
/** Submenu [CatScan] **/ |
|||
cat: "Procurar nesta categoria: " + [ |
|||
/** Menu [CatScan] **/ |
|||
fb.cat = "Procurar nesta categoria: " + [ |
|||
"<a href='" + fb.catScanUrl + "ts&templates=Sem-fontes'>sem fontes</a>", |
"<a href='" + fb.catScanUrl + "ts&templates=Sem-fontes'>sem fontes</a>", |
||
"<a href='" + fb.catScanUrl + "ts&templates=Revis%C3%A3o&go='>revisão</a>", |
"<a href='" + fb.catScanUrl + "ts&templates=Revis%C3%A3o&go='>revisão</a>", |
||
Linha 235: | Linha 233: | ||
"<a href='" + fb.catScanUrl + "ss&size=1000&stubop=or&links=4&go='>menos de 1 000 bytes ou 4 links</a>", |
"<a href='" + fb.catScanUrl + "ss&size=1000&stubop=or&links=4&go='>menos de 1 000 bytes ou 4 links</a>", |
||
"<a href='" + fb.catScanUrl + "ss&size=500&stubop=or&links=2&go='>menos de 500 bytes ou 2 links</a>" |
"<a href='" + fb.catScanUrl + "ss&size=500&stubop=or&links=2&go='>menos de 500 bytes ou 2 links</a>" |
||
].join(' | ') |
].join(' | ') |
||
var esbText = "", |
|||
esbText2 = ""; |
|||
//TODO: Merge with function fb.ESRok() defined above, possibly using $('#target').keypress() |
|||
fb.esbOk = function (evt) { |
|||
if (window.event && window.event.keyCode == 13) { |
|||
evt = "ok"; |
|||
} else if (evt && evt.which == 13) { |
|||
evt = "ok"; |
|||
} |
|||
if (evt == "ok") { |
|||
fb.run("esboço-" + document.getElementById("esbinput").value); |
|||
} |
|||
}; |
}; |
||
// TODO: Consider using jQuery: $('#target').keypress() |
|||
// TODO: Merge with function fb.esbOk() defined below, possibly using jQuery |
|||
fb.ok = function( evt, option ) { |
|||
// $('#target').keypress() |
|||
fb.ESRok = function(evt) { |
|||
if (window.event && window.event.keyCode == 13) { |
if (window.event && window.event.keyCode == 13) { |
||
evt = |
evt = 'ok'; |
||
} else if (evt && evt.which == 13) { |
} else if (evt && evt.which == 13) { |
||
evt = |
evt = 'ok'; |
||
} |
} |
||
if (evt == |
if (evt == 'ok') { |
||
if ( option == 'esb' ) { |
|||
this.run("subst:ESR", document.getElementById("esrinput").value + " ~~" + "~~"); |
|||
fb.run("esboço-" + document.getElementById( fb.prefix + 'esb-input' ).value); |
|||
} else if ( option == 'ESR' ) { |
|||
fb.run("subst:ESR", document.getElementById( fb.prefix + 'esr-input' ).value + " ~~" + "~~"); |
|||
} |
|||
} |
} |
||
}; |
}; |
||
/* |
|||
* Adds the content of the menu to the corresponding element |
|||
* @param: {string} A string containing the content to be added |
|||
* TODO: Replace ocurrences of this function by something like $(...).html() |
|||
*/ |
|||
fb.open = function (menu) { |
|||
this.submenu.innerHTML = menu; |
|||
}; |
|||
/* Função de edição |
/* Função de edição |
||
Linha 369: | Linha 348: | ||
"Página marcada como [[WP:M|mínimo]]" : |
"Página marcada como [[WP:M|mínimo]]" : |
||
"Página marcada como [[WP:EBC|esboço]]"; |
"Página marcada como [[WP:EBC|esboço]]"; |
||
} else if (code |
} else if ($.inArray( code, [ 'subst:VDA' , 'subst:matrad' ]) > -1) { |
||
value = extraText; |
value = extraText; |
||
} else { |
} else { |
||
Linha 399: | Linha 378: | ||
}; |
}; |
||
var esb, |
|||
esbText = "", |
|||
esbText2 = ""; |
|||
/* Callback function for API calls |
|||
/* Consulta a API do MediaWiki usando AJAX |
|||
* @param |
* @param {string} code An abreviation such as "esb", "afl", "PV", |
||
* @param: {string} url The url of the API query |
|||
* FIXME: @deprecated Use jQuery AJAX functions (see [[mw:RL/JD#ajax.js]] ) |
|||
*/ |
*/ |
||
fb. |
fb.callAPI = function ( code ) { |
||
var user, |
|||
var ajax = sajax_init_object(), |
|||
that = this |
that = this, |
||
apiParams = { |
|||
if (!ajax) { |
|||
'esb': { |
|||
return; |
|||
'list': 'allpages', |
|||
'aplimit': '1', |
|||
'apnamespace': '10' |
|||
}, |
|||
'afl': { |
|||
'list': 'backlinks', |
|||
'bllimit': '1', |
|||
'blfilterredir': 'nonredirects', |
|||
'blnamespace': '0', |
|||
'bltitle': mw.config.get('wgPageName') |
|||
}, |
|||
'PV': { |
|||
'list': 'watchlist', |
|||
'wlprop': 'user|comment|title|sizes', |
|||
'wlexcludeuser': mw.config.get('wgUserName') |
|||
}, |
|||
'PN': { |
|||
'list': 'recentchanges', |
|||
'rctype': 'new', |
|||
'rcnamespace': '0', |
|||
'rcshow': '!patrolled', |
|||
'rcprop': 'user|comment|title|sizes|ids' |
|||
}, |
|||
'MR': { |
|||
'list': 'recentchanges', |
|||
'rctype': 'edit', |
|||
'rcnamespace': '0', |
|||
'rcshow': 'anon', |
|||
'rcprop': 'user|comment|title|sizes' |
|||
}, |
|||
'usu': { |
|||
'list': 'allusers', |
|||
'aulimit': '1', |
|||
'auprop': 'editcount|registration' |
|||
} |
|||
}; |
|||
switch ( code ) { |
|||
case 'esb': |
|||
esb = document.getElementById( fb.prefix + 'esb-input' ); |
|||
if (esbText == esb.value || esbText2 == esb.value) { |
|||
return; |
|||
} |
|||
esbText = esb.value; |
|||
if (esbText == esb.value.substr(0, (esb.value.length - 1))) { |
|||
return; |
|||
} |
|||
apiParams.esb.apprefix = 'Esboço-' + esb.value; |
|||
break; |
|||
case 'usu': |
|||
user = mw.config.get('wgTitle'); |
|||
if ( user.indexOf('/') > -1 ) { |
|||
user = user.substring(0, user.indexOf('/')); |
|||
} |
|||
apiParams.usu.aufrom = user; |
|||
break; |
|||
} |
} |
||
apiParams[ code ].format = 'json'; |
|||
ajax.open('GET', url, true); |
|||
apiParams[ code ].action = 'query'; |
|||
ajax.send(''); |
|||
$.getJSON( |
|||
ajax.onreadystatechange = function () { |
|||
mw.util.wikiScript( 'api' ), |
|||
if (ajax.readyState == 4 && ajax.status == 200) { |
|||
apiParams[ code ], function( data ) { |
|||
that.processAPI( code, data ); |
|||
} |
} |
||
); |
|||
}; |
}; |
||
/* Callback function for API calls |
/* Callback function for API calls |
||
* @param {string} code An abreviation such as "esb", "afl", "PV", |
* @param {string} code An abreviation such as "esb", "afl", "PV", |
||
* @param {Object} |
* @param {Object} data JSON content returned by API |
||
*/ |
*/ |
||
fb. |
fb.processAPI = function (code, data) { |
||
var |
var i, title, length, comment, user, |
||
query = data && data.query, |
|||
if (!api) { |
|||
pages = [], |
|||
url = mw.config.get('wgScriptPath') + "/api.php?format=xml&action=query&"; |
|||
charnum = 0, |
|||
// TODO: Criar um objeto { 'esb': ..., 'afl':... } com um item para cada "fabi" |
|||
that = this; |
|||
case 'esb': |
|||
/** Processamento da resposta do API **/ |
|||
esb = document.getElementById("esbinput"); |
|||
switch ( code ) { |
|||
if (esbText == esb.value || esbText2 == esb.value) { |
|||
case 'afl': |
|||
return; |
|||
var backlinks, |
|||
} |
|||
info = "("; |
|||
info += (document.getElementById("Refer.C3.AAncias") |
|||
if (esbText == esb.value.substr(0, (esb.value.length - 1))) { |
|||
|| document.getElementById("Notas_e_refer.C3.AAncias")) ? |
|||
return; |
|||
"ref" : |
|||
"<span style=\"color:red\">ref</span>"; |
|||
url += "list=allpages&aplimit=1&apnamespace=10&apprefix=" + |
|||
var catLine = document.getElementById("mw-normal-catlinks"); |
|||
encodeURI("Esboço-") + encodeURIComponent(esb.value); |
|||
// FIXME: Do not do screen scraping to get this info! |
|||
break; |
|||
if (catLine && catLine.innerHTML.indexOf("><a href=\"" + mw.config.get('wgArticlePath').replace('$1', '')) > -1) { |
|||
case 'afl': |
|||
info += " · cat"; |
|||
url += "list=backlinks&bllimit=1&blfilterredir=nonredirects" + |
|||
} else { |
|||
"&blnamespace=0&bltitle=" + |
|||
info += " · <span style=\"color:red\" title=\"Esta página ainda não foi categorizada\">cat</span>"; |
|||
encodeURIComponent(mw.config.get('wgPageName')); |
|||
break; |
|||
case 'PV': |
|||
url += "list=watchlist&wlexcludeuser=" + |
|||
encodeURIComponent(mw.config.get('wgUserName')) + |
|||
"&wlprop=user|comment|title|sizes"; |
|||
break; |
|||
case 'PN': |
|||
url += "list=recentchanges&rctype=new&rcnamespace=0" + |
|||
"&rcshow=!patrolled&rcprop=user|comment|title|sizes|ids"; |
|||
break; |
|||
case 'MR': |
|||
url += "list=recentchanges&rctype=edit&rcnamespace=0" + |
|||
"&rcshow=anon&rcprop=user|comment|title|sizes"; |
|||
break; |
|||
case 'usu': |
|||
user = mw.config.get('wgTitle'); |
|||
if (user.indexOf('/') > -1) { |
|||
user = user.substring(0, user.indexOf('/')); |
|||
} |
|||
url += "list=allusers&aulimit=1&aufrom=" + |
|||
encodeURIComponent(user) + "&auprop=editcount|registration"; |
|||
break; |
|||
} |
} |
||
info += (document.getElementById("p-lang")) ? |
|||
this.ajax(code, url); |
|||
" · iw" : |
|||
} else { |
|||
" · <span style=\"color:red\" title=\"Esta página ainda não" + |
|||
/** Processamento da resposta do API **/ |
|||
" possui links para outros idiomas\">iw</span>"; |
|||
switch ( code ) { |
|||
case 'afl': |
|||
// Afluentes |
|||
backlinks = query && query.backlinks; |
|||
var info = "("; |
|||
if ( !backlinks ) { |
|||
info += (document.getElementById("Refer.C3.AAncias") |
|||
mw.log( 'The backlinks query returned no data.' ); |
|||
|| document.getElementById("Notas_e_refer.C3.AAncias")) ? |
|||
} else if ( backlinks.length ) { |
|||
"ref" : |
|||
info += ' · <a href="' + |
|||
"<span style=\"color:red\">ref</span>"; |
|||
mw.util.wikiGetlink( 'Especial:Páginas afluentes/' + mw.config.get('wgPageName') ) + |
|||
var catLine = document.getElementById("mw-normal-catlinks"); |
|||
'" title="afluentes">afl</a>)'; |
|||
// FIXME: Do not do screen scraping to get this info! |
|||
} else { |
|||
if (catLine && catLine.innerHTML.indexOf("><a href=\"" + mw.config.get('wgArticlePath').replace('$1', '')) > -1) { |
|||
info += ' · <span style="color:red">afl</span>)'; |
|||
} |
|||
this.$submenu.html( info ); |
|||
info += " · <span style=\"color:red\" title=\"Esta página ainda não foi categorizada\">cat</span>"; |
|||
if ( document.getElementById( 'ca-talk' ).className != 'new' ) { |
|||
} |
|||
$.getJSON( |
|||
info += (document.getElementById("p-lang")) ? |
|||
mw.util.wikiScript( 'api' ), { |
|||
" · iw" : |
|||
'format': 'json', |
|||
" · <span style=\"color:red\" title=\"Esta página ainda não" + |
|||
'action': 'query', |
|||
" possui links para outros idiomas\">iw</span>"; |
|||
'prop': 'categories', |
|||
api = api.getElementsByTagName("bl"); |
|||
'indexpageids': '1', |
|||
if (api && api.length) { |
|||
'titles': mw.config.get('wgFormattedNamespaces')[ mw.config.get('wgNamespaceNumber') + 1 ] + |
|||
info += " · <a href=\"" + |
|||
':' + mw.config.get('wgTitle') |
|||
}, function( data ) { |
|||
"\" title=\"afluentes\">afl</a>)"; |
|||
that.processAPI( 'qualidade', data ); |
|||
} else { |
|||
} |
|||
info += " · <span style=\"color:red\">afl</span>)"; |
|||
); |
|||
} else { |
|||
url = mw.config.get('wgScriptPath') + |
|||
var hiddenCats = document.getElementById("mw-hidden-catlinks"); |
|||
"/api.php?format=xml&action=query&prop=categories&titles=" + |
|||
if (hiddenCats) { |
|||
mw.config.get('wgFormattedNamespaces')[ mw.config.get('wgNamespaceNumber') + 1 ] + |
|||
hiddenCats = hiddenCats.innerHTML; |
|||
encodeURIComponent( mw.config.get('wgTitle') ); |
|||
if (hiddenCats.indexOf("!Artigos de qualidade") > -1) { |
|||
this.submenu.innerHTML = info; |
|||
hiddenCats = hiddenCats.substr(hiddenCats.indexOf("!Artigos de qualidade") + 22, 1); |
|||
if (document.getElementById("ca-talk").className != "new") { |
|||
if (hiddenCats == "d") { |
|||
this.ajax("qualidade", url); |
|||
hiddenCats = "?"; |
|||
} else { |
|||
var hiddenCats = document.getElementById("mw-hidden-catlinks"); |
|||
if (hiddenCats) { |
|||
hiddenCats = hiddenCats.innerHTML; |
|||
if (hiddenCats.indexOf("!Artigos de qualidade") > -1) { |
|||
hiddenCats = hiddenCats.substr(hiddenCats.indexOf("!Artigos de qualidade") + 22, 1); |
|||
if (hiddenCats == "d") { |
|||
hiddenCats = "?"; |
|||
} |
|||
this.submenu.innerHTML += "<span title='Qualidade do artigo'> Q-<b>" + |
|||
hiddenCats + "</b></span>"; |
|||
} |
} |
||
this.$submenu.html( |
|||
this.$submenu.html() + "<span title='Qualidade do artigo'> Q-<b>" + |
|||
hiddenCats + "</b></span>" |
|||
); |
|||
} |
} |
||
} |
} |
||
break; |
} |
||
break; |
|||
case 'qualidade': |
|||
var cats, cat, pageids, quality; |
|||
// Qualidade do artigo |
|||
if ( query ) { |
|||
api = api.getElementsByTagName("cl"); |
|||
cats = query.pages; |
|||
if (api) { |
|||
pageids = query.pageids; |
|||
var quality; |
|||
if ( cats && pageids && pageids.length ) { |
|||
cats = cats[ pageids[0] ].categories; |
|||
if (!api[i]){ |
|||
if ( !cats ){ |
|||
mw.log( 'The categories query returned incomplete data.' ); |
|||
} |
|||
return false; |
|||
quality = api[i].getAttribute("title"); |
|||
if (quality.indexOf("!Artigos de qualidade") > -1) { |
|||
quality = quality.substr(32, 1); |
|||
if (quality == "d") { |
|||
quality = "?"; |
|||
} |
|||
this.submenu.innerHTML += "<span title='Qualidade do artigo'> Q-<b>" + |
|||
quality + "</b></span>"; |
|||
break; |
|||
} |
|||
} |
} |
||
} else { |
} else { |
||
mw.log( 'The categories query returned incomplete data.' ); |
|||
return; |
|||
return false; |
|||
} |
} |
||
} else { |
|||
break; |
|||
mw.log( 'The categories query returned no data.' ); |
|||
case 'esb': |
|||
return false; |
|||
// Esboço temático |
|||
} |
|||
api = api.getElementsByTagName("p"); |
|||
// Qualidade do artigo |
|||
if (api && api.length) { |
|||
for (i = 0; i < cats.length; i++) { |
|||
api = api[0].getAttribute("title") |
|||
cat = cats[i].title; |
|||
.replace(/Predefinição:Esboço-/gi, ""); |
|||
if ( cat && cat.indexOf( '!Artigos de qualidade' ) > -1 ){ |
|||
// Categoria:!Artigos de qualidade 1 sobre ... |
|||
// ^ |
|||
quality = cat.substr( 32, 1 ); |
|||
if (quality == 'd') { |
|||
quality = '?'; |
|||
} |
|||
this.$submenu.html( |
|||
this.$submenu.html() + |
|||
'<span title="Qualidade do artigo"> Q-<b>' + |
|||
quality + '</b></span>' |
|||
); |
|||
break; |
|||
} |
|||
} |
|||
break; |
|||
case 'esb': |
|||
var template, |
|||
esb = document.getElementById( fb.prefix + 'esb-input' ); |
|||
if ( query ) { |
|||
template = query.allpages && query.allpages[0] && query.allpages[0].title; |
|||
if ( !template ) { |
|||
mw.log( 'The categories query returned incomplete data.' ); |
|||
return false; |
|||
} |
|||
template = template.replace( /^Predefinição:Esboço-/gi, '' ); |
|||
} else { |
|||
mw.log( 'The categories query returned no data.' ); |
|||
return false; |
|||
} |
|||
if ((esb.setSelectionRange |
|||
|| esb.createTextRange |
|||
|| typeof (esb.selectionStart) != 'undefined' |
|||
&& typeof (esb.selectionEnd) != 'undefined' |
|||
) |
|||
&& esb.value == template.substr(0, esb.value.length) |
|||
) { |
|||
// Exibe sugestões. Baseado no script do HotCat |
|||
var start = esb.value.length; |
|||
esb.value = template; |
|||
esbText2 = template; |
|||
if (esb.setSelectionRange) { |
|||
esb.setSelectionRange(start, template.length); |
|||
} else if (esb.createTextRange) { |
|||
var sel = esb.createTextRange(); |
|||
sel.move( 'character', start ); |
|||
sel.moveEnd( 'character', template.length - start ); |
|||
sel.select(); |
|||
} else { |
} else { |
||
esb.selectionStart = start; |
|||
return; |
|||
esb.selectionEnd = template.length; |
|||
} |
} |
||
} |
|||
if ((esb.setSelectionRange |
|||
break; |
|||
|| esb.createTextRange |
|||
case 'PN': |
|||
|| typeof (esb.selectionStart) != 'undefined' |
|||
case 'MR': // Mudanças recentes |
|||
&& typeof (esb.selectionEnd) != 'undefined' |
|||
case 'PV': // Páginas vigiadas |
|||
) |
|||
var item, j, |
|||
&& esb.value == api.substr(0, esb.value.length) |
|||
listName = { |
|||
'PV': 'watchlist', |
|||
// Exibe sugestões. Baseado no script do HotCat |
|||
'MR': 'recentchanges', |
|||
var start = esb.value.length; |
|||
'PN': 'recentchanges' |
|||
esb.value = api; |
|||
}, |
|||
esbText2 = api; |
|||
summaryChanges = { |
|||
if (esb.setSelectionRange) { |
|||
'PV' : [ |
|||
esb.setSelectionRange(start, api.length); |
|||
[ '[[Ajuda:Guia de edição/Menus e ferramentas/Sumário de edição|?]]', '' ], |
|||
} else if (esb.createTextRange) { |
|||
[ '/*', '?' ], |
|||
var sel = esb.createTextRange(); |
|||
[ '*/', ':' ] |
|||
], |
|||
sel.moveEnd("character", api.length - start); |
|||
'MR' : [ |
|||
[ '/*', '?' ], |
|||
[ '*/', ':' ] |
|||
esb.selectionStart = start; |
|||
], |
|||
esb.selectionEnd = api.length; |
|||
'PN' : [ |
|||
[ '[[Ajuda:SEA|?]] ', '' ] |
|||
] |
|||
}, |
|||
urlParam = { |
|||
'PV': 'diff=last', |
|||
'MR': 'diff=last', |
|||
'PN': 'redirect=no&rcid=' |
|||
}, |
|||
list = query[ listName[ code ] ], |
|||
max = ( list.length < 10 )? list.length : 10; |
|||
for ( i = 0; i < max; i++ ) { |
|||
item = list[ i ]; |
|||
if ( !item ){ |
|||
continue; |
|||
} |
} |
||
title = item.title; |
|||
break; |
|||
charnum += title.length; |
|||
case 'PV': |
|||
if (charnum > 180) { |
|||
break; |
|||
api = api.getElementsByTagName("item"); |
|||
for (i = 0; i < api.length && i < 10; i++) { |
|||
if (!api[i]){ |
|||
continue; |
|||
} |
|||
title = api[i].getAttribute("title"); |
|||
charnum += title.length; |
|||
if (charnum > 180) { |
|||
break; |
|||
} |
|||
length = (api[i].getAttribute("newlen") |
|||
- api[i].getAttribute("oldlen")); |
|||
if (length > 0) { |
|||
length = "+" + length; |
|||
} |
|||
comment = api[i].getAttribute("comment").replace("/*", "?"); |
|||
if (comment) { |
|||
comment = "(" + comment.replace("*/", ":") + ")"; |
|||
} |
|||
comment = comment.replace("[[Ajuda:Guia de edição/Menus e" + |
|||
" ferramentas/Sumário de edição|?]]", ""); |
|||
if ( i > 0){ |
|||
pages += ' | '; |
|||
} |
|||
pages += "<a href=\"" + mw.util.wikiGetlink( title ) + |
|||
"?diff=last\" title=\"(" + length + ") " + |
|||
api[i].getAttribute("user") + " " + comment + "\">" + |
|||
title + "</a>"; |
|||
} |
} |
||
length = item.newlen - item.oldlen; |
|||
this.submenu.innerHTML = pages; |
|||
if (length > 0) { |
|||
break; |
|||
length = '+' + length; |
|||
case 'PN': |
|||
// Páginas novas |
|||
api = api.getElementsByTagName("rc"); |
|||
for (i = 0; i < api.length && i < 10; i++) { |
|||
if (!api[i]){ |
|||
continue; |
|||
} |
|||
title = api[i].getAttribute("title"); |
|||
charnum += title.length; |
|||
if (charnum > 180) { |
|||
break; |
|||
} |
|||
length = "+" + api[i].getAttribute("newlen"); |
|||
comment = api[i].getAttribute("comment"); |
|||
if (comment) { |
|||
comment = "(" + comment.replace("[[Ajuda:SEA|?]] ", "") + ")"; |
|||
} |
|||
if ( i > 0){ |
|||
pages += ' | '; |
|||
} |
|||
pages += "<a href=\"" + mw.util.wikiGetlink( title ) |
|||
+ "?redirect=no&rcid=" + api[i].getAttribute("rcid") |
|||
+ "\" title=\"(" + length + ") " + |
|||
api[i].getAttribute("user") + " " + comment |
|||
+ "\">" + title + "</a>"; |
|||
} |
} |
||
comment = item.comment || ''; |
|||
this.submenu.innerHTML = pages; |
|||
for ( j=0; j < summaryChanges[ code ].length; j++ ){ |
|||
break; |
|||
comment = comment.replace( |
|||
case 'MR': |
|||
summaryChanges[ code ][0], |
|||
// Mudanças recentes |
|||
summaryChanges[ code ][1] |
|||
api = api.getElementsByTagName("rc"); |
|||
); |
|||
for (i = 0; i < api.length && i < 10; i++) { |
|||
if (!api[i]){ |
|||
continue; |
|||
} |
|||
title = api[i].getAttribute("title"); |
|||
charnum += title.length; |
|||
if (charnum > 180) { |
|||
break; |
|||
} |
|||
length = (api[i].getAttribute("newlen") |
|||
- api[i].getAttribute("oldlen")); |
|||
if (length > 0) { |
|||
length = "+" + length; |
|||
} |
|||
comment = api[i].getAttribute("comment").replace("/*", "?"); |
|||
if (comment) { |
|||
comment = "(" + comment.replace("*/", ":") + ")"; |
|||
} |
|||
if ( i > 0){ |
|||
pages += ' | '; |
|||
} |
|||
pages += "<a href=\"" + mw.util.wikiGetlink( title ) |
|||
+ "?diff=last\" title=\"(" + length + ") " |
|||
+ api[i].getAttribute("user") + " " |
|||
+ comment + "\">" + title + "</a>"; |
|||
} |
} |
||
if (comment) { |
|||
this.submenu.innerHTML = pages; |
|||
comment = '(' + comment + ')'; |
|||
break; |
|||
} |
|||
case 'usu': |
|||
if ( code === 'PN' ){ |
|||
// Informações do(a) usuário(a) |
|||
urlParam[ code ] += item.rcid; |
|||
api = api.getElementsByTagName("u"); |
|||
if ( api && api.length ) { |
|||
var regDate = api[0].getAttribute("registration"); |
|||
regDate = regDate.substr(8, 2) + "/" + regDate.substr(5, 2) + |
|||
"/" + regDate.substr(0, 4); |
|||
user = mw.config.get('wgTitle'); |
|||
if (user.indexOf("/") > -1) { |
|||
user = user.substring(0, user.indexOf("/")); |
|||
} |
|||
var encUser = encodeURI(user); |
|||
this.submenu.innerHTML = |
|||
"<span style=\"color:black\">" + |
|||
api[0].getAttribute("editcount") + |
|||
"</span> edições desde <span style=\"color:black\">" + |
|||
regDate + "</span> | <a href=\"" + |
|||
mw.util.wikiGetlink( 'Especial:Contribuições/' ) + |
|||
encUser + |
|||
"\">contribuições</a> | <a href=\"" + |
|||
mw.util.wikiGetlink( 'Especial:Registo/' ) + |
|||
encUser + |
|||
"\">registros</a> | <a href=\"" + |
|||
mw.util.wikiGetlink( 'Especial:Registo' ) + |
|||
"?type=block&page=Usu%C3%A1rio%3A" + |
|||
encUser + |
|||
"\">registros de bloqueio</a> | <span class=\"plainlinks\">" + |
|||
"<a href=\"http://toolserver.org/~river/cgi-bin/count_edits?user=" + |
|||
encUser + |
|||
"&dbname=ptwiki_p\" class=\"external text\">contador de edições</a></span>"; |
|||
} else { |
|||
return; |
|||
} |
} |
||
pages.push( |
|||
'<a href="' + mw.util.wikiGetlink( title ) + '?' + |
|||
urlParam[ code ] + '" title="(' + length + ') ' + item.user + |
|||
' ' + comment + '">' + title + '</a>' |
|||
); |
|||
} |
} |
||
this.$submenu.html( pages.join( ' | ' ) ); |
|||
break; |
|||
case 'usu': |
|||
// Informações do(a) usuário(a) |
|||
if ( !query ) { |
|||
mw.log( 'The categories query returned no data.' ); |
|||
return false; |
|||
} |
|||
user = query.allusers && query.allusers[0] && query.allusers[0]; |
|||
if ( user ) { |
|||
// Ex.: YYYY-MM-DDThh:mm:ssZ |
|||
var regDate = user.registration; |
|||
regDate = regDate.substr(8, 2) + '/' + regDate.substr(5, 2) + |
|||
'/' + regDate.substr(0, 4); |
|||
user = mw.config.get('wgTitle'); |
|||
if (user.indexOf("/") > -1) { |
|||
user = user.substring(0, user.indexOf("/")); |
|||
} |
|||
var encUser = encodeURI(user); |
|||
this.$submenu.html( [ |
|||
'<span style="color:black">' + user.editcount + |
|||
'</span> edições desde <span style="color:black">' + regDate + '</span>', |
|||
'<a href="' + mw.util.wikiGetlink( 'Especial:Contribuições/' ) + |
|||
encUser + '">contribuições</a>', |
|||
'<a href="' + mw.util.wikiGetlink( 'Especial:Registo/' ) + |
|||
encUser + '">registros</a>', |
|||
'<a href="' + mw.util.wikiGetlink( 'Especial:Registo' ) + |
|||
'?type=block&page=Usu%C3%A1rio%3A' + encUser + '">registros de bloqueio</a>', |
|||
'<span class="plainlinks"><a href="http://toolserver.org/~river/cgi-bin/count_edits?user=' + |
|||
encUser + '&dbname=ptwiki_p" class="external text">contador de edições</a></span>' |
|||
].join( ' | ' ) |
|||
); |
|||
} else { |
|||
return; |
|||
} |
|||
break; |
|||
} |
} |
||
}; |
}; |
||
Linha 710: | Linha 711: | ||
/* Initialize the gadget */ |
/* Initialize the gadget */ |
||
fb.init = function () { |
fb.init = function () { |
||
var inUserNS, contentSub = |
var inUserNS, $contentSub = $( '#contentSub' ), |
||
param = mw.util.getParamValue('fastb'); |
param = mw.util.getParamValue('fastb'); |
||
fb.$menu.attr( 'id', fb.prefix + 'menu' ); |
|||
fb.$submenu.attr( 'id', fb.prefix + 'submenu' ); |
|||
if ($.inArray(mw.config.get('wgAction'), ["view", "edit"]) !== -1) { |
if ($.inArray(mw.config.get('wgAction'), ["view", "edit"]) !== -1) { |
||
fb.submenu. |
fb.$submenu.html( '' ); |
||
/*** Menu Principal ***/ |
|||
if (mw.config.get('wgNamespaceNumber') > -1) { |
if (mw.config.get('wgNamespaceNumber') > -1) { |
||
inUserNS = $.inArray(mw.config.get('wgNamespaceNumber'), [2, 3]) > -1 |
inUserNS = $.inArray(mw.config.get('wgNamespaceNumber'), [2, 3]) > -1 |
||
&& mw.config.get('wgTitle').indexOf(mw.config.get('wgUserName')) === 0; |
&& mw.config.get('wgTitle').indexOf(mw.config.get('wgUserName')) === 0; |
||
if (inUserNS) { |
if (inUserNS) { |
||
fb.menu. |
fb.$menu.html( "[" + |
||
fb.link("ER|1", "ER1", "Eliminar subpágina do próprio usuário") + |
fb.link("ER|1", "ER1", "Eliminar subpágina do próprio usuário") + |
||
"]"; |
"]" ); |
||
} else { |
} else { |
||
fb.menu. |
fb.$menu.html( "[<a onMouseOver='this.style.cursor=\"default\"'" + |
||
" onClick='fb. |
" onClick='fb.$submenu.html(fb.submenu.ER)'>ER</a>]" ); |
||
} |
} |
||
} |
} |
||
if ($.inArray(mw.config.get('wgNamespaceNumber'), [0, 102]) !== -1) { |
if ($.inArray(mw.config.get('wgNamespaceNumber'), [0, 102]) !== -1) { |
||
fb.$menu.html( |
|||
fb.menu.innerHTML += " [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
fb.$menu.html() + [ |
|||
" onClick='fb.open(fb.ESR)'>ESR</a>] [" + |
|||
' [<a onMouseOver="this.style.cursor=\'default\'"' + |
|||
fb.link("subst:apagar", "PE", |
|||
' onClick="fb.$submenu.html(fb.submenu.ESR)">ESR</a>', |
|||
"Marcar para eliminação por votação") + |
|||
fb.link( 'subst:apagar', 'PE', |
|||
"] [<a onMouseOver='this.style.cursor=\"pointer\"'" + |
|||
'Marcar para eliminação por votação'), |
|||
" title='Cópia/Violação de direito autoral'" + |
|||
'<a onMouseOver="this.style.cursor=\'pointer\'"' + |
|||
" onClick='obs=prompt(\"Informe o url da página copiada\"," + |
|||
' title="Cópia/Violação de direito autoral"' + |
|||
" \"http://\");fb.run(\"subst:VDA\",obs)'>VDA</a>] [" + |
|||
' onClick="obs=prompt(\'Informe o url da página copiada\',' + |
|||
fb.link("subst:suspeito", "susp", |
|||
' \'http://\');fb.run(\'subst:VDA\',obs)">VDA</a>', |
|||
"Suspeito de violação de direitos autorais") + |
|||
fb.link( 'subst:suspeito', 'susp', |
|||
'Suspeito de violação de direitos autorais'), |
|||
"Tradução de baixa qualidade", |
|||
fb.link( 'subst:matrad', 'trad', |
|||
"De qual língua a página foi maltraduzida (ca, de, en, es," + |
|||
'Tradução de baixa qualidade', |
|||
" fr, it, ja, nl, no, pl, ru, sv, zh)?") + |
|||
'De qual língua a página foi maltraduzida (ca, de, en, es,' + |
|||
"] [" + fb.link("redirect", "#R", "Redirecionar", |
|||
' fr, it, ja, nl, no, pl, ru, sv, zh)?' ), |
|||
"Redirecionar para qual página?") + |
|||
fb.link( 'redirect', '#R', 'Redirecionar', |
|||
"] [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
'Redirecionar para qual página?'), |
|||
" onClick='fb.open(fb.man)'>manutenção</a>]" + |
|||
'<a onMouseOver="this.style.cursor=\'default\'"' + |
|||
' onClick="fb.$submenu.html(fb.submenu.man)">manutenção</a>', |
|||
'<a onMouseOver="this.style.cursor=\'default\'"' + |
|||
' onClick="fb.$submenu.html(fb.submenu.esb)">esboço</a>', |
|||
'<a onMouseOver="this.style.cursor=\'default\'"' + |
|||
if (mw.config.get('wgAction') === "view") { |
|||
' onClick="fb.$submenu.html(fb.submenu.search)">busca</a>]' |
|||
fb.api("afl"); |
|||
].join( '] [' ) |
|||
); |
|||
if (mw.config.get('wgAction') === 'view') { |
|||
fb.callAPI('afl'); |
|||
} |
} |
||
} else { |
} else { |
||
if ($.inArray(mw.config.get('wgNamespaceNumber'), [2, 10]) !== -1) { |
if ($.inArray(mw.config.get('wgNamespaceNumber'), [2, 10]) !== -1) { |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + " [" + fb.link("subst:apagar", "PE", |
|||
"Marcar para eliminação por votação") + "]" |
"Marcar para eliminação por votação") + "]" |
||
); |
|||
} |
} |
||
if (mw.config.get('wgNamespaceNumber') % 2 === 0) { |
if (mw.config.get('wgNamespaceNumber') % 2 === 0) { |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + " [" + fb.link("redirect", "#R", "Redirecionar", |
|||
"Redirecionar para qual página?") + "]" |
"Redirecionar para qual página?") + "]" |
||
); |
|||
} |
} |
||
if (mw.config.get('wgNamespaceNumber') === 14) { |
if (mw.config.get('wgNamespaceNumber') === 14) { |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + " [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
" onClick='fb. |
" onClick='fb.$submenu.html(fb.submenu.cat)'>CatScan</a>]" |
||
); |
|||
} |
} |
||
} |
} |
||
if (mw.config.get('wgNamespaceNumber') === 3) { |
if (mw.config.get('wgNamespaceNumber') === 3) { |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + " [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
" onClick='fb.$submenu.html(fb.submenu.warn)'>aviso</a>]" |
|||
); |
|||
} |
} |
||
if ($.inArray(mw.config.get('wgNamespaceNumber'), [2, 3]) !== -1) { |
if ($.inArray(mw.config.get('wgNamespaceNumber'), [2, 3]) !== -1) { |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + " [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
" onClick='fb.callAPI(\"usu\")'>sobre a conta</a>]" |
|||
); |
|||
} |
} |
||
} |
} |
||
fb.menu. |
fb.$menu.html( |
||
fb.$menu.html() + [ |
|||
" [<a onMouseOver='this.style.cursor=\"default\"'" + |
|||
" title=\"Páginas vigiadas\" onClick='fb. |
" title=\"Páginas vigiadas\" onClick='fb.callAPI(\"PV\")'>PV</a>", |
||
" |
"<a onMouseOver='this.style.cursor=\"default\"'" + |
||
" title=\"Páginas novas não patrulhadas\"" + |
" title=\"Páginas novas não patrulhadas\"" + |
||
" onClick='fb. |
" onClick='fb.callAPI(\"PN\")'>PN</a>", |
||
" |
"<a onMouseOver='this.style.cursor=\"default\"'" + |
||
" title=\"Mudanças recentes (IPs, domínio principal)\"" + |
" title=\"Mudanças recentes (IPs, domínio principal)\"" + |
||
" onClick='fb. |
" onClick='fb.callAPI(\"MR\")'>MR</a>]" |
||
].join( '] [' ) |
|||
); |
|||
$contentSub.append( fb.$menu ).append( fb.$submenu ); |
|||
switch (mw.config.get('wgAction')) { |
switch (mw.config.get('wgAction')) { |
||
case 'edit': |
case 'edit': |