orbit-basic/app/assets/javascripts/orbitdesktop.js

1117 lines
40 KiB
JavaScript
Raw Normal View History

2012-05-02 09:05:40 +00:00
2012-03-28 10:53:30 +00:00
// JavaScript Document
//harry
2012-04-24 08:45:26 +00:00
//Inititialize function will initialize desktop
$.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;
};
2012-03-28 10:53:30 +00:00
var orbitDesktop = function(dom){
orbitDesktopAPI.apply(this);
o = this;
this.contentHolder = dom;
this.themesettings = "";
this.theme = "4f8d3f493b67fcd05f086359";
2012-03-28 10:53:30 +00:00
this.transitionTime = 500;
this.currenthtml = "desktop.html";
this.currentface = "home";
2012-04-24 08:45:26 +00:00
this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":""};
2012-03-28 10:53:30 +00:00
this.tp = "";
2012-04-12 06:44:08 +00:00
this.sectionList;
2012-03-28 10:53:30 +00:00
this.initialize = function(){
2012-04-05 12:32:56 +00:00
var theme = o.theme;
var custom = false;
2012-04-12 14:18:58 +00:00
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
2012-04-05 12:32:56 +00:00
if(desktopSettings){
if(desktopSettings.theme!="custom"){
theme = desktopSettings.theme;
}else{
theme = "4f8d3f493b67fcd05f086359";
custom = true;
}
2012-04-06 09:24:39 +00:00
o.theme = theme;
loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper);
2012-04-06 09:24:39 +00:00
}else{loadTheme();}
2012-03-28 10:53:30 +00:00
})
2012-04-24 08:45:26 +00:00
var loadTheme = function(customtheme,customwallpaper){ //This function will load the theme from database
2012-04-06 09:24:39 +00:00
$.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(customtheme);
}
$(document).ready(function(){o.loadWallpaper(customwallpaper);o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
2012-04-06 09:24:39 +00:00
})
}
2012-03-28 10:53:30 +00:00
};
2012-04-24 08:45:26 +00:00
this.changeTheme = function(theme){ // this function is used for changing theme
2012-03-28 10:53:30 +00:00
o.theme = theme;
2012-03-29 07:23:48 +00:00
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
2012-03-28 10:53:30 +00:00
o.themesettings = eval(ts);
$('head').find("#dyn_css").remove();
2012-03-30 10:06:06 +00:00
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
2012-03-28 10:53:30 +00:00
o.loadWallpaper();
o.loadIconCache();
})
};
2012-04-24 08:45:26 +00:00
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
2012-04-04 18:31:32 +00:00
$("a#d_app_manager").click(function(){
2012-03-28 10:53:30 +00:00
var target = $(this).attr("href");
if(o.currenthtml!=target){
o.desktopData[o.currentface] = $(o.contentHolder).html();
$("#content").hide("drop",o.transitionTime,function(){
o.initializeAppSearch(target);
});
}
});
2012-04-04 18:31:32 +00:00
$("a#d_desktop").click(function(){
2012-03-28 10:53:30 +00:00
var target = $(this).attr("href");
if(o.currenthtml!=target){
o.desktopData[o.currentface] = $(o.contentHolder).html();
$("#content").hide("drop",o.transitionTime,function(){
o.initializeDesktop(target);
});
}
});
2012-04-04 18:31:32 +00:00
$("a#d_sections").click(function(){
2012-03-28 10:53:30 +00:00
var target = $(this).attr("href");
if(o.currenthtml!=target){
o.desktopData[o.currentface] = $(o.contentHolder).html();
$("#content").hide("drop",o.transitionTime,function(){
o.initializeSectionsManager(target);
});
}
});
2012-04-24 08:45:26 +00:00
$("#d_journal_p").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.initializeJournalPapers(target);
});
}
});
2012-04-05 12:09:01 +00:00
$("a#d_settings").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.initializeSettings(target);
2012-04-05 12:09:01 +00:00
});
}
});
2012-03-28 10:53:30 +00:00
$(window).resize(function(){
var ww = $(window).width();
2012-04-03 10:25:41 +00:00
$("img#thmbackground").attr({"width":ww});
2012-05-02 09:04:16 +00:00
if( $('.tinycanvas') ){ $('.tinycanvas').tinyscrollbar_update(); }
2012-03-28 10:53:30 +00:00
});
2012-04-11 07:31:10 +00:00
var $widget_fn = $('.widget_fn'),$fn_des = $('.fn_des');
$widget_fn.hover(function(){
var fn_name = $(this).find('img').attr('alt'),nth = $(this).parents('.d_cate').index(),des_left = $('.dock_child').eq(nth).width();
$(this).addClass('thmc1');
$fn_des.text(fn_name).css({'top':nth * 60,'left': des_left + 60}).stop(true, true).fadeIn();
},function(){
$(this).removeClass('thmc1');
$fn_des.stop(true, true).fadeOut();
2012-03-28 10:53:30 +00:00
});
};
2012-04-24 08:45:26 +00:00
this.initializeDesktop = function(target){ //this is for initializing main desktops that are sections and tiles
2012-03-29 07:23:48 +00:00
if(!target)target = "desktop";
2012-03-28 10:53:30 +00:00
o.currenthtml = target;
o.currentface = "home";
2012-04-11 07:31:10 +00:00
2012-04-24 08:45:26 +00:00
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
2012-04-29 22:41:05 +00:00
var groupWrapperWidth = 0;
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
2012-04-30 06:33:12 +00:00
2012-04-12 14:18:58 +00:00
$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
2012-05-02 09:05:40 +00:00
var first = true;
2012-04-29 22:41:05 +00:00
$("div#desktop .g_col").sortable({
connectWith: ".g_col",
2012-03-28 10:53:30 +00:00
tolerance: 'pointer' ,
2012-04-29 22:41:05 +00:00
revert: 300,
containment: '#group_wrapper',
helper: 'clone',
2012-03-28 10:53:30 +00:00
stop:function(){
2012-05-02 09:05:40 +00:00
first = true;
},
update:function(){
2012-05-02 09:05:40 +00:00
if(first){
first = false;
var newpostitions = new Array;
var groupids = new Array;
$.each($("div#desktop .group"),function(i,grp){
var groupone = new Array;
groupids.push($(grp).attr("id"));
$ul = $(grp).find(".g_col .element");
$.each($ul,function(){
groupone.push($(this).attr("id"));
})
newpostitions.push(groupone);
});
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
}
var s = $(this).find('.element').length;
if(s!=0){
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(this).sortable('cancel');
}
}else{$(this).remove();}
2012-04-29 22:41:05 +00:00
},
receive: function(event, ui){
var s = $(this).find('.element').length,
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(ui.sender).sortable('cancel');
}
2012-03-28 10:53:30 +00:00
}
});
2012-04-18 05:17:12 +00:00
$('div#desktop .tinycanvas')
.tinyscrollbar({ axis: 'x' })
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
// simple dropdown menu
var $sdm = $('.sdm');
if( !$sdm.children('.sdm_o') ){
return;
} else {
$sdm.hover(function(){
$(this).addClass('thmc2');
}, function(){
$(this).removeClass('thmc2');
});
}
2012-04-11 07:31:10 +00:00
2012-04-24 08:45:26 +00:00
}
var loadTiles = function(id){ //This will load tiles for a specific desktop .. id of section has to be passed here to load tiles
$("div#desktop div#group_wrapper").empty();
$.getJSON("/desktop/getgroups",{sectionid:id},function(groups){
var tilecolors = o.themesettings.tilecolor;
var opacity = ["op05","op06","op07","op08","op09"];
$.each(groups,function(i,group){
group.sort(o.sortJSON("position",true,parseInt));
2012-04-29 22:41:05 +00:00
// var $group = $('<div class="group"><ul class="grp ui-sortable"></ul></div>'),
var colindex = 0,
$group = $('<div class="group"></div>'),
$col = $('<ul class="g_col g_col_w2 col'+ colindex +'"/>'),
$li,
bdsum = 0,
bwsum = 0,
bhsum = 0,
small = 0,
single = false;
2012-04-29 22:41:05 +00:00
$group.append($col);
for(j=0;j<group.length;j++){
var tile = group[j];
2012-04-29 22:41:05 +00:00
var brick = tile.shape.replace(' holder_f','').split(' '),
bw = parseInt(brick[0].substr(1)),
bh = parseInt(brick[1].substr(1)),
bd = bw * bh;
if(bh==1 && bw==1){
small++;
}else if(bh!=1 && bw!=1){
single = true;
2012-05-02 09:05:40 +00:00
}
if(small==2){
small=0;
single=false;
}else if(small==1 && single==true){
bh++;
small=0;
single=false;
}else{small=0;single=false;}
2012-04-29 22:41:05 +00:00
bdsum+=bd;
bwsum+=bw;
bhsum+=bh;
if(bdsum > 8 || bhsum > 6){
bdsum = 0, bhsum = 0, colindex++,j--;
2012-04-29 22:41:05 +00:00
$group.append('<ul class="g_col g_col_w2 col'+ colindex +'"/>');
}else{
var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
var op = opacity[Math.floor(Math.random()*opacity.length)];
if(j==0)$group.attr("id",tile.group_id);
if(tile.data_category == "app")
$li = $('<li id="'+tile._id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile._id+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
else
$li = $('<li id="'+tile._id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
$group.find('.col'+colindex).append($li);
2012-04-29 22:41:05 +00:00
}
}
2012-04-24 08:45:26 +00:00
$("div#desktop div#group_wrapper").append($group);
2012-04-11 07:31:10 +00:00
})
2012-04-24 08:45:26 +00:00
bindHandlers();
o.initializeWidgets();
})
}
var loadSectionList = function(){ //This will load the section list from the db
$.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){
o.sectionList = eval(sectionlist);
$.each(sectionlist,function(i,section){
var tempstyle="";
if(i==0){
tempstyle = "style='display:none;'";
2012-04-27 06:04:11 +00:00
$("#desktop #section_heading").text(section.name);
2012-04-24 08:45:26 +00:00
}
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh2" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
2012-04-11 07:31:10 +00:00
})
2012-04-24 08:45:26 +00:00
bindSecondaryHandlers();
})
}
var bindSecondaryHandlers = function(){ //This is the secondary bind handler function which is used to bind events which are repeatative
2012-04-12 14:18:58 +00:00
$("div#desktop ul#section_list li.section_name").click(function(){
$("div#desktop li.section_name").show();
2012-04-11 07:31:10 +00:00
$(this).hide();
2012-04-29 22:41:05 +00:00
$("#desktop #section_heading").text($(this).text());
o.sectionId = $(this).find("a").attr("href");
loadTiles(o.sectionId);
2012-04-11 07:31:10 +00:00
})
}
2012-03-28 10:53:30 +00:00
if(!o.desktopData[o.currentface]){
2012-03-29 07:23:48 +00:00
$(o.contentHolder).empty().load("/desktop/"+target,function(){
2012-04-11 07:31:10 +00:00
loadTiles(o.sectionId);
loadSectionList();
2012-03-28 10:53:30 +00:00
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
2012-04-11 07:31:10 +00:00
bindHandlers();
o.initializeWidgets();
bindSecondaryHandlers();
2012-04-12 16:00:24 +00:00
$("div#desktop ul#section_list").empty();
$.each(o.sectionList,function(i,section){
var tempstyle="";
2012-04-23 13:04:02 +00:00
if(section._id==o.sectionId){
2012-04-12 16:00:24 +00:00
tempstyle = "style='display:none;'";
$("div#desktop span#section_heading").text(section.name);
}
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh2" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
})
bindSecondaryHandlers();
2012-03-28 10:53:30 +00:00
}
};
2012-04-24 08:45:26 +00:00
2012-04-11 07:22:05 +00:00
this.tempFunc = function(th){
o.confirm("What","","",function(reply){
alert(reply);
})
2012-04-24 08:45:26 +00:00
};
this.initializeAppSearch = function(target){ //this is application search ie is app manager initialization
2012-03-28 10:53:30 +00:00
o.currenthtml = target;
o.currentface = "apps_manager";
var searchArray,allApps;
2012-04-24 08:45:26 +00:00
var bindHandlers = function(){ // bind handler for app manager page
2012-04-29 22:41:05 +00:00
var gn = $('.g_col').length,
gw = $('.g_col').outerWidth(true);
$("#app_manager #group_wrapper").css("width",gn*gw);
// $("div#app_manager .group_search").css("width",$(window).width()-200);
2012-03-28 10:53:30 +00:00
//for textbox search
2012-04-29 22:41:05 +00:00
$("#app_manager #searchbox").focus(function(){$(this).val("");}).keyup(function(e){
2012-03-28 10:53:30 +00:00
if($(this).val()){
2012-04-12 14:18:58 +00:00
$("div#app_manager .search_result").empty();
$("div#app_manager #seperator").hide();
searchArray = $("div#app_manager .element:containsi("+$(this).val()+")");
2012-03-28 10:53:30 +00:00
if(searchArray.length>0){
2012-04-12 14:18:58 +00:00
$("div#app_manager #seperator").show();
2012-03-28 10:53:30 +00:00
searchArray.each(function(){
var $newelement = $('<div class="search element w1 h1 hp vp thmc2" data-category="desktop">'+$(this).html()+'</div>');
2012-04-12 14:18:58 +00:00
$("div#app_manager .search_result").prepend($newelement);
2012-03-28 10:53:30 +00:00
})
}
2012-04-12 14:18:58 +00:00
}else{$("div#app_manager #seperator").hide();$("div#app_manager .search_result").empty();}
2012-03-28 10:53:30 +00:00
}).blur(function(){$(this).val("Search");});
//for Alphabet sorting
2012-04-12 14:18:58 +00:00
$("div#app_manager a#alphabet_sort_btn").click(function(){
2012-04-11 07:31:10 +00:00
switch ($(this).attr("href")){
2012-03-28 10:53:30 +00:00
case "ascending":
$(this).attr("href","descending").find(".thmtxt").text("Alphabet [Z-A]");
2012-04-12 14:18:58 +00:00
allApps = $("div#app_manager .group_search .element").sort(sortAscending);
2012-03-28 10:53:30 +00:00
break;
case "descending":
$(this).attr("href","ascending").find(".thmtxt").text("Alphabet [A-Z]");
2012-04-12 14:18:58 +00:00
allApps = $("div#app_manager .group_search .element").sort(sortDescending);
2012-03-28 10:53:30 +00:00
break;
}
$("div#app_manager #app_list").empty();
var count = 0, colindex = 0;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
$.each(allApps,function(i,app){
count++;
if( count > 4 ){
count = 1, colindex+=1;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
$('.g_col.col'+ colindex).append(app);
} else {
$('.g_col.col'+ colindex).append(app);
}
})
2012-03-28 10:53:30 +00:00
return false;
})
2012-04-18 05:17:12 +00:00
$('.tinycanvas')
.tinyscrollbar({ axis: 'x'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
2012-03-28 10:53:30 +00:00
}
2012-04-24 08:45:26 +00:00
var loadApps = function(){ //this load apps for sorting and searching
2012-04-12 06:44:08 +00:00
$.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){
2012-04-29 22:41:05 +00:00
var count = 0, colindex = 0;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
2012-04-12 06:44:08 +00:00
$.each(appss,function(i,apps){
$.each(apps,function(i,app){
2012-04-29 22:41:05 +00:00
var $app;
count++;
$app = $('<div class="element w1 h1 hp vp thmc2" data-category="'+app.data_category+'" data-content="'+app.data_content+'"><span class="tile thmc2"></span><a href="'+app._id+'" class="appicon"><img src="'+o.iconPath+app.data_content+'.png" alt="" onclick="return false;"></a><h1 class="appname thmtxt">'+app.title+'</h1></div>');
if( count > 4 ){
count = 1, colindex+=1;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
$('.g_col.col'+ colindex).append($app);
} else {
$('.g_col.col'+ colindex).append($app);
}
2012-04-12 06:44:08 +00:00
})
})
bindHandlers();
})
}
2012-03-28 10:53:30 +00:00
if(!o.desktopData[o.currentface]){
2012-04-05 05:58:58 +00:00
$(o.contentHolder).empty().load("/desktop/"+target,function(){
2012-04-12 06:44:08 +00:00
loadApps();
2012-03-28 10:53:30 +00:00
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
bindHandlers();
2012-03-28 10:53:30 +00:00
}
};
2012-04-24 08:45:26 +00:00
this.initializeSectionsManager = function(target){ // this is init function for section manager
2012-03-28 10:53:30 +00:00
o.currenthtml = target;
2012-04-05 12:09:01 +00:00
o.currentface = "sections";
2012-04-19 21:38:53 +00:00
var elementParent,element,slabel;
2012-04-24 08:45:26 +00:00
var bindHandlers = function(){ // this is bind handler for section manager page
2012-04-13 09:01:00 +00:00
var groupWrapperWidth = 0;
2012-04-12 16:00:24 +00:00
$("div#sections .group").width(400);
2012-04-12 14:18:58 +00:00
$("div#sections .group").each(function(){groupWrapperWidth+=$(this).width();})
2012-04-12 08:25:06 +00:00
groupWrapperWidth+=200;
2012-04-12 16:00:24 +00:00
groupWrapperHeight = $(".group").height() + 20;
2012-04-13 09:01:00 +00:00
$("#group_wrapper").width(groupWrapperWidth);
2012-04-19 21:38:53 +00:00
$("div#sections #group_wrapper .grp").sortable({
2012-03-28 10:53:30 +00:00
start:function(){
2012-04-19 21:38:53 +00:00
slabel = $(this).siblings('.section_label');
2012-04-20 01:45:40 +00:00
slabel.find('li:hidden').stop(1,1).fadeIn(500);
2012-03-28 10:53:30 +00:00
},
stop:function(){
2012-04-20 01:45:40 +00:00
slabel.find('li:not(:nth-child(1))').stop(1,1).fadeOut(500);
2012-03-28 10:53:30 +00:00
}
});
2012-04-19 21:38:53 +00:00
$("div#sections .section_label li:not(:nth-child(1))").droppable({
drop:function(event, ui){
2012-04-19 23:31:48 +00:00
elementParent = ui.draggable.parents('.group');
var $item = $( this ),
$list = $( '#'+$item.data("category") );
if($list.children('.element').length>=24){
2012-03-29 11:50:23 +00:00
o.notify("Section is full.","alert");
}
else{
2012-04-19 23:31:48 +00:00
ui.draggable.hide('fast',function(){
$(this).appendTo($list).fadeIn();
});
$.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":ui.draggable.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId});
2012-04-19 21:38:53 +00:00
if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){
o.desktopData["home"]="";
}
}
2012-04-20 01:45:40 +00:00
$(this).find('span.tile').addClass('op06',400);
},
over:function(){
2012-04-09 09:40:03 +00:00
$(this).find('span.tile').removeClass('op06');
},
out:function(){
$(this).find('span.tile').addClass('op06');
2012-04-19 23:31:48 +00:00
},
accept: '.to_drop'
2012-04-09 09:40:03 +00:00
});
2012-04-18 05:17:12 +00:00
$('.tinycanvas')
.tinyscrollbar({ axis: 'x'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
2012-05-01 10:05:17 +00:00
var $sdm = $('.sdm');
if( !$sdm.children('.sdm_o') ){
return;
} else {
2012-04-12 06:44:08 +00:00
$sdm.hover(function(){$(this).addClass('thmc2');}, function(){$(this).removeClass('thmc2');});
}
2012-03-28 10:53:30 +00:00
};
2012-04-24 08:45:26 +00:00
var loadApps = function(){ // this loads apps from db to in each sections
2012-04-12 06:44:08 +00:00
$.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){
var $group,$lii,$li;
var z=0;
for(section in o.sectionList){
$group = $('<div class="group" id="'+o.sectionList[section]._id+'"><div class="section_label"><ul class="section_grp"></ul></div><ul class="grp" id="section'+(z+1)+'"></ul></div>');
2012-04-12 06:44:08 +00:00
for(x=0;x<4;x++){
if(x==0){
2012-04-20 01:45:40 +00:00
$li = $('<li class="element w1 h1 hp vp thmtxt" data-content="'+o.sectionList[z]._id+'"><span class="tile thmc1"></span><span class="thmtxt">'+o.sectionList[z].name+'</span></li>');
2012-04-12 06:44:08 +00:00
$group.find("ul.section_grp").append($li);
}
if(z!=x){
$lii = $('<li class="element w1 h1 hp vp thmtxt" style="display: none;" data-category="section'+(x+1)+'" data-content="'+o.sectionList[x]._id+'"><span class="tile thmc2 op06"></span><span class="thmtxt">'+o.sectionList[x].name+'</span></li>');
2012-04-12 06:44:08 +00:00
$group.find("ul.section_grp").append($lii);
}
}
z++;
$("div#group_wrapper").append($group);
}
2012-04-12 08:25:06 +00:00
var yy=1,y=0;
2012-04-12 06:44:08 +00:00
$.each(appss,function(i,apps){
2012-04-12 08:25:06 +00:00
2012-04-12 06:44:08 +00:00
$.each(apps,function(i,app){
$li = $('<li class="element to_drop w1 hh2 hp vp" data-category="'+app.data_category+'" data-content="'+app.data_content+'" id="'+app._id+'"><div class="appicon"><img src="'+o.iconPath+app.data_content+'.png" class="" width="30" /></div><h1 class="appname thmtxth">'+app.title+'</h1></li>');
2012-04-12 08:25:06 +00:00
$("ul#section"+yy).append($li);
2012-04-12 06:44:08 +00:00
})
2012-04-12 08:25:06 +00:00
if(y==1){
y=-1;
yy++;
}
2012-04-12 06:44:08 +00:00
y++;
})
bindHandlers();
})
}
2012-03-28 10:53:30 +00:00
if(!o.desktopData[o.currentface]){
2012-04-05 05:58:58 +00:00
$(o.contentHolder).empty().load("/desktop/"+target,function(){
2012-04-12 06:44:08 +00:00
loadApps();
2012-03-28 10:53:30 +00:00
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
bindHandlers();
}
};
2012-04-24 08:45:26 +00:00
this.initializeSettings = function(target){ //this is to initialize setting page
o.currenthtml = target;
o.currentface = "settings";
2012-04-24 08:45:26 +00:00
var bindHandlers = function(){ // this is the bind handler function for setting page
2012-04-18 05:17:12 +00:00
$("div#settings ul#setting_left_nav li a").on({
click: function(){
if(!$(this).data("clicked")){
var tfunc = $(this).attr("href");
switch(tfunc){
case "themes":
themes();
break;
case "sections":
sections();
break;
case "connection":
connection();
break;
2012-04-18 05:17:12 +00:00
}
$("div#settings ul#setting_left_nav li a").removeClass('thmc1 thmtxt').data('clicked',null);
$(this).addClass('thmc1 thmtxt').data('clicked',true);
}
},
mouseenter: function(){
$(this).removeClass('admtxt').addClass('thmc1 thmtxt');
},
mouseleave: function(){
var t = $(this).data('clicked') ? '' : 'thmc1 thmtxt';
$(this).removeClass(t).addClass('admtxt');
}
2012-04-12 06:19:53 +00:00
});
2012-04-18 05:17:12 +00:00
2012-04-11 09:58:52 +00:00
}
2012-04-24 08:45:26 +00:00
var sections = function(){ // this load section page in setting page
var bindHandlers = function(){ // binding handlers in section page
2012-04-12 06:19:53 +00:00
$('.tinycanvas').each(function(){
var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height();
2012-04-18 05:17:12 +00:00
$(this)
.css({'height': h-sh-24})
.tinyscrollbar({ axis: 'y'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
2012-04-12 06:19:53 +00:00
});
2012-04-12 14:18:58 +00:00
$("a#name_save_btn").click(function(){
var desktopnm = new Array;
$("#desktop_names input").each(function(){
desktopnm.push($(this).val());
})
$.post("/desktop/save_desktop_settings",{"save":"desktopnames","desktopid":o.desktopId,"desktopnms":desktopnm},function(result,status){
2012-04-24 08:45:26 +00:00
if(result[0].success=="true"){
o.notify("Names Saved!!","success",2);
}else
o.notify("Name saving failed!!","imp",2);
2012-04-12 14:18:58 +00:00
})
2012-04-12 16:00:24 +00:00
$.each(o.sectionList,function(i,sec){
sec.name = desktopnm[i];
})
2012-04-12 14:18:58 +00:00
})
2012-04-11 09:58:52 +00:00
}
2012-04-12 14:18:58 +00:00
$("div#settings div#panel_r").load("/desktop/settingsections",function(){
$.getJSON("/desktop/get_desktop_settings",{"get":"sectionnames","desktopid":o.desktopId},function(sectionnames){
$("#desktop_names input").each(function(i){
$(this).val(sectionnames[i]);
})
2012-04-11 09:58:52 +00:00
bindHandlers();
2012-04-12 14:18:58 +00:00
})
2012-04-11 09:58:52 +00:00
})
2012-04-11 09:26:25 +00:00
}
2012-04-24 08:45:26 +00:00
var themes = function(){ // this opens themes page in setting page
var bindHandlers = function(){ // binding handlers in themes page
2012-04-18 05:17:12 +00:00
// live change theme
$(".theme_list > .ssl_item").click(function(){
o.changeTheme($(this).attr("id"));
2012-04-18 05:17:12 +00:00
// $(".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){
2012-04-24 08:45:26 +00:00
if(result[0].success=="true"){
o.notify("Theme Saved!!","success",2);
loadthmc();
} else {
o.notify("Theme saving failed!!","imp",2);
2012-04-12 14:18:58 +00:00
}
});
2012-04-11 09:26:25 +00:00
});
2012-04-18 05:17:12 +00:00
// single select
$('.ssl .ssl_item').each(function(){
$(this).on({
click: function(){
$(this).switchClass('','thmc1 active',300);
$(this).siblings('.thmc1').switchClass('thmc1 active','',100);
2012-04-18 10:15:02 +00:00
2012-04-18 05:17:12 +00:00
if( $(this).find('.ssl_des') ){
$(this).parents('.ssl').find('.ssl_des').removeClass('thmtxt');
$(this).find('.ssl_des').addClass('thmtxt');
2012-04-18 10:15:02 +00:00
}
2012-04-19 21:38:53 +00:00
},
mouseenter: function(){
if( !$(this).hasClass('active') ){
$(this).addClass('thmc1');
if( $(this).find('.ssl_des') ){
$(this).find('.ssl_des').addClass('thmtxt');
}
}
},
mouseleave: function(){
if( !$(this).hasClass('active') ){
$(this).removeClass('thmc1');
if( $(this).find('.ssl_des') ){
$(this).find('.ssl_des').removeClass('thmtxt');
}
}
2012-04-18 05:17:12 +00:00
}
2012-04-18 10:15:02 +00:00
});
2012-04-18 05:17:12 +00:00
});
2012-04-18 10:20:39 +00:00
2012-04-11 09:26:25 +00:00
$('.tinycanvas').each(function(){
var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height();
2012-04-18 05:17:12 +00:00
$(this)
.css({'height': h-sh-24})
.tinyscrollbar({ axis: 'y'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
2012-04-11 09:26:25 +00:00
});
2012-04-10 09:44:36 +00:00
2012-04-18 05:17:12 +00:00
// tab
2012-04-11 09:26:25 +00:00
var $anchor = $('.s_tab a[href*=#]'),
$tabcontent = $('.st_c');
2012-04-10 09:44:36 +00:00
2012-04-11 09:26:25 +00:00
$anchor.each(function(){
$(this).click(function(){
var target = $(this).attr('href');
$anchor.removeClass('thmc2 thmtxt admtxt admbg').addClass('admtxt admbg');
$(this).toggleClass('thmc2 thmtxt admtxt admbg');
$tabcontent.hide();
$(target).show();
$('.tinycanvas').tinyscrollbar_update();
return false;
});
});
2012-04-18 09:57:47 +00:00
$('.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;
}
}
});
$("a#theme_submit").click(function(){
2012-04-19 07:36:03 +00:00
o.confirm({
message : "Are you sure that you want to save custom theme?",
highlighted : 1,
buttons : ["Yes","No"]
},function(reply){
if(reply){
2012-04-19 07:36:03 +00:00
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){
2012-04-24 08:45:26 +00:00
if(result[0].success=="true")
o.notify("Custom theme saved!!","success",2);
else
o.notify("Custom theme saving failed!!","imp",2);
2012-04-19 07:36:03 +00:00
})
}
})
});
$(".stock_wallpaper .ssl_item").click(function(){
var wallpapername = $(this).find("img").attr("alt");
o.changeWallpaper(wallpapername);
})
2012-04-11 05:46:32 +00:00
}
2012-04-24 08:45:26 +00:00
var loadthmc = function(){ // a general function to load the themecolor in color selector
2012-04-18 09:57:47 +00:00
$('.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));
});
}
2012-04-12 14:18:58 +00:00
$("div#settings div#panel_r").load("/desktop/settingthemes",function(){
$.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){
2012-04-19 21:38:53 +00:00
$('#st1 .theme_list [id='+theme+']')
.addClass("thmc1 active", 300)
.find("span")
.addClass("thmtxt");
2012-04-11 09:26:25 +00:00
bindHandlers();
2012-04-18 09:57:47 +00:00
loadthmc();
2012-04-12 14:18:58 +00:00
})
2012-04-11 09:26:25 +00:00
})
}
var connection = function(){
var bindHandlers = function(){
2012-05-03 06:40:54 +00:00
$("#connection_setting ul a").click(function(){
var what = $(this).attr("for"),
type = $(this).attr("href"),
$ul = $("#"+type+"_connection"),
usernm = $ul.find("input[type=text]").val(),
pwd = $ul.find("input[type=password]").val();
switch(what){
case "save":
case "new":
if(usernm!="" && pwd!=""){
$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+usernm+"</div>")
$ul.find("input[type=password]").replaceWith("<div class='c_info pwd'>&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;</div>");
$(this).text("Edit").attr("for","edit");
$(this).parent().find("a[for=delete]").show();
$ul.find("span.c_status").text("Connected").addClass("c_status_on");
if(what=="save")
what="edit";
saveaccount(usernm,pwd,type,what);
}
break;
case "edit":
var un = $ul.find("div.usrnm").text();
$ul.find("div.usrnm").replaceWith('<input type="text" value="'+un+'">');
$ul.find("div.pwd").replaceWith('<input type="password">');
$(this).text("Save").attr("for","save");
break;
case "delete":
var $this = $(this);
o.confirm({
message : "Are you sure that you want to remove this account?",
buttons : ["Yes","No"],
highlighted : 2
},function(reply){
if(reply){
$this.hide();
$ul.find("div.usrnm").replaceWith('<input type="text">');
$ul.find("div.pwd").replaceWith('<input type="password">');
$ul.find("span.c_status").text("No Connection").removeClass("c_status_on");
$this.parent().find("a[for=edit]").text("Connect").attr("for","new");
saveaccount("","",type,what);
}
})
break;
2012-05-03 06:40:54 +00:00
}
})
2012-05-01 10:05:17 +00:00
var $conlist = $('.s_form'),
conlist_w = $conlist.length * $conlist.outerWidth(true) + ($conlist.length - 1) * 25;
$('#connection_setting').width(conlist_w);
$('.tinycanvas')
.tinyscrollbar({ axis: 'x'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
}
var saveaccount = function(usernm,pwd,type,what){
$.post("/desktop/save_account_info",{email:usernm,password:pwd,account:type,dowhat:what},function(result){
if(what!="delete"){
if(result[0].success=="true")
o.notify(type+" account connected!!","success",2);
else
o.notify(type+" account connection failed!!","imp",2);
}else{
if(result[0].success=="true")
o.notify(type+" account removed!!","success",2);
else
o.notify(type+" account removal failed!!","imp",2);
}
})
}
$("div#settings div#panel_r").load("/desktop/settingconnection",function(){
2012-05-03 06:40:54 +00:00
$.getJSON("desktop/getaccounts",function(accounts){
$.each(accounts,function(i,account){
$ul = $("#"+account.type+"_connection");
$ul.find("input[type=text]").replaceWith("<div class='c_info usrnm'>"+account.email+"</div>")
$ul.find("input[type=password]").replaceWith("<div class='c_info pwd'>&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;</div>");
$ul.find("a[for=new]").text("Edit").attr("for","edit");
$ul.find("a[for=delete]").show();
$ul.find("span.c_status").text("Connected").addClass("c_status_on");
})
bindHandlers();
})
})
}
2012-04-11 07:36:32 +00:00
2012-04-11 09:26:25 +00:00
$(o.contentHolder).empty().load("/desktop/"+target,function(){
2012-04-11 09:58:52 +00:00
bindHandlers();
2012-04-12 06:44:08 +00:00
themes();
2012-04-11 09:26:25 +00:00
});
};
2012-04-24 08:45:26 +00:00
this.initializeJournalPapers = function(target){ // this init journal papers
o.currenthtml = target;
o.currentface = "journal_p";
var bindHandlers = function(){ // bind handler for journal paper
2012-04-27 06:04:11 +00:00
$('.s_menu a').on({
2012-04-24 08:45:26 +00:00
click: function(){
2012-04-27 06:04:11 +00:00
if(!$(this).hasClass('active')){
var tfunc = $(this).attr('href');
switch(tfunc){
case 'list':
list();
break;
case 'addpaper':
addpaper();
break;
}
$('.s_menu a').removeClass('thmc1 thmtxt active');
$(this).addClass('thmc1 thmtxt active');
2012-04-24 08:45:26 +00:00
}
},
mouseenter: function(){
2012-04-27 06:04:11 +00:00
if(!$(this).hasClass('active')){
$(this).switchClass('admtxt','thmc1 thmtxt',0);
}
2012-04-24 08:45:26 +00:00
},
mouseleave: function(){
2012-04-27 06:04:11 +00:00
var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt';
$(this).switchClass(t,'admtxt',0);
2012-04-24 08:45:26 +00:00
}
});
}
var list = function(){ // to open list part in journal papers page
var journalData;
2012-04-24 08:45:26 +00:00
var bindHandlers = function(){ // to bind handlers for list page
2012-05-02 09:04:16 +00:00
o.simple_drop_down();
2012-05-03 06:39:22 +00:00
// fill width for tiny scroll bar
var e = $('.list_t'),
count = e.length,
baseWidth = e.eq(1).outerWidth(true);
e.parents('.overview').width( baseWidth * count );
2012-05-02 09:04:16 +00:00
$('.tinycanvas')
.tinyscrollbar({ axis: 'x'})
.find('.scrollbar')
.delay(1500)
.addClass('op00', 500);
$("#journal_p div.toolbar ul#journal_selection_options a").click(function(){
switch($(this).attr("href")){
case "all":
$("#journal_p div#paper_list a.item_check_status").addClass("checked");
break;
case "none":
$("#journal_p div#paper_list a.item_check_status").removeClass("checked");
break;
}
return false;
})
$("#journal_p div.toolbar ul#journal_view_selection a").click(function(){
switch($(this).attr("href")){
case "journal":
journalview();
break;
case "keywords":
keywordsview();
break;
case "title":
titleview();
break;
case "abstract":
abstractview();
break;
}
return false;
})
}
var bindSecondaryHandlers = function(){
$("#journal_p div#paper_list a").click(function(){
if($(this).hasClass("item_check_status")){
$(this).toggleClass("checked");
}else if($(this).hasClass("icon-star")){
$(this).removeClass("icon-star").addClass("icon-star-empty");
}else if($(this).hasClass("icon-star-empty")){
$(this).removeClass("icon-star-empty").addClass("icon-star");
}
return false;
})
}
var journalview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="item_check_status"><span class="icon-ok"></span></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
var keywordsview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="item_check_status"><span class="icon-ok"></span></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
var titleview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="item_check_status"><span class="icon-ok"></span></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
var abstractview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="item_check_status"><span class="icon-ok"></span></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des" style="text-align:justify;">'+paper.abstract+paper.abstract+'</div></li>');
column.find("ul").append(li);
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
2012-04-24 08:45:26 +00:00
}
$("div#settings div#panel_r").load("/desktop/journal_p_list",function(){
$.getJSON("/desktop_publications/getjournals",function(journals){
journalData = eval(journals);
journalview();
bindHandlers();
})
2012-04-24 08:45:26 +00:00
})
}
var addpaper = function(){ // to open add pages in journal papers page
var bindHandlers = function(){ // to bind handlers for add page
}
$("div#settings div#panel_r").load("/desktop/journal_p_add",function(){
bindHandlers();
})
}
if(!o.desktopData[o.currentface]){
$(o.contentHolder).empty().load("/desktop/"+target,function(){
bindHandlers();
list();
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
bindHandlers();
2012-05-02 09:04:16 +00:00
list();
2012-04-24 08:45:26 +00:00
}
};
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper
2012-03-28 10:53:30 +00:00
var ww = $(window).width();
var wh = $(window).height();
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"});
2012-03-28 10:53:30 +00:00
else
$("img#thmbackground").attr({"src":o.wallpaperPath+wallpaper,"width":ww}).css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","height":"auto"});
2012-03-28 10:53:30 +00:00
$("div#bgover").css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","width":ww,"height":wh});
};
2012-04-24 08:45:26 +00:00
this.loadIconCache = function(){ // this function load or refresh icon cache for the theme
2012-04-05 12:32:56 +00:00
var imgs = $("ul.docklist img");
$.each(imgs,function(){
var setting_name = $(this).attr("id").replace("_icon","");
$(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name])
})
2012-04-06 07:18:39 +00:00
};
2012-04-24 08:45:26 +00:00
this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop
var elements = $("#group_wrapper li.element");
$.each(elements,function(){
var widget = $(this);
if(widget.attr("data-category")=="widget"){
2012-04-11 07:31:10 +00:00
var widgename = widget.attr("data-content");
$.getScript("/desktop_widgets/"+widgename+"/"+widgename+".js",function(){
widget.find("div.appholder").load("/desktop_widgets/"+widgename+"/index.html.erb");
});
// $(this).find("div.appholder").append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/desktop_widgets/"+widgename+"/css/"+widgename+".css"));
}
})
2012-04-18 09:57:47 +00:00
};
2012-04-24 08:45:26 +00:00
this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db
$.post("desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){
if(result[0].success=="true")
o.notify("Wallpaper saved!!","success",2);
else
o.notify("Wallpaper saving failed!!","imp",2);
})
2012-04-24 08:45:26 +00:00
};
2012-05-02 09:04:16 +00:00
this.simple_drop_down = function(){
// simple dropdown menu
if( !$('.sdm').children('.sdm_o') ){
return;
} else {
$('.sdm').hover(function(){
$(this).stop(1,1).toggleClass('thmc2 thmtxt');
}, function(){
$(this).stop(1,1).toggleClass('thmc2 thmtxt');
});
}
}
2012-03-28 10:53:30 +00:00
o.initialize();
}
2012-03-29 07:23:48 +00:00
orbitDesktop.prototype.themefolder = "themes";
orbitDesktop.prototype.widgetfolder = "desktop_widgets";
2012-04-05 12:32:56 +00:00
orbitDesktop.prototype.desktopId = "1";
orbitDesktop.prototype.notifyImgPath = "temp";
orbitDesktop.prototype.wallpaperPath = "/assets/stockBackground/";
2012-04-12 06:44:08 +00:00
orbitDesktop.prototype.iconPath = "/assets/icons/";
2012-04-12 14:18:58 +00:00
orbitDesktop.prototype.currentLanguage = "en";
2012-04-19 12:26:21 +00:00
orbitDesktop.prototype.currentUsername = "Harry";
2012-04-11 07:31:10 +00:00
var uselessfunction = function(){
$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
}