[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 // htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc. 2 // This copyright notice MUST stay intact for use (see license.txt). 3 // 4 // Portions (c) dynarch.com, 2003 5 // 6 // A free WYSIWYG editor replacement for <textarea> fields. 7 // For full source code and docs, visit http://www.interactivetools.com/ 8 // 9 // Version 3.0 developed by Mihai Bazon. 10 // http://dynarch.com/mishoo 11 // 12 // $Id: popup.js 26 2004-03-31 02:35:21Z Wei Zhuo $ 13 14 // Slightly modified for the ImageManager, window resizing is done only 15 // by each window's script. Added translation for a few other HTML elements. 16 17 function getAbsolutePos(el) { 18 var r = { x: el.offsetLeft, y: el.offsetTop }; 19 if (el.offsetParent) { 20 var tmp = getAbsolutePos(el.offsetParent); 21 r.x += tmp.x; 22 r.y += tmp.y; 23 } 24 return r; 25 }; 26 27 function comboSelectValue(c, val) { 28 var ops = c.getElementsByTagName("option"); 29 for (var i = ops.length; --i >= 0;) { 30 var op = ops[i]; 31 op.selected = (op.value == val); 32 } 33 c.value = val; 34 }; 35 36 function __dlg_onclose() { 37 if(opener.Dialog._return) 38 opener.Dialog._return(null); 39 }; 40 41 function __dlg_init(bottom) { 42 var body = document.body; 43 var body_height = 0; 44 if (typeof bottom == "undefined") { 45 var div = document.createElement("div"); 46 body.appendChild(div); 47 var pos = getAbsolutePos(div); 48 body_height = pos.y; 49 } else { 50 var pos = getAbsolutePos(bottom); 51 body_height = pos.y + bottom.offsetHeight; 52 } 53 if(opener && opener.Dialog && opener.Dialog._arguments) 54 window.dialogArguments = opener.Dialog._arguments; 55 if (!document.all) { 56 //window.sizeToContent(); 57 //window.sizeToContent(); // for reasons beyond understanding, 58 // only if we call it twice we get the 59 // correct size. 60 window.addEventListener("unload", __dlg_onclose, true); 61 // center on parent 62 var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2; 63 var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2; 64 65 window.moveTo(x, y); 66 //window.innerWidth = body.offsetWidth + 5; 67 //window.innerHeight = body_height + 2; 68 } else { 69 // window.dialogHeight = body.offsetHeight + 50 + "px"; 70 // window.dialogWidth = body.offsetWidth + "px"; 71 //window.resizeTo(body.offsetWidth, body_height); 72 var ch = body.clientHeight; 73 var cw = body.clientWidth; 74 //window.resizeBy(body.offsetWidth - cw, body_height - ch); 75 var W = body.offsetWidth; 76 var H = 2 * body_height - ch; 77 if(ch <= 0) H = body_height; 78 var x = (screen.availWidth - W) / 2; 79 var y = (screen.availHeight - H) / 2; 80 //alert('x:'+x+' y:'+y+' ch:'+ch); 81 if(Dialog.is_ie) 82 window.moveTo(x, y); 83 else //opera 84 window.moveTo(x, y - H/4); 85 } 86 document.body.onkeypress = __dlg_close_on_esc; 87 }; 88 89 function __dlg_translate(i18n) { 90 var types = ["span", "option", "td", "button", "div", "label", "a","img", "legend"]; 91 for (var type in types) { 92 var spans = document.getElementsByTagName(types[type]); 93 for (var i = spans.length; --i >= 0;) { 94 var span = spans[i]; 95 if (span.firstChild && span.firstChild.data) { 96 var txt = i18n[span.firstChild.data]; 97 if (txt) span.firstChild.data = txt; 98 } 99 if(span.title){ 100 var txt = i18n[span.title]; 101 if(txt) span.title = txt; 102 } 103 if(span.alt){ 104 var txt = i18n[span.alt]; 105 if(txt) span.alt = txt; 106 } 107 } 108 } 109 var txt = i18n[document.title]; 110 if (txt) 111 document.title = txt; 112 }; 113 114 // closes the dialog and passes the return info upper. 115 function __dlg_close(val) { 116 opener.Dialog._return(val); 117 window.close(); 118 }; 119 120 function __dlg_close_on_esc(ev) { 121 ev || (ev = window.event); 122 if (ev.keyCode == 27) { 123 window.close(); 124 return false; 125 } 126 return true; 127 }; 128 129 function Dialog(){}; 130 Dialog.agt = navigator.userAgent.toLowerCase(); 131 Dialog.is_ie = ((Dialog.agt.indexOf("msie") != -1) && (Dialog.agt.indexOf("opera") == -1));
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |