מדיה ויקי:Common.js: הבדלים בין גרסאות
מתוך The Crowdsourced Resource-Based Economy Knowledgebase
מ (גרסה אחת) |
(הגבלת אורך תקציר העריכה - קיים בממשק הכללי. הוספת סקריפט שמשנה את התנהגות כפתור "הערה", כך שיוסיף תבנית הערה במקום תג ref) |
||
(גרסת ביניים אחת של משתמש אחד אינה מוצגת) | |||
שורה 1: | שורה 1: | ||
− | /* | + | /* ייבוא סקריפטים */ |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | /* | + | /* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */ |
− | + | function importUserScript() { | |
− | + | var args = arguments; | |
− | + | mw.loader.using('mediawiki.util', function() { | |
− | + | for (var arg = 0; arg < args.length; arg++) { | |
− | + | try { | |
− | + | importScript( "MediaWiki:סקריפטים/" + args[arg]); | |
− | + | } | |
− | + | catch(e) {} | |
− | + | } | |
− | + | }); | |
} | } | ||
− | /** | + | /* פונקציה הטוענת פונקציות בעת עליית הדף */ |
− | + | function addLoadEvent(e) { hookEvent( "load", e ); } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | } | + | |
− | /* | + | /* פונקציה לקבלת ערך של פרמטר משורת הכתובת */ |
− | + | function getParamValue( paramName ) { return mw.util.getParamValue(paramName); } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | } | + | |
− | + | mw.loader.using( 'mediawiki.util', function() { | |
− | + | importScript("MediaWiki:Functions.js"); // פונקציות המצויות בשימוש בסקריפטים שונים | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | if ( wgPageName == "עמוד_ראשי" || wgPageName == "שיחה:עמוד_ראשי" ) { | |
− | + | importScript("MediaWiki:Mainpage.js"); // שיפורים שונים בעמוד הראשי | |
− | + | if ( wgNamespaceNumber == 0 ) importScript("MediaWiki:Portals.js"); // פורטלים מתחלפים בעמוד הראשי | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | / | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | if ( | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | // | + | // סקריפטים כלליים |
− | + | importScript("MediaWiki:UploadLink.js"); // שינוי קישורי ההעלאה | |
− | + | importScript("MediaWiki:SubPagesLink.js"); // הוספת קישור לדפי המשנה של הדף הנוכחי | |
− | + | importScript("MediaWiki:FeaturedInterwiki.js"); // תמיכה באינטרוויקי מומלץ ואיכותי | |
− | + | importScript("MediaWiki:Navigationbar.js"); // תמיכה בקופסאות מוסתרות | |
− | + | importScript("MediaWiki:Collapsetables.js"); // טבלאות מוסתרות | |
− | + | importScript("MediaWiki:Tabs.js"); // תמיכה בלשוניות | |
− | + | importScript("MediaWiki:ImgPresentation.js"); // מצגת תמונות | |
+ | importScript("MediaWiki:ImgToggle.js"); // החלפת תמונות, עבור [[תבנית:מפת מיקום]] | ||
+ | importScript("MediaWiki:LoadingContent.js"); // הצגת טקסטים הנטענים באופן דינמי | ||
+ | importScript("Mediawiki:Imagemap-Highlight.js") // עבור [[תבנית:מפת תמונה]] עם סימון=כן | ||
+ | importScript("MediaWiki:Autopurge.js"); // הוספת אפשרות לרענון אוטומטי על ידי אנונימיים, ללא מעבר בטופס | ||
+ | importScript('Mediawiki:Common.js/interwiki-lang.js'); // הצגת שם השפה בעברית | ||
+ | importScript('Mediawiki:Common.js/pgn.js'); // להצגת שחמט | ||
+ | importScript("MediaWiki:anonTalkLink.js"); // הצגת קישור לדף השיחה עבור אנונימיים, בעת קבלת הודעה | ||
+ | importScript("MediaWiki:HelpLinks.js"); // הוספת מסגרת הפניית תשומת לב לדף השיחה של הערך + הסבר בדפי שיחה כיצד להוסיף פסקה חדשה לערך. | ||
+ | if (wgNamespaceNumber == 6) | ||
+ | try{mw.loader.load('//toolserver.org/~dapete/ime/ime.js');}catch(e){} // surround with try/catch in case other server behaves badly. | ||
+ | // סקריפטים עבור אנונימיים ו/או חדשים | ||
+ | if ( $.inArray("autoconfirmed",wgUserGroups)==-1 ) { | ||
+ | importScript("MediaWiki:Navtip.js"); // הוספת התיבה "רוצה טיפ?" בצד למשתמשים אנונימיים | ||
} | } | ||
− | / | + | // סקריפטים לדפי עריכה |
− | + | if ( (wgAction == "edit" || wgAction == "submit") && !($('#wpTextbox1').prop( 'readonly' )) ) | |
− | + | { | |
− | if ( | + | importScript("MediaWiki:Edittoolbar.js"); // תוספות לסרגל העריכה |
− | + | importScript("MediaWiki:Templateslist.js"); // הצגת רשימת תבניות | |
− | + | importScript("MediaWiki:Nosaving.js"); // חיוב תצוגה מקדימה למשתמשים אנונימיים | |
− | + | importScript("MediaWiki:Edittools.js"); // שיפור התווים המיוחדים שמתחת לדף העריכה | |
− | + | importScript("MediaWiki:Ref2template.js"); //ref סקריפט שמשנה את התנהגות כפתור "הערה": הוספת תבנית הערה. במקום להוסיף תג | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | / | + | // סקריפטים לעמודים ספציפיים |
− | + | if(wgCanonicalSpecialPageName == "Upload" ) | |
− | + | importScript("MediaWiki:Licenses.js"); // שיפורים ברשיונות ושינויים בדף ההעלאה | |
− | if ( | + | // הופעת [[תבנית:דיון חדש במזנון]] לפני יצירת פסקה חדשה במזנון |
− | + | if(mw.config.get('wgPageName')=='ויקיפדיה:מזנון') | |
− | } | + | $(document).ready(function(){ |
+ | $('#ca-addsection a').attr('href',$('#ca-addsection a').attr('href')+'&editintro=תבנית:דיון_חדש_במזנון'); | ||
+ | }); | ||
− | /** | + | /** 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]] | ||
+ | */ | ||
+ | mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400'); | ||
+ | /* | ||
+ | * 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]] | ||
*/ | */ | ||
− | if ( | + | function skinRedirect() |
− | + | { | |
− | + | if (wgArticleId == 0 && wgUserName) { | |
+ | var slash = wgPageName.indexOf('/'); | ||
+ | var norm = wgPageName.substr(0, slash) + wgPageName.substr(slash).toLowerCase(); | ||
+ | var test = 'משתמש:' + 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, '/' + skin + '.' + ext); | ||
+ | } | ||
} | } | ||
+ | addOnloadHook(skinRedirect); | ||
− | + | if ( wgPageName == "ויקיפדיה:בוקמרקלטים" || wgPageName == "שיחת_ויקיפדיה:בוקמרקלטים" ) { | |
− | + | importScript("MediaWiki:/common.js/bookmarkletsInit.js"); // דף הבוקמרקלטים | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ( | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | / | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | if (wgNamespaceNumber == -1 && wgCanonicalSpecialPageName === 'Search'){ | |
− | + | importScript("MediaWiki:SearchEngines.js"); // בחירה במנועי חיפוש שונים | |
− | + | importScript('Mediawiki:Gadget-advanceSearch.js'); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | /* | |
− | + | * Adds an automatic "{{תב|מוגן}}" or "{{תב|מוגן חלקית}}" template when the page is protected. | |
− | /** | + | * You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted. |
− | * | + | |
* | * | ||
− | * | + | * written by [[User:ערן]], [[User:Yonidebest]] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
* | * | ||
− | |||
*/ | */ | ||
− | + | var restrictionEdit=mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit'); | |
− | + | if(restrictionEdit && restrictionEdit.length>0 && (restrictionEdit[0]=='sysop' || restrictionEdit[0]=='autoconfirmed') && $('#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected').length==0 && | |
− | + | ($.inArray(mw.config.get('wgAction'),['view','submit'])+1) && mw.config.get('wgNamespaceNumber')==0) | |
− | + | { | |
− | + | $.get(wgServer+mw.util.wikiScript('api'),{ | |
− | + | action: 'parse',format:'json',text: '{{'+(restrictionEdit[0] == 'sysop'? 'מוגן' : 'מוגן חלקית')+'}}',prop: 'text',title: mw.config.get('wgTitle') | |
− | + | },function(data){ | |
− | + | $(document).ready(function(){ | |
− | + | $('.printfooter').before($('<div>',{'class': 'plprotected',html:data.parse.text['*']})); | |
− | + | }); | |
− | + | ||
− | + | }); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
− | + | }); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | } ); | + | |
− | + |
גרסה מתאריך 07:29, 21 בינואר 2013
/* ייבוא סקריפטים */ /* פונקציה לייבוא סקריפט מ[[ויקיפדיה:סקריפטים]] */ function importUserScript() { var args = arguments; mw.loader.using('mediawiki.util', function() { for (var arg = 0; arg < args.length; arg++) { try { importScript( "MediaWiki:סקריפטים/" + args[arg]); } catch(e) {} } }); } /* פונקציה הטוענת פונקציות בעת עליית הדף */ function addLoadEvent(e) { hookEvent( "load", e ); } /* פונקציה לקבלת ערך של פרמטר משורת הכתובת */ function getParamValue( paramName ) { return mw.util.getParamValue(paramName); } mw.loader.using( 'mediawiki.util', function() { importScript("MediaWiki:Functions.js"); // פונקציות המצויות בשימוש בסקריפטים שונים if ( wgPageName == "עמוד_ראשי" || wgPageName == "שיחה:עמוד_ראשי" ) { importScript("MediaWiki:Mainpage.js"); // שיפורים שונים בעמוד הראשי if ( wgNamespaceNumber == 0 ) importScript("MediaWiki:Portals.js"); // פורטלים מתחלפים בעמוד הראשי } // סקריפטים כלליים importScript("MediaWiki:UploadLink.js"); // שינוי קישורי ההעלאה importScript("MediaWiki:SubPagesLink.js"); // הוספת קישור לדפי המשנה של הדף הנוכחי importScript("MediaWiki:FeaturedInterwiki.js"); // תמיכה באינטרוויקי מומלץ ואיכותי importScript("MediaWiki:Navigationbar.js"); // תמיכה בקופסאות מוסתרות importScript("MediaWiki:Collapsetables.js"); // טבלאות מוסתרות importScript("MediaWiki:Tabs.js"); // תמיכה בלשוניות importScript("MediaWiki:ImgPresentation.js"); // מצגת תמונות importScript("MediaWiki:ImgToggle.js"); // החלפת תמונות, עבור [[תבנית:מפת מיקום]] importScript("MediaWiki:LoadingContent.js"); // הצגת טקסטים הנטענים באופן דינמי importScript("Mediawiki:Imagemap-Highlight.js") // עבור [[תבנית:מפת תמונה]] עם סימון=כן importScript("MediaWiki:Autopurge.js"); // הוספת אפשרות לרענון אוטומטי על ידי אנונימיים, ללא מעבר בטופס importScript('Mediawiki:Common.js/interwiki-lang.js'); // הצגת שם השפה בעברית importScript('Mediawiki:Common.js/pgn.js'); // להצגת שחמט importScript("MediaWiki:anonTalkLink.js"); // הצגת קישור לדף השיחה עבור אנונימיים, בעת קבלת הודעה importScript("MediaWiki:HelpLinks.js"); // הוספת מסגרת הפניית תשומת לב לדף השיחה של הערך + הסבר בדפי שיחה כיצד להוסיף פסקה חדשה לערך. if (wgNamespaceNumber == 6) try{mw.loader.load('//toolserver.org/~dapete/ime/ime.js');}catch(e){} // surround with try/catch in case other server behaves badly. // סקריפטים עבור אנונימיים ו/או חדשים if ( $.inArray("autoconfirmed",wgUserGroups)==-1 ) { importScript("MediaWiki:Navtip.js"); // הוספת התיבה "רוצה טיפ?" בצד למשתמשים אנונימיים } // סקריפטים לדפי עריכה if ( (wgAction == "edit" || wgAction == "submit") && !($('#wpTextbox1').prop( 'readonly' )) ) { importScript("MediaWiki:Edittoolbar.js"); // תוספות לסרגל העריכה importScript("MediaWiki:Templateslist.js"); // הצגת רשימת תבניות importScript("MediaWiki:Nosaving.js"); // חיוב תצוגה מקדימה למשתמשים אנונימיים importScript("MediaWiki:Edittools.js"); // שיפור התווים המיוחדים שמתחת לדף העריכה importScript("MediaWiki:Ref2template.js"); //ref סקריפט שמשנה את התנהגות כפתור "הערה": הוספת תבנית הערה. במקום להוסיף תג } // סקריפטים לעמודים ספציפיים if(wgCanonicalSpecialPageName == "Upload" ) importScript("MediaWiki:Licenses.js"); // שיפורים ברשיונות ושינויים בדף ההעלאה // הופעת [[תבנית:דיון חדש במזנון]] לפני יצירת פסקה חדשה במזנון if(mw.config.get('wgPageName')=='ויקיפדיה:מזנון') $(document).ready(function(){ $('#ca-addsection a').attr('href',$('#ca-addsection a').attr('href')+'&editintro=תבנית:דיון_חדש_במזנון'); }); /** 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]] */ mw.loader.load('//meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400'); /* * 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 skinRedirect() { if (wgArticleId == 0 && wgUserName) { var slash = wgPageName.indexOf('/'); var norm = wgPageName.substr(0, slash) + wgPageName.substr(slash).toLowerCase(); var test = 'משתמש:' + 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, '/' + skin + '.' + ext); } } addOnloadHook(skinRedirect); if ( wgPageName == "ויקיפדיה:בוקמרקלטים" || wgPageName == "שיחת_ויקיפדיה:בוקמרקלטים" ) { importScript("MediaWiki:/common.js/bookmarkletsInit.js"); // דף הבוקמרקלטים } if (wgNamespaceNumber == -1 && wgCanonicalSpecialPageName === 'Search'){ importScript("MediaWiki:SearchEngines.js"); // בחירה במנועי חיפוש שונים importScript('Mediawiki:Gadget-advanceSearch.js'); } /* * Adds an automatic "{{תב|מוגן}}" or "{{תב|מוגן חלקית}}" template when the page is protected. * You can use the {{תב|ללא הודעת הגנה אוטומטית}} to prevent the protection notice from being inserted. * * written by [[User:ערן]], [[User:Yonidebest]] * */ var restrictionEdit=mw.config.get('wgRestrictionCreate') || mw.config.get('wgRestrictionEdit'); if(restrictionEdit && restrictionEdit.length>0 && (restrictionEdit[0]=='sysop' || restrictionEdit[0]=='autoconfirmed') && $('#pl-noprotectionnotice, #pl-autoconfirmed, #pl-protected').length==0 && ($.inArray(mw.config.get('wgAction'),['view','submit'])+1) && mw.config.get('wgNamespaceNumber')==0) { $.get(wgServer+mw.util.wikiScript('api'),{ action: 'parse',format:'json',text: '{{'+(restrictionEdit[0] == 'sysop'? 'מוגן' : 'מוגן חלקית')+'}}',prop: 'text',title: mw.config.get('wgTitle') },function(data){ $(document).ready(function(){ $('.printfooter').before($('<div>',{'class': 'plprotected',html:data.parse.text['*']})); }); }); } });