מדיה ויקי:Makor.js: הבדלים בין גרסאות בדף
קפיצה לניווט
קפיצה לחיפוש
Yeshivaorgil (שיחה | תרומות) מאין תקציר עריכה |
Yeshivaorgil (שיחה | תרומות) (שיפוץ) |
||
שורה 1: | שורה 1: | ||
/* כלי ליצירת מקורות המקושרים לפרוייקט השו"ת */ | |||
/* גרסה 1.0 נכתב ע"י Yeshivaorgil */ | |||
function generateMakor( cat, book, per, pas) { | |||
var code = ""; | |||
if (book.substr(0,book.indexOf(" ")) != cat) | |||
code += cat + ":" + book + " " + per + " " + pas; | |||
else | |||
code += cat + ":" + book.substr(book.indexOf(" ")+1) + " " + per + " " + pas; | |||
insertTags( "{{מקור|", "}}", code ); | |||
} | |||
function calPer(hak) | |||
{ | |||
a=hak*1; | |||
a *= 0.27; | |||
hak=Math.round((100*(a+1))/27); | |||
return hak; | |||
} | |||
function popupMakor() { | |||
var popup = window.open( "", "popup", "height=380,width=500" ); | |||
popup.document.open(); | |||
popup.document.write('<html><head><title>מקור מקושר</title>'); | |||
popup.document.write('<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "http://www.yeshiva.org.il/wiki/skins/monobook/main.css"; @import "http://www.yeshiva.org.il/wiki/skins/monobook/rtl.css"; /*]]>*/</style>'); | |||
popup.document.write('<style>select{font-family:arial;}.lst0{height:0px;width:0px;visibility:hidden;}.lst1{height:100px;width:300px;visiblility:visible;}</style>'); | |||
popup.document.write('<script language="javascript" src="http://www.yeshiva.org.il/wiki/extensions/makor/BD.js"></script>'); | |||
popup.document.write('<script type="text/javascript">function insertCode() {'); | |||
popup.document.write('var cat = document.paramForm.catList.options[document.paramForm.catList.selectedIndex].text; '); | |||
popup.document.write('var book = document.paramForm.inputBook.value; '); | |||
popup.document.write('var per = document.paramForm.inputPerek.value; '); | |||
popup.document.write('var pas = document.paramForm.inputPasuk.value; '); | |||
popup.document.write('window.opener.generateMakor( cat, book, per, pas); '); | |||
popup.document.write('}\n'); | |||
popup.document.write('function getL()'); | |||
popup.document.write('{//alert(BrowserDetect.browser);\n'); | |||
popup.document.write('var xmlHttp;var num=document.paramForm.catList.selectedIndex;'); | |||
popup.document.write('try{// Firefox, Opera 8.0+, Safari\n'); | |||
popup.document.write('xmlHttp=new XMLHttpRequest();}\n'); | |||
popup.document.write('catch (e){// Internet Explorer\n'); | |||
popup.document.write('try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}\n'); | |||
popup.document.write('catch (e)'); | |||
popup.document.write('{'); | |||
popup.document.write('try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}\n'); | |||
popup.document.write('catch (e){'); | |||
popup.document.write('alert("Your browser does not support AJAX!");'); | |||
popup.document.write('return false;}\n'); | |||
popup.document.write('}\n'); | |||
popup.document.write('}\n'); | |||
popup.document.write('xmlHttp.onreadystatechange=function()'); | |||
popup.document.write('{'); | |||
popup.document.write('if(xmlHttp.readyState==4)'); | |||
popup.document.write('{'); | |||
popup.document.write('if(BrowserDetect.browser=="Explorer")'); | |||
popup.document.write('document.getElementById("selectList").outerHTML="<select id=\\"selectList\\" ondblclick=\\"autoVom(this);\\" onchange=\\"autoVom(this);\\" dir=\\"rtl\\" size=6>" + xmlHttp.responseText + "</select>";'); | |||
popup.document.write('else\n'); | |||
popup.document.write('document.getElementById("selectList").innerHTML=xmlHttp.responseText;'); | |||
popup.document.write('}\n'); | |||
popup.document.write('}\n'); | |||
popup.document.write('if(BrowserDetect.browser!="Explorer")'); | |||
popup.document.write('xmlHttp.open("GET","http://www.yeshiva.org.il/wiki/extensions/makor/bl.php?sCat="+num,true);'); | |||
popup.document.write('else\n'); | |||
popup.document.write('xmlHttp.open("GET","http://www.yeshiva.org.il/wiki/extensions/makor/bl.php?sCat="+num,false);'); | |||
popup.document.write('xmlHttp.send(null);'); | |||
popup.document.write('}\n'); | |||
popup.document.write('function autoVom(selObj) {'); | |||
popup.document.write('paramForm.inputBook.value = selObj.options[selObj.selectedIndex].text;'); | |||
popup.document.write('}\n'); | |||
popup.document.write('function loadCat(selObj) {'); | |||
popup.document.write('getL();'); | |||
popup.document.write('}\n'); | |||
popup.document.write('function FindDefinitionInList(UserSelection,objSelectBox)'); | |||
popup.document.write('{'); | |||
popup.document.write('var strSearchString, lngLenSearchString;'); | |||
popup.document.write('strSearchString = UserSelection.value;'); | |||
popup.document.write('lngLenSearchString = strSearchString.length;'); | |||
popup.document.write('for (i=0;i<objSelectBox.length;i++)'); | |||
popup.document.write('{'); | |||
popup.document.write('if (objSelectBox[i].text.substr(0,lngLenSearchString) == strSearchString){'); | |||
popup.document.write('objSelectBox.options[i].selected = true;'); | |||
popup.document.write('break;}'); | |||
popup.document.write('}\n'); | |||
popup.document.write('if(event.keyCode == 13) {'); | |||
popup.document.write('UserSelection.value = objSelectBox.options[i].text;}'); | |||
popup.document.write('}\n'); | |||
popup.document.write('</script>'); | |||
popup.document.write('</head><body>'); | |||
popup.document.write('<p>אנא הזן/י פרמטרים למקור : </p>'); | |||
popup.document.write('<form name="paramForm">'); | |||
popup.document.write('קטגוריה:<select id="catList" name="catList" onchange=\'loadCat(this);\'>'); | |||
popup.document.write('<option>תנ"ך</option><option>פרשנות-תנ"ך</option><option>משנה</option><option>תוספתא</option><option>מסכתות-קטנות</option><option>בבלי</option><option>ירושלמי</option><option>מדרשי-הלכה</option><option>מדרשי-אגדה</option><option>זוהר</option><option>גאונים</option><option>פרשנות-משנה</option><option>ראשונים</option><option>פוסקים</option><option>אחרונים</option><option>מנהגים</option><option>מצוות</option><option>מחשבה</option><option>רמב"ם</option><option>פרשנות-רמב"ם</option><option>טור</option><option>בית-יוסף</option><option>שולחן-ערוך</option><option>פרשנות-שו"ע</option><option>קיצור-שולחן-ערוך</option><option>חסידות</option><option>שות</option><option>כללים</option>'); | |||
popup.document.write('</select></div><BR>'); | |||
popup.document.write('ספר: <INPUT id="inputBook" name="inputBook" maxlength="100" onkeyup=\'FindDefinitionInList(getElementById("inputBook"),getElementById("select" + getElementById("catList").selectedIndex));\' style=\'FONT-FAMILY: arial; WIDTH: 200px;\' value=\'בראשית\'><BR>'); | |||
popup.document.write('רשימת ספרים:'); | |||
popup.document.write('<select id="selectList" ondblclick="paramForm.inputBook.value = this.options[this.selectedIndex].text;" onchange=\"paramForm.inputBook.value = this.options[this.selectedIndex].text;\" dir=\"rtl\" size=6 class="lst1">'); | |||
popup.document.write('<option>בראשית</option>'); | |||
popup.document.write('<option>שמות</option>'); | |||
popup.document.write('<option>ויקרא</option>'); | |||
popup.document.write('<option>במדבר</option>'); | |||
popup.document.write('<option>דברים</option>'); | |||
popup.document.write('<option>יהושע</option>'); | |||
popup.document.write('<option>שופטים</option>'); | |||
popup.document.write('<option>שמואל א</option>'); | |||
popup.document.write('<option>שמואל ב</option>'); | |||
popup.document.write('<option>מלכים א</option>'); | |||
popup.document.write('<option>מלכים ב</option>'); | |||
popup.document.write('<option>ישעיהו</option>'); | |||
popup.document.write('<option>ירמיהו</option>'); | |||
popup.document.write('<option>יחזקאל</option>'); | |||
popup.document.write('<option>הושע</option>'); | |||
popup.document.write('<option>יואל</option>'); | |||
popup.document.write('<option>עמוס</option>'); | |||
popup.document.write('<option>עובדיה</option>'); | |||
popup.document.write('<option>יונה</option>'); | |||
popup.document.write('<option>מיכה</option>'); | |||
popup.document.write('<option>נחום</option>'); | |||
popup.document.write('<option>חבקוק</option>'); | |||
popup.document.write('<option>צפניה</option>'); | |||
popup.document.write('<option>חגי</option>'); | |||
popup.document.write('<option>זכריה</option>'); | |||
popup.document.write('<option>מלאכי</option>'); | |||
popup.document.write('<option>תהלים</option>'); | |||
popup.document.write('<option>משלי</option>'); | |||
popup.document.write('<option>איוב</option>'); | |||
popup.document.write('<option>שיר השירים</option>'); | |||
popup.document.write('<option>רות</option>'); | |||
popup.document.write('<option>איכה</option>'); | |||
popup.document.write('<option>קהלת</option>'); | |||
popup.document.write('<option>אסתר</option>'); | |||
popup.document.write('<option>דניאל</option>'); | |||
popup.document.write('<option>עזרא</option>'); | |||
popup.document.write('<option>נחמיה</option>'); | |||
popup.document.write('<option>דברי הימים א</option>'); | |||
popup.document.write('<option>דברי הימים ב</option>'); | |||
popup.document.write('</select>'); | |||
popup.document.write('<br>'); | |||
popup.document.write('חלק בספר (פרק, סימן וכד\'): <input type="text" name="inputPerek" maxlength="30" value="א" style=\"width:50px;\"><p>'); | |||
popup.document.write('חלק משנה (פסוק, סעיף וכד\') [לא חובה להזין]: <input type="text" name="inputPasuk" maxlength="30" value="א" style=\"width:50px;\"><p>'); | |||
popup.document.write('</form><br>'); | |||
popup.document.write('<p><a href="javascript:insertCode(); self.close();"> הוספת הקוד לחלון העריכה</a></p>'); | |||
popup.document.write('<p><a href="javascript:self.close()"> סגירה</a></p>');/**/ | |||
popup.document.write('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>'); | |||
popup.document.write('</body></html>'); | |||
popup.document.close(); | |||
} | |||
/* הוספת כפתור מקורות לסרגל הכלים */ | |||
function makorButton() | |||
{ | |||
if( document.getElementById("toolbar") ) | |||
{ | |||
var makorButton = document.createElement("img"); | |||
makorButton.width = 23; | |||
makorButton.height = 22; | |||
makorButton.src = "images/4/44/Button_makor.PNG"; | |||
makorButton.border = 0; | |||
makorButton.alt = "הוספת מקור"; | |||
makorButton.title = "הוספת מקור"; | |||
makorButton.style.cursor = "pointer"; | |||
makorButton.onclick = popupMakor; | |||
document.getElementById("toolbar").appendChild( makorButton ); | |||
} | |||
} | |||
hookEvent("load", makorButton); | |||
גרסה מ־15:43, 12 בפברואר 2009
|
/* כלי ליצירת מקורות המקושרים לפרוייקט השו"ת */ /* גרסה 1.0 נכתב ע"י Yeshivaorgil */ function generateMakor( cat, book, per, pas) { var code = ""; if (book.substr(0,book.indexOf(" ")) != cat) code += cat + ":" + book + " " + per + " " + pas; else code += cat + ":" + book.substr(book.indexOf(" ")+1) + " " + per + " " + pas; insertTags( "{{מקור|", "}}", code ); } function calPer(hak) { a=hak*1; a *= 0.27; hak=Math.round((100*(a+1))/27); return hak; } function popupMakor() { var popup = window.open( "", "popup", "height=380,width=500" ); popup.document.open(); popup.document.write('<html><head><title>מקור מקושר</title>'); popup.document.write('<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "http://www.yeshiva.org.il/wiki/skins/monobook/main.css"; @import "http://www.yeshiva.org.il/wiki/skins/monobook/rtl.css"; /*]]>*/</style>'); popup.document.write('<style>select{font-family:arial;}.lst0{height:0px;width:0px;visibility:hidden;}.lst1{height:100px;width:300px;visiblility:visible;}</style>'); popup.document.write('<script language="javascript" src="http://www.yeshiva.org.il/wiki/extensions/makor/BD.js"></script>'); popup.document.write('<script type="text/javascript">function insertCode() {'); popup.document.write('var cat = document.paramForm.catList.options[document.paramForm.catList.selectedIndex].text; '); popup.document.write('var book = document.paramForm.inputBook.value; '); popup.document.write('var per = document.paramForm.inputPerek.value; '); popup.document.write('var pas = document.paramForm.inputPasuk.value; '); popup.document.write('window.opener.generateMakor( cat, book, per, pas); '); popup.document.write('}\n'); popup.document.write('function getL()'); popup.document.write('{//alert(BrowserDetect.browser);\n'); popup.document.write('var xmlHttp;var num=document.paramForm.catList.selectedIndex;'); popup.document.write('try{// Firefox, Opera 8.0+, Safari\n'); popup.document.write('xmlHttp=new XMLHttpRequest();}\n'); popup.document.write('catch (e){// Internet Explorer\n'); popup.document.write('try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}\n'); popup.document.write('catch (e)'); popup.document.write('{'); popup.document.write('try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}\n'); popup.document.write('catch (e){'); popup.document.write('alert("Your browser does not support AJAX!");'); popup.document.write('return false;}\n'); popup.document.write('}\n'); popup.document.write('}\n'); popup.document.write('xmlHttp.onreadystatechange=function()'); popup.document.write('{'); popup.document.write('if(xmlHttp.readyState==4)'); popup.document.write('{'); popup.document.write('if(BrowserDetect.browser=="Explorer")'); popup.document.write('document.getElementById("selectList").outerHTML="<select id=\\"selectList\\" ondblclick=\\"autoVom(this);\\" onchange=\\"autoVom(this);\\" dir=\\"rtl\\" size=6>" + xmlHttp.responseText + "</select>";'); popup.document.write('else\n'); popup.document.write('document.getElementById("selectList").innerHTML=xmlHttp.responseText;'); popup.document.write('}\n'); popup.document.write('}\n'); popup.document.write('if(BrowserDetect.browser!="Explorer")'); popup.document.write('xmlHttp.open("GET","http://www.yeshiva.org.il/wiki/extensions/makor/bl.php?sCat="+num,true);'); popup.document.write('else\n'); popup.document.write('xmlHttp.open("GET","http://www.yeshiva.org.il/wiki/extensions/makor/bl.php?sCat="+num,false);'); popup.document.write('xmlHttp.send(null);'); popup.document.write('}\n'); popup.document.write('function autoVom(selObj) {'); popup.document.write('paramForm.inputBook.value = selObj.options[selObj.selectedIndex].text;'); popup.document.write('}\n'); popup.document.write('function loadCat(selObj) {'); popup.document.write('getL();'); popup.document.write('}\n'); popup.document.write('function FindDefinitionInList(UserSelection,objSelectBox)'); popup.document.write('{'); popup.document.write('var strSearchString, lngLenSearchString;'); popup.document.write('strSearchString = UserSelection.value;'); popup.document.write('lngLenSearchString = strSearchString.length;'); popup.document.write('for (i=0;i<objSelectBox.length;i++)'); popup.document.write('{'); popup.document.write('if (objSelectBox[i].text.substr(0,lngLenSearchString) == strSearchString){'); popup.document.write('objSelectBox.options[i].selected = true;'); popup.document.write('break;}'); popup.document.write('}\n'); popup.document.write('if(event.keyCode == 13) {'); popup.document.write('UserSelection.value = objSelectBox.options[i].text;}'); popup.document.write('}\n'); popup.document.write('</script>'); popup.document.write('</head><body>'); popup.document.write('<p>אנא הזן/י פרמטרים למקור : </p>'); popup.document.write('<form name="paramForm">'); popup.document.write('קטגוריה:<select id="catList" name="catList" onchange=\'loadCat(this);\'>'); popup.document.write('<option>תנ"ך</option><option>פרשנות-תנ"ך</option><option>משנה</option><option>תוספתא</option><option>מסכתות-קטנות</option><option>בבלי</option><option>ירושלמי</option><option>מדרשי-הלכה</option><option>מדרשי-אגדה</option><option>זוהר</option><option>גאונים</option><option>פרשנות-משנה</option><option>ראשונים</option><option>פוסקים</option><option>אחרונים</option><option>מנהגים</option><option>מצוות</option><option>מחשבה</option><option>רמב"ם</option><option>פרשנות-רמב"ם</option><option>טור</option><option>בית-יוסף</option><option>שולחן-ערוך</option><option>פרשנות-שו"ע</option><option>קיצור-שולחן-ערוך</option><option>חסידות</option><option>שות</option><option>כללים</option>'); popup.document.write('</select></div><BR>'); popup.document.write('ספר: <INPUT id="inputBook" name="inputBook" maxlength="100" onkeyup=\'FindDefinitionInList(getElementById("inputBook"),getElementById("select" + getElementById("catList").selectedIndex));\' style=\'FONT-FAMILY: arial; WIDTH: 200px;\' value=\'בראשית\'><BR>'); popup.document.write('רשימת ספרים:'); popup.document.write('<select id="selectList" ondblclick="paramForm.inputBook.value = this.options[this.selectedIndex].text;" onchange=\"paramForm.inputBook.value = this.options[this.selectedIndex].text;\" dir=\"rtl\" size=6 class="lst1">'); popup.document.write('<option>בראשית</option>'); popup.document.write('<option>שמות</option>'); popup.document.write('<option>ויקרא</option>'); popup.document.write('<option>במדבר</option>'); popup.document.write('<option>דברים</option>'); popup.document.write('<option>יהושע</option>'); popup.document.write('<option>שופטים</option>'); popup.document.write('<option>שמואל א</option>'); popup.document.write('<option>שמואל ב</option>'); popup.document.write('<option>מלכים א</option>'); popup.document.write('<option>מלכים ב</option>'); popup.document.write('<option>ישעיהו</option>'); popup.document.write('<option>ירמיהו</option>'); popup.document.write('<option>יחזקאל</option>'); popup.document.write('<option>הושע</option>'); popup.document.write('<option>יואל</option>'); popup.document.write('<option>עמוס</option>'); popup.document.write('<option>עובדיה</option>'); popup.document.write('<option>יונה</option>'); popup.document.write('<option>מיכה</option>'); popup.document.write('<option>נחום</option>'); popup.document.write('<option>חבקוק</option>'); popup.document.write('<option>צפניה</option>'); popup.document.write('<option>חגי</option>'); popup.document.write('<option>זכריה</option>'); popup.document.write('<option>מלאכי</option>'); popup.document.write('<option>תהלים</option>'); popup.document.write('<option>משלי</option>'); popup.document.write('<option>איוב</option>'); popup.document.write('<option>שיר השירים</option>'); popup.document.write('<option>רות</option>'); popup.document.write('<option>איכה</option>'); popup.document.write('<option>קהלת</option>'); popup.document.write('<option>אסתר</option>'); popup.document.write('<option>דניאל</option>'); popup.document.write('<option>עזרא</option>'); popup.document.write('<option>נחמיה</option>'); popup.document.write('<option>דברי הימים א</option>'); popup.document.write('<option>דברי הימים ב</option>'); popup.document.write('</select>'); popup.document.write('<br>'); popup.document.write('חלק בספר (פרק, סימן וכד\'): <input type="text" name="inputPerek" maxlength="30" value="א" style=\"width:50px;\"><p>'); popup.document.write('חלק משנה (פסוק, סעיף וכד\') [לא חובה להזין]: <input type="text" name="inputPasuk" maxlength="30" value="א" style=\"width:50px;\"><p>'); popup.document.write('</form><br>'); popup.document.write('<p><a href="javascript:insertCode(); self.close();"> הוספת הקוד לחלון העריכה</a></p>'); popup.document.write('<p><a href="javascript:self.close()"> סגירה</a></p>');/**/ popup.document.write('<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>'); popup.document.write('</body></html>'); popup.document.close(); } /* הוספת כפתור מקורות לסרגל הכלים */ function makorButton() { if( document.getElementById("toolbar") ) { var makorButton = document.createElement("img"); makorButton.width = 23; makorButton.height = 22; makorButton.src = "images/4/44/Button_makor.PNG"; makorButton.border = 0; makorButton.alt = "הוספת מקור"; makorButton.title = "הוספת מקור"; makorButton.style.cursor = "pointer"; makorButton.onclick = popupMakor; document.getElementById("toolbar").appendChild( makorButton ); } } hookEvent("load", makorButton);