On the post you mentioned, here's the code that sets the hash
:
function (hsh) {
hsh="#"+hsh;
this.current.hash=hsh;
document.location.hash=hsh;
}
And here's the code that reads the hash
(e.g. from another URL):
function () {
if(document.location.hash.split("#").pop()==this.current.hash.split("#").pop()) { return; }//this hash was set by code!
var bl=-1;//-1 = none; otherwise, it's a block index.
var cp=-1;
if(document.location.hash.indexOf(Un.HASH_BLOCK_PREFIX)>-1) {
var blkhsh=document.location.hash.substring(Un.HASH_BLOCK_PREFIX.length+1);
var blknum=parseInt(blkhsh,16);
if(!isNaN(blknum)) {
for(bi in Un.BLOCKS.blFrom) {
if(Un.BLOCKS.blFrom[bi]==blkhsh) {
bl=bi; break;
}
}
}
else {
var blkspc=blkhsh.split(Un.HASH_BLOCK_SPACE).join(" ");
for(bi in Un.BLOCKS.blName) {
if(Un.BLOCKS.blName[bi]==blkspc) {
bl=bi; break;
}
}
}
}
else if(document.location.hash!="") {
var hexhsh=document.location.hash.split("#").pop().split(Un.HASH_CP_PREFIX).pop().split("x").pop(); //if the cp_prefix is missing, or if prefixed with x, this will still work :)
if(hexhsh.length==4 && !isNaN(parseInt(hexhsh,16))) {
cp=hexhsh;
for(bi in Un.BLOCKS.blFrom) {
if(Un.BLOCKS.blFrom[bi]>cp) {
bl=bi-1;
break;
}
}
}
}
if(bl>-1) {
Un.selectBlock(bl,(cp==-1 ? 0 : 1));
}
else {
Un.next(1);
Un.setMenuButton($("#BlockButton"),0);
}
if(cp!=-1) {
setTimeout("Un.cpOpen('"+cp+"')",100);
}
}