/    Sign up×
Community /Pin to ProfileBookmark

cookies JQUERY sortable

Found this nice little script but it was designed for 3 colums heres the JS:

[code]
function serialize()
{
serial = $.SortSerialize();
var now = new Date();
now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 365);

var serialhash = serial.hash;
var serialhash = serialhash.replace(/=/g, “:”);

var serialhash = serial.hash;
var serialhash = serialhash.replace(/=/g, “:”);

var serialhash = serialhash.replace(/statusModule/, “0”);
var serialhash = serialhash.replace(/commentsModule/, “1”);
var serialhash = serialhash.replace(/LatestBP/, “2”);

var serialhash = serialhash.replace(/PMModule/, “5”);
var serialhash = serialhash.replace(/QBPModule/, “6”);
var serialhash = serialhash.replace(/imageModule/, “7”);

var serialhash = serialhash.replace(/&/g, “#”);
var serialhash = serialhash.replace(/sort1/, “0”);
var serialhash = serialhash.replace(/sort1/g, “”);
var serialhash = serialhash.replace(/sort2/, “1”);
var serialhash = serialhash.replace(/sort2/g, “”);
var serialhash = serialhash.replace(/[[]]/g, “”);
var serialhash = serialhash.replace(/#:/g, “:”);
var serialhash = serialhash.replace(/#/g, “:#”);

var serialhash2 = “:#”;

var serialhash = serialhash + serialhash2;

document.cookie = “hporderwrap=”+ serialhash +”;expires=” + now;
};

/* REordering the divs */
function zxcDragInit(zxcevt,zxccls){
var zxcparary=zxcElsByClass(zxccls[0],false,’DIV’);
for (var zxcnu=0,zxcdivs,zxcdivary=[],zxcparary=zxcElsByClass(zxccls[0],false,’DIV’),zxctitle,zxc0=0;zxc0<zxcparary.length;zxc0++){
zxcdivs=zxcElsByClass(zxccls[1],zxcparary[zxc0],’DIV’);
for (var zxc0a=0;zxc0a<zxcdivs.length;zxc0a++){
zxcdivary.push(zxcdivs[zxc0a]);
zxcdivs[zxc0a].nu=(zxcnu++)+”;
}
}
if (zxcReadCookie(zxccls[0])){
var zxccookievalue=zxcReadCookie(zxccls[0]);
zxccookievalue=zxccookievalue.split(‘#’)
for (var zxcp,zxcs,zxc1=0;zxc1<zxccookievalue.length-1;zxc1++){
zxcs=zxccookievalue[zxc1].split(‘:’);
zxcp=zxcparary[zxcs[0]];
for (var zxc1a=1;zxc1a<zxcs.length-1;zxc1a++){
zxcp.appendChild(zxcdivary[zxcs[zxc1a]]);
}
}
}
}
function zxcEventAdd(zxco,zxct,zxcf,zxcp) {
if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ return zxco[zxcf](e,zxcp);}, false); }
else if ( zxco.attachEvent ){ zxco.attachEvent(‘on’+zxct,function(e){ return zxco[zxcf](e,zxcp); }); }
else {
var zxcPrev=zxco[“on” + zxct];
if (zxcPrev){ zxco[‘on’+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e,zxcp); }; }
else { zxco[‘on’+zxct]=zxco[zxcf]; }
}
}

function zxAddEvt(obj, fun,ev, p)
{
if (obj[‘zxc’]) return;
obj[‘zxc’+fun+ev])
}

function zxcElsByClass(zxccls,zxcp,zxctag) {
zxcp=zxcp||document;
zxcp=typeof(zxcp)==’object’?zxcp:document.getElementById(zxcp);
zxctag=zxctag||’*’;
for (var zxcels=zxcp.getElementsByTagName(zxctag),zxcreg=new RegExp(‘\b’+zxccls+’\b’),zxcary=[],zxc0=0;zxc0<zxcels.length;zxc0++){
if (zxcreg.test(zxcels[zxc0].className)) zxcary.push(zxcels[zxc0]);
}
return zxcary;
}
function zxcReadCookie(zxcnme){
zxcnme+=’=’;

var zxcsplit = document.cookie.split(‘;’);
for(var zxc0=0;zxc0<zxcsplit.length;zxc0++) {
var zxcs=zxcsplit[zxc0];
while (zxcs.charAt(0)==’ ‘) zxcs=zxcs.substring(1,zxcs.length);
if (zxcs.indexOf(zxcnme)==0) return zxcs.substring(zxcnme.length,zxcs.length);
}
return null;
}

zxcAddEvt(window,’zxcDragInit’,’load’,[‘hporderwrap’,’groupItem’,’itemHeader’,1]);

// Delete Cookie
function deletecookiecity() {
var zxcsplit = document.cookie.split(‘;’);
var now = new Date();
now.setTime(now.getTime() – 1000 * 60 * 60 * 24 * 365)

document.cookie = “hporderwrap=”+ zxcsplit +”;expires=” + now;
window.location.reload();
}

// onpage load
$(document).ready(

function () {
$(‘#settingBox’).hide();
$(‘.closeArea’).bind(‘click’, toggleContent);
<?php
for ($turn = 0; $turn < sizeof($menuSide); $turn++)
{
$using = $menuSide[$turn];
if ($using == 0)
$sOh = “hide”;
else
$sOh = “show”;

echo “$(‘.mylist” . $turn . “‘).” . $sOh . “();n”;
}
?>
$(‘div.hporderwrap’).Sortable(
{
accept: ‘groupItem’,
helperclass: ‘sortHelper’,
activeclass : ‘sortableactive’,
hoverclass : ‘sortablehover’,
handle: ‘div.itemHeader’,
tolerance: ‘pointer’,
scroll: false,
onChange : function(ser)
{
},
onStart : function()
{
$.iAutoscroller.start(this, document.getElementsByTagName(‘body’));
},
onStop : function()
{
$.iAutoscroller.stop();
}
}
);
}
);
[/code]

and the HTML:

[code]

<div id=”sort1″ class=”hporderwrap”>

<div id=”statusModule” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Status <div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>

<div id=”commentsModule” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Comments<div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>

<div id=”LatestBP” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Latest Blog Posts<div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>

</div>

<div id=”sort2″ class=”hporderwrap”>

<div id=”PMModule” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Private Messages<div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>

<div id=”QBPModule” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Quick-Step Blog Post<div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>

<div id=”imageModule” class=”groupItem”>
<div style=”-moz-user-select: none;” class=”itemHeader” onmouseup=”setTimeout(‘serialize();’, 1*1000); return false;”>
Image Upload<div class=”closeArea”></div>
</div>

<div class=”postshown itemContent”>
sdf
</div>
</div>
</div>
[/code]

The problem is that only the first coloum saves, if I move any modules in the second colum it doesnt save.

Any help ? ?

Thanks

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 02.2009 — Send a pm to vwphillips, he wrote the script.
Copy linkTweet thisAlerts:
@codingisfunMar 02.2009 — Send a pm to vwphillips, he wrote the script.[/QUOTE]
How did you know vwphillips wrote it?
Copy linkTweet thisAlerts:
@FangMar 02.2009 — His signature: 'zxc'
×

Success!

Help @allyant spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...