File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ assets:
115115 # only works if `assets.self_host.enabled` is 'true'
116116 env : # [development|production]
117117
118+ pwa :
119+ enabled : true # the option for PWA feature
120+
118121paginate : 10
119122
120123# ------------ The following options are not recommended to be modified ------------------
Original file line number Diff line number Diff line change 9090
9191{% if jekyll.environment == 'production' %}
9292 <!-- PWA -->
93- < script defer src ="{{ '/app.js' | relative_url }} "> </ script >
93+ {% if site.pwa.enabled %}
94+ < script defer src ="{{ '/app.js' | relative_url }} "> </ script >
95+ {% else %}
96+ < script defer src ="{{ '/unregister.js' | relative_url }} "> </ script >
97+ {% endif %}
9498
9599 <!-- GA -->
96100 {% if site.google_analytics.id != empty and site.google_analytics.id %}
Original file line number Diff line number Diff line change 4848 < i class ="fas fa-angle-up "> </ i >
4949 </ a >
5050
51- < div id ="notification " class ="toast " role ="alert " aria-live ="assertive " aria-atomic ="true "
52- data-animation ="true " data-autohide ="false ">
53- < div class ="toast-header ">
54- < button type ="button " class ="ml-2 ml-auto close " data-dismiss ="toast " aria-label ="Close ">
55- < span aria-hidden ="true "> ×</ span >
56- </ button >
51+ {% if site.pwa.enabled %}
52+ < div id ="notification " class ="toast " role ="alert " aria-live ="assertive " aria-atomic ="true "
53+ data-animation ="true " data-autohide ="false ">
54+ < div class ="toast-header ">
55+ < button type ="button " class ="ml-2 ml-auto close " data-dismiss ="toast " aria-label ="Close ">
56+ < span aria-hidden ="true "> ×</ span >
57+ </ button >
58+ </ div >
59+ < div class ="toast-body text-center pt-0 ">
60+ < p class ="pl-2 pr-2 mb-3 "> {{ site.data.locales[lang].notification.update_found }}</ p >
61+ < button type ="button " class ="btn btn-primary " aria-label ="Update ">
62+ {{ site.data.locales[lang].notification.update }}
63+ </ button >
64+ </ div >
5765 </ div >
58- < div class ="toast-body text-center pt-0 ">
59- < p class ="pl-2 pr-2 mb-3 "> {{ site.data.locales[lang].notification.update_found }}</ p >
60- < button type ="button " class ="btn btn-primary " aria-label ="Update ">
61- {{ site.data.locales[lang].notification.update }}
62- </ button >
63- </ div >
64- </ div >
66+ {% endif %}
6567
6668 {% include search-loader.html %}
6769
Original file line number Diff line number Diff line change 1+ -- -
2+ layout : compress
3+ permalink: '/unregister.js'
4+ -- -
5+
6+ if ( 'serviceWorker' in navigator ) {
7+ navigator . serviceWorker . getRegistrations ( ) . then ( ( registrations ) => {
8+ for ( let reg of registrations ) {
9+ reg . unregister ( ) ;
10+ }
11+ } ) ;
12+ }
You can’t perform that action at this time.
0 commit comments