MediaWiki:Common.js
/* Import more specific scripts if necessary */
if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") //scripts specific to editing pages {
importScript("MediaWiki:Common.js/edit.js")
}
( function( $ ) {
// CONFIG var config = window.ShowHideConfig = $.extend( true, { autoCollapse: 2, userLang: true, brackets: '[]', linkBefore: false, // German de: { show: "anzeigen", hide: "verbergen", showAll: "alle anzeigen", hideAll: "alle verbergen" }, // English en: { show: "show", hide: "hide", showAll: "show all", hideAll: "hide all" }, // Spanish es: { show: "Mostrar", hide: "Ocultar", showAll: "Mostrar todo", hideAll: "Ocultar todo" }, // French fr: { show: "montrer", hide: "cacher", showAll: "montrer tous", hideAll: "cacher tous" }, // Japanese ja: { show: "表示", hide: "非表示", showAll: "すべて表示", hideAll: "すべて非表示" }, // Dutch nl: { show: "tonen", hide: "verbergen", showAll: "alles tonen", hideAll: "alles verbergen" }, // Polish pl: { show: "Pokaż", hide: "Ukryj", showAll: "Pokaż wszystko", hideAll: "Ukryj wszystko" }, // Russian ru: { show: "Открыть", hide: "Скрыть", showAll: "Открыть все", hideAll: "Скрыть все" } // Make a post on the talkpage if you have i18n updates }, window.ShowHideConfig || {} );
// i18n function function msg( name ) { if ( config.userLang && wgUserLanguage in config && name in config[wgUserLanguage] ) { return config[wgUserLanguage][name]; } if ( wgContentLanguage in config && name in config[wgContentLanguage] ) { return config[wgContentLanguage][name]; } return config.en[name]; }
// common $.fn.onLink = function( fn ) { return this.bind( 'click keypress', function(e) { if ( e.type === 'click' || ( e.type === 'keypress' && ( e.keyCode === 13 || e.charCode === 32 ) ) ) { fn.call(this, e); } } ); };
/** Collapsible tables using jQuery * * Description: Allows tables to be collapsed, showing only the header. */ function collapseTable( node, state ) { var $table = $( node ), $button = $table.find( 'tr:first > th:first .collapseLink' );
if ( !$table.length || !$button.length ) { return false; }
if ( typeof state === 'boolean' ) { $table.toggleClass( 'collapsed', !state ); } else { $table.toggleClass( 'collapsed' ); } var hidden = $table.hasClass( 'collapsed' ); $table.find( '> * > tr:not(:first):not(.nocollapse)' )[hidden?"hide":"show"](); $button.text( msg( hidden ? "show" : "hide" ) ); return true; }
function createCollapseButtons() { var NavigationBoxes = []; $( 'table.collapsible' ).each( function () { NavigationBoxes.push(this); var $buttonLink = $( '' ).text( msg( "hide" ) ).css({ cursor: "pointer" }).onLink( function( e ) { collapseTable( $(this).closest('table') ); } ), $button = $( "" ).css( { "float": "right", textAlign: "right", fontWeight: "normal", width: "6em", marginLeft: "-100%" } ); $button.append( document.createTextNode(config.brackets.substr(0, config.brackets.length/2)), $buttonLink, config.brackets.substr(config.brackets.length/2) );
var $header = $( this ).find( 'tr:first > th:first' ).prepend($button); } );
// if more Navigation Bars found than Default: hide all if ( $( NavigationBoxes ).filter( '.autocollapse' ).length >= config.autoCollapse ) { $( NavigationBoxes ).filter( '.autocollapse' ).each( function () { collapseTable( this, false ); } ); } else { $( NavigationBoxes ).filter( '.collapsed' ).each( function () { collapseTable( this, false ); } ); } }
$( createCollapseButtons );
/** Dynamic Navigation Bars with jQuery * * Base Description: See Wikipedia:Wikipedia:NavFrame. */
// shows and hides content and picture (if available) of navigation bars function toggleNavigationBar( node ) { var $navFrame = $( node ), $navToggle = $navFrame.find( '.NavHead:first .collapseLink' );
if ( !$navFrame.length || !$navToggle.length ) { return false; }
$navFrame.toggleClass( 'NavVisible' ); $navFrame.find( '.NavPic, .NavContent' ).not( $navFrame.find( '.NavFrame .NavPic' ) ).not( $navFrame.find( '.NavFrame .NavContent' ) ).slideToggle(); $navToggle.text( msg( $navFrame.hasClass( 'NavVisible' ) ? "hide" : "show" ) ); return true; }
// adds show/hide-button to navigation bars function createNavigationBarToggleButton() { var NavFrames = $( '.NavFrame' ).addClass( 'NavVisible' ).each( function () { var $navHead = $( this ).find( '.NavHead:first' ), $buttonLink = $( '' ).text( msg( "hide" ) ).onLink( function ( e ) { toggleNavigationBar( $( this ).closest( '.NavFrame' ) ); } ), $button = $( '' ); $navHead.filter( 'legend' ).append( ' - ' ); if ( config.brackets ) { $button.append( document.createTextNode(config.brackets.substr(0, config.brackets.length/2)), $buttonLink, config.brackets.substr(config.brackets.length/2) ); } else { $button.append( $buttonLink ); } $navHead[config.linkBefore?"prepend":"append"]($button); } ); // if more Navigation Bars found than Default: hide all if ( NavFrames.length >= config.autoCollapse ) { NavFrames.not( '.noautocollapse' ).each( function () { toggleNavigationBar(this); } ); } else { NavFrames.filter( '.collapsed' ).each( function () { toggleNavigationBar(this); } ); } return true; }
$( createNavigationBarToggleButton );
$( function () { $( '.NavGlobal' ).each( function () { $( '' ).append( document.createTextNode( '[' ), $( '' ).text( msg( "showAll" ) ).onLink( function ( e ) { $( '.NavFrame' ).each( function () { if ( !$( this ).hasClass( 'NavVisible' ) ) toggleNavigationBar(this); } ); } ), ']' ).appendTo( this ); $( this ).append( ' ' ); $('').append( document.createTextNode( '[' ), $( '' ).text( msg( "hideAll" ) ).onLink( function ( e ) { $( '.NavFrame' ).each( function () { if ( $( this ).hasClass( 'NavVisible' ) ) toggleNavigationBar(this); } ); } ), ']' ).appendTo( this ); } ); } );
} )( jQuery ); /*
/*
* scripts imported from en.wikisource.org and wikisource.org */
/* messages are configurable here */ self.ws_messages = { 'optlist':'Display options', 'hide_page_numbers':'Hide page links', 'show_page_numbers':'Show page links', 'layout':'Layout', 'author':'Author', 'translator':'Translator', 'editor':'Editor', 'publisher':'Publisher', 'place':'Place', 'volume':'Volume', 'school':'School', 'book':'Book', 'collection':'Collection', 'journal':'Journal or magazine', 'phdthesis':'Thesis, report', 'dictionary':'Dictionary', 'progress':'Progress', 'progress_T':'Done', 'progress_V':'To be validated', 'progress_C':'To be proofread', 'progress_MS':'Ready for Match & Split', 'progress_OCR':'Needs an OCR text layer', 'progress_X':'Source file is an excerpt of a larger volume, or a mixture of several sources', 'progress_L':'Source file is incorrect (missing pages, unordered pages, etc)', '▲':'Return to the top of the page.',
'corr_list':"List of corrections performed on this page" ,
'corr_link':"Corrections" ,
'corr_one':"One typo </a> has been corrected." ,
'corr_many':" typos</a> have been corrected." ,
'corr_close':"Close." ,
'iwtrans':'Its text comes from', 'iwtrans2':'Its text comes from other Wikisource subdomains.' }
/* dynamic layouts from en.wikisource.org*/ self.ws_layouts = {
'Layout 1':{'text-wrap':"position:relative;margin-left:3em;margin-right:3em;",
'#text-container':"width:36em;margin:0px auto;font-family:Georgia,serif;" ,
'#text':"text-align:justify;",
'.sidenote-right':"position:absolute; left:37em;width:16em;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:37em;width:16em;text-indent:0em;text-align:right;",
'.editsection':"display:none",
'#headertemplate':"" },
'Layout 2':{'text-wrap':"",
'#text-container':"" ,
'#text':"",
'.sidenote-right':"float:right;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.sidenote-left':"float:left;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"" },
'Layout 3':{'text-wrap':"margin-left:3em",
'#text-container':"position:relative; min-width:60em; float:left; width:100%; margin-right:-23em;" ,
'#text':"text-align:justify;margin-right:23em; text-indent:0em; padding-left:0px; padding-right:0px;width:auto;",
'.sidenote-right':"position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.sidenote-left': "position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"position:absolute; top:0em; right:-23em; width:21em;float:right; text-align:left;" }
}
self.proofreadpage_add_container = true;
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript'); //importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript'); importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript'); importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript'); importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript'); importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');
/* From en.wikisource.org Disabling mouse wheel until the problem is fixed. Users that have a configurations where zoom wheel works can override this, by adding "self.proofreadpage_disable_wheelzoom=false;" to their javascript.
- /
self.proofreadpage_disable_wheelzoom=true;