Don't overwrite query string of webcam URI

If there's a query already present, just append the timestamp to it with a & in between instead of creating a new query.
(cherry picked from commit 51c77be)
This commit is contained in:
Gina Häußge 2014-08-11 22:25:09 +02:00
parent dffa00dc5e
commit af9a6a8a6e

View file

@ -361,7 +361,15 @@ $(function() {
var webcamImage = $("#webcam_image");
var currentSrc = webcamImage.attr("src");
if (currentSrc === undefined || currentSrc.trim() == "") {
webcamImage.attr("src", CONFIG_WEBCAM_STREAM + "?" + new Date().getTime());
var newSrc = CONFIG_WEBCAM_STREAM;
if (CONFIG_WEBCAM_STREAM.lastIndexOf("?") > -1) {
newSrc += "&";
} else {
newSrc += "?";
}
newSrc += new Date().getTime();
webcamImage.attr("src", newSrc);
}
} else if (previous.hash == "#control") {
// only disable webcam stream if tab is out of focus for more than 5s, otherwise we might cause