Initial commit to branch upgrade-js

Start incrementally adding to sites javascript. Starting with, handling
application cache events, then considering additional features like
using local storage to allow offline reading of posts, as well as an
interface to view and manage them.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
Collin J. Doering 2015-08-17 03:01:51 -04:00
parent c2aefc647f
commit e7decd4349
1 changed files with 10 additions and 0 deletions

View File

@ -218,6 +218,11 @@ _paq.push(['enableLinkTracking']);
});
}
function appCacheUpdateReady () {
window.applicationCache.swapCache();
// TODO: find what resource is loaded currently and reload it if it has changed
}
function init(router) {
router.setCallback(loadPageContent);
@ -225,6 +230,11 @@ _paq.push(['enableLinkTracking']);
router.runRouter(location.pathname);
});
window.addEventListener("updateready", appCacheUpdateReady);
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
appCacheUpdateReady();
}
$(document).ready(function () {
$('#nav-menu a.menuitem').click(function () {
$(this).closest('ul').find('li.active').removeClass('active');