more pushState
This commit is contained in:
parent
b7531c3071
commit
a6cf963b6e
1 changed files with 14 additions and 6 deletions
|
@ -70,14 +70,21 @@ var app = new Ox.App({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
app.url = function(url) {
|
app.url = function(url) {
|
||||||
|
var current_url = document.location.pathname + document.location.hash;
|
||||||
if(!url)
|
if(!url)
|
||||||
var url = document.location.pathname;
|
var url = current_url;
|
||||||
else {
|
else {
|
||||||
var title = document.title + ' '+ url;
|
if(url != current_url) {
|
||||||
history.pushState({}, title, url);
|
var title = document.title + ' '+ url;
|
||||||
|
history.pushState({}, title, url);
|
||||||
|
} else {
|
||||||
|
//FIXME: this is a workaround since open gets called twice
|
||||||
|
// due to a bug with double click
|
||||||
|
Ox.print('ignore double call of app.url, double click need to be fixed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(/[0-9A-Z]/.exec(url.substring(1,2))) {
|
if(/[0-9A-Z]/.exec(url.substring(1,2))) {
|
||||||
var id = url.split('/')[1];
|
var id = url.split('/')[1];
|
||||||
|
@ -481,7 +488,7 @@ app.constructGroups = function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
location.hash = app.Query.toString(query);
|
history.pushState({}, '', '/#' + app.Query.toString(query));
|
||||||
}),
|
}),
|
||||||
query: {
|
query: {
|
||||||
conditions: [],
|
conditions: [],
|
||||||
|
@ -860,6 +867,7 @@ app.constructList = function(view) {
|
||||||
background: 'red'
|
background: 'red'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
['list', 'icons'].indexOf(view) > -1 && $list.bindEvent({
|
['list', 'icons'].indexOf(view) > -1 && $list.bindEvent({
|
||||||
closepreview: function(event, data) {
|
closepreview: function(event, data) {
|
||||||
app.$ui.previewDialog.close();
|
app.$ui.previewDialog.close();
|
||||||
|
@ -1896,7 +1904,7 @@ app.constructToolbar = function() {
|
||||||
}), callback);
|
}), callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
location.hash = app.Query.toString(query);
|
history.pushState({}, '', '/#' + app.Query.toString(query));
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
id: 'findElement'
|
id: 'findElement'
|
||||||
|
|
Loading…
Reference in a new issue