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

ביטול גרסה 8556677 של Mikimik (שיחה)
אין תקציר עריכה
 
(257 גרסאות ביניים של 19 משתמשים אינן מוצגות)
שורה 1: שורה 1:
// Global variable hints for JSHint
/* global $, mw, importScript */
/* ייבוא סקריפטים */
/* ייבוא סקריפטים */
importScript("MediaWiki:Functions.js"); // פונקציות המצויות בשימוש בסקריפטים שונים


// סקריפטים עבור העמוד הראשי
/* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */
if(wgTitle == "עמוד ראשי"){
function importUserScript() {
importScript("MediaWiki:Mainpage.js"); // שיפורים שונים בעמוד הראשי
'use strict';
importScript("MediaWiki:Portals.js"); // פורטלים מתחלפים בעמוד הראשי
 
var args = arguments;
 
mw.loader.using( 'mediawiki.util', function () {
for ( var arg = 0; arg < args.length; arg++ ) {
try {
importScript( 'MediaWiki:סקריפטים/' + args[arg] + '.js' );
}
catch( e ) {
}
}
} );
}
}


// סקריפטים כלליים
/* פונקציה הטוענת פונקציות בעת עליית הדף */
importScript("MediaWiki:UploadLink.js"); // שינוי קישורי ההעלאה
function addLoadEvent() {
importScript("MediaWiki:SubPagesLink.js"); // הוספת קישור לדפי המשנה של הדף הנוכחי
// Deprecated
importScript("MediaWiki:FeaturedInterwiki.js"); // תמיכה באינטרוויקי מומלץ
}
importScript("MediaWiki:Navigationbar.js"); // תמיכה בקופסאות מוסתרות
importScript("MediaWiki:SelectAllunDel.js"); // כפתור "סימון כל הגרסאות" בדף שחזור הגרסאות
importScript("MediaWiki:Collapsetables.js"); // טבלאות מוסתרות
importScript("MediaWiki:Fixol.js"); // תיקון הרשימות הממוספרות למשתמשי פיירפוקס
importScript("MediaWiki:Hebcalendar.js"); // תוספות לתאריכים עבריים
importScript("MediaWiki:Autopurge.js"); // הוספת אפשרות לרענון אוטומטי על ידי אנונימיים, ללא מעבר בטופס
importScript("MediaWiki:Tabs.js"); // תמיכה בלשוניות
importScript("MediaWiki:AlertProtected.js"); // סקריפט המוסיף תבנית "מוגן" או "מוגן חלקית" לדף מוגן או מוגן חלקית, בהתאמה
importScript("MediaWiki:SearchEngines.js"); // בחירה במנועי חיפוש שונים


// סקריפטים עבור אנונימיים ו/או חדשים
mw.loader.using( 'mediawiki.util', function () {
if(wgUserName == null){
'use strict';
importScript("MediaWiki:Navtip.js"); // הוספת התיבה "רוצה טיפ?" בצד למשתמשים אנונימיים
importScript("MediaWiki:HelpLinks.js"); // הוספת מסגרת הפניית תשומת לב לדף השיחה של הערך + הסבר בדפי שיחה כיצד להוסיף פסקה חדשה לערך. מוצג אצל משתמשים חדשים ואנונימיים בלבד.


  // ביטול תצוגת הודעה מרכזית של הקרן (היוצר קו אפור ב-IE)
importScript( 'MediaWiki:Functions.js' ); // פונקציות המצויות בשימוש בסקריפטים שונים
var centralNoticeClass = getElementsByClassName(document, 'table', 'notice-wrapper-boardvote-voting');
 
  if (centralNoticeClass && centralNoticeClass[0] ) centralNoticeClass[0].style.display = 'none';
if ( $.inArray( mw.config.get( 'wgPageName' ), [
}
'עמוד_ראשי',
'שיחה:עמוד_ראשי'
] ) + 1 ) {
importScript( 'MediaWiki:Mainpage.js' ); // שיפורים שונים בעמוד הראשי
 
if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) {
importScript( 'MediaWiki:Portals.js' ); // פורטלים מתחלפים בעמוד הראשי
}
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {
mw.loader.load( 'ext.gadget.ime' );
}
 
 
// סקריפטים עבור אנונימיים ו/או חדשיםs
if ( $.inArray( 'autoconfirmed', mw.config.get( 'wgUserGroups' ) ) === -1 ) {
importScript( 'MediaWiki:Autopurge.js' ); // הוספת אפשרות לרענון אוטומטי על ידי אנונימיים, ללא מעבר בטופס
importScript( 'MediaWiki:Navtip.js' ); // הוספת התיבה "רוצה טיפ?" בצד למשתמשים אנונימיים
}
 
// סקריפטים לדפי עריכה
if ( ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) + 1 ) &&
!$( '#wpTextbox1' ).prop( 'readonly' )
) {
importScript( 'MediaWiki:Templateslist.js' ); // הצגת רשימת תבניות
importScript( 'MediaWiki:Nosaving.js' ); // חיוב תצוגה מקדימה למשתמשים אנונימיים
importScript( 'MediaWiki:Edittools.js' ); // שיפור התווים המיוחדים שמתחת לדף העריכה
importScript( 'MediaWiki:Ref2template.js' ); //ref סקריפט שמשנה את התנהגות כפתור "הערה": הוספת תבנית הערה. במקום להוסיף תג
}
 
