1(function(window){ 2BX.DD = function(params) 3{ 4 return new BX.DD.dragdrop(params); 5} 6 7BX.DD.allowSelection = function() 8{ 9 document.onmousedown = null; 10 var b = document.body; 11 b.ondrag = null; 12 b.onselectstart = null; 13 b.style.MozUserSelect = ''; 14 15 // if (jsDD.current_node) 16 // { 17 // jsDD.current_node.ondrag = null; 18 // jsDD.current_node.onselectstart = null; 19 // jsDD.current_node.style.MozUserSelect = ''; 20 // } 21} 22 23BX.DD.denySelection = function() 24{ 25 document.onmousedown = BX.False; 26 var b = document.body; 27 b.ondrag = BX.False; 28 b.onselectstart = BX.False; 29 b.style.MozUserSelect = 'none'; 30 // if (jsDD.current_node) 31 // { 32 // jsDD.current_node.ondrag = jsUtils.False; 33 // jsDD.current_node.onselectstart = jsUtils.False; 34 // jsDD.current_node.style.MozUserSelect = 'none'; 35 // } 36} 37 38BX.DD.dragdrop = function(params) 39{ 40 41 42} 43 44/* 45 * BX.DD.dropFiles - for html5 drag and drop files 46 * 47 * example: 48 * 49 * BX(function() { 50 * var dropBoxNode = BX('WebDAV23'); 51 * var dropbox = new BX.DD.dropFiles(dropBoxNode); 52 * if (dropbox && dropbox.supported()) 53 * { 54 * BX.addCustomEvent(dropbox, 'dropFiles', function(files) { WDUploadDroppedFiles(files);}); 55 * BX.addCustomEvent(dropbox, 'dragEnter', function() {BX.addClass( dropBoxNode, 'droptarget');}); 56 * BX.addCustomEvent(dropbox, 'dragLeave', function() {BX.removeClass( dropBoxNode, 'droptarget');}); 57 * } 58 * }); 59 * 60 * to save files use BX.ajax.FormData 61 */ 62BX.DD.dropFiles = function(div) 63{ 64 if (BX.type.isElementNode(div) 65 && this.supported()) 66 { 67 div.setAttribute('dropzone', 'copy f:*/*'); 68 this.DIV = div; 69 this._timer = null; 70 this._initEvents(); 71 72 this._cancelLeave = function() 73 { 74 if (this._timer != null) 75 { 76 clearTimeout(this._timer); 77 this._timer = null; 78 } 79 } 80 this._prepareLeave = function() 81 { 82 this._cancelLeave(); 83 this._timer = setTimeout( BX.delegate(function() { 84 BX.onCustomEvent(this, 'dragLeave') 85 }, this), 100); 86 } 87 88 return this; 89 } 90 return false; 91} 92 93BX.DD.dropFiles.prototype._initEvents = function() 94{ 95 BX.bind(this.DIV, 'dragover', BX.proxy(this._dragOver, this)); 96 BX.bind(this.DIV, 'dragenter', BX.proxy(this._dragEnter, this)); 97 BX.bind(this.DIV, 'dragleave', BX.proxy(this._dragLeave, this)); 98 BX.bind(this.DIV, 'dragexit', BX.proxy(this._dragExit, this)); 99 BX.bind(this.DIV, 'drop', BX.proxy(this._drop, this)); 100} 101 102BX.DD.dropFiles.prototype._dragEnter = function(e) 103{ 104 BX.PreventDefault(e); 105 this._cancelLeave(); 106 BX.onCustomEvent(this, 'dragEnter', [e]); 107 return true; 108} 109 110BX.DD.dropFiles.prototype._dragExit = function(e) 111{ 112 BX.PreventDefault(e); 113 this._prepareLeave(); 114 return false; 115} 116 117 118BX.DD.dropFiles.prototype._dragLeave = function(e) 119{ 120 BX.PreventDefault(e); 121 this._prepareLeave(); 122 return false; 123} 124 125BX.DD.dropFiles.prototype._dragOver = function(e) 126{ 127 BX.PreventDefault(e); 128 this._cancelLeave(); 129 return true; 130} 131 132BX.DD.dropFiles.prototype._drop = function(e) 133{ 134 BX.PreventDefault(e); 135 var dt = e.dataTransfer; 136 var files = dt.files; 137 BX.onCustomEvent(this, 'dropFiles', [files, e]); 138 BX.onCustomEvent(this, 'dragLeave') 139 return false; 140} 141 142BX.DD.dropFiles.prototype.isEventSupported = function(event) 143{ 144 var div = BX.create('DIV'); 145 var eventName = 'on'+event; 146 var result = (eventName in div); 147 148 if (!result && div.setAttribute && div.removeAttribute) 149 { 150 div.setAttribute(eventName, ''); 151 result = (typeof div[eventName] === 'function'); 152 } 153 154 div = null; 155 return result; 156} 157 158BX.DD.dropFiles.prototype.supported = function() 159{ 160 return ( (!!window.FileReader) && this.isEventSupported('dragstart') && this.isEventSupported('drop') ); 161} 162 163})(window) 164
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.