Msg box added and background image saving complete
This commit is contained in:
1 parent
b4bf81d40a
commit
4bad25e682
6 files changed
+117
-55
No files matched your search
@@ -1,5 +1,20 @@
|
||||
// JavaScript Document
|
||||
//harry
|
||||
//harry
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
$.fn.sort = function(c) {
|
||||
return this.pushStack([].sort.apply(this, arguments), []);
|
||||
};
|
||||
var sortAscending = function(a, b) {
|
||||
return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1;
|
||||
};
|
||||
var sortDescending = function(a, b) {
|
||||
return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1;
|
||||
};
|
||||
|
||||
var orbitDesktop = function(dom){
|
||||
orbitDesktopAPI.apply(this);
|
||||
o = this;
|
||||
@@ -25,18 +40,18 @@ var orbitDesktop = function(dom){
|
||||
custom = true;
|
||||
}
|
||||
o.theme = theme;
|
||||
loadTheme(desktopSettings.customtheme);
|
||||
loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper);
|
||||
}else{loadTheme();}
|
||||
})
|
||||
var loadTheme = function(dhtml){
|
||||
var loadTheme = function(customtheme,customwallpaper){
|
||||
$.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);
|
||||
$("head").append(customtheme);
|
||||
}
|
||||
$(document).ready(function(){o.loadWallpaper();o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
|
||||
$(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
|
||||
})
|
||||
}
|
||||
};
|
||||
@@ -263,7 +278,9 @@ var orbitDesktop = function(dom){
|
||||
}
|
||||
};
|
||||
this.tempFunc = function(th){
|
||||
|
||||
o.confirm("What","","",function(reply){
|
||||
alert(reply);
|
||||
})
|
||||
}
|
||||
this.initializeAppSearch = function(target){
|
||||
o.currenthtml = target;
|
||||
@@ -602,25 +619,33 @@ var orbitDesktop = function(dom){
|
||||
});
|
||||
|
||||
$("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']+";} body{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);
|
||||
o.confirm("Are you sure that you want to set this custom theme?",["Yes","No"],3,function(reply){
|
||||
if(reply){
|
||||
var colors = new Array;
|
||||
$("#color_input 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']+";} body{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);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(".stock_wallpaper .ssl_item").click(function(){
|
||||
var wallpapername = $(this).find("img").attr("alt");
|
||||
o.changeWallpaper(wallpapername);
|
||||
})
|
||||
|
||||
}
|
||||
var loadthmc = function(){
|
||||
$('.color-picker').each(function(){
|
||||
@@ -658,17 +683,19 @@ var orbitDesktop = function(dom){
|
||||
themes();
|
||||
});
|
||||
};
|
||||
|
||||
this.loadWallpaper = function(wallpaper){
|
||||
if(!wallpaper)wallpaper = o.themesettings.background;
|
||||
if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper
|
||||
var ww = $(window).width();
|
||||
var wh = $(window).height();
|
||||
if(o.themesettings.background)
|
||||
$("img#thmbackground").attr({"src":"/"+o.themefolder+"/"+o.theme+"/images/"+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"});
|
||||
if(!wallpaper)
|
||||
$("img#thmbackground").attr({"src":"/"+o.themefolder+"/"+o.theme+"/images/"+wallpapernm,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"});
|
||||
else
|
||||
$("img#thmbackground").attr({"src":"/"+"images/"+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"});
|
||||
$("img#thmbackground").attr({"src":o.wallpaperPath+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"});
|
||||
|
||||
$("div#bgover").css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","width":ww,"height":wh});
|
||||
};
|
||||
|
||||
this.loadIconCache = function(){
|
||||
var imgs = $("ul.docklist img");
|
||||
$.each(imgs,function(){
|
||||
@@ -690,6 +717,18 @@ var orbitDesktop = function(dom){
|
||||
|
||||
})
|
||||
};
|
||||
this.saveWallpaper = function(wallpaper){
|
||||
$.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result,status){
|
||||
if(status=="success"){
|
||||
if(result[0].success=="true")
|
||||
o.notify("Wallpaper saved!!","success",2);
|
||||
else
|
||||
o.notify("Wallpaper saving failed!!","imp",2);
|
||||
}else{
|
||||
o.notify("Connection problem!!","alert",2);
|
||||
}
|
||||
})
|
||||
}
|
||||
o.initialize();
|
||||
}
|
||||
|
||||
@@ -697,6 +736,7 @@ orbitDesktop.prototype.themefolder = "themes";
|
||||
orbitDesktop.prototype.widgetfolder = "desktop_widgets";
|
||||
orbitDesktop.prototype.desktopId = "1";
|
||||
orbitDesktop.prototype.notifyImgPath = "temp";
|
||||
orbitDesktop.prototype.wallpaperPath = "/assets/stockBackground/";
|
||||
orbitDesktop.prototype.iconPath = "/assets/icons/";
|
||||
orbitDesktop.prototype.currentLanguage = "en";
|
||||
var uselessfunction = function(){
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
// JavaScript Document
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
$.fn.sort = function(c) {
|
||||
return this.pushStack([].sort.apply(this, arguments), []);
|
||||
};
|
||||
var sortAscending = function(a, b) {
|
||||
return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1;
|
||||
};
|
||||
var sortDescending = function(a, b) {
|
||||
return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1;
|
||||
};
|
||||
//Harry Bomrah
|
||||
var orbitDesktopAPI = function(){
|
||||
o = this;
|
||||
this.notify = function(msg,type,time){
|
||||
@@ -63,4 +50,35 @@ var orbitDesktopAPI = function(){
|
||||
}
|
||||
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
|
||||
};
|
||||
this.changeWallpaper = function(wallpaper){
|
||||
$("img#thmbackground").attr("src",o.wallpaperPath+wallpaper);
|
||||
o.saveWallpaper(wallpaper);
|
||||
};
|
||||
this.confirm = function(msg,btnvalues,highlighted,callbackfn){
|
||||
if(!btnvalues)btnvalues=["Ok","Cancel"];
|
||||
if(highlighted!=1 || highlighted!=2)highlighted=2;
|
||||
if(!msg)msg = "Are you sure?"
|
||||
var $confirm = $("#orbitdiag");
|
||||
$confirm.find(".diag_action a").addClass("admbg admtxt");
|
||||
$confirm.find(".diag_message").text(msg);
|
||||
if(highlighted == 1)
|
||||
$confirm.find("#diag_confirm").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
|
||||
if(highlighted == 2)
|
||||
$confirm.find("#diag_cancel").removeClass("admbg admtxt").addClass("thmc1 thmtxt");
|
||||
$confirm.find("#diag_confirm").text(btnvalues[0]).one("click",function(){
|
||||
$confirm.hide();
|
||||
$confirm.find(".diag_action a").unbind();
|
||||
if(typeof callbackfn=="function")
|
||||
callbackfn.call(this,true);
|
||||
});
|
||||
$confirm.find("#diag_cancel").text(btnvalues[1]).one("click",function(){
|
||||
$confirm.hide();
|
||||
$confirm.find(".diag_action a").unbind();
|
||||
if(typeof callbackfn=="function")
|
||||
callbackfn.call(this,false);
|
||||
});
|
||||
$confirm.show();
|
||||
}
|
||||
};
|
||||
orbitDesktopAPI.prototype.notifyImgPath = "temp";
|
||||
orbitDesktopAPI.prototype.wallpaperPath = "temp";
|
||||
Reference in new issue
Block a user