Custom thème done and theme id done…
This commit is contained in:
1 parent
b2d72902c3
commit
95a1e266ae
229 files changed
+100
-27
No files matched your search
@@ -5,7 +5,7 @@ var orbitDesktop = function(dom){
|
||||
o = this;
|
||||
this.contentHolder = dom;
|
||||
this.themesettings = "";
|
||||
this.theme = "default";
|
||||
this.theme = "4f8d3f493b67fcd05f086359";
|
||||
// this.themefolder = "themes";
|
||||
this.transitionTime = 500;
|
||||
this.currenthtml = "desktop.html";
|
||||
@@ -15,17 +15,27 @@ var orbitDesktop = function(dom){
|
||||
this.sectionList;
|
||||
this.initialize = function(){
|
||||
var theme = o.theme;
|
||||
var custom = false;
|
||||
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
|
||||
if(desktopSettings){
|
||||
theme = desktopSettings.theme;
|
||||
if(desktopSettings.theme!="custom"){
|
||||
theme = desktopSettings.theme;
|
||||
}else{
|
||||
theme = "4f8d3f493b67fcd05f086359";
|
||||
custom = true;
|
||||
}
|
||||
o.theme = theme;
|
||||
loadTheme();
|
||||
loadTheme(desktopSettings.customtheme);
|
||||
}else{loadTheme();}
|
||||
})
|
||||
var loadTheme = function(){
|
||||
var loadTheme = function(dhtml){
|
||||
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
|
||||
o.themesettings = eval(ts);
|
||||
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
|
||||
if(custom){
|
||||
$("head").find("#dyn_css").remove();
|
||||
$("head").append(dhtml);
|
||||
}
|
||||
$(document).ready(function(){o.loadWallpaper();o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
|
||||
})
|
||||
}
|
||||
@@ -422,6 +432,7 @@ var orbitDesktop = function(dom){
|
||||
o.currentface = "settings";
|
||||
var bindHandlers = function(){
|
||||
$("div#settings ul#setting_left_nav li a").click(function(){
|
||||
if(!$(this).data("clicked")){
|
||||
var tfunc = $(this).attr("href");
|
||||
switch(tfunc){
|
||||
case "themes":
|
||||
@@ -433,6 +444,7 @@ var orbitDesktop = function(dom){
|
||||
}
|
||||
$("div#settings ul#setting_left_nav li a").removeClass('thmc1 thmtxt').data('clicked',null);
|
||||
$(this).addClass('thmc1 thmtxt').data('clicked',true);
|
||||
}
|
||||
});
|
||||
$("div#settings ul#setting_left_nav li a").hover(function(){
|
||||
$(this).removeClass('admtxt').addClass('thmc1 thmtxt');
|
||||
@@ -482,10 +494,10 @@ var orbitDesktop = function(dom){
|
||||
var themes = function(){
|
||||
var bindHandlers = function(){
|
||||
$(".theme_list > li").click(function(){
|
||||
o.changeTheme($(this).find('.theme_name').text());
|
||||
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');
|
||||
$.post("/desktop/save_desktop_settings",{"save":"theme","desktopid":o.desktopId,"theme":$(this).text()},function(result,status){
|
||||
$.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")
|
||||
o.notify("Theme Saved!!","success",2);
|
||||
@@ -516,7 +528,33 @@ var orbitDesktop = function(dom){
|
||||
return false;
|
||||
});
|
||||
});
|
||||
$('.color-picker').miniColors();
|
||||
/* $("tr#color_inputs input").each(function(){
|
||||
var what = $(this).attr("for");
|
||||
alert($("#theme_preview_area ."+what).css("background-color"))
|
||||
$(this).val()
|
||||
}) */
|
||||
|
||||
$('.color-picker').miniColors({
|
||||
change:function(hex){
|
||||
var changewhat = $(this).attr("for");
|
||||
var previewarea = $("#theme_preview_area");
|
||||
switch(changewhat){
|
||||
case "thmtxt":
|
||||
case "thmtxth":
|
||||
previewarea.find("."+changewhat).css({"color":hex});
|
||||
break;
|
||||
case "g_sep":
|
||||
previewarea.find("."+changewhat).css({"border-color":hex});
|
||||
break;
|
||||
case "background":
|
||||
previewarea.css({"background-color":hex});
|
||||
break;
|
||||
default:
|
||||
previewarea.find("."+changewhat).css({"background-color":hex});
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
$('.theme_list li:first-child').data('clicked',true); // this line just for demo
|
||||
$('.theme_list li').hover(function(){
|
||||
$(this).addClass('thmc1').find('.theme_name').addClass('thmtxt');
|
||||
@@ -525,11 +563,31 @@ var orbitDesktop = function(dom){
|
||||
t = $(this).data('clicked') ? '' : 'thmtxt';
|
||||
$(this).removeClass(c).find('.theme_name').removeClass(t);
|
||||
});
|
||||
|
||||
$("a#theme_submit").click(function(){
|
||||
var colors = new Array;
|
||||
$("tr#color_inputs input").each(function(){
|
||||
colors[$(this).attr("for")] = $(this).val();
|
||||
})
|
||||
var dhtml ="<style> .thmc1 { background: "+colors['thmc1']+"; }.thmc2 { background: "+colors['thmc2']+"; }.thmc3 { background: #FFFFFF; }.thmc4 { background: "+colors['thmc4']+"; }.thmtxt { color: "+colors['thmtxt']+"; }.thmtxth { color: "+colors['thmtxth']+"; }.g_sep { border-color: "+colors['g_sep']+"; #thmbackground{background-color: "+colors['background']+"} }</style>";
|
||||
$("head").find("#dyn_css").remove();
|
||||
$("head").append(dhtml);
|
||||
$.post("/desktop/save_desktop_settings",{"save":"customtheme","desktopid":o.desktopId,"theme":dhtml},function(result,status){
|
||||
if(status=="success"){
|
||||
if(result[0].success=="true")
|
||||
o.notify("Custom theme saved!!","success",2);
|
||||
else
|
||||
o.notify("Custom theme saving failed!!","imp",2);
|
||||
}else{
|
||||
o.notify("Connection problem!!","alert",2);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
$("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:containsi("+theme+")").addClass("thmc1").find("span").addClass("thmtxt");
|
||||
$("#st1 ul.theme_list li#"+theme).addClass("thmc1").find("span").addClass("thmtxt");
|
||||
bindHandlers();
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user