אונטערשייד צווישן ווערסיעס פון "מעדיעוויקי:Common.js"

340 בייטן אראפגענומען ,  פֿאַר 2 יאָר
אפדעיט
ק (אויסשטעל)
(אפדעיט)
שורה 116: שורה 116:
   }
   }


  /*
/*
  * Adds an automatic '{{תב|מוגן}}' or '{{תב|מוגן חלקית}}' template when the page is protected.
* Adds an automatic '{{תב|מוגן}}' or '{{תב|מוגן חלקית}}' template when the page is protected.
  * You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted.
* You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted.
  *
*
  * written by [[User:ערן]], [[User:Yonidebest]]
* written by [[User:ערן]], [[User:Yonidebest]]
  *
*
  */
*/
  $(function () {
$(function(){
    var restrictionEdit =
var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit');
      mw.config.get("wgRestrictionCreate") ||
if( restrictionEdit &&
      mw.config.get("wgRestrictionEdit");
restrictionEdit.length > 0 &&
    if (
(
      restrictionEdit &&
restrictionEdit[0] === 'sysop' ||
      restrictionEdit.length > 0 &&
restrictionEdit[0] === 'autoconfirmed' ||
      (restrictionEdit[0] === "sysop" ||
restrictionEdit[0] === 'templateeditor' ||
        restrictionEdit[0] === "autoconfirmed" ||
restrictionEdit[0] === 'editautopatrolprotected'
        restrictionEdit[0] === "templateeditor" ||
) &&
        restrictionEdit[0] === "autopatrol") &&
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 &&
      $("#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected").length ===
( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 )
        0 &&
) {
      $.inArray(mw.config.get("wgAction"), ["view", "submit"]) + 1
var restrictionEditMapping = {
    ) {
'sysop': 'מוגן',
      var restrictionEditMapping = {
'templateeditor': 'הגנת תבניות',
        sysop: "מוגן",
'editautopatrolprotected': 'הגנה מוגברת',
        templateeditor: "הגנת ממשק",
'autoconfirmed': 'מוגן חלקית'
        autopatrol: "הגנה מוגברת",
};
        autoconfirmed: "מוגן חלקית",
      };
$.get( mw.util.wikiScript( 'api' ), {
 
action: 'parse',
      $.get(
format: 'json',
        mw.util.wikiScript("api"),
text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}',
        {
prop: 'text|indicators',
          action: "parse",
title: mw.config.get('wgPageName'),
          format: "json",
contentmodel: 'wikitext'
          text: "{{" + restrictionEditMapping[restrictionEdit[0]] + "}}",
}, function( data ) {
          prop: "text|indicators",
$( function () {
          title: mw.config.get("wgPageName"),
$( '.printfooter' ).before( $( '<div>', {
          contentmodel: "wikitext",
'class': 'plprotected',
        },
'html': data.parse.text['*']
        function (data) {
} ) );
          $(function () {
            $(".printfooter").before(
var newList = [];
              $("<div>", {
$.each( data.parse.indicators, function ( name, indicator ) {
                class: "plprotected",
newList.push(
                html: data.parse.text["*"],
$( '<div>' )
              })
        .addClass( 'mw-indicator' )
            );
        .attr( 'id', mw.util.escapeIdForAttribute( 'mw-indicator-' + indicator.name ) )
 
        .html( indicator['*'] )
            var newList = [];
        .get( 0 ),
            $.each(data.parse.indicators, function (name, indicator) {
// Add a whitespace between the <div>s because
              newList.push(
// they get displayed with display: inline-block
                $("<div>")
document.createTextNode( '\n' )
                  .addClass("mw-indicator")
);
                  .attr(
} );
                    "id",
$( '.mw-indicators' ).append( newList );
                    mw.util.escapeIdForAttribute(
} );
                      "mw-indicator-" + indicator.name
} );
                    )
}
                  )
});
                  .html(indicator["*"])
} );
                  .get(0),
                // Add a whitespace between the <div>s because
                // they get displayed with display: inline-block
                document.createTextNode("\n")
              );
            });
            $(".mw-indicators").append(newList);
          });
        }
      );
    }
  });
});


// On demand loading of gadgets, initial version from ruwiki.
// On demand loading of gadgets, initial version from ruwiki.