source: trunk/jabberit_messenger/js/makeW.js @ 2226

Revision 2226, 2.5 KB checked in by alexandrecorreia, 14 years ago (diff)

Ticket #941 - Correcao dos templates na parte de configuracao para o navegador IE8.

  • Property svn:executable set to *
  • Property svn:mime-type set to text/plain
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 JITXtools(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                        window.document.body.insertBefore( _window, document.body.lastChild );
33                       
34                        getElement(pObj.id_window + '__content').innerHTML = pObj.content;
35                       
36                        if( pObj.draggable )
37                        {
38                                dragDrop = new dragdrop();
39                                dragDrop.set( pObj.id_window );
40                        }
41                }
42                else
43                {
44                        load(pObj.id_window, "display");
45                }
46        }
47
48        function getElement(pElement)
49        {
50                return document.getElementById(pElement);
51        }
52       
53        function load( pId, pVisible )
54        {
55                var winM = document.getElementById( pId + '__parent')
56               
57                if( winM != null )
58                {
59                        if ( pVisible == "display" )
60                        {
61                                if(winM.getAttribute("leftOld") != "-1500px")
62                                        winM.style.left = winM.getAttribute("leftOld");
63                                else
64                                        winM.style.left = "70px";
65                        }       
66                       
67                        if ( pVisible == "hidden")
68                        {
69                                winM.setAttribute("leftOld" , winM.style.left );
70                                winM.style.left = "-1500px";
71                        }
72                       
73                        if( pVisible == "remove" )
74                        {
75                                document.body.removeChild( winM );
76                        }
77                }
78        }
79       
80        function _window()
81        {
82                if( arguments.length > 0 )
83                {
84                        if( arguments.length == 1 )
85                        {
86                                JSLoader.load([path + "js/dragdrop.js"]);
87                                JSLoader.load([path + "templates/default/css/button.css"])
88
89                                var obj = arguments[0];
90       
91                                setTimeout(function(){ build(obj);}, 200);
92                        }
93
94                        if( arguments.length == 2 )
95                        {
96                                load(arguments[0], arguments[1]);
97                        }       
98                }       
99        }
100
101        window.bWindow  = _window;
102
103})();
104
105function winBuild()
106{
107        if( arguments.length > 0 )
108        {       
109                if( arguments.length == 1 )
110                        _win = new bWindow( arguments[0] );
111               
112                if( arguments.length == 2 )
113                        _win = new bWindow( arguments[0], arguments[1] );
114        }
115}
Note: See TracBrowser for help on using the repository browser.