MediaWiki:Gadget-global-constants.js: Unterschied zwischen den Versionen

Aus Stupidedia, der sinnfreien Enzyklopädie!
Wechseln zu: Navigation, Suche
Zeile 16: Zeile 16:
 
$.each( ['award', 'create', 'edit', 'move', 'upload'], function() {
 
$.each( ['award', 'create', 'edit', 'move', 'upload'], function() {
 
     global.protection[this] = '*';
 
     global.protection[this] = '*';
     if ( mw.config.get( 'wgRestriction' + $.ucFirst( this ) ) !== null ) {
+
     if ( mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) ) !== null ) {
         if ( mw.config.get( 'wgRestriction' + $.ucFirst( this ) ).length !== 0 ) {
+
         if ( mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) ).length !== 0 ) {
             global.protection[this] = mw.config.get( 'wgRestriction' + $.ucFirst( this ) )[0];
+
             global.protection[this] = mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) )[0];
 
         }
 
         }
 
     }
 
     }
Zeile 57: Zeile 57:
  
 
// Signaturcode
 
// Signaturcode
global.signature = $.parseJSON( mw.user.options.get( 'userjs-signature' ) ) || '— ~~~~';
+
global.signature = $.parseJSON( mw.user.options.get( 'userjs-signature' ) ) || '— [[Benutzer:Uebel|Uebel]] ([[Benutzer Diskussion:Uebel|Diskussion]]) 17:55, 8. Mär. 2018 (CET)';

Version vom 8. März 2018, 18:55 Uhr

/**
 * Globale „Konstanten“ und sowas
 *
 * <nowiki>
 */

// Seitenstatus
global.isEditing = ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 && mw.config.get( 'wgNamespaceNumber' ) !== -1 ); // Sind wir am Bearbeiten?
global.isArticle = ( $.inArray( mw.config.get( 'wgNamespaceNumber' ), [0, 102, 104, 106] ) !== -1 ); // Handelt es sich um einen Artikel?
global.isTalkpage = ( mw.config.get( 'wgNamespaceNumber' ) % 2 === 1 && mw.config.get( 'wgNamespaceNumber' ) !== -1 ); // Oder um eine Diskussionsseite?
global.isSubjectpage = !global.isTalkpage;
global.isSpecialpage = ( mw.config.get( 'wgNamespaceNumber' ) === -1 );
global.pageExists = ( mw.config.get( 'wgArticleId' ) !== 0 );

global.protection = new Object();
$.each( ['award', 'create', 'edit', 'move', 'upload'], function() {
    global.protection[this] = '*';
    if ( mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) ) !== null ) {
        if ( mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) ).length !== 0 ) {
            global.protection[this] = mw.config.get( 'wgRestriction' + jquery.ucFirst( this ) )[0];
        }
    }
} );

// Textfeld und Zusammenfassung
global.textbox = document.getElementById( 'wpTextbox1' );
global.summary = document.getElementById( 'wpSummary' );

// Benutzergruppen
global.groups = new Object();
global.groups.all = mw.config.get( 'wgUserGroups' );
global.groups.names = {
    '*': 'Alle',
    user: 'Benutzer',
    autoconfirmed: 'Automatisch bestätigte Benutzer',
    hda: 'Helden der Arbeit',
    f: 'Funktionäre',
    sysop: 'Diktatoren',
    checkuser: 'Checker',
    bureaucrat: 'Bürokraten',
    bot: 'Bots',
    developer: 'Systemadministratoren'
};
$.each( ['*', 'user', 'autoconfirmed', 'hda', 'f', 'sysop', 'checkuser', 'bureaucrat', 'bot', 'developer'], function() {
    global.groups[this] = ( $.inArray( this.toString(), global.groups.all ) !== -1 );
} );

// Tokens
global.editToken = mw.user.tokens.get( 'editToken' );
global.watchToken = mw.user.tokens.get( 'watchToken' );

// Dateipfade
global.fileSources = {};

// Titelobjekte
global.titleObjects = {};

// Signaturcode
global.signature = $.parseJSON( mw.user.options.get( 'userjs-signature' ) ) || '— [[Benutzer:Uebel|Uebel]] ([[Benutzer Diskussion:Uebel|Diskussion]]) 17:55, 8. Mär. 2018 (CET)';

Linktipps: Faditiva und 3DPresso