MediaWiki:Common.js
Aparença
Nota: Després de publicar, possiblement necessitareu refrescar la memòria cau del vostre navegador per a veure'n els canvis.
- Firefox / Safari: Premeu Majús i alhora cliqueu el botó Actualitzar, o pressioneu Ctrl+F5 o Ctrl+R (⌘+R en un Mac)
- Google Chrome: Premeu Ctrl+Majús+R (⌘+Shift+R en un Mac)
- Internet Explorer / Edge: Premeu Ctrl i alhora cliqueu a Actualitza o pressioneu Ctrl+F5
- Opera: Premeu Ctrl-F5.
/* Es carregarà per a tots els usuaris i per a qualsevol pàgina el codi JavaScript que hi haja després d'aquesta línia. */
/* Mostrar icona de qualitat a la pestanya. Plantilles PageQuality i TextQuality. Autor: ThomasV */
function pageQuality() {
for(var i=0;spanElem = document.getElementsByTagName("span")[i];i++ ) {
if (spanElem.className == "pagequality") {
t = spanElem.title;
var new_img = document.createElement("img");
new_img.setAttribute("src", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
new_img.setAttribute("title", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
if(mw.config.get('wgPageName').substring(0,7) === "Pàgina:") {
a = document.getElementById("ca-nstab-main");
if(a) a.firstChild.appendChild(new_img);
} else {
s1 = spanElem.parentNode.previousSibling;
opttext = s1.firstChild.firstChild;
img = opttext.firstChild.nextSibling.nextSibling.nextSibling;
next = img.nextSibling;
opttext.removeChild(img);
opttext.insertBefore(new_img,next);
}
}
if (spanElem.className == "textquality") {
t = spanElem.title;
var new_img = document.createElement("img");
new_img.setAttribute("src", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
new_img.setAttribute("title", "/wiki/Special:Filepath/"+t.substring(0,t.length-1)+'%25.png');
a = document.getElementById("ca-nstab-main");
if(a) a.firstChild.appendChild(new_img);
}
}
}
$(pageQuality);
/* Localització dels javascripts de ThomasV. */
self.ws_messages = {
'optlist':'Opcions de visualització',
'corr_list':"Correccions respecte de l´original publicat",
'corr_link':"Correccions",
'corr_one':"Una errata </a> ha estat corregida.",
'corr_many':" errates</a> han estat corregides.",
'corr_close':'Tancar.',
'iwtrans':'El seu text prové de',
'hide_page_numbers':'Oculta pàgines',
'show_page_numbers':'Mostra pàgines'
};
/* Necessari per a la resta de javascripts de ThomasV. */
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
/* Cross-domain transclusions through the API. By ThomasV. Plantilla iwpage */
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');
/* Errates. By ThomasV. Plantilla Corr */
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript');
/* :fr:MediaWiki:MediaWiki.panel.js Menú extra segons skin*/
mediaWiki.panel = function(data) {
var skin = mw.config.get('skin');
var panelInfo = {};
if(skin=="monobook" || skin=="chick" || skin=="myskin" || skin=="simple") {
panelInfo = {
'portletClassName': 'portlet',
'pBodyClassName': 'pBody',
'columnId': 'column-one'
};
} else if(skin=="modern") {
panelInfo = {
'portletClassName': 'portlet',
'pBodyClassName': 'pBody',
'columnId': 'mw_portlets'
};
} else if(skin=="vector") {
panelInfo = {
'portletClassName': 'portal expanded',
'pBodyClassName': 'body',
'columnId': 'mw-panel'
};
} else {
return;
}
if(typeof data.sections != 'undefined') {
var divBefore = $('#p-lang');
$.each( data.sections, function( sectionId, section ) {
if(divBefore.length !== 0) {
divBefore.before('<div id="p-' + sectionId + '" class="' + panelInfo.portletClassName + '"><h3>' + section.label + '</h3><div class="' + panelInfo.pBodyClassName + '"></div></div>');
} else {
$('#' + panelInfo.columnId).append('<div id="p-' + sectionId + '" class="' + panelInfo.portletClassName + '"><h3>' + section.label + '</h3><div class="' + panelInfo.pBodyClassName + '"></div></div>');
}
if(typeof section.data != 'undefined') {
$('div#p-' + sectionId + ' div.' + panelInfo.pBodyClassName).append(section.data);
} else {
$('div#p-' + sectionId + ' div.' + panelInfo.pBodyClassName).append("<ul>");
var list = $('div#p-' + sectionId + ' ul');
$.each( section.links, function( linkId, link ) {
link['class'] = (typeof link['class'] != 'undefined') ? link['class'] : '';
list.append('<li id="n-' + linkId + '" class="' + link['class'] + '"><a href="' + link.href + '">' + link.label + '</a></li>');
} );
if(skin == "vector") {
if(typeof section.expanded == 'undefined' || section.expanded) {
$('div#p-' + sectionId).addClass('expanded');
$('div#p-' + sectionId + ' div.' + panelInfo.pBodyClassName).show();
} else {
$('div#p-' + sectionId).addClass('collapsed');
}
}
}
} );
} else if(typeof data.section != 'undefined') {
var list = $('div#p-' + data.section + ' ul');
$.each( data.links, function( linkId, link ) {
link['class'] = (typeof link['class'] != 'undefined') ? link['class'] : '';
list.append('<li id="n-' + linkId + '" class="' + link['class'] + '"><a href="' + link.href + '">' + link.label + '</a></li>');
} );
}
};
/* Atributs d'estils dinàmics. Copiat de fr:MediaWiki:Common.js */
self.ws_layouts = {
'Estil 1':{'text-wrap':"position:relative;margin-left:3em;margin-right:3em;",
'#text-container':"width:36em;margin:0px auto;" ,
'#text':"text-align:justify;",
'#box-right':"position:absolute; right:-20em;top:0em;",
'#box-toc':"position:absolute; right:-23em;top:0em; width:22em;",
'.sidenote-right':"position:absolute; left:37em;width:15em;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:37em;width:15em;text-indent:0em;text-align:right;",
'.editsection':"display:none",
'.headerlabel':"display:none",
'.headertemplate-author':"font-size:100%",
'.headertemplate-title':"font-size:120%;",
'.headertemplate-reference':"font-size:90%",
'#headertemplate':"" },
'Estil 2':{'text-wrap':"margin-left:3em",
'#text-container':"" ,
'#text':"text-align:justify;width:auto;",
'#box-right':"float:right;",
'#box-toc':"margin:auto;width:100%;",
'.sidenote-right':"float:right;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.sidenote-left':"float:left;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'.headerlabel':"display:none",
'.headertemplate-author':"font-size:100%",
'.headertemplate-title':"font-size:120%;",
'.headertemplate-reference':"font-size:90%",
'#headertemplate':"" },
'Estil 3':{'text-wrap':"margin-left:3em",
'#text-container':"position:relative; min-width:60em; float:left; width:100%; margin-right:-23em;" ,
'#text':"text-align:justify;margin-right:23em; text-indent:0em; padding-left:0px; padding-right:0px;width:auto;position:relative;",
'#box-right':"float:right;",
'#box-toc':"margin:auto;width:100%;",
'.sidenote-right':"position:absolute; right:-16em; width:15em; background-color:#eeeeee;color:black;text-indent:0em;text-align:left;line-height:normal;",
'.sidenote-left': "position:absolute; right:-16em; width:15em; background-color:#eeeeee;color:black;text-indent:0em;text-align:left;line-height:normal;",
'.editsection':"display:none",
'.headerlabel':"display:inline",
'.headertemplate-author':"font-size:100%;",
'.headertemplate-title':"font-size:100%;",
'.headertemplate-reference':"font-size:100%;",
'#headertemplate':"position:absolute; top:0em; right:-23em; width:21em;float:right; text-align:left;" }
};
/* Opcions per als números de pàgina */
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript');
/* Amagar títol i categoria a la Portada i subportades */
mw.loader.using(['mediawiki.util']).then(function() {
var isDiff = mw.util.getParamValue('diff') || mw.util.getParamValue('oldid');
if ((mw.config.get('wgIsMainPage')) && mw.config.get('wgIsArticle') && !isDiff){
mw.util.addCSS('#lastmod, #siteSub, #contentSub, h1.firstHeading, #catlinks { display: none !important; }');
}
});