From 61c0c4b5428044ac46509a054e1fbdbdf27a7a52 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Thu, 15 Nov 2012 11:18:55 +0800 Subject: [PATCH] modified file of view bug --- app/assets/javascripts/orbitdesktop.js | 2685 ++++++++++++------------ 1 file changed, 1343 insertions(+), 1342 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 7f82c625..f6ac193c 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -1,1405 +1,1406 @@ // JavaScript Document //harry //Inititialize function will initialize desktop - + $.extend($.expr[':'], { - 'containsi': function (elem, i, match, array) { - return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; - } + '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), []); - }; + return this.pushStack([].sort.apply(this, arguments), []); +}; var sortAscending = function(a, b) { - return $(a).find("h1").text() > $(b).find("h1").text() ? 1 : -1; + 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; + return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1; }; var orbitDesktop = function(dom){ - orbitDesktopAPI.apply(this); - // o = this; - this.contentHolder = dom; - this.themesettings = ""; - this.theme = "4f8d3f493b67fcd05f086359"; - this.transitionTime = 500; - this.currenthtml = "desktop.html"; - this.currentface = "home"; - this.desktopData = {}; - this.tp = ""; - this.sectionList; - this.data_method; - this.initialize = function(){ - - var theme = o.theme; - var custom = false; - - $.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){ - if(desktopSettings){ - if(desktopSettings.theme!="custom"){ - theme = desktopSettings.theme; - }else{ - theme = "4f8d3f493b67fcd05f086359"; - custom = true; - } - 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); - $('head').append( $('').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.contentHolder).empty().load("desktop",function(){ - o.desktopData["d_desktop"] = ""; - o.initializeDesktop("d_desktop","",false); - }) - }); - }) - } - } - this.changeTheme = function(theme){ // this function is used for changing theme - o.theme = theme; - $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ - o.themesettings = eval(ts); - $('head').find("#dyn_css").remove(); - $('head').append( $('').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css)); - o.loadWallpaper(); - o.loadIconCache(); - }) - }; - this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc - $(".docklist a").click(function(){ - var target = $(this).attr("id"); - var url = $(this).attr("href"); - o.data_method = $(this).attr("data-method"); - if(o.currenthtml!=target){ - if(o.desktopData[o.currentface] == "undefined") - o.desktopData[o.currentface] = ""; - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.currenthtml = target; - o.currentface = target; - var cache = false; - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load(url,function(){ - if(typeof o.data_method != "undefined"){ - if(o.data_method != "") - window.o[o.data_method](target,url,cache); - } - }); - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - cache = true; - if(typeof o.data_method != "undefined"){ - if(o.data_method != "") - window.o[o.data_method](target,url,cache); - } - } - }); - } - return false; - }) - $('body').on({ - click: function(){ - if(!$(this).hasClass('active')){ - var sub_data_method = $(this).attr('data-method'); - if(sub_data_method){ - $("#panel_r").load($(this).attr("href"),function(){ - // o.simple_drop_down(); + orbitDesktopAPI.apply(this); + // o = this; + this.contentHolder = dom; + this.themesettings = ""; + this.theme = "4f8d3f493b67fcd05f086359"; + this.transitionTime = 500; + this.currenthtml = "desktop.html"; + this.currentface = "home"; + this.desktopData = {}; + this.tp = ""; + this.sectionList; + this.data_method; + this.initialize = function(){ - // o.tinyscrollbar_ext({ - // main: '.tinycanvas', - // fill: '.s_grid_con' - // }) - if(typeof o.data_method != "undefined"){ - if(o.data_method != ""){ - if(typeof sub_data_method != "undefined"){ - if(sub_data_method != ""){ - window.o[o.data_method][sub_data_method](); - } - } - } - } - }) - } - $('.s_menu a').removeClass('thmc1 thmtxt active'); - $(this).addClass('thmc1 thmtxt active'); - } - return false; - }, - 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); - } - },'.s_menu a'); - $(window).resize(function(){ - var ww = $(window).width(); - $("img#thmbackground").attr({"width":ww}); - if( $('.tinycanvas').length > 0 ){ $('.tinycanvas').tinyscrollbar_update(); } - if($(o.contentHolder).find("div.app_frame").length > 0){ - $(o.contentHolder).find("div.app_frame").each(function(){ - var app_holder_height = $(this).height() - 72; - 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}); - }) - } - }); - 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(); - }); - }; - - this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles - if(!target)target = "desktop"; - 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 = $('