From 08810a8fe7f6d2501ca017c2e87e9cdcbace54e5 Mon Sep 17 00:00:00 2001 From: laurence Date: Fri, 13 Sep 2013 06:55:10 +0800 Subject: laurence --- js/colorpicker.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) (limited to 'js/colorpicker.js') diff --git a/js/colorpicker.js b/js/colorpicker.js index 785d430..574349f 100644 --- a/js/colorpicker.js +++ b/js/colorpicker.js @@ -87,12 +87,14 @@ var ColorPicker = { var key = event.which || event.keyCode; if(key === 13) { $('#colorpicker').css({'background-image':"url('" + $('#bgURI').val() + "')"}); + $('#opt_bgURI').val($('#bgURI').val()); $('#bgURI').val(''); } }); }else{ $('#colorpicker').css({'background-image':'none','background-color':$('#' + this.id).html().toLowerCase()}); - } + } + $('#opt_bgColor').val(this.id); }); //--------event handler over colorpanel------- var firstwidth; @@ -152,6 +154,43 @@ var ColorPicker = { }); } }, + loadColorStorage: function() { + var opts = $('#opt_hexswitch').val(); + names = false; + rgbs = false; + hexes = false; + if(opts == 'names') { + selectedname = namespace.val(); + selectedrgb = hextorgb[nametohex[selectedname]]; + hexswitch.html('CLICK TO SWITCH TO RGB VALUES'); + rgbs = true; + }else if(opts == 'rgbs') { + selectedname = rgbtoname[namespace.val()]; + selectedrgb = namespace.val(); + hexes = true; + hexswitch.html('CLICK TO SWITCH TO HEX VALUES') + }else if(opts == 'hexes') { + names = true; + selectedrgb = hextorgb[namespace.val()]; + selectedname = rgbtoname[selectedrgb]; + hexswitch.html('CLICK TO SWITCH TO COLOR NAMES'); + } + colornames.html(selectedname); + preview.css({'background-color':selectedrgb,'border-style':'none'}); + vasebackground.css('background-color',selectedrgb); + infostate = parseInt($('#opt_infoswitch').val()); + ColorPicker.switchcolorinfo(); + var bgOpt = $('#opt_bgColor').val(); + if (bgOpt == "bg1") + { + $('#colorpicker').css({'background-image':'url("./images/bg.dither.gif")','background-color':'gray','background-color':'black'}); + }else if(bgOpt == "bg5"){ + $('#colorpicker').css({'background-image':"url('" + $('#opt_bgURI').val() + "')"}); + }else{ + $('#colorpicker').css({'background-image':'none','background-color':$('#' + bgOpt).html()}); + } + $('#bgURI').val($('#opt_bgURI').val()); + }, switchhovercss: function(sel, uno) { var chng = {}; chng['color'] = 'white'; @@ -191,6 +230,7 @@ var ColorPicker = { namespace.val(selectedname); names = false; rgbs = true; + $('#opt_hexswitch').val('names'); }else if(hexes == true) { rgbs = false; names = false; @@ -198,6 +238,7 @@ var ColorPicker = { namespace.val(rgbtohex[selectedrgb]); hexes = false; names = true; + $('#opt_hexswitch').val('hexes'); }else if(rgbs == true) { names = false; hexes = false; @@ -205,6 +246,7 @@ var ColorPicker = { namespace.val(selectedrgb) rgbs = false; hexes = true; + $('#opt_hexswitch').val('rgbs'); } }, putitin: function() { @@ -292,22 +334,26 @@ var ColorPicker = { } infostate = 2; infospace.html('(NAMES)'); + $('#opt_infoswitch').val('1'); }else if(infostate == 0) { $('.colors').html(""); infostate = 1; infospace.html('(NONE)'); + $('#opt_infoswitch').val('0'); }else if(infostate == 2) { for(var i=0; i < color_values.length; i++) { $('#d' + i).html(nametohex[divtoname['#d' + i]]); } infostate = 3; infospace.html('(HEXES)'); + $('#opt_infoswitch').val('2'); }else if(infostate == 3) { for(var i=0; i < color_values.length; i++) { $('#d' + i).html(hextorgb[nametohex[divtoname['#d' + i]]]); } - infostate = 0; + infostate = 0; infospace.html('(RGBS)'); + $('#opt_infoswitch').val('3'); } }, show: function() { -- cgit v1.2.3-70-g09d2