User:Bocardodarapti/monobook.js

// copy from monobook.js of German wikiversity, generated with help by Exxu.

/** * Interface for the classic edit toolbar. * * Adapted from MediaWiki Core, before it was removed from it on 2018-10-17 */ var wgTitle = mw.config.get('wgTitle'); var wgPageName = mw.config.get('wgPageName'); var wgCanonicalNamespace = mw.config.get('wgCanonicalNamespace');

( function {	var toolbar, isReady, $toolbar, queue, slice, $currentFocused;

/**	 * Internal helper that does the actual insertion of the button into the toolbar. *	 * For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`, * `sampleText` and `imageId` as separate arguments (in this order) is also supported. *	 * @private *	 * @param {Object} button Object with the following properties. * You are required to provide *either* the `onClick` parameter, or the three parameters * `tagOpen`, `tagClose` and `sampleText`, but not both (they're mutually exclusive). * @param {string} [button.imageFile] Image to use for the button. * @param {string} button.speedTip Tooltip displayed when user mouses over the button. * @param {Function} [button.onClick] Function to be executed when the button is clicked. * @param {string} [button.tagOpen] * @param {string} [button.tagClose] * @param {string} [button.sampleText] Alternative to `onClick`. `tagOpen`, `tagClose` and * `sampleText` together provide the markup that should be inserted into page text at * current cursor position. * @param {string} [button.imageId] `id` attribute of the button HTML element. Can be * used to define the image with CSS if it's not provided as `imageFile`. * @param {string} [speedTip] * @param {string} [tagOpen] * @param {string} [tagClose] * @param {string} [sampleText] * @param {string} [imageId] */	function insertButton( button, speedTip, tagOpen, tagClose, sampleText, imageId ) { var $button;

// Backwards compatibility if ( typeof button !== 'object' ) { button = { imageFile: button, speedTip: speedTip, tagOpen: tagOpen, tagClose: tagClose, sampleText: sampleText, imageId: imageId };		}

if ( button.imageFile ) { $button = $( ' ' ).attr( {				src: button.imageFile,				alt: button.speedTip,				title: button.speedTip,				id: button.imageId || undefined,				'class': 'mw-toolbar-editbutton'			} ); } else { $button = $( ' ' ).attr( {				title: button.speedTip,				id: button.imageId || undefined,				'class': 'mw-toolbar-editbutton'			} ); }

$button.click( function ( e ) {			if ( button.onClick !== undefined ) {				button.onClick( e );			} else {				toolbar.insertTags( button.tagOpen, button.tagClose, button.sampleText );			}

return false; } );

$toolbar.append( $button ); }

isReady = false; $toolbar = false;

/**	 * @private * @property {Array} * Contains button objects (and for backwards compatibility, it can	 * also contains an arguments array for insertButton). */	queue = []; slice = queue.slice;

toolbar = {

/**		 * Add buttons to the toolbar. *		 * Takes care of race conditions and time-based dependencies by placing buttons in a queue if * this method is called before the toolbar is created. *		 * For backwards-compatibility, passing `imageFile`, `speedTip`, `tagOpen`, `tagClose`, * `sampleText` and `imageId` as separate arguments (in this order) is also supported. *		 * @inheritdoc #insertButton */		addButton: function { if ( isReady ) { insertButton.apply( toolbar, arguments ); } else { // Convert arguments list to array queue.push( slice.call( arguments ) ); }		},

/**		 * Add multiple buttons to the toolbar (see also #addButton). *		 * Example usage: *		 *    addButtons( [ { .. }, { .. }, { .. } ] ); *    addButtons( { .. }, { .. } ); *		 * @param {...Object|Array} [buttons] An array of button objects or the first * button object in a list of variadic arguments. */		addButtons: function ( buttons ) { if ( !Array.isArray( buttons ) ) { buttons = slice.call( arguments ); }			if ( isReady ) { buttons.forEach( function ( button ) {					insertButton( button );				} ); } else { // Push each button into the queue queue.push.apply( queue, buttons ); }		},

/**		 * Apply tagOpen/tagClose to selection in currently focused textarea. *		 * Uses `sampleText` if selection is empty. *		 * @param {string} tagOpen * @param {string} tagClose * @param {string} sampleText */		insertTags: function ( tagOpen, tagClose, sampleText ) { if ( $currentFocused && $currentFocused.length ) { $currentFocused.textSelection(					'encapsulateSelection', {						pre: tagOpen,						peri: sampleText,						post: tagClose					}				); }		}	};

// For backwards compatibility. Used to be called from EditPage.php, maybe other places as well. toolbar.init = $.noop;

// Expose API publicly mw.toolbar = toolbar;

$( function {		var $textBox, i, button;

// Used to determine where to insert tags $currentFocused = $( '#wpTextbox1' );

// Populate the selector cache for $toolbar $toolbar = $( '#toolbar' );

if ( $toolbar.length === 0 ) { $textBox = $( '#wpTextbox1' ); if ( $textBox.length === 0 ) { return; }			$toolbar = $( ' ' ).attr( { id: 'toolbar' } ); $toolbar.insertBefore( $textBox ); }

for ( i = 0; i < queue.length; i++ ) { button = queue[ i ]; if ( Array.isArray( button ) ) { // Forwarded arguments array from mw.toolbar.addButton insertButton.apply( toolbar, button ); } else { // Raw object from mw.toolbar.addButtons insertButton( button ); }		}

// Clear queue queue.length = 0;

// This causes further calls to addButton to go to insertion directly // instead of to the queue. // It is important that this is after the one and only loop through // the queue isReady = true;

// Apply to dynamically created textboxes as well as normal ones $( document ).on( 'focus', 'textarea, input:text', function {			$currentFocused = $( this );		} ); } );

} );

window.currentFocused = undefined;

// this function adds a toolbar button via mw.toolbar window.addButton = function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { // Don't generate buttons for browsers which don't fully // support it. mw.toolbar.addButton({   'imageId': imageId,    'imageFile': imageFile,    'speedTip': speedTip,    'tagOpen': tagOpen,    'tagClose': tagClose,    'sampleText': sampleText  }); };

// @deprecated window.mwInsertEditButton = function( parent, item ) { var image = document.createElement( 'img' ); image.width = 23; image.height = 22; image.className = 'mw-toolbar-editbutton'; if ( item.imageId ) { image.id = item.imageId; } image.src = item.imageFile; image.border = 0; image.alt = item.speedTip; image.title = item.speedTip; image.style.cursor = 'pointer'; image.onclick = function { insertTags( item.tagOpen, item.tagClose, item.sampleText ); // click tracking if ( ( typeof $ != 'undefined' ) && ( typeof $.trackAction != 'undefined' ) ) { $.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, "-") ); }   return false; };

parent.appendChild( image ); return true; };

// this function generates the actual toolbar buttons with localized text // we use it to avoid creating the toolbar where javascript is not enabled window.mwSetupToolbar = function { var toolbar = document.getElementById( 'toolbar' ); if ( !toolbar ) { return false; }

// Don't generate buttons for browsers which don't fully // support it. // but don't assume wpTextbox1 is always here var textboxes = document.getElementsByTagName( 'textarea' ); if ( !textboxes.length ) { // No toolbar if we can't find any textarea return false; } // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been replaced // with some other kind of control if ( textboxes[0].style.display != 'none' ) { if ( !( document.selection && document.selection.createRange )     && textboxes[0].selectionStart === null ) { return false; } }  return true; };

// apply tagOpen/tagClose to selection in textarea, // use sampleText instead of selection if there is none window.insertTags = function( tagOpen, tagClose, sampleText ) { if ( typeof $ != 'undefined' && typeof $.fn.textSelection != 'undefined' && currentFocused &&     ( currentFocused.nodeName.toLowerCase == 'iframe' || currentFocused.id == 'wpTextbox1' ) ) { $( '#wpTextbox1' ).textSelection(     'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }    ); return; } var txtarea; if ( document.editform ) { txtarea = currentFocused; } else { // some alternate form? take the first one we can find var areas = document.getElementsByTagName( 'textarea' ); txtarea = areas[0]; } var selText, isSample = false;

function checkSelectedText { if ( !selText ) { selText = sampleText; isSample = true; } else if ( selText.charAt(selText.length - 1) == ' ' ) { // exclude ending space char selText = selText.substring(0, selText.length - 1); tagClose += ' '; } }

};

/** * Restore the edit box scroll state following a preview operation, * and set up a form submission handler to remember this state */ window.scrollEditBox = function { var editBox = document.getElementById( 'wpTextbox1' ); var scrollTop = document.getElementById( 'wpScrolltop' ); var editForm = document.getElementById( 'editform' ); if( editForm && editBox && scrollTop ) { if( scrollTop.value ) { editBox.scrollTop = scrollTop.value; }   addHandler( editForm, 'submit', function {      scrollTop.value = editBox.scrollTop;    } ); } };

function toolbarExtension_semanticTemplates{ var textHere = " Hier Text einsetzen "; var formulaHere = " Hier Formel einsetzen "; var regx = wgPageName.match(/Aufgabe|Beispiel|Bemerkung|Beweis|Definition|Fakt/gi);

// // //Bedingte Einsetzungshilfen // //

// // //Bedingte Einsetzungshilfen für Stichworte // //

if(wgPageName.match(/MSW/)) { mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Mathematisches Stichwort",     "tagOpen": "",     "tagClose": "",     "sampleText": ""}); }

if(wgPageName.match(/^MDLD/)){ var getStart = /^MDLD\/(.*)/; getStart.exec(wgTitle); var start = RegExp.$1; mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Definition deviation",     "tagOpen": "",     "sampleText": "Target"}); }

if(wgPageName.match(/Factreferencenumber$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Factreferencenumber",     "tagOpen": "",     "sampleText": "Theorem"}); }

if(wgPageName.match(/Examplereferencenumber$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Examplereferencenumber",     "tagOpen": "",     "sampleText": " "}); }

if(wgPageName.match(/Definitionreferencenumber$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Definitionreferencenumber",     "tagOpen": "",     "sampleText": " "}); }

if(wgPageName.match(/Remarkreferencenumber$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Remarkreferencenumber",     "tagOpen": "",     "sampleText": " "}); }

if(wgPageName.match(/Exercisereferencenumber$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Exercisereferencenumber",     "tagOpen": "",     "sampleText": " "}); }

// // //Bedingter Button für Vorlesungsaufzählung // //

if(wgPageName.match(/Vorlesungsaufzählung$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Vorlesungsaufzählung",     "tagOpen": "",     "sampleText": wgPageName.replace(/.Vorlesungsaufzählung$/,"")}); }

// // //Bedingter Button für Arbeitsblattaufzählung // //

if(wgPageName.match(/Arbeitsblattaufzählung$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Arbeitsblattaufzählung",     "tagOpen": "",     "sampleText": wgPageName.replace(/.Arbeitsblattaufzählung$/,"")}); }

// // //Bedingte Buttons für Latexversion // //

if(wgPageName.match(/latex$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Latexdeklaration",     "tagOpen": "",     "sampleText": " "}); }

if(wgPageName.match(/latexmakros$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Latexmakrosseite",     "tagOpen": "",     "sampleText": "Theorie"}); }

// // //Bedingte Buttons für Kontrollversion (intern) // //

if(wgPageName.match(/kontrolle$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Kontrollseite",     "tagOpen": "",     "sampleText": " "}); }

// // //Mathematische Umgebungen // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/3/3f/Button_clipboard_math.png",     "speedTip": "Mathematische Formel (Latex)",     "tagOpen": "  ",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/3/3f/Button_clipboard_math.png",     "speedTip": "Mathematische Formel (Latex)",     "tagOpen": "  ",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/ce/Button_clipboard_mathdisplay.png",     "speedTip": "Mathdisplay",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/5/5f/Button_sorterbar.png",     "speedTip": "Mathematische Korrespondenz",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/d/d8/Button_clipboard_enum.png",     "speedTip": "Mathematische Liste",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/5/5f/Button_sorterbar.png",     "speedTip": "Mathematische Bedingung",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/3/3f/Set_theory_icon.svg",     "speedTip": "Element",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/8/86/Button_clipboard_valign.png",     "speedTip": "Vergleichskette",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/f/ff/Button_arrow_right.png",     "speedTip": "Abbildungsstruktur",     "tagOpen": "\n",     "sampleText": formulaHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/f/f3/Button_clipboard_template.png",     "speedTip": "Vorlage einfügen",     "tagOpen": "  ",     "sampleText": " Vorlagennamen hier einfügen "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/f/f3/Button_clipboard_template.png",     "speedTip": "Vorlage einfügen",     "tagOpen": "",     "sampleText": ""});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a4/Btn_toolbar_par.png",     "speedTip": "Bracket",     "tagOpen": "  ",     "sampleText": textHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/8/8f/Button_clipboard_parameter.png",     "speedTip": "Parameter",     "tagOpen": "",     "sampleText": " Hier Vorlagenparameter einsetzen "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/5/54/Button_clipboard_latex_operation.png",     "speedTip": "Operator einfügen",     "tagOpen": "  ",     "sampleText": "Operatornamen hier einfügen "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/d/d8/Button_clipboard_enum.png",     "speedTip": "Aufzählung",     "tagOpen": "\n",     "sampleText": textHere});

// // //Herausstellungen // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/c9/Button_clipboard_bold.png",     "speedTip": "Keyword",     "tagOpen": "  ",     "sampleText": " Keyword "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a4/Btn_toolbar_par.png",     "speedTip": "Bracket extra",     "tagOpen": "\n",     "sampleText": textHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/27/Button_clipboard_headline.png",     "speedTip": "Seitenüberschrift",     "tagOpen": "",     "sampleText": textHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/1/1a/Button_clipboard_subheading.png",     "speedTip": "Subtitle",     "tagOpen": "",     "sampleText": textHere});

// // //Einbindungen // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/e/ee/Button_clipboard_image.png",     "speedTip": "Bild einbinden",     "tagOpen": "\n",     "sampleText": " Hier Bildname einsetzen "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/cf/Button_clipboard_definition.png",     "speedTip": "Definition einbinden",     "tagOpen": "\n",     "sampleText": " Hier Definitionsname einsetzen "});

// // //Spezielle Defintionsbuttons // //

if(wgPageName.match(/Definition$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/c9/Button_clipboard_bold.png",     "speedTip": "Word of definition",     "tagOpen": "\n ",     "sampleText": " Word of definition "}); }

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/8/87/Button_clipboard_fact.png",     "speedTip": "Fact",     "tagOpen": "\n",     "sampleText": " Name of fact "});

if(wgPageName.match(/Begriff$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/c9/Button_clipboard_bold.png",     "speedTip": "Stichwort",     "tagOpen": "\n ",     "sampleText": " Stichwort "}); }

if(wgPageName.match(/Name$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/7b/Button_clipboard_bold.png",     "speedTip": "Stichwort",     "tagOpen": "\n ",     "sampleText": " Stichwort "}); }

// // //Spezielle Beweisbuttons (aktiv bei /Beweis) // //

if(wgPageName.match(/Beweis$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/6/6d/Button_recycling.png",     "speedTip": "Teilbeweis",     "tagOpen": "",     "sampleText": "Beweis"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/6/6d/Button_recycling.png",     "speedTip": "Ringbeweis",     "tagOpen": "",     "sampleText": "Beweis von 1 nach 2"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/6/6d/Button_recycling.png",     "speedTip": "Beweisrichtung",     "tagOpen": "\n",     "sampleText": "Beweis"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Fallunterscheidung",     "tagOpen": "\n",     "sampleText": "Fall1"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a5/Buttonexperimenty.png",     "speedTip": "Widerspruchsbeweis",     "tagOpen": "",     "sampleText": "Annahme"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/ad/Button_l_nl.png",     "speedTip": "Induktionsbeweis",     "tagOpen": "",     "sampleText": "Induktion"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Zwischenbehauptung",     "tagOpen": "\n",     "sampleText": "Zwischenbehauptung"}); }

// // //Weitere Strukturen // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/c2/Button_clipboard_information.png",     "speedTip": "Remark",     "tagOpen": "\n",     "sampleText": " Remark "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/76/Button_clipboard_example.png",     "speedTip": "Example",     "tagOpen": "\n",     "sampleText": " Example "});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/1/1f/Button_clipboard_task.png",     "speedTip": "Aufgabe einbinden",     "tagOpen": "\n",     "sampleText": " Hier Aufgabenname einsetzen "});

// // //Spezielle Aufgabenbuttons (aktiv nur bei /Aufgabe und /Beweis) // //

if(wgPageName.match(/Aufgabe$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/f/f3/Button_clipboard_template.png",     "speedTip": "Aufgabenformvorlage",     "tagOpen": "",     "sampleText": "Aufgabenformname"});

}

if(wgPageName.match(/Aufgabenform$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/3/35/Sister_icon.png",     "speedTip": "n Sie",     "tagOpen": "",     "tagClose": "",     "sampleText": ""});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/3/35/Sister_icon.png",     "speedTip": "ManSie Unterscheidung einbinden",     "tagOpen": "",     "sampleText": "bestimme"});

}

// // //Button für mathematischer Text (abhängig vom Texttyp) // //

if(wgPageName.match(/Definition$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Definition",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Begriff$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Begriff",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Name$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Satzabfrage",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Name/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Satzantwort",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Inhalt$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Antwort",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Fact$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Fact",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Proof$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Proofs",     "tagOpen": "",     "sampleText": textHere}); }

if(wgPageName.match(/Name$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Name",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Exercise$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Aufgabe",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Aufgabenform$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Aufgabenform",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Example$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Example",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Remark$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Remark",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Beispielliste$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Beispielliste",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Solution$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical text/Solution",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Kommentar$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Kommentar",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Verfahren$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Verfahren",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Sprechweise$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Sprechweise",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Notation$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Notation",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Diagramm$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Diagramm",     "tagOpen": "",     "sampleText": textHere});

}

// // //Unter Sonstiges // //

if(wgPageName.match(/Definitionskern$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Sonstiges",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Einzelbegründung$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Sonstiges",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Beweisverweis$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Verweis",     "tagOpen": "",     "sampleText": textHere});

}

// // //Section // //

if(wgPageName.match(/Section$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematical section",     "tagOpen": "",     "sampleText": textHere});

}

// // //Tabelle // //

if(wgPageName.match(/Tabelle$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Tabelle",     "tagOpen": "",     "sampleText": textHere});

}

// // //Klausuren // //

if(wgPageName.match(/Klausur$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Klausur",     "tagOpen": "",     "sampleText": textHere});

}

if(wgPageName.match(/Klausur$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/1/1f/Button_clipboard_task.png",     "speedTip": "Aufgabe",     "tagOpen": "\n|",     "tagClose":"/Aufgabe|p|||",     "sampleText": textHere});

}

if(wgPageName.match(/Klausur_mit_Lösungen$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Aufgabe",     "tagOpen": "",     "sampleText": wgPageName.replace(/.mit_Lösungen$/,"")});

}

if(wgPageName.match(/Situation$/)){

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/a/a7/Button_clipboard_mathematical_text.png",     "speedTip": "Mathematischer Text/Situation",     "tagOpen": "",     "sampleText": textHere});

}

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Situationsvorlage",     "tagOpen": "",     "sampleText": " Vorlagenname "});

// // //Links // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/6/65/Button_clipboard_Dlink.png",     "speedTip": "Definitions-Link",     "tagOpen": "\n\n",     "sampleText": "Definition to be linked"});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/7d/Button_clipboard_Flink.png",     "speedTip": "Factlink",     "tagOpen": "\n\n",     "sampleText": textHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/c/c9/Button_clipboard_bold.png",     "speedTip": "Examplelink",     "tagOpen": "\n\n",     "sampleText": textHere});

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/5/54/Letter_A.svg",     "speedTip": "Aufgabe-Link",     "tagOpen": "\n\n",     "sampleText": textHere});

// // //Kategorisierung // //

if(wgPageName.match(/Aufgaben$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Aufgaben-Kategorisierung",     "tagOpen": "",     "sampleText": textHere}); }

if(wgPageName.match(/Arbeitsblätter$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Arbeitsblatt-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Arbeitsblätter$/,"")}); }

if(wgPageName.match(/Beispiele$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Beispiel-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Beispiele$/,"")}); }

if(wgPageName.match(/Bemerkungen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Bemerkungs-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Bemerkungen$/,"")}); }

if(wgPageName.match(/Beweise$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Beweis-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Beweise$/,"")}); }

if(wgPageName.match(/Definitionen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Definitions-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Definitionen$/,"")}); }

if(wgPageName.match(/Notationen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Notations-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Notationen$/,"")}); }

if(wgPageName.match(/Sprechweisen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Sprechweise-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Sprechweisen$/,"")}); }

if(wgPageName.match(/Fakten$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Fakten-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Fakten$/,"")}); }

if(wgPageName.match(/Klausuren$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Klausur-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Klausuren$/,"")}); }

if(wgPageName.match(/Lösungen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Lösungs-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Lösungen$/,"")}); }

if(wgPageName.match(/Kommentare$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Kommentar-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Kommentare$/,"")}); }

if(wgPageName.match(/Situationsbeschreibungen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Situation-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Situationsbeschreibungen$/,"")}); }

if(wgPageName.match(/Textabschnitte$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Textabschnitt-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Textabschnitte$/,"")}); }

if(wgPageName.match(/Strukturvorlagen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Vorlagen-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Strukturvorlagen$/,"")}); }

if(wgPageName.match(/Diagramme$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Diagramme-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Diagramme$/,"")}); }

if(wgPageName.match(/Verfahren$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Verfahrens-Kategorisierung",     "tagOpen": "",     "sampleText": wgTitle.replace(/.Verfahren$/,"")}); }

if(wgCanonicalNamespace.match("Category")){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png",     "speedTip": "Kategorisierung",     "tagOpen": "",     "sampleText": textHere}); }

// // //Buttons zum Schreiben von Strukturvorlagen // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/6/62/Button_desambig.png",     "speedTip": "If-Bedingung",     "tagOpen": "\n",     "sampleText": "Bedingung einfügen"});

if(wgCanonicalNamespace.match("Template")){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Strukturvorlage",     "tagOpen": "    ",     "sampleText": "Struktur"}); }

// // //Einträge für Vorträge und Literatur // //

if(wgPageName.match(/Themen$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Vortragseintrag",     "tagOpen": "",     "sampleText": "  "}); }

if(wgPageName.match(/Vorträge$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Vortragseintrag",     "tagOpen": "",     "sampleText": "  "}); }

if(wgPageName.match(/Literatureintrag/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Bucheintrag",     "tagOpen": "",     "sampleText": "Vorname"}); }

if(wgPageName.match(/Literatureintrag/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Artikeleintrag",     "tagOpen": "",     "sampleText": "Vorname"}); }

if(wgPageName.match(/Literatur$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Eintrag im Literaturverzeichnis",     "tagOpen": "",     "sampleText": "Literaturstichwort"}); }

if(wgPageName.match(/Literaturverzeichnis$/)){ mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Eintrag im Literaturverzeichnis",     "tagOpen": "",     "sampleText": "Literaturstichwort"}); }

// // //Einsetzungshilfen Umstellung // //

mw.toolbar.addButton({    "imageFile": "//upload.wikimedia.org/wikipedia/commons/7/74/Button_oeil.png",     "speedTip": "Kat",     "tagOpen": "",     "tagClose": "",     "sampleText":""});

return false; } $( toolbarExtension_semanticTemplates ) ;

$( scrollEditBox ); $( mwSetupToolbar ); $( function { currentFocused = document.getElementById( 'wpTextbox1' );  // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html  // focus does not bubble normally, but using a trick we can do event delegation  // on the focus event on all text inputs to make the toolbox usable on all of them  var editForm = document.getElementById( 'editform' );  if ( !editForm ) {    return;  }  function onfocus( e ) {    var elm = e.target || e.srcElement;    if ( !elm ) {      return;    }    var tagName = elm.tagName.toLowerCase;    var type = elm.type || '';    if ( tagName !== 'textarea' && tagName !== 'input' ) {      return;    }    if ( tagName === 'input' && type.toLowerCase !== 'text' ) {      return;    }

currentFocused = elm; }

if ( editForm.addEventListener ) { // Gecko, WebKit, Opera, etc... (all standards compliant browsers) editForm.addEventListener( 'focus', onfocus, true ); // This MUST be true to work } else if ( editForm.attachEvent ) { // IE needs a specific trick here since it doesn't support the standard editForm.attachEvent( 'onfocusin', function { onfocus( event ); } ); }

// HACK: make currentFocused work with the usability iframe // With proper focus detection support (HTML 5!) this'll be much cleaner if ( typeof $ != 'undefined' ) { var iframe = $( '.wikiEditor-ui-text iframe' ); if ( iframe.length > 0 ) { $( iframe.get( 0 ).contentWindow.document ) .add( iframe.get( 0 ).contentWindow.document.body ) // for IE       .focus( function { currentFocused = iframe.get( 0 ); } ); } }

editForm });