Conteúdo apagado Conteúdo adicionado
novo
 
m - emitindo alerta
Linha 2:
"use strict";
 
var NavigationBarHide = "ocultar";
var NavigationBarShow = "exibir";
 
function checkAndSetToggleified(element) {
Linha 28:
var text = jQuery(heading).text()
.toLowerCase()
// jQuery's .text() is inconsistent about whitespace:
.replace(/^\s+|\s+$/g, "").replace(/\s+/g, " ")
// remove numbers added by the "Auto-number headings" pref:
.replace(/^[1-9][0-9.]+ ?/, "");
if (/^[a-zA-Z0-9\s_-]+$/.test(text))
Linha 61 ⟶ 59:
if (!(navHead && navContent))
return;
 
// Step 1, don't react when a subitem is clicked.
$(navHead).find("a").on("click", function (e) {
e.stopPropagation();
});
 
// Step 2, toggle visibility when bar is clicked.
var $navToggle = $("<a>").attr("role", "button").attr("tabindex", "0");
Linha 90 ⟶ 86:
}
 
function setupHiddenQuotes(li) {
/* == View Switching == */
if (checkAndSetToggleified(li)) {
return;
}
var HQToggle, liComp, dl;
var HQShow = "citações";
var HQHide = "citações";
function show() {
HQToggle.html(HQHide);
$(li).children("ul").show();
}
function hide() {
HQToggle.html(HQShow);
$(li).children("ul").hide();
}
for (var k = 0; k < li.childNodes.length; k++) {
// Look at each component of the definition.
liComp = li.childNodes[k];
if (liComp.nodeName.toLowerCase() === "dl" && !dl) {
dl = liComp;
}
 
if (/^(ul|UL)$/.test(liComp.nodeName)) {
HQToggle = $("<a>").attr("role", "button").attr("tabindex", "0");
$(dl || liComp).before($("<span>").addClass("HQToggle").append(HQToggle));
HQToggle.on("click", window.VisibilityToggles.register("quotations", show, hide));
break;
}
}
}
 
function viewSwitching(rootElement) {
Linha 98 ⟶ 125:
var $rootElement = $(rootElement);
var showButtonText = $rootElement.data("vs-showtext") || "mais";
var hideButtonText = $rootElement.data("vs-hidetext") || "menos";
var toSkip = $rootElement.find(".vsSwitcher").find("*");
Linha 113 ⟶ 140:
e.stopPropagation();
});
 
// Add the toggle button.
var toggleButton = $("<a>").attr("role", "button").attr("tabindex", "0");
$("<span>").addClass("NavToggle").append(toggleButton).prependTo(toggleElement);
 
// Determine the visibility toggle category (for the links in the bar on the left).
var toggleCategory = $rootElement.data("toggle-category");
if (!toggleCategory) {
Linha 135 ⟶ 160:
if (!toggleCategory)
toggleCategory = "others";
 
// Register the visibility toggle.
toggleElement.css("cursor", "pointer");
toggleElement.on("click", window.VisibilityToggles.register(toggleCategory,
Linha 151 ⟶ 175:
}
 
/* ==List switching== */
window.listSwitcherRowCount = window.listSwitcherRowCount || 3;
 
Linha 177 ⟶ 200:
var $rootElement = $(rootElement);
var $termList = $rootElement.find(".term-list");
// Find the element to place the toggle button in.
var $toggleElement = $rootElement.find(".list-switcher-element");
var columnCount = parseInt($termList.data("column-count"), 10);
if (!(columnCount && columnCount > 0)) {
Linha 189 ⟶ 209:
var $listItems = $rootElement.find("ul").first().find("li");
var $toHide = getListItemsToHide($listItems, columnCount, rowsInShowState);
 
// Don't do anything if there aren't any items to hide.
if ($toHide.length === 0) {
$toggleElement.hide();
Linha 197 ⟶ 216:
$toggleElement.css("cursor", "pointer");
// Add the toggle button.
var $toggleButton = $("<a>").attr("role", "button").attr("tabindex", "0");
Linha 207 ⟶ 224:
$navToggle.css(rootBackgroundColor ? "background-color" : "background",
rootBackgroundColor || rootBackground);
 
// The $toggleElement becomes clickable in its entirety, but
// we need to prevent this if a contained link is clicked instead.
$toggleElement.children("a").on("click", function (e) {
e.stopPropagation();
});
 
var toggleCategory = $rootElement.data("toggle-category")
|| getToggleCategory($rootElement[0], "other lists");
var showButtonText = $toggleElement.data("showtext") || "mais";
var hideButtonText = $toggleElement.data("hidetext") || "menos";
// Determine the text for the $toggleButton.
 
var showButtonText = $toggleElement.data("showtext") || "mais ᐯ";
var hideButtonText = $toggleElement.data("hidetext") || "menos ᐱ";
// Register the visibility toggle.
$toggleElement.on("click", window.VisibilityToggles.register(toggleCategory,
function show() {
Linha 231 ⟶ 243:
$toHide.hide();
}));
 
// Add the toggle button to the DOM tree.
$navToggle.append($toggleButton).prependTo($toggleElement);
$toggleElement.show();
Linha 242 ⟶ 253:
window.getToggleCategory = getToggleCategory;
 
/* == Apply four functions defined above == */
mw.hook('wikipage.content').add(function($content) {
// NavToggles
Linha 248 ⟶ 258:
createNavToggle(this);
});
 
//quotes
if (mw.config.get('wgNamespaceNumber') === 0) {
// First, find all the ordered lists, i.e. all the series of definitions.
$('ol > li', $content).each(function(){
setupHiddenQuotes(this);
Linha 257 ⟶ 265:
}
 
//view switching
$('.vsSwitcher', $content).each(function(){
viewSwitching(this);
});
 
// list switching
$(".list-switcher", $content).each(function () {
enableListSwitch(this, window.listSwitcherRowCount);