remote browser: detect change of song, and Android browser ajax cache issue

This commit is contained in:
Jonathan Corwin 2011-05-04 23:34:43 +01:00
parent c8a2a0d291
commit cce8556b45

View File

@ -112,6 +112,7 @@ window.OpenLP = {
$.getJSON(
"/api/poll",
function (data, status) {
var prevItem = OpenLP.currentItem;
OpenLP.currentSlide = data.results.slide;
OpenLP.currentItem = data.results.item;
if ($("#service-manager").is(":visible")) {
@ -125,10 +126,14 @@ window.OpenLP = {
item.attr("data-theme", "e").removeClass("ui-btn-up-c").addClass("ui-btn-up-e");
return false;
}
});
});
$("#service-manager div[data-role=content] ul[data-role=listview]").listview("refresh");
}
if ($("#slide-controller").is(":visible")) {
if(prevItem != OpenLP.currentItem) {
OpenLP.loadController();
return;
}
var idx = 0;
$("#slide-controller div[data-role=content] ul[data-role=listview] li").attr("data-theme", "c").removeClass("ui-btn-up-e").addClass("ui-btn-up-c");
$("#slide-controller div[data-role=content] ul[data-role=listview] li a").each(function () {
@ -200,5 +205,6 @@ $("#controller-unblank").live("click", OpenLP.unblankDisplay);
// Alerts
$("#alert-submit").live("click", OpenLP.showAlert);
// Poll the server twice a second to get any updates.
$.ajaxSetup({ cache: false });
setInterval("OpenLP.pollServer();", 500);
OpenLP.pollServer();