removing old version of yui
This commit is contained in:
parent
d1d368dcd1
commit
4fd23d094f
766 changed files with 0 additions and 262230 deletions
102
www/extras/yui/examples/dragdrop/js/DDList.js
vendored
102
www/extras/yui/examples/dragdrop/js/DDList.js
vendored
|
|
@ -1,102 +0,0 @@
|
|||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a YAHOO.util.DDProxy implementation. During the drag over event, the
|
||||
* dragged element is inserted before the dragged-over element.
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
YAHOO.example.DDList = function(id, sGroup, config) {
|
||||
|
||||
if (id) {
|
||||
this.init(id, sGroup, config);
|
||||
this.initFrame();
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
|
||||
var s = this.getDragEl().style;
|
||||
s.borderColor = "transparent";
|
||||
s.backgroundColor = "#f6f5e5";
|
||||
s.opacity = 0.76;
|
||||
s.filter = "alpha(opacity=76)";
|
||||
};
|
||||
|
||||
// YAHOO.example.DDList.prototype = new YAHOO.util.DDProxy();
|
||||
YAHOO.extend(YAHOO.example.DDList, YAHOO.util.DDProxy);
|
||||
|
||||
YAHOO.example.DDList.prototype.startDrag = function(x, y) {
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
dragEl.className = clickEl.className;
|
||||
dragEl.style.color = clickEl.style.color;
|
||||
dragEl.style.border = "1px solid blue";
|
||||
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.endDrag = function(e) {
|
||||
// disable moving the linked element
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.onDrag = function(e, id) {
|
||||
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.onDragOver = function(e, id) {
|
||||
// this.logger.log(this.id.toString() + " onDragOver " + id);
|
||||
var el;
|
||||
|
||||
if ("string" == typeof id) {
|
||||
el = YAHOO.util.DDM.getElement(id);
|
||||
} else {
|
||||
el = YAHOO.util.DDM.getBestMatch(id).getEl();
|
||||
}
|
||||
|
||||
var mid = YAHOO.util.DDM.getPosY(el) + ( Math.floor(el.offsetTop / 2));
|
||||
this.logger.log("mid: " + mid);
|
||||
|
||||
if (YAHOO.util.Event.getPageY(e) < mid) {
|
||||
var el2 = this.getEl();
|
||||
var p = el.parentNode;
|
||||
p.insertBefore(el2, el);
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.onDragEnter = function(e, id) {
|
||||
// this.logger.log(this.id.toString() + " onDragEnter " + id);
|
||||
// this.getDragEl().style.border = "1px solid #449629";
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.onDragOut = function(e, id) {
|
||||
// I need to know when we are over nothing
|
||||
// this.getDragEl().style.border = "1px solid #964428";
|
||||
};
|
||||
|
||||
YAHOO.example.DDList.prototype.toString = function() {
|
||||
return "DDList " + this.id;
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
YAHOO.example.DDListBoundary = function(id, sGroup, config) {
|
||||
if (id) {
|
||||
this.init(id, sGroup, config);
|
||||
this.logger = this.logger || YAHOO;
|
||||
this.isBoundary = true;
|
||||
}
|
||||
};
|
||||
|
||||
// YAHOO.example.DDListBoundary.prototype = new YAHOO.util.DDTarget();
|
||||
YAHOO.extend(YAHOO.example.DDListBoundary, YAHOO.util.DDTarget);
|
||||
|
||||
YAHOO.example.DDListBoundary.prototype.toString = function() {
|
||||
return "DDListBoundary " + this.id;
|
||||
};
|
||||
|
||||
48
www/extras/yui/examples/dragdrop/js/DDMy.js
vendored
48
www/extras/yui/examples/dragdrop/js/DDMy.js
vendored
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a ygDDFramed implementation where the frame only moves vertically, and
|
||||
* the DOM elements are swapped when one is dropped on another
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
YAHOO.example.DDMy = function(id, sGroup, config) {
|
||||
|
||||
if (id) {
|
||||
this.init(id, sGroup, config);
|
||||
this.initFrame();
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
|
||||
// The frame should only move vertically... this makes it so the user can
|
||||
// only move content channels up and down within a column
|
||||
this.setXConstraint(0, 0);
|
||||
};
|
||||
|
||||
// YAHOO.example.DDMy.prototype = new YAHOO.util.DDProxy();
|
||||
YAHOO.extend(YAHOO.example.DDMy, YAHOO.util.DDProxy);
|
||||
|
||||
YAHOO.example.DDMy.prototype.onDragDrop = function(e, id) {
|
||||
this.logger.log(this.id + " onDragDrop");
|
||||
|
||||
var el;
|
||||
|
||||
if ("string" == typeof id) {
|
||||
el = YAHOO.util.DDM.getElement(id);
|
||||
} else {
|
||||
el = YAHOO.util.DDM.getBestMatch(id).getEl();
|
||||
}
|
||||
|
||||
YAHOO.util.DDM.swapNode(this.getEl(), el);
|
||||
};
|
||||
|
||||
YAHOO.example.DDMy.prototype.endDrag = function(e) {
|
||||
// we default behavior is to move the element to the end point when
|
||||
// the drag is ended. In our case, we only want to move the element
|
||||
// when it is dropped on another dd element. To override the default,
|
||||
// we simply need to create an empty endDrag function.
|
||||
};
|
||||
62
www/extras/yui/examples/dragdrop/js/DDMy2.js
vendored
62
www/extras/yui/examples/dragdrop/js/DDMy2.js
vendored
|
|
@ -1,62 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a YAHHO.util.DDProxy implementation like DDMy, but the content
|
||||
* channels are * not restricted to one column, and we drag a miniature
|
||||
* representation of the * content channel rather than a frame of the channel.
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
YAHOO.example.DDMy2 = function(id, sGroup, config) {
|
||||
|
||||
if (id) {
|
||||
this.init(id, sGroup, config);
|
||||
this.initFrame();
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
|
||||
// Change the style of the frame to be a miniature representation of a
|
||||
// content channel
|
||||
var s = this.getDragEl().style;
|
||||
s.background = "url(img/channel.png) 0 0 no-repeat";
|
||||
s.height = "92px";
|
||||
s.width = "100px";
|
||||
// s.opacity = 0.66;
|
||||
// s.filter = "alpha(opacity=66)";
|
||||
|
||||
// Specify that we do not want to resize the drag frame... we want to keep
|
||||
// the drag frame the size of our miniature content channel image
|
||||
//this.resizeFrame = false;
|
||||
|
||||
// Specify that we want the drag frame centered around the cursor rather
|
||||
// than relative to the click location so that the miniature content
|
||||
// channel appears in the location that was clicked
|
||||
// this.centerFrame = true;
|
||||
};
|
||||
|
||||
// YAHOO.example.DDMy2.prototype = new YAHOO.util.DDProxy();
|
||||
YAHOO.extend(YAHOO.example.DDMy2, YAHOO.util.DDProxy);
|
||||
|
||||
YAHOO.example.DDMy2.prototype.onDragDrop = function(e, id) {
|
||||
this.logger.log(this.id + " onDragDrop");
|
||||
|
||||
var el;
|
||||
if ("string" == typeof id) {
|
||||
el = YAHOO.util.DDM.getElement(id);
|
||||
} else {
|
||||
el = YAHOO.util.DDM.getBestMatch(id).getEl();
|
||||
}
|
||||
|
||||
YAHOO.util.DDM.swapNode(this.getEl(), el);
|
||||
};
|
||||
|
||||
YAHOO.example.DDMy2.prototype.endDrag = function(e) {
|
||||
// we default behavior is to move the element to the end point when
|
||||
// the drag is ended. In our case, we only want to move the element
|
||||
// when it is dropped on another dd element. To override the default,
|
||||
// we simply need to create an empty endDrag function.
|
||||
};
|
||||
49
www/extras/yui/examples/dragdrop/js/DDOnTop.js
vendored
49
www/extras/yui/examples/dragdrop/js/DDOnTop.js
vendored
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a DragDrop implementation that moves the object as it is being dragged,
|
||||
* and keeps the object being dragged on top. This is a subclass of DD rather
|
||||
* than DragDrop, and inherits the implementation of most of the event listeners
|
||||
* from that class.
|
||||
*
|
||||
* @extends YAHOO.util.DD
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop items
|
||||
*/
|
||||
YAHOO.example.DDOnTop = function(id, sGroup, config) {
|
||||
if (id) {
|
||||
this.init(id, sGroup, config);
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
};
|
||||
|
||||
// YAHOO.example.DDOnTop.prototype = new YAHOO.util.DD();
|
||||
YAHOO.extend(YAHOO.example.DDOnTop, YAHOO.util.DD);
|
||||
|
||||
/**
|
||||
* The inital z-index of the element, stored so we can restore it later
|
||||
*
|
||||
* @type int
|
||||
*/
|
||||
YAHOO.example.DDOnTop.prototype.origZ = 0;
|
||||
|
||||
YAHOO.example.DDOnTop.prototype.startDrag = function(x, y) {
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
var style = this.getEl().style;
|
||||
|
||||
// store the original z-index
|
||||
this.origZ = style.zIndex;
|
||||
|
||||
// The z-index needs to be set very high so the element will indeed be on top
|
||||
style.zIndex = 999;
|
||||
};
|
||||
|
||||
YAHOO.example.DDOnTop.prototype.endDrag = function(e) {
|
||||
this.logger.log(this.id + " endDrag");
|
||||
|
||||
// restore the original z-index
|
||||
this.getEl().style.zIndex = this.origZ;
|
||||
};
|
||||
169
www/extras/yui/examples/dragdrop/js/DDPlayer.js
vendored
169
www/extras/yui/examples/dragdrop/js/DDPlayer.js
vendored
|
|
@ -1,169 +0,0 @@
|
|||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @class a YAHOO.util.DDFramed implementation. During the drag over event, the
|
||||
* dragged element is inserted before the dragged-over element.
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop objects
|
||||
*/
|
||||
YAHOO.example.DDPlayer = function(id, sGroup, config) {
|
||||
this.initPlayer(id, sGroup);
|
||||
};
|
||||
|
||||
// YAHOO.example.DDPlayer.prototype = new YAHOO.util.DDProxy();
|
||||
YAHOO.extend(YAHOO.example.DDPlayer, YAHOO.util.DDProxy);
|
||||
|
||||
YAHOO.example.DDPlayer.TYPE = "DDPlayer";
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.initPlayer = function(id, sGroup, config) {
|
||||
if (!id) { return; }
|
||||
|
||||
this.init(id, sGroup, config);
|
||||
this.initFrame();
|
||||
|
||||
this.logger = this.logger || YAHOO;
|
||||
var s = this.getDragEl().style;
|
||||
s.borderColor = "transparent";
|
||||
// s.backgroundColor = "#cccccc";
|
||||
s.opacity = 0.76;
|
||||
s.filter = "alpha(opacity=76)";
|
||||
|
||||
// specify that this is not currently a drop target
|
||||
this.isTarget = false;
|
||||
|
||||
this.originalStyles = [];
|
||||
|
||||
this.type = YAHOO.example.DDPlayer.TYPE;
|
||||
this.slot = null;
|
||||
|
||||
this.startPos = YAHOO.util.Dom.getXY( this.getEl() );
|
||||
this.logger.log(id + " startpos: " + this.startPos);
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.startDrag = function(x, y) {
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
dragEl.className = clickEl.className;
|
||||
dragEl.style.color = this.DDM.getStyle(clickEl, "color");;
|
||||
dragEl.style.backgroundColor = this.DDM.getStyle(clickEl, "backgroundColor");
|
||||
|
||||
var s = clickEl.style;
|
||||
s.opacity = .1;
|
||||
s.filter = "alpha(opacity=10)";
|
||||
|
||||
var targets = YAHOO.util.DDM.getRelated(this, true);
|
||||
this.logger.log(targets.length + " targets");
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
|
||||
var targetEl = this.getTargetDomRef(targets[i]);
|
||||
|
||||
if (!this.originalStyles[targetEl.id]) {
|
||||
this.originalStyles[targetEl.id] = targetEl.className;
|
||||
}
|
||||
|
||||
targetEl.className = "target";
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.getTargetDomRef = function(oDD) {
|
||||
if (oDD.player) {
|
||||
return oDD.player.getEl();
|
||||
} else {
|
||||
return oDD.getEl();
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.endDrag = function(e) {
|
||||
// reset the linked element styles
|
||||
var s = this.getEl().style;
|
||||
s.opacity = 1;
|
||||
s.filter = "alpha(opacity=100)";
|
||||
|
||||
this.resetTargets();
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.resetTargets = function() {
|
||||
|
||||
// reset the target styles
|
||||
var targets = YAHOO.util.DDM.getRelated(this, true);
|
||||
for (var i=0; i<targets.length; i++) {
|
||||
var targetEl = this.getTargetDomRef(targets[i]);
|
||||
var oldStyle = this.originalStyles[targetEl.id];
|
||||
if (oldStyle) {
|
||||
targetEl.className = oldStyle;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.onDragDrop = function(e, id) {
|
||||
// get the drag and drop object that was targeted
|
||||
var oDD;
|
||||
|
||||
if ("string" == typeof id) {
|
||||
oDD = YAHOO.util.DDM.getDDById(id);
|
||||
} else {
|
||||
oDD = YAHOO.util.DDM.getBestMatch(id);
|
||||
}
|
||||
|
||||
var el = this.getEl();
|
||||
|
||||
// check if the slot has a player in it already
|
||||
if (oDD.player) {
|
||||
// check if the dragged player was already in a slot
|
||||
if (this.slot) {
|
||||
// check to see if the player that is already in the
|
||||
// slot can go to the slot the dragged player is in
|
||||
// YAHOO.util.DDM.isLegalTarget is a new method
|
||||
if ( YAHOO.util.DDM.isLegalTarget(oDD.player, this.slot) ) {
|
||||
this.logger.log("swapping player positions");
|
||||
YAHOO.util.DDM.moveToEl(oDD.player.getEl(), el);
|
||||
this.slot.player = oDD.player;
|
||||
oDD.player.slot = this.slot;
|
||||
} else {
|
||||
this.logger.log("moving player in slot back to start");
|
||||
YAHOO.util.Dom.setXY(oDD.player.getEl(), oDD.player.startPos);
|
||||
this.slot.player = null;
|
||||
oDD.player.slot = null
|
||||
}
|
||||
} else {
|
||||
// the player in the slot will be moved to the dragged
|
||||
// players start position
|
||||
oDD.player.slot = null;
|
||||
YAHOO.util.DDM.moveToEl(oDD.player.getEl(), el);
|
||||
}
|
||||
} else {
|
||||
// Move the player into the emply slot
|
||||
// I may be moving off a slot so I need to clear the player ref
|
||||
if (this.slot) {
|
||||
this.slot.player = null;
|
||||
}
|
||||
}
|
||||
|
||||
YAHOO.util.DDM.moveToEl(el, oDD.getEl());
|
||||
this.resetTargets();
|
||||
|
||||
this.slot = oDD;
|
||||
this.slot.player = this;
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.swap = function(el1, el2) {
|
||||
var dom = YAHOO.util.Dom;
|
||||
var pos1 = dom.getXY(el1);
|
||||
var pos2 = dom.getXY(el2);
|
||||
dom.setXY(el1, pos2);
|
||||
dom.setXY(el2, pos1);
|
||||
};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.onDragOver = function(e, id) {};
|
||||
|
||||
YAHOO.example.DDPlayer.prototype.onDrag = function(e, id) {};
|
||||
|
||||
46
www/extras/yui/examples/dragdrop/js/DDResize.js
vendored
46
www/extras/yui/examples/dragdrop/js/DDResize.js
vendored
|
|
@ -1,46 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @extends YAHOO.util.DragDrop
|
||||
* @constructor
|
||||
* @param {String} handle the id of the element that will cause the resize
|
||||
* @param {String} panel id of the element to resize
|
||||
* @param {String} sGroup the group of related DragDrop items
|
||||
*/
|
||||
YAHOO.example.DDResize = function(panelElId, handleElId, sGroup, config) {
|
||||
if (panelElId) {
|
||||
this.init(panelElId, sGroup, config);
|
||||
this.handleElId = handleElId;
|
||||
this.setHandleElId(handleElId);
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
};
|
||||
|
||||
// YAHOO.example.DDResize.prototype = new YAHOO.util.DragDrop();
|
||||
YAHOO.extend(YAHOO.example.DDResize, YAHOO.util.DragDrop);
|
||||
|
||||
YAHOO.example.DDResize.prototype.onMouseDown = function(e) {
|
||||
var panel = this.getEl();
|
||||
this.startWidth = panel.offsetWidth;
|
||||
this.startHeight = panel.offsetHeight;
|
||||
|
||||
this.startPos = [YAHOO.util.Event.getPageX(e),
|
||||
YAHOO.util.Event.getPageY(e)];
|
||||
};
|
||||
|
||||
YAHOO.example.DDResize.prototype.onDrag = function(e) {
|
||||
var newPos = [YAHOO.util.Event.getPageX(e),
|
||||
YAHOO.util.Event.getPageY(e)];
|
||||
|
||||
var offsetX = newPos[0] - this.startPos[0];
|
||||
var offsetY = newPos[1] - this.startPos[1];
|
||||
|
||||
var newWidth = Math.max(this.startWidth + offsetX, 10);
|
||||
var newHeight = Math.max(this.startHeight + offsetY, 10);
|
||||
|
||||
var panel = this.getEl();
|
||||
panel.style.width = newWidth + "px";
|
||||
panel.style.height = newHeight + "px";
|
||||
};
|
||||
|
||||
106
www/extras/yui/examples/dragdrop/js/DDResize2.js
vendored
106
www/extras/yui/examples/dragdrop/js/DDResize2.js
vendored
|
|
@ -1,106 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @extends YAHOO.util.DragDrop
|
||||
* @constructor
|
||||
* @param {String} handle the id of the element that will cause the resize
|
||||
* @param {String} panel id of the element to resize
|
||||
* @param {String} sGroup the group of related DragDrop items
|
||||
*/
|
||||
YAHOO.example.DDResize = function(panelElId, nwHandle,
|
||||
neHandle, seHandle, swHandle, sGroup, config) {
|
||||
if (panelElId) {
|
||||
this.init(panelElId, sGroup, config);
|
||||
this.nwHandle = nwHandle;
|
||||
this.neHandle = neHandle;
|
||||
this.seHandle = seHandle;
|
||||
this.swHandle = swHandle;
|
||||
this.setHandleElId(nwHandle);
|
||||
this.setHandleElId(neHandle);
|
||||
this.setHandleElId(seHandle);
|
||||
this.setHandleElId(swHandle);
|
||||
this.logger = this.logger || YAHOO;
|
||||
}
|
||||
};
|
||||
|
||||
// YAHOO.example.DDResize.prototype = new YAHOO.util.DragDrop();
|
||||
YAHOO.extend(YAHOO.example.DDResize, YAHOO.util.DragDrop);
|
||||
|
||||
YAHOO.example.DDResize.prototype.lockAspectRatio = false;
|
||||
|
||||
YAHOO.example.DDResize.prototype.onMouseDown = function(e) {
|
||||
var panel = this.getEl();
|
||||
this.startWidth = panel.offsetWidth;
|
||||
this.startHeight = panel.offsetHeight;
|
||||
this.panelStartPos = YAHOO.util.Dom.getXY(panel);
|
||||
|
||||
this.aspectRatio = this.startWidth/this.startHeight;
|
||||
this.direction = this.getDirection(YAHOO.util.Event.getTarget(e, true).id);
|
||||
this.logger.log("direction " + this.direction);
|
||||
|
||||
this.startPos = [YAHOO.util.Event.getPageX(e),
|
||||
YAHOO.util.Event.getPageY(e)];
|
||||
};
|
||||
|
||||
YAHOO.example.DDResize.prototype.onDrag = function(e) {
|
||||
var newPos = [YAHOO.util.Event.getPageX(e),
|
||||
YAHOO.util.Event.getPageY(e)];
|
||||
|
||||
var offsetX = newPos[0] - this.startPos[0];
|
||||
var offsetY = (this.lockAspectRatio) ? offsetX : newPos[1] - this.startPos[1];
|
||||
|
||||
var newWidth = Math.max(this.startWidth + offsetX, 10);
|
||||
var newHeight = Math.max(this.startHeight + offsetY, 10);
|
||||
|
||||
var panel = this.getEl();
|
||||
|
||||
|
||||
var panelPos = YAHOO.util.Dom.getXY(panel);
|
||||
var movePos = [this.panelStartPos[0], this.panelStartPos[1]];
|
||||
var doMove = false;
|
||||
|
||||
if (this.direction == "nw" || this.direction == "sw") {
|
||||
movePos[0] = this.panelStartPos[0] + offsetX;
|
||||
newWidth = Math.max(this.startWidth - offsetX, 10);
|
||||
doMove = true;
|
||||
}
|
||||
|
||||
if (this.direction == "ne" || this.direction == "nw") {
|
||||
offsetY = newPos[1] - this.startPos[1];
|
||||
offsetX = offsetY;
|
||||
movePos[1] = this.panelStartPos[1] + offsetY;
|
||||
newHeight = Math.max(this.startHeight - offsetY, 10);
|
||||
newWidth = Math.max(this.startWidth - offsetX, 10);
|
||||
doMove = true;
|
||||
}
|
||||
|
||||
|
||||
switch (this.direction) {
|
||||
case "nw":
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (doMove) {
|
||||
YAHOO.util.Dom.setXY(panel, movePos);
|
||||
}
|
||||
|
||||
panel.style.width = newWidth + "px";
|
||||
panel.style.height = newHeight + "px";
|
||||
};
|
||||
|
||||
YAHOO.example.DDResize.prototype.getDirection = function(handle) {
|
||||
if (handle == this.nwHandle) {
|
||||
return "nw";
|
||||
} else if (handle == this.neHandle) {
|
||||
return "ne";
|
||||
} else if (handle == this.seHandle) {
|
||||
return "se";
|
||||
} else if (handle == this.swHandle) {
|
||||
return "sw";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
170
www/extras/yui/examples/dragdrop/js/DDSwap.js
vendored
170
www/extras/yui/examples/dragdrop/js/DDSwap.js
vendored
|
|
@ -1,170 +0,0 @@
|
|||
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a YAHOO.util.DDProxy implementation that swaps positions with the
|
||||
* target when dropped
|
||||
*
|
||||
* @extends YAHOO.util.DDProxy
|
||||
* @constructor
|
||||
* @param {String} id the id of the linked element
|
||||
* @param {String} sGroup the group of related DragDrop items
|
||||
*/
|
||||
YAHOO.example.DDSwap = function(id, sGroup, config) {
|
||||
this.swapInit(id, sGroup, config);
|
||||
};
|
||||
|
||||
YAHOO.extend(YAHOO.example.DDSwap, YAHOO.util.DDProxy);
|
||||
|
||||
YAHOO.example.DDSwap.prototype.swapInit = function(id, sGroup, config) {
|
||||
if (!id) { return; }
|
||||
|
||||
this.init(id, sGroup, config);
|
||||
this.initFrame();
|
||||
this.logger = this.logger || YAHOO;
|
||||
|
||||
/**
|
||||
* css style to use when items are not being hovered over.
|
||||
*/
|
||||
this.offClass = "testSquare";
|
||||
|
||||
/**
|
||||
* css style to use when hovered over
|
||||
*/
|
||||
this.onClass = "testSquareOn";
|
||||
|
||||
/**
|
||||
* cache of the elements we have changed the style so we can restore it
|
||||
* later
|
||||
*/
|
||||
this.els = [];
|
||||
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.onDragDrop = function(e, id) {
|
||||
var dd = YAHOO.util.DDM.getDDById(id);
|
||||
this.swap(this.getEl(), dd.getEl());
|
||||
this.resetConstraints();
|
||||
dd.resetConstraints();
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.swap = function(el1, el2) {
|
||||
this.logger.log(this.id + " onDragDrop swap");
|
||||
|
||||
// Swap out the position of the two objects. This only works for absolutely
|
||||
// positioned elements. See for an implementation that
|
||||
// works for relatively positioned elements
|
||||
var s1 = el1.style;
|
||||
var s2 = el2.style;
|
||||
|
||||
var l = s1.left;
|
||||
var t = s1.top;
|
||||
|
||||
s1.left = s2.left;
|
||||
s1.top = s2.top;
|
||||
|
||||
s2.left = l;
|
||||
s2.top = t;
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.onDragEnter = function(e, id) {
|
||||
this.logger.log(this.id + " dragEnter " + id);
|
||||
|
||||
// store a ref so we can restore the style later
|
||||
this.els[id] = true;
|
||||
|
||||
// set the mouseover style
|
||||
var el = YAHOO.util.DDM.getElement(id);
|
||||
if (el.className != this.onClass) {
|
||||
el.className = this.onClass;
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.onDragOut = function(e, id) {
|
||||
this.logger.log(this.id + " dragOut " + id);
|
||||
|
||||
// restore the style
|
||||
YAHOO.util.DDM.getElement(id).className = this.offClass;
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.endDrag = function(e) {
|
||||
this.logger.log(this.id + " endDrag");
|
||||
this.resetStyles();
|
||||
|
||||
/*
|
||||
var el = this.getDragEl();
|
||||
el.style.visibility = ""; // show the element first
|
||||
var position = [100, 100];
|
||||
var duration = 0.4;
|
||||
var oAnim = new YAHOO.util.Motion(
|
||||
el, { points: { to: position } }, duration, YAHOO.util.Easing.easeOut );
|
||||
|
||||
oAnim.onComplete.subscribe( function() { el.style.visibility = "hidden" } );
|
||||
*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.resetStyles = function() {
|
||||
// restore all element styles
|
||||
for (var i in this.els) {
|
||||
var el = YAHOO.util.DDM.getElement(i);
|
||||
if (el) { el.className = this.offClass; }
|
||||
}
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap.prototype.onDrag = function(e) { };
|
||||
|
||||
YAHOO.example.DDSwap.prototype.onDragOver = function(e) { };
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Intersect mode
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
YAHOO.example.DDSwap_i = function(id, sGroup) {
|
||||
this.swapInit(id, sGroup);
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap_i.prototype = new YAHOO.example.DDSwap();
|
||||
|
||||
YAHOO.example.DDSwap_i.prototype.onDragDrop = function(e, dds) {
|
||||
// this.logger.log(this.id + " onDragDrop swap");
|
||||
var dd = YAHOO.util.DDM.getBestMatch(dds);
|
||||
this.swap(this.getEl(), dd.getEl());
|
||||
|
||||
this.resetConstraints();
|
||||
dd.resetConstraints();
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap_i.prototype.onDragEnter = function(e, dds) {
|
||||
// this.logger.log(this.id + " dragEnter " + id);
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap_i.prototype.onDragOver = function(e, dds) {
|
||||
|
||||
this.resetStyles();
|
||||
|
||||
var dd = YAHOO.util.DDM.getBestMatch(dds);
|
||||
|
||||
this.els[dd.id] = true;
|
||||
|
||||
// set the mouseover style
|
||||
var el = dd.getEl();
|
||||
if (el.className != this.onClass) {
|
||||
el.className = this.onClass;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
YAHOO.example.DDSwap_i.prototype.onDragOut = function(e, dds) {
|
||||
// this.logger.log(this.id + " dragOut " + id);
|
||||
|
||||
// restore the style
|
||||
for (var i=0; i<dds.length; ++i) {
|
||||
dds[i].getEl().className = this.offClass;
|
||||
}
|
||||
};
|
||||
|
||||
101
www/extras/yui/examples/dragdrop/js/color.js
vendored
101
www/extras/yui/examples/dragdrop/js/color.js
vendored
|
|
@ -1,101 +0,0 @@
|
|||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
YAHOO.util.Color = new function() {
|
||||
|
||||
// Adapted from http://www.easyrgb.com/math.html
|
||||
// hsv values = 0 - 1
|
||||
// rgb values 0 - 255
|
||||
this.hsv2rgb = function (h, s, v) {
|
||||
var r, g, b;
|
||||
if ( s == 0 ) {
|
||||
r = v * 255;
|
||||
g = v * 255;
|
||||
b = v * 255;
|
||||
} else {
|
||||
|
||||
// h must be < 1
|
||||
var var_h = h * 6;
|
||||
if ( var_h == 6 ) {
|
||||
var_h = 0;
|
||||
}
|
||||
|
||||
//Or ... var_i = floor( var_h )
|
||||
var var_i = Math.floor( var_h );
|
||||
var var_1 = v * ( 1 - s );
|
||||
var var_2 = v * ( 1 - s * ( var_h - var_i ) );
|
||||
var var_3 = v * ( 1 - s * ( 1 - ( var_h - var_i ) ) );
|
||||
|
||||
if ( var_i == 0 ) {
|
||||
var_r = v;
|
||||
var_g = var_3;
|
||||
var_b = var_1;
|
||||
} else if ( var_i == 1 ) {
|
||||
var_r = var_2;
|
||||
var_g = v;
|
||||
var_b = var_1;
|
||||
} else if ( var_i == 2 ) {
|
||||
var_r = var_1;
|
||||
var_g = v;
|
||||
var_b = var_3
|
||||
} else if ( var_i == 3 ) {
|
||||
var_r = var_1;
|
||||
var_g = var_2;
|
||||
var_b = v;
|
||||
} else if ( var_i == 4 ) {
|
||||
var_r = var_3;
|
||||
var_g = var_1;
|
||||
var_b = v;
|
||||
} else {
|
||||
var_r = v;
|
||||
var_g = var_1;
|
||||
var_b = var_2
|
||||
}
|
||||
|
||||
r = var_r * 255 //rgb results = 0 ÷ 255
|
||||
g = var_g * 255
|
||||
b = var_b * 255
|
||||
|
||||
}
|
||||
return [Math.round(r), Math.round(g), Math.round(b)];
|
||||
};
|
||||
|
||||
this.rgb2hex = function (r,g,b) {
|
||||
return this.toHex(r) + this.toHex(g) + this.toHex(b);
|
||||
};
|
||||
|
||||
this.hexchars = "0123456789ABCDEF";
|
||||
|
||||
this.toHex = function(n) {
|
||||
n = n || 0;
|
||||
n = parseInt(n, 10);
|
||||
if (isNaN(n)) n = 0;
|
||||
n = Math.round(Math.min(Math.max(0, n), 255));
|
||||
|
||||
return this.hexchars.charAt((n - n % 16) / 16) + this.hexchars.charAt(n % 16);
|
||||
};
|
||||
|
||||
this.toDec = function(hexchar) {
|
||||
return this.hexchars.indexOf(hexchar.toUpperCase());
|
||||
};
|
||||
|
||||
this.hex2rgb = function(str) {
|
||||
var rgb = [];
|
||||
rgb[0] = (this.toDec(str.substr(0, 1)) * 16) +
|
||||
this.toDec(str.substr(1, 1));
|
||||
rgb[1] = (this.toDec(str.substr(2, 1)) * 16) +
|
||||
this.toDec(str.substr(3, 1));
|
||||
rgb[2] = (this.toDec(str.substr(4, 1)) * 16) +
|
||||
this.toDec(str.substr(5, 1));
|
||||
// gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
|
||||
return rgb;
|
||||
};
|
||||
|
||||
this.isValidRGB = function(a) {
|
||||
if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255) return false;
|
||||
if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255) return false;
|
||||
if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255) return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
34
www/extras/yui/examples/dragdrop/js/key.js
vendored
34
www/extras/yui/examples/dragdrop/js/key.js
vendored
|
|
@ -1,34 +0,0 @@
|
|||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
YAHOO.util.Key = new function() {
|
||||
// this.logger = new ygLogger("ygEventUtil");
|
||||
// DOM key constants
|
||||
this.DOM_VK_UNDEFINED = 0x0;
|
||||
this.DOM_VK_RIGHT_ALT = 0x12;
|
||||
this.DOM_VK_LEFT_ALT = 0x12;
|
||||
this.DOM_VK_LEFT_CONTROL = 0x11;
|
||||
this.DOM_VK_RIGHT_CONTROL = 0x11;
|
||||
this.DOM_VK_LEFT_SHIFT = 0x10;
|
||||
this.DOM_VK_RIGHT_SHIFT = 0x10;
|
||||
this.DOM_VK_META = 0x9D;
|
||||
this.DOM_VK_BACK_SPACE = 0x08;
|
||||
this.DOM_VK_CAPS_LOCK = 0x14;
|
||||
this.DOM_VK_DELETE = 0x7F;
|
||||
this.DOM_VK_END = 0x23;
|
||||
this.DOM_VK_ENTER = 0x0D;
|
||||
this.DOM_VK_ESCAPE = 0x1B;
|
||||
this.DOM_VK_HOME = 0x24;
|
||||
this.DOM_VK_NUM_LOCK = 0x90;
|
||||
this.DOM_VK_PAUSE = 0x13;
|
||||
this.DOM_VK_PRINTSCREEN = 0x9A;
|
||||
this.DOM_VK_SCROLL_LOCK = 0x91;
|
||||
this.DOM_VK_SPACE = 0x20;
|
||||
this.DOM_VK_TAB = 0x09;
|
||||
this.DOM_VK_LEFT = 0x25;
|
||||
this.DOM_VK_RIGHT = 0x27;
|
||||
this.DOM_VK_UP = 0x26;
|
||||
this.DOM_VK_DOWN = 0x28;
|
||||
this.DOM_VK_PAGE_DOWN = 0x22;
|
||||
this.DOM_VK_PAGE_UP = 0x21;
|
||||
};
|
||||
|
||||
20
www/extras/yui/examples/dragdrop/js/log.js
vendored
20
www/extras/yui/examples/dragdrop/js/log.js
vendored
|
|
@ -1,20 +0,0 @@
|
|||
// Adapter for YAHOO.widget.Logger
|
||||
|
||||
var ygLogger = function(module) {
|
||||
return new YAHOO.widget.LogWriter(module);
|
||||
};
|
||||
|
||||
YAHOO.widget.LogWriter.prototype.debug = function() {
|
||||
this.log.apply(this, arguments);
|
||||
};
|
||||
|
||||
YAHOO.widget.LogWriter.prototype.setModuleName = function(source) {
|
||||
this._source = source;
|
||||
};
|
||||
|
||||
|
||||
ygLogger.init = function(div) {
|
||||
new YAHOO.widget.LogReader(div, {
|
||||
height: "400px"
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue