previous

page 29

next
move(card1,card2) in functions.js
function move(card1,card2) {
var c1=card1.style.gridColumnStart;
var c2=card2.style.gridColumnStart;
if (klass(card1)=='temp') {
// temp → main or final
var id=card1.id; var i=id-100;
var j=g_temp_col[i];
if (klass(card2)=='final') {
var id=card2.id; var i2=id-200;
g_final_col[i2]=j;
} else {
g_main_cols[c2].push(j);
}
g_temp_col[i]=-1;
} else if (klass(card2)=='temp') {
// main → temp
var id=g_main_cols[c1].pop();
var id2=card2.id; var i=id2-100;
g_temp_col[i]=id;
} else if (klass(card2)=='final') {
// main → final
var id=g_main_cols[c1].pop();
var id2=card2.id; var i=id2-200;
g_final_col[i]=id;
} else {
// main → main
g_seq.reverse();
var l=g_seq.length;
for (var i=0;i<l;i++) {
g_main_cols[c1].pop();
var id=g_seq.pop();
g_main_cols[c2].push(id);
}
}
}
previous
next