מדיה ויקי:Common.js – הבדלי גרסאות

אין תקציר עריכה
מ. רובין (שיחה | תרומות)
ניסיון לתיקון באג
 
(14 גרסאות ביניים של 5 משתמשים אינן מוצגות)
שורה 1: שורה 1:
// Global variable hints for JSHint
// Global variable hints for JSHint
/* global $, mw */
/* global $, mw, importScript */


/* ייבוא סקריפטים */
/* ייבוא סקריפטים */


//function importScript(pageName) {
//    mw.loader.load("//chabadpedia.co.il/index.php?title="+pageName+"&action=raw&ctype=text/javascript");
//}
/* פונקציה לייבוא סקריפט מ[[חב"דפדיה:סקריפטים]] */
/* פונקציה לייבוא סקריפט מ[[חב"דפדיה:סקריפטים]] */
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(){
$(function(){
// var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit');
var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit');
// if( restrictionEdit &&
if( restrictionEdit &&
// restrictionEdit.length > 0 &&
restrictionEdit.length > 0 &&
// (
(
// restrictionEdit[0] === 'sysop' ||
restrictionEdit[0] === 'sysop' ||
// restrictionEdit[0] === 'autoconfirmed' ||
restrictionEdit[0] === 'autoconfirmed' ||
// restrictionEdit[0] === 'templateeditor' ||
restrictionEdit[0] === 'templateeditor' ||
// restrictionEdit[0] === 'editautopatrolprotected'
restrictionEdit[0] === 'editautopatrolprotected'
// ) &&
) &&
// $( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 &&
$( '#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected' ).length === 0 &&
// ( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 )
( $.inArray( mw.config.get( 'wgAction' ), [ 'view', 'submit' ] ) + 1 )
// ) {
) {
// var restrictionEditMapping = {
var restrictionEditMapping = {
// 'sysop': 'מוגן',
'sysop': 'מוגן',
// 'templateeditor': 'הגנת ממשק',
'templateeditor': 'הגנת תבניות',
// 'editautopatrolprotected': 'הגנה מוגברת',
'editautopatrolprotected': 'הגנה מוגברת',
// 'autoconfirmed': 'מוגן חלקית'
'autoconfirmed': 'מוגן חלקית'
// };
};
// $.get( mw.util.wikiScript( 'api' ), {
$.get( mw.util.wikiScript( 'api' ), {
// action: 'parse',
action: 'parse',
// format: 'json',
format: 'json',
// text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}',
text: '{{' + restrictionEditMapping[restrictionEdit[0]] + '}}',
// prop: 'text|indicators',
prop: 'text|indicators',
// title: mw.config.get('wgPageName'),
title: mw.config.get('wgPageName'),
// contentmodel: 'wikitext'
contentmodel: 'wikitext'
// }, function( data ) {
}, function( data ) {
// $( function () {
$( function () {
// $( '.printfooter' ).before( $( '<div>', {
$( '.printfooter' ).before( $( '<div>', {
// 'class': 'plprotected',
'class': 'plprotected',
// 'html': data.parse.text['*']
'html': data.parse.text['*']
// } ) );
} ) );
// var newList = [];
var newList = [];
// $.each( data.parse.indicators, function ( name, indicator ) {
$.each( data.parse.indicators, function ( name, indicator ) {
// newList.push(
newList.push(
// $( '<div>' )
$( '<div>' )
//         .addClass( 'mw-indicator' )
        .addClass( 'mw-indicator' )
//         .attr( 'id', mw.util.escapeIdForAttribute( 'mw-indicator-' + indicator.name ) )
        .attr( 'id', mw.util.escapeIdForAttribute( 'mw-indicator-' + indicator.name ) )
//         .html( indicator['*'] )
        .html( indicator['*'] )
//         .get( 0 ),
        .get( 0 ),
// // Add a whitespace between the <div>s because
// Add a whitespace between the <div>s because
// // they get displayed with display: inline-block
// they get displayed with display: inline-block
// document.createTextNode( '\n' )
document.createTextNode( '\n' )
// );
);
// } );
} );
// $( '.mw-indicators' ).append( newList );
$( '.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) {}
try {
document.getElementById("mw-createaccount-join").innerText='הצטרפות לחב"דפדיה';
}
}
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("http://chabadpedia.co.il/index.php?title=מדיה_ויקי:Gadget-Summarieslist.js&action=raw&ctype=text/javascript");
//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);
}
}
link.href = 'http://chabadpedia.co.il/images/e/e6/%D7%A1%D7%9E%D7%9C_%D7%97%D7%91%D7%93%D7%A4%D7%93%D7%99%D7%94.png';
 
// עבור ספירת ערכים
mw.loader.load('/index.php?title=MediaWiki:Stats.js&action=raw&ctype=text/javascript');