Skip to content

Instantly share code, notes, and snippets.

@DreadKnight
Created May 6, 2012 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DreadKnight/2621287 to your computer and use it in GitHub Desktop.
Save DreadKnight/2621287 to your computer and use it in GitHub Desktop.
url get change
var basePage = window.location.href.replace( /#.*/, "");
function showId(id) {
TINY.box.show({url:'details.php',post:'id='+id,width:880,height:650,topsplit:2,close:true,callback:function(b){
$(b).click(function() {
history.replaceState("", "", basePage);
});
}});
history.replaceState("", "", basePage + "#id=" + id);
}
window.onload = function() {
if (/[\#&]id=(\d+)/.test(location.hash)) {
var id = parseInt(RegExp.$1);
showId(id);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment