Initial commit as release 1.1.0
This commit is contained in:
60
distfiles/colorpicker/js/YAHOO.js
Normal file
60
distfiles/colorpicker/js/YAHOO.js
Normal file
@@ -0,0 +1,60 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class The Yahoo global namespace
|
||||
*/
|
||||
var YAHOO = function() {
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform utils namespace
|
||||
*/
|
||||
util: {},
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform widgets namespace
|
||||
*/
|
||||
widget: {},
|
||||
|
||||
/**
|
||||
* Yahoo presentation platform examples namespace
|
||||
*/
|
||||
example: {},
|
||||
|
||||
/**
|
||||
* Returns the namespace specified and creates it if it doesn't exist
|
||||
*
|
||||
* YAHOO.namespace("property.package");
|
||||
* YAHOO.namespace("YAHOO.property.package");
|
||||
*
|
||||
* Either of the above would create YAHOO.property, then
|
||||
* YAHOO.property.package
|
||||
*
|
||||
* @param {String} sNameSpace String representation of the desired
|
||||
* namespace
|
||||
* @return {Object} A reference to the namespace object
|
||||
*/
|
||||
namespace: function( sNameSpace ) {
|
||||
|
||||
if (!sNameSpace || !sNameSpace.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var levels = sNameSpace.split(".");
|
||||
|
||||
var currentNS = YAHOO;
|
||||
|
||||
// YAHOO is implied, so it is ignored if it is included
|
||||
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
|
||||
currentNS[levels[i]] = currentNS[levels[i]] || {};
|
||||
currentNS = currentNS[levels[i]];
|
||||
}
|
||||
|
||||
return currentNS;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
} ();
|
||||
|
||||
39
distfiles/colorpicker/js/animation.js
Normal file
39
distfiles/colorpicker/js/animation.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
YAHOO.util.Anim=function(el,attributes,duration,method)
|
||||
{if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={doMethod:function(attribute,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attribute,val,unit){YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);},getAttribute:function(attribute){return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));},defaultUnits:{opacity:' '},defaultUnit:'px',init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var endTime=null;var actualFrames=0;var defaultValues={};el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.setDefault=function(attribute,val){if(val=='auto'){switch(attribute){case'width':val=el.clientWidth||el.offsetWidth;break;case'height':val=el.clientHeight||el.offsetHeight;break;case'left':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetLeft;}else{val=0;}
|
||||
break;case'top':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetTop;}else{val=0;}
|
||||
break;default:val=0;}}
|
||||
defaultValues[attribute]=val;}
|
||||
this.getDefault=function(attribute){return defaultValues[attribute];};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.animate=function(){this.onStart.fire();this._onStart.fire();this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);var attributes=this.attributes;var el=this.getEl();var val;for(var attribute in attributes){val=this.getAttribute(attribute);this.setDefault(attribute,val);}
|
||||
isAnimated=true;actualFrames=0;startTime=new Date();};this.stop=function(){this.currentFrame=0;endTime=new Date();var data={time:endTime,duration:endTime-startTime,frames:actualFrames,fps:actualFrames/this.duration};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};var onTween=function(){var start;var end=null;var val;var unit;var attributes=this['attributes'];for(var attribute in attributes){unit=attributes[attribute]['unit']||this.defaultUnits[attribute]||this.defaultUnit;if(typeof attributes[attribute]['from']!='undefined'){start=attributes[attribute]['from'];}else{start=this.getDefault(attribute);}
|
||||
if(typeof attributes[attribute]['to']!='undefined'){end=attributes[attribute]['to'];}else if(typeof attributes[attribute]['by']!='undefined'){end=start+attributes[attribute]['by'];}
|
||||
if(end!==null&&typeof end!='undefined'){val=this.doMethod(attribute,start,end);if((attribute=='width'||attribute=='height'||attribute=='opacity')&&val<0){val=0;}
|
||||
this.setAttribute(attribute,val,unit);}}
|
||||
actualFrames+=1;};this._onStart=new YAHOO.util.CustomEvent('_onStart',this);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onTween.subscribe(onTween);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){if(tween.isAnimated()){return false;}
|
||||
queue[queue.length]=tween;tweenCount+=1;this.start();};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween)
|
||||
{clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){queue[i].stop();}}
|
||||
queue=[];thread=null;tweenCount=0;}
|
||||
else{tween.stop();tweenCount-=1;if(tweenCount<=0){this.stop();}}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
|
||||
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
|
||||
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
|
||||
tween.onTween.fire();tween._onTween.fire();}
|
||||
else{YAHOO.util.AnimMgr.stop(tween);}}};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
|
||||
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
|
||||
tween.currentFrame+=tweak;}};}
|
||||
YAHOO.util.Bezier=new function()
|
||||
{this.getPosition=function(points,t)
|
||||
{var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
|
||||
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
|
||||
return[tmp[0][0],tmp[0][1]];};};YAHOO.util.Easing=new function(){this.easeNone=function(t,b,c,d){return b+c*(t/=d);};this.easeIn=function(t,b,c,d){return b+c*((t/=d)*t*t);};this.easeOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(tc+-3*ts+3*t);};this.easeBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-2*tc+3*ts);};this.backIn=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-3.4005*tc*ts+10.2*ts*ts+-6.2*tc+0.4*ts);};this.backOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(8.292*tc*ts+-21.88*ts*ts+22.08*tc+-12.69*ts+5.1975*t);};this.backBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(0.402*tc*ts+-2.1525*ts*ts+-3.2*tc+8*ts+-2.05*t);};};YAHOO.util.Motion=function(el,attributes,duration,method){if(el){this.initMotion(el,attributes,duration,method);}};YAHOO.util.Motion.prototype=new YAHOO.util.Anim();YAHOO.util.Motion.prototype.defaultUnits.points='px';YAHOO.util.Motion.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='points'){var translatedPoints=this.getTranslatedPoints();var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;if(translatedPoints){val=YAHOO.util.Bezier.getPosition(translatedPoints,t);}}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
|
||||
return val;};YAHOO.util.Motion.prototype.getAttribute=function(attribute){var val=null;if(attribute=='points'){val=[this.getAttribute('left'),this.getAttribute('top')];if(isNaN(val[0])){val[0]=0;}
|
||||
if(isNaN(val[1])){val[1]=0;}}else{val=parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));}
|
||||
return val;};YAHOO.util.Motion.prototype.setAttribute=function(attribute,val,unit){if(attribute=='points'){YAHOO.util.Dom.setStyle(this.getEl(),'left',val[0]+unit);YAHOO.util.Dom.setStyle(this.getEl(),'top',val[1]+unit);}else{YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);}};YAHOO.util.Motion.prototype.initMotion=function(el,attributes,duration,method){YAHOO.util.Anim.call(this,el,attributes,duration,method);attributes=attributes||{};attributes.points=attributes.points||{};attributes.points.control=attributes.points.control||[];this.attributes=attributes;var start;var end=null;var translatedPoints=null;this.getTranslatedPoints=function(){return translatedPoints;};var translateValues=function(val,self){var pageXY=YAHOO.util.Dom.getXY(self.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var onStart=function(){start=this.getAttribute('points');var attributes=this.attributes;var control=attributes['points']['control']||[];if(control.length>0&&control[0].constructor!=Array){control=[control];}
|
||||
if(YAHOO.util.Dom.getStyle(this.getEl(),'position')=='static'){YAHOO.util.Dom.setStyle(this.getEl(),'position','relative');}
|
||||
if(typeof attributes['points']['from']!='undefined'){YAHOO.util.Dom.setXY(this.getEl(),attributes['points']['from']);start=this.getAttribute('points');}
|
||||
else if((start[0]===0||start[1]===0)){YAHOO.util.Dom.setXY(this.getEl(),YAHOO.util.Dom.getXY(this.getEl()));start=this.getAttribute('points');}
|
||||
var i,len;if(typeof attributes['points']['to']!='undefined'){end=translateValues(attributes['points']['to'],this);for(i=0,len=control.length;i<len;++i){control[i]=translateValues(control[i],this);}}else if(typeof attributes['points']['by']!='undefined'){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
|
||||
if(end){translatedPoints=[start];if(control.length>0){translatedPoints=translatedPoints.concat(control);}
|
||||
translatedPoints[translatedPoints.length]=end;}};this._onStart.subscribe(onStart);};YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Anim.call(this,el,attributes,duration,method);}};YAHOO.util.Scroll.prototype=new YAHOO.util.Anim();YAHOO.util.Scroll.prototype.defaultUnits.scroll=' ';YAHOO.util.Scroll.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
|
||||
return val;}
|
||||
YAHOO.util.Scroll.prototype.getAttribute=function(attribute){var val=null;var el=this.getEl();if(attribute=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=parseFloat(YAHOO.util.Dom.getStyle(el,attribute));}
|
||||
return val;};YAHOO.util.Scroll.prototype.setAttribute=function(attribute,val,unit){var el=this.getEl();if(attribute=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{YAHOO.util.Dom.setStyle(el,attribute,val+unit);}};
|
||||
101
distfiles/colorpicker/js/color.js
Normal file
101
distfiles/colorpicker/js/color.js
Normal file
@@ -0,0 +1,101 @@
|
||||
/* 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;
|
||||
};
|
||||
}
|
||||
|
||||
43
distfiles/colorpicker/js/ddcolorposter.js
Normal file
43
distfiles/colorpicker/js/ddcolorposter.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
======================================================================
|
||||
ddcolorposter.js: By Dynamic Drive (http://www.dynamicdrive.com)
|
||||
Communicates between Yahoo Color Picker and form fields on your page
|
||||
Created: Feb 20th, 06'
|
||||
======================================================================
|
||||
*/
|
||||
|
||||
function executeonload(functionref){
|
||||
if (window.addEventListener)
|
||||
window.addEventListener("load", functionref, false)
|
||||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", functionref)
|
||||
else if (document.getElementById)
|
||||
window.onload=functionref
|
||||
}
|
||||
|
||||
var ddcolorposter={
|
||||
initialize:function(r,g,b, hexvalue){
|
||||
this.rvalue=r //store red value
|
||||
this.gvalue=g //store green value
|
||||
this.bvalue=b //store blue value
|
||||
this.hexvalue=hexvalue //store combined hex value
|
||||
if (typeof this.targetobj!="undefined"){
|
||||
this.targetobj.value=this.hexvalue //set field to selected hex color value
|
||||
if (typeof this.divobj!="undefined") //set adjacent div to selected hex color value
|
||||
this.divobj.style.backgroundColor="#"+this.hexvalue
|
||||
}
|
||||
},
|
||||
echocolor:function(inputobj, divID){
|
||||
this.targetobj=inputobj
|
||||
this.divobj=document.getElementById(divID)
|
||||
this.targetobj.onblur=function(){
|
||||
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
|
||||
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
|
||||
}
|
||||
},
|
||||
fillcolorbox:function(inputID, divID){
|
||||
var inputobj=document.getElementById(inputID)
|
||||
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
|
||||
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
|
||||
}
|
||||
}
|
||||
26
distfiles/colorpicker/js/dom.js
Normal file
26
distfiles/colorpicker/js/dom.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
YAHOO.util.Dom=new function(){this.get=function(el){if(typeof el=='string'){el=document.getElementById(el);}
|
||||
return el;};this.getStyle=function(el,property){var value=null;var dv=document.defaultView;el=this.get(el);if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}
|
||||
else if(el.style[property]){value=el.style[property];}
|
||||
else if(el.currentStyle&&el.currentStyle[property]){value=el.currentStyle[property];}
|
||||
else if(dv&&dv.getComputedStyle)
|
||||
{var converted='';for(i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}
|
||||
if(dv.getComputedStyle(el,'').getPropertyValue(converted)){value=dv.getComputedStyle(el,'').getPropertyValue(converted);}}
|
||||
return value;};this.setStyle=function(el,property,val){el=this.get(el);switch(property){case'opacity':if(el.filters){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}
|
||||
break;default:el.style[property]=val;}};this.getXY=function(el){el=this.get(el);if(el.parentNode===null||this.getStyle(el,'display')=='none'){return false;}
|
||||
var parent=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;return[box.left+scrollLeft,box.top+scrollTop];}
|
||||
else if(document.getBoxObjectFor){box=document.getBoxObjectFor(el);pos=[box.x,box.y];}
|
||||
else{pos=[el.offsetLeft,el.offsetTop];parent=el.offsetParent;if(parent!=el){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}
|
||||
var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1||(ua.indexOf('safari')!=-1&&this.getStyle(el,'position')=='absolute')){pos[1]-=document.body.offsetTop;}}
|
||||
if(el.parentNode){parent=el.parentNode;}
|
||||
else{parent=null;}
|
||||
while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}
|
||||
else{parent=null;}}
|
||||
return pos;};this.getX=function(el){return this.getXY(el)[0];};this.getY=function(el){return this.getXY(el)[1];};this.setXY=function(el,pos,noRetry){el=this.get(el);var pageXY=YAHOO.util.Dom.getXY(el);if(pageXY===false){return false;}
|
||||
var delta=[parseInt(YAHOO.util.Dom.getStyle(el,'left'),10),parseInt(YAHOO.util.Dom.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=0;}
|
||||
if(isNaN(delta[1])){delta[1]=0;}
|
||||
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
|
||||
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
|
||||
var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}
|
||||
return true;};this.setX=function(el,x){return this.setXY(el,[x,null]);};this.setY=function(el,y){return this.setXY(el,[null,y]);};this.getRegion=function(el){el=this.get(el);return new YAHOO.util.Region.getRegion(el);};this.getClientWidth=function(){return(document.documentElement.offsetWidth||document.body.offsetWidth);};this.getClientHeight=function(){return(self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight);};};YAHOO.util.Region=function(t,r,b,l){this.top=t;this.right=r;this.bottom=b;this.left=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+" t: "+this.top+", r: "+this.right+", b: "+this.bottom+", l: "+this.left+"}");}
|
||||
YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){this.x=x;this.y=y;this.top=y;this.right=x;this.bottom=y;this.left=x;};YAHOO.util.Point.prototype=new YAHOO.util.Region();
|
||||
1
distfiles/colorpicker/js/dragdrop.js
vendored
Normal file
1
distfiles/colorpicker/js/dragdrop.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
distfiles/colorpicker/js/event.js
Normal file
1
distfiles/colorpicker/js/event.js
Normal file
File diff suppressed because one or more lines are too long
34
distfiles/colorpicker/js/key.js
Normal file
34
distfiles/colorpicker/js/key.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/* 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;
|
||||
};
|
||||
|
||||
89
distfiles/colorpicker/js/log.js
Normal file
89
distfiles/colorpicker/js/log.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
|
||||
|
||||
/**
|
||||
* @class a general logging class. Expects to be initalized with a reference
|
||||
* to a html element to write to.
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} sModuleName the name of the module this instance belongs
|
||||
* to. Used in the log message to help id where the msg came from.
|
||||
*/
|
||||
function ygLogger(sModuleName) {
|
||||
if (this.setModuleName)
|
||||
this.setModuleName(sModuleName);
|
||||
}
|
||||
|
||||
ygLogger.DEBUG_ENABLED = true;
|
||||
ygLogger.targetEl = null;
|
||||
ygLogger.logStack = [];
|
||||
ygLogger.startLog = new Date().getTime();
|
||||
ygLogger.lastLog = new Date().getTime();
|
||||
ygLogger.locked = true;
|
||||
ygLogger.logTimeout = null;
|
||||
|
||||
ygLogger.init = function(oHostElement) {
|
||||
if (oHostElement) {
|
||||
ygLogger.targetEl = oHostElement;
|
||||
} else {
|
||||
// create element or create window?
|
||||
}
|
||||
};
|
||||
|
||||
ygLogger.prototype.setModuleName = function(sModuleName) {
|
||||
this.logName = sModuleName;
|
||||
};
|
||||
|
||||
ygLogger.prototype.debug = function() {
|
||||
if (ygLogger.DEBUG_ENABLED) {
|
||||
var newDate = new Date();
|
||||
var newTime = newDate.getTime();
|
||||
var timeStamp = newTime - ygLogger.lastLog;
|
||||
var totalSeconds = (newTime - ygLogger.startLog) / 1000;
|
||||
|
||||
ygLogger.lastLog = newTime;
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
ygLogger.logStack[ygLogger.logStack.length] =
|
||||
timeStamp + " ms(" + totalSeconds + ") " +
|
||||
newDate.toLocaleTimeString() + "<br />" +
|
||||
this.logName + ": <b>" + arguments[i] + "</b>";
|
||||
}
|
||||
|
||||
if (ygLogger.logTimeout == null) {
|
||||
ygLogger.logTimeout = setTimeout("ygLogger._outputMessages()" , 1);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
ygLogger.disable = function() {
|
||||
ygLogger.DEBUG_ENABLED = false;
|
||||
try { ygLogger.targetEl.style.visibility = "hidden"; } catch(e) {}
|
||||
|
||||
};
|
||||
|
||||
ygLogger.enable = function() {
|
||||
ygLogger.DEBUG_ENABLED = true;
|
||||
try { ygLogger.targetEl.style.visibility = ""; } catch(e) {}
|
||||
};
|
||||
|
||||
ygLogger._outputMessages = function() {
|
||||
if (ygLogger.targetEl != null) {
|
||||
|
||||
for (var i = 0; i < ygLogger.logStack.length; i++) {
|
||||
var sMsg = ygLogger.logStack[i];
|
||||
var oNewElement = ygLogger.targetEl.appendChild(
|
||||
document.createElement("p"));
|
||||
oNewElement.innerHTML = sMsg;
|
||||
}
|
||||
|
||||
ygLogger.logStack = [];
|
||||
|
||||
ygLogger.targetEl.scrollTop = ygLogger.targetEl.scrollHeight;
|
||||
|
||||
// debugger;
|
||||
}
|
||||
|
||||
ygLogger.logTimeout = null;
|
||||
};
|
||||
|
||||
1
distfiles/colorpicker/js/slider.js
Normal file
1
distfiles/colorpicker/js/slider.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user