Handle push state entirely
This commit is contained in:
parent
4f00d3c71a
commit
6597dba36d
4 changed files with 56 additions and 9 deletions
|
@ -39,9 +39,19 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
// Set up
|
||||
var app = new heist('heist');
|
||||
app.newDocument();
|
||||
$('textarea').focus();
|
||||
// Handle pops
|
||||
window.onpopstate = function(evt) {
|
||||
var path = evt.target.location.pathname;
|
||||
if (path === '/') {
|
||||
app.newDocument();
|
||||
}
|
||||
else {
|
||||
app.loadDocument(path.substring(1, path.length));
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue