Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@
yaxismax2 = result.yaxismax2;
feedlist = result.feedlist;

// attempt to update time selector to match the view
var hours = Math.floor((view.end - view.start) / 3600 / 1000);
dropdown = $('.graph_time').children()
for (var i = dropdown.length - 1; i > 0; i--) {
if (hours >= dropdown[i].value) {
$('.graph_time').val(dropdown[i].value);
break;
}
}

// show settings
showmissing = result.showmissing;
showtag = result.showtag;
Expand All @@ -170,6 +180,17 @@
datetimepickerInit();
graph_resize();
graph_reload();

// automatic refresh every 60s < interval < 1 day
var refresh = Math.min(Math.max(60, view.interval / 2), 86400);
window.setInterval(function() {
if (floatingtime) {
$('.graph_time_refresh').click();
}
else {
graph_reload();
}
}, refresh * 1000); // ms
}
});

Expand Down