Major tinyscrollbar update

This commit is contained in:
harrybomrah authored and Matt K. Fu committed 2013-04-17 10:54:38 +08:00
1 parent 8e98cb3ec9
commit 1d06bcaae7
17 files changed
+91 -109

No files matched your search

+34 -26
View File
@@ -4,13 +4,14 @@
//callback-method will be called after desktop controlled ajax call
//container=true is the area where the view will be loaded
//load = true is used to load the list element by default
//load = true is used to load the submenu item by default
//response-type = "json"|"script"|"xml|html" default is json
//autocomplete-list = "listname" an array from which autocomplete will be attached to its respective input or textarea
//ajax-remote="get/delete/post/false" this will automatically bind the <a> with remote ajax call. By default if the resposne is html, it ll be inserted in container=true, false option will not make any calls and also stop page refresh
// content-holder = "jquery dom", the returned html of server will be put inside the dom mentioned in content-holder of a tag. this can be used in a tags as attributes
//confirm-message ="Some message", this will prompt user with a confirm box and show the message before ajax call is made.
//"toggle-onclick" = "classes to get toggle" this will toggle classes on toggle when a tags are clicked.
//"delete-item" = "true" this will remove its respective item from the list.
//for layout tinyscrollbar
@@ -181,16 +182,22 @@ var orbitDesktop = function(dom){
type : t,
url : $e.attr("href"),
success : function(data){
if(typeof data == "string"){
if(ca)
$(ca).html(data);
else{
o.layout_data(data);
// $("div[container=true]").html(data);
if(typeof data == "string"){
if(ca)
$(ca).html(data);
else{
o.layout_data(data);
// $("div[container=true]").html(data);
}
}
if(exe)
window.o[o.data_method][exe](data,$e);
if(t == "delete"){
if($e.attr("delete-item")=="true"){
var li_to_delete = $e.parentsUntil("li[item=true]").find("li[item=true]");
li_to_delete.slideUp();
}
}
}
if(exe)
window.o[o.data_method][exe](data,$e);
}
});
}
@@ -275,8 +282,9 @@ var orbitDesktop = function(dom){
};
this.layout_data = function(h){
var $e = $(h);
var column_container = $e.find("div.overview");
var $e = $("<div></div>");
$e.html(h);
var column_container = $e.find("div.overview");
var layout = column_container.attr("content-layout"), base_width = parseInt(column_container.attr("base-width")), no_of_entries,temp_div = $("<div></div>"),total_columns=0;
switch (layout){
case "simple":
@@ -284,13 +292,15 @@ var orbitDesktop = function(dom){
temp_div.append(column_container.html());
break;
case "datalist":
no_of_entries = (typeof column_container.attr("per-column") != "undefined"? column_container.attr("per-column") : 4);
no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4);
var height_percentage = 100/no_of_entries;
var entries = column_container.find("li[item=true]"),x = 0;
entries.each(function(i,li){
if(x == 0){
column = $("<div class='column type_datalist' style='width:"+base_width+"px'><ul></ul></div");
total_columns++;
}
$(li).addClass("datalist_item").height(height_percentage+"%");
column.find("ul").eq(0).append(li);
x++;
if(x == no_of_entries){
@@ -310,8 +320,8 @@ var orbitDesktop = function(dom){
})
break;
}
column_container.empty();
$("div[container=true]").html(h);
$("div[container=true]").html(h).find("div.overview").wrap('<div class="tinycanvas vp"><div class="viewport"></div></div>');
$("div[container=true]").find("div.tinycanvas").prepend('<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>');
$("div[container=true] div.overview").html(temp_div.html());
if(isNaN(base_width)){
o.tinyscrollbar_ext({
@@ -342,19 +352,19 @@ var orbitDesktop = function(dom){
var cache = false;
if(!o.desktopData[o.currentface]){
$(o.contentHolder).empty().load(url,function(){
$(o.contentHolder).empty().load(url,function(data){
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
window.o[o.data_method](target,url,cache);
}
try{
if(!customload)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
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]"));
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
}
}catch(EX){}
@@ -363,12 +373,12 @@ var orbitDesktop = function(dom){
$(o.contentHolder).html(o.desktopData[o.currentface]);
try{
if(!customload)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
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]"));
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
}
}catch(EX){}
cache = true;
@@ -380,7 +390,7 @@ var orbitDesktop = function(dom){
});
}
}
this.sub_menu_item = function(dom){
this.sub_menu_item = function(dom,data){
var sub_data_method = dom.attr('callback-method');
if(sub_data_method){
$.ajax({
@@ -399,13 +409,12 @@ var orbitDesktop = function(dom){
}
}
})
// $("div[container=true]").load(dom.attr("href"),function(data){
// })
o.highlight_sub_menu_item(dom);
}
if(dom.length == 0)
o.layout_data(data);
// $('*[content-type=menu] a').removeClass('thmc1 thmtxt active');
// dom.addClass('thmc1 thmtxt active');
o.highlight_sub_menu_item(dom);
}
this.highlight_sub_menu_item = function(no){
$('*[content-type=menu] a').removeClass('thmc1 thmtxt active');
@@ -732,7 +741,6 @@ var orbitDesktop = function(dom){
};
this.initializeAppSearch = function(target,url,cache){ //this is application search ie is app manager initialization
var searchArray,allApps;
var bindHandlers = function(){ // bind handler for app manager page
var gn = $('.g_col').length,