source: trunk/phpgwapi/js/expressolivre/expressolivre.js @ 2704

Revision 2704, 1.5 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Adicionando scripts referente ao pacote ExpressoLivre?.

Line 
1( function( )
2{
3        var _configuration = ExpressoLivre( ).JSON( );
4
5        var _xconnector = null;
6        var _xlink = null;
7
8        function _go( )
9        {
10                _xconnector.go.apply( _xconnector, arguments );
11        }
12
13        function _link( )
14        {
15                _xlink.click.apply( _xlink, arguments );
16        }
17
18        function _path( )
19        {
20                return window.location.protocol + "//" + window.location.host + _configuration.url;
21        }
22
23        function _template( )
24        {
25                return _configuration.template;
26        }
27
28        function _theme( )
29        {
30                return _configuration.theme;
31        }
32
33        function _ExpressoLivre( )
34        {
35                return ( new function( )
36                {
37                        this.go = _go;
38                        this.link = _link;
39                        this.path = _path;
40                        this.theme = _theme;
41                        this.template = _template;
42                } );
43        }
44
45        window.ExpressoLivre = _ExpressoLivre( );
46
47        _xlink = new XLink( ExpressoLivre.path( ) );
48
49        _xconnector = new XConnector( {
50                "path" : ExpressoLivre.path( )
51        } );
52
53        XEvents.add( window, 'onload', function( )
54        {
55                document.getElementsByTagName( 'body' ).item( 0 ).style.overflowY = 'scroll';
56
57                var _scripts = document.getElementsByTagName( 'head' ).item( 0 ).getElementsByTagName( 'script' );
58                var _loaded = [ ];
59
60                for ( var i = 0; i < _scripts.length; i++ )
61                        if ( _scripts.item( i ).getAttribute( 'src' ) != null )
62                                _loaded[ _loaded.length ] = _scripts.item( i ).getAttribute( 'src' ).substr(
63                                        _path.length - 1,
64                                        _scripts.item( i ).getAttribute( 'src' ).indexOf( '?' ) - _path.length + 1
65                                );
66
67                new XScript( _loaded );
68
69                var _links = document.getElementsByTagName( 'a' );
70                for ( var i = 0; i < _links.length; i++ )
71                        _xlink.intercept( _links.item( i ) );
72        } );
73} )( );
Note: See TracBrowser for help on using the repository browser.