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

Revision 1567, 2.4 KB checked in by alexandrecorreia, 15 years ago (diff)

Ticket #370 - Melhoria do layout das janelas, para criação de preferencia(on/offline).

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