source: sandbox/jabberit_messenger/trophy_expresso/js/makeW.js @ 2750

Revision 2750, 2.4 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #986 - Correcao para o auto carregamento da janela quando a preferencia esta marcada.

  • Property svn:executable set to *
Line 
1(function()
2{
3        var _xtools             = null;
4        var dragDrop    = null;
5        var path                = path_jabberit;
6       
7        function build(pObj)
8        {
9                var _window = getElement( pObj.id_window + '__parent');
10                _xtools = new xtools(path);             
11               
12                if( _window == null )
13                {
14                        pObj.width              = ( ( pObj.width > 160 ) ? pObj.width : 160 );
15                        pObj.height             = ( ( pObj.height > 80 ) ? pObj.height : 80 );
16                        pObj.onclick    = "_winBuild('" + pObj.id_window + "', '" + pObj.closeAction + "')";
17                       
18                        _window = document.createElement("div");
19                        _window.id      = pObj.id_window + "__parent";
20                        _window.setAttribute("onselectstart" , "return false");
21                        _window.style.width             = pObj.width + "px";
22                        _window.style.height    = pObj.height + "px";
23                        _window.style.top               = pObj.top + "px";
24                        _window.style.left              = pObj.left + "px";
25                        _window.style.position  = "absolute";
26                        _window.style.zIndex    = pObj.zindex;
27                        _window.innerHTML               = _xtools.parse( _xtools.xml('window_main'), 'window.xsl', pObj );
28
29                        if( pObj.closeAction == "hidden" )
30                                _window.setAttribute("leftOld", pObj.left + "px" );
31                       
32                        if( pObj.leftOld )
33                                _window.setAttribute("leftOld", pObj.leftOld + "px" );
34                       
35                        window.document.body.insertBefore( _window, document.body.lastChild );
36                       
37                        getElement(pObj.id_window + '__content').innerHTML = pObj.content;
38                       
39                        if( pObj.draggable )
40                        {
41                                dragDrop = new _drag_drop();
42                                dragDrop.set( pObj.id_window );
43                        }
44                }
45                else
46                {
47                        load(pObj.id_window, "display");
48                }
49        }
50
51        function getElement(pElement)
52        {
53                return document.getElementById(pElement);
54        }
55       
56        function load( pId, pVisible )
57        {
58                var _window = document.getElementById( pId + '__parent')
59               
60                if( _window != null )
61                {
62                        if ( pVisible == "display" )
63                        {
64                                if( _window.style.left == "-1500px" )
65                                        _window.style.left = _window.getAttribute("leftOld");
66                        }
67                       
68                        if ( pVisible == "hidden")
69                        {
70                                _window.setAttribute("leftOld" , _window.style.left );
71                                _window.style.left = "-1500px";
72                        }
73                       
74                        if( pVisible == "remove" )
75                        {
76                                document.body.removeChild( _window );
77                        }
78                }
79        }
80       
81        function _window()
82        {
83                if( arguments.length > 0 )
84                {
85                        if( arguments.length == 1 )
86                        {
87                                var obj = arguments[0];
88                                build(obj);
89                        }
90                       
91                        if( arguments.length == 2 )
92                        {
93                                load(arguments[0], arguments[1]);
94                        }       
95                }
96        }
97
98        window.bWindow  = _window;
99
100})();
101
102function _winBuild()
103{
104        if( arguments.length > 0 )
105        {       
106                if( arguments.length == 1 )
107                        _win = new bWindow( arguments[0] );
108               
109                if( arguments.length == 2 )
110                        _win = new bWindow( arguments[0], arguments[1]);       
111        }
112}
Note: See TracBrowser for help on using the repository browser.