MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus OBS Wiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/**
* Wikipage import methods
*
* See https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript#wikibits.js
*/
/**
* @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25.
*/
function importScriptURI( url ) {
if ( loadedScripts[ url ] ) {
return null;
}
loadedScripts[ url ] = true;
var s = document.createElement( 'script' );
s.setAttribute( 'src', url );
document.getElementsByTagName( 'head' )[ 0 ].appendChild( s );
return s;
}
function importScript( page ) {
var uri = mw.config.get( 'wgScript' ) + '?title=' +
mw.util.wikiUrlencode( page ) +
'&action=raw&ctype=text/javascript';
return importScriptURI( uri );
}
/**
* @deprecated since 1.17 Use mw.loader instead. Warnings added in 1.25.
*/
function importStylesheetURI( url, media ) {
var l = document.createElement( 'link' );
l.rel = 'stylesheet';
l.href = url;
if ( media ) {
l.media = media;
}
document.getElementsByTagName( 'head' )[ 0 ].appendChild( l );
return l;
}
function importStylesheet( page ) {
var uri = mw.config.get( 'wgScript' ) + '?title=' +
mw.util.wikiUrlencode( page ) +
'&action=raw&ctype=text/css';
return importStylesheetURI( uri );
}
/**
/**
  * Redirect User:Name/skin.js and skin.css to the current skin's pages
  * Redirect User:Name/skin.js and skin.css to the current skin's pages
Zeile 106: Zeile 58:
  }
  }
}
}
/* this does not work at all :( */

Version vom 28. Juli 2017, 16:13 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */
/**
 * Redirect User:Name/skin.js and skin.css to the current skin's pages
 * (unless the 'skin' page really exists)
 * @source: http://www.mediawiki.org/wiki/Snippets/Redirect_skin.js
 * @rev: 2
 */
if ( mw.config.get( 'wgArticleId' ) == 0 && mw.config.get( 'wgNamespaceNumber' ) == 2 ) {
        var titleParts = mw.config.get( 'wgPageName' ).split( '/' );
        // Make sure there was a part before and after the slash
        // And that the latter is 'skin.js' or 'skin.css'
        if ( titleParts.length == 2 ) {
                var userSkinPage = titleParts.shift() + '/' + mw.config.get( 'skin' );
                if ( titleParts.slice(-1) == 'skin.js' ) {
                        window.location.href = mw.util.wikiGetlink( userSkinPage + '.js' );
                } else if ( titleParts.slice(-1) == 'skin.css' ) {
                        window.location.href = mw.util.wikiGetlink( userSkinPage + '.css' );
                }
        }
}

// Book specific
var wgBookName = ( mw.config.get( 'wgPageName' ).split( '/', 1)[0] || '' ).split( ':', 2 ).join( ':' );
importStylesheet('MediaWiki:Common.css/' + wgBookName);

// makeCollapsible (remove when deployed)
importStylesheet('MediaWiki:JQuery-makeCollapsible.css');
importScript('MediaWiki:JQuery-makeCollapsible.js'); 

// Imported scripts
importScript('MediaWiki:Common.js/Relics.js');
importScript('MediaWiki:Common.js/ExtraTools.js');
importScript('MediaWiki:Common.js/CollapseElements.js');
importScript('MediaWiki:Common.js/NavigationTabs.js');
importScript('MediaWiki:Common.js/Displaytitle.js');
importScript('MediaWiki:Common.js/RandomBook.js');
importScript('MediaWiki:Common.js/Perbook.js');
importScript('MediaWiki:Common.js/tabs.js');
importScript('MediaWiki:Common.js/top.js');
importScript('MediaWiki:Common.js/review.js');
importScript('MediaWiki:Common.js/Categories.js');
importScript('MediaWiki:Common.js/use.js');

if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == 'Watchlist' ) {
	importScript('MediaWiki:Common.js/WatchlistNotice.js');
} else if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit', 'upload'] ) != -1 ) {
	importScript('MediaWiki:Common.js/Special_characters.js');
	importScript('MediaWiki:Common.js/Toolbox.js');
}

// Load sysop-specific JavaScript/CSS from [[MediaWiki:Common.js/Sysop.js]] and [[MediaWiki:Common.css/Sysop.css]]
if ( $.inArray( 'sysop', wgUserGroups) > -1 ) {
 importStylesheet('MediaWiki:Common.css/Sysop.css');
 if ( !window.disableSysopJS ) {
  $(function(){
   importScript('MediaWiki:Common.js/Sysop.js');
  });
 }
}

/* this does not work at all :( */