User:BLueFiSH.as/monobook.js

// Variable um eine je nach Modus differenzierte Ausgabe zu ermöglichen var docURL = document.URL; var pagemode; if     (docURL.indexOf('action=edit') > 0 || docURL.indexOf('action=submit') > 0) pagemode = 'edit'; else if (docURL.indexOf('Special:Upload') > 0)  pagemode = 'upload'; else if (docURL.indexOf('action=history') > 0)  pagemode = 'history'; else if (docURL.indexOf('&diff=') > 0)          pagemode = 'diff'; else                                            pagemode = 'view';

// pagemode = 'view';

if (docURL.indexOf("secure") > 0) {secmode=true} else {secmode=false;} var wpkurz = mw.config.get('wgServer')+mw.config.get('wgScriptPath')+"iki/"; var wplang = mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="; if (secmode == true ) { var wpdekurz = "https://secure.wikimedia.org/wikipedia/de/wiki/"; var wpdelang = "https://secure.wikimedia.org/wikipedia/de/w/index.php?title="; var commonskurz = "https://secure.wikimedia.org/wikipedia/commons/wiki/"; var commonslang = "https://secure.wikimedia.org/wikipedia/commons/w/index.php?title="; } else { var wpdekurz = "http://de.wikipedia.org/wiki/"; var wpdelang = "http://de.wikipedia.org/w/index.php?title="; var commonskurz = "http://commons.wikimedia.org/wiki/"; var commonslang = "http://commons.wikimedia.org/w/index.php?title="; }

if ( pagemode == 'edit' ) sidebarhoehe = 250; else sidebarhoehe = 250;

XXX='';

XXX=XXX+'JS '; XXX=XXX+'CSS'; XXX=XXX+' ';

if ( pagemode == 'edit' || pagemode == 'upload') { XXX=XXX+'\',\'\',\'\');">br | '; XXX=XXX+'br_b | '; XXX=XXX+'\',\'\');">\/\/ | '; XXX=XXX+'\',\'\<\/code\>\',\'\');">code'; XXX=XXX+' '; XXX=XXX+'\',\'\<\/small\>\',\'\');">small | '; XXX=XXX+'\',\'\<\/s\>\',\'\');">strike | '; XXX=XXX+'<a href="#" onclick="insertTags(\'\{\{subst:PAGENAME\}\}\',\'\',\'\');">PNAME</a>'; XXX=XXX+' ';

XXX=XXX+'<a href="#" onclick="document.editform.wpTextbox1.value=\'#REDIRECT \';document.editform.wpSummary.value=\'redirect created\';document.editform.wpTextbox1.focus;">ReDir</a> | '; XXX=XXX+'<a href="#" onclick="insertTags(\'\[\[Category:\',\'\]\]\\n\',\'\');">Cat:</a> | '; XXX=XXX+'<a href="#" onclick="insertTags(\'\{\{subst:ncd\}\}\',\'\',\'\');document.editform.wpSummary.value=\'NowCommons\';document.editform.wpWatchthis.checked=false;">NowCom</a>'; XXX=XXX+' ';

XXX=XXX+'<a href="#" onclick="insertTags(\'\[\[User:BLueFiSH.as|BLueFiSH\]\] \[\[User_talk:BLueFiSH.as|?!\]\] \~\~\~\~\~\',\'\',\'\');">BigSig</a> | '; XXX=XXX+'<a href="#" onclick="insertTags(\'\[\[User:BLueFiSH.as|BLueFiSH\]\]\',\'\',\'\');">SmallSig</a>'; XXX=XXX+' '; XXX=XXX+'<a href="#" onclick="document.editform.wpTextbox1.value=\'\{\{delete\}\}\\n\\nBegründung --\~\~\~\~\\n\\n\\n\\n\\n\'+document.editform.wpTextbox1.value;document.editform.wpSummary.value=\'fastdelete\';document.editform.wpWatchthis.checked=true;document.editform.wpTextbox1.focus;">fastdelete</a> | '; XXX=XXX+'<a href="#" onclick="document.editform.wpTextbox1.value=document.editform.wpTextbox1.value+\'\{\{subst:nld\}\}\';document.editform.wpSummary.value=\'unknown license\';document.editform.wpWatchthis.checked=true;document.editform.wpTextbox1.focus;">unknown</a>'; XXX=XXX+' ';

}