// סקריפטים לעמודים ספציפיים
if( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Upload' ) {
importScript( 'MediaWiki:Licenses.js' ); // שיפורים ברשיונות ושינויים בדף ההעלאה
}
 
// הופעת [[תבנית:דיון חדש במזנון]] לפני יצירת פסקה חדשה במזנון
if( mw.config.get( 'wgPageName' ) === 'ויקיפדיה:מזנון' ) {
$( document ).ready( function() {
var $addSectionLink = $( '#ca-addsection a' ),
currentHref = $addSectionLink.attr( 'href' );
 
$addSectionLink.attr( 'href', currentHref + '&editintro=תבנית:דיון_חדש_במזנון' );
} );
}
 
// link to sub pages
if ( mw.config.get( 'wgNamespaceNumber' ) > 0 &&
mw.config.get('wgNamespaceNumber') != 6 &&
mw.config.get('wgNamespaceNumber') != 14
) {
$ ( function() {
var linkText = mw.config.get( 'wgUserLanguage' ) == 'he' ? 'דפי משנה' : 'Sub pages',
linkTitle = mw.config.get( 'wgUserLanguage' ) == 'he' ? 'רשימת דפי המשנה של דף זה' : 'List of the sub pages of this page';
$( '#t-recentchangeslinked' ).after( $( '<li>' ).append( $( '<a>', {
text: linkText,
href: mw.util.getUrl( 'Special:PrefixIndex/' + mw.config.get( 'wgPageName' ) ),
title: linkTitle
} ) ) );
} );
}
 
/** WikiMiniAtlas *******************************************************
*
*  Description: WikiMiniAtlas is a popup click and drag world map.
*              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
*              The script itself is located on meta because it is used by many projects.
*              See [[Meta:WikiMiniAtlas]] for more information.
* Maintainers: [[User:Dschwen]]
*/
( function () {
if ( $( 'a.external.text[href*=geohack], div.kmldata' ).length ) {
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript' );
}
} )();
 
/*
* Description: Redirects from /User:UserName/skin.js or .css to the user's actual skin page. Used (also) in {{תב|דף אישי}}.
* Originally created by [[:en:User:Cacycle]]
*/
$( function () {
if ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgUserName' ) ) {
            var pageName = mw.config.get( 'wgPageName' );
var slash = pageName.indexOf( '/' );
var norm = pageName.substr( 0, slash ) + mw.config.get( 'wgPageName' ).substr( slash ).toLowerCase();
var test = 'משתמש:' + mw.config.get( 'wgUserName' ).replace( / /g, '_' ) + '/skin.';
var ext = null;
 
if ( norm === test + 'js' ) {
ext = 'js';
} else if (norm === test + 'css') {
ext = 'css';
}
 
if ( ext !== null ) {
window.location.href = window.location.href.replace(
/\/skin.(css|js)/i,
'/' + mw.config.get( 'skin' ) + '.' + ext
);
}
}
 
// create an event when util.addPortletLink() is called, so scripts that manipulate menus ca readjust.
var oldFunc = mw.util.addPortletLink;
if ( typeof oldFunc === 'function' ) {
mw.util.addPortletLink = function () {
var res = oldFunc.apply( this, arguments );
$( document ).trigger( 'new-portlet-link' );
 
return res;
};
}
} );
 
if ( $.inArray( mw.config.get( 'wgPageName' ), [
'ויקיפדיה:בוקמרקלטים',
'שיחת_ויקיפדיה:בוקמרקלטים'
] ) + 1 ) { 
importScript( 'MediaWiki:bookmarkletsInit.js' ); // דף הבוקמרקלטים
}


