Skip to content

Commit ae4555a

Browse files
committed
- Fixed problems with plugin disable
- Added service worker to online template - Build uses distribution folder
1 parent 0cf7a4e commit ae4555a

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

bld.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Build SamplePlugin for TiddlyWiki5
44

5-
TIDDLYWIKI_PLUGIN_PATH="/h/My Dropbox/tiddlywiki/plugins/danielo515/tiddlypouchPlugin/master/src/plugins" tiddlywiki \
5+
TIDDLYWIKI_PLUGIN_PATH="/h/My Dropbox/tiddlywiki/plugins/danielo515/tiddlypouchPlugin/master/dist" tiddlywiki \
66
./wiki \
77
--verbose \
88
--build index --build OnlineDemo \
@@ -13,4 +13,4 @@ mv ./wiki/output/license.md license.md
1313
mv ./wiki/output/index.html ../gh-pages
1414
mv ./wiki/output/online.html ../gh-pages/online/index.html
1515

16-
cd ../gh-pages && git add . && git commit -m "$1" && git push origin master
16+
cd ../gh-pages && git add . && git commit -m "${1:-Deployed to github pages}" && git push origin master

wiki/tiddlers/Site/site_config.multids

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ title: $:/
33

44
state/sidebar: no
55
config/WikiParserRules/Inline/wikilink: disable
6-
config/Toolbar/Icons: no
7-
config/Plugins/Disabled/$:/plugins/danielo515/tiddlypouch: yes
6+
config/Toolbar/Icons: no
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
title: $:/config/Plugins/Disabled/$:/plugins/danielo515/tiddlypouch
2+
text: yes

wiki/tiddlers/system/build_templates/online.html.tid

+25-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: $:/NoteSelf/templates/online.html
77
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Force IE standards mode for Intranet and HTA - should be the first meta -->
88
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
99

10-
<link rel="manifest" href="manifest.json" />
10+
<link rel="manifest" href="manifest.json" >
1111

1212
<meta name="application-name" content="NoteSelf" />
1313
<meta name="generator" content="NoteSelf" />
@@ -51,5 +51,29 @@ title: $:/NoteSelf/templates/online.html
5151
<div id="bootKernel" style="display:none;">
5252
{{ $:/boot/boot.js ||$:/core/templates/javascript-tiddler}}
5353
</div>
54+
<script>
55+
(function(){
56+
var shouldRegister = window.location.protocol === 'https:' || window.location.hostname === 'localhost';
57+
if ('serviceWorker' in navigator && shouldRegister) {
58+
navigator.serviceWorker.register('sw.js').then(function(registration) {
59+
// only show message on worker installed event
60+
registration.onupdatefound = function() {
61+
var worker = registration.installing;
62+
if (!worker) return;
63+
64+
worker.onstatechange = function() {
65+
if (worker.state === "installed") {
66+
console.log('<i class="fa fa-download"></i> Caching completed. This app works offline!');
67+
console.log($tw);
68+
}
69+
};
70+
};
71+
}).catch(function(err) {
72+
Raven.captureException(err);
73+
console.log('sw failure', err);
74+
});
75+
}
76+
})();
77+
</script>
5478
</body>
5579
</html>

0 commit comments

Comments
 (0)