Move all assets in-repo to allow service worker to cache them

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-09-12 01:02:20 +05:30
parent 8295277cba
commit 66621fe46d
9 changed files with 24 additions and 7 deletions

View File

@ -5,10 +5,23 @@ const precacheResources = [
'index.html',
'/bundle.min.js',
'/main.min.css',
'/fonts/Inter-UI-Bold.woff',
'/fonts/Inter-UI-Medium.woff',
'/fonts/Inter-UI-Medium.woff2',
'/fonts/fa-brands-400.woff',
'/css/fontawesome-5.9.0-all.min.css',
'/fonts/fa-solid-900.woff2',
'/fonts/Inter-UI-Italic.woff',
'/fonts/Inter-UI-Regular.woff',
'/fonts/Inter-UI-Italic.woff2',
'/fonts/Inter-UI-MediumItalic.woff2',
'/fonts/Inter-UI-MediumItalic.woff',
'/fonts/Inter-UI-BoldItalic.woff',
'/fonts/Inter-UI-Regular.woff2',
'/fonts/Inter-UI-Bold.woff2',
'/fonts/Inter-UI-Regular.woff',
'/fonts/Inter-UI-Bold.woff',
'/fonts/fa-solid-900.woff',
'/fonts/Inter-UI-BoldItalic.woff2',
'/fonts/fa-brands-400.woff2'
];
self.addEventListener('install', event => {

View File

@ -0,0 +1 @@
!function(){"use strict";var e="DIGITAL_CLIMATE_STRIKE",t="_DIGITAL_CLIMATE_STRIKE_WIDGET_CLOSED_",a=(new Date).getTime(),n=864e5,i=window.DIGITAL_CLIMATE_STRIKE_OPTIONS||{},o=void 0!==i.iframeHost?i.iframeHost:"https://assets.digitalclimatestrike.net",r=i.websiteName||null,l=i.footerDisplayStartDate||new Date(2019,7,1),d=i.fullPageDisplayStartDate||new Date(2019,8,20),g=!!i.forceFullPageWidget,u=parseFloat(i.cookieExpirationDays||1),s=!(!i.alwaysShowWidget&&-1===window.location.hash.indexOf("ALWAYS_SHOW_DIGITAL_CLIMATE_STRIKE")),c=!!i.disableGoogleAnalytics,m=!!i.showCloseButtonOnFullPageWidget,h=function(){var e="en";("es"===i.language||!i.language&&navigator&&navigator.language.match(/^es/))&&(e="es");("de"===i.language||!i.language&&navigator&&navigator.language.match(/^de/))&&(e="de");("cs"===i.language||!i.language&&navigator&&navigator.language.match(/^cs/))&&(e="cs");("fr"===i.language||!i.language&&navigator&&navigator.language.match(/^fr/))&&(e="fr");("nl"===i.language||!i.language&&navigator&&navigator.language.match(/^nl/))&&(e="nl");return e}();function f(){var t=document.createElement("div");t.id=e;var a=document.createElement("iframe");return a.src=function(){var e=o;e+="en"===h?"/index.html?":"/index-"+h+".html?";var t=[["hostname",window.location.host],["fullPageDisplayStartDate",d.toISOString()],["language",h]];return g&&t.push(["forceFullPageWidget","true"]),m&&t.push(["showCloseButtonOnFullPageWidget","true"]),c&&t.push(["googleAnalytics","false"]),r&&t.push(["websiteName",encodeURI(r)]),e+t.map(function(e){return e.join("=")}).join("&")}(),a.frameBorder=0,a.allowTransparency=!0,t.appendChild(a),document.body.appendChild(t),t}function v(){document.getElementById(e).remove(),window.removeEventListener("message",w),function(e,t,a){var i=new Date;i.setTime(i.getTime()+a*n);var o="expires="+i.toGMTString();document.cookie=e+"="+t+"; "+o+"; path=/"}(t,"true",u)}function w(t){var a;if(t.data.DIGITAL_CLIMATE_STRIKE)switch(t.data.action){case"maximize":return document.getElementById(e).style.width="100%",void(document.getElementById(e).style.height="100%");case"closeButtonClicked":return v();case"buttonClicked":return a=t.data.linkUrl,void(document.location=a)}}function I(){return l.getTime()>a&&d.getTime()>a||new Date(d.getTime()+n)<a||!!function(e){for(var t,a=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++)if(0==(t=n[i].trim()).indexOf(a))return t.substring(a.length,t.length);return""}(t)&&!s}function p(){if(!I()){f();var t,a,n,i=window.innerWidth<600?"200px":"145px";t="DIGITAL_STRIKE_CSS",a="#"+e+" { position: fixed; right: 0; left: 0; bottom: 0px; width: 100%; height: "+i+"; z-index: 20000; -webkit-overflow-scrolling: touch; overflow: hidden; } #"+e+" iframe { width: 100%; height: 100%; }",(n=document.createElement("style")).type="text/css",n.id=t,n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a)),document.head.appendChild(n),window.addEventListener("message",w),document.removeEventListener("DOMContentLoaded",p)}}switch(document.readyState){case"complete":case"loaded":case"interactive":p();break;default:document.addEventListener("DOMContentLoaded",p)}}();

View File

@ -31,10 +31,7 @@
{{ end }}
<!-- CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha256-UzFD2WYH2U1dQpKDjjZK72VtPeWP50NoJjd26rnAdUI=" crossorigin="anonymous" />
<!-- JS -->
<script src="https://assets.digitalclimatestrike.net/widget.js" async></script>
<link rel="stylesheet" href="/css/fontawesome-5.9.0-all.min.css" />
<!-- PWA -->
<meta name="msapplication-TileColor" content="#2b5797">

View File

@ -2,7 +2,8 @@
{{ $menu := resources.Get "js/menu.js" }}
{{ $prism := resources.Get "js/prism.js" }}
{{ $theme := resources.Get "js/theme.js" }}
{{ $secureJS := slice $main $menu $prism $theme | resources.Concat "bundle.js" | resources.Minify }}
{{ $climatestrike := resources.Get "js/digitalclimatestrike-widget.js" }}
{{ $secureJS := slice $main $menu $prism $theme $climatestrike | resources.Concat "bundle.js" | resources.Minify }}
<script type="text/javascript" src="{{ $secureJS.RelPermalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
{{- if .Site.GoogleAnalytics }}

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.