Benutzer:Ricardo02/monobook.js: Unterschied zwischen den Versionen

Aus ConanWiki
Zur Navigation springen Zur Suche springen
Inhalt hinzugefügt Inhalt gelöscht
Keine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Zeile 2: Zeile 2:
 
+ 'MediaWiki:Gadget-Extra-Editbuttons.js&action=raw&ctype=text/javascript"><\/script>')
 
+ 'MediaWiki:Gadget-Extra-Editbuttons.js&action=raw&ctype=text/javascript"><\/script>')
 
var rmEditButtons = [6,7,10]
 
var rmEditButtons = [6,7,10]
customEditButtons = "R1,T,H,K"
+
customEditButtons = "A3,R1,T,H,K"
  +
/*
  +
Integration vieler externer Hilfsfunktionen vor allem des Toolservers in die Oberfläche der Wikipedia
  +
mittels zusätzlicher Karteireiter an geeigneten Stellen abhängig vom Kontext der gerade dargestellten
  +
Seite (Artikel, Bildseite, Benutzerseite, Kategorie...).
  +
Dieses Skript basiert auf http://commons.wikimedia.org/wiki/MediaWiki:Extra-tabs.js, welches dort für
  +
die Toolserverintegration sorgt, siehe http://de.wikipedia.org/wiki/Wikipedia:Helferlein/Toolserver-Integration.
  +
  +
Dieses Skript wurde mit Konqueror 3.5 and Firefox 1.5 getesten. Opera und Internet Explorer werden
  +
ebenfalls unterstützt. Bitte Ergänzungen sorgfältig testen (Skripte, die nur im Firefox laufen, sind
  +
blöd!)
  +
*/
  +
  +
// works only in monobook skin
  +
