MediaWiki:Extra-tabs.js

De Wikinoticias, la fuente libre de noticias

Nota: Después de guardar, debes recargar la caché de tu navegador para ver los cambios:

  • Mozilla: Pulsa Recargar (o Ctrl-R)
  • Internet Explorer / Opera: Ctrl-F5
  • Safari: Cmd-R
  • Konqueror Ctrl-R.
/* <source lang="javascript"> Top of Javascript */
// Spanish interface elements for Extra-tabs.js

/* tooltips and access keys */ 
// ==========================================================================
// BEGIN: MediaWiki interface button definition for Duesentrieb's image tools:
// "Check usage", "User image gallery", "Orphaned images of user" and 
// "Untagged images of user".
// If you are located at an "Image:" you get the "check usage" tab, if you
// are at a "User:" page you get the "gallery", "orphans" and "untagged" tab.
// If you are on other pages these tabs do not get shown. These functions are
// enabled in Wikimedia Commons by default via [[Mediawiki:Monobook.js]] and
// its local language subpages.
// This script has been tested with Konqueror 3.5 and Firefox 1.5 and other
// browsers including Opera and Internet Explorer have been reported to work
// as well. If you enhance or change this template please test it previous to
// editing here in your local monobook.js with as many as possible browsers
// (in order not to clash with the function names here change in your local
// monobook.js all "global_" to "local_").
// Be aware that the global JavaScripts do not get updated by the Wikimedia
// servers that fast after saving them.

// written by Dbenbenn, Avatar, Duesentrieb and Arnomane

// Switch for people that don't want the extra tabs.
if (load_extratabs == true && skin == 'monobook')
{

// project URL without protocol handler
var tab_project = mw.config.get('wgServer').replace("http://", "");

// Translations (variables for internationalisation and localisation):

// namespace names (there is only wgCanonicalNamespace variable; although not a
// problem for Commons but for non-english wikis, we make it easier for them
// reusing the script with these variables)
var tab_ns_image = 'Image:';
var tab_ns_user = 'User:';
var tab_ns_special = 'Special:';

var tab_comentarios = 'comentarios';
var tab_volver = 'volver al artículo';

// Appends a new tab.

function global_append_tab(url, name, id)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);
 
  var txt = document.createTextNode(name);
  na.appendChild(txt);
 
  var li = document.createElement('li');
  if(id) li.id = id;
  li.appendChild(na);

  // Grab the element we want to append the tab and append the tab to it.
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
  tabs.appendChild(li);
}

function comentario()
{
  if((!mw.config.get('wgPageName').match('Portada') || mw.config.get('wgTitle') != 'Portada') && wgIsArticle == true ) // si dice Portada o el nombre de la página = al título de la página
  {
  global_append_tab('//es.wikinews.org/w/index.php?title=Talk:' + mw.config.get('wgTitle') + '/Comentarios&preload=Plantilla:Comentarios_preload&editintro=Plantilla:Comentarios_intro&section=new&action=edit', tab_comentarios, 'comentario');
  }
}

function volver()
{
  if(mw.config.get('wgPageName').match('/Comentarios'))
  {
    titulo = mw.config.get('wgTitle').replace('/Comentarios','');
    global_append_tab('//es.wikinews.org/wiki/'+titulo, tab_volver, 'retornar');
  }
}

function global_do_onload()
{
    // title without namespace name. Replacing blanks by underscores
    // is just for beautifying the resulting URL a little bit. The
    // critical part is the call to encodeURIComponent. Without this
    // call, file or user names with "&" in the name won't work, because
    // the ampersand is a parameter delimiter!
    var title = encodeURIComponent (mw.config.get('wgTitle').split (" ").join ("_"));

    // Namespace numbers are (see [[m:Help:Variables]]):
    // -1: Special
    // 2:  User
    // 3:  User_talk
    // 6:  Image
    // 7:  Image_talk
    // 14: Category
    switch(mw.config.get('wgNamespaceNumber'))
    {
        case 0: comentario(); break;
        case 1: volver(); break;
        default: // nothing
    }
}

//$( global_do_onload );

}
// END: MediaWiki interface button definition for Duesentrieb's image tools.
// ========================================================================

// Add the check usage link to the classic skin.
function addCheckUsageLink()
{
 var toc = document.getElementById('filetoc');
 var cu = document.createElement('a');
 var li = document.createElement('li');
 
 cu.setAttribute('href', 'http://tools.wikimedia.de/~daniel/WikiSense/CheckUsage.php?w=_100000&i=' + encodeURIComponent(mw.config.get('wgTitle')));
 cu.textContent = 'check usage';
 li.appendChild(cu);
 toc.appendChild(li);
}
if (mw.config.get('wgNamespaceNumber') == 6 && skin == 'standard')
 $(addCheckUsageLink);

/* Bottom of Javascript </source> */