Widgets Loading dynamically and semi structured
This commit is contained in:
1 parent
bb2375b15e
commit
35567c2139
25 files changed
+612
-548
No files matched your search
@@ -68,9 +68,16 @@ var orbitDesktop = function(dom){
|
||||
});
|
||||
}
|
||||
});
|
||||
$("select#change_theme").change(function(){
|
||||
o.changeTheme($(this).val());
|
||||
})
|
||||
$("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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(window).resize(function(){
|
||||
var ww = $(window).width();
|
||||
$("img#thmbackground").attr({"width":ww});
|
||||
@@ -140,14 +147,32 @@ var orbitDesktop = function(dom){
|
||||
|
||||
});
|
||||
$('#holder').tinyscrollbar({ axis: 'x'});
|
||||
$("div.scrollbar").hover(function(){
|
||||
$(this).removeClass('op01');
|
||||
}, function(){
|
||||
$(this).addClass('op01');
|
||||
});
|
||||
var $sdm = $('.sdm');
|
||||
|
||||
if( !$sdm.children('.sdm_o') ){
|
||||
return;
|
||||
} else {
|
||||
$sdm.hover(function(){
|
||||
$(this).addClass('thmc2');
|
||||
}, function(){
|
||||
$(this).removeClass('thmc2');
|
||||
});
|
||||
}
|
||||
}
|
||||
if(!o.desktopData[o.currentface]){
|
||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
||||
bindHandlers();
|
||||
o.initializeWidgets();
|
||||
});
|
||||
}else{
|
||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||
bindHandlers();
|
||||
o.initializeWidgets();
|
||||
}
|
||||
};
|
||||
this.tempFunc = function(){
|
||||
@@ -200,15 +225,16 @@ var orbitDesktop = function(dom){
|
||||
if(!o.desktopData[o.currentface]){
|
||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
||||
bindHandlers();
|
||||
|
||||
});
|
||||
}else{
|
||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||
bindHandlers();
|
||||
bindHandlers();
|
||||
}
|
||||
};
|
||||
this.initializeSectionsManager = function(target){
|
||||
o.currenthtml = target;
|
||||
o.currentface = "settings";
|
||||
o.currentface = "sections";
|
||||
var elementParent,element;
|
||||
var bindHandlers = function(){
|
||||
$(".group").width(530);
|
||||
@@ -236,6 +262,17 @@ var orbitDesktop = function(dom){
|
||||
$(this).toggleClass("op06");
|
||||
})//.mouseleave(function(){$(this).addClass("op06");});
|
||||
$('#holder').tinyscrollbar({ axis: 'x'});
|
||||
var $sdm = $('.sdm');
|
||||
|
||||
if( !$sdm.children('.sdm_o') ){
|
||||
return;
|
||||
} else {
|
||||
$sdm.hover(function(){
|
||||
$(this).addClass('thmc2');
|
||||
}, function(){
|
||||
$(this).removeClass('thmc2');
|
||||
});
|
||||
}
|
||||
};
|
||||
if(!o.desktopData[o.currentface]){
|
||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
||||
@@ -247,6 +284,23 @@ var orbitDesktop = function(dom){
|
||||
}
|
||||
|
||||
};
|
||||
this.initializeSettings = function(target){
|
||||
o.currenthtml = target;
|
||||
o.currentface = "settings";
|
||||
var bindHandlers = function(){
|
||||
$("select#change_theme").change(function(){
|
||||
o.changeTheme($(this).val());
|
||||
})
|
||||
}
|
||||
if(!o.desktopData[o.currentface]){
|
||||
$(o.contentHolder).empty().load("/desktop/"+target,function(){
|
||||
bindHandlers();
|
||||
});
|
||||
}else{
|
||||
$(o.contentHolder).html(o.desktopData[o.currentface]);
|
||||
bindHandlers();
|
||||
}
|
||||
};
|
||||
this.loadWallpaper = function(wallpaper){
|
||||
if(!wallpaper)wallpaper = o.themesettings.background;
|
||||
var ww = $(window).width();
|
||||
@@ -264,11 +318,26 @@ var orbitDesktop = function(dom){
|
||||
var setting_name = $(this).attr("id").replace("_icon","");
|
||||
$(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name])
|
||||
})
|
||||
};
|
||||
this.initializeWidgets = function(){
|
||||
var elements = $("#group_wrapper li.element");
|
||||
$.each(elements,function(){
|
||||
var widget = $(this);
|
||||
if(widget.attr("data-category")=="widget"){
|
||||
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"));
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
o.initialize();
|
||||
}
|
||||
|
||||
orbitDesktop.prototype.themefolder = "themes";
|
||||
orbitDesktop.prototype.widgetfolder = "desktop_widgets";
|
||||
orbitDesktop.prototype.desktopId = "1";
|
||||
orbitDesktop.prototype.notifyImgPath = "temp";
|
||||
|
||||
|
||||
Reference in new issue
Block a user