/* ========================= make Quickbar ============================= */ if (pagemode != 'print') { document.write('<div id="myquickbar" style="font-size:10px; padding:1px; position:fixed; top:0px; left:0px; z-index:10; background-color:#FFFFFF; width:150px; height:'+sidebarhoehe+'px">' + XXX + ' ') }

/* ========================= FUNCTIONS ============================= */

function brboth { insertTags('<br style="clear:both" />',,); }

/* =============================================================================================== */ /* die folgenden Funktionen fügen ein paar hilfreiche Tabs in die Tableiste über einer Seite hinzu */ /* gefunden bei en:User:Dbenbenn/monobook.js und mit eigenen Sachen erweitert                 */

var editlk; var username;

// Returns <li> name</a></li> function addlilink(url, name) { var na = document.createElement('a'); na.setAttribute('href', url); var txt = document.createTextNode(name); na.appendChild(txt); var li = document.createElement('li'); li.appendChild(na); return li; }

// Gets the URL version of the page title. function get_tidy_title { editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href; // cut everything up to "title=" from the start and everything past "&action=edit" from the end editlk = editlk.substring(editlk.indexOf('title=') + 6, editlk.lastIndexOf('&action=edit')); return editlk; }

function get_username { if ( docURL.indexOf('SpeCial:Contributions') > 0 ) { if ( docURL.indexOf('&target=') > 0 ) // Spezial:Contributions&target=BLueFiSH.as   { username = docURL.substr(docURL.indexOf('&target=')+8, docURL.length - docURL.indexOf('&target=')+8); }   else if ( docURL.indexOf('Contributions/') > 0 ) // Spezial:Contributions/BLueFiSH.as   { username = docURL.substr(docURL.indexOf('Contributions/')+14, docURL.length - docURL.indexOf('Contributions/')+14); } }  else if (editlk) { username = editlk.replace('Benutzer_Diskussion:',''); username = editlk.replace('Benutzer:',''); } }

// Adds "userlog" tab to User: and User talk: pages. function add_user_tabs(tabs, editlk) { editlk = editlk.substring(editlk.indexOf(':') + 1); var slloc = editlk.indexOf('/'); if (slloc > 0) editlk = editlk.substring(0, slloc); tabs.appendChild(addlilink(wplang+'Special:Log&user=' + editlk, 'userlog')); }

// Adds "userlog" tab to Spezial:Contributions function add_contributions_tabs(tabs, username) { tabs.appendChild(addlilink(wplang+'Special:Log&user=' + username, 'userlog')); }

// Adds "pagelock" to other pages function add_pagelog_tab(tabs, title) { tabs.appendChild(addlilink(wplang+'Special:Log&page=' + title, 'pagelog')); }

function openInterwikiImage { wpdomain = prompt('Sprachdomain?',''); if (wpdomain != "") window.open('http://'+wpdomain+'.wikipedia.org/wiki/' + wgPageName); }

document.write('<SCRIPT SRC="'+wpdelang+'Benutzer:BLueFiSH.as/JS/commonsmover.js&action=raw&ctype=text/javascript"><\/SCRIPT>');

function add_image_tabs(tabs) { tabs.appendChild(addlilink(commonskurz + wgPageName, 'commons')); tabs.appendChild(addlilink('javascript:GetImageInfoAndOpenUploadpage;', 'C-UP')); tabs.appendChild(addlilink(wpdekurz + wgPageName, 'de')); tabs.appendChild(addlilink('javascript:openInterwikiImage;', 'lang..')); tabs.appendChild(addlilink('http://tools.wikimedia.de/~daniel/WikiSense/CheckUsage.php?i='+ wgPageName +'&w=_160&m=&x=&go=Check+Usage&b=0#end', 'usage')); add_pagelog_tab(tabs, wgPageName); }

function addTabs { var tabs = document.getElementById('column-one').getElementsByTagName('div')[0].getElementsByTagName('ul')[0]; get_username; if ( document.getElementById("ca-edit") ) { var title = get_tidy_title; if (title.indexOf('Image:') == 0) add_image_tabs(tabs); else add_pagelog_tab(tabs, title); } else if ( docURL.indexOf('Special:Contributions')>0 ) add_contributions_tabs(tabs, username); }

function Init { addTabs; document.getElementById("column-one").style.paddingTop = 10 + sidebarhoehe + "px"; document.getElementById("pt-logout").getElementsByTagName("a")[0].innerHTML = "X"; }

if (pagemode != 'print') window.onload = Init;