[1530] | 1 | (function() |
---|
| 2 | { |
---|
| 3 | var Xtools = null; |
---|
| 4 | var dragDrop = null; |
---|
| 5 | var path = path_jabberit; |
---|
| 6 | |
---|
| 7 | function build(pObj) |
---|
| 8 | { |
---|
[2226] | 9 | var _window = getElement( pObj.id_window + '__parent'); |
---|
[1530] | 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 ); |
---|
[2226] | 16 | pObj.onclick = "winBuild('" + pObj.id_window + "', '" + pObj.closeAction + "')"; |
---|
[1530] | 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 ); |
---|
[1579] | 28 | |
---|
[2226] | 29 | if( pObj.closeAction == "hidden" ) |
---|
| 30 | _window.setAttribute("leftOld", pObj.left + "px" ); |
---|
| 31 | |
---|
[1579] | 32 | window.document.body.insertBefore( _window, document.body.lastChild ); |
---|
[1530] | 33 | |
---|
[2226] | 34 | getElement(pObj.id_window + '__content').innerHTML = pObj.content; |
---|
| 35 | |
---|
[1530] | 36 | if( pObj.draggable ) |
---|
| 37 | { |
---|
| 38 | dragDrop = new dragdrop(); |
---|
| 39 | dragDrop.set( pObj.id_window ); |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | else |
---|
[2226] | 43 | { |
---|
| 44 | load(pObj.id_window, "display"); |
---|
| 45 | } |
---|
[1530] | 46 | } |
---|
| 47 | |
---|
[2226] | 48 | function getElement(pElement) |
---|
[1530] | 49 | { |
---|
[2226] | 50 | return document.getElementById(pElement); |
---|
[1530] | 51 | } |
---|
| 52 | |
---|
[2226] | 53 | function load( pId, pVisible ) |
---|
[1530] | 54 | { |
---|
[2226] | 55 | var winM = document.getElementById( pId + '__parent') |
---|
[1530] | 56 | |
---|
| 57 | if( winM != null ) |
---|
| 58 | { |
---|
| 59 | if ( pVisible == "display" ) |
---|
[2226] | 60 | { |
---|
| 61 | if(winM.getAttribute("leftOld") != "-1500px") |
---|
| 62 | winM.style.left = winM.getAttribute("leftOld"); |
---|
| 63 | else |
---|
| 64 | winM.style.left = "70px"; |
---|
| 65 | } |
---|
[1530] | 66 | |
---|
| 67 | if ( pVisible == "hidden") |
---|
[2226] | 68 | { |
---|
| 69 | winM.setAttribute("leftOld" , winM.style.left ); |
---|
[1530] | 70 | winM.style.left = "-1500px"; |
---|
[2226] | 71 | } |
---|
[1530] | 72 | |
---|
| 73 | if( pVisible == "remove" ) |
---|
[2226] | 74 | { |
---|
[1530] | 75 | document.body.removeChild( winM ); |
---|
[2226] | 76 | } |
---|
[1530] | 77 | } |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | function _window() |
---|
| 81 | { |
---|
[2226] | 82 | if( arguments.length > 0 ) |
---|
[1530] | 83 | { |
---|
[2226] | 84 | if( arguments.length == 1 ) |
---|
| 85 | { |
---|
| 86 | JSLoader.load([path + "js/dragdrop.js"]); |
---|
| 87 | JSLoader.load([path + "templates/default/css/button.css"]) |
---|
[1530] | 88 | |
---|
[2226] | 89 | var obj = arguments[0]; |
---|
| 90 | |
---|
| 91 | setTimeout(function(){ build(obj);}, 200); |
---|
| 92 | } |
---|
[1530] | 93 | |
---|
[2226] | 94 | if( arguments.length == 2 ) |
---|
| 95 | { |
---|
| 96 | load(arguments[0], arguments[1]); |
---|
| 97 | } |
---|
| 98 | } |
---|
[1530] | 99 | } |
---|
| 100 | |
---|
| 101 | window.bWindow = _window; |
---|
| 102 | |
---|
| 103 | })(); |
---|
| 104 | |
---|
| 105 | function winBuild() |
---|
| 106 | { |
---|
[2226] | 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 | } |
---|
[1530] | 115 | } |
---|