Zum Inhalt springen

Benutzer:Bernardissimo/monobook.js

aus Wikipedia, der freien Enzyklopädie

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
//<pre><nowiki>

   document.write('<script src="'
   + 'http://de.wikipedia.org/w/index.php?title=Benutzer:ASM/quickedit.js'
   + '&action=raw&ctype=text/javascript"></script>');

 // [[Benutzer:Joschua/Userpage Navigation]]
 document.write('<SCRIPT SRC="http://de.wikipedia.org/w/index.php?title=Benutzer:Joschua/Userpage_Navigation/js&action=raw&ctype=text/javascript"><\/SCRIPT>');


//Die Bearbeiten-Links wieder schön nach rechts
var oldEditsectionLinks = true;


getsub('rp');
getsub('rv2version');


function getsub(script){
document.write('<SCRIPT SRC="http://de.wikipedia.org/w/index.php?title=Benutzer:Bernardissimo/monobook.js/' + script + '.js&action=raw&ctype=text/javascript"><\/SCRIPT>');
}

// [[en:User:Lupin/popupsdev.js]] - please include this line
document.write('<script type="text/javascript" src="' 
             + 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popupsdev.js' 
             + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

popupShortcutKeys = true;
popupAdminLinks = false;
popupStructure = 'menus';
popupFixRedits = true;
popupFixDabs = true;
imagePopupsForImages = false;


// Neuer Tab für Schnelllöschantrag
function schnellloeschen(grund)
{
  var f = document.editform, t = f.wpTextbox1;
var alt = t.value;
  t.value = "{{Löschen}} ''"+grund+"'' --~~~~"; 
  t.value += "\n";
  t.value += "----";
  t.value += "\n";
  t.value += alt;
  f.wpSummary.value = "SLA+ ("+grund+")";
  f.wpMinoredit.checked = true;
}


function addlilink(tabs, url, name, id){
    var na = document.createElement('a');
    na.href = url;
    na.id = id;
    na.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(na);
    tabs.appendChild(li);
    return li;
}


function replace(){
    var s = prompt("Search regexp?");
    if(s){
        var r = prompt("Replace regexp?");
        if(!r && r != '') return;
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

// appends msg to the currently-editted page, sets the summary to summ,
// and marks or unmarks the Watch this page checkbox according to watch.
function edit_summary_watch(msg, summ, watch)
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value += msg;
  f.wpSummary.value = summ;
}


// adds various tabs to call the above
function add_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

  // Only add for pages with "Editing User talk:" at the start of the title
  if (document.title.indexOf("Bearbeiten von Benutzer Diskussion:") == 0)
    {
      addlilink(tabs, 'javascript:edit_summary_watch("{{subst:Benutzer:Bernardissimo/Hallo|"+prompt("Name?")+"}} --~~~~", "", false, 1)',"W");
    }
	
  if(document.title.indexOf("Bearbeiten ") == 0){
        addlilink(tabs, 'javascript:replace()', 'Replace');
        addlilink(tabs, 'javascript:schnellloeschen(prompt("Grund für Schnelllöschantrag?"))', 'SLA');

    }

}

if (window.addEventListener)
  window.addEventListener("load", add_tabs, false);
else if (window.attachEvent)
  window.attachEvent("onload", add_tabs);
  


if ( document.createElement && window.addEventListener )
{
	function SoFixItInit() // pre-load, (don't want to slow down loading of article's content, though)
	{

	}

	function SoFixItLoad() // post-load
	{
		UserMenu = new PortletMenu( 'p-personal'   );
		PageMenu = new PortletMenu( 'p-cactions'   );
		 NavMenu = new PortletMenu( 'p-navigation' );
		//ToolMenu = new PortletMenu( 'p-tb'         );

			//	This is inefficient and not particularly robust.
			//	This comes first, I want this link to come up as
			//	fast as possible.
			//
		function GetByClass( sElem, sClass )
		{	var i, a2 = [], a = document.getElementsByTagName( sElem );
			for ( i = 0; i < a.length; i++ )
				if ( a[ i ].className == sClass )
					a2.push( a[ i ] );
			return a2;
		}

		var userName = UserMenu.getText( 'pt-userpage' );

			// personal (top-most) menu
			//
			//		Celestianpower  Háblame  Prefs  Watchlist  Log out
			//
		UserMenu.setText( 'pt-mytalk'     , 'Diskussion'  );
		UserMenu.setText( 'pt-preferences', 'Prefs' );
		UserMenu.setText( 'pt-watchlist'  , 'Watchlist' );
		UserMenu.setText( 'pt-logout'     , 'Log out'   );
			//
			//
			//
			//	it seems there is a stylesheet that makes them lowercase
			//
			//		ok, the lowercased menu items are starting to really bug me:
			//
		document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0].style.textTransform = 'none';
			//
		

			//	article-actions menu, (the "tabs")
			//
		if ( PageMenu[ 'ca-history' ] ) // theory: if it has a history tab, then it's purgable
		{
			PageMenu.insertBefore( 'ca-history', 'ca-lastdiff', 'Last diff',
				PageMenu.getHref( 'ca-history' ).replace( /action=history/, 'diff=0' ) );

			

                        PageMenu.setText( 'ca-edit'     , 'Edit'   );

                        PageMenu.setText( 'ca-history'     , 'History'   );
		}

		var x = 1;
		NavMenu.append( 'n-' + x++, 'monobook.js', 'http://de.wikipedia.org/w/index.php?title=User:' + userName + '/monobook.js&action=edit' );
	}

	function PortletMenu( id ) // constructor
	{
		this.menu = document.getElementById( id );
		this.list = this.menu.getElementsByTagName( 'ul' )[ 0 ]; // bypass "<h5>Views</h5>", etc.

			//	sigh...as far as I can figure, there is empty whitespace being treated
			//	as TextNodes....
			//
		var LIs = this.list.getElementsByTagName( 'li' );

		for ( var i = 0; i < LIs.length; i++ )
		{
			this[ LIs[ i ].id ] = LIs[ i ];
		}

		this.newItem = function( id, txt, url )
		{	var li = document.createElement( 'li' ); li.id   = id;
			var  a = document.createElement( 'a'  );  a.href = url;

			 a.appendChild( document.createTextNode( txt ) );
			li.appendChild( a );

			this[ id ] = li; // watch this!!!

			return li;
		}

		this.append = function( id, txt, url )
		{	this.list.appendChild( this.newItem( id, txt, url ) );
		}
		
		this.insertBefore = function( old, id, txt, url )
		{	this.list.insertBefore( this.newItem( id, txt, url ), this[ old ] );
		}

			//	the ByTagName here is a bit annoying, but in Safari, I was picking
			//	up TextNodes by using this[ id ].firstChild.firstChild
			//
		this.getText = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data }
		this.setText = function( id, txt ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].firstChild.data = txt }

		this.getHref = function( id      ) { return this[ id ].getElementsByTagName( 'a' )[ 0 ].href       }
		this.setHref = function( id, url ) {        this[ id ].getElementsByTagName( 'a' )[ 0 ].href = url }
		
		//	I add em as I need em....
	}


	function RemoveNode( id )
	{	var node = document.getElementById( id )
		node.parentNode.removeChild( node );
	}



	SoFixItInit();
	window.addEventListener( 'load', SoFixItLoad, false );
}



//</nowiki></pre>