Changeset 2802 for trunk/phpgwapi
- Timestamp:
- 05/18/10 09:41:04 (14 years ago)
- Location:
- trunk/phpgwapi/js
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/js/expressolivre/expressolivre.js
r2732 r2802 14 14 15 15 var _loading = new Image( ); 16 17 function _form( ) 18 { 19 if ( ! arguments.length ) 20 return false; 21 22 var _handler = null; 23 24 if ( arguments.length > 1 && arguments[ 1 ] && arguments[ 1 ].constructor == Function ) 25 _handler = arguments[ 1 ]; 26 else 27 _handler = _xlink.manipulator; 28 29 _wait( ); 30 31 return XForm( arguments[ 0 ], _handler ); 32 } 16 33 17 34 function _go( ) … … 73 90 } 74 91 92 function _wait( ) 93 { 94 if ( _divAppboxHeader ) 95 _divAppboxHeader.innerHTML = ''; 96 97 if ( _divAppbox ) 98 { 99 var _center = document.createElement( 'center' ); 100 _center.appendChild( _loading ); 101 102 _divAppbox.innerHTML = ''; 103 _divAppbox.appendChild( _center ); 104 } 105 } 106 75 107 function _ExpressoLivre( ) 76 108 { 77 109 return ( new function( ) 78 110 { 111 this.form = _form; 79 112 this.go = _go; 80 113 this.lang = _lang; … … 91 124 _xlink = new XLink( _path( ) ); 92 125 _xlink.handler( { 93 "before" : function( ) 94 { 95 if ( _divAppboxHeader ) 96 _divAppboxHeader.innerHTML = ''; 126 "before" : _wait, 127 "after" : function( ) 128 { 129 if ( _divAppbox ) 130 _divAppbox.innerHTML = ''; 97 131 98 if ( _divAppbox ) 99 { 100 var _center = document.createElement( 'center' ); 101 _center.appendChild( _loading ); 102 103 _divAppbox.innerHTML = ''; 104 _divAppbox.appendChild( _center ); 105 } 106 }, 107 "after" : function( ) 108 { 109 if ( _divAppbox ) 110 _divAppbox.innerHTML = ''; 111 112 while ( arguments[ 0 ].hasChildNodes( ) ) 113 _divAppbox.appendChild( arguments[ 0 ].firstChild ); 114 } 132 while ( arguments[ 0 ].hasChildNodes( ) ) 133 _divAppbox.appendChild( arguments[ 0 ].firstChild ); 134 } 115 135 } ); 116 136 … … 129 149 _divAppbox = document.getElementById( 'divAppbox' ); 130 150 _divAppbox.innerHTML = ''; 151 152 document.title = 'ExpressoLivre'; 131 153 132 154 document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll'; -
trunk/phpgwapi/js/tools/xlink.js
r2756 r2802 3 3 var _connector = new XConnector; 4 4 var _script = new XScript; 5 var _location = window.location; 5 6 6 7 function Link( ) 7 8 { 8 9 var _path = ( arguments.length && arguments[ 0 ].constructor == String ) ? arguments[ 0 ] : '/'; 10 9 11 var _last_request = null; 10 11 12 var _before = null; 12 13 var _after = null; 13 14 14 if ( window.location.protocol + '//' + window.location.host + window.location.pathname != _path )15 if ( _location.protocol + '//' + _location.host + _location.pathname != _path ) 15 16 window.location.href = _path + ( 16 ( window.location.hash ) ?17 window.location.hash : '#' + String( window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search ).substr( _path.length )17 ( _location.hash ) ? 18 _location.hash : '#' + String( _location.protocol + '//' + _location.host + _location.pathname + _location.search ).substr( _path.length ) 18 19 ); 19 20 20 21 function _click( _action, _cache ) 21 22 { 22 if ( _action.indexOf( window.location.host ) < 0 )23 _action = window.location.protocol + '//' + window.location.host + _action;23 if ( _action.indexOf( _location.host ) < 0 ) 24 _action = _location.protocol + '//' + _location.host + _action; 24 25 25 26 var _post = ( arguments.length == 3 && arguments[ 2 ] && arguments[ 2 ].constructor == String ) ? arguments[ 2 ] : null; … … 35 36 'access' : _action, 36 37 'cache' : _cache, 37 'handler' : _ handler,38 'handler' : _manipulator, 38 39 'post' : _post 39 40 } ); … … 69 70 } 70 71 71 function _ handler(data )72 function _manipulator( _data ) 72 73 { 73 data = data.trim( ); 74 data = data.replace( /\n/g, '__LINE_FEED_CHARACTER__' ); 75 data = data.replace( /\r|\t/g, '' ); 76 var _js = data.match( /<script[^>]*>.*?<\/script>/gi ); 74 if ( ! ( _data.constructor == String ) ) 75 return false; 76 77 var _line_feed = '__LINE_FEED_CHARACTER_' + ( Date.parse( new Date ) ) + '__'; 78 79 _data = _data.trim( ).replace( /[\r\t]/g, '' ).replace( /\n/g, _line_feed ); 80 81 _line_feed = new RegExp( _line_feed, 'g' ); 82 83 var _js = _data.match( new RegExp( '<script[^>]*>.*?<\/script>', 'gi' ) ); 84 77 85 if ( _js ) 78 86 { 79 87 var _tag = /<script([^>]+src=["'](\S+)["'])?[^>]*>(.*?)<\/script>/i; 88 80 89 for ( var i = 0; i < _js.length; i++ ) 81 90 { 82 data =data.replace( _js[ i ], '' );91 _data = _data.replace( _js[ i ], '' ); 83 92 84 93 _js[ i ] = _tag.exec( _js[ i ] ); 85 94 86 if ( _js[ i ][ 2 ] == undefined || _js[ i ][ 2 ].length == 0 ) 87 _script.inline( _js[ i ][ 3 ].replace( /__LINE_FEED_CHARACTER__/g, '\n' ) ); 95 var _external = _js[ i ][ 2 ]; 96 97 if ( _external == undefined || _external.length == 0 ) 98 _script.inline( _js[ i ][ 3 ].replace( _line_feed, '\n' ) ); 88 99 else 89 100 { 90 var _external = _js[ i ][ 2 ];91 92 101 if ( _external.indexOf( window.location.host ) < 0 ) 93 102 _external = window.location.protocol + '//' + window.location.host + _external; … … 105 114 } 106 115 } 107 data = data.replace( /__LINE_FEED_CHARACTER__|[\r\t]/g, '' );108 116 109 117 var el = document.createElement( 'div' ); 110 el.innerHTML = data;118 el.innerHTML = _data.replace( _line_feed, '' ); 111 119 112 120 var _links = el.getElementsByTagName( 'a' ); … … 120 128 } 121 129 122 function _ manipulator( )130 function _handler( ) 123 131 { 124 132 if ( arguments.length != 1 ) … … 156 164 157 165 this.intercept = _intercept; 158 this.handler = _manipulator; 166 this.handler = _handler; 167 this.manipulator = _manipulator; 159 168 } 160 169
Note: See TracChangeset
for help on using the changeset viewer.