Mudanças entre as edições de "MediaWiki:Common.js"
Ir para navegação
Ir para pesquisar
Linha 23: | Linha 23: | ||
ta['ca-watch'] = new Array('w','Adicionar esta página aos artigos vigiados por você'); |
ta['ca-watch'] = new Array('w','Adicionar esta página aos artigos vigiados por você'); |
||
ta['ca-unwatch'] = new Array('w','Remover esta página dos artigos vigiados por você'); |
ta['ca-unwatch'] = new Array('w','Remover esta página dos artigos vigiados por você'); |
||
− | ta |
+ | ta.search = new Array('f','Pesquisar na Desciclopédia'); |
ta['p-logo'] = new Array('','Página principal'); |
ta['p-logo'] = new Array('','Página principal'); |
||
ta['n-mainpage'] = new Array('z','Visitar a página principal'); |
ta['n-mainpage'] = new Array('z','Visitar a página principal'); |
||
Linha 52: | Linha 52: | ||
ta['ca-nstab-forum'] = new Array('c','Ver a página do fórum'); |
ta['ca-nstab-forum'] = new Array('c','Ver a página do fórum'); |
||
+ | /* Definição das variáveis visando conformizar o código já existente com o |
||
− | //skin = { |
||
+ | * guia de Migração de versões disponibilizada pelo MediaWIki. Ver mais em: |
||
− | // "Namespace:Main Page": "", |
||
+ | * - https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#HTML_bugs_in_core |
||
− | // "User:Guest/Web 2.0": "Fullscreen.css" |
||
+ | */ |
||
− | //} |
||
− | |||
− | // Definição das variáveis conforme guia de Migração de versões disponibilizada |
||
− | // pelo MediaWIki |
||
− | // Ver: https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#HTML_bugs_in_core |
||
var skinName = mw.config.get("skin"); |
var skinName = mw.config.get("skin"); |
||
+ | var mwArticleId = mw.config.get("wgArticleId"); |
||
var mwAction = mw.config.get("wgAction"); |
var mwAction = mw.config.get("wgAction"); |
||
var mwUserName = mw.config.get("wgUserName"); |
var mwUserName = mw.config.get("wgUserName"); |
||
var mwPageName = mw.config.get("wgPageName"); |
var mwPageName = mw.config.get("wgPageName"); |
||
− | |||
− | //var re = RegExp("(.*) - Desciclopédia"); |
||
− | //var matches = re.exec(document.title); |
||
+ | // Desnecessário, como o próprio sumário da [[MediaWiki:Skin|pagina referenciada já diz]]... |
||
− | //if (matches) { |
||
+ | //document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>'); |
||
− | // if (skin[matches[1]] != undefined) { |
||
− | // skinName = (skin[matches[1]].length > 0) ? skin[matches[1]] : matches[1] + '.css'; |
||
− | // document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>'); |
||
− | // } |
||
− | //} |
||
− | document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>'); |
||
// inserts user name into <span class="insertusername"></span> |
// inserts user name into <span class="insertusername"></span> |
||
function UserNameReplace() { |
function UserNameReplace() { |
||
− | for(var i=0; |
+ | for(var i=0; i <= document.getElementsByTagName("span").length; i++) { |
+ | UserName = document.getElementsByTagName("span")[i]; |
||
+ | let ViewerName = null; |
||
if (mwUserName&&(UserName.getAttribute('class') === "insertusername")) { |
if (mwUserName&&(UserName.getAttribute('class') === "insertusername")) { |
||
− | + | ViewerName = mwUserName; |
|
UserName.innerHTML = ViewerName; |
UserName.innerHTML = ViewerName; |
||
} |
} |
||
if (mwUserName&&(UserName.getAttribute('class') == "insertusername2")) { |
if (mwUserName&&(UserName.getAttribute('class') == "insertusername2")) { |
||
− | + | ViewerName = '<a href="'+location.protocol+'//'+location.hostname+'/wiki/Usuário:'+mwUserName+'" title="Usuário:'+mwUserName+'">'+mwUserName+'</a>'; |
|
UserName.innerHTML = ViewerName; |
UserName.innerHTML = ViewerName; |
||
} |
} |
||
Linha 90: | Linha 81: | ||
} |
} |
||
$(UserNameReplace); |
$(UserNameReplace); |
||
+ | |||
− | |||
− | //============================================================ |
||
− | // Fonctions de gestion |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * Installation d'une nouvelle fonction de cette façon: |
||
− | * aOnloadFunctions[aOnloadFunctions.length] = nom_de_la_fonction; // (sans parenthèses) |
||
− | */ |
||
− | /*if (!window.aOnloadFunctions) { |
||
− | var aOnloadFunctions = new Array(); |
||
− | } |
||
− | |||
− | window.onload = function() |
||
− | { |
||
− | if (window.aOnloadFunctions) { |
||
− | for (var _i=0; _i<aOnloadFunctions.length; _i++) { |
||
− | aOnloadFunctions[_i](); |
||
− | } |
||
− | } |
||
− | }*/ |
||
− | |||
/** |
/** |
||
+ | * Carrega uma função para executar no carregar de uma página. |
||
− | * Ajouter une nouvelle fonction a excuter au chargement de la page. |
||
+ | * Código originalmente criado por uma Wiki francófona ou algo assim. |
||
+ | * Comentado em português para melhorar a leitura do código por não-conhecedores |
||
+ | * daquele idioma e pessoas menos afeitas a linguagem de script. |
||
*/ |
*/ |
||
function addLoadEvent(func) { |
function addLoadEvent(func) { |
||
− | if (window.addEventListener) |
+ | if (window.addEventListener) |
− | window.addEventListener("load", func, false); |
+ | window.addEventListener("load", func, false); |
− | else if (window.attachEvent) |
+ | else if (window.attachEvent) |
− | window.attachEvent("onload", func); |
+ | window.attachEvent("onload", func); |
} |
} |
||
Linha 128: | Linha 101: | ||
* Ver: https://en.wikipedia.org/wiki/Wikipedia:NavFrame |
* Ver: https://en.wikipedia.org/wiki/Wikipedia:NavFrame |
||
*/ |
*/ |
||
− | |||
− | // ============================================================ |
||
− | // BEGIN Dynamic Navigation Bars |
||
// set up the words in your language |
// set up the words in your language |
||
Linha 158: | Linha 128: | ||
if (NavToggle.firstChild.data == NavigationBarHide) { |
if (NavToggle.firstChild.data == NavigationBarHide) { |
||
for ( |
for ( |
||
− | + | let NavChild = NavFrame.firstChild; |
|
NavChild !== null; |
NavChild !== null; |
||
NavChild = NavChild.nextSibling |
NavChild = NavChild.nextSibling |
||
Linha 175: | Linha 145: | ||
// if hidden now |
// if hidden now |
||
} else if (NavToggle.firstChild.data == NavigationBarShow) { |
} else if (NavToggle.firstChild.data == NavigationBarShow) { |
||
− | for ( |
+ | for (let NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling) { |
if (NavChild.className === 'NavPic') { |
if (NavChild.className === 'NavPic') { |
||
NavChild.style.display = 'block'; |
NavChild.style.display = 'block'; |
||
Linha 193: | Linha 163: | ||
var indexNavigationBar = 0; |
var indexNavigationBar = 0; |
||
// iterate over all <div>-elements |
// iterate over all <div>-elements |
||
+ | for(var i=0; i <= document.getElementsByTagName("div").length; i++) { |
||
− | for( |
||
+ | NavFrame = document.getElementsByTagName("div")[i]; |
||
− | var i=0; |
||
− | NavFrame = document.getElementsByTagName("div")[i]; |
||
− | i++ |
||
− | ) { |
||
// if found a navigation bar |
// if found a navigation bar |
||
if (NavFrame.className === "NavFrame") { |
if (NavFrame.className === "NavFrame") { |
||
+ | indexNavigationBar += 1; |
||
− | |||
− | indexNavigationBar++; |
||
var NavToggle = document.createElement("a"); |
var NavToggle = document.createElement("a"); |
||
NavToggle.className = 'NavToggle'; |
NavToggle.className = 'NavToggle'; |
||
Linha 221: | Linha 187: | ||
// if more Navigation Bars found than Default: hide all |
// if more Navigation Bars found than Default: hide all |
||
if (NavigationBarShowDefault < indexNavigationBar) { |
if (NavigationBarShowDefault < indexNavigationBar) { |
||
− | for( |
+ | for(var i=1; i<=indexNavigationBar; i++) { |
− | var i=1; |
||
− | i<=indexNavigationBar; |
||
− | i++ |
||
− | ) { |
||
toggleNavigationBar(i); |
toggleNavigationBar(i); |
||
} |
} |
||
Linha 237: | Linha 199: | ||
// END Dynamic Navigation Bars |
// END Dynamic Navigation Bars |
||
// ============================================================ |
// ============================================================ |
||
− | |||
− | //============================================================ |
||
− | // |
||
− | // Caractères spéciaux |
||
− | // |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * Ajoutez le menu pour choisir des sous-ensembles de caractères spéciaux |
||
− | * @note L'ordre de cette liste doit correspondre a celui de MediaWiki:Edittools ! |
||
− | */ |
||
− | /*function addCharSubsetMenu() { |
||
− | var specialchars = document.getElementById('specialchars'); |
||
− | |||
− | if (specialchars) { |
||
− | var menu = "<select style=\"display:inline\" onChange=\"chooseCharSubset(selectedIndex)\">"; |
||
− | menu += "<option>Wiki</option>"; |
||
− | menu += "<option>Mathématiques</option>"; |
||
− | menu += "<option>API</option>"; |
||
− | menu += "<option>Latin/Romain</option>"; |
||
− | menu += "<option>Grec</option>"; |
||
− | menu += "<option>Cyrillique</option>"; |
||
− | menu += "<option>AHD</option>"; |
||
− | menu += "<option>Allemand</option>"; |
||
− | menu += "<option>Arabe</option>"; |
||
− | menu += "<option>Catalan</option>"; |
||
− | menu += "<option>Croate</option>"; |
||
− | menu += "<option>Espagnol</option>"; |
||
− | menu += "<option>Espéranto</option>"; |
||
− | menu += "<option>Estonien</option>"; |
||
− | menu += "<option>Gallois</option>"; |
||
− | menu += "<option>Hawaien</option>"; |
||
− | menu += "<option>Hébreu</option>"; |
||
− | menu += "<option>Hiéroglyphe</option>"; |
||
− | menu += "<option>Hollandais</option>"; |
||
− | menu += "<option>Hongrois</option>"; |
||
− | menu += "<option>Indo-européen</option>"; |
||
− | menu += "<option>Irlandais</option>"; |
||
− | menu += "<option>Islandais</option>"; |
||
− | menu += "<option>Italien</option>"; |
||
− | menu += "<option>Letton</option>"; |
||
− | menu += "<option>Lituanien</option>"; |
||
− | menu += "<option>Maltais</option>"; |
||
− | menu += "<option>Navajo & Apache</option>"; |
||
− | menu += "<option>Pinyin</option>"; |
||
− | menu += "<option>Polonais</option>"; |
||
− | menu += "<option>Portugais</option>"; |
||
− | menu += "<option>Rōmaji</option>"; |
||
− | menu += "<option>Roumain</option>"; |
||
− | menu += "<option>Scandinave</option>"; |
||
− | menu += "<option>Serbe</option>"; |
||
− | menu += "<option>Tchèque</option>"; |
||
− | menu += "<option>Turc</option>"; |
||
− | menu += "<option>Vieil anglais</option>"; |
||
− | menu += "<option>Vietnamien</option>"; |
||
− | menu += "<option>Yiddish</option>"; |
||
− | menu += "</select>"; |
||
− | specialchars.innerHTML = menu + specialchars.innerHTML; |
||
− | */ |
||
− | /* default subset - try to use a cookie some day */ |
||
− | // chooseCharSubset(0); |
||
− | // } |
||
− | //} |
||
− | |||
− | /* select subsection of special characters */ |
||
− | /*function chooseCharSubset(s) { |
||
− | var l = document.getElementById('specialchars').getElementsByTagName('p'); |
||
− | for (var i = 0; i < l.length ; i++) { |
||
− | l[i].style.display = i == s ? 'inline' : 'none'; |
||
− | l[i].style.visibility = i == s ? 'visible' : 'hidden'; |
||
− | } |
||
− | } |
||
− | |||
− | addLoadEvent(addCharSubsetMenu);*/ |
||
− | |||
− | //============================================================ |
||
− | // |
||
− | // Choix de l'affichage des références |
||
− | // |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * Choix du mode d'affichage des références. |
||
− | * @note L'ordre de cette liste doit correspondre a celui de Modèle:Édition ! |
||
− | */ |
||
− | /*function addBibSubsetMenu() |
||
− | { |
||
− | var specialBib = document.getElementById('specialBib'); |
||
− | |||
− | if (specialBib) |
||
− | { |
||
− | specialBib.style.display = 'block'; |
||
− | var menu = "<select style=\"display:inline;\" onChange=\"chooseBibSubset(selectedIndex)\">"; |
||
− | menu += "<option>Liste</option>"; |
||
− | menu += "<option>WikiNorme</option>"; |
||
− | menu += "<option>BibTeX</option>"; |
||
− | menu += "<option>ISBD</option>"; |
||
− | menu += "<option>ISO690</option>"; |
||
− | menu += "</select>"; |
||
− | specialBib.innerHTML = specialBib.innerHTML + menu; |
||
− | }*/ |
||
− | ///* default subset - try to use a cookie some day */ |
||
− | /*chooseBibSubset(0); |
||
− | }*/ |
||
− | |||
− | /* select subsection of special characters */ |
||
− | /*function chooseBibSubset(s) |
||
− | { |
||
− | var l = document.getElementsByTagName('div'); |
||
− | for (var i = 0; i < l.length ; i++) |
||
− | { |
||
− | if(l[i].className == 'BibList') l[i].style.display = s == 0 ? 'block' : 'none'; |
||
− | else if(l[i].className == 'WikiNorme') l[i].style.display = s == 1 ? 'block' : 'none'; |
||
− | else if(l[i].className == 'BibTeX') l[i].style.display = s == 2 ? 'block' : 'none'; |
||
− | else if(l[i].className == 'ISBD') l[i].style.display = s == 3 ? 'block' : 'none'; |
||
− | else if(l[i].className == 'ISO690') l[i].style.display = s == 4 ? 'block' : 'none'; |
||
− | } |
||
− | } |
||
− | |||
− | addLoadEvent(addBibSubsetMenu);*/ |
||
− | |||
− | |||
− | |||
− | //============================================================ |
||
− | // |
||
− | // Prévisualisation rapide |
||
− | // |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * Script de ajoutant une option de prévisualisation rapide. |
||
− | * |
||
− | * |
||
− | * English: Add a Quick View option on the Edit pages. |
||
− | * This script add 2 new buttons into the "editButtons" div. |
||
− | * When QuickPrev button is press, the content of edit window |
||
− | * is retreived and parsed using regular expressions. |
||
− | * |
||
− | * @author: fr:user:aoineko |
||
− | * @version: 0.2 |
||
− | */ |
||
− | /*function addQuickPreview() |
||
− | { |
||
− | var QuickPreviewBtnTitle = "Mostrar/Atualizar Pre-Visualização Rápida [Alt + Q]"; |
||
− | var QuickPreviewBtnValue = "Mostrar/Atualizar Pre-Visualização Rápida"; |
||
− | var QuickPrevHideBtnTitle = "Esconder Visualização Rápida [Alt + H]"; |
||
− | var QuickPrevHideBtnValue = "Fechar"; |
||
− | |||
− | var div = document.getElementsByTagName('div'); |
||
− | for(var i = 0; i < div.length ; i++) |
||
− | { |
||
− | if(div[i].className == "editButtons") // search "editButtons" div |
||
− | { |
||
− | div[i].appendChild(document.createElement("br")); // add a <br/> |
||
− | |||
− | var wpQuick = document.createElement("input"); // create and set the "QuickPrev" button |
||
− | wpQuick.setAttribute("id", "wpQuick"); |
||
− | wpQuick.setAttribute("name", "wpQuick"); |
||
− | wpQuick.setAttribute("title", QuickPreviewBtnTitle); |
||
− | wpQuick.setAttribute("value", QuickPreviewBtnValue); |
||
− | wpQuick.setAttribute("type", "button"); |
||
− | wpQuick.setAttribute("onclick", "doQuickPreview();"); |
||
− | wpQuick.setAttribute("tabindex", "8"); |
||
− | wpQuick.setAttribute("accesskey", "Q"); |
||
− | div[i].appendChild(wpQuick); |
||
− | |||
− | var wpHide = document.createElement("input"); // create and set the "Hide" button |
||
− | wpHide.setAttribute("id", "wpHide"); |
||
− | wpHide.setAttribute("name", "wpHide"); |
||
− | wpHide.setAttribute("title", QuickPrevHideBtnTitle); |
||
− | wpHide.setAttribute("value", QuickPrevHideBtnValue); |
||
− | wpHide.setAttribute("type", "button"); |
||
− | wpHide.setAttribute("onclick", "hideQuickPreview();"); |
||
− | wpHide.setAttribute("tabindex", "9"); |
||
− | wpHide.setAttribute("accesskey", "H"); |
||
− | div[i].appendChild(wpHide); |
||
− | } |
||
− | } |
||
− | }*/ |
||
− | |||
− | /// Retreive current code and parse it |
||
− | //function doQuickPreview() |
||
− | //{ |
||
− | // var wpQuickPreview = document.getElementById("wpQuickPreview"); |
||
− | // if(!wpQuickPreview) |
||
− | // { |
||
− | /*var l = document.getElementsByTagName('div'); |
||
− | for(var i = 0; i < l.length ; i++) |
||
− | if(l[i].className == "previewnote") |
||
− | wpQuickPreview = l; |
||
− | |||
− | if(!wpQuickPreview)*/ |
||
− | // { |
||
− | // wpQuickPreview = document.createElement("div"); |
||
− | // wpQuickPreview.setAttribute("style", "border:solid 1px gray; width:100%; margin-top:1em; margin-bottom:1em; padding:0.5em;"); |
||
− | // var wpSummaryLabel = document.getElementById("wpSummaryLabel"); |
||
− | // wpSummaryLabel.parentNode.insertBefore(wpQuickPreview, wpSummaryLabel); |
||
− | // } |
||
− | // wpQuickPreview.setAttribute("id", "wpQuickPreview"); |
||
− | // } |
||
− | // wpQuickPreview.style.display = "block"; |
||
− | |||
− | // wpTextbox1 = document.getElementById("wpTextbox1"); |
||
− | // var str = "=Prévisualisation rapide=\n" + wpTextbox1.value; |
||
− | // var qp = new QuickPreview(str); |
||
− | // wpQuickPreview.innerHTML = qp.Parse(); |
||
− | //} |
||
− | |||
− | //function QuickPreview(wiki) |
||
− | //{ |
||
− | // this.line = wiki.split(/\n/); |
||
− | // this.html = new String; |
||
− | |||
− | // this.list = 0; // current list depth |
||
− | // this.tab = 0; // current tabulation depth |
||
− | // this.pre = false; /// inside a <pre> tag |
||
− | // this.para = false; /// inside a paragraph |
||
− | |||
− | // this.HandlePre = function(i) |
||
− | /* { |
||
− | if(this.line[i][0] == ' ') |
||
− | { |
||
− | if(this.para) |
||
− | { |
||
− | this.para = false; |
||
− | this.html += "</p>\n"; |
||
− | } |
||
− | if(!this.pre) |
||
− | { |
||
− | this.pre = true; |
||
− | this.html += "<pre>\n"; |
||
− | } |
||
− | this.html += this.line[i] + "\n"; |
||
− | return true; |
||
− | } |
||
− | else if(this.pre) |
||
− | { |
||
− | this.pre = false; |
||
− | this.html += "</pre>\n"; |
||
− | } |
||
− | return false; |
||
− | }; |
||
− | |||
− | this.HandleH = function(i) |
||
− | { |
||
− | if(res = this.line[i].match(/^(={1,6})(.*)\1(.*)$/)) |
||
− | { |
||
− | this.line[i] = "<h" + res[1].length + ">" + res[2] + "</h" + res[1].length + ">" + res[3]; |
||
− | return true; |
||
− | } |
||
− | return false; |
||
− | }; |
||
− | |||
− | this.Parse = function() |
||
− | { |
||
− | this.html = ""; |
||
− | |||
− | for(var i = 0; i < this.line.length ; i++) |
||
− | { |
||
− | var p = true; |
||
− | |||
− | if(this.HandlePre(i)) |
||
− | continue; |
||
− | |||
− | if(this.HandleH(i)) |
||
− | p = false; |
||
− | |||
− | if(p && !this.para) |
||
− | { |
||
− | this.para = true; |
||
− | this.html += "<p>"; |
||
− | } |
||
− | |||
− | this.html += this.line[i] |
||
− | |||
− | // Sign // |
||
− | .replace(/~{5}/g, Date()) |
||
− | .replace(/~{4}/g, "<span style='padding:0.2em; margin:0.5em; border:dashed 1px yellow;'>Signature</span> "+Date()) |
||
− | .replace(/~{3}/g, "<span style='padding:0.2em; margin:0.5em; border:dashed 1px yellow;'>Signature</span>") |
||
− | |||
− | // Style // |
||
− | .replace(/'''''(.*?)''(.*?)'''/g, "<strong><em>$1</em>$2</strong>") |
||
− | .replace(/'''''(.*?)'''(.*?)''/g, "<em><strong>$1</strong>$2</em>") |
||
− | .replace(/'''(.*?)''(.*?)'''''/g, "<strong>$1<em>$2</em></strong>") |
||
− | .replace(/'''''(.*?)''''/g, "<strong><em>\'$1</em></strong>") |
||
− | .replace(/''''(.*?)''''/g, "<strong><em>$1</em></strong>") |
||
− | .replace(/''''(.*?)'''/g, "<strong>\'$1</strong>") |
||
− | .replace(/'''(.*?)'''/g, "<strong>$1</strong>") |
||
− | .replace(/'''(.*?)''/g, "<em>\'$1</em>") |
||
− | .replace(/''(.*?)''/g, "<em>$1</em>") |
||
− | |||
− | // List // |
||
− | .replace(/^\*(.*)/g, "<li>$1</li>") |
||
− | .replace(/^#(.*)/g, "<li>$1</li>") |
||
− | .replace(/^:(.*)/g, "<li>$1</li>") |
||
− | |||
− | // Link // |
||
− | .replace(/\{\{([^\|]*).*}}/g, "<span style='padding:0.2em; margin:0.5em; border:dashed 1px lightgreen;'>Modèle : $1</span>") |
||
− | .replace(/\[\[[Ii]mage:([^\|]*)[^\[]*\]\]/g, "<span style='padding:0.2em; margin:0.5em; border:dashed 1px lightblue;'>Image : $1</span>") |
||
− | .replace(/\[\[[Cc]atégorie:([^\|]*)[^\[]*\]\]/g, "<span style='padding:0.2em; margin:0.5em; border:dashed 1px #FF8080;'><a href='/wiki/Catégorie:$1' title='$1'>Catégorie : $1</a></span>") |
||
− | .replace(/\[\[([^\[.]*)\|([^\[.]*)\]\]/g, "<a href='/wiki/$1' title='$1'>$2</a>") |
||
− | .replace(/\[\[([^\[.]*)\]\]/g, "<a href='/wiki/$1' title='$1'>$1</a>")*/ |
||
− | /* |
||
− | // Special // |
||
− | .replace(/\n\n/g, "\n\n<br/>") |
||
− | .replace(/(^|\n)-{4}(?!~)/g, "<hr/>") |
||
− | |||
− | // Table // |
||
− | .replace(/(^|\n)\{\|(.*)/g, "$1<table $2>") |
||
− | .replace(/(^|\n)\|}/g, "$1</table>") |
||
− | .replace(/(^|\n)(\|.*)\|\|/g, "$1$2</td><td>") |
||
− | .replace(/(^|\n)\|[^-}](.*)/g, "$1</td>$2<td>") |
||
− | .replace(/(^|\n)(!.*)!!/g, "$1$2</th><th>") |
||
− | .replace(/(^|\n)/g, "$1</th>$2<th>") |
||
− | */ |
||
− | /* ; |
||
− | this.html += "\n"; |
||
− | } |
||
− | |||
− | return this.html; |
||
− | }; |
||
− | }; |
||
− | |||
− | /// Hide |
||
− | function hideQuickPreview() |
||
− | { |
||
− | var wpQuickPreview = document.getElementById("wpQuickPreview"); |
||
− | if(wpQuickPreview) |
||
− | { |
||
− | wpQuickPreview.style.display = 'none'; |
||
− | } |
||
− | } |
||
− | |||
− | addLoadEvent(addQuickPreview);*/ |
||
− | |||
− | //============================================================ |
||
− | // |
||
− | // Barre d'outil |
||
− | // |
||
− | //============================================================ |
||
− | |||
− | //============================================================ |
||
− | // Générateur de tableaux |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * |
||
− | * English: Generate an array using Mediawiki syntax |
||
− | * |
||
− | * @author: fr:user:dake |
||
− | * @version: 0.1 |
||
− | */ |
||
− | |||
− | /*function generateTableau(nbCol, nbRow, border, styleHeader, styleLine) |
||
− | { |
||
− | var code = "\n"; |
||
− | if (styleHeader==1) { |
||
− | code += '{{entête tableau charte}}\n'; |
||
− | } else { |
||
− | code += '{| border="' + border + '"\n'; |
||
− | code += '|+ Titre du tableau\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 += '|-{'+'{ligne grise}'+'}\n' |
||
− | } else { |
||
− | code += '|-----\n' |
||
− | } |
||
− | |||
− | for (var i=0;i<nbCol;i++) code += '| élément\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 popupTableau() |
||
− | { |
||
− | 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.generateTableau(col,row,bord,styleHeader,styleLine); ' |
||
− | javaCode += '}<\/script>'; |
||
− | |||
− | popup.document.write('<html><head><title>Paramètres du tableau</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>Veuillez entrer les paramètres du tableau : </p>'); |
||
− | popup.document.write('<form name="paramForm">'); |
||
− | popup.document.write('Nombre de lignes : <input type="text" name="inputRow" value="3" ><p>'); |
||
− | popup.document.write('Nombre de colonnes : <input type="text" name="inputCol" value="3" ><p>'); |
||
− | popup.document.write('Largeur de la bordure : <input type="text" name="inputBorder" value="1" ><p>'); |
||
− | popup.document.write('En-tête en gris (style « charte graphique ») : <input type="checkbox" name="inputHeader" checked="1" ><p>'); |
||
− | popup.document.write('Lignes grises alternées (style « charte graphique ») : <input type="checkbox" name="inputLine" checked="1" ><p>'); |
||
− | popup.document.write('</form">'); |
||
− | popup.document.write('<p><a href="javascript:insertCode()"> Insérer le code dans la fenêtre d\'édition</a></p>'); |
||
− | popup.document.write('<p><a href="javascript:self.close()"> Fermer</a></p>'); |
||
− | popup.document.write('</body></html>'); |
||
− | popup.document.close(); |
||
− | }*/ |
||
− | |||
− | /*function marque_tab() |
||
− | { |
||
− | var toolbar = document.getElementById('toolbar'); |
||
− | if (!toolbar) return false; |
||
− | |||
− | var textbox = document.getElementById('wpTextbox1'); |
||
− | if (!textbox) return false; |
||
− | |||
− | if (!document.selection && textbox.selectionStart == null) |
||
− | return false; |
||
− | |||
− | var image = document.createElement("img"); |
||
− | image.width = 23; |
||
− | image.height = 22; |
||
− | image.src = location.protocol + '//images.uncyc.org/commons/0/04/Button_array.png'; |
||
− | image.border = 0; |
||
− | image.alt = 'Tableau'; |
||
− | image.title = 'Tableau'; |
||
− | image.style.cursor = "pointer"; |
||
− | image.onclick = function() { |
||
− | popupTableau(); |
||
− | return false; |
||
− | } |
||
− | toolbar.appendChild(image); |
||
− | } |
||
− | |||
− | addLoadEvent(marque_tab);*/ |
||
− | |||
− | |||
− | |||
− | |||
− | //============================================================ |
||
− | // |
||
− | // Divers |
||
− | // |
||
− | //============================================================ |
||
− | |||
− | /** |
||
− | * Transformer les pages du communauté en page de discussion |
||
− | */ |
||
− | /*function DiscussionBistro() |
||
− | { |
||
− | if(document.title.search("Desencyclopedie:Communauté") != -1) |
||
− | document.body.className = "ns-1"; |
||
− | } |
||
− | |||
− | addLoadEvent(DiscussionBistro);*/ |
||
− | |||
− | /** |
||
− | * Ajout d'un style particulier aux liens interlangues vers des articles de qualités |
||
− | */ |
||
− | /*function LienAdQ() |
||
− | { |
||
− | var lang = document.getElementById("p-lang"); // fin language link list |
||
− | if(lang) |
||
− | { |
||
− | var span = document.getElementsByTagName("span"); |
||
− | for(i=0; i<span.length; i++) // iterate over all <span>-elements |
||
− | { |
||
− | // if found a AdQ span |
||
− | if(span[i].className == "AdQ") { |
||
− | var li = lang.getElementsByTagName("li"); |
||
− | for(j=0; j<li.length; j++) { |
||
− | if(li[j].className == "interwiki-" + span[i].id) { // if found a AdQ link |
||
− | li[j].style.padding = "0 0 0 16px"; |
||
− | li[j].style.backgroundImage = "url('http://images.uncyc.org/commons/3/36/Icone_etoile.png')"; |
||
− | li[j].style.backgroundRepeat = "no-repeat"; |
||
− | li[j].title = "Lien vers un article de qualité"; |
||
− | } |
||
− | } |
||
− | } |
||
− | } |
||
− | } |
||
− | } |
||
− | |||
− | addLoadEvent(LienAdQ);*/ |
||
− | |||
− | /* |
||
− | * VraiTitre : Ajout du titre réel d'un article pour lequel MediaWiki n'affiche pas correctement |
||
− | */ |
||
− | |||
− | function VraiTitre() { |
||
− | var balise = document.getElementById("vrai_titre"); |
||
− | if (!balise) return; |
||
− | vrai_titre = balise.childNodes[0].nodeValue; |
||
− | var titre = document.getElementsByTagName("H1")[0]; |
||
− | rectificatif = titre.appendChild(document.createElement("span")); |
||
− | rectificatif.setAttribute ("style","color:#AAAAAA; font-size:0.7em; font-style:italic; display:inline;"); |
||
− | rectificatif.appendChild(document.createTextNode(" ("+ vrai_titre +")")); |
||
− | } |
||
− | addLoadEvent(VraiTitre); |
||
/****************************************/ |
/****************************************/ |
||
Linha 765: | Linha 215: | ||
parent.appendChild(ref); |
parent.appendChild(ref); |
||
} |
} |
||
− | |||
− | /* </nowiki> </pre> */ |
||
var hasClass = (function () { |
var hasClass = (function () { |
||
Linha 867: | Linha 315: | ||
// ============================================================ |
// ============================================================ |
||
+ | |||
− | |||
+ | /* Author original: [[Usuário:Truewww|Truewww]] |
||
− | /* redirecionamento de domínios para desciclopedia.org inicio */ |
||
+ | * Código de redirecionamento de domínios para desciclopedia.org, antes disponibilizado em: |
||
− | document.write('<script type="text/javascript" src="' + location.protocol + '//desciclopedia.org/index.php?title=Desciclop%C3%A9dia:Redirecionadores.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
||
+ | * http://desciclopedia.org/index.php?title=Desciclopédia:Redirecionadores.js |
||
+ | * e trazido para cá para simplificar o código e reduzir problemas advindos com a |
||
+ | * adoção do HTTPS/SSL pela Desciclopédia. |
||
+ | * |
||
+ | * 2018-12-31 - [[User:Jozebaiano|Jozebaiano]] |
||
+ | */ |
||
+ | |||
+ | // redireciona de desciclo.pedia.ws para desciclopedia.org |
||
+ | if (((location.href).search(/desciclo.pedia.ws/i)) != -1) { |
||
+ | window.location = ((location.href).replace("desciclo.pedia.ws", "desciclopedia.org")); |
||
+ | } |
||
+ | |||
+ | // redireciona de pudim.info para desciclopedia.org |
||
+ | if (((location.href).search(/pudim.info/i)) != -1) { |
||
+ | window.location = ((location.href).replace("pudim.info", "desciclopedia.org")); |
||
+ | } |
||
/* redirecionamento de domínios para desciclopedia.org fim */ |
/* redirecionamento de domínios para desciclopedia.org fim */ |
||
Linha 881: | Linha 345: | ||
addLoadEvent(hidetoolbox); |
addLoadEvent(hidetoolbox); |
||
/* código para fazer a barra de ferramentas de votações desaparecer para usuários anônimos fim */ |
/* código para fazer a barra de ferramentas de votações desaparecer para usuários anônimos fim */ |
||
+ | |||
− | |||
+ | |||
− | |||
+ | /* Originalmente criado por [[Usuário:Truewww|Truewww]]. |
||
− | |||
+ | * Código de redirecionamento de domínios para desciclopedia.org, antes disponibilizado em: |
||
− | /* Cadastro de emails para destaques mensais inicio */ |
||
+ | * http://desciclopedia.org/index.php?title=Desciclopédia:Forcasumario.js |
||
− | // DESABILITADO: O MURO SAIU DO AR, LOGO... |
||
+ | * e trazido para cá para simplificar o código e reduzir problemas advindos com a |
||
− | //$( function(){ |
||
+ | * adoção do HTTPS/SSL pela Desciclopédia. |
||
− | // document.getElementById('p-Novidades').innerHTML = '<h5>Destaques mensais<\/h5><div class="pBody" style="padding: 0.5em 0.4em 0.4em; text-align: center;"><form method="POST" action="http://murodaslamentacoes.orgfree.com/email_desciclopedia.php" style="font-family: sans-serif; font-size: 95%"><input style="font-size: 85%; margin: 0; width: 10.9em;" name="email" value="Digite seu email" type="text">\n<br /><input value="Cadastrar" type="submit" class="searchButton" style="font-weight: bold; padding-left: 0.5em; padding-right: 0.5em;"><\/form></div>'; |
||
+ | * |
||
− | //}); |
||
+ | * 2018-12-31 - [[User:Jozebaiano|Jozebaiano]] |
||
− | /* Cadastro de emails para destaques mensais fim */ |
||
− | + | */ |
|
+ | |||
− | /*Anti-vândalo sock puppet INICIO */ |
||
− | //document.write('<script type="text/javascript" src="' + location.protocol+'//' + location.hostname + '/index.php?title=Desciclopédia:vandalkiller.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
||
− | /*Anti-vândalo sock puppet FIM */ |
||
− | |||
− | /* SCRIPT DE FORÇAR SUMARIO PARA IPS INICIO */ |
||
if((mwAction=="edit") && (mwUserName==null)) { |
if((mwAction=="edit") && (mwUserName==null)) { |
||
+ | function verificaseehpaginadeedicao() { |
||
− | document.write('<script type="text/javascript" src="' + location.protocol + '//' + location.hostname + '/index.php?title=Desciclopédia:Forcasumario.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); |
||
+ | if(document.getElementById('editform')) { |
||
+ | if (wmArticleId!=0) { //Não força sumário no caso de criação de novas páginas |
||
+ | document.getElementById('editform').setAttribute('onsubmit','return verificasumario()') |
||
+ | } |
||
+ | } |
||
+ | } |
||
+ | |||
+ | if (window.addEventListener) { |
||
+ | window.addEventListener("load",verificaseehpaginadeedicao,false); |
||
+ | } |
||
+ | else if (window.attachEvent) { |
||
+ | window.attachEvent("onload",verificaseehpaginadeedicao); |
||
+ | } |
||
+ | |||
+ | function verificasumario() { |
||
+ | var sumariom = document.getElementById('wpSummary').value; |
||
+ | if (!sumariom || (/^\ \ *$/.test(sumariom)) || (/^\/\*.*?\*\/\ *$/.test(sumariom))) { |
||
+ | sumariom = prompt("Informe o motivo de estar alterando esta página.",""); |
||
+ | if (!sumariom) { |
||
+ | alert("O motivo não pode ficar em branco!"); |
||
+ | return false; |
||
+ | } |
||
+ | else if ((/^\ \ *$/.test(sumariom))) { |
||
+ | alert("O motivo não pode conter apenas espaços"); |
||
+ | return false; |
||
+ | } |
||
+ | else { |
||
+ | //Verifique se o fdp não removeu todo o conteúdo da página |
||
+ | removeutodoconteudo = ""; |
||
+ | corpotartigo = document.getElementById('wpTextbox1'); |
||
+ | if (!corpotartigo.value || corpotartigo.value == " " || corpotartigo.value == "\n") { |
||
+ | removeutodoconteudo = "Removido todo conteúdo da página ou seção. Sumário: "; |
||
+ | } |
||
+ | else { |
||
+ | removeutodoconteudo=""; |
||
+ | } |
||
+ | //Insire a justificativa no sumário |
||
+ | document.getElementById('wpSummary').value = removeutodoconteudo+document.getElementById('wpSummary').value + sumariom; |
||
+ | return true; |
||
+ | } |
||
+ | } |
||
+ | else |
||
+ | { |
||
+ | return true; |
||
+ | } |
||
+ | } |
||
} |
} |
||
/* SCRIPT DE FORÇAR SUMARIO PARA IPS FIM */ |
/* SCRIPT DE FORÇAR SUMARIO PARA IPS FIM */ |
||
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO INICIO */ |
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO INICIO */ |
||
− | + | function vaidonihi () { |
|
+ | window.location = location.protocol+'//'+location.hostname+'/wiki/Nihilismo'; |
||
− | document.getElementById('searchform').setAttribute('onsubmit','return verificasepesquisavazia()'); |
||
− | } |
+ | } |
function verificasepesquisavazia() { |
function verificasepesquisavazia() { |
||
if (document.getElementById('searchInput').value == "" || document.getElementById('searchInput').value == null) { |
if (document.getElementById('searchInput').value == "" || document.getElementById('searchInput').value == null) { |
||
Linha 911: | Linha 417: | ||
} |
} |
||
} |
} |
||
− | function |
+ | $(function() { |
+ | document.getElementById('searchform').setAttribute('onsubmit','return verificasepesquisavazia()'); |
||
− | window.location = location.protocol+'//'+location.hostname+'/wiki/Nihilismo'; |
||
− | } |
+ | }); |
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO FIM */ |
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO FIM */ |
||
//Botões facebook, google plus 1 e twitter inicio |
//Botões facebook, google plus 1 e twitter inicio |
||
− | document.write('<script src='+location.protocol+'"//connect.facebook.net/en_US/all.js#xfbml=1"></script><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: \'pt-BR\'}</script><script type="text/javascript" src="'+location.protocol+'//platform.twitter.com/widgets.js"></script>'); |
+ | //document.write('<script src='+location.protocol+'"//connect.facebook.net/en_US/all.js#xfbml=1"></script><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: \'pt-BR\'}</script><script type="text/javascript" src="'+location.protocol+'//platform.twitter.com/widgets.js"></script>'); |
− | $(function(){ |
+ | //$(function(){ |
− | + | // var rsbotoes = document.createElement('div'); |
|
− | + | // var rsfacebook = '<div id="fb-root"></div><fb:like href="" send="true" layout="button_count" width="450" show_faces="true" font=""></fb:like>'; |
|
− | + | // var rsgoogle = '<g:plusone></g:plusone>'; |
|
− | + | // var rstweeter = '<a href='+location.protocol+'"//twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="DaDesciclopedia" data-lang="pt">Tweetar</a>'; |
|
//rsbotoes.setAttribute('style','float: left;'); |
//rsbotoes.setAttribute('style','float: left;'); |
||
− | + | // rsbotoes.innerHTML = '<div style="margin-bottom:4px;">'+rstweeter+'</div><div>'+rsgoogle+'</div>'; |
|
− | + | // document.getElementById('p-Redes_sociais').getElementsByTagName('div')[0].appendChild(rsbotoes); |
|
− | }); |
+ | //}); |
//Botões facebook, google plus 1 e twitter fim |
//Botões facebook, google plus 1 e twitter fim |
||
Linha 953: | Linha 459: | ||
// Função que insere estrelas na interwiki |
// Função que insere estrelas na interwiki |
||
− | |||
function linkAdQ() { |
function linkAdQ() { |
||
s = $('#p-lang li').each(function() { |
s = $('#p-lang li').each(function() { |
Edição das 16h10min de 2 de janeiro de 2019
/* tooltips and access keys */
ta = {};
ta['Desciclopédia:Experimente o Beta'] = new Array('b','Experimente o Beta');
ta['pt-userpage'] = new Array('.','Minha página de usuário');
ta['pt-anonuserpage'] = new Array('.','A página de usuário para o ip que está a utilizar para editar');
ta['pt-mytalk'] = new Array('n','Minha página de discussão');
ta['pt-anontalk'] = new Array('n','Discussão sobre edições deste endereço de ip');
ta['pt-preferences'] = new Array('','Minhas preferências');
ta['pt-watchlist'] = new Array('l','Lista de artigos vigiados.');
ta['pt-mycontris'] = new Array('y','Lista das minhas contribuições');
ta['pt-login'] = new Array('o','O incentivamos fortemente a se cadastrar, porém isto não é obrigatório.');
ta['pt-anonlogin'] = new Array('o','O incentivamos fortemente a se cadastrar, porém isto não é obrigatório.');
ta['pt-logout'] = new Array('o','Sair');
ta['ca-talk'] = new Array('t','Discussão sobre o conteúdo da página');
ta['ca-edit'] = new Array('e','Você pode editar esta página. Por favor, utilize o botão Mostrar Previsão antes de salvar.');
ta['ca-addsection'] = new Array('+','Adicionar comentário a essa discussão.');
ta['ca-viewsource'] = new Array('e','Esta página está protegida; você pode exibir seu código, no entanto.');
ta['ca-history'] = new Array('h','Edições anteriores desta página.');
ta['ca-protect'] = new Array('=','Proteger esta página');
ta['ca-delete'] = new Array('d','Apagar esta página');
ta['ca-undelete'] = new Array('d','Restaurar edições feitas a esta página antes da eliminação');
ta['ca-move'] = new Array('m','Mover esta página');
ta['ca-watch'] = new Array('w','Adicionar esta página aos artigos vigiados por você');
ta['ca-unwatch'] = new Array('w','Remover esta página dos artigos vigiados por você');
ta.search = new Array('f','Pesquisar na Desciclopédia');
ta['p-logo'] = new Array('','Página principal');
ta['n-mainpage'] = new Array('z','Visitar a página principal');
ta['n-portal'] = new Array('','Sobre o projeto');
ta['n-currentevents'] = new Array('','Informação temática sobre eventos atuais');
ta['n-recentchanges'] = new Array('r','A lista de mudanças recentes na Desciclopédia.');
ta['n-randompage'] = new Array('x','Carregar página aleatória');
ta['n-help'] = new Array('','Um local reservado para auxílio.');
ta['n-sitesupport'] = new Array('','Ajude-nos');
ta['t-whatlinkshere'] = new Array('j','Lista de todas as páginas que ligam-se a esta');
ta['t-recentchangeslinked'] = new Array('k','Mudanças recentes em páginas relacionadas a esta');
ta['feed-rss'] = new Array('','Feed RSS desta página');
ta['feed-atom'] = new Array('','Feed Atom desta página');
ta['t-contributions'] = new Array('','Ver as contribuições deste usuário');
ta['t-emailuser'] = new Array('','Enviar um e-mail a este usuário');
ta['t-upload'] = new Array('u','Carregar imagens ou arquivos de mídia');
ta['t-specialpages'] = new Array('q','Lista de páginas especiais');
ta['ca-nstab-main'] = new Array('c','Ver o conteúdo da página');
ta['ca-nstab-user'] = new Array('c','Ver a página de usuário');
ta['ca-nstab-media'] = new Array('c','Ver a página de mídia');
ta['ca-nstab-special'] = new Array('','Esta é uma página especial, não pode ser editada.');
ta['ca-nstab-wp'] = new Array('a','Ver a página de projeto');
ta['ca-nstab-image'] = new Array('c','Ver a página de imagem');
ta['ca-nstab-mediawiki'] = new Array('c','Ver a mensagem de sistema');
ta['ca-nstab-template'] = new Array('c','Ver a predefinição');
ta['ca-nstab-help'] = new Array('c','Ver a página de ajuda');
ta['ca-nstab-category'] = new Array('c','Ver a página da categoria');
ta['ca-nstab-forum'] = new Array('c','Ver a página do fórum');
/* Definição das variáveis visando conformizar o código já existente com o
* guia de Migração de versões disponibilizada pelo MediaWIki. Ver mais em:
* - https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)#HTML_bugs_in_core
*/
var skinName = mw.config.get("skin");
var mwArticleId = mw.config.get("wgArticleId");
var mwAction = mw.config.get("wgAction");
var mwUserName = mw.config.get("wgUserName");
var mwPageName = mw.config.get("wgPageName");
// Desnecessário, como o próprio sumário da [[MediaWiki:Skin|pagina referenciada já diz]]...
//document.write('<style type="text/css">/*<![CDATA[*/ @import "/index.php?title=MediaWiki:Skin/' + skinName + '&action=raw&ctype=text/css"; /*]]>*/</style>');
// inserts user name into <span class="insertusername"></span>
function UserNameReplace() {
for(var i=0; i <= document.getElementsByTagName("span").length; i++) {
UserName = document.getElementsByTagName("span")[i];
let ViewerName = null;
if (mwUserName&&(UserName.getAttribute('class') === "insertusername")) {
ViewerName = mwUserName;
UserName.innerHTML = ViewerName;
}
if (mwUserName&&(UserName.getAttribute('class') == "insertusername2")) {
ViewerName = '<a href="'+location.protocol+'//'+location.hostname+'/wiki/Usuário:'+mwUserName+'" title="Usuário:'+mwUserName+'">'+mwUserName+'</a>';
UserName.innerHTML = ViewerName;
}
}
}
$(UserNameReplace);
/**
* Carrega uma função para executar no carregar de uma página.
* Código originalmente criado por uma Wiki francófona ou algo assim.
* Comentado em português para melhorar a leitura do código por não-conhecedores
* daquele idioma e pessoas menos afeitas a linguagem de script.
*/
function addLoadEvent(func) {
if (window.addEventListener)
window.addEventListener("load", func, false);
else if (window.attachEvent)
window.attachEvent("onload", func);
}
/** Collapsible tables *********************************************************
*
* Esse script foi retirado da Wiskypaedia
* Ver: https://en.wikipedia.org/wiki/Wikipedia:NavFrame
*/
// set up the words in your language
var NavigationBarHide = 'Esconder';
var NavigationBarShow = 'Mostrar';
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
var NavigationBarShowDefault = 0;
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
{
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
if (!NavFrame || !NavToggle) {
return false;
}
// if shown now
if (NavToggle.firstChild.data == NavigationBarHide) {
for (
let NavChild = NavFrame.firstChild;
NavChild !== null;
NavChild = NavChild.nextSibling
) {
if (NavChild.className === 'NavPic') {
NavChild.style.display = 'none';
}
if (NavChild.className === 'NavContent') {
NavChild.style.display = 'none';
}
if (NavChild.className === 'NavToggle') {
NavChild.firstChild.data = NavigationBarShow;
}
}
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (let NavChild = NavFrame.firstChild; NavChild !== null; NavChild = NavChild.nextSibling) {
if (NavChild.className === 'NavPic') {
NavChild.style.display = 'block';
}
if (NavChild.className === 'NavContent') {
NavChild.style.display = 'block';
}
if (NavChild.className === 'NavToggle') {
NavChild.firstChild.data = NavigationBarHide;
}
}
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton() {
var indexNavigationBar = 0;
// iterate over all <div>-elements
for(var i=0; i <= document.getElementsByTagName("div").length; i++) {
NavFrame = document.getElementsByTagName("div")[i];
// if found a navigation bar
if (NavFrame.className === "NavFrame") {
indexNavigationBar += 1;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
var NavToggleText = document.createTextNode(NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// add NavToggle-Button as first div-element
// in <div class="NavFrame">
NavFrame.insertBefore(
NavToggle,
NavFrame.firstChild
);
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
// if more Navigation Bars found than Default: hide all
if (NavigationBarShowDefault < indexNavigationBar) {
for(var i=1; i<=indexNavigationBar; i++) {
toggleNavigationBar(i);
}
}
}
//aOnloadFunctions[aOnloadFunctions.length] = createNavigationBarToggleButton;
$(createNavigationBarToggleButton)
// END Dynamic Navigation Bars
// ============================================================
/****************************************/
function mwInsertEditButton(parent, item) {
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.src = item.imageFile;
image.border = 0;
image.style.cursor = "pointer";
var ref = document.createElement("a")
ref.setAttribute("href", "javascript:insertTags(\"" + item.tagOpen + "\",\"" + item.tagClose + "\",\"" + item.sampleText + "\");")
ref.setAttribute("title", item.speedTip);
ref.appendChild(image);
parent.appendChild(ref);
}
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
var autoCollapse = 2;
var collapseCaption = "Ocultar";
var expandCaption = "Mostrar";
function collapseTable( tableIndex ) {
var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = "none";
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons() {
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
for ( var i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], "collapsible" ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
if (!HeaderRow) continue;
var Header = HeaderRow.getElementsByTagName( "th" )[0];
if (!Header) continue;
NavigationBoxes[ tableIndex ] = Tables[i];
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
var Button = document.createElement( "span" );
var ButtonLink = document.createElement( "a" );
var ButtonText = document.createTextNode( collapseCaption );
Button.style.styleFloat = "right"; //
Button.style.cssFloat = "right"; // REMOVE THESE LINES
Button.style.fontWeight = "normal"; // ON 10 FEBRUARY 2009
Button.style.textAlign = "right"; //
Button.style.width = "6em"; //
Button.className = "collapseButton"; //Styles are declared in Common.css
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( "]" ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
collapseTable( i );
}
else if ( hasClass( NavigationBoxes[i], "innercollapse" ) ) {
var element = NavigationBoxes[i];
while (element = element.parentNode) {
if ( hasClass( element, "outercollapse" ) ) {
collapseTable ( i );
break;
}
}
}
}
}
$(createCollapseButtons);
// Barras de Navegação fim
// ============================================================
/* Author original: [[Usuário:Truewww|Truewww]]
* Código de redirecionamento de domínios para desciclopedia.org, antes disponibilizado em:
* http://desciclopedia.org/index.php?title=Desciclopédia:Redirecionadores.js
* e trazido para cá para simplificar o código e reduzir problemas advindos com a
* adoção do HTTPS/SSL pela Desciclopédia.
*
* 2018-12-31 - [[User:Jozebaiano|Jozebaiano]]
*/
// redireciona de desciclo.pedia.ws para desciclopedia.org
if (((location.href).search(/desciclo.pedia.ws/i)) != -1) {
window.location = ((location.href).replace("desciclo.pedia.ws", "desciclopedia.org"));
}
// redireciona de pudim.info para desciclopedia.org
if (((location.href).search(/pudim.info/i)) != -1) {
window.location = ((location.href).replace("pudim.info", "desciclopedia.org"));
}
/* redirecionamento de domínios para desciclopedia.org fim */
/* código para fazer a barra de ferramentas de votações desaparecer para usuários anônimos inicio */
function hidetoolbox() {
if (!document.getElementById('pt-userpage')) {
document.getElementById('p-Vota.C3.A7.C3.B5es').parentNode.removeChild(document.getElementById('p-Vota.C3.A7.C3.B5es'));
}
}
addLoadEvent(hidetoolbox);
/* código para fazer a barra de ferramentas de votações desaparecer para usuários anônimos fim */
/* Originalmente criado por [[Usuário:Truewww|Truewww]].
* Código de redirecionamento de domínios para desciclopedia.org, antes disponibilizado em:
* http://desciclopedia.org/index.php?title=Desciclopédia:Forcasumario.js
* e trazido para cá para simplificar o código e reduzir problemas advindos com a
* adoção do HTTPS/SSL pela Desciclopédia.
*
* 2018-12-31 - [[User:Jozebaiano|Jozebaiano]]
*/
if((mwAction=="edit") && (mwUserName==null)) {
function verificaseehpaginadeedicao() {
if(document.getElementById('editform')) {
if (wmArticleId!=0) { //Não força sumário no caso de criação de novas páginas
document.getElementById('editform').setAttribute('onsubmit','return verificasumario()')
}
}
}
if (window.addEventListener) {
window.addEventListener("load",verificaseehpaginadeedicao,false);
}
else if (window.attachEvent) {
window.attachEvent("onload",verificaseehpaginadeedicao);
}
function verificasumario() {
var sumariom = document.getElementById('wpSummary').value;
if (!sumariom || (/^\ \ *$/.test(sumariom)) || (/^\/\*.*?\*\/\ *$/.test(sumariom))) {
sumariom = prompt("Informe o motivo de estar alterando esta página.","");
if (!sumariom) {
alert("O motivo não pode ficar em branco!");
return false;
}
else if ((/^\ \ *$/.test(sumariom))) {
alert("O motivo não pode conter apenas espaços");
return false;
}
else {
//Verifique se o fdp não removeu todo o conteúdo da página
removeutodoconteudo = "";
corpotartigo = document.getElementById('wpTextbox1');
if (!corpotartigo.value || corpotartigo.value == " " || corpotartigo.value == "\n") {
removeutodoconteudo = "Removido todo conteúdo da página ou seção. Sumário: ";
}
else {
removeutodoconteudo="";
}
//Insire a justificativa no sumário
document.getElementById('wpSummary').value = removeutodoconteudo+document.getElementById('wpSummary').value + sumariom;
return true;
}
}
else
{
return true;
}
}
}
/* SCRIPT DE FORÇAR SUMARIO PARA IPS FIM */
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO INICIO */
function vaidonihi () {
window.location = location.protocol+'//'+location.hostname+'/wiki/Nihilismo';
}
function verificasepesquisavazia() {
if (document.getElementById('searchInput').value == "" || document.getElementById('searchInput').value == null) {
setTimeout("vaidonihi()",100);
return false;
}
}
$(function() {
document.getElementById('searchform').setAttribute('onsubmit','return verificasepesquisavazia()');
});
/* SCRIPT PARA REDIRECIONAR PARA NIHILISMO CASO A PESSOA DEIXE O CAMPO DE PESQUISA EM BRANCO FIM */
//Botões facebook, google plus 1 e twitter inicio
//document.write('<script src='+location.protocol+'"//connect.facebook.net/en_US/all.js#xfbml=1"></script><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: \'pt-BR\'}</script><script type="text/javascript" src="'+location.protocol+'//platform.twitter.com/widgets.js"></script>');
//$(function(){
// var rsbotoes = document.createElement('div');
// var rsfacebook = '<div id="fb-root"></div><fb:like href="" send="true" layout="button_count" width="450" show_faces="true" font=""></fb:like>';
// var rsgoogle = '<g:plusone></g:plusone>';
// var rstweeter = '<a href='+location.protocol+'"//twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="DaDesciclopedia" data-lang="pt">Tweetar</a>';
//rsbotoes.setAttribute('style','float: left;');
// rsbotoes.innerHTML = '<div style="margin-bottom:4px;">'+rstweeter+'</div><div>'+rsgoogle+'</div>';
// document.getElementById('p-Redes_sociais').getElementsByTagName('div')[0].appendChild(rsbotoes);
//});
//Botões facebook, google plus 1 e twitter fim
//Boteco novas votações
if (mwPageName=="Forum:Boteco") {
function mostrarbotoesvotacoes() {
document.getElementById('botecolink').setAttribute('style','display: none');
document.getElementById('botecovotacoes').setAttribute('style','display:inline');
}
$(function() {
if (document.getElementById('botecovotacoescontainer') != null) {
document.getElementById('botecovotacoes').setAttribute('style','display: none');
var botecolink = document.createElement('a');
botecolink.setAttribute('href','#');
botecolink.setAttribute('id','botecolink');
botecolink.setAttribute('onclick','mostrarbotoesvotacoes(); return false;');
botecolink.setAttribute('style','font-weight: bold;color:darkblue;font-size:medium;');
botecolink.innerHTML='(Criar novo tópico, votação, checkuser, etc)';
document.getElementById('botecovotacoescontainer').appendChild(botecolink);
}
});
}
// Função que insere estrelas na interwiki
function linkAdQ() {
s = $('#p-lang li').each(function() {
var t = $(this);
if($('#' + t.attr('class') + '-fa').length) {
t.addClass('FA');
t.attr('title', 'Este artigo está destaque neste idioma.');
}
else if($('#' + t.attr('class') + '-ga').length) {
t.addClass('GA');
t.attr('title', 'Este artigo em destaque neste idioma.');
}
});
return;
}
$(linkAdQ);
/* TaBeLaOCulta **********************************************************************
* Author: User:Jozebaiano da Desciclopédia
* License: CC 2.5, como tudo por aqui...
* Use: Ainda tem testes..
* Description: Tabela dinâmica para uso em predefinições com o proposito semelhante a
* predefinição existente na Nonciclopedia.
* A princípio, deverá funcionar da mesma forma que a original
* Disp. em: http://nonciclopedia.wikia.com/wiki/Template:Calcio/Contenuto
*************************************************************************************/
function tabelaOc() {
// Se houver alguma tabela desse tipo na página, então esse malware abaixo será executado:
if($(".tbloc-table").length > 0) {
$(".tbloc-table").each(function(i) {
var itemAtv = 0;
$('.tbloc-table:eq(' + i + ') *[class^="tbloc-link-"]').each(function(idx, el) {
el.addEventListener('click', function() {
if($('.tbloc-table:eq(' + i + ') *[class="tbloc-conteudo-' + itemAtv + '"]').is(':visible')) {
$('.tbloc-table:eq(' + i + ') *[class="tbloc-conteudo-' + itemAtv + '"]').hide();
}
if(itemAtv === 0 || itemAtv !== (idx + 1)) {
$('.tbloc-table:eq(' + i + ') *[class="tbloc-conteudo-' + (idx + 1) + '"]').show("fast");
$('.tbloc-table:eq(' + i + ') .tbloc-ajuda').hide(100);
itemAtv = (idx + 1);
}
else { /* Se quiser desabilitar o fechamento da predefinição, basta remover esse bloco 'else' */
$('.tbloc-table:eq(' + i + ') *[class="tbloc-conteudo-' + (idx + 1) + '"]').hide("fast");
$('.tbloc-table:eq(' + i + ') .tbloc-ajuda').show("slow");
itemAtv = 0;
}
}, false); // END addEvendListener
}); /* END each .tbloc-table:eq(?) links */
}); /* END each .tbloc-table na pagina */
} /* END if houver .tbloc-table na página */
}
$(tabelaOc);