position update fixed..

This commit is contained in:
Harry Bomrah 2012-05-02 17:05:40 +08:00
parent 769a67f026
commit 5b7c422446
1 changed files with 21 additions and 25 deletions

View File

@ -1,9 +1,7 @@
// JavaScript Document // JavaScript Document
//harry //harry
//Inititialize function will initialize desktop //Inititialize function will initialize desktop
$.extend($.expr[':'], { $.extend($.expr[':'], {
'containsi': function (elem, i, match, array) { 'containsi': function (elem, i, match, array) {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
@ -25,7 +23,6 @@ var orbitDesktop = function(dom){
this.contentHolder = dom; this.contentHolder = dom;
this.themesettings = ""; this.themesettings = "";
this.theme = "4f8d3f493b67fcd05f086359"; this.theme = "4f8d3f493b67fcd05f086359";
// this.themefolder = "themes";
this.transitionTime = 500; this.transitionTime = 500;
this.currenthtml = "desktop.html"; this.currenthtml = "desktop.html";
this.currentface = "home"; this.currentface = "home";
@ -136,11 +133,11 @@ var orbitDesktop = function(dom){
o.currentface = "home"; o.currentface = "home";
var bindHandlers = function(){ // this function will bind all the handlers in the desktop var bindHandlers = function(){ // this function will bind all the handlers in the desktop
var groupWrapperWidth = 0; var groupWrapperWidth = 0;
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
$("div#desktop #group_wrapper").css("width",groupWrapperWidth); $("div#desktop #group_wrapper").css("width",groupWrapperWidth);
var first = true;
$("div#desktop .g_col").sortable({ $("div#desktop .g_col").sortable({
connectWith: ".g_col", connectWith: ".g_col",
tolerance: 'pointer' , tolerance: 'pointer' ,
@ -148,37 +145,37 @@ var orbitDesktop = function(dom){
containment: '#group_wrapper', containment: '#group_wrapper',
helper: 'clone', helper: 'clone',
stop:function(){ stop:function(){
var newpostitions = new Array; first = true;
var groupids = new Array;
$.each($("div#desktop .group"),function(i,grp){
var groupone = new Array;
groupids.push($(grp).attr("id"));
$ul = $(grp).find(".g_col .element");
$.each($ul,function(){
groupone.push($(this).attr("id"));
})
newpostitions.push(groupone);
});
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
}, },
update:function(){ update:function(){
if(first){
first = false;
var newpostitions = new Array;
var groupids = new Array;
$.each($("div#desktop .group"),function(i,grp){
var groupone = new Array;
groupids.push($(grp).attr("id"));
$ul = $(grp).find(".g_col .element");
$.each($ul,function(){
groupone.push($(this).attr("id"));
})
newpostitions.push(groupone);
});
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
}
var s = $(this).find('.element').length; var s = $(this).find('.element').length;
if(s!=0){ if(s!=0){
last = $(this).find('.element').eq(s-1).position(), last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true); lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){ if ((last.top+lasth)>528){
$(this).sortable('cancel'); $(this).sortable('cancel');
} }
}else{$(this).remove();} }else{$(this).remove();}
}, },
receive: function(event, ui){ receive: function(event, ui){
var s = $(this).find('.element').length, var s = $(this).find('.element').length,
last = $(this).find('.element').eq(s-1).position(), last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true); lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){ if ((last.top+lasth)>528){
$(ui.sender).sortable('cancel'); $(ui.sender).sortable('cancel');
} }
@ -228,12 +225,12 @@ var orbitDesktop = function(dom){
bw = parseInt(brick[0].substr(1)), bw = parseInt(brick[0].substr(1)),
bh = parseInt(brick[1].substr(1)), bh = parseInt(brick[1].substr(1)),
bd = bw * bh; bd = bw * bh;
if(bh==1 && bw==1){ if(bh==1 && bw==1){
small++; small++;
}else if(bh!=1 && bw!=1){ }else if(bh!=1 && bw!=1){
single = true; single = true;
} }
if(small==2){ if(small==2){
small=0; small=0;
single=false; single=false;
@ -899,5 +896,4 @@ orbitDesktop.prototype.currentLanguage = "en";
orbitDesktop.prototype.currentUsername = "Harry"; orbitDesktop.prototype.currentUsername = "Harry";
var uselessfunction = function(){ var uselessfunction = function(){
$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"}); $.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
} }