[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 /***************************************************************************\ 2 * eGroupWare - Contacts Center * 3 * http://www.egroupware.org * 4 * Written by: * 5 * - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> * 6 * - Jonas Goes <jqhcb@users.sourceforge.net> * 7 * - Vinicius Cubas Brand <viniciuscb@users.sourceforge.net> * 8 * sponsored by Think.e - http://www.think-e.com.br * 9 * ------------------------------------------------------------------------- * 10 * This program is free software; you can redistribute it and/or modify it * 11 * under the terms of the GNU General Public License as published by the * 12 * Free Software Foundation; either version 2 of the License, or (at your * 13 * option) any later version. * 14 \***************************************************************************/ 15 16 /***********************************************\ 17 * INITIALIZATION * 18 \***********************************************/ 19 20 /***********************************************\ 21 * AUXILIAR FUNCTIONS * 22 \***********************************************/ 23 24 function Element (element) 25 { 26 return document.all[element]; 27 } 28 29 /***********************************************\ 30 * HTML ELEMENTS AUXILIAR FUNCTIONS * 31 \***********************************************/ 32 33 /***********************************************\ 34 * OTHER FUNCTIONS * 35 \***********************************************/ 36 37 //postpone function to be executed after body had loaded 38 cJsLib.prototype.postponeFunction = function(obj_function) 39 { 40 if (document && document.body && this.loaded) 41 { 42 obj_function(); 43 return; 44 } 45 46 if (typeof(obj_function) != 'function') 47 { 48 throw ('JsLib.postponeFunction: parameter must be a function'); 49 } 50 51 this._functions.push(obj_function); 52 53 // 'arguments' are all args passed to this function 54 var args = new Array(); 55 for (var i = 1; i< arguments.length; i++) 56 { 57 args.push(arguments[i]); 58 } 59 60 if (args.length) 61 { 62 this._arguments.push(args); 63 } 64 this.init(); 65 } 66 67 //exec postponed functions 68 cJsLib.prototype.execPostponed = function() 69 { 70 if (this._original_body_onload != null) 71 { 72 this._original_body_onload(); 73 } 74 75 var code = ''; 76 var _this = this; 77 78 for (var i in this._functions) 79 { 80 if (typeof(this._arguments[i]) == 'object') 81 { 82 code += 'this._functions['+i+']('; 83 for (var j in _this._arguments[i]) 84 { 85 code += this._arguments[i][j]+','; 86 } 87 88 code = code.substr(code, code.length-1); 89 code += ');'; 90 91 continue; 92 } 93 94 code += 'this._functions['+i+']();'; 95 } 96 97 eval(code); 98 /* 99 for (var i=0; i < this._functions.length; i++) 100 { 101 this._functions[i](); //TODO treat args 102 } 103 */ 104 } 105 106 //put function on body onload 107 cJsLib.prototype.init = function() 108 { 109 if (this.initialized) 110 { 111 return; 112 } 113 114 this.initialized = true; 115 this.loaded = false; 116 117 var _this = this; 118 var init = function() 119 { 120 var execPostponed = function() 121 { 122 _this.execPostponed(); 123 _this.loaded = true; 124 }; 125 _this._original_body_onload = document.body.onload; 126 document.body.onload = execPostponed; 127 //document.body.onload = function() { alert('Rodou!')}; 128 }; 129 130 Timeout(function() { if (document.body) return true; else return false;}, init); 131 } 132 133 var JsLib = new cJsLib(); 134 135 136 /***********************************************\ 137 * JS Object Extension * 138 \***********************************************/ 139 // Insert Debug Holder 140 function _createDebugDOM() 141 { 142 var dbg_holder = document.createElement('xmp'); 143 144 dbg_holder.id = 'jsapiDebug'; 145 dbg_holder.style.position = 'absolute'; 146 dbg_holder.style.left = '1500px'; 147 dbg_holder.style.top = '0px'; 148 dbg_holder.style.fontFamily = 'monospace'; 149 150 document.body.appendChild(dbg_holder); 151 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |