„Benutzer:CyRoXX/monobook.js“ – Versionsunterschied
Erscheinungsbild
Inhalt gelöscht Inhalt hinzugefügt
CyRoXX (Diskussion | Beiträge) K nowikis; zum testen ein ersetzungsfall en -> de: User -> Benutzer |
CyRoXX (Diskussion | Beiträge) K replace erzeugt nur werte, diese müssen noch aufgefangen werden |
||
| Zeile 211: | Zeile 211: | ||
//testweise Ersetzung |
//testweise Ersetzung |
||
realTitleText.replace(/^User:/, "Benutzer:"); |
realTitleText = realTitleText.replace(/^User:/, "Benutzer:"); |
||
realTitleHTML.replace(/^User:/, "Benutzer:"); |
realTitleHTML = realTitleHTML.replace(/^User:/, "Benutzer:"); |
||
var h1 = document.getElementsByTagName("h1")[0]; |
var h1 = document.getElementsByTagName("h1")[0]; |
||
Version vom 3. Januar 2007, 01:57 Uhr
//<nowiki>
// Nuetzliche Skripte gibts auch unter:
// http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts
//***********************************************************************
// Marks admins with something
// by [[:de:User:Spongo]]
// 28. Dez. 2005
//***********************************************************************
var markadmin = true;
var UrlParameters = new Array ();
readparams();
document.write('<SCRIPT SRC=\'http://tools.wikimedia.de/~aka/dewiki_admins.txt\'><\/SCRIPT>');
function MarkAdmins(){
if (markadmin){
var langUser = "Benutzer:"; // in German 'Benutzer:'
var aMark = document.createElement("b");
var aMarkText = document.createTextNode(" (A)"); // dieser Text wird hinter dem Namen des Admins angefügt (Standard: "(A)")
aMark.appendChild(aMarkText);
var ishistory = (UrlParameters['action']=='history');
var isdiskussion = (((document.URL.indexOf('Spezial:Recentchanges') > 0)) || (document.URL.indexOf('Diskussion') > 0) || (document.URL.indexOf('Wikipedia') > 0));
var searchExp = /.wiki.Benutzer.(.+)/;
if (ishistory || isdiskussion || ((UrlParameters['diff']>'') && (UrlParameters['oldid']>''))) {
for (var i=0; aNode = document.getElementsByTagName("a")[i]; i++) {
// if it's a link to an user
if ( (href = aNode.getAttribute("href")) && (href.search("/wiki/" + langUser) != -1) ) {
currUser = searchExp.exec(href)[1];
// is this user an admin?
for (var k=0; k < admins.length; ++k){
if (currUser == admins[k]){
aNode.appendChild(aMark.cloneNode(true));
break;
}
}
}
}
}
}
}
//******************************************
function readparams () {
var asReadInUrlParameters;
var asReadInUrlParameter;
// Get URL parameters
asReadInUrlParameters = location.search.substring(1, location.search.length).split("&");
for (i = 0; i < asReadInUrlParameters.length; i++) {
asReadInUrlParameter = asReadInUrlParameters[i].split("=");
UrlParameters[decodeURIComponent(asReadInUrlParameter[0])] = decodeURIComponent(asReadInUrlParameter[1]);
}
} //function readparams
//******************************************
addOnloadHook(MarkAdmins);
//***********************************************************************
// Google-Link
//***********************************************************************
function addLink(where, url, name, id, title, key, after){
//* where is the id of the toolbar where the button should be added;
// i.e. one of "p-cactions", "p-personal", or "p-navigation".
//* url is the URL which will be called when the button is clicked.
// javascript: urls can be used to do more complex things.
//* name is what will appear as the name of the button.
//* id is the id of the button; it's best to define one.
// Use a prefix to make sure its unique. Optional.
//* title is the tooltip title that gives a longer description
// of the button; if you define a accesskey, mention it here. Optional.
//* key is the char you want for the accesskey. Optional.
//* after is the id of the button you want to follow this one. Optional.
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);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
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;
}
addOnloadHook(function () { // add onload handler using code from wikibits.js
var title;
if (!(title = document.getElementById('t-whatlinkshere') )) return;
if (!(title = title.getElementsByTagName('a')[0] )) return;
if (!(title = title.href )) return;
if (!(title = title.replace(/^.*title=Spezial:Whatlinkshere&target=/, '') )) return;
if (!(title = title.replace(/^(Diskussion|Benutzer|Wikipedia|Bild|MediaWiki|Vorlage|Hilfe|Kategorie|Portal)(_Diskussion)?:/, '') )) return;
if (!(title = title.replace(/("|%22)/g, '') )) return;
if (!(title = title.replace(/_/g, '%20') )) return;
//===jetzt kommt endlich der Google Link====
addLink('p-tb', 'http://www.google.com/search?q=%22'+title+'%22%20-Wikipedia&ie=utf-8&oe=utf-8',
'Google', 't-googlesearch', 'Suche bei Google nach "'+decodeURIComponent(title)+'"', 'G', null);
//=========Link fuer Interwiki-Suche ==============================
addLink('p-tb', 'http://vs.aka-online.de/cgi-bin/globalwpsearch.pl?search='+title+'&timeout=120&minor=0',
'GlobalWPSearch', 't-interwikisearch', 'Suche bei GlobalWPSearch nach "'+decodeURIComponent(title)+'"', 'I', null);
//=========Link fuer Logs =======================================
addLink('p-tb', 'http://de.wikipedia.org/w/index.php?title=Spezial%3ALog&type=&user=&page='+title,
'Logbücher', 't-logsearch', 'Suche in den Logbüchern nach "'+decodeURIComponent(title)+'"', 'L', null);
}); //===Ende der Funktion=====
//***********************************************************************
// externISBN
//
// Beim Klicken auf einen ISBN-Link landet man nicht auf der WP-Seite mit
// weiterführenden Links, sondern auf der Online-Preisvergleichsseite von
// Bookbutler.de.
//
// Vorlage für diese Funktion: Skript auf en:Wikipedia:WikiProject User scripts/Scripts
// (war ursprünglich Direktlink auf Amazon)
//***********************************************************************
function externISBN() {
for (var i = 0; i < document.links.length; i++)
{
var ln = document.links[i].href.match(/isbn=(.*)/);
if (ln) {
document.links[i].href='http://www.bookbutler.de/vergleich/wps/'+RegExp.$1;
}
}
}
addOnloadHook(externISBN);
// [[:en:User:Lupin/popups.js]]
// Main page in English: [[:en:Wikipedia:Tools/Navigation Popups]]
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>');
//***********************************************************************
/** "Technical restrictions" title fix *****************************************
*
* Description:
* Maintainers: [[User:Interiot]], [[User:Mets501]]
*/
// For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.
// (for instance [[iPod]]'s title is updated. <nowiki>But [[C#]] is not an equivalent wikilink, so [[C Sharp]] doesn't have its main title changed)</nowiki>
//
// The function looks for a banner like this: <nowiki>
// <div id="RealTitleBanner"> <!-- div that gets hidden -->
// <span id="RealTitle">title</span>
// </div>
// </nowiki>An element with id=DisableRealTitle disables the function.
var disableRealTitle = 0; // users can disable this by making this true from their monobook.js
editprefix = "Bearbeiten von ";
//if (wgIsArticle) { // don't display the RealTitle when editing, since it is apparently inconsistent (doesn't show when editing sections, doesn't show when not previewing)
addOnloadHook(function() {
try {
var realTitleBanner = document.getElementById("RealTitleBanner");
if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
var realTitle = document.getElementById("RealTitle");
if (realTitle) {
var realTitleHTML = realTitle.innerHTML;
realTitleText = pickUpText(realTitle);
var isPasteable = 0;
//var containsHTML = /</.test(realTitleHTML); // contains ANY HTML
var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
// calculate whether the title is pasteable
var verifyTitle = realTitleText.replace(/^ +/, ""); // trim left spaces
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
// if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.
if (wgNamespaceNumber != 0) {
if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") {
verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1);
} else {
realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText;
realTitleHTML = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleHTML;
}
}
// verify whether wgTitle matches
verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, ""); // trim left and right spaces
verifyTitle = verifyTitle.replace(/_/g, " "); // underscores to spaces
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
isPasteable = (verifyTitle == wgTitle);
// Add the 'editprefix' to the titles, if wgIsArticle is false
if (!wgIsArticle) {
realTitleText = editprefix + realTitleText;
realTitleHTML = editprefix + realTitleHTML;
}
// replace the English canonical Namespaces by the German Namespaces
var enNS = new Array("Media", "Special", "Talk", "User", "User talk", "Project", "Project talk", "Image", "Image talk", "MediaWiki", "MediaWiki talk", "Template", "Template talk", "Help", "Help talk", "Category", "Category talk", "Portal", "Portal talk");
var deNS = new Array("Media", "Spezial", "Diskussion", "Benutzer", "Benutzer Diskussion", "Wikipedia", "Wikipedia Diskussion", "Bild", "Bild Diskussion", "MediaWiki", "MediaWiki Diskussion", "Vorlage", "Vorlage Diskussion", "Hilfe", "Hilfe Diskussion", "Kategorie", "Kategorie Diskussion", "Portal", "Portal Diskussion");
//testweise Ersetzung
realTitleText = realTitleText.replace(/^User:/, "Benutzer:");
realTitleHTML = realTitleHTML.replace(/^User:/, "Benutzer:");
var h1 = document.getElementsByTagName("h1")[0];
if (h1 && isPasteable) {
h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
if (!containsTooMuchHTML)
realTitleBanner.style.display = "none";
}
document.title = realTitleText + " - Wikipedia";
}
}
} catch (e) {
/* Something went wrong. */
}
});
//}
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML
function pickUpText(aParentElement) {
var str = "";
function pickUpTextInternal(aElement) {
var child = aElement.firstChild;
while (child) {
if (child.nodeType == 1) // ELEMENT_NODE
pickUpTextInternal(child);
else if (child.nodeType == 3) // TEXT_NODE
str += child.nodeValue;
child = child.nextSibling;
}
}
pickUpTextInternal(aParentElement);
return str;
}
//********Ende erzwungener kleiner Anfangsbuchstabe*********************
//***********************************************************************
// APPER's Rechtschreibprüfung (Benutzer:APPER bzw. Benutzer:APPER)
//***********************************************************************
//document.write('<SCRIPT SRC="http://de.wikipedia.org/w/index.php?title=Benutzer:APPER/RP/js&action=raw&ctype=text/javascript"><\/SCRIPT>');
//</nowiki>