diff options
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/gen-docs.js | 29 | ||||
| -rw-r--r-- | docs/src/templates/index.html | 11 | ||||
| -rw-r--r-- | docs/src/templates/offline.html | 4 | 
3 files changed, 43 insertions, 1 deletions
| diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index 1e5a09c4..ead01c32 100644 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -27,6 +27,10 @@ var writes = callback.chain(function(){    writer.copyDir('img', writes.waitFor());    writer.copyDir('examples', writes.waitFor());    writer.copyTpl('index.html', writes.waitFor()); +  writer.copyTpl('offline.html', writes.waitFor()); +  writer.output('app-cache.manifest', +                appCacheTemplate().replace(/%TIMESTAMP%/, (new Date()).toISOString()), +                writes.waitFor());    writer.merge(['docs.js',                  'doc_widgets.js'],                 'docs-combined.js', @@ -59,3 +63,28 @@ writer.makeDir('build/docs/syntaxhighlighter', work);  ///////////////////////////////////  function now(){ return new Date().getTime(); } + + +function appCacheTemplate() { +  return ["CACHE MANIFEST", +          "# %TIMESTAMP%", +          "", +          "# cache all of these", +          "CACHE:", +          "jquery.min.js", +          "syntaxhighlighter/syntaxhighlighter-combined.js", +          "../angular.min.js", +          "docs-combined.js", +          "docs-keywords.js", +          "docs-combined.css", +          "syntaxhighlighter/syntaxhighlighter-combined.css", +          "img/texture_1.png", +          "img/yellow_bkgnd.jpg", +          "", +          "FALLBACK:", +          "/ offline.html", +          "", +          "# allow access to google analytics and twitter when we are online", +          "NETWORK:", +          "*"].join('\n'); +} diff --git a/docs/src/templates/index.html b/docs/src/templates/index.html index 9e0c64ba..cdd04e1d 100644 --- a/docs/src/templates/index.html +++ b/docs/src/templates/index.html @@ -1,7 +1,8 @@  <!doctype html>  <html xmlns:ng="http://angularjs.org/"        xmlns:doc="http://docs.angularjs.org/" -      ng:controller="DocsController"> +      ng:controller="DocsController" +      manifest="app-cache.manifest">  <head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    <title ng:bind-template="<angular/>: {{partialTitle}}"><angular/></title> @@ -20,6 +21,14 @@        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);      })(); + +    // force page reload when new update is available +    window.applicationCache && window.applicationCache.addEventListener('updateready', function(e) { +      if (window.applicationCache.status == window.applicationCache.UPDATEREADY) { +        window.applicationCache.swapCache(); +        window.location.reload(); +      } +    }, false);    </script>  </head> diff --git a/docs/src/templates/offline.html b/docs/src/templates/offline.html new file mode 100644 index 00000000..9996eb1c --- /dev/null +++ b/docs/src/templates/offline.html @@ -0,0 +1,4 @@ +<h2>OFFLINE</h2> + +<p>This page if unavailable because your are offline.</p> +<p>Please connect to the Internet and reload the page.</p> | 
