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
//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;
@ -25,7 +23,6 @@ var orbitDesktop = function(dom){
this.contentHolder = dom;
this.themesettings = "";
this.theme = "4f8d3f493b67fcd05f086359";
// this.themefolder = "themes";
this.transitionTime = 500;
this.currenthtml = "desktop.html";
this.currentface = "home";
@ -136,11 +133,11 @@ var orbitDesktop = function(dom){
o.currentface = "home";
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);});
$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
var first = true;
$("div#desktop .g_col").sortable({
connectWith: ".g_col",
tolerance: 'pointer' ,
@ -148,37 +145,37 @@ var orbitDesktop = function(dom){
containment: '#group_wrapper',
helper: 'clone',
stop:function(){
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});
first = true;
},
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;
if(s!=0){
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(this).sortable('cancel');
}
}else{$(this).remove();}
},
receive: function(event, ui){
var s = $(this).find('.element').length,
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(ui.sender).sortable('cancel');
}
@ -228,12 +225,12 @@ var orbitDesktop = function(dom){
bw = parseInt(brick[0].substr(1)),
bh = parseInt(brick[1].substr(1)),
bd = bw * bh;
if(bh==1 && bw==1){
small++;
}else if(bh!=1 && bw!=1){
single = true;
}
}
if(small==2){
small=0;
single=false;
@ -899,5 +896,4 @@ orbitDesktop.prototype.currentLanguage = "en";
orbitDesktop.prototype.currentUsername = "Harry";
var uselessfunction = function(){
$.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"});
}
}