From e3782c9cf7abdc85eadaf97bba0372546a9c3e4c Mon Sep 17 00:00:00 2001 From: devin chen Date: Wed, 10 Apr 2013 11:16:06 +0800 Subject: [PATCH] minor update --- app/assets/javascripts/orbitdesktop.js | 612 +++++++----------- .../stylesheets/desktop/desktop-main.css | 3 + .../stylesheets/desktop/desktop-main.scss | 6 +- .../stylesheets/desktop/desktop-select2.css | 18 +- .../stylesheets/desktop/desktop-select2.scss | 21 +- 5 files changed, 249 insertions(+), 411 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index e5f3c3fb..7f617863 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -108,8 +108,8 @@ var orbitDesktop = function(dom){ this.contentHolder = dom; this.themesettings = ""; this.theme = "4f8d3f493b67fcd05f086359"; - this.transitionTime = 500; - this.currenthtml = "home"; + this.transitionTime = 1000; + this.currenthtml = "desktop.html"; this.currentface = "home"; this.desktopData = {}; this.tp = ""; @@ -135,7 +135,7 @@ var orbitDesktop = function(dom){ o.theme = theme; loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper); }else{loadTheme();} - }) + }); var loadTheme = function(customtheme,customwallpaper){ //This function will load the theme from database $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ o.themesettings = eval(ts); @@ -160,8 +160,8 @@ var orbitDesktop = function(dom){ } }); }) - } - } + }; + }; this.customPage = function(customload){ customload = customload.replace("#",""); if(customload.search("-") != -1){ @@ -170,7 +170,7 @@ var orbitDesktop = function(dom){ }else{ o.menu_item($(".docklist a[custom-load="+customload+"]"),true); } - } + }; this.changeTheme = function(theme){ // this function is used for changing theme o.theme = theme; $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ @@ -189,9 +189,9 @@ var orbitDesktop = function(dom){ $.getJSON("http://maps.googleapis.com/maps/api/geocode/json?latlng="+o.locationdata.lat+","+o.locationdata.lng+"&sensor=true",function(data){ $.each(data.results[0].address_components,function(i,val){ o.locationdata[val.types[0]] = val.long_name; - }) + }); o.locationdata.formatted_address = data.results[0].formatted_address; - }) + }); } var locationError = function(){ @@ -211,7 +211,7 @@ var orbitDesktop = function(dom){ $(".docklist a").click(function(){ o.menu_item($(this)); return false; - }) + }); $('body').on({ @@ -254,7 +254,7 @@ var orbitDesktop = function(dom){ } $(this).ajaxSubmit(options); return false; - }) + }); $("body").on("click","*[ajax-remote]",function(){ var $e = $(this); @@ -262,8 +262,8 @@ var orbitDesktop = function(dom){ var classes_to_toggle = $e.attr("toggle-onclick"); var exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : ""); if(classes_to_toggle){ - $e.toggleClass(classes_to_toggle); - } + $e.toggleClass(classes_to_toggle); + } if(t == "false"){ if(exe){ window.o[o.data_method][exe](null,$e); @@ -310,11 +310,11 @@ var orbitDesktop = function(dom){ a(); } return false; - }) + }); $(window).resize(function(){ - var ww = $(window).width(); - $("img#thmbackground").attr({"width":ww}); + // var ww = $(window).width(); + // $("img#thmbackground").attr({"width":ww}); if( $('.tinycanvas').length > 0 ){ $('.tinycanvas').tinyscrollbar_update('relative'); } if($(o.contentHolder).find("div.app_frame").length > 0){ $(o.contentHolder).find("div.app_frame").each(function(){ @@ -322,7 +322,7 @@ var orbitDesktop = function(dom){ var app_holder_width = $(this).width(); $(this).find("div.app_holder").height(app_holder_height); $(this).find("div.app_holder iframe").attr({"height":app_holder_height,"width":app_holder_width}); - }) + }); } }); @@ -372,14 +372,14 @@ var orbitDesktop = function(dom){ this.value = terms.join( ", " ); return false; } - }) - }) + }); + }); }; this.layout_data = function(h){ - var $e; - var column_container,layout, base_width , no_of_entries = 0, pagination_link , pagination_variable, gutter, total_width; + var $e; + var column_container,layout, base_width, total_width, gutter, no_of_entries = 0, pagination_link, pagination_variable; o.paging = true; gutter = (!isNaN(gutter)) ? gutter : 12; this.layout_data.generate_layout_html = function(l){ @@ -393,7 +393,6 @@ var orbitDesktop = function(dom){ case "simple": total_columns++; temp_div.append(column_container.html()); - total_width = "auto"; break; case "datalist": no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4); @@ -412,10 +411,7 @@ var orbitDesktop = function(dom){ x = 0; temp_div.append(column); } - }) - if(x != 0){ - temp_div.append(column); - } + }); } total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null; break; @@ -423,16 +419,17 @@ var orbitDesktop = function(dom){ entries = column_container.find("div[column=true]"),x = 0,column; if(entries.length!=0){ entries.each(function(i,ul){ - column = $("
0){ - $("div[container=true] div.overview").append(f.markup); + $("div[container=true] .overview").append(f.markup); if(f.width){ - var w = $("div[container=true] div.overview").width(); - $("div[container=true] div.overview").width(w+f.width); + var w = $("div[container=true] .overview").width(); + $("div[container=true] .overview").width(w+f.width); } o.tinyscrollbar.tinyscrollbar_update("relative"); o.paging = true; - }else{o.paging = false;} + } else { + o.paging = false; + } } - }) + }); } this.insert_new_column = function(index){ - var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),base_width = parseInt(column_container.attr("base-width")),column; + var column_container = $("div[container=true] .overview"),layout = column_container.attr("content-layout"),base_width = parseInt(column_container.attr("base-width")),column; var i = (index == 0? 0 : index-1); var previous_column = column_container.find(".column").eq(i); if(previous_column.length == 0)return false; @@ -515,7 +514,7 @@ var orbitDesktop = function(dom){ } this.remove_column = function(index){ - var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),column = column_container.find(".column").eq(index),base_width = parseInt(column_container.attr("base-width")); + var column_container = $("div[container=true] .overview"),layout = column_container.attr("content-layout"),column = column_container.find(".column").eq(index),base_width = parseInt(column_container.attr("base-width")); if(column.length == 0)return false; switch(layout){ case "datalist": @@ -542,53 +541,72 @@ var orbitDesktop = function(dom){ o.lastlink = url; o.data_method = dom.attr("callback-method"); if(o.currenthtml!=target){ - if(o.desktopData[o.currentface] == "undefined") + if(o.desktopData[o.currentface] == "undefined"){ o.desktopData[o.currentface] = ""; + } o.desktopData[o.currentface] = $(o.contentHolder).html(); if(customload){ $(o.contentHolder).html("
"); } - $("#content").hide("drop",o.transitionTime,function(){ + $("#content > #holder").toggle("drop",{ easing: "easeInOutQuint" },o.transitionTime,function(){ o.currenthtml = target; o.currentface = target; var cache = false; if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load(url,function(data){ if(typeof o.data_method != "undefined"){ - if(o.data_method != "") + if(o.data_method != ""){ window.o[o.data_method](target,url,cache); + } } - try{ - if(!customload) + try { + if(!customload){ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); - else{ - if(submenuitem) - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); - else - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); + } else { + if(submenuitem){ + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); + } else { + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); } - }catch(EX){} - - }) + } + } catch(EX){} + header_ani(); + }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); - try{ - if(!customload) + header_ani(); + try { + if(!customload){ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); - else{ - if(submenuitem) - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); - else - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); - } - }catch(EX){} + } else { + if(submenuitem){ + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); + } else { + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); + } + } + } catch(EX){} cache = true; if(typeof o.data_method != "undefined"){ - if(o.data_method != "") - window.o[o.data_method](target,url,cache); + if(o.data_method != ""){ + window.o[o.data_method](target,url,cache); + } } } }); + $('#header') + .delay(600) + .effect('drop',{ + easing: 'easeInOutQuint', + direction: 'down' + },300); + } + + var header_ani = function(){ + $('#header').hide().toggle('drop',{easing: 'easeInOutQuint', direction:'down'}); + $('#header > *').each(function(i){ + $(this).hide().delay(i*100).fadeIn(600,'easeInOutQuint'); + }); } } this.sub_menu_item = function(dom,data){ @@ -632,312 +650,112 @@ var orbitDesktop = function(dom){ } this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles - if(!target)target = "home"; + target = (!target) ? 'desktop' : target; var bindHandlers = function(){ // this function will bind all the handlers in the desktop - // var groupWrapperWidth = 0; - // $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); - // var grps = new Array; - // $("div#desktop #group_wrapper").css("width",groupWrapperWidth); - // var first = true; - // $("div#desktop .g_col").sortable({ - // connectWith: ".g_col", - // tolerance: 'pointer' , - // revert: 300, - // containment: '#group_wrapper', - // helper: 'clone', - // stop:function(){ - // first = true; - // var grpwidth = 0; - // for(i in grps){ - // var grp = grps[i]; - // if(grp.find(".element").length == 0){ - // grp.animate({"width":"0px"},500,function(){$(this).remove();}); - // grpwidth+=225; - // } - // } - // grps = []; - // $("#group_wrapper").width($("#group_wrapper").width()-grpwidth); - // }, - // start:function(){ - // $("#group_wrapper").find("div.group").each(function(i,par){ - // var nextnumber = $(this).find("ul").length; - // $newcol = $('