change url when changing property

This commit is contained in:
Joerg Lehmann 2020-10-31 11:11:20 +01:00
parent 9296866fe9
commit 272b0117b6
1 changed files with 16 additions and 5 deletions

View File

@ -7,6 +7,17 @@ $(function() {
console.log("XXX: "+start.format());
function change_property(new_property) {
if (new_property != property) {
property = new_property;
if (history.pushState) {
var newurl = window.location.href.replace(/property=./,'property='+new_property);
window.history.pushState({path:newurl},'',newurl);
}
}
}
function cb(start, end) {
$('#reportrange span').html(start.locale('de').format('D. MMM YYYY') + ' - ' + end.locale('de').format('D. MMM YYYY'));
console.log("A new date selection was made: " + start.format() + ' to ' + end.format());
@ -17,27 +28,27 @@ $(function() {
}
$('#btn_w').on("click", function() {
property = 'w';
change_property('w');
drawGraph(deveui, alias, property, s_start, s_end, false);
});
$('#btn_t').on("click", function() {
property = 't';
change_property('t');
drawGraph(deveui, alias, property, s_start, s_end, false);
});
$('#btn_h').on("click", function() {
property = 'h';
change_property('h');
drawGraph(deveui, alias, property, s_start, s_end, false);
});
$('#btn_p').on("click", function() {
property = 'p';
change_property('p');
drawGraph(deveui, alias, property, s_start, s_end, false);
});
$('#btn_vp').on("click", function() {
property = 'vp';
change_property('vp');
drawGraph(deveui, alias, property, s_start, s_end, false);
});