MediaWiki:Common.js: Revizyonlar arasındaki fark
Görünüm
İçerik silindi İçerik eklendi
ResourceLoader/Migration guide (users) mw:Special:Permalink/4989156#importScriptURI (global sysop action) |
|||
466. liniya: | 466. liniya: | ||
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) { |
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) { |
||
var temp = UnitNode.childNodes[j]; |
var temp = UnitNode.childNodes[j]; |
||
if (temp.className |
if (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) { units.push(temp); } |
||
} |
} |
||
var wrap; |
|||
for (j = 0 ; j < units.length ; j++) { |
for (j = 0 ; j < units.length ; j++) { |
||
currentimage=units[j]; |
currentimage=units[j]; |
||
wrap = document.createElement('div'); |
|||
wrap.id = "ImageGroupsGr" + i + "Im" + j; |
|||
currentimage.parentNode.insertBefore(wrap, currentimage); |
|||
wrap.appendChild(currentimage); |
|||
var imghead = document.createElement("div"); |
var imghead = document.createElement("div"); |
||
var leftlink = document.createElement("a"); |
var leftlink = document.createElement("a"); |
||
491. liniya: | 495. liniya: | ||
appendChild(rightlink); |
appendChild(rightlink); |
||
} |
} |
||
if (units.length>1) |
if (units.length>1) wrap.insertBefore(imghead,wrap.childNodes[0]); |
||
if (j != 0) |
if (j != 0) wrap.style.display="none"; |
||
} |
} |
||
} |
} |
01.26, 24 Küçük ay 2023 sayfanın şindiki halı
// <nowiki>
/*
* Description: Redirects from /User:UserName/skin.js or .css to the user's actual skin page
* Maintainer: Cacycle
*/
if (wgArticleId == 0 && mw.config.get('wgUserName')) {
var slash = mw.config.get('wgPageName').indexOf('/');
var norm = mw.config.get('wgPageName').substr(0, slash) + mw.config.get('wgPageName').substr(slash).toLowerCase();
var test = 'User:' + mw.config.get('wgUserName').replace(/ /g, '_') + '/skin.';
var ext = null;
if (norm == test + 'js') ext = 'js';
else if (norm == test + 'css') ext = 'css';
if (ext != null) location.href = location.href.replace(/\/skin.(css|js)/i, '/' + skin + '.' + ext);
}
/** extract a URL parameter from the current URL **********
* From [[en:User:Lupin/autoedit.js]]
*
* paramName : the name of the parameter to extract
*/
function getURLParamValue( paramName, url)
{
if (typeof (url) == 'undefined' || url === null) url = location.href;
var cmdRe=RegExp( '[&?]' + paramName + '=([^&#]*)' ); // Stop at hash
var m=cmdRe.exec(url);
if (m && m.length > 1) return decodeURIComponent(m[1]);
return null;
}
/** &withJS= URL parameter *******
* Allow to try custom scripts from MediaWiki space
* without editing [[Special:Mypage/monobook.js]]
*/
var extraJS = getURLParamValue("withJS");
if ( extraJS && extraJS.match("^MediaWiki:[^&<>=%]*\.js$") ) {
importScript(extraJS);
}
/* Import more specific scripts if necessary */
if (mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit" || mw.config.get('wgPageName') == "Special:Upload") //scripts specific to editing pages
{
importScript("MediaWiki:Common.js/edit.js");
}
else if (mw.config.get('wgPageName') == "Special:Watchlist") //watchlist scripts
{
importScript("MediaWiki:Common.js/watchlist.js");
}
if( mw.config.get('wgNamespaceNumber') == 6 ) {
importScript('MediaWiki:Common.js/file.js');
}
/**
* WikiMiniAtlas is a popup click and drag world map.
* See [[meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
/* Load fixes for Windows font rendering */
if( navigator.platform.indexOf( "Win" ) != -1 ) {
mw.loader.load( '/w/index.php?title=MediaWiki:Common.css/WinFixes.css&action=raw&ctype=text/css', 'text/css' );
}
/* Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/** Interwiki links to featured articles ***************************************
*
* Description: Highlights interwiki links to featured articles (or
* equivalents) by changing the bullet before the interwiki link
* into a star.
* Maintainers: [[User:R. Koot]]
*/
function LinkFA()
{
if ( document.getElementById( "p-lang" ) ) {
var InterwikiLinks = document.getElementById( "p-lang" ).getElementsByTagName( "li" );
for ( var i = 0; i < InterwikiLinks.length; i++ ) {
if ( document.getElementById( InterwikiLinks[i].className + "-fa" ) ) {
InterwikiLinks[i].className += " FA";
InterwikiLinks[i].title = "Bu madde, başka bir dilde seçkin madde statüsündedir.";
} else if ( document.getElementById( InterwikiLinks[i].className + "-ga" ) ) {
InterwikiLinks[i].className += " GA";
InterwikiLinks[i].title = "Bu madde, başka bir dilde kaliteli madde statüsündedir.";
}
}
}
}
$( LinkFA );
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Maintainers: [[User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = "gizle";
var expandCaption = "göster";
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.className = "collapseButton"; //Styles are declared in Common.css
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "href", "#" );
ButtonLink.addEventListener("click", new Function( "evt", "collapseTable(" + tableIndex + " ); return false;") );
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 );
/** Dynamic Navigation Bars (experimental) *************************************
*
* Description: See [[Wikipedia:NavFrame]].
* Maintainers: UNMAINTAINED
*/
// set up the words in your language
var NavigationBarHide = '[' + collapseCaption + ']';
var NavigationBarShow = '[' + expandCaption + ']';
// 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 (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
NavChild.style.display = 'none';
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if (hasClass(NavChild, 'NavContent') || hasClass(NavChild, 'NavPic')) {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
var indexNavigationBar = 0;
// iterate over all < div >-elements
var divs = document.getElementsByTagName("div");
for (var i = 0; NavFrame = divs[i]; i++) {
// if found a navigation bar
if (hasClass(NavFrame, "NavFrame")) {
indexNavigationBar++;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
var isCollapsed = hasClass( NavFrame, "collapsed" );
/*
* Check if any children are already hidden. This loop is here for backwards compatibility:
* the old way of making NavFrames start out collapsed was to manually add style="display:none"
* to all the NavPic/NavContent elements. Since this was bad for accessibility (no way to make
* the content visible without JavaScript support), the new recommended way is to add the class
* "collapsed" to the NavFrame itself, just like with collapsible tables.
*/
for (var NavChild = NavFrame.firstChild; NavChild != null && !isCollapsed; NavChild = NavChild.nextSibling) {
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
if ( NavChild.style.display == 'none' ) {
isCollapsed = true;
}
}
}
if (isCollapsed) {
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {
NavChild.style.display = 'none';
}
}
}
var NavToggleText = document.createTextNode(isCollapsed ? NavigationBarShow : NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
for(var j=0; j < NavFrame.childNodes.length; j++) {
if (hasClass(NavFrame.childNodes[j], "NavHead")) {
NavToggle.style.color = NavFrame.childNodes[j].style.color;
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
}
$( createNavigationBarToggleButton );
/** Main Page layout fixes *********************************************************
*
* Description: Adds an additional link to the complete list of languages available.
* Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
*/
if (mw.config.get('wgPageName') == 'Ana_Sayfa' || mw.config.get('wgPageName') == 'Tartışma:Ana_Sayfa')
$(function () {
mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias',
'Tam liste', 'interwiki-completelist', 'Vikipedilerin tam listesi');
}
)
/***** uploadwizard_newusers ********
* Switches in a message for non-autoconfirmed users at [[Wikipedia:Upload]]
*
* Maintainers: [[User:Krimpet]]
****/
function uploadwizard_newusers() {
if (mw.config.get('wgNamespaceNumber') == 4 && mw.config.get('wgTitle') == "Yükle" && mw.config.get('wgAction') == "view") {
var oldDiv = document.getElementById("autoconfirmedusers"),
newDiv = document.getElementById("newusers");
if (oldDiv && newDiv) {
if (typeof mw.config.get('wgUserGroups') == "object" && mw.config.get('wgUserGroups')) {
for (i = 0; i < mw.config.get('wgUserGroups').length; i++) {
if (mw.config.get('wgUserGroups')[i] == "autoconfirmed") {
oldDiv.style.display = "block";
newDiv.style.display = "none";
return;
}
}
}
oldDiv.style.display = "none";
newDiv.style.display = "block";
return;
}
}
}
$(uploadwizard_newusers);
// -------------------------------------------------------------------------------
// Force Preview JavaScript code - Start
//
// To allow any group to bypass being forced to preview,
// enter the group name in the permittedGroups array.
// E.g.
// var permittedGroups = []; // force everyone
// var permittedGroups = [ "user"]; // permit logged-in users
// var permittedGroups = [ "sysop", "bureaucrat"]; // permit sysop, bureaucrat
// -------------------------------------------------------------------------------
var permittedGroups = [ "*"];
function forcePreview()
{
if( mw.config.get('wgAction') != "edit") return;
if( mw.config.get('wgUserGroups') === null) {
mw.config.set('wgUserGroups', []);
}
if ( mw.config.get( "wgUserGroups" ).filter(function(group) {
return permittedGroups.indexOf(group) > -1;
}).length ) return;
var saveButton = document.getElementById("wpSave");
if( !saveButton )
return;
saveButton.disabled = true;
saveButton.value = "Sayfayı kaydet";
saveButton.style.fontWeight = "normal";
document.getElementById("wpPreview").style.fontWeight = "bold";
}
$(forcePreview);
// -----------------------------------------------------
// Force Preview JavaScript code - End
// -----------------------------------------------------
// Sidebar Değişiklikleri
function ModifySidebar(action, section, name, link) {
try {
switch (section) {
case "diğer diller":
var target = "p-lang";
break;
case "araçlar":
var target = "p-tb";
break;
case "gezinti":
var target = "p-navigation";
break;
default:
var target = "p-" + section;
break;
}
if (action == "add") {
var node = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var aNode = document.createElement('a');
var liNode = document.createElement('li');
aNode.appendChild(document.createTextNode(name));
aNode.setAttribute('href', link);
liNode.appendChild(aNode);
liNode.className='plainlinks';
node.appendChild(liNode);
}
if (action == "remove") {
var list = document.getElementById(target)
.getElementsByTagName('div')[0]
.getElementsByTagName('ul')[0];
var listelements = list.getElementsByTagName('li');
for (var i = 0; i < listelements.length; i++) {
if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
listelements[i].getElementsByTagName('a')[0].href == link) {
list.removeChild(listelements[i]);
}
}
}
} catch(e) {
// lets just ignore what's happened
return;
}
}
function CustomizeModificationsOfSidebar() {
//removes [[Özel:Yükle]] from toolbox
ModifySidebar("remove", "araçlar", "Dosya yükle", "//tr.wikipedia.org/wiki/Özel:Yükle");
//adds [[Vikipedi:Yükle]] to toolbox
ModifySidebar("add", "araçlar", "Dosya yükle", "//tr.wikipedia.org/wiki/Vikipedi:Yükle");
}
$(CustomizeModificationsOfSidebar);
/**
* Şablon:Kaydırmalı galeri için
*/
function toggleImage(group, remindex, shwindex) {
document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
}
function ImageGroup(){
if (document.URL.match(/printable/g)) return;
var divs=document.getElementsByTagName("div");
var i = 0, j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length ; i++) {
if (divs[i].className != "ImageGroup") continue;
UnitNode=undefined;
search=divs[i].getElementsByTagName("div");
for (j = 0; j < search.length ; j++) {
if (search[j].className != "ImageGroupUnits") continue;
UnitNode=search[j];
break;
}
if (UnitNode==undefined) continue;
units=Array();
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
var temp = UnitNode.childNodes[j];
if (['center', 'mw-halign-center'].some(function(className) { return temp.classList.contains(className); })) { units.push(temp); }
}
var wrap;
for (j = 0 ; j < units.length ; j++) {
currentimage=units[j];
wrap = document.createElement('div');
wrap.id = "ImageGroupsGr" + i + "Im" + j;
currentimage.parentNode.insertBefore(wrap, currentimage);
wrap.appendChild(currentimage);
var imghead = document.createElement("div");
var leftlink = document.createElement("a");
var rightlink = document.createElement("a");
if (j != 0) {
leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
leftlink.innerHTML="◀";
}
if (j != units.length - 1) {
rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
rightlink.innerHTML="▶";
}
var comment = document.createElement("tt");
comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
with(imghead) {
style.fontSize="110%";
style.fontweight="bold";
appendChild(leftlink);
appendChild(comment);
appendChild(rightlink);
}
if (units.length>1) wrap.insertBefore(imghead,wrap.childNodes[0]);
if (j != 0) wrap.style.display="none";
}
}
}
$(ImageGroup);
/*************
*** AJAX transclusion table <//meta.wikimedia.org/wiki/User:Pathoschild/Scripts/AJAX_transclusion_table>
*** by [[m:user:Pathoschild]]
*************/
// Documentation:
// - uses tables with class="attable"
function attIntialize() {
/* namespace */
var att = {};
/* find AJAX tables */
att.alltables = document.getElementsByTagName('table'); // all tables
att.tables = new Array(); // AJAX tables
att.count = att.alltables.length; // count all tables
var x = 0; // count AJAX tables
for(var i=0; i<att.count; i++) {
if(att.alltables[i].getAttribute('class')) {
if(att.alltables[i].getAttribute('class').match(/\battable\b/)) {
att.tables[x] = att.alltables[i];
x++;
}
}
}
if(att.tables.length) {
/* array of all att rows */
att.rows = new Array;
/* rebuild tables with tbodies */
att.countTables = att.tables.length;
for(var i=0; i<att.countTables; i++) {
/* get elements */
att.table = att.tables[i];
att.trows = att.table.getElementsByTagName('tr');
att.countRows = att.trows.length;
/* rebuild and fill row array */
att.tbody = document.createElement('tbody');
for(var x=0; x<att.countRows; x++) {
att.countTemp = att.rows.length;
att.rows[att.countTemp] = att.trows[x].cloneNode(true);
att.rows[att.countTemp].setAttribute('id','oldrow_'+att.countTemp);
att.tbody.appendChild(att.rows[att.countTemp]);
}
att.table.innerHTML = '';
att.table.appendChild(att.tbody);
}
/* create template add/show link */
att.shlink = document.createElement('a');
att.shlink.setAttribute('style','font-size:0.9em; cursor:pointer;');
att.shlink.appendChild(document.createTextNode('[göster] '));
/* add show/hide links */
att.countRows = att.rows.length;
for(var i=0; i<att.countRows; i++) {
att.row = att.rows[i];
att.firstCell = att.row.getElementsByTagName('td')[0];
// skip rows with no links or cells
att.link = att.row.getElementsByTagName('a')[0];
if(att.link && att.link.getAttribute('href').match(/^\/wiki/) && att.firstCell) {
att.row.setAttribute('id','oldrow_'+i);
att.newlink = att.shlink.cloneNode(true);
att.newlink.setAttribute('OnClick','attShow('+i+');');
att.newlink.setAttribute('id','attlink_'+i);
att.firstCell.insertBefore(att.newlink,att.firstCell.firstChild);
}
}
}
}
function attShow(id) {
/* get elements */
var att = {};
att.row = document.getElementById('oldrow_'+id);
att.tbody = att.row.parentNode;
/* build display row */
att.colspan = att.row.getElementsByTagName('td').length;
att.newrow = document.createElement('tr');
att.newrow.setAttribute('id','newrow_'+id);
att.newcell = document.createElement('td');
att.newcell.setAttribute('colspan',att.colspan);
att.newbox = document.createElement('div');
att.newbox.setAttribute('style','margin:0.5em; padding:0.5em; border:2px solid gray;');
att.loader = document.createElement('img');
att.loader.setAttribute('src','//upload.wikimedia.org/wikipedia/commons/d/d2/Spinning_wheel_throbber.gif');
att.newbox.appendChild(att.loader);
att.newcell.appendChild(att.newbox);
att.newrow.appendChild(att.newcell);
att.tbody.insertBefore(att.newrow,att.row.nextSibling);
/* get title */
att.links = att.row.getElementsByTagName('a');
att.count = att.links.length;
for(var i=0; i<att.count; i++) {
if(att.links[i].getAttribute('title')) {
att.title = att.links[i].getAttribute('title');
break;
}
}
att.query = sajax_init_object();
att.url = mw.config.get('wgServer')+'/wiki/'+att.title+'?action=render';
att.query.open('GET',att.url,true);
att.query.send('');
att.query.onreadystatechange = function() {
if(att.query.readyState==4) {
if(att.query.status==200) {
att.newbox.innerHTML = att.query.responseText;
}
else {
att.loader.setAttribute('img','//upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Achtung.svg/32px-Achtung.svg.png');
}
}
}
/* update show/hide link */
att.shlink = document.getElementById('attlink_'+id);
att.shlink.innerHTML = '[gizle] ';
att.shlink.setAttribute('OnClick','attHide('+id+');');
}
function attHide(id) {
/* get elements */
var att = {};
att.row = document.getElementById('newrow_'+[id]);
att.shlink = document.getElementById('attlink_'+id);
/* remove display row */
att.row.parentNode.removeChild(att.row);
/* update show/hide link */
att.shlink.innerHTML = '[göster] ';
att.shlink.setAttribute('OnClick','attShow('+id+');');
}
if(!location.href.match('disableatt=true')) {
attIntialize();
}
/**
* Déplacement des [modifier]
*
* Correction des titres qui s'affichent mal en raison de limitations dues à MediaWiki.
* Ce script devrait pouvoir être supprimé lorsque le [[bugzilla:11555]] sera résolu (comportement équivalent)
*
* Copyright 2006, Marc Mongenet. Licence GPL et GFDL.
*
* The function looks for <span class="editsection">, and move them
* at the end of their parent and display them inline in small font.
* var oldEditsectionLinks=true disables the function.
*/
function setModifySectionStyle()
{
var process = function(list)
{
for(var i=0;i!=list.length;i++)
{
var span=list[i].firstChild
if (span.className == "editsection")
{
span.style.fontSize = "xx-small";
span.style.fontWeight = "normal";
span.style.cssFloat = span.style.styleFloat = "none";
span.parentNode.appendChild(document.createTextNode(" "));
span.parentNode.appendChild(span);
}
}
}
try
{
if (!(typeof oldEditsectionLinks == 'undefined' || oldEditsectionLinks == false)) return;
process(document.getElementsByTagName("h2"));
process(document.getElementsByTagName("h3"));
process(document.getElementsByTagName("h4"));
process(document.getElementsByTagName("h5"));
process(document.getElementsByTagName("h6"));
}
catch (e) { }
}
$(setModifySectionStyle);
//******************************************************************
// Ana Sayfadaki Metabox için gereken kod. İlk fırsatta muadili bulunacak
//******************************************************************
/* Funcionament de la Plantilla:Metacaixa
Implementat per: Usuari:Peleguer.
Actualitzat per Joanjoc seguint les indicacions d'en Martorell
*/
function MetaCaixaInit(){
//S'executa al carregar-se la pàgina, si hi ha metacaixes,
// s'assignen els esdeveniments als botons
//alert("MetaCaixaInit");
var i=0 //Inicialitzem comptador de caixes
for (i=0;i<=9;i++){
var vMc = document.getElementById("mc"+i);
if (!vMc) break;
//alert("MetaCaixaInit, trobada Metacaixa mc"+i);
var j=1 //Inicialitzem comptador de botons dins de la caixa
var vPsIni = 0 //Pestanya visible inicial
for (j=1;j<=9;j++){
var vBt = document.getElementById("mc"+i+"bt"+j);
if (!vBt) break;
//alert("MetaCaixaInit, trobat botó mc"+i+"bt"+j);
vBt.onclick = MetaCaixaMostraPestanya; //A cada botó assignem l'esdeveniment onclick
//alert (vBt.className);
if (vBt.className=="mcBotoSel") vPsIni=j; //Si tenim un botó seleccionat, en guardem l'index
}
//alert ("mc="+i+", ps="+j+", psini="+vPsIni );
if (vPsIni == 0) { //Si no tenim cap botó seleccionat, n'agafem un aleatòriament
vPsIni = 1+Math.floor((j-1)*Math.random()) ;
//alert ("Activant Pestanya a l'atzar; _mc"+i+"bt"+vPsIni +"_");
document.getElementById("mc"+i+"ps"+vPsIni).style.display = "block";
document.getElementById("mc"+i+"ps"+vPsIni).style.visibility = "visible";
document.getElementById("mc"+i+"bt"+vPsIni).className="mcBotoSel";
}
}
}
function MetaCaixaMostraPestanya(){
//S'executa al clicar una pestanya,
//aquella es fa visible i les altres s'oculten
var vMcNom = this.id.substr(0,3); //A partir del nom del botó, deduïm el nom de la caixa
var vIndex = this.id.substr(5,1); //I l'index
var i=1
for (i=1;i<=9;i++){ //busquem totes les pestanyes d'aquella caixa
//alert(vMcNom+"ps"+i);
var vPsElem = document.getElementById(vMcNom+"ps"+i);
if (!vPsElem) break;
if (vIndex==i){ //Si és la pestanya bona la mostrem i canviem la classe de botó
vPsElem.style.display = "block";
vPsElem.style.visibility = "visible";
document.getElementById(vMcNom+"bt"+i).className="mcBotoSel";
} else { //Sinó, l'ocultem i canviem la classe de botó
vPsElem.style.display = "none";
vPsElem.style.visibility = "hidden";
document.getElementById(vMcNom+"bt"+i).className="mcBoto";
}
}
return false; //evitem la recàrrega de la pàgina
}
$(MetaCaixaInit);
//</nowiki>