Changeset 2729 for trunk/phpgwapi
- Timestamp:
- 05/06/10 17:30:43 (14 years ago)
- Location:
- trunk/phpgwapi/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/js/expressolivre/expressolivre.js
r2712 r2729 25 25 _xconnector.go( { 26 26 'access' : 'phpgwapi.expressolivre.lang&lang=' + lang + '&module=' + module, 27 'cache' : true, 27 28 'handler' : function( data ) 28 29 { -
trunk/phpgwapi/js/tools/xlink.js
r2712 r2729 78 78 if ( js ) 79 79 { 80 var tag = /<script([^>]* src="(\S+)"|[^>]*)>(.*?)<\/script>/;80 var tag = /<script([^>]*src="(\S+)"[^>]*|[^>]*)>(.*?)<\/script>/; 81 81 for ( var i = 0; i < js.length; i++ ) 82 82 { 83 83 var type = tag.exec( js[ i ] ); 84 data = data.replace( "\n\t\t" +type[ 0 ], '' );84 data = data.replace( type[ 0 ], '' ); 85 85 _new_scripts[ _new_scripts.length ] = type; 86 86 } … … 98 98 _container.appendChild( el.firstChild ); 99 99 100 var _count = 0; 101 function _scripts( ) 100 for ( var i = 0; i < _new_scripts.length; i++ ) 102 101 { 103 if ( _new_scripts[ _count ][ 2 ] == undefined || _new_scripts[ _count ][ 2 ].length == 0 ) 104 _script.load( function( ) 105 { 106 if ( ++_count < _new_scripts.length ) 107 _scripts( ); 108 }, _new_scripts[ _count ][ 3 ] ); 102 if ( _new_scripts[ i ][ 2 ] == undefined || _new_scripts[ i ][ 2 ].length == 0 ) 103 _script.inline( _new_scripts[ i ][ 3 ] ); 109 104 else 110 105 { 111 if ( _new_scripts[ _count][ 2 ].indexOf( window.location.host ) < 0 )112 _new_scripts[ _count ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ _count][ 2 ];106 if ( _new_scripts[ i ][ 2 ].indexOf( window.location.host ) < 0 ) 107 _new_scripts[ i ][ 2 ] = window.location.protocol + '//' + window.location.host + _new_scripts[ i ][ 2 ]; 113 108 114 _script. add(115 _new_scripts[ _count][ 2 ].substr(109 _script.external( 110 _new_scripts[ i ][ 2 ].substr( 116 111 _path.length - 1, 117 _new_scripts[ _count][ 2 ].length - _path.length + 1 - (118 ( _new_scripts[ _count][ 2 ].indexOf( '?' ) < 0 ) ?119 0 : ( _new_scripts[ _count ][ 2 ].length - _new_scripts[ _count][ 2 ].indexOf( '?' ) )112 _new_scripts[ i ][ 2 ].length - _path.length + 1 - ( 113 ( _new_scripts[ i ][ 2 ].indexOf( '?' ) < 0 ) ? 114 0 : ( _new_scripts[ i ][ 2 ].length - _new_scripts[ i ][ 2 ].indexOf( '?' ) ) 120 115 ) 121 116 ) 122 117 ); 123 if ( ++_count < _new_scripts.length )124 _scripts( );125 118 } 126 119 } 127 120 128 if ( _new_scripts.length ) 129 { 130 _scripts( ); 131 _script.load( ); 132 } 121 _script.load( ); 133 122 } 134 123 -
trunk/phpgwapi/js/tools/xscript.js
r2703 r2729 5 5 var _new = [ ]; 6 6 7 function _ add( pURL)7 function _inline( ) 8 8 { 9 for ( var i = 0; i < _loaded.length; i++ ) 10 if ( _loaded[ i ] == pURL ) 11 return false; 9 _new[ _new.length ] = { 10 "type" : "inline", 11 "content" : arguments[ 0 ] 12 }; 13 } 12 14 13 _new[ _new.length ] = pURL; 14 15 return true; 15 function _external( ) 16 { 17 _new[ _new.length ] = { 18 "type" : "external", 19 "content" : arguments[ 0 ] 20 }; 16 21 } 17 22 18 23 function _load( ) 19 24 { 20 var _handler = null; 21 if ( arguments.length && typeof arguments[ 0 ] == 'function' ) 22 _handler = arguments[ 0 ]; 25 var _count = 0; 26 function _handler( ) 27 { 28 var _scripts = [ ]; 29 _script : while ( _count < _new.length && _new[ _count ].type != 'inline' ) 30 { 31 for ( var i = 0; i < _loaded.length; i++ ) 32 if ( _loaded[ i ] == _new[ _count ].content ) 33 { 34 _count++; 35 continue _script; 36 } 23 37 24 var _inline = '';25 if ( arguments.length && typeof arguments[ 1 ] == 'string' )26 _inline = arguments[ 1 ];38 _scripts[ _scripts.length ] = _loaded[ _loaded.length ] = _new[ _count ].content; 39 _count++; 40 } 27 41 28 if ( ! _new.length ) 29 { 30 window.eval( _inline); 31 if ( _handler ) 32 _handler( ); 42 _scripts = _scripts.join( ';' ); 43 44 if ( _scripts.length ) 45 _connector.go( { 46 "access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts, 47 "handler" : function( data ) 48 { 49 window.eval( data ); 50 if ( _count < _new.length && _new[ _count ].type == 'inline' ) 51 { 52 window.eval( _new[ _count ].content ); 53 _count++; 54 _handler( ); 55 } 56 else 57 { 58 _count++; 59 _handler( ); 60 } 61 } 62 } ); 63 else 64 if ( _count < _new.length && _new[ _count ].type == 'inline' ) 65 { 66 window.eval( _new[ _count ].content ); 67 _count++; 68 _handler( ); 69 } 70 71 if ( _count == _new.length ) 72 _new = [ ]; 33 73 } 34 else 35 { 36 var _scripts = _new.join( ';' ); 37 38 for ( var i = 0; i < _new.length; i++ ) 39 _loaded[ _loaded.length ] = _new[ i ]; 40 41 _new = [ ]; 42 43 _connector.go( { 44 "access" : URL_SERVER + 'controller.php?action=phpgwapi.javascript.get_source&source=' + _scripts, 45 "handler" : function( data ) 46 { 47 window.eval( data + _inline); 48 49 if ( _handler ) 50 _handler( ); 51 } 52 } ); 53 } 74 _handler( ); 54 75 } 55 76 … … 61 82 } 62 83 63 Script.prototype.add = _add; 84 Script.prototype.external = _external; 85 Script.prototype.inline = _inline; 64 86 Script.prototype.load = _load; 65 87
Note: See TracChangeset
for help on using the changeset viewer.