2022-11-14 17:31:15 +00:00
|
|
|
|
(function($){
|
|
|
|
|
var bigColorPicker = new function(){
|
|
|
|
|
var currentPicker = null; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
|
|
var allColorArray = [];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊǰ<CEAA><C7B0><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>Ϊ6<CEAA><36><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ܵĶ<DCB5>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var sideLength = 6;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>߳<EFBFBD>
|
|
|
|
|
this.init = function(){
|
|
|
|
|
$("body").append('<div id="bigpicker" class="bigpicker"><ul class="bigpicker-bgview-text" ><li><div id="bigBgshowDiv"></div></li><li><input id="bigHexColorText" size="7" maxlength="7" value="#000000" /></li></ul><div id="bigSections" class="bigpicker-sections-color"></div><div id="bigLayout" class="biglayout" ></div></div>');
|
|
|
|
|
|
|
|
|
|
$("#bigLayout").hover(function(){
|
|
|
|
|
$(this).show();
|
|
|
|
|
},function(){
|
|
|
|
|
$(this).hide();
|
|
|
|
|
}).click(function(){
|
|
|
|
|
$("#bigpicker").hide();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//<2F><>ɫʰȡ<CAB0><C8A1>text<78><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>¼<EFBFBD>
|
|
|
|
|
$("#bigHexColorText").keypress(function(){
|
|
|
|
|
var text = $.trim($(this).val());
|
|
|
|
|
$(this).val(text.replace(/[^A-Fa-f0-9#]/g,''));
|
|
|
|
|
if(text.length <= 0)return;
|
|
|
|
|
text = text.charAt(0)=='#'?text:"#" + text;
|
|
|
|
|
var countChar = 7 - text.length;
|
|
|
|
|
if(countChar < 0){
|
|
|
|
|
text = text.substring(0,7);
|
|
|
|
|
}else if(countChar > 0){
|
|
|
|
|
for(var i=0;i<countChar;i++){
|
|
|
|
|
text += "0";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
$("#bigBgshowDiv").css("backgroundColor",text);
|
|
|
|
|
}).keyup(function(){
|
|
|
|
|
var text = $.trim($(this).val());
|
|
|
|
|
$(this).val(text.replace(/[^A-Fa-f0-9#]/g,''));
|
|
|
|
|
}).focus(function(){
|
|
|
|
|
this.select();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵط<C4B5>ʱѡ<CAB1><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
$(document).bind('mousedown',function(event){
|
|
|
|
|
if(!($(event.target).parents().andSelf().is('#bigpicker'))){
|
|
|
|
|
$("#bigpicker").hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* callback:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><E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EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>p(<EFBFBD><EFBFBD>P)<EFBFBD><EFBFBD>
|
|
|
|
|
* undefined<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>p(<EFBFBD><EFBFBD>P)
|
|
|
|
|
* sideLength:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>Сȡֵ<EFBFBD><EFBFBD>ΧΪ2<EFBFBD><EFBFBD>10<EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD>Ϊ6,ֻ<EFBFBD><EFBFBD>engineΪLʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
*/
|
|
|
|
|
this.showPicker = function(callback,engine,sideLength_){
|
|
|
|
|
|
|
|
|
|
if($("body").length > 0 && $("#bigpicker").length <= 0){
|
|
|
|
|
bigColorPicker.init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sl_ = parseInt(sideLength_,10);
|
|
|
|
|
if(engine == "L" && !isNaN(sl_) && sl_ >=2 && sl_ <= 10){
|
|
|
|
|
sideLength = sl_;
|
|
|
|
|
}else{
|
|
|
|
|
sideLength = 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getAllColorArray = function(){
|
|
|
|
|
allColorArray = new Array(sideLength*3 + 2);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var mixColorArray = [];
|
|
|
|
|
var blackWhiteGradientArray = gradientColor(new RGB(0,0,0),new RGB(255,255,255));
|
|
|
|
|
for(var i=0;i<blackWhiteGradientArray.length;i++){
|
|
|
|
|
mixColorArray[i] = blackWhiteGradientArray[i];
|
|
|
|
|
}
|
|
|
|
|
var baseArray = [new RGB(255,0,0),new RGB(0,255,0),new RGB(0,0,255),new RGB(255,255,0),new RGB(0,255,255),new RGB(255,0,255),new RGB(204,255,0),new RGB(153,0,255),new RGB(102,255,255),new RGB(51,0,0)];
|
|
|
|
|
mixColorArray = mixColorArray.concat(baseArray.slice(0, sideLength));
|
|
|
|
|
allColorArray[0] = mixColorArray;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var blackArray = new Array(sideLength*2);
|
|
|
|
|
for(var i=0;i<blackArray.length;i++){
|
|
|
|
|
blackArray[i] = new RGB(0,0,0);
|
|
|
|
|
}
|
|
|
|
|
allColorArray[1] = blackArray;
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var cornerColorArray = new Array();//<2F><><EFBFBD><EFBFBD>Ԫ<EFBFBD>أ<EFBFBD>ÿ<EFBFBD><C3BF>Ԫ<EFBFBD>ط<EFBFBD>6<EFBFBD><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>ɫ<EFBFBD><C9AB>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
|
|
|
|
|
cornerColorArray.push(generateBlockcornerColor(0),generateBlockcornerColor(51),generateBlockcornerColor(102),generateBlockcornerColor(153),generateBlockcornerColor(204),generateBlockcornerColor(255));
|
|
|
|
|
var count = 0;
|
|
|
|
|
var halfOfAllArray1 = [];
|
|
|
|
|
var halfOfAllArray2 = [];
|
|
|
|
|
for(var i=0;i<cornerColorArray.length;i++){
|
|
|
|
|
var startArray = gradientColor(cornerColorArray[i][0][0],cornerColorArray[i][0][1]);
|
|
|
|
|
var endArray = gradientColor(cornerColorArray[i][1][0],cornerColorArray[i][1][1]);
|
|
|
|
|
for(var j=0;j<sideLength;j++){
|
|
|
|
|
if(i < 3){
|
|
|
|
|
halfOfAllArray1[count] = gradientColor(startArray[j],endArray[j]);
|
|
|
|
|
}else{
|
|
|
|
|
halfOfAllArray2[count - sideLength*3] = gradientColor(startArray[j],endArray[j]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<halfOfAllArray1.length;i++){
|
|
|
|
|
allColorArray[i + 2] = halfOfAllArray1[i].concat(halfOfAllArray2[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>RGB<47><42>ɫת<C9AB><D7AA><EFBFBD><EFBFBD>Hex<65><78>ʽ
|
|
|
|
|
for(var i=0;i<allColorArray.length;i++){
|
|
|
|
|
for(var j=0;j<allColorArray[i].length;j++){
|
|
|
|
|
allColorArray[i][j] = RGBToHex(allColorArray[i][j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.getAllColorArray();
|
|
|
|
|
|
|
|
|
|
$(this).data("bigpickerCallback",callback);
|
|
|
|
|
|
|
|
|
|
if(engine){
|
|
|
|
|
try{
|
|
|
|
|
engine = engine.toUpperCase();
|
|
|
|
|
}catch(e){
|
|
|
|
|
engine = "P";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(engine == "L" ){
|
|
|
|
|
$("#bigSections").unbind("mousemove").unbind("mouseout").removeClass("bigpicker-bgimage");
|
|
|
|
|
var ulArray = new Array();
|
|
|
|
|
for(var i=0;i<sideLength*3 + 2;i++){
|
|
|
|
|
ulArray.push("<ul>");
|
|
|
|
|
for(var j=0;j<sideLength*2;j++){
|
|
|
|
|
ulArray.push("<li data-color='" + allColorArray[i][j] + "' style='background-color: " + allColorArray[i][j] + ";' ></li>");
|
|
|
|
|
}
|
|
|
|
|
ulArray.push("</ul>");
|
|
|
|
|
}
|
|
|
|
|
$("#bigSections").html(ulArray.join(""));
|
|
|
|
|
var minBigpickerHeight = 90;
|
|
|
|
|
var minBigpickerWidth = 129;
|
|
|
|
|
var minSectionsHeight = minBigpickerHeight - 29;
|
|
|
|
|
var minSectionsWidth = minBigpickerWidth - 1;
|
|
|
|
|
|
|
|
|
|
var defaultSectionsWidth = (sideLength*3 + 2)*11 + 1;
|
|
|
|
|
if(defaultSectionsWidth < minSectionsWidth){
|
|
|
|
|
$("#bigSections li,#bigLayout").width(minSectionsWidth/(sideLength*3 + 2) - 2)
|
|
|
|
|
.height(minSectionsHeight/(sideLength*2) - 1);
|
|
|
|
|
$("#bigpicker").height(minBigpickerHeight).width(minBigpickerWidth);
|
|
|
|
|
$("#bigSections").height(minSectionsHeight).width(minSectionsWidth);
|
|
|
|
|
}else{
|
|
|
|
|
$("#bigSections").width(defaultSectionsWidth)
|
|
|
|
|
.height(sideLength*2*11);
|
|
|
|
|
$("#bigpicker").width(defaultSectionsWidth + 5)
|
|
|
|
|
.height(sideLength*2*11 + 29);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#bigSections ul").find("li:last").css("border-bottom","1px solid #000000");
|
|
|
|
|
$("#bigSections ul:last li").css("border-right","1px solid #000000");
|
|
|
|
|
|
|
|
|
|
$("#bigSections li").hover(function(){
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
$("#bigLayout").css({"left":$this.position().left,"top":$this.position().top}).show();
|
|
|
|
|
var cor = $this.attr("data-color");
|
|
|
|
|
$("#bigBgshowDiv").css("backgroundColor",cor);
|
|
|
|
|
$("#bigHexColorText").val(cor);
|
|
|
|
|
invokeCallBack(cor);
|
|
|
|
|
},function(){
|
|
|
|
|
$("#bigLayout").hide();
|
|
|
|
|
});
|
|
|
|
|
}else{
|
|
|
|
|
//Ԥ<><D4A4><EFBFBD><EFBFBD>ͼƬ
|
|
|
|
|
var bgmage = new Image();
|
|
|
|
|
bgmage.src = "../images/big_bgcolor.jpg";
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>ΪĬ<CEAA><C4AC><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
$("#bigSections").height(134).width(222).addClass("bigpicker-bgimage").empty();
|
|
|
|
|
$("#bigpicker").width(227).height(163);
|
|
|
|
|
//Pģʽʱ<CABD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫС<C9AB><D0A1><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>ʱ<EFBFBD><CAB1>ȡ<EFBFBD><C8A1>ɫ
|
|
|
|
|
$("#bigSections").unbind("mousemove").unbind("mouseout").mousemove(function(event){
|
|
|
|
|
var xSections = getSections(sideLength*3 + 2);
|
|
|
|
|
var ySections = getSections(sideLength*3);
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
var cursorXPos = event.pageX - $this.offset().left;
|
|
|
|
|
var cursorYPos = event.pageY - $this.offset().top;
|
|
|
|
|
var xi = 0;
|
|
|
|
|
var yi = 0;
|
|
|
|
|
for(var i=0;i<(sideLength*3+2);i++){
|
|
|
|
|
if(cursorXPos >= xSections[i][0] && cursorXPos <= xSections[i][1]){
|
|
|
|
|
xi = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<(sideLength*3);i++){
|
|
|
|
|
if(cursorYPos >= ySections[i][0] && cursorYPos <= ySections[i][1]){
|
|
|
|
|
yi = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$("#bigLayout").css({"left":$this.position().left + xi*11,"top":$this.position().top + yi*11}).show();
|
|
|
|
|
var hex = allColorArray[xi][yi];
|
|
|
|
|
$("#bigBgshowDiv").css("backgroundColor",hex);
|
|
|
|
|
$("#bigHexColorText").val(hex);
|
|
|
|
|
|
|
|
|
|
invokeCallBack(hex);
|
|
|
|
|
|
|
|
|
|
}).mouseout(function(){
|
|
|
|
|
$("#bigLayout").hide();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>ɫ<EFBFBD><C9AB>Ԫ<EFBFBD>ذ<EFBFBD><D8B0><EFBFBD>click<63>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ɫʰȡ<CAB0><C8A1>
|
|
|
|
|
$(this).bind("click",function(event){
|
|
|
|
|
currentPicker = event.currentTarget;
|
|
|
|
|
$("#bigBgshowDiv").css("backgroundColor","#000000");
|
|
|
|
|
$("#bigHexColorText").val("#000000");
|
|
|
|
|
|
|
|
|
|
var pos = calculatePosition ($(currentPicker));
|
|
|
|
|
$("#bigpicker").css({"left":pos.left + "px","top":pos.top + "px"}).fadeIn(300);
|
|
|
|
|
|
|
|
|
|
var bigSectionsP = $("#bigSections").position();
|
|
|
|
|
$("#bigLayout").css({"left":bigSectionsP.left,"top":bigSectionsP.top}).show();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.hidePicker = function(){
|
|
|
|
|
$("#bigpicker").hide();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.movePicker = function(){
|
|
|
|
|
var pos = calculatePosition ($(currentPicker));
|
|
|
|
|
$("#bigpicker").css({"left":pos.left + "px","top":pos.top + "px"});
|
|
|
|
|
$("#bigLayout").hide();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>left,top<6F><70><EFBFBD><EFBFBD>
|
|
|
|
|
function calculatePosition ($el) {
|
|
|
|
|
var offset = $el.offset();
|
|
|
|
|
var compatMode = document.compatMode == 'CSS1Compat';
|
|
|
|
|
var w = compatMode ? document.documentElement.clientWidth : document.body.clientWidth;
|
|
|
|
|
var h = compatMode ? document.documentElement.clientHeight : document.body.clientHeight;
|
|
|
|
|
var pos = {left:offset.left,top:offset.top + $el.height() + 7};
|
|
|
|
|
var $bigpicker = $("#bigpicker");
|
|
|
|
|
if(offset.left + $bigpicker.width() > w){
|
|
|
|
|
pos.left = offset.left - $bigpicker.width() - 7;
|
|
|
|
|
if(pos.left < 0){
|
|
|
|
|
pos.left = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(offset.top + $el.height() + 7 + $bigpicker.height() > h){
|
|
|
|
|
pos.top = offset.top - $bigpicker.height() - 7;
|
|
|
|
|
if(pos.top < 0){
|
|
|
|
|
pos.top = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8>ǵ<EFBFBD><C7B5><EFBFBD>ɫ<EFBFBD><C9AB>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
|
|
|
|
|
function generateBlockcornerColor(r){
|
|
|
|
|
var a = new Array(2);
|
|
|
|
|
a[0] = [new RGB(r,0,0),new RGB(r,255,0)];
|
|
|
|
|
a[1] = [new RGB(r,0,255),new RGB(r,255,255)];
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|
|
|
|
function gradientColor(startColor,endColor){
|
|
|
|
|
var gradientArray = [];
|
|
|
|
|
gradientArray[0] = startColor;
|
|
|
|
|
gradientArray[sideLength-1] = endColor;
|
|
|
|
|
var averageR = Math.round((endColor.r - startColor.r)/sideLength);
|
|
|
|
|
var averageG = Math.round((endColor.g - startColor.g)/sideLength);
|
|
|
|
|
var averageB = Math.round((endColor.b - startColor.b)/sideLength);
|
|
|
|
|
for(var i=1;i<sideLength-1;i++){
|
|
|
|
|
gradientArray[i] = new RGB(startColor.r + i*averageR,startColor.g + i*averageG,startColor.b + i*averageB);
|
|
|
|
|
}
|
|
|
|
|
return gradientArray;
|
|
|
|
|
}
|
|
|
|
|
/*<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[0,11],[12,23],[24,37]..
|
|
|
|
|
* sl:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
function getSections(sl){
|
|
|
|
|
var sections = new Array(sl);
|
|
|
|
|
var initData = 0;
|
|
|
|
|
for(var i=0;i<sl;i++){
|
|
|
|
|
var temp = initData + 1;
|
|
|
|
|
initData += 11;
|
|
|
|
|
sections[i] = [temp,initData];
|
|
|
|
|
}
|
|
|
|
|
return sections;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function RGBToHex(rgb){
|
|
|
|
|
var hex = "#";
|
|
|
|
|
for(c in rgb){
|
|
|
|
|
var h = rgb[c].toString(16).toUpperCase();
|
|
|
|
|
if(h.length == 1){
|
|
|
|
|
hex += "0" + h;
|
|
|
|
|
}else{
|
|
|
|
|
hex += h;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return hex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//RGB<47><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>һ<EFBFBD><D2BB>RGB<47><42>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|
|
|
|
function RGB(r,g,b){
|
|
|
|
|
this.r = Math.max(Math.min(r,255),0);
|
|
|
|
|
this.g = Math.max(Math.min(g,255),0);
|
|
|
|
|
this.b = Math.max(Math.min(b,255),0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function invokeCallBack(hex){
|
|
|
|
|
var callback_ = $(currentPicker).data("bigpickerCallback");
|
|
|
|
|
if($.isFunction(callback_)){
|
|
|
|
|
callback_(currentPicker,hex);
|
|
|
|
|
}else if(callback_ == undefined || callback_ == ""){
|
|
|
|
|
$(currentPicker).val(hex);
|
|
|
|
|
}else{
|
|
|
|
|
if(callback_.charAt(0) != "#"){
|
|
|
|
|
callback_ = "#" + callback_;
|
|
|
|
|
}
|
|
|
|
|
$(callback_).val(hex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
$.fn.bigColorpicker = bigColorPicker.showPicker;
|
|
|
|
|
$.fn.bigColorpickerMove = bigColorPicker.movePicker; //ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>קʱʰȡ<CAB0><C8A1><EFBFBD>渡<EFBFBD><E6B8A1><EFBFBD>ƶ<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
|
|
$.fn.bigColorpickerHide = bigColorPicker.hidePicker; //<2F><>ӦһЩ<D2BB>ض<EFBFBD><D8B6><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ҫ<EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>ʱʹ<CAB1>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʰȡ<CAB0><C8A1>
|
2022-11-14 15:49:28 +00:00
|
|
|
|
})(jQuery);
|