שיחת מדיה ויקי:Common.js
Double jQuery[עריכה]
Hi,
As of October 2010 jQuery has been loaded by default on all pages within the Wikimedia domain. Back then the $
alias was not set so you had to use jQuery
. I noticed that this wiki is loading an additional instance of jQuery:
document.write('<script type="text/javascript" src="' + 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>');
This is a problem because it overrides the jQuery loaded by MediaWiki:
/* MediaWiki */ jQuery = ....... jQuery.plugin = ..... /* he.wikisource.org */ http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js jQuery.plugin is now gone.
If you wish to use the $-variable as a shortcut to jQuery, use the following:
window.$ = jQuery; // Now you can use $ $('#something').hide();
As of today, since 1.17 is deployed, the $-variable is automatically a shortcut to jQuery so you dont have to do that either. For that reason please remove the following two lines:
document.write('<script type="text/javascript" src="' + 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>');
- No longer overrides the one loaded by MediaWiki (which is a different version (1.4.2))
- $ is already set as alias to jQuery
- Loads the page faster (loading once instead of twice saves time)!
Thanks in advance, Krinkle 20:42, 11 בפברואר 2011 (IST)
- PS: If you have any questions, feel free to ask me or someone else in #wikimedia-dev on irc.freenode.org or leave a message on my Talk page on Meta-Wiki. Krinkle 20:42, 11 בפברואר 2011 (IST)
Give search results even when page doesn't exist[עריכה]
Hello, I propose to enable the tool created by Magnus Manske (creator of MediaWiki) to provide results from other languages and Commons (via Wikidata) when a page doesn't exist here: links are added to Special:Search and noarticletext. This helps to encourage translation and to make readers use your wiki more, because they can be sure to find something even if it's not local (rather than searching directly on the biggest wiki). The Italian and Polish Wikipedias, among others already enabled it by default.
Examples: [1] [2] [3]. More information: Magnus blog.
How to: just add the following line at the end of Common.js.
// Results from Wikidata // [[File:Wdsearch_script_screenshot.png]] if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) { importScriptURI("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript"); }
--Nemo 22:37, 19 במאי 2017 (IDT) (comments, translations and last instructions)
הצעת עדכון[עריכה]
אני מציע לתקן את הסקריפט כפי שכתוב להלן, כך שקוד ישן שאין בו עוד צורך ימחק ומשתנים גלובלים יקראו באמצעות mw.config.get. (ייתכן שיש עוד קוד ישן - אלו לפחות החלקים ששמתי לב אליהם) ערן (שיחה) 22:37, 19 במאי 2017 (IDT)
/* ערכו קובץ זה כדי להריץ סקריפטים ב־JavaScript באתר כולו. ערכו את [[מדיה ויקי:Monobook.js]] לסקריפטים שיופעלו ברקע מונובוק בלבד. */
// import scripts for Interwiki Transclusion from //wikisource.org/wiki/Wikisource:Shared_Scripts
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:InterWikiTransclusion.js&action=raw&ctype=text/javascript');
// import script for OCR Button
if (mw.config.get( 'wgCanonicalNamespace' ) == 'Page' && $.inArray(mw.config.get('wgAction'), ['edit', 'submit']) > -1) {
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript');
}
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:Hocr.js&action=raw&ctype=text/javascript');
var talkNS = "שיחה"; // talk namespace
/** JSconfig *****
* You can override these default in your [[Special:Mypage/monobook.js]]
* templatesList gets the following parameter:
* 'toolbar' : adds the list to the toolbar (default).
* 'bottom' : adds the list to the bottom of the page, next to the summary.
* false : doesn't add the list at all.
*/
var JSconfig =
{
templatesList: 'toolbar'
}
// ============================================================
// BEGIN Dynamic Navigation Bars (experimantal)
// set up the words in your language
var NavigationBarHide = '[הסתר]';
var NavigationBarShow = '[הראה]';
// set up max count of Navigation Bars on page,
// if there are more, all will be hidden
// NavigationBarShowDefault = 0; // all bars will be hidden
// NavigationBarShowDefault = 1; // on pages with more than 1 bar all bars will be hidden
var NavigationBarShowDefault = 0;
// shows and hides content and picture (if available) of navigation bars
// Parameters:
// indexNavigationBar: the index of navigation bar to be toggled
function toggleNavigationBar(indexNavigationBar)
{
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);
if (!NavFrame || !NavToggle) {
return;
}
// if shown now
if (NavToggle.firstChild.data == NavigationBarHide) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if (NavChild.nodeName.toLowerCase() == "div") {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'none';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'none';
}
}
}
NavToggle.firstChild.data = NavigationBarShow;
// if hidden now
} else if (NavToggle.firstChild.data == NavigationBarShow) {
for (
var NavChild = NavFrame.firstChild;
NavChild != null;
NavChild = NavChild.nextSibling
) {
if (NavChild.className == 'NavPic') {
NavChild.style.display = 'block';
}
if (NavChild.className == 'NavContent') {
NavChild.style.display = 'block';
}
}
NavToggle.firstChild.data = NavigationBarHide;
}
}
// adds show/hide-button to navigation bars
function createNavigationBarToggleButton()
{
var indexNavigationBar = 0;
var NavFrame;
// iterate over all < div >-elements
for(
var i=0;
NavFrame = document.getElementsByTagName("div")[i];
i++
) {
// if found a navigation bar
if (NavFrame.className == "NavFrame") {
indexNavigationBar++;
var NavToggle = document.createElement("a");
NavToggle.className = 'NavToggle';
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
var NavToggleText = document.createTextNode(NavigationBarHide);
NavToggle.appendChild(NavToggleText);
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)
for(
var j=0;
j < NavFrame.childNodes.length;
j++
) {
if (NavFrame.childNodes[j].nodeName.toLowerCase() == "div" && NavFrame.childNodes[j].className == "NavHead") {
NavFrame.childNodes[j].appendChild(NavToggle);
}
}
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
}
}
// if more Navigation Bars found than Default: hide all
if (NavigationBarShowDefault < indexNavigationBar) {
for(
var i=1;
i<=indexNavigationBar;
i++
) {
toggleNavigationBar(i);
}
}
}
// END Dynamic Navigation Bars
// ============================================================
/* פונקציה לבחירת כל הגרסאות בדף השחזורים כברירת מחדל */
function selectAllunDel()
{
/* בצע רק אם בדף יש טופס שחזור */
var undeleteForm = document.getElementById('undelete');
if (undeleteForm == null) return;
var unDelAll=document.createElement('input');
unDelAll.value='סימון כל הגרסאות';
unDelAll.type='button';
unDelAll.onclick=function(){
for(var j=0; a = document.getElementsByTagName("input")[j]; j++) {
if(a.type=="checkbox") a.checked=true;
}
};
undeleteForm.elements["restore"].parentNode.appendChild(unDelAll);
}
// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
// התאמה אישית של רשימת הרישיונות בדף העלאת קובץ
function showLicenseAlert(licenseAlert)
{
licenseAlertField = document.getElementById('uploadAlertData');
if (licenseAlertField) switch (licenseAlert) {
case "שימוש הוגן":
licenseAlertField.innerHTML = '<b>תזכורת</b>: בשדה התיאור יש להחליף את הכיתוב "שם-הערך-בו-מותר-השימוש" בשם הערך שבגינו העלאתם את התמונה.';
document.getElementById('uploadAlert').style.display = "block";
break;
case "ויקישיתוף":
licenseAlertField.innerHTML = '<b>תזכורת</b>: תמונות חופשיות יש להעלות לוויקישיתוף (למעט תמונות שנועדו לשימוש אישי בדף משתמש).';
document.getElementById('uploadAlert').style.display = "block";
break;
case "שימוש הוגן ומקור":
licenseAlertField.innerHTML = '<b>תזכורת</b>: בשדה התיאור יש להחליף את הכיתוב "שם-הערך-בו-מותר-השימוש" בשם הערך שבגינו העלאתם את התמונה, ואת הכיתוב "מקור-התמונה" באתר האינטרנט ממנה נלקחה התמונה.';
document.getElementById('uploadAlert').style.display = "block";
break;
}
}
function showLicenseInfo(licenseName)
{
licenseViewOriginal = document.getElementById('wpUploadDescription');
if (licenseViewOriginal != null && licenseName != "disabled") {
licenseViewOriginal.focus();
var licenseView = '== רישיון ==\n{{';
var usrName = mw.config.get('wgUserName');
switch (licenseName) {
case "מולטי ייחוס ורישיון זהה":
licenseView += 'דו-רישיוני|GFDL|cc-by-sa-2.5,2.0,1.0}}\nנוצר על ידי [[משתמש:' + usrName + ']]';
showLicenseAlert("ויקישיתוף");
break;
case "ייחוס ורישיון זהה עצמי":
licenseView += 'cc-by-sa-2.5}}\nנוצר על ידי [[משתמש:' + usrName + ']]';
showLicenseAlert("ויקישיתוף");
break;
case "מולטי ייחוס":
licenseView += 'דו-רישיוני|GFDL|cc-by-2.5}}\nנוצר על ידי [[משתמש:' + usrName + ']]';
showLicenseAlert("ויקישיתוף");
break;
case "self GFDL":
licenseView += 'GFDL}}\nנוצר על ידי [[משתמש:' + usrName + ']]';
showLicenseAlert("ויקישיתוף");
break;
case "GFDL":
licenseView += 'GFDL}}';
showLicenseAlert("ויקישיתוף");
break;
case "רשות ציבור":
licenseView += 'שימוש חופשי|' + usrName + '}}';
showLicenseAlert("ויקישיתוף");
break;
case "ייחוס ורישיון זהה":
licenseView += 'cc-by-sa-2.5}}';
showLicenseAlert("ויקישיתוף");
break;
case "ייחוס":
licenseView += 'cc-by-2.5}}';
showLicenseAlert("ויקישיתוף");
break;
case "ייחוס בלבד":
licenseView += 'ייחוס|שם משתמש=' + usrName + '}}';
showLicenseAlert("ויקישיתוף");
break;
case "שימוש הוגן":
licenseView += 'שימוש הוגן|מקור=מקור-התמונה|ערך=שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן ומקור");
break;
case "עטיפת אלבום":
licenseView += 'עטיפת אלבום|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "עטיפת ספר":
licenseView += 'עטיפת ספר|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "כרזת סרט, וידיאו או תקליטור":
licenseView += 'כרזת סרט|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "לוגו":
licenseView += 'לוגו|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "צילום מסך של אתר אינטרנט או תוכנה":
licenseView += 'צילום מסך|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "סריקה של ספר, עיתון או עצם אחר":
licenseView += 'סריקה|שם-הערך-בו-מותר-השימוש}}';
showLicenseAlert("שימוש הוגן");
break;
case "אין":
licenseView = '== רישיון ==\nאין לי מידע בקשר למצב זכויות היוצרים ולרישיון הקובץ.';
break;
case "infobox":
if (licenseViewOriginal.value=="") {
var doubletilda = '{' + '{';
licenseView = doubletilda + 'מידע|\n|תיאור=\n|מקור=\n|תאריך יצירה=\n|יוצר=\n|אישורים והיתרים=\n|גרסאות אחרות=\n}}';
}
else licenseView = "";
licenseViewOriginal.rows = 20;
break;
}
if (licenseViewOriginal.value == "") {
licenseViewOriginal.value = licenseView;
} else {
licenseViewOriginal.value = licenseViewOriginal.value + '\n' + licenseView;
}
}
}
function licenseListViewer()
{
licenseListOriginal = document.getElementById('wpLicense');
if (licenseListOriginal != null) {
licenseListOriginal.onchange = function(){showLicenseInfo(licenseListOriginal[licenseListOriginal.selectedIndex].title);licenseListOriginal.selectedIndex=0;return false;}
// remove all old options
while (licenseListOriginal.options.length != 0) {
licenseListOriginal.options[0] = null;
}
// fair use page
if (mw.config.get('wgUserLanguage') == 'fairuse') {
// create custom options
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "";
oOption.title = "disabled";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "אין לי מידע בקשר לרישיון";
oOption.title = "אין";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "------- שימוש הוגן -------";
oOption.title = "disabled";
oOption.disabled = "disabled";
oOption.style.color = "red";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "שימוש הוגן";
oOption.title = "שימוש הוגן";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "לוגו";
oOption.title = "לוגו";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "עטיפת ספר";
oOption.title = "עטיפת ספר";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "עטיפת אלבום";
oOption.title = "עטיפת אלבום";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "כרזת סרט, וידיאו או תקליטור";
oOption.title = "כרזת סרט, וידיאו או תקליטור";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "סריקה של ספר, עיתון או עצם אחר";
oOption.title = "סריקה של ספר, עיתון או עצם אחר";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "צילום מסך של אתר אינטרנט או תוכנה";
oOption.title = "צילום מסך של אתר אינטרנט או תוכנה";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "אין לי מידע בקשר לרישיון";
oOption.title = "אין";
} else { // normal upload page
// create custom options
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "";
oOption.title = "disabled";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "אין לי מידע בקשר לרישיון";
oOption.title = "אין";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "------- אני יצרתי... -------";
oOption.title = "disabled";
oOption.disabled = "disabled";
oOption.style.color = "red";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני דורש ייחוס ליוצר כולל הפצת נגזרות תחת רישיון זהה (דו־רישיוני: GFDL ו־CC-BY-SA-2.5 (כולל רישיונות ישנים 2.0 ו־1.0)";
oOption.title = "מולטי ייחוס ורישיון זהה";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני דורש ייחוס ליוצר כולל הפצת נגזרות תחת רישיון זהה (CC-BY-SA-2.5)";
oOption.title = "ייחוס ורישיון זהה עצמי";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני דורש ייחוס ליוצר (דו־רישיוני: GFDL ו־CC-BY-2.5)";
oOption.title = "מולטי ייחוס";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני דורש ייחוס ליוצר בלבד";
oOption.title = "ייחוס בלבד";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני מפיץ אותו תחת GFDL";
oOption.title = "self GFDL";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ואני משחרר אותו לרשות הציבור";
oOption.title = "רשות ציבור";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "------- לא אני יצרתי, אבל יוצר התמונה מרשה הפצה תחת: -------";
oOption.title = "disabled";
oOption.disabled = "disabled";
oOption.style.color = "red";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "GFDL";
oOption.title = "GFDL";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ייחוס ליוצר, הפצת נגזרות תחת רישיון זהה (CC-BY-SA-2.5)";
oOption.title = "ייחוס ורישיון זהה";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "ייחוס ליוצר (CC-BY-2.5)";
oOption.title = "ייחוס";
oOption = document.createElement("OPTION");
licenseListOriginal.options.add(oOption);
oOption.innerHTML = "אין לי מידע בקשר לרישיון";
oOption.title = "אין";
}
//add the מידע template to description box
showLicenseInfo("infobox");
}
}
// סוף התאמה אישית של רשימת הרישיונות בדף העלאת קובץ
// =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
/* פונקציה שמשמשת לאיפשור ניקוד ב[[מדיה ויקי:edittools]] */
function nikud(){
if (document.getElementById('edit-templates')!=null){
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
if(a.className == "nikud") {
a.onclick=function(){insertTags('', this.title, '');return false;};
}
}
}
}
/* "Technical restrictions" title fix - Taken from en:MediaWiki:Common.js */
// For pages that have something like Template:Lowercase, replace the title, but only if it is cut-and-pasteable as a valid wikilink.
// (for instance iPod's title is updated. But [[C#]] is not an equivalent wikilink, so [[C Sharp]] doesn't have its main title changed)
//
// The function looks for a banner like this:
// <div id="RealTitleBanner"> <!-- div that gets hidden -->
// <span id="RealTitle">title</span>
// </div>
// An element with id=DisableRealTitle disables the function.
var disableRealTitle = 0; // users can disable this by making this true from their monobook.js
$(document).ready(function() {
try {
var realTitleBanner = document.getElementById("RealTitleBanner");
if (realTitleBanner && !document.getElementById("DisableRealTitle") && !disableRealTitle) {
var realTitle = document.getElementById("RealTitle");
if (realTitle) {
var realTitleHTML = realTitle.innerHTML;
/* אם הכותרת לא כוללת אותיות בעברית ואם realTitleHTML מכיל dir, אז שנה את הכיווניות של הכותרת לשמאל->ימין */
if (realTitleHTML=='dir' && !document.getElementsByTagName('h1')[0].innerHTML.match(/[א-ת]/) && document.getElementsByTagName('h1')[0].className=='firstHeading'){
document.getElementsByTagName('h1')[0].innerHTML='<span dir=\"ltr\">'+document.getElementsByTagName('h1')[0].innerHTML+'</span>';
realTitleBanner.style.display = "none";
return;
}
realTitleText = pickUpText(realTitle);
var isPasteable = 0;
//var containsHTML = /</.test(realTitleHTML); // contains ANY HTML
var containsTooMuchHTML = /</.test( realTitleHTML.replace(/<\/?(sub|sup|small|big)>/gi, "") ); // contains HTML that will be ignored when cut-n-pasted as a wikilink
// calculate whether the title is pasteable
var verifyTitle = realTitleText.replace(/^ +/, ""); // trim left spaces
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
// if the namespace prefix is there, remove it on our verification copy. If it isn't there, add it to the original realValue copy.
if (mw.config.get('wgNamespaceNumber') != 0) {
if (mw.config.get('wgCanonicalNamespace') == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(mw.config.get('wgCanonicalNamespace').length) == ":") {
verifyTitle = verifyTitle.substr(mw.config.get('wgCanonicalNamespace').length + 1);
} else {
realTitleText = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleText;
realTitleHTML = mw.config.get('wgCanonicalNamespace').replace(/_/g, " ") + ":" + realTitleHTML;
}
}
// verify whether wgTitle matches
verifyTitle = verifyTitle.replace(/^ +/, "").replace(/ +$/, ""); // trim left and right spaces
verifyTitle = verifyTitle.replace(/_/g, " "); // underscores to spaces
verifyTitle = verifyTitle.charAt(0).toUpperCase() + verifyTitle.substring(1, verifyTitle.length); // uppercase first character
isPasteable = (verifyTitle == mw.config.get('wgTitle'));
var h1 = document.getElementsByTagName("h1")[0];
if (h1 && isPasteable) {
h1.innerHTML = containsTooMuchHTML ? realTitleText : realTitleHTML;
if (!containsTooMuchHTML)
realTitleBanner.style.display = "none";
}
document.title = realTitleText + " - ויקיפדיה";
}
}
} catch (e) {
/* Something went wrong. */
}
});
// similar to innerHTML, but only returns the text portions of the insides, excludes HTML
function pickUpText(aParentElement) {
var str = "";
function pickUpTextInternal(aElement) {
var child = aElement.firstChild;
while (child) {
if (child.nodeType == 1) // ELEMENT_NODE
pickUpTextInternal(child);
else if (child.nodeType == 3) // TEXT_NODE
str += child.nodeValue;
child = child.nextSibling;
}
}
pickUpTextInternal(aParentElement);
return str;
}
/* קישור ישיר לדף שהפך להפניה בדף אישור ההעברה */
function EncodedMoveLink()
{
encodedLinkID = document.getElementById('encodedlink');
if (encodedLinkID != null) {
encodedLinkID.innerHTML = '(<a href="//he.wikipedia.org/w/index.php?title=' + encodedLinkID.innerHTML + '&redirect=no" class="internal">קישור קבוע</a>)';
encodedLinkID.style.display = "inline";
}
}
/* לא מאפשר לאנונימיים לשמור את הדף לפני לחיצה על תצוגה מקדימה */
function noSaving() {
if (mw.config.get('wgUserName') == null && mw.config.get('wgAction') == 'edit') {
saveButton = document.getElementById('wpSave');
if (saveButton != null) {
saveButton.disabled = true;
if(document.getElementById('wpPreview')!=null) document.getElementById('wpPreview').value = 'הראה תצוגה מקדימה (חובה)';
}
}
}
/* A helper function to add a button to one of the toolbars in the interface.
Took it from [[:en:User:Omegatron/monobook.js/addlink.js]] */
function addLink(where, url, name, id, title, key, after){
var na = document.createElement('a');
na.href = url;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
if(id) li.id = id;
li.appendChild(na);
var tabs = document.getElementById(where).getElementsByTagName('ul')[0];
if(after) {
tabs.insertBefore(li,document.getElementById(after));
} else {
tabs.appendChild(li);
}
if(id) {
if(key && title) { ta[id] = [key, title]; }
else if(key) { ta[id] = [key, '']; }
else if(title) { ta[id] = ['', title];}
}
// re-render the title and accesskeys from existing code in wikibits.js
akeytt();
return li;
}
// From [[en:User:Lupin/autoedit.js]]
// Retrieve parameter value from the address bar link
//
function getParamValue(paramName) {
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var h=document.location;
var m=cmdRe.exec(h);
if (m) {
try {
return decodeURIComponent(m[1]);
} catch (someError) {}
}
return null;
}
/* סקריפט זמני לתקופת סקר הקוראים שגורם לקישור הסקר להיפתח בחלון חדש */
function popupsforanons(){
if(!document.getElementById('siteNotice')) return;
if(!document.getElementById('siteNotice').getElementsByTagName('a')[0]) return;
document.getElementById('siteNotice').getElementsByTagName('a')[0].target='_blank';
}
$(document).ready(popupsforanons);
function interwikiExtra() {
// iterate over all <span>-elements
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
// if found a linkInfo span
if(a.className == "interwiki-info") {
// iterate over all <li>-elements
var count=0;
for(var j=0; b = document.getElementsByTagName("li")[j]; j++) {
if(b.className == "interwiki-" + a.id) {
b.innerHTML = b.innerHTML + " "+a.title;
if(a.title == "(vo)") {
b.title = "Texte original";
}
}
else if(b.className == "interwiki-" + a.id.substr(0,a.id.length-1)) {
count = count+1;
if(a.id.charAt(a.id.length-1) == count) {
b.innerHTML = b.innerHTML + " "+a.title;
}
}
}
}
}
}
$(document).ready(interwikiExtra);
/* הגדרת הפונקציות לטעינה */
$(document).ready(EncodedMoveLink);
$(document).ready(licenseListViewer);
$(document).ready(noSaving);
$(document).ready(selectAllunDel);
$(document).ready(createNavigationBarToggleButton);
$(document).ready(addCharSubsetMenu);
$(document).ready(nikud);
$(document).ready(miznon);
//
// Popup script [[User:ori229]] july,2007 Used in [[תבנית:ב]]
// Show popups on specific words, when the mouse is placed on them
// Updated in 11.2016 to use JQuery and work with touch screens.
//
function touchFriendlyTooltip() {
var targets = $( '.TooltipPhrase' ),
target = false, tooltip = false, title = false;
targets.bind( 'mouseenter', function() {
$(".TooltipTip").remove(); // clear other tooltips before showing a new one
target = $( this );
tip = target.find(".TooltipSpan").html();
tooltip = $( '<div id="tooltip" class="TooltipTip"></div>' );
tooltip.css( 'opacity', 0 ).html( tip ).appendTo( 'body' );
var init_tooltip = function()
{
if( $( window ).width() < tooltip.outerWidth() * 1.5 )
tooltip.css( 'max-width', $( window ).width() / 2 );
else
tooltip.css( 'max-width', 340 );
var pos_left = target.offset().left + ( target.outerWidth() / 2 ) - ( tooltip.outerWidth() / 2 ),
pos_top = target.offset().top + target.outerHeight() + 2;
if( pos_left < 0 )
pos_left = target.offset().left + target.outerWidth() / 2 - 20;
if( pos_left + tooltip.outerWidth() > $( window ).width() )
pos_left = target.offset().left - tooltip.outerWidth() + target.outerWidth() / 2 + 20;
target.css( { color: "gray" } );
tooltip.css( { left: pos_left, top: pos_top, opacity: 0.98 } );
};
init_tooltip();
$( window ).resize( init_tooltip );
var remove_tooltip = function() {
tooltip.animate( { opacity: 0 }, 1500, function() {
// wait a little until hiding, to allow click on a link
$( this ).remove();
});
target.css({ color: "" });
};
target.bind( 'mouseleave', remove_tooltip );
tooltip.bind( 'click', remove_tooltip ); // for mobile
});
}
$(document).ready(touchFriendlyTooltip);
// Dynamic layouts
if ( !self.ws_layouts ) {
self.ws_layouts = {};
}
self.ws_layouts['Layout 1'] = {
'#text-wrap':"",
'#text-container':"" ,
'#text':"",
'.sidenote-right':"float:right;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.sidenote-left':"float:left;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':""
};
self.ws_layouts['Layout 2'] = {
'#text-wrap':"position:relative;margin-left:3em;margin-right:3em;",
'#text-container':"width:36em;margin:0px auto;font-family:Georgia,serif;" ,
'#text':"text-align:justify;",
'.sidenote-right':"position:absolute; left:37em;width:16em;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:37em;width:16em;text-indent:0em;text-align:right;",
'.editsection':"display:none",
'#headertemplate':""
};
self.ws_layouts['Layout 3'] = {
'#text-wrap':"margin-left:3em",
'#text-container':"position:relative; min-width:60em; float:left; width:100%; margin-right:-23em;" ,
'#text':"text-align:justify;margin-right:23em; text-indent:0em; padding-left:0px; padding-right:0px;width:auto; position:relative;",
'.sidenote-right':"position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"position:absolute; top:0em; right:-23em; width:21em;float:right; text-align:left;"
};
/* תבנית גימטריה - נכתבה ע"י קיפודנחש */
"use strict"
$(function() {
if ($('.gim-calc, .gim-product .gim-factor').length)
mw.loader.using('jquery.tipsy', function() {
var gimvals = {'א': 1, 'ב': 2, 'ג': 3, 'ד': 4, 'ה': 5, 'ו': 6, 'ז': 7, 'ח': 8, 'ט': 9, 'י': 10, 'כ': 20, 'ך': 20, 'ל': 30, 'מ': 40, 'ם': 40, 'נ': 50, 'ן': 50, 'ס': 60, 'ע': 70, 'פ': 80, 'ף': 80, 'צ': 90, 'ץ': 90, 'ק': 100, 'ר': 200, 'ש': 300, 'ת': 400},
smallgimvals={'א':1,'ב':2,'ג':3,'ד':4,'ה':5,'ו':6,'ז':7,'ח':8,'ט':9,'י':1,'כ':2,'ך':2,'ל':3,'מ':4,'ם':4,
'נ':5,'ן':5,'ס':6,'ע':7,'פ':8,'ף':8,'צ':9,'ץ':9,'ק':1,'ר':2,'ש':3,'ת':4},
tipsyParams = {
title: function() {
function gimatria(str, small) {
var tar = str.split(''),
sum = 0;
for (var ind in tar)
sum += (small ? (smallgimvals[tar[ind]] || 0) : (gimvals[tar[ind]] || 0));
return sum;
}
function trim(str) {
return str.substr(0, 100) + (str.length > 100 ? '...' : '');
}
var $this = $(this),
product = $this.hasClass('gim-factor'),
is_smallgim = $this.hasClass('smallgim');
if (product) {
var factors = $this.closest('.gim-product').find('.gim-factor'),
prod = 1,
desc = [],
glue = $('<span>').append($('<p>').text('בגימטריה כפול')).html();
factors.each(function() {
var t = $(this).text(),
fact = gimatria(t, false),
p = $('<p>').css({fontWeight: 'bold', border: 'solid red 1px'});
p.text(t + ' (' + fact + ')');
prod *= fact;
desc.push($('<span>').append(p).html());
});
return ('הערך של'
+ desc.join(glue)
+ 'בגימטריה הוא: '
+ prod
);
} else {
var str = $this.text();
return (
'הערך של <p style="font-weight:bold; border: solid red 1px;">'
+ trim(str)
+'</p> בגימטריה'
+(is_smallgim? ' קטנה ': ' ' )
+ 'הוא: '
+ gimatria(str, is_smallgim)
);
}
},
gravity: function() {
var loc =
($(this).offset().top > ($(document).scrollTop() + $(window).height() - 120) ? 's' : 'n') +
($(this).offset().left > ($(document).scrollLeft() + $(window).width() / 4) ? '' : 'w');
return loc;
},
html: true,
delayOut: 150,
delayIn: 150,
fade: true, opacity: 1,
};
$('.gim-calc, .gim-product .gim-factor').tipsy(tipsyParams);
});
});
/* IE Fixes */
if ( $.client.profile().name === 'msie' ) {
/**
* Helper script for .hlist class in Common.css
* Last updated: January 6, 2013
* @maintainer: [[User:Edokter]]
* @revision: 3.0
*/
/* Fix wrapping issue in IE 8 and up for hlist in table; put a soft-hyphen in front of list items. */
if ( $.client.profile().versionBase > '7' ) {
mw.util.addCSS( 'table.hlist li:before { content: "\\ad"; }' );
}
/* Add pseudo-selector class to last-child list items in IE 8 */
if ( $.client.profile().versionBase == '8' ) {
$( '.hlist' ).find( 'dd:last-child, dt:last-child, li:last-child' )
.addClass( 'hlist-last-child' );
}
/* Generate interpuncts and parentheses for IE < 8 */
if ( $.client.profile().versionBase < '8' ) {
var hlists = $( '.hlist' );
hlists.find( 'dt:not(:last-child)' )
.append( ': ' );
hlists.find( 'dd:not(:last-child)' )
.append( '<b>·</b> ' );
hlists.find( 'li:not(:last-child)' )
.append( '<b>·</b> ' );
hlists.find( 'dl dl, dl ol, dl ul, ol dl, ol ol, ol ul, ul dl, ul ol, ul ul' )
.prepend( '( ' ).append( ') ' );
}
}
/*
* 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))
{
$.get(mw.config.get('wgServer')+mw.util.wikiScript('api'),{
action: 'parse',format:'json',text: '{{'+(restrictionEdit[0] == 'sysop'? 'מוגן' : 'מוגן חלקית')+'|מוקטן=כן}}',prop: 'text',title: mw.config.get('wgPageName')
},function(data){
$(document).ready(function(){
$('.printfooter').before($('<div>',{'class': 'plprotected',html:data.parse.text['*']}));
});
});
}
// סקריפטים לדפי עריכה
if ( (mw.config.get('wgAction') === "edit" || mw.config.get('wgAction') === "submit") &&
!($('#wpTextbox1').prop( 'readonly' ))
) {
importScript("MediaWiki:Edittoolbar.js"); // תוספות לסרגל העריכה
}
// סקריפטים כלליים
importScript('Mediawiki:Common.js/pgn.js'); // להצגת שחמט
importScript("MediaWiki:Collapsetables.js"); // טבלאות מוסתרות
עדכונים להווה[עריכה]
הדף הזה לא מתוחזק כבר שנים ולדעתי כדאי שמי מעורכי הממשק שמבין בזה יעבור עליו ויראה מה רלוונטי ומה כבר לא. דוגמאות קונקרטיות:
- בשורה 621 יש 'סקריפט זמני' שנמצא שם עוד מלפני 2008 (לא בדקתי מעבר), ומיותר.
- בשורה 672 יש סקריפט מיותר מהסיבה הפשוטה שאין לנו בוויקיטקסט דף שנקרא "ויקיפדיה:מזנון" וגם לא נראה לי שהוא נצרך לאחר כל השדרוגים שעברו דפי השיחה בשנים האחרונות.
- מיד אחריו מופיע סקריפט של קישורי בינוויקי שהונח שם בתאריך 10/9/2008 (אני חושב שזה לפני המצאת ויקינתונים) וגם נראה מיותר לאחר השדרוגים.
כל זה רק בתוך 100 שורות... שלום אורי • שיחה • ד' באייר ה'תשפ"ג • 18:50, 24 באפריל 2023 (IDT)
- אולי כדאי לתייג את המשתמשים בעלי הרשאת עורך ממשק אצלנו.--נחום • שיחה 20:28, 24 באפריל 2023 (IDT)