From 1bab7402af40b2d9baf281c881f1999304aad689 Mon Sep 17 00:00:00 2001 From: Benoit Schweblin Date: Thu, 4 Apr 2013 21:10:49 +0100 Subject: [PATCH] Force refresh when UPDATEREADY --- cache.manifest | 2 +- js/core.js | 2 +- js/main.js | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cache.manifest b/cache.manifest index bd4a1fed..c55af310 100644 --- a/cache.manifest +++ b/cache.manifest @@ -1 +1 @@ -CACHE MANIFEST # v8 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/prod/custo.js js/async-runner.js js/bootstrap.js js/config.js js/gdrive.js js/jgrowl.js js/jquery.js js/jquery-ui.js js/layout.js js/main.js js/Markdown.Converter.js js/Markdown.Editor.js js/Markdown.Sanitizer.js js/require.js js/synchronizer.js img/ajax-loader.gif img/dropbox.png img/gdrive.png img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/stackedit-16.png img/stackedit-32.ico NETWORK: * +CACHE MANIFEST # v19 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/prod/custo.js js/async-runner.js js/bootstrap.js js/config.js js/gdrive.js js/jgrowl.js js/jquery.js js/jquery-ui.js js/layout.js js/main.js js/Markdown.Converter.js js/Markdown.Editor.js js/Markdown.Sanitizer.js js/require.js js/synchronizer.js img/ajax-loader.gif img/dropbox.png img/gdrive.png img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/stackedit-16.png img/stackedit-32.ico NETWORK: * diff --git a/js/core.js b/js/core.js index bd5ec280..93302d44 100644 --- a/js/core.js +++ b/js/core.js @@ -258,7 +258,7 @@ define(["jquery", "bootstrap", "jgrowl", "layout", "Markdown.Editor"], function( }; core.init = function() { - + // jGrowl configuration $.jGrowl.defaults.life = 5000; $.jGrowl.defaults.closer = false; diff --git a/js/main.js b/js/main.js index 79e571be..949d714c 100644 --- a/js/main.js +++ b/js/main.js @@ -16,6 +16,14 @@ requirejs.config({ }); require(["jquery", "core", "file-manager", "config", "custo"], function($, core, fileManager) { $(function() { + + // If browser downloaded a new app cache. + if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { + window.applicationCache.swapCache(); + window.location.reload(); + return; + } + core.init(); fileManager.init(); });