מדיה ויקי:Common.js – הבדלי גרסאות
אין תקציר עריכה |
ניסיון לתיקון באג |
||
| (14 גרסאות ביניים של 5 משתמשים אינן מוצגות) | |||
| שורה 1: | שורה 1: | ||
// Global variable hints for JSHint | // Global variable hints for JSHint | ||
/* global $, mw */ | /* global $, mw, importScript */ | ||
/* ייבוא סקריפטים */ | /* ייבוא סקריפטים */ | ||
/* פונקציה לייבוא סקריפט מ[[חב"דפדיה:סקריפטים]] */ | /* פונקציה לייבוא סקריפט מ[[חב"דפדיה:סקריפטים]] */ | ||
function importUserScript() { | function importUserScript() { | ||
'use strict'; | 'use strict'; | ||
var args = arguments; | var args = arguments; | ||
mw.loader.using( 'mediawiki.util', function() { | mw.loader.using( 'mediawiki.util', function () { | ||
for ( var arg = 0; arg < args.length; arg++ ) { | for ( var arg = 0; arg < args.length; arg++ ) { | ||
try { | try { | ||
| שורה 59: | שורה 57: | ||
) { | ) { | ||
importScript( 'MediaWiki:Templateslist.js' ); // הצגת רשימת תבניות | importScript( 'MediaWiki:Templateslist.js' ); // הצגת רשימת תבניות | ||
importScript( 'MediaWiki:Nosaving.js' ); // חיוב תצוגה מקדימה למשתמשים אנונימיים | importScript( 'MediaWiki:Nosaving.js' ); // חיוב תצוגה מקדימה למשתמשים אנונימיים ולחשבונות חולפים | ||
importScript( 'MediaWiki:Edittools.js' ); // שיפור התווים המיוחדים שמתחת לדף העריכה | importScript( 'MediaWiki:Edittools.js' ); // שיפור התווים המיוחדים שמתחת לדף העריכה | ||
importScript( 'MediaWiki:Ref2template.js' ); //ref סקריפט שמשנה את התנהגות כפתור "הערה": הוספת תבנית הערה. במקום להוסיף תג | importScript( 'MediaWiki:Ref2template.js' ); //ref סקריפט שמשנה את התנהגות כפתור "הערה": הוספת תבנית הערה. במקום להוסיף תג | ||
| שורה 69: | שורה 67: | ||
} | } | ||
// הופעת [[תבנית:דיון חדש באולם]] לפני יצירת פסקה חדשה באולם | // הופעת [[תבנית:דיון חדש באולם]] לפני יצירת פסקה חדשה באולם | ||
if( mw.config.get( 'wgPageName' ) === 'חב"דפדיה:אולם דיונים' ) { | if( mw.config.get( 'wgPageName' ) === 'חב"דפדיה:אולם דיונים' ) { | ||
$( document ).ready( function() { | $( document ).ready( function() { | ||
| שורה 167: | שורה 165: | ||
* | * | ||
*/ | */ | ||
$(function(){ | |||
var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit'); | |||
if( restrictionEdit && | |||
restrictionEdit.length > 0 && | |||
( | |||
restrictionEdit[0] === 'sysop' || | |||
restrictionEdit[0] === 'autoconfirmed' || | |||
restrictionEdit[0] === 'templateeditor' || | |||
restrictionEdit[0] === 'editautopatrolprotected' | |||
) && | |||
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 && | |||
( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 ) | |||
) { | |||
var restrictionEditMapping = { | |||
'sysop': 'מוגן', | |||
'templateeditor': 'הגנת תבניות', | |||
'editautopatrolprotected': 'הגנה מוגברת', | |||
'autoconfirmed': 'מוגן חלקית' | |||
}; | |||
$.get( mw.util.wikiScript( 'api' ), { | |||
action: 'parse', | |||
format: 'json', | |||
text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}', | |||
prop: 'text|indicators', | |||
title: mw.config.get('wgPageName'), | |||
contentmodel: 'wikitext' | |||
}, function( data ) { | |||
$( function () { | |||
$( '.printfooter' ).before( $( '<div>', { | |||
'class': 'plprotected', | |||
'html': data.parse.text['*'] | |||
} ) ); | |||
var newList = []; | |||
$.each( data.parse.indicators, function ( name, indicator ) { | |||
newList.push( | |||
$( '<div>' ) | |||
.addClass( 'mw-indicator' ) | |||
.attr( 'id', 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 ); | |||
} ); | |||
} ); | |||
} | |||
}); | |||
} ); | } ); | ||
| שורה 247: | שורה 245: | ||
} ); | } ); | ||
} | } | ||
// if page is semi-protectedted and user is autoconfirmed but not autopatroller, patroller, or an admin | |||
// check if user meets community standard for "autoconfirmed" (30 days, 100 edits), and if they don't, | |||
// remove edit capability, similar to normal protection behavior. | |||
// מסנן השחתות #109 will prevent this user from saving their work in any case. | |||
(function() { | |||
var ug = mw.config.get("wgUserGroups"), | |||
prot = mw.config.get("wgRestrictionEdit", []); | |||
if (prot[0] == 'autoconfirmed' && | |||
ug.includes('autoconfirmed') && | |||
! ug.includes('autopatrolled') && | |||
! ug.includes('patroller') && | |||
! ug.includes('sysop') | |||
) { | |||
importScript( 'mediawiki:Block-newbie-edit.js' ); | |||
} | |||
})(); | |||
// On demand loading of gadgets, initial version from ruwiki. | // On demand loading of gadgets, initial version from ruwiki. | ||
| שורה 259: | שורה 274: | ||
} ); | } ); | ||
} ); | } ); | ||
/*מכאן ואילך: קוד שנוצר בחב"דפדיה*/ | /*מכאן ואילך: קוד שנוצר בחב"דפדיה*/ | ||
try { | try { | ||
document.getElementById('wpLeaveRedirect').checked=false; | document.getElementById('wpLeaveRedirect').checked=false; | ||
} | } | ||
catch(err) {} | catch(err) {} | ||
| שורה 274: | שורה 283: | ||
} | } | ||
catch(err) {} | catch(err) {} | ||
if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { | if (mw.config.get('wgNamespaceNumber')==6 && mw.config.get('wgAction')=='view') { | ||
mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); | mw.loader.load('//tools.wmflabs.org/imagemapedit/ime.js'); | ||
| שורה 281: | שורה 289: | ||
// }) | // }) | ||
// } ) | // } ) | ||
mw.loader.load(" | //mw.loader.load("//chabadpedia.co.il/index.php?title=מדיה_ויקי:Gadget-Summarieslist.js&action=raw&ctype=text/javascript"); | ||
function importScriptURI(uri) { | function importScriptURI(uri) { | ||
mw.loader.load(uri); | mw.loader.load(uri); | ||
| שורה 292: | שורה 299: | ||
document.getElementsByTagName('head')[0].appendChild(link); | document.getElementsByTagName('head')[0].appendChild(link); | ||
} | } | ||
// עבור ספירת ערכים | |||
mw.loader.load('/index.php?title=MediaWiki:Stats.js&action=raw&ctype=text/javascript'); | |||