$.links = {
current:0,
key:[],
val:{},
add:function (o){
this.key.push(o.hash);
this.val[o.hash] = o.url;
},
remove:function (hash){
for(i=0;i<this.key.length;i++)
{
if(hash === this.key[i])
{
this.val[this.key[i]] = null;
this.key.splice(i,1);
return;
}
}
},
set:function (hash){
for(i=0;i<this.key.length;i++)
{
if(hash === this.key[i])
{
this.current = i;
return ;
}
}
},
getCurrent:function (){ return this.val[this.key[this.current]];},
prev:function (){
this.move("p");
return this.val[this.key[this.current]];
},
next:function (){
this.move("n");
return this.val[this.key[this.current]];
},
move:function (direction)
{
if(direction=="n"&&this.current < this.key.length)
{
this.current++;
return ;
}
if(direction=="p"&&this.current > 0)
{
this.current--;
return ;
}
}
};
current:0,
key:[],
val:{},
add:function (o){
this.key.push(o.hash);
this.val[o.hash] = o.url;
},
remove:function (hash){
for(i=0;i<this.key.length;i++)
{
if(hash === this.key[i])
{
this.val[this.key[i]] = null;
this.key.splice(i,1);
return;
}
}
},
set:function (hash){
for(i=0;i<this.key.length;i++)
{
if(hash === this.key[i])
{
this.current = i;
return ;
}
}
},
getCurrent:function (){ return this.val[this.key[this.current]];},
prev:function (){
this.move("p");
return this.val[this.key[this.current]];
},
next:function (){
this.move("n");
return this.val[this.key[this.current]];
},
move:function (direction)
{
if(direction=="n"&&this.current < this.key.length)
{
this.current++;
return ;
}
if(direction=="p"&&this.current > 0)
{
this.current--;
return ;
}
}
};