/usr/share/javascript/yui3/dd-ddm/dd-ddm.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('dd-ddm', function(Y) {
/**
* Extends the dd-ddm-base Class to add support for the viewport shim to allow a draggable node to drag to be dragged over an iframe or any other node that traps mousemove events.
* It is also required to have Drop Targets enabled, as the viewport shim will contain the shims for the Drop Targets.
* @module dd
* @submodule dd-ddm
* @for DDM
* @namespace DD
*/
Y.mix(Y.DD.DDM, {
/**
* @private
* @property _pg
* @description The shim placed over the screen to track the mousemove event.
* @type {Node}
*/
_pg: null,
/**
* @private
* @property _debugShim
* @description Set this to true to set the shims opacity to .5 for debugging it, default: false.
* @type {Boolean}
*/
_debugShim: false,
_activateTargets: function() { },
_deactivateTargets: function() {},
_startDrag: function() {
if (this.activeDrag && this.activeDrag.get('useShim')) {
this._pg_activate();
this._activateTargets();
}
},
_endDrag: function() {
this._pg_deactivate();
this._deactivateTargets();
},
/**
* @private
* @method _pg_deactivate
* @description Deactivates the shim
*/
_pg_deactivate: function() {
this._pg.setStyle('display', 'none');
},
/**
* @private
* @method _pg_activate
* @description Activates the shim
*/
_pg_activate: function() {
if (!this._pg) {
this._createPG();
}
var ah = this.activeDrag.get('activeHandle'), cur = 'auto';
if (ah) {
cur = ah.getStyle('cursor');
}
if (cur == 'auto') {
cur = this.get('dragCursor');
}
this._pg_size();
this._pg.setStyles({
top: 0,
left: 0,
display: 'block',
opacity: ((this._debugShim) ? '.5' : '0'),
cursor: cur
});
},
/**
* @private
* @method _pg_size
* @description Sizes the shim on: activatation, window:scroll, window:resize
*/
_pg_size: function() {
if (this.activeDrag) {
var b = Y.one('body'),
h = b.get('docHeight'),
w = b.get('docWidth');
this._pg.setStyles({
height: h + 'px',
width: w + 'px'
});
}
},
/**
* @private
* @method _createPG
* @description Creates the shim and adds it's listeners to it.
*/
_createPG: function() {
var pg = Y.Node.create('<div></div>'),
bd = Y.one('body'), win;
pg.setStyles({
top: '0',
left: '0',
position: 'absolute',
zIndex: '9999',
overflow: 'hidden',
backgroundColor: 'red',
display: 'none',
height: '5px',
width: '5px'
});
pg.set('id', Y.stamp(pg));
pg.addClass(Y.DD.DDM.CSS_PREFIX + '-shim');
bd.prepend(pg);
this._pg = pg;
this._pg.on('mousemove', Y.throttle(Y.bind(this._move, this), this.get('throttleTime')));
this._pg.on('mouseup', Y.bind(this._end, this));
win = Y.one('win');
Y.on('window:resize', Y.bind(this._pg_size, this));
win.on('scroll', Y.bind(this._pg_size, this));
}
}, true);
}, '3.5.1' ,{skinnable:false, requires:['dd-ddm-base', 'event-resize']});
|