if (skin == 'monobook')
  +
{
  +
  +
// project URL without protocol handler
  +
var tab_project = wgServer.replace("http://", "");
  +
var tab_language = tab_project.split(".")[0];
  +
var tab_base = tab_project.split(".")[1];
  +
  +
// 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 = 'Datei:';
  +
var tab_ns_user = 'Benutzer:';
  +
var tab_ns_special = 'Spezial:';
  +
  +
// Interface strings, translations get defined in the /<ISO-Code> sub pages
  +
var tab_fist = 'image search';
  +
var tab_check_usage = 'check usage';
  +
var tab_log = 'log';
  +
var tab_gallery = 'gallery';
  +
var tab_orphans = 'orphans';
  +
var tab_untagged = 'untagged';
  +
var tab_catscan = 'CatScan';
  +
var tab_diff = 'diff to me';
  +
var tab_mediasearch = 'file overview';
  +
var tab_commonshelper = 'move to Commons';
  +
var tab_templatetiger = 'evaluation';
  +
var tab_wscan = 'new copyvio candidates';
  +
var tab_autoreviewer = 'troubleshooting';
  +
  +
document.write('<script type="text/javascript" src="' + wgScript + '?title='
  +
+ 'MediaWiki:Gadget-toolserver-integration.js/' + wgUserLanguage
  +
+ '&action=raw&ctype=text/javascript"><\/script>');
  +
  +
function 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 add_article_tabs(article)
  +
{
  +
append_tab('http://toolserver.org/~magnus/fist.php?doit=1&language=' + tab_language + '&project=' + tab_base + '&data=' + article + '&datatype=articles&params[catdepth]=0&params[random]=50&params[ll_max]=5&params[free_only]=1&params[commons_max]=5&params[commonsense]=on' + '&params[flickr_max]=5&params[flickr_new_name_from_article]=1&params[wts_max]=5&params[gimp_max]=5&params[esp_max]=5&params[esp_skip_flickr]=1' + '&params[forarticles]=all&params[lessthan_images]=3&params[jpeg]=1&params[png]=1&params[gif]=1&params[svg]=1&params[min_width]=80' + '&params[min_height]=80&sources[languagelinks]=1&sources[commons]=1&sources[flickr]=1&sources[wts]=1&sources[gimp]=1&sources[everystockphoto]=1', tab_fist, 'ca-fist');
  +
  +
append_tab('http://toolserver.org/~timl/cgi-bin/wikilint?url=' + wgServer + '/wiki/' + article + '&remove_century=ON&do_typo_check=ON&l=' + tab_language + '&Go%21=Go%21&.cgifields=rnd&.cgifields=testpage&.cgifields=remove_century&.cgifields=do_typo_check', tab_autoreviewer, 'ca-autoreviewer');
  +
}
  +
  +
function add_image_tabs(imagetitle)
  +
{
  +
// show only if local image
  +
if (wgArticleId != 0)
  +
{
  +
// TODO: add '&reallydirectupload=1' when commonshelper provides a preview prior to direct upload
  +
append_tab('http://toolserver.org/~magnus/commonshelper.php?interface=' + wgUserLanguage + '&language=' + tab_language + '&image=' + imagetitle + '&newname=&project=' + tab_base + '&username=&commonsense=1&doit=Get+text' , tab_commonshelper, 'ca-commonshelper');
  +
}
  +
  +
append_tab('http://toolserver.org/~daniel/WikiSense/CheckUsage.php?i=' + imagetitle + '&w=_100000', tab_check_usage, 'ca-checkusage');
  +
append_tab('/w/index.php?title=' + tab_ns_special + 'Log&page=' + tab_ns_image + imagetitle, tab_log, 'ca-log');
  +
}
  +
  +
function add_template_tabs(template)
  +
{
  +
append_tab('http://toolserver.org/~kolossos/templatetiger/tt-table4.php?lang=' + tab_language + '&template=' + template + '&offset=0&limit=30' , tab_templatetiger, 'ca-templatetiger');
  +
}
  +
  +
function add_user_tabs(username)
  +
{
  +
append_tab('http://toolserver.org/~daniel/WikiSense/Gallery.php?wiki=' + tab_project + '&img_user_text=' + username , tab_gallery, 'ca-gallery');
  +
append_tab('http://toolserver.org/~daniel/WikiSense/OrphanImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_orphans, 'ca-orphans');
  +
append_tab('http://toolserver.org/~daniel/WikiSense/UntaggedImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_untagged, 'ca-untagged');
  +
}
  +
  +
function add_category_tabs(category)
  +
{
  +
append_tab('http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php?wiki=' + tab_project + '&basecat=' + category , tab_catscan, 'ca-catscan');
  +
}
  +
  +
function add_special_tabs()
  +
{
  +
switch(wgCanonicalSpecialPageName)
  +
{
  +
case 'Contributions':
  +
var username = document.getElementById('contentSub').getElementsByTagName('a')[0].firstChild.nodeValue;
  +
add_user_tabs(username);
  +
break;
  +
case 'Newpages':
  +
case 'Recentchanges':
  +
append_tab('http://toolserver.org/~revvar/urv.php' , tab_wscan, 'ca-wscan');
  +
break;
  +
default:
  +
// nothing
  +
}
  +
}
  +
  +
function add_default_tabs(title)
  +
{
  +
append_tab('http://toolserver.org/~daniel/WikiSense/MyDiff.php?wiki=' + tab_project + '&title=' + title + '&user=' + wgUserName, tab_diff, 'ca-mydiff');
  +
}
  +
  +
function do_onload()
  +
{
  +
// show tabs only on certain user actions
  +
switch(wgAction)
  +
{
  +
case 'view':
  +
case 'edit':
  +
case 'submit':
  +
// title without namespace name
  +
var title = wgTitle;
  +
// Namespace numbers are (see [[m:Help:Variables]]):
  +
// -1: Special
  +
// 2: User
  +
// 3: User_talk
  +
// 6: Image
  +
// 7: Image_talk
  +
// 14: Category
  +
switch(wgNamespaceNumber)
  +
{
  +
case -1:
  +
// Tabs not useful for anon users (IPs). On contributions we can grab the (de.wikipedia custom)
  +
// [[MediaWiki:Sp-contributions-footer-anon]] id in order to determine if it is an anon user or not.
  +
if (!document.getElementById('sp-contributions-footer-anon'))
  +
{
  +
add_special_tabs();
  +
}
  +
break;
  +
case 0:
  +
add_article_tabs(title);
  +
break;
  +
case 2:
  +
case 3:
  +
// Tabs not useful for anon users (IPs). On user pages we can check if the log link (t-log id) exists.
  +
// Anon (and not existing, aka "fake") users don't have a toolbox link into the log.
  +
if (document.getElementById('t-log'))
  +
{
  +
add_user_tabs(title);
  +
}
  +
break;
  +
case 6:
  +
case 7:
  +
add_image_tabs(title);
  +
break;
  +
case 10:
  +
add_template_tabs(title);
  +
break;
  +
case 14:
  +
add_category_tabs(title);
  +
break;
  +
default:
  +
// nothing
  +
}
  +
break;
  +
  +
case 'history':
  +
// title with namespace name
  +
title = wgPageName;
  +
switch(wgNamespaceNumber)
  +
{
  +
case -1:
  +
break;
  +
default:
  +
add_default_tabs(title);
  +
}
  +
break;
  +
  +
default:
  +
// nothing;
  +
}
  +
}
  +
  +
addOnloadHook( do_onload );
  +
  +
}

Version vom 1. März 2010, 16:46 Uhr

document.write('<script type="text/javascript" src="http://de.wikipedia.org/w/index.php?title='
     + 'MediaWiki:Gadget-Extra-Editbuttons.js&action=raw&ctype=text/javascript"><\/script>')
var rmEditButtons = [6,7,10]
customEditButtons = "A3,R1,T,H,K"
/*
  Integration vieler externer Hilfsfunktionen vor allem des Toolservers in die Oberfläche der Wikipedia
  mittels zusätzlicher Karteireiter an geeigneten Stellen abhängig vom Kontext der gerade dargestellten
  Seite (Artikel, Bildseite, Benutzerseite, Kategorie...).
  Dieses Skript basiert auf http://commons.wikimedia.org/wiki/MediaWiki:Extra-tabs.js, welches dort für
  die Toolserverintegration sorgt, siehe http://de.wikipedia.org/wiki/Wikipedia:Helferlein/Toolserver-Integration.
 
  Dieses Skript wurde mit Konqueror 3.5 and Firefox 1.5 getesten. Opera und Internet Explorer werden
  ebenfalls unterstützt. Bitte Ergänzungen sorgfältig testen (Skripte, die nur im Firefox laufen, sind
  blöd!)
*/
 
// works only in monobook skin
if (skin == 'monobook')
{
 
// project URL without protocol handler
var tab_project = wgServer.replace("http://", "");
var tab_language = tab_project.split(".")[0];
var tab_base = tab_project.split(".")[1];
 
// 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 = 'Datei:';
var tab_ns_user = 'Benutzer:';
var tab_ns_special = 'Spezial:';
 
// Interface strings, translations get defined in the /<ISO-Code> sub pages
var tab_fist = 'image search';
var tab_check_usage = 'check usage';
var tab_log = 'log';
var tab_gallery = 'gallery';
var tab_orphans = 'orphans';
var tab_untagged = 'untagged';
var tab_catscan = 'CatScan';
var tab_diff = 'diff to me';
var tab_mediasearch = 'file overview';
var tab_commonshelper = 'move to Commons';
var tab_templatetiger = 'evaluation';
var tab_wscan = 'new copyvio candidates';
var tab_autoreviewer = 'troubleshooting';
 
document.write('<script type="text/javascript" src="' + wgScript + '?title='
  + 'MediaWiki:Gadget-toolserver-integration.js/' + wgUserLanguage 
  + '&action=raw&ctype=text/javascript"><\/script>');
 
function 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 add_article_tabs(article)
{
  append_tab('http://toolserver.org/~magnus/fist.php?doit=1&language=' + tab_language + '&project=' + tab_base + '&data=' + article + '&datatype=articles&params[catdepth]=0&params[random]=50&params[ll_max]=5&params[free_only]=1&params[commons_max]=5&params[commonsense]=on' + '&params[flickr_max]=5&params[flickr_new_name_from_article]=1&params[wts_max]=5&params[gimp_max]=5&params[esp_max]=5&params[esp_skip_flickr]=1' + '&params[forarticles]=all&params[lessthan_images]=3&params[jpeg]=1&params[png]=1&params[gif]=1&params[svg]=1&params[min_width]=80' + '&params[min_height]=80&sources[languagelinks]=1&sources[commons]=1&sources[flickr]=1&sources[wts]=1&sources[gimp]=1&sources[everystockphoto]=1', tab_fist, 'ca-fist');
 
  append_tab('http://toolserver.org/~timl/cgi-bin/wikilint?url=' + wgServer + '/wiki/' + article + '&remove_century=ON&do_typo_check=ON&l=' + tab_language + '&Go%21=Go%21&.cgifields=rnd&.cgifields=testpage&.cgifields=remove_century&.cgifields=do_typo_check', tab_autoreviewer, 'ca-autoreviewer');
}
 
function add_image_tabs(imagetitle)
{
  // show only if local image
  if (wgArticleId != 0)
  {
    // TODO: add '&reallydirectupload=1' when commonshelper provides a preview prior to direct upload 
    append_tab('http://toolserver.org/~magnus/commonshelper.php?interface=' + wgUserLanguage + '&language=' + tab_language + '&image=' + imagetitle + '&newname=&project=' + tab_base + '&username=&commonsense=1&doit=Get+text' , tab_commonshelper, 'ca-commonshelper');
  }
 
  append_tab('http://toolserver.org/~daniel/WikiSense/CheckUsage.php?i=' + imagetitle + '&w=_100000', tab_check_usage, 'ca-checkusage');
  append_tab('/w/index.php?title=' + tab_ns_special + 'Log&page=' + tab_ns_image + imagetitle, tab_log, 'ca-log');
}
 
function add_template_tabs(template)
{
  append_tab('http://toolserver.org/~kolossos/templatetiger/tt-table4.php?lang=' + tab_language + '&template=' + template + '&offset=0&limit=30' , tab_templatetiger, 'ca-templatetiger');
}
 
function add_user_tabs(username)
{
  append_tab('http://toolserver.org/~daniel/WikiSense/Gallery.php?wiki=' + tab_project + '&img_user_text=' + username , tab_gallery, 'ca-gallery');
  append_tab('http://toolserver.org/~daniel/WikiSense/OrphanImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_orphans, 'ca-orphans');
  append_tab('http://toolserver.org/~daniel/WikiSense/UntaggedImages.php?wiki=' + tab_project + '&img_user_text=' + username , tab_untagged, 'ca-untagged');
}
 
function add_category_tabs(category)
{
  append_tab('http://toolserver.org/~daniel/WikiSense/CategoryIntersect.php?wiki=' + tab_project + '&basecat=' + category , tab_catscan, 'ca-catscan');
}
 
function add_special_tabs()
{
  switch(wgCanonicalSpecialPageName)
  {
    case 'Contributions':
      var username = document.getElementById('contentSub').getElementsByTagName('a')[0].firstChild.nodeValue;
      add_user_tabs(username);
      break;
    case 'Newpages':
    case 'Recentchanges':
      append_tab('http://toolserver.org/~revvar/urv.php' , tab_wscan, 'ca-wscan');
      break;
    default:
      // nothing
  }
}
 
function add_default_tabs(title)
{
  append_tab('http://toolserver.org/~daniel/WikiSense/MyDiff.php?wiki=' + tab_project + '&title=' + title + '&user=' + wgUserName, tab_diff, 'ca-mydiff');
}
 
function do_onload()
{
  // show tabs only on certain user actions
  switch(wgAction)
  {
    case 'view':
    case 'edit':
    case 'submit':
      // title without namespace name
      var title = wgTitle;
      // Namespace numbers are (see [[m:Help:Variables]]):
      // -1: Special
      // 2:  User
      // 3:  User_talk
      // 6:  Image
      // 7:  Image_talk
      // 14: Category
      switch(wgNamespaceNumber)
      {
        case -1:
          // Tabs not useful for anon users (IPs). On contributions we can grab the (de.wikipedia custom)
          // [[MediaWiki:Sp-contributions-footer-anon]] id in order to determine if it is an anon user or not.
          if (!document.getElementById('sp-contributions-footer-anon'))
          {
            add_special_tabs();
          }
          break;
        case 0:
          add_article_tabs(title);
          break;
        case 2:
        case 3:
          // Tabs not useful for anon users (IPs). On user pages we can check if the log link (t-log id) exists.
          // Anon (and not existing, aka "fake") users don't have a toolbox link into the log.
          if (document.getElementById('t-log'))
          {
            add_user_tabs(title);
          }
          break;
        case 6:
        case 7:
          add_image_tabs(title);
          break;
        case 10:
          add_template_tabs(title);
          break;
        case 14:
          add_category_tabs(title);
          break;
        default:
          // nothing
      }
      break;
 
    case 'history':
      // title with namespace name
      title = wgPageName;
      switch(wgNamespaceNumber)
      {
        case -1:
          break;
        default:
          add_default_tabs(title);
      }
      break;
 
    default:
      // nothing;
  }
}
 
addOnloadHook( do_onload );
 
}