- Timestamp:
- 05/11/10 15:13:27 (14 years ago)
- Location:
- trunk/phpgwapi/js/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/js/tools/xlink.js
r2741 r2756 71 71 function _handler( data ) 72 72 { 73 data = data.trim( ); 73 74 data = data.replace( /\n/g, '__LINE_FEED_CHARACTER__' ); 74 var js = data.match( /<script[^>]*>.*?<\/script>/gi ); 75 if ( js ) 75 data = data.replace( /\r|\t/g, '' ); 76 var _js = data.match( /<script[^>]*>.*?<\/script>/gi ); 77 if ( _js ) 76 78 { 77 var _tag = /<script([^>] *src="(\S+)"[^>]*|[^>]*)>(.*?)<\/script>/i;78 for ( var i = 0; i < js.length; i++ )79 var _tag = /<script([^>]+src=["'](\S+)["'])?[^>]*>(.*?)<\/script>/i; 80 for ( var i = 0; i < _js.length; i++ ) 79 81 { 80 var _type = _tag.exec( js[ i ] ); 81 data = data.replace( _type[ 0 ], '' ); 82 data = data.replace( _js[ i ], '' ); 82 83 83 if ( _type[ 2 ] == undefined || _type[ 2 ].length == 0 ) 84 _script.inline( _type[ 3 ].replace( /__LINE_FEED_CHARACTER__/g, '\n' ) ); 84 _js[ i ] = _tag.exec( _js[ i ] ); 85 86 if ( _js[ i ][ 2 ] == undefined || _js[ i ][ 2 ].length == 0 ) 87 _script.inline( _js[ i ][ 3 ].replace( /__LINE_FEED_CHARACTER__/g, '\n' ) ); 85 88 else 86 89 { 87 if ( _type[ 2 ].indexOf( window.location.host ) < 0 ) 88 _type[ 2 ] = window.location.protocol + '//' + window.location.host + _type[ 2 ]; 90 var _external = _js[ i ][ 2 ]; 91 92 if ( _external.indexOf( window.location.host ) < 0 ) 93 _external = window.location.protocol + '//' + window.location.host + _external; 89 94 90 95 _script.external( 91 _ type[ 2 ].substr(96 _external.substr( 92 97 _path.length - 1, 93 _ type[ 2 ].length - _path.length + 1 - (94 ( _ type[ 2 ].indexOf( '?' ) < 0 ) ?95 0 : ( _ type[ 2 ].length - _type[ 2 ].indexOf( '?' ) )98 _external.length - _path.length + 1 - ( 99 ( _external.indexOf( '?' ) < 0 ) ? 100 0 : ( _external.length - _external.indexOf( '?' ) ) 96 101 ) 97 102 ) -
trunk/phpgwapi/js/tools/xscript.js
r2729 r2756 47 47 "handler" : function( data ) 48 48 { 49 window.eval( data );50 49 if ( _count < _new.length && _new[ _count ].type == 'inline' ) 51 { 52 window.eval( _new[ _count ].content ); 53 _count++; 54 _handler( ); 55 } 50 data += _new[ _count ].content; 51 52 if ( window.execScript ) 53 window.execScript( data ); 56 54 else 57 { 58 _count++; 59 _handler( ); 60 } 55 with ( window ) 56 window.eval( data ); 57 58 _count++; 59 _handler( ); 61 60 } 62 61 } ); … … 64 63 if ( _count < _new.length && _new[ _count ].type == 'inline' ) 65 64 { 66 window.eval( _new[ _count ].content ); 65 if ( window.execScript ) 66 window.execScript( _new[ _count ].content ); 67 else 68 with ( window ) 69 window.eval( _new[ _count ].content ); 70 67 71 _count++; 68 72 _handler( );
Note: See TracChangeset
for help on using the changeset viewer.