Nota: Després de desar, heu de netejar la memòria cau del navegador per veure els canvis. En la majoria de navegadors amb Windows o Linux, premeu Ctrl+F5 o bé premeu Shift i cliqueu el botó "Actualitza" (Ctrl i "Actualitza" amb Internet Explorer). Vegeu més informació i instruccions per a cada navegador a Viquipèdia:Neteja de la memòria cau.

/*
 *<pre><nowiki>
 *
 *Obtingut amb el codi &#x7b;{subst:Usuari:Pasqual/p:ViquiestrisAvançats.js}}
 *
 */

/*
#############################################################################################

AVÍS IMPORTANT: No modifiqueu cap línia continguda en este mòdul, excepte "vePropi = true;"
   que permet carregar el mòdul on es podran personalitzar els viquiestris configurant totes
   les opcions. (L'opció per als Viquiestris estàndards és "vePropi = false;"

   També es poden carregar altres mòduls al final del document abans les tres darreres línies.
   Per poder carregar un mòdul afegiu la següent funció indicant entre cometes el servidor, 
   l'usuari i el mòdul. Si els dos primer paràmetres es deixen en blanc el servidor per defecte
   serà "ca.wikipedia.org" i l'usuari "Pasqual". És imprescindible especificar el mòdul.

   per a més informació vegeu [[usuari:Pasqual/Viquiestris/Documentació#carregar mòduls]]
   (http://ca.wikipedia.org/wiki/Usuari:Pasqual/Viquiestris/Documentaci%C3%B3)

#############################################################################################
*/


/********************************************************************************************/
/* ******************************************************************************************/
/* *                                                                                      * */
/* *                                 Carregador de mòduls                                 * */
/* *                        Funció desenvolupada per ca:Usuari:Pasqual                    * */
/* *                                                                                      * */
/* **************************************************************************************** */
/********************************************************************************************/


function carrega (servidor,usuari,mòdul) {
  var lt = String.fromCharCode(60);
  var gt = String.fromCharCode(62);
  var domini = '';

  var llargCad  = servidor.length;
  if (llargCad <= 3 && servidor.indexOf(".") == -1) {
    domini = servidor;
  } else {
    domini=servidor.substring(0,servidor.indexOf("."))
  }

  if (domini == '') domini = 'ca';;
  if (usuari=='') usuari='Pasqual';

  if (domini=='ca' && usuari=='Pasqual' && (mòdul.indexOf("viquiestris") == -1
      && mòdul.indexOf("scripts/") == -1)) {mòdul='scripts/'+mòdul;}

  if (servidor=='') servidor=domini;
  if (servidor.length==2){servidor += '.wikipedia.org';}
  if (mòdul.indexOf(".js") == -1 && mòdul.indexOf(".css") == -1) {mòdul += '.js';}

  if (mòdul.indexOf(".js") > -1) {
    document.writeln(lt+'script type="text/javascript" src="' + 'http://' + servidor
    + '/w/index.php?title=User:' + usuari + '/' + mòdul 
    + '&action=raw&ctype=text/javascript&dontcountme=s"'+gt+lt+'/script'+gt);
  } else if (mòdul.indexOf(".css") > -1) {
    document.writeln(lt+'link rel="stylesheet" type="text/css" href="' 
    + 'http://' + servidor + '/w/index.php?title=User:' + usuari + '/' + mòdul 
    +'&action=raw&ctype=text/css" /'+gt);
  }
}

/********************************************************************************************/
/*                                                                                          */
/*                                       Inicialització                                     */
/*                                                                                          */
/********************************************************************************************/

vePropi = true;                //defecte: TRUE. Amb 'true' es carregarà el vostre mòdul 
                               //".../paràmetres.js" on podreu modificar les diferents
                               //opcions dels Viquiestris. Si trieu 'true' haureu 
                               //de crear el mòdul. Vegeu [[Usuari:Pasqual/viquiestris]]
                               //per a més informació
carrega ("","","viquiestris");
/*
</nowiki></pre>
*/


// Traducció catalana del sistema de popups per [[w:ca:Usuari:SMP]]

// Per a qualsevol dubte, problema o suggeriment sobre la traducció, aneu a [[Usuari Discussió:SMP/strings-ca.js]].

