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