From ff4b131aed6e57df4a50a6f9a3a38118172c2ce8 Mon Sep 17 00:00:00 2001 From: devin Date: Tue, 10 Jul 2012 16:34:50 +0800 Subject: [PATCH] tinyscroll bar update --- app/assets/javascripts/orbitdesktop.js | 160 ++++++++----------------- 1 file changed, 49 insertions(+), 111 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index e84349a38..f3101e49c 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -249,13 +249,11 @@ var orbitDesktop = function(dom){ } } }); - $('div#desktop .tinycanvas') - .tinyscrollbar({ axis: 'x' }) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); - + o.tinyscrollbar_ext({ + main: '.tinycanvas' + }) + o.simple_drop_down(); $("div#group_wrapper ul li[data-category=app]").click(function(){ o.appWindow({ @@ -432,11 +430,9 @@ var orbitDesktop = function(dom){ }) return false; }) - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas' + }) } var loadApps = function(){ //this load apps for sorting and searching $.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){ @@ -517,11 +513,9 @@ var orbitDesktop = function(dom){ }, accept: '.to_drop' }); - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas' + }) }; @@ -614,12 +608,6 @@ var orbitDesktop = function(dom){ },{ axis : "y" }) - // $(this) - // .css({'height': h-sh-24}) - // .tinyscrollbar({ axis: 'y'}) - // .find('.scrollbar') - // .delay(1500) - // .addClass('op00', 500); }); $("a#name_save_btn").click(function(){ @@ -668,12 +656,13 @@ var orbitDesktop = function(dom){ $('.tinycanvas').each(function(){ var h = $(this).parent().height(), sh = $(this).siblings('.s_tab').height(); - $(this) - .css({'height': h-sh-24}) - .tinyscrollbar({ axis: 'y'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + + o.tinyscrollbar_ext({ + main: $(this), + height: h-sh-24 + },{ + axis: 'y' + }) }); o.single_select(); @@ -819,11 +808,9 @@ var orbitDesktop = function(dom){ $('#connection_setting').width(conlist_w); - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas' + }) } var saveaccount = function(usernm,pwd,type,what){ @@ -916,18 +903,10 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ // to bind handlers for list page o.simple_drop_down(); - // 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 ); - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.list_t' + }) $("#journal_selection_options a").click(function(){ @@ -1064,20 +1043,10 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ // to bind handlers for add page o.simple_drop_down(); - // fill width for tiny scroll bar - var e = $('.s_grid_con'), - count = e.length, - baseWidth = e.eq(1).outerWidth(true); - - e.parents('.overview').width( baseWidth * count ); - - - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.s_grid_con' + }) } $("div#journal_p div#panel_r").load("/desktop/journal_p_add",function(){ bindHandlers(); @@ -1187,18 +1156,11 @@ var orbitDesktop = function(dom){ } return false; }); - // 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 ); - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.list_t' + }) } $("div#apps_store div#panel_r").load("/desktop_appstore/widgets",function(){ @@ -1309,18 +1271,10 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ o.simple_drop_down(); - // 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 ); - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.list_t' + }) } $("div#books div#panel_r").load("/desktop/books_list",function(){ @@ -1332,18 +1286,10 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ o.simple_drop_down(); - // fill width for tiny scroll bar - var e = $('.s_grid_con'), - count = e.length, - baseWidth = e.eq(1).outerWidth(true); - - e.parents('.overview').width( baseWidth * count ); - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.s_grid_con' + }) } @@ -1411,18 +1357,10 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ o.simple_drop_down(); - // fill width for tiny scroll bar - var e = $('.s_grid_con'), - count = e.length, - baseWidth = e.eq(1).outerWidth(true); - - e.parents('.overview').width( baseWidth * count ); - - $('.tinycanvas') - .tinyscrollbar({ axis: 'x'}) - .find('.scrollbar') - .delay(1500) - .addClass('op00', 500); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.s_grid_con' + }) } $("div#seminar_p div#panel_r").load("/desktop/seminar_p_add",function(){ @@ -1498,14 +1436,14 @@ var orbitDesktop = function(dom){ var count,baseWidth,fillArray,pxs; - if( typeof target.fill == 'object' ){ + if( typeof target.fill == 'string' ){ fillArray = target.main.find(target.fill); count = fillArray.length; - baseWidth = fillArray.eq(1).outerWidth(true); + baseWidth = $(target.fill).eq(1).outerWidth(true); target.main.find('.overview').width( baseWidth * count); - } else if( typeof fill == 'number' ){ + } else if( typeof target.fill == 'number' ){ target.main.find('.overview').width( target.fill ); - } else if( typeof fill == 'undefined' ){ + } else if( typeof target.fill == 'undefined' ){ } else { o.notify('tinyscrollbar: setting width failed','imp',2);