Work around deprecation of offline capabilities

This commit is contained in:
Joe Tretter
2020-08-29 14:11:41 -05:00
parent e1a15e7efb
commit 32122b8213
2 changed files with 195 additions and 188 deletions

View File

@@ -59,16 +59,20 @@ function initSession(){
// Check if a new cache is available on page load. || TODO: the Server could notify for new versions, then the check would be done closer to time.
window.addEventListener('load', function(e) {
window.applicationCache.addEventListener('updateready', function(e) {
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Intentially not calling swapcache here, it's quite useless because it will only use the new verstion for newly loaded files anyway...
if (confirm('A new version of this site is available. Load it?')) {
window.location.reload();
try{
window.applicationCache.addEventListener('updateready', function(e) {
if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
// Intentially not calling swapcache here, it's quite useless because it will only use the new verstion for newly loaded files anyway...
if (confirm('A new version of this site is available. Load it?')) {
window.location.reload();
}
} else {
// Manifest didn't changed. Nothing new to server.
}
} else {
// Manifest didn't changed. Nothing new to server.
}
}, false);
}, false);
} catch (ex) {
console.log("Quick Fix - switch off AppCachea",ex);
}
}, false);
var indexHtmlRevision = $("#lbRevision").text().split(" ")[1];

View File

@@ -1,179 +1,182 @@
<!doctype html>
<html lang="en" manifest="cache.manifest">
<head>
<!-- meta name="apple-mobile-web-app-capable" content="yes" / TODO: prevents from cache refreshing! -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Shopping List</title>
<style type="text/css">
@import "jquery.mobile.theme-1.3.2.css";
@import "jquery.mobile.structure-1.3.2.min.css";
legend { font-weight:bold;text-decoration:underline}
</style>
<script src="jquery-1.10.2.min.js"></script>
<script src="jquery.mobile-1.3.2.min.js"></script>
<script src="IndexedDBShim.js"></script>
<script src="jquery.indexeddb.js"></script>
<script src="globals.js"></script>
<script src="database.js"></script>
<script src="transfer.js"></script>
<script src="datahandler.js"></script>
<script src="helpers.js"></script>
<script src="uicontroler.js"></script>
<script language='JavaScript'>
$(document).bind('pageinit',function() {
defineDisplayStatus();
if (applicationCache.status==applicationCache.IDLE) { applicationCache.update(); }
$("#lbHeading").text("Shopping List");
$("#pnlHeading").show();
// get rid of the Searchbox of the Entries ListView
$("#lstEntries").prev().children(".ui-input-search").hide();
initSession();
// Enter key submits input fields
$("#tbCode,#tbShoppingListName,#tbNewEntry,#tbShopName").keyup( function(e) {
if (e.keyCode == 13) {
e.currentTarget.onsubmit();
}
});
// Setup recurring transfer poll
window.setInterval(transferQDispatcher,10000);
})
</script>
</head>
<body>
<div id='pnlHeading' data-role="header">
<a id="btnHeadingLeft" data-role="button" data-icon="arrow-l">TESTL</a>
<h1 id='lbHeading'>TESTMID</h1>
<a id="btnHeadingRight" data-role="button" data-icon="gear">TESTR</a>
<div id='pnlShops'>
</div>
<div id='pnlSettingsNav' style='display:none'>
<div data-role="navbar">
<ul>
<li><a onClick='showTransferQ();' class="ui-btn-active ui-state-persist">TransferQ</a></li>
<li><a onClick='setMode("SettingsSettings")'>Settings</a></li>
<li><a onClick='setMode("About")'>About</a></li>
</ul>
</div>
</div>
</div>
<div id='pnlBranding' style='display:none'>
<div id='pnlDisclaimer'>
<fieldset><legend>Terms of Use+Disclaimer</legend>
By using this service you agree to the following terms of use:
<ul>
<li>There is no guarantee of this service to be available and working at any point in time</li>
<li>There is no data security whatsoever, data might be lost or shared</li>
<li>This service does not offer any form of data protection or privacy</li>
<li>No claims can be made for any demage due to using this service</li>
<li>Data entered into this system immediately becomes ownership of the system operator</li>
<li>Even though there are no access restrictions this system isn't available for public use</li>
<ul>
<br>
<a data-role="button" data-icon="check" data-iconpos="right" onclick='$("#pnlDisclaimer").slideUp();$("#pnlDisclaimerAccepted").slideDown();' >Agree</a>
<a data-role="button" data-icon="delete" data-iconpos="right" href='http://www.google.com' >Decline</a>
</fieldset>
</div>
<div id='pnlDisclaimerAccepted' style='display:none'>
<table>
<tr>
<td>Shopping List Name:</td>
<td><input type='text' onsubmit='$("#btnSubmitBranding").click();' style='width:200px' id='tbShoppingListName' value=''></input></td>
</tr><tr>
<td colspan='2'> <a data-role="button" data-icon="arrow-r" data-iconpos="right" id='btnSubmitBranding' onclick='JavaScript:brandBrowser($("#tbShoppingListName").val());' >Brand</a> </td>
</tr>
</table>
<br />
<hr />
<br />
<fieldset><legend>INFO</legend>
In order to access a shopping list form multiple computers there must be an identifier that is unique for each shopping list.
Everybody who knows this identifier can access this shopping list!
</fieldset>
</div>
</div>
<div id='pnlEntries' style='display:none'>
<table width='100%' border='0'>
<tr>
<td style='width:80%'>
<input type="text" x-webkit-speech name="name" onsubmit="$('#btnSubmitNewEntry').click();" id="tbNewEntry" data-clear-btn="true" value="" data-mini="true" onchange="this.onkeyup()" onkeyup='$("#lstEntries").prev().children(".ui-input-search").children("input").val(this.value).change();'/>
</td> <td>
<input id="btnSubmitNewEntry" onclick="addNewEntry($('#tbNewEntry').val());$('#tbNewEntry').val('').change();" type="submit" data-mini="true" data-theme="b" value="Add" />
</td>
</tr>
</table>
<hr>
<ul data-role="listview" id='lstEntries' data-filter="true"> <!-- filtering when entering value in add box... -->
</ul>
<div data-role="footer" data-id="foo1" data-position="fixed">
</div>
</div>
<div id='pnlShopDetails' style='display:none'>
<div data-role='fieldcontain'>
<label for="tbShopName">Shop-Name:</label>
<input type="text" id="tbShopName" onsubmit="$('#btnShopAddEdit').click();" placeholder="Name of the Shop" value="" />
</div>
<a id="btnShopAddEdit" data-role="button" data-icon="arrow-r" data-iconpos="right" onclick="shopChangeHandler($('#tbShopName').attr('globalid') || generateUUID(),$('#tbShopName').val())" type="submit" data-theme="b">Done</a>
<a id="btnShopDelete" data-role="button" data-icon="delete" data-iconpos="right" onclick="shopDeletion($('#tbShopName').attr('globalid'))" type="submit" data-theme="c">Delete Shop</a>
</div>
<div id='pnlTransferQ' style='display:none'>
<a data-role="button" data-icon="refresh" onclick='refreshTransferQDisplay()'>Refresh</a>
<ul data-role="listview" id='lstTransferQItems' data-filter="false">
</ul>
<hr/ >
<h3>Data:</h3>
<textarea style='background-colour:yellow' id='txtTransferQDetails'>
</textarea>
</div>
<div id='pnlSettings' style='display:none'>
<a id="btnUnbrand" data-role="button" data-icon="delete" data-iconpos="right" onclick="unbrandBrowser();" type="submit">Unbrand</a>
<a id="btnShowDebugConsole" data-role="button" data-icon="check" data-iconpos="right" onclick="window.console.log=myConsoleLog;$('#pnlDebugConsole').slideToggle(2000)" type="submit">Show Debug Console</a>
</div>
<div id='pnlAbout' style='display:none'>
Offline, Synchronizing ShoppingList<br />
Implemented and operated by Joe Tretter (j.tretter at gmail dot com)<br />
</div>
<div id='pnlDebugConsole' style='display:none'>
<div data-role="fieldcontain">
<label for="tbCode">Code</label>
<input onsubmit='$("#txtDebugOutput").text(eval($("#tbCode").val()))' id='tbCode'></input>
</div>
<div data-role="fieldcontain">
<label for="txtDebugOutput">Result Output</label>
<textarea cols="40" rows="8" id="txtDebugOutput"></textarea>
</div>
<div data-role="fieldcontain">
<label for="txtDebugConsole">Debug Console</label>
<textarea cols="40" rows="8" id="txtDebugConsole"></textarea>
</div>
</div>
<br />
<span id='lbRevision' style='font-size:xx-small' >$Revision: 74 $</span>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<!-- meta name="apple-mobile-web-app-capable" content="yes" / TODO: prevents from cache refreshing! -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Shopping List</title>
<style type="text/css">
@import "jquery.mobile.theme-1.3.2.css";
@import "jquery.mobile.structure-1.3.2.min.css";
legend { font-weight:bold;text-decoration:underline}
</style>
<script src="jquery-1.10.2.min.js"></script>
<script src="jquery.mobile-1.3.2.min.js"></script>
<script src="IndexedDBShim.js"></script>
<script src="jquery.indexeddb.js"></script>
<script src="globals.js"></script>
<script src="database.js"></script>
<script src="transfer.js"></script>
<script src="datahandler.js"></script>
<script src="helpers.js"></script>
<script src="uicontroler.js"></script>
<script language='JavaScript'>
$(document).bind('pageinit',function() {
defineDisplayStatus();
try {
if (applicationCache.status==applicationCache.IDLE) { applicationCache.update(); }
} catch(ex) {
console.log("Quick fix switch off appCache",ex);
}
$("#lbHeading").text("Shopping List");
$("#pnlHeading").show();
// get rid of the Searchbox of the Entries ListView
$("#lstEntries").prev().children(".ui-input-search").hide();
initSession();
// Enter key submits input fields
$("#tbCode,#tbShoppingListName,#tbNewEntry,#tbShopName").keyup( function(e) {
if (e.keyCode == 13) {
e.currentTarget.onsubmit();
}
});
// Setup recurring transfer poll
window.setInterval(transferQDispatcher,10000);
})
</script>
</head>
<body>
<div id='pnlHeading' data-role="header">
<a id="btnHeadingLeft" data-role="button" data-icon="arrow-l">TESTL</a>
<h1 id='lbHeading'>TESTMID</h1>
<a id="btnHeadingRight" data-role="button" data-icon="gear">TESTR</a>
<div id='pnlShops'>
</div>
<div id='pnlSettingsNav' style='display:none'>
<div data-role="navbar">
<ul>
<li><a onClick='showTransferQ();' class="ui-btn-active ui-state-persist">TransferQ</a></li>
<li><a onClick='setMode("SettingsSettings")'>Settings</a></li>
<li><a onClick='setMode("About")'>About</a></li>
</ul>
</div>
</div>
</div>
<div id='pnlBranding' style='display:none'>
<div id='pnlDisclaimer'>
<fieldset><legend>Terms of Use+Disclaimer</legend>
By using this service you agree to the following terms of use:
<ul>
<li>There is no guarantee of this service to be available and working at any point in time</li>
<li>There is no data security whatsoever, data might be lost or shared</li>
<li>This service does not offer any form of data protection or privacy</li>
<li>No claims can be made for any demage due to using this service</li>
<li>Data entered into this system immediately becomes ownership of the system operator</li>
<li>Even though there are no access restrictions this system isn't available for public use</li>
<ul>
<br>
<a data-role="button" data-icon="check" data-iconpos="right" onclick='$("#pnlDisclaimer").slideUp();$("#pnlDisclaimerAccepted").slideDown();' >Agree</a>
<a data-role="button" data-icon="delete" data-iconpos="right" href='http://www.google.com' >Decline</a>
</fieldset>
</div>
<div id='pnlDisclaimerAccepted' style='display:none'>
<table>
<tr>
<td>Shopping List Name:</td>
<td><input type='text' onsubmit='$("#btnSubmitBranding").click();' style='width:200px' id='tbShoppingListName' value=''></input></td>
</tr><tr>
<td colspan='2'> <a data-role="button" data-icon="arrow-r" data-iconpos="right" id='btnSubmitBranding' onclick='JavaScript:brandBrowser($("#tbShoppingListName").val());' >Brand</a> </td>
</tr>
</table>
<br />
<hr />
<br />
<fieldset><legend>INFO</legend>
In order to access a shopping list form multiple computers there must be an identifier that is unique for each shopping list.
Everybody who knows this identifier can access this shopping list!
</fieldset>
</div>
</div>
<div id='pnlEntries' style='display:none'>
<table width='100%' border='0'>
<tr>
<td style='width:80%'>
<input type="text" x-webkit-speech name="name" onsubmit="$('#btnSubmitNewEntry').click();" id="tbNewEntry" data-clear-btn="true" value="" data-mini="true" onchange="this.onkeyup()" onkeyup='$("#lstEntries").prev().children(".ui-input-search").children("input").val(this.value).change();'/>
</td> <td>
<input id="btnSubmitNewEntry" onclick="addNewEntry($('#tbNewEntry').val());$('#tbNewEntry').val('').change();" type="submit" data-mini="true" data-theme="b" value="Add" />
</td>
</tr>
</table>
<hr>
<ul data-role="listview" id='lstEntries' data-filter="true"> <!-- filtering when entering value in add box... -->
</ul>
<div data-role="footer" data-id="foo1" data-position="fixed">
</div>
</div>
<div id='pnlShopDetails' style='display:none'>
<div data-role='fieldcontain'>
<label for="tbShopName">Shop-Name:</label>
<input type="text" id="tbShopName" onsubmit="$('#btnShopAddEdit').click();" placeholder="Name of the Shop" value="" />
</div>
<a id="btnShopAddEdit" data-role="button" data-icon="arrow-r" data-iconpos="right" onclick="shopChangeHandler($('#tbShopName').attr('globalid') || generateUUID(),$('#tbShopName').val())" type="submit" data-theme="b">Done</a>
<a id="btnShopDelete" data-role="button" data-icon="delete" data-iconpos="right" onclick="shopDeletion($('#tbShopName').attr('globalid'))" type="submit" data-theme="c">Delete Shop</a>
</div>
<div id='pnlTransferQ' style='display:none'>
<a data-role="button" data-icon="refresh" onclick='refreshTransferQDisplay()'>Refresh</a>
<ul data-role="listview" id='lstTransferQItems' data-filter="false">
</ul>
<hr/ >
<h3>Data:</h3>
<textarea style='background-colour:yellow' id='txtTransferQDetails'>
</textarea>
</div>
<div id='pnlSettings' style='display:none'>
<a id="btnUnbrand" data-role="button" data-icon="delete" data-iconpos="right" onclick="unbrandBrowser();" type="submit">Unbrand</a>
<a id="btnShowDebugConsole" data-role="button" data-icon="check" data-iconpos="right" onclick="window.console.log=myConsoleLog;$('#pnlDebugConsole').slideToggle(2000)" type="submit">Show Debug Console</a>
</div>
<div id='pnlAbout' style='display:none'>
Offline, Synchronizing ShoppingList<br />
Implemented and operated by Joe Tretter (j.tretter at gmail dot com)<br />
</div>
<div id='pnlDebugConsole' style='display:none'>
<div data-role="fieldcontain">
<label for="tbCode">Code</label>
<input onsubmit='$("#txtDebugOutput").text(eval($("#tbCode").val()))' id='tbCode'></input>
</div>
<div data-role="fieldcontain">
<label for="txtDebugOutput">Result Output</label>
<textarea cols="40" rows="8" id="txtDebugOutput"></textarea>
</div>
<div data-role="fieldcontain">
<label for="txtDebugConsole">Debug Console</label>
<textarea cols="40" rows="8" id="txtDebugConsole"></textarea>
</div>
</div>
<br />
<span id='lbRevision' style='font-size:xx-small' >$Revision: 74 $</span>
</body>
</html>