Merge branch 'desktop_harry' into desktop_devin
This commit is contained in:
commit
1a9fa8f505
53 files changed
+358
-337
No files matched your search
@@ -26,7 +26,7 @@ var orbitDesktop = function(dom){
|
||||
this.transitionTime = 500;
|
||||
this.currenthtml = "desktop.html";
|
||||
this.currentface = "home";
|
||||
this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":""};
|
||||
this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":""};
|
||||
this.tp = "";
|
||||
this.sectionList;
|
||||
this.initialize = function(){
|
||||
@@ -55,7 +55,7 @@ var orbitDesktop = function(dom){
|
||||
$(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
this.changeTheme = function(theme){ // this function is used for changing theme
|
||||
o.theme = theme;
|
||||
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
|
||||
@@ -112,6 +112,15 @@ var orbitDesktop = function(dom){
|
||||
});
|
||||
}
|
||||
});
|
||||
$("a#d_appstore").click(function(){
|
||||
var target = $(this).attr("href");
|
||||
if(o.currenthtml!=target){
|
||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
||||
$("#content").hide("drop",o.transitionTime,function(){
|
||||
o.initializeAppstore(target);
|
||||
});
|
||||
}
|
||||
});
|
||||
$(window).resize(function(){
|
||||
var ww = $(window).width();
|
||||
$("img#thmbackground").attr({"width":ww});
|
||||
@@ -314,9 +323,7 @@ var orbitDesktop = function(dom){
|
||||
};
|
||||
|
||||
this.tempFunc = function(th){
|
||||
o.confirm("What","","",function(reply){
|
||||
alert(reply);
|
||||
})
|
||||
$.post("desktop/twitter",function(){});
|
||||
};
|
||||
|
||||
this.initializeAppSearch = function(target){ //this is application search ie is app manager initialization
|
||||
@@ -1020,7 +1027,7 @@ var orbitDesktop = function(dom){
|
||||
bindSecondaryHandlers();
|
||||
}
|
||||
|
||||
$("div#settings div#panel_r").load("/desktop/journal_p_list",function(){
|
||||
$("div#journal_p div#panel_r").load("/desktop/journal_p_list",function(){
|
||||
$.getJSON("/desktop_publications/getjournals",function(journals){
|
||||
journalData = eval(journals);
|
||||
journalview();
|
||||
@@ -1048,7 +1055,7 @@ var orbitDesktop = function(dom){
|
||||
.delay(1500)
|
||||
.addClass('op00', 500);
|
||||
}
|
||||
$("div#settings div#panel_r").load("/desktop/journal_p_add",function(){
|
||||
$("div#journal_p div#panel_r").load("/desktop/journal_p_add",function(){
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
@@ -1064,6 +1071,161 @@ var orbitDesktop = function(dom){
|
||||
list();
|
||||
}
|
||||
};
|
||||
this.initializeAppstore = function(target){
|
||||
o.currenthtml = target;
|
||||
o.currentface = "appstore";
|
||||
var bindHandlers = function(){
|
||||
$('.s_menu a').on({
|
||||
click: function(){
|
||||
if(!$(this).hasClass('active')){
|
||||
var tfunc = $(this).attr('href');
|
||||
switch(tfunc){
|
||||
case 'widgets':
|
||||
widgets();
|
||||
break;
|
||||
}
|
||||
$('.s_menu a').removeClass('thmc1 thmtxt active');
|
||||
$(this).addClass('thmc1 thmtxt active');
|
||||
}
|
||||
},
|
||||
mouseenter: function(){
|
||||
if(!$(this).hasClass('active')){
|
||||
$(this).switchClass('admtxt','thmc1 thmtxt',0);
|
||||
}
|
||||
},
|
||||
mouseleave: function(){
|
||||
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
|
||||
$(this).switchClass(t,'admtxt',0);
|
||||
}
|
||||
});
|
||||
}
|
||||
var widgets = function(){
|
||||
var bindHandlers = function(){
|
||||
$("#widget_list a").click(function(){
|
||||
var sectionid = $(this).attr("for");
|
||||
var widgetid = $(this).parent().parent().attr("for");
|
||||
switch($(this).attr("href")){
|
||||
case "addthis":
|
||||
$this = $(this);
|
||||
o.confirm({
|
||||
message: "Are you sure you want to add this widget?",
|
||||
buttons: ['Yes','No'],
|
||||
highlighted: 1
|
||||
},function(reply){
|
||||
if(reply){
|
||||
$.post("desktop_appstore/widgets_settings",{section:sectionid, widget:widgetid, what:"add"},function(result){
|
||||
if(result[0].success){
|
||||
$this.attr("href","removethis");
|
||||
$targetDom = $this.parent().parent().find("div.status");
|
||||
$parentDom = $this.parent();
|
||||
if($targetDom.find("a").length == 0)
|
||||
$targetDom.html("Status : Installed on");
|
||||
$targetDom.append(" ").append($this);
|
||||
if($parentDom.find("a").length == 0)
|
||||
$parentDom.empty();
|
||||
o.desktopData["home"]="";
|
||||
o.notify("Widget added.","success",2);
|
||||
}else{
|
||||
o.notify(result[0].error,"imp",2);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
break;
|
||||
case "removethis":
|
||||
$this = $(this);
|
||||
o.confirm({
|
||||
message: "Are you sure you want to remove this widget?",
|
||||
buttons: ['Yes','No'],
|
||||
highlighted: 2
|
||||
},function(reply){
|
||||
if(reply){
|
||||
$.post("desktop_appstore/widgets_settings",{section:sectionid, widget:widgetid, what:"remove"},function(result){
|
||||
if(result[0].success){
|
||||
$this.attr("href","addthis");
|
||||
$targetDom = $this.parent().parent().find("div.not_status");
|
||||
$parentDom = $this.parent();
|
||||
if($targetDom.html()=="")
|
||||
$targetDom.html("Install on");
|
||||
$targetDom.append(" ").append($this);
|
||||
if($parentDom.find("a").length == 0)
|
||||
$parentDom.html("Status : Downloaded");
|
||||
o.desktopData["home"]="";
|
||||
o.notify("Widget removed.","success",2);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
$("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){
|
||||
$.getJSON("/desktop_appstore/getuserwidgets",function(userwidgets){
|
||||
var column = $('<div class="g_col list_t" style="width:350px;"><ul></ul></div>'),
|
||||
counter = 1,
|
||||
li;
|
||||
$.each(userwidgets,function(i,widge){
|
||||
if(!widge.status)widge.status = "Downloaded";
|
||||
var brick = widge.shape.split(' '),
|
||||
bw = parseInt(brick[0].substr(1)),
|
||||
bh = parseInt(brick[1].substr(1)),
|
||||
shp = bw+" X "+bh;
|
||||
li = $('<li class="list_t_item" for="'+widge._id+'"><div class="list_t_title">'+widge.name+'</div><div class="list_t_des">Author : '+widge.author+'</div><div class="list_t_des">Shape : '+shp+'</div><div class="list_t_des status">Status : '+widge.status+'</div><div class="list_t_des not_status"></div></li>');
|
||||
var cur_section_names = new Array();
|
||||
var section_names = new Array();
|
||||
var section_links = new Array();
|
||||
if(widge.section){
|
||||
var s_name_list = "";
|
||||
$.each(widge.section,function(x,sec){
|
||||
$.each(o.sectionList,function(j,s){
|
||||
if(s._id==sec){
|
||||
cur_section_names.push(s.name);
|
||||
s_name_list+= "<a href='removethis' for='"+s._id+"' style='text-decoration:underline;'>"+s.name +"</a> ";
|
||||
}
|
||||
})
|
||||
})
|
||||
var section_names = o.getArrayfromJson(o.sectionList,"name");
|
||||
var section_links = o.getArrayfromJson(o.sectionList,"_id");
|
||||
var s_name_list_not = "";
|
||||
$.each(section_names,function(j,sec_name){
|
||||
if($.inArray(sec_name,cur_section_names)==-1){
|
||||
var sec_link = section_links[j];
|
||||
s_name_list_not+= "<a href='addthis' for='"+sec_link+"' style='text-decoration:underline;'>"+sec_name+"</a> ";
|
||||
}
|
||||
})
|
||||
li.find("div.status").html("Status : Installed on "+s_name_list);
|
||||
if(s_name_list_not)
|
||||
li.find("div.not_status").html("Install on "+s_name_list_not);
|
||||
}else{
|
||||
li.find("div.not_status").html("Install on "+o.sectionList[0].name+", "+o.sectionList[1].name+", "+o.sectionList[2].name+", "+o.sectionList[3].name);
|
||||
}
|
||||
//console.log(section_names);
|
||||
column.find("ul").append(li);
|
||||
if(counter%4==0){
|
||||
$("#apps_store div#widget_list").append(column);
|
||||
column = $('<div class="g_col list_t" style="width:350px;"><ul></ul></div>');
|
||||
}
|
||||
counter++;
|
||||
})
|
||||
$("#apps_store div#widget_list").append(column);
|
||||
bindHandlers();
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if(!o.desktopData[o.currentface]){
|
||||
$(o.contentHolder).empty().load("/desktop_appstore/"+target,function(){
|
||||
widgets();
|
||||
bindHandlers();
|
||||
});
|
||||
}else{
|
||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||
widgets();
|
||||
bindHandlers();
|
||||
}
|
||||
}
|
||||
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
|
||||
if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper
|
||||
var ww = $(window).width();
|
||||
|
||||
@@ -79,6 +79,13 @@ var orbitDesktopAPI = function(){
|
||||
});
|
||||
$confirm.stop(1,1).fadeIn();
|
||||
};
|
||||
this.getArrayfromJson = function(tjson,key){
|
||||
var tempArray = new Array;
|
||||
$.each(tjson,function(i,val){
|
||||
tempArray.push(val[key]);
|
||||
})
|
||||
return tempArray;
|
||||
}
|
||||
};
|
||||
orbitDesktopAPI.prototype.notifyImgPath = "temp";
|
||||
orbitDesktopAPI.prototype.wallpaperPath = "temp";
|
||||
Reference in new issue
Block a user