User:SoledadKabocha/common-junk.js

// stuff transferred from common.js

if ( typeof mw.notify !== 'function' ) { // to make a visible indication even if I'm not looking at the console (see common.css) // XXX: probably safer if I avoid using jQuery... var jqcon = $( '#content' ); jqcon.addClass( 'linkclassifier-aborted' );

throw new Error( 'How did we get here w/o loading mediawiki core modules?' ); }

if ( typeof jsfnPortletLink !== 'function' || typeof isActionEditing !== 'boolean' ) { var errStr = 'aborting because we don\'t have jsfnPortletLink and/or isActionEditing; this means common.js didn\'t load properly'; mw.notify( 'common-junk.js ' + errStr, { autoHide: false } ); // make sure we actually abort throw new Error( errStr ); }

//

window.fantasqueFontDisabled = false; function toggleFantasqueFontForMonospace { var jqbod = $( 'body' ); //TODO: make selector configurable

if ( window.fantasqueFontDisabled ) { jqbod.removeClass( 'forbid-fantasque' ); } else { jqbod.addClass( 'forbid-fantasque' ); }

window.fantasqueFontDisabled = !window.fantasqueFontDisabled;

mw.notify(   'Monospaced text is now using ' +    ( window.fantasqueFontDisabled ? 'Liberation ' : 'Fantasque Sans ' ) +   'Mono (if available)',    { tag: 'myjs-monofont' }  ); }

function anchorArchiveLinks { mw.notify( 'anchorArchiveLinks: not currently implemented; old implementation was broken (shouldn\'t see this!)' ); }

jsfnPortletLink( 'p-tb', toggleFantasqueFontForMonospace, 'Toggle monosp. font', 'ca-monofnttgl' );

function lastResortToLoadMB { // This happens if linkclassifier was not run if ( typeof markBlocked !== 'function' ) { importScript( 'User:SoledadKabocha/markBlockedPlus.js' ); } } // XXX: honor mbEnableOnMainspaceDiff if ( !( mw.config.get( 'wgNamespaceNumber' ) === 0 && mw.config.get( 'wgAction' ) === 'view' ) ) { setTimeout( lastResortToLoadMB, 59500 ); }

if ( isActionEditing === true && typeof window.checkEditBrackets === 'function' ) { jsfnPortletLink( 'p-cactions', checkEditBrackets, '(aBB)', 'ca-antibracketbotmanual' ); if ( mw.config.get( 'wgPageContentModel' ) === 'wikitext' ) { // TODO: Only start timing when the edit box has focus or possibly when its text is modified. //     Otherwise, this gives useless warnings for incomplete Rcat edits. setInterval( checkEditBrackets, 25000 ); } }