// Versió original anglesa: [[:en:User:Lupin/popups.js]]

 document.write('<script type="text/javascript" src="' 
    + 'http://ca.wikipedia.org/w/index.php?title=User:SMP/strings-ca.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
 document.write('<script type="text/javascript" src="' 
    + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js' 
    + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');


//<pre>
function addlilink(tabs, url, name, id, title, key){
    var na = document.createElement('a');
    na.href = url;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    if(id) li.id = id;
    li.appendChild(na);
    tabs.appendChild(li);
    if(id)
    {
        if(key && title)
        {
            ta[id] = [key, title];
        }
        else if(key)
        {
            ta[id] = [key, ''];
        }
        else if(title)
        {
            ta[id] = ['', title];
        }
    }
    // re-render the title and accesskeys from existing code in wikibits.js
    akeytt();
    return li;
}

// STATUS CHANGER
$(function (){
  var user = document.getElementById( 'pt-userpage' ).firstChild.firstChild.data;
  var subpage = "/Status";
  var scheme = "/StatusTemplate";
  var linkprefix = "http://en.wikipedia.org/w/index.php?title=User:";
  var contribs = document.getElementById( 'pt-mycontris' );
  //Add the links
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=in", "In", "pt-status-in", "I'm in!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=busy", "Busy", "pt-status-busy", "I'm busy!", "");
  addlilink(contribs, linkprefix+user+subpage+"&action=edit&newstatus=out", "Out", "pt-status-out", "I'm out!", "");
  if (location.href.indexOf("&action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
  //Get new status
  statusRegExp = /&action=edit&newstatus=(.*)/;
  status = statusRegExp.exec(location.href)[1];
  //Modify the form
  document.getElementById('wpTextbox1').value = "{{User:"+user+scheme+"|"+status+"}}";
  document.getElementById('wpSummary').value = "Status: "+status;
  document.getElementById('wpMinoredit').checked = 'checked';
  //Submit it!
  document.getElementById('editform').submit();
});

// Revert tools by Lorian
function getElementsByClass(searchClass,node,tag) {
  // Function from http://www.dustindiaz.com/getelementsbyclass/
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}

// _GET code from NoGray JS Library http://www.nogray.com/new_site/
var _GET = new Array();
var _uri = location.href;

var _temp_get_arr = _uri.substring(_uri.indexOf('?')+1, _uri.length).split("&");

var _temp_get_arr_1 = new Array();

for(_get_arr_i=0; _get_arr_i<_temp_get_arr.length; _get_arr_i++){
  _temp_get_arr_1 = _temp_get_arr[_get_arr_i].split("=");
  _GET[decodeURI(_temp_get_arr_1[0])] = decodeURI(_temp_get_arr_1[1]);
}

delete _uri; delete _temp_get_arr; delete _temp_get_arr_1;

function getMessage (where, user1, user2) {
  var message = prompt ('What message would you like to leave?', '');
  window.location = 'http://en.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&'+where+'=2&user1='+user1+'&user2='+user2+'&message='+message;
}

$(function (){
  if (location.href.match(/diff=/)) {
    // Get username of submitter
    var user1 = getElementsByClass('diff-otitle',null,'td'); user1 = user1[0].getElementsByTagName('a')[2].innerHTML;
    var user2 = getElementsByClass('diff-ntitle',null,'td'); user2 = user2[0].getElementsByTagName('a')[2].innerHTML;
    document.getElementById('contentSub').innerHTML = '(<a href="http://en.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&revert=1&user1='+user1+'&user2='+user2+'">Revert</a> / <a href="javascript:var message = getMessage(\'revert\', \''+user1+'\', \''+user2+'\');">Message</a>) (<a href="http://en.wikipedia.org/w/index.php?title=' + _GET['title'] + '&action=edit&oldid=' + _GET['oldid'] + '&vandalism=1&user1='+user1+'&user2='+user2+'">Vandalism</a> / <a href="javascript:var message = getMessage(\'vandalism\', \''+user1+'\', \''+user2+'\');">Message</a>) (Warn: <a href="http://en.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=1">Test</a> / <a href="http://en.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=2">Blatant</a> / <a href="http://en.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=3">Nonsense</a> / <a href="http://en.wikipedia.org/w/index.php?title=User_talk:'+user2+'&action=edit&section=new&warn=4">Blanking</a>)';
  } else if (location.href.match(/revert=1/)) {
    document.getElementById('wpSummary').value = 'Reverted edits by [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] to version ' + _GET['oldid']+' by [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/revert=2/)) {
    document.getElementById('wpSummary').value = 'Reverted edits by [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] to version ' + _GET['oldid']+' by [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=1/)) {
    document.getElementById('wpSummary').value = 'Reverted vandalism by [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] to version ' + _GET['oldid']+' by [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']]';
    document.getElementById('editform').submit();
  } else if (location.href.match(/vandalism=2/)) {
    document.getElementById('wpSummary').value = 'Reverted vandalism by [[Special:Contributions/'+_GET['user2']+'|'+_GET['user2']+']] to version ' + _GET['oldid']+' by [[Special:Contributions/'+_GET['user1']+'|'+_GET['user1']+']] ('+_GET['message']+')';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=1/)) {
    document.getElementById('wpSummary').value = 'Vandalism warning';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:test}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=2/)) {
    document.getElementById('wpSummary').value = 'Vandalism warning';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:blatantvandal}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=3/)) {
    document.getElementById('wpSummary').value = 'Vandalism warning';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:test2}} ~~'+'~~';
    document.getElementById('editform').submit();
  } else if (location.href.match(/warn=4/)) {
    document.getElementById('wpSummary').value = 'Vandalism warning';
    document.getElementById('wpTextbox1').value = '{{sub'+'st:test2a}} ~~'+'~~';
    document.getElementById('editform').submit();
  }
});

if (document.title.indexOf('User:Interiot/Tool2/code.js') != -1) {
  mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Interiot/Tool2/code.js&action=raw&ctype=text/javascript'); }
//</pre>