// סקריפטים עבור מפעילים
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ) {
if ( wgUserGroups != null && (wgUserGroups[0] == 'sysop' || wgUserGroups[1] == 'sysop') ) {
importScript( 'MediaWiki:SearchEngines.js' ); // בחירה במנועי חיפוש שונים
importScript("MediaWiki:FixHistPage.js"); // הסתרת קישורים ותיבות checkbox אצל מפעילים בדף ההיסטוריה והוספת אפשרות להפעלתם באמצעות כפתור מתאים.
importScript( 'Mediawiki:Gadget-advanceSearch.js' );
}
}


//סקריפטים לדפי עריכה
/*
if ( wgAction == "edit" || wgAction == "submit" || wgCanonicalSpecialPageName == "Upload" )
* Adds an automatic '{{תב|מוגן}}' or '{{תב|מוגן חלקית}}' template when the page is protected.
{
* You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted.
importScript("MediaWiki:Edittoolbar.js"); // תוספות לסרגל העריכה
*
importScript("MediaWiki:Templateslist.js"); // הצגת רשימת תבניות
* written by [[User:ערן]], [[User:Yonidebest]]
importScript("MediaWiki:Summarieslist.js"); // הצגת רשימת תקצירי עריכה
*
importScript("MediaWiki:Nosaving.js"); // חיוב תצוגה מקדימה למשתמשים אנונימיים
*/
importScript("MediaWiki:Edittools.js"); // שיפור התווים המיוחדים שמתחת לדף העריכה
$(function(){
importScript("MediaWiki:References.js"); // סקריפט המתריע למשתמשים כאשר יש הערות שוליים ואין פיסקת הערות שוליים
var restrictionEdit = mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit');
importScript("MediaWiki:Licenses.js"); // שיפורים ברשיונות ושינויים בדף ההעלאה
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 );
} );
} );
}
});
} );


// סקריפטים לעמודים ספציפיים
// search meta-commands: make the table display clickabe keywords.
importScript("MediaWiki:VillagePump.js"); // הופעת [[תבנית:דיון חדש במזנון]] לפני יצירת פסקה חדשה במזנון
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' ) {
importScript("MediaWiki:Filtertalk.js"); // סקריפט המוסיף קישור לדפי שיחה של המסננים
mw.hook( 'he.wikipedia.collapsetables.loaded' ).add( function () {
'use strict';


/** WikiMiniAtlas *******************************************************
var $searchBox = $( '#searchText input' ),
  *
$metaStringsTable = $( '#mw-search-meta-strings' );
  *  Description: WikiMiniAtlas is a popup click and drag world map.
  *              This script causes all of our coordinate links to display the WikiMiniAtlas popup button.
$metaStringsTable.find( 'span.mw-search-meta-string' ).wrap( $( '<a>' )
  *              The script itself is located on meta because it is used by many projects.
.click( function( e ) {
  *              See [[Meta:WikiMiniAtlas]] for more information.  
var currentText, newText;
  *  Maintainers: [[User:Dschwen]]
  */
if (wgServer == "https://secure.wikimedia.org") {
  var metaBase = "https://secure.wikimedia.org/wikipedia/meta";
} else {
  var metaBase = "http://meta.wikimedia.org";
}
importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400")


/******* סקריפטים זמניים ******/
e.preventDefault();


/* move damn "try beta" link to end */
currentText = $searchBox.val();
function fixBetaLink() {
newText = $( this ).text();
var ptoptintry = document.getElementById('pt-optin-try');
if (!ptoptintry) return;


ptoptintry.parentNode.appendChild(ptoptintry);
$searchBox.val( currentText + newText );
} )
);
// Make the table appear only after the collapsible styles are loaded,
// so that it won't delay showing the search results
$metaStringsTable.css( 'display', 'table' );
} );
}
}


addOnloadHook(fixBetaLink);
// On demand loading of scripts and gadgets, initial version from ruwiki.
 
// Detects uses of template "טען סקריפט"
importScript("MediaWiki:ImgToggle.js"); // סקריפט בבדיקה - החלפת תמונות
// and loads specifically-named scripts or gadgets.
// for a gadget, its name as defined in gadgets-definition must begin with "ondemand-"
if ( mw.config.get('wgCanonicalNamespace') !== 'Special' )
mw.hook( 'wikipage.content' ).add( function( content ) {
var beenthere = {};
$( '.executeJS', content ).each( function () {
var gadget = $( this ).data( 'gadgetname' );
if ( gadget && $.trim( gadget ) ) mw.loader.load( 'ext.gadget.ondemand-' + $.trim( gadget ) ); // np repetitions - resourceloader takes care
} );
} );