some updates

This commit is contained in:
Harry Bomrah committed 2012-04-18 18:15:02 +08:00
1 parent d14630769a
commit 6b35cf821e
4 files changed
+92 -44

No files matched your search

+37 -2
View File
@@ -495,8 +495,8 @@ var orbitDesktop = function(dom){
var bindHandlers = function(){
$(".theme_list > li").click(function(){
o.changeTheme($(this).attr("id"));
$(".theme_list > li").removeClass('thmc1').data('clicked',null).find('.theme_name').removeClass('thmtxt');
$(this).addClass('thmc1').data('clicked',true).find('.theme_name').addClass('thmtxt');
// $(".theme_list > li").removeClass('thmc1').data('clicked',null).find('.theme_name').removeClass('thmtxt');
// $(this).addClass('thmc1').data('clicked',true).find('.theme_name').addClass('thmtxt');
$.post("/desktop/save_desktop_settings",{"save":"theme","desktopid":o.desktopId,"theme":$(this).attr("id")},function(result,status){
if(status=="success"){
if(result[0].success=="true")
@@ -508,6 +508,19 @@ var orbitDesktop = function(dom){
}
});
});
$('.ssl .ssl_item').each(function(){
$(this).on({
click: function(){
$(this).switchClass('','thmc1 active',300);
$(this).siblings('.thmc1').switchClass('thmc1 active','',100);
if( $(this).find('.ssl_des') ){
$(this).parents('.ssl').find('.ssl_des').removeClass('thmtxt');
$(this).find('.ssl_des').addClass('thmtxt');
}
}
});
});
$('.tinycanvas').each(function(){
var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height();
@@ -585,6 +598,28 @@ var orbitDesktop = function(dom){
})
}
var loadthmc = function(){
$('.color-picker').each(function(){
var cc = $(this).attr('for'), hex, color;
switch(cc){
case 'thmtxt':
case 'thmtxth':
hex = 'color';
break;
case 'g_sep':
hex = 'border-left-color';
break;
default:
hex = 'background-color';
break;
}
if(cc=="background")
color = $("#theme_preview_area").css("background-color");
else
color = $('#theme_preview_area .'+cc).css(hex);
$(this).miniColors("value", o.rgb2hex(color));
});
}
$("div#settings div#panel_r").load("/desktop/settingthemes",function(){
$.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){
$("#st1 ul.theme_list li#"+theme).addClass("thmc1").find("span").addClass("thmtxt");
+8 -1
View File
@@ -55,5 +55,12 @@ var orbitDesktopAPI = function(){
var A = key(a), B = key(b);
return ((A < B) ? -1 : (A > B) ? +1 : 0) * [-1,1][+!!reverse];
}
}
};
this.rgb2hex = function(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = function(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
};
};