(הבדלים בין גרסאות)
Admin (שיחה | תרומות)
(דף חדש: - ←כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד - - ←מצא מיקום עליון - function getLeftOffset(obj){ ...)
עבור להשוואת הגרסאות הבאה ←
גרסה מתאריך 08:46, 31 ביולי 2007
/* כל סקריפט JavaScript שנכתב כאן ירוץ עבור כל המשתמשים בכל טעינת עמוד */
/* מצא מיקום עליון */ function getLeftOffset(obj){ var myleft = 0; while(obj.offsetParent != null){ myleft += obj.offsetLeft; obj = obj.offsetParent; } return myleft; } /* מצא מיקום שמאל */ function getTopOffset(obj){ var mytop = 0; while(obj.offsetParent != null){ mytop += obj.offsetTop; obj = obj.offsetParent; } return mytop; }
/* ערכו קובץ זה כדי להריץ סקריפטים ב־JavaScript באתר כולו. ערכו את מדיה ויקי:Monobook.js לסקריפטים שיופעלו ברקע מונובוק בלבד. */
/* פונקציה הטוענת פונקציות בעת עליית הדף */
function addLoadEvent(event)
{
if (window.addEventListener) /* דפדפן שאינו אינטרנט אקספלורר */ { window.addEventListener("load", event, false); } else if (window.attachEvent) /* אינטרנט אקספלורר */ { window.attachEvent("onload", event); }
}
/** 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'
}
/* הרחבת שורת הלחצנים מעל לתיבת העריכה */ if (mwCustomEditButtons) /* רק אם המערך קיים, כלומר – אם זה דף עריכה */ {
function addEditButton(imageFile, tagOpen, sampleText, tagClose, speedTip) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://upload.wikimedia.org/wikipedia/he/" + imageFile, "tagOpen": tagOpen, "sampleText": sampleText, "tagClose": tagClose, "speedTip": speedTip }; } addEditButton("c/c9/Button_strike.png", "addEditButton("e/ea/Button_align_left.png", '", "טקסט המסומן כמחוק", "", "טקסט מחוק");
addEditButton("1/13/Button_enter.png", "addEditButton("1/12/Button_gallery.png", "
", "", "", "ירידת שורה"); addEditButton("8/80/Button_upper_letter.png", "", "כתב עילי", "", "כתב עילי"); addEditButton("7/70/Button_lower_letter.png", "", "כתב תחתי", "", "כתב תחתי"); addEditButton("5/58/Button_small.png", "", "כתב מוקטן", "", "כתב מוקטן"); addEditButton("3/34/Button_hide_comment.png", "", "הערה מוסתרת");
\n", "תמונה:PictureFileName.jpg
כיתוב תמונה\nתמונה:PictureFileName.jpg|כיתוב תמונה", "\n |
addEditButton("e/e9/Button_headline2.png", "=== ", "כותרת משנית", " ===", "יצירת כותרת ברמה 3"); addEditButton("8/8e/Button_shifting.png", ":", "", "", "הזחה לשמאל"); addEditButton("2/23/Button_code.png", '<source lang="text">\n', "טקסט", "\n<\/source>\n", "עיצוב קוד"); addEditButton("1/1e/Button_font_color.png", '', "טקסט צבוע", "", "טקסט עם צבע"); addEditButton("9/93/Button_sub_link.png", "שם תצוגה", "", "קישור לכותרת בדף"); addEditButton("d/d3/Button_definition_list.png", "\n; ", "פריט", " : ", "רשימת הגדרות"); addEditButton("a/ac/Button_ref.PNG", "<ref>", "הזן הערת שוליים כאן", "</ref>", "הערת שוליים");
}
/* הוספת כפתור טבלה, המעלה כלי ליצירת טבלאות */ /* גרסה 0.1, נלקח מוויקיפדיה בצרפתית, נכתב במקור על־ידי Dake */ function generateTableau(nbCol, nbRow, border, styleHeader, styleLine) {
var code = "\n"; if (styleHeader==1) { code += '{| class=\"wikitable\" border=\"' + border + '\"\n'; } else { code += '{| border=\"' + border + '\"\n'; code += '|+ כותרת הטבלה\n'; } for (var i=0;i<nbCol;i++) code += '! כותרת ' + i + '\n' for (var j=0;j<nbRow;j++) { if ((j+1)%2==0 && styleLine==1) { code += '|- bgcolor=\"#EFEFEF\"\n' } else { code += '|-\n' } for (var i=0;i<nbCol;i++) code += '| תא\n'; } code += '|}'; insertTags(,, code);
}
function popupTableau() {
var popup = window.open(,'name','height=240,width=250'); javaCode = '<script type=\"text\/javascript\">function insertCode(){'; javaCode += 'var row = parseInt(document.paramForm.inputRow.value); ' javaCode += 'var col = parseInt(document.paramForm.inputCol.value); ' javaCode += 'var bord = parseInt(document.paramForm.inputBorder.value); ' javaCode += 'var styleHeader = document.paramForm.inputHeader.checked; ' javaCode += 'var styleLine = document.paramForm.inputLine.checked; ' javaCode += 'window.opener.generateTableau(col,row,bord,styleHeader,styleLine); ' javaCode += '}<\/script>'; popup.document.write('<html><head><title>פרמטרים לטבלה</title>'); popup.document.write('<style type=\"text\/css\" media=\"screen,projection\">/*<![CDATA[*/ @import \"\/skins-1.5\/monobook\/main.css?5\";@import \"/skins-1.5/monobook/rtl.css\"; /*]]>*/<\/style>'); popup.document.write(javaCode); popup.document.write('</head><body>');popup.document.write('
אנא הזן/י פרמטרים לטבלה :
');popup.document.write('<form name=\"paramForm\">');popup.document.write('מספר שורות : <input type=\"text\" name=\"inputRow\" maxlength=\"3\" value=\"3\" style=\"width:50px;\">
'); popup.document.write('מספר עמודות : <input type=\"text\" name=\"inputCol\" maxlength=\"3\" value=\"3\" style=\"width:50px;\"><p>'); popup.document.write('רוחב מסגרת : <input type=\"text\" name=\"inputBorder\" maxlength=\"2\" value=\"1\" style=\"width:50px;\"><p>'); popup.document.write('טבלה מעוצבת : <input type=\"checkbox\" name=\"inputHeader\" checked=\"1\" ><p>'); popup.document.write('שורות אפורות לסירוגין: <input type=\"checkbox\" name=\"inputLine\" checked=\"1\" ><p>'); popup.document.write('</form">'); popup.document.write('<p><a href=\"javascript:insertCode();self.close();\"> הוספת הקוד לחלון העריכה</a>
'); popup.document.write('<a href=\"javascript:self.close()\"> סגירה</a>
');popup.document.write('</body></html>'); popup.document.close();
}
/* הוספת כפתור טבלאות לסרגל הכלים */ function tableButton() {
tooly = document.getElementById('toolbar'); if (tooly != null)
{
/* הגדרת כפתור עם כלי להוספת טבלאות. */ var tableButton=document.createElement("img"); tableButton.width = 23; tableButton.height = 22; tableButton.src = "http://upload.wikimedia.org/wikipedia/he/6/60/Button_insert_table.png"; tableButton.border = 0; tableButton.alt = "הוספת טבלה"; tableButton.title = "הוספת טבלה"; tableButton.style.cursor = "pointer"; tableButton.onclick = popupTableau; tooly.appendChild(tableButton);
} }
//************************************
// פונקציה להוספת רשימת תבניות בסרגל הכלים
// נכתב על ידי משתמש:Yonidebest ומשתמש:ערן
//
function createOptionElement(selectEl, text) {
oOption = document.createElement("option"); selectEl.options.add(oOption); oOption.innerHTML = text; oOption.title = text; return selectEl;
}
function templatesList() {
if (!JSconfig.templatesList) return; // user doesn't want the template list if (wgAction != 'edit' && wgAction != 'submit') return; // not edit page var toolbar = document.getElementById('toolbar'); if (!toolbar && JSconfig.templatesList == 'toolbar') return; // no toolbar tmpSelect = document.createElement('select'); tmpSelect.id = 'templatesList'; tmpSelect.onchange = function(){insertTemplate(this.selectedIndex);this.selectedIndex=0;return false;} // array to define options titles var tempTitles=new Array('בחרו תבנית כדי להוסיף', 'קטגוריה', 'פירוש נוסף', 'בעבודה', 'לקריאה נוספת','קישורים חיצוניים', 'ראו גם', 'הודעת קצרמר', 'דף הפניה', 'פירושונים','הפניה להערת שוליים', 'כותרת הערת שוליים', 'הפרת זכויות יוצרים', 'הבהרת חשיבות', 'ערך בבדיקה', 'הוספת ציטוט');
//create options for(var i=0;i<16;i++) tmpSelect = createOptionElement(tmpSelect, tempTitles[i]);
// add list to the end of tool if (JSconfig.templatesList == 'toolbar') // add to toolbar toolbar.appendChild(tmpSelect); else { // add to the bottom of the page var tmpltTable = document.getElementById('edit-templates').getElementsByTagName('table'); if (tmpltTable[0]) { var nTr = document.createElement('tr'); var nTd1 = document.createElement('td'); nTd1.appendChild(document.createTextNode('תבנית:')); nTr.appendChild(nTd1); var nTd2 = document.createElement('td'); nTd2.appendChild(tmpSelect); nTr.appendChild(nTd2); tmpltTable[0].appendChild(nTr); } }
}
function insertTemplate(index) {
var templates = new Array; var bracketA = "{" + "{"; var bracketB = "}" + "}"; templates[0] = "\n[[קטגוריה:"; templates[1] = "שם הקטגוריה"; templates[2] = "]]"; templates[3] = bracketA + "פירוש נוסף|"; templates[4] = "נוכחי=|אחר=|ראו="; templates[5] = bracketB; templates[6] = "\n"; templates[7] = bracketA + "בעבודה" + bracketB; templates[8] = "\n"; templates[9] = "\n== לקריאה נוספת ==\n"; templates[10] = "* שם סופר, שם ספר, שם הוצאה, תאריך הוצאה.\n"; templates[11] = ""; templates[12] = "\n== קישורים חיצוניים ==\n"; templates[13] = "* שם כותב, [Address תיאור המאמר], שם האתר\n"; templates[14] = ""; templates[15] = "\n== ראו גם ==\n"; templates[16] = "* שם ערך\n"; templates[17] = ""; templates[18] = ""; templates[19] = "\n" + bracketA + "קצרמר" + bracketB; templates[20] = ""; templates[21] = "#הפניה [["; templates[22] = "שם הערך המופנה"; templates[23] = "]]"; templates[24] = "\n" + bracketA + "פירושונים|" + "\n"; templates[25] = "* ערך 1 - הסבר קצר על מהותו של ערך 1\n* ערך 2 - הסבר קצר על מהותו של ערך 2"; templates[26] = "\n" + bracketB; templates[27] = "<ref name=\"ref-name\" />"; templates[28] = ""; templates[29] = ""; templates[30] = "\n== הערות שוליים =="; templates[31] = "\n<references />"; templates[32] = ""; templates[33] = "\n" + bracketA + "הפרת זכויות יוצרים|מקור="; templates[34] = " המקור שממנו הועתק התוכן "; templates[35] = "|זמן=" + bracketA + "ס:יום נוכחי" + bracketB + "/" + bracketA + "ס:חודש נוכחי" + bracketB + "/" + bracketA + "ס:שנה נוכחית" + bracketB + "(~~" + "~~" + "~)" + bracketB + "\n"; templates[36] = bracketA + "ס:הבהרת חשיבות"+ bracketB; templates[37] = ""; templates[38] = ""; templates[39] = bracketA + "בבדיקה"; templates[40] = ""; templates[41] = "|זמן=" + bracketA + "ס:יום נוכחי" + bracketB+ "/" + bracketA + "ס:חודש נוכחי" + bracketB+ "/" + bracketA + "ס:שנה נוכחית" + bracketB+ "(~~" + "~~" + "~)" + bracketB; templates[42] = bracketA + "ציטוט|מרכאות=כן|תוכן="; templates[43] = "הזינו ציטוט כאן"; templates[44] = bracketB; if (index > 0) insertTags(templates[index * 3 - 3], templates[index * 3 - 1], templates[index * 3 - 2]);
}
/* פונקציה להוספת כוכב בקישורי בינויקי לערכים מומלצים */ function featuredInterwiki() {
// iterate over all -elements
var a;
for(var i=0; a = document.getElementsByTagName("span")[i]; i++) {
// if found a FA span
if(a.className == "FA") {
// iterate over all // title
// // An element with id=DisableRealTitle disables the function.
var disableRealTitle = 0; // users can disable this by making this true from their monobook.js addOnloadHook(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' && !wgPageName.match(/[א-ת]/) && document.getElementsByTagName('h1')[0].className=='firstHeading'){
if(wgAction!= 'edit' && wgAction!='submit') document.getElementsByTagName('h1')[0].innerHTML=''+document.getElementsByTagName('h1')[0].innerHTML+'';
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 (wgNamespaceNumber != 0) { if (wgCanonicalNamespace == verifyTitle.substr(0, wgCanonicalNamespace.length).replace(/ /g, "_") && verifyTitle.charAt(wgCanonicalNamespace.length) == ":") { verifyTitle = verifyTitle.substr(wgCanonicalNamespace.length + 1); } else { realTitleText = wgCanonicalNamespace.replace(/_/g, " ") + ":" + realTitleText; realTitleHTML = 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 == 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="http://he.wikipedia.org/w/index.php?title=' + encodedLinkID.innerHTML + '&redirect=no" class="internal">קישור קבוע</a>)'; encodedLinkID.style.display = "inline"; }
}
/* לא מאפשר לאנונימיים לשמור את הדף לפני לחיצה על תצוגה מקדימה */
function noSaving() {
if (wgUserName == null && wgAction == 'edit') { saveButton = document.getElementById('wpSave'); if (saveButton != null) { saveButton.disabled = true; if(document.getElementById('wpPreview')!=null) document.getElementById('wpPreview').value = 'הראה תצוגה מקדימה (חובה)'; } }
}
/** MediaWiki media player ******************************************************* * * Description: A Java player for in-browser playback of media files. * Created by: commons:User:Gmaxwell */ document.write('<script type="text/javascript" src="' + 'http://he.wikipedia.org/w/index.php?title=Mediawiki:Wikimediaplayer.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
/*
* fix numbered lists in firefox * * written by Dekel [dekelb(at)(no-spam)gmail.com] */
function fixOl() {
if(clientPC.indexOf('firefox/') == -1) { return; } var olList = document.getElementsByTagName('ol'); for(var i = 0; i < olList.length; ++i) { var d = document.createElement('div'); d.setAttribute('style', 'margin-left: 2em; display: table;'); var o = document.createElement('ol'); o.innerHTML = olList[i].innerHTML; var attr; for ( var j = 0; j < olList[i].attributes.length; j++ ) { attr = olList[i].attributes[j]; o.setAttribute( attr.nodeName, attr.nodeValue ); } olList[i].parentNode.insertBefore(d, olList[i]); olList[i].parentNode.removeChild(olList[i]); d.appendChild(o); }
}
/* טעינת תבנית:דיון חדש במזנון לפני יצירת פסקה חדשה במזנון */ function miznon(){ if (wgPageName != 'ויקיפדיה:מזנון') return; if(!document.getElementById('ca-addsection')) return; document.getElementById('ca-addsection').getElementsByTagName('a')[0].href+='&editintro=%D7%AA%D7%91%D7%A0%D7%99%D7%AA:%D7%93%D7%99%D7%95%D7%9F_%D7%97%D7%93%D7%A9_%D7%91%D7%9E%D7%96%D7%A0%D7%95%D7%9F'; }
/* 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;
}
/*** Hebrew Calendar Options *****
* Shows three radio buttons for the Hebrew calendar options. * Writen by User:Yonidebest * */
function hebrewCalendarInit() {
var hebrewOptions = document.getElementById('HebrewOptions'); if (!hebrewOptions) return; hebrewOptions.innerHTML = ""; var elForm = document.createElement("FORM"); elForm.style.display = "inline"; try { // IE var elInput1 = document.createElement('<INPUT name="hebrewOptionsRadio">'); } catch(e) { // other browsers var elInput1 = document.createElement('INPUT'); elInput1.name = "hebrewOptionsRadio"; } elInput1.type = "radio"; elInput1.value = "0"; elInput1.onclick = function(){ hebrewCalendar(this.value);return true; } elForm.appendChild(elInput1); elForm.appendChild(document.createTextNode("כולם ")); try { // IE var elInput2 = document.createElement('<INPUT name="hebrewOptionsRadio">'); } catch(e) { // other browsers var elInput2 = document.createElement('INPUT'); elInput2.name = "hebrewOptionsRadio"; } elInput2.type = "radio"; elInput2.value = "1"; elInput2.defaultChecked = true; elInput2.onclick = function(){ hebrewCalendar(this.value);return true; } elForm.appendChild(elInput2); elForm.appendChild(document.createTextNode("עיקריים ")); try { // IE var elInput3 = document.createElement('<INPUT name="hebrewOptionsRadio">'); } catch(e) { // other browsers var elInput3 = document.createElement('INPUT'); elInput3.name = "hebrewOptionsRadio"; } elInput3.type = "radio"; elInput3.value = "2"; elInput3.onclick = function(){ hebrewCalendar(this.value);return true; } elForm.appendChild(elInput3); elForm.appendChild(document.createTextNode("ללא")); hebrewOptions.appendChild(elForm); hebrewOptions.style.display = "inline"; hebrewCalendar("1");
}
function hebrewCalendar(index) {
var spans = document.getElementsByTagName("SPAN"); for (var i = 0; i < spans.length; i++) { switch (index) { case "0": // כולם if (spans[i].id == "MainHoliday" || spans[i].id == "NonMainHoliday") toggleHoliday(spans[i], false); break; case "1": // עיקריים if (spans[i].id == "MainHoliday") toggleHoliday(spans[i], false); if (spans[i].id == "NonMainHoliday") toggleHoliday(spans[i], true); break; case "2": // ללא if (spans[i].id == "MainHoliday" || spans[i].id == "NonMainHoliday") toggleHoliday(spans[i], true); break; } }
}
// where action is true: remove color; function toggleHoliday(span, action) {
var aHoliday = span.parentNode; var supHoliday = aHoliday.parentNode; var tdHoliday = supHoliday.parentNode; if (tdHoliday.tagName != "TD") tdHoliday = tdHoliday.parentNode; if (action) { // then remove span.removeAttribute("style"); if (tdHoliday.id) tdHoliday.removeAttribute("bgColor"); else { tdHoliday.id = tdHoliday.bgColor; tdHoliday.removeAttribute("bgColor"); } } else { span.style.cursor = "help"; span.style.borderBottom = "2px solid red"; if (tdHoliday.id) tdHoliday.bgColor = tdHoliday.id; }
}
/* הגדרת הפונקציות לטעינה */ addLoadEvent(tableButton); addLoadEvent(templatesList); addLoadEvent(EncodedMoveLink); addLoadEvent(licenseListViewer); addLoadEvent(noSaving); addOnloadHook(selectAllunDel); addOnloadHook(featuredInterwiki); addOnloadHook(createNavigationBarToggleButton); addOnloadHook(addCharSubsetMenu); addLoadEvent(nikud); addOnloadHook(fixOl); addOnloadHook(miznon); addOnloadHook(hebrewCalendarInit);