| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:32:46 2008 ] | [ AWF-CMS 2.1.3 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 // Wikipedia JavaScript support functions 2 // if this is true, the toolbar will no longer overwrite the infobox when you move the mouse over individual items 3 var noOverwrite=false; 4 var alertText; 5 var clientPC = navigator.userAgent.toLowerCase(); // Get client info 6 var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) 7 && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1)); 8 var is_safari = ((clientPC.indexOf('AppleWebKit')!=-1) && (clientPC.indexOf('spoofer')==-1)); 9 var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled )); 10 if (clientPC.indexOf('opera')!=-1) { 11 var is_opera = true; 12 var is_opera_preseven = (window.opera && !document.childNodes); 13 var is_opera_seven = (window.opera && document.childNodes); 14 } 15 16 function escapeQuotes(text) { 17 var re=new RegExp("'","g"); 18 text=text.replace(re,"\\'"); 19 re=new RegExp('"',"g"); 20 text=text.replace(re,'"'); 21 re=new RegExp("\\n","g"); 22 text=text.replace(re,"\\n"); 23 return text; 24 } 25 26 function escapeQuotesHTML(text) { 27 var re=new RegExp('"',"g"); 28 text=text.replace(re,"""); 29 return text; 30 } 31 32 // apply tagOpen/tagClose to selection in textarea, 33 // use sampleText instead of selection if there is none 34 // copied and adapted from phpBB 35 36 function insertTags(tagOpen, tagClose, sampleText, txtarea) { 37 // var txtarea = document.editform.wpTextbox1; 38 // IE 39 if(document.selection && !is_gecko) { 40 var theSelection = document.selection.createRange().text; 41 if(!theSelection) { theSelection=sampleText;} 42 txtarea.focus(); 43 if(theSelection.charAt(theSelection.length - 1) == " "){// exclude ending space char, if any 44 theSelection = theSelection.substring(0, theSelection.length - 1); 45 document.selection.createRange().text = tagOpen + theSelection + tagClose + " "; 46 } else { 47 document.selection.createRange().text = tagOpen + theSelection + tagClose; 48 } 49 50 // Mozilla 51 } else if(txtarea.selectionStart || txtarea.selectionStart == '0') { 52 var startPos = txtarea.selectionStart; 53 var endPos = txtarea.selectionEnd; 54 var scrollTop=txtarea.scrollTop; 55 var myText = (txtarea.value).substring(startPos, endPos); 56 if(!myText) { myText=sampleText;} 57 if(myText.charAt(myText.length - 1) == " "){ // exclude ending space char, if any 58 subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " "; 59 } else { 60 subst = tagOpen + myText + tagClose; 61 } 62 txtarea.value = txtarea.value.substring(0, startPos) + subst + 63 txtarea.value.substring(endPos, txtarea.value.length); 64 txtarea.focus(); 65 66 var cPos=startPos+(tagOpen.length+myText.length+tagClose.length); 67 txtarea.selectionStart=cPos; 68 txtarea.selectionEnd=cPos; 69 txtarea.scrollTop=scrollTop; 70 71 // All others 72 } else { 73 var copy_alertText=alertText; 74 var re1=new RegExp("\\$1","g"); 75 var re2=new RegExp("\\$2","g"); 76 copy_alertText=copy_alertText.replace(re1,sampleText); 77 copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose); 78 var text; 79 if (sampleText) { 80 text=prompt(copy_alertText); 81 } else { 82 text=""; 83 } 84 if(!text) { text=sampleText;} 85 text=tagOpen+text+tagClose; 86 document.infoform.infobox.value=text; 87 // in Safari this causes scrolling 88 if(!is_safari) { 89 txtarea.focus(); 90 } 91 noOverwrite=true; 92 } 93 // reposition cursor if possible 94 if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate(); 95 } 96 97 function QuickJump(Formular) { 98 var Element = Formular.Ziel.selectedIndex; 99 if (Formular.Ziel.options[Element].value != 0) 100 { 101 location = Formular.Ziel.options[Element].value; 102 } 103 } 104 105 function sendmessage(user_id) { 106 window.open("message.php?send_message=" + user_id, "SendInstantMessage", "width=309,height=269,dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=no,status=no,location=no"); 107 } 108 109 function open_print_window(url) { 110 window.open(url,"print","width=600,height=400,dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no"); 111 } 112 113 function open_popup_window(url, x, y) { 114 window.open(url,"js_window","width="+x+",height="+y+",dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,top=90,left=110"); 115 } 116 117 function open_window(url) { 118 window.open(url, "popup", 119 "width=800,height=600,dependent=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no"); 120 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |