User:Umherirrender/monobook.js

/* * Globale Anpassungen */ mw.loader.load( '//de.wikipedia.org/w/index.php?title=Benutzer:Umherirrender/monobook-sul.js&action=raw&ctype=text/javascript' ); /* * lokale Anpassungen */ /* funktionen aufrufen */ mw.loader.using( [ 'mediawiki.util' ], $( function { /* link auf Special:LanguageStats in der Sidebar */ mw.util.addPortletLink( 'p-bw-sidebar-translators',  mw.util.wikiGetlink( 'Special:LanguageStats/de' ),  'Sprachstatistiken',  'n-bw-sidebar-LanguageStats',  'Sprachstatistiken',  'l',  '#n-bw-sidebar-portal' ); /* dopple link zu Special:RecentChanges, damit Bot-Bearbeitungen direkt sichtbar - 7039 */ mw.util.addPortletLink( 'p-navigation',  mw.config.get( 'wgScript' ) + '?title=Special:RecentChanges&hidebots=0&translations=only&trailer=/de',  'Übersetzungen auf Deutsch',  'n-bw-sidebar-changes-lang-bot',  'Übersetzungen auf Deutsch',  'b',  '#n-bw-sidebar-changes-lang' ); /* entferne den nun doppelten Link */ var recentlink = $( '#n-bw-sidebar-changes-lang' ); if( recentlink.length ) { recentlink.remove; } /* ergänzt tab für Wechsel zwischen de <-> de-formal */ if ( mw.config.get( 'wgNamespaceNumber' ) === 8 ) { var wgPageName = mw.config.get( 'wgPageName' ); var index = wgPageName.lastIndexOf( '/' ) if ( index !== -1 ) { var basetitle = wgPageName.substring( 0, index ); var lang = wgPageName.substring( index + 1 ); //link zur de.wp  mw.util.addPortletLink(    'p-tb',    '//de.wikipedia.org/wiki/' + mw.util.wikiUrlencode( basetitle ),    'de.wikipedia',    't-de-wikipedia',    'de.wikipedia',    'b',    '#t-recentchangeslinked'   ); //Sprachkürzel setzen $( '#ca-nstab-mediawiki a' ).text( lang ); //unterscheidung if ( lang === 'de' ) { mw.util.addPortletLink(    'p-cactions',     mw.util.wikiGetlink( basetitle + '/de-formal' ),     'de-formal',     'ca-nstab-mediawiki-de-formal',     'de-formal',     'p',     'ca-talk'    ); } else { mw.util.addPortletLink(    'p-cactions',     mw.util.wikiGetlink( basetitle + '/de' ),     'de',     'ca-nstab-mediawiki-de',     'de',     'p',     '#ca-nstab-mediawiki'    ); } } } //when there is a edit box var wgAction = mw.config.get( 'wgAction' ); if ( wgAction === 'edit' || wgAction === 'submit' ) { /* replace !!FUZZY!! with backgroundColor */ var wgPageName = mw.config.get( 'wgPageName' ); var textarea = $( '#wpTextbox1' ); if( textarea.length && !textarea.attr( 'readonly' ) && textarea.val.match( /^!!FUZZY!!/ ) && wgPageName.substring( wgPageName.length - 4 ) !== '/qqq' ) { textarea.val( textarea.val.replace( /^(?:!!FUZZY!!)+/, '' ) ); textarea.css( 'backgroundColor', '#FFDBDB' ); } /* the original text is shown twice in edit window */ mw.util.addCSS( '.mw-translate-definition-preview { display:none }' ); /* set a select for default summary */ // span of the label var summaryLabel = $( '#wpSummaryLabel' ); //only, if below the textarea if ( summaryLabel.length && summaryLabel.parent && summaryLabel.parent.attr( 'class' ) === "editOptions" ) { //the select var summarySelect = $( document.createElement( 'select' ) ); summarySelect.attr( 'name', 'summarySelect' ); summarySelect.attr( 'id', 'summarySelect' ); summarySelect.change( function {    var summarySelect = $( '#summarySelect' );    var summary = $( '#wpSummary' );    var selectValue = summarySelect.val;    var summaryValue = summary.val;    //append with a space    if ( summaryValue ===  ) {     summary.val( selectValue );    } else if( selectValue !==  ) {     summary.val( summaryValue + ' ' + selectValue );    }   }); // set default var optionFirst = $( document.createElement( 'option' ) ); summarySelect.append( optionFirst ); optionFirst.val( '' ); optionFirst.text( summaryLabel.text );

/* text of select */ var summaryOption = [ 'defuzzy', 'translate', 'formal', 're' ];  //set options for ( var i = 0; i < summaryOption.length; i++ ) { var option = $( document.createElement( 'option' ) ); summarySelect.append( option ); option.val( summaryOption[i] ); option.text( summaryOption[i] ); }  //make visible - hidden by my css summaryLabel.css( 'display', 'block' ); //remove the text summaryLabel.text( '' ); //append select summaryLabel.append( summarySelect ); } } }));