Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PWA compliancy (Progressive Web App) #183

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion myviews/footer.ejs
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
<script>
if ('serviceWorker' in navigator) {
// Register a service worker hosted at the root of the
// site using the default scope.
navigator.serviceWorker.register('<%=baseUrl%>/service-worker.js').then(function(registration) {
console.log('Service worker registration succeeded:', registration);
}, /*catch*/ function(error) {
console.log('Service worker registration failed:', error);
});
} else {
console.log('Service workers are not supported.');
}
</script>

</body>
</html>
</html>
5 changes: 5 additions & 0 deletions myviews/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
<meta charset="utf-8">
<meta http-equiv="Cache-control" content="public">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="mobile-web-app-capable" content="yes" />

<!-- Additional js libs -->
<script src="<%=baseUrl%>/js/jquery-3.3.1.slim.min.js"></script>
<script src="<%=baseUrl%>/js/bootstrap.min.js"></script>

<!-- Manifest -->
<link rel="manifest" href="<%=baseUrl%>/site.webmanifest">

<!--- CSS -->
<link rel="stylesheet" href="<%=baseUrl%>/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=baseUrl%>/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=baseUrl%>/css/styles.css">

<!-- Apply UI customisations -->
<%if(globals.custBrand !== ""){%>
<style>.banners { font-family: '<%=globals.custBrand%>'; }</style>
Expand Down
7 changes: 7 additions & 0 deletions public/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});
19 changes: 19 additions & 0 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name":"Posterr",
"short_name":"Posterr",
"icons":[{
"src":"favicons/android-chrome-192x192.png",
"sizes":"192x192",
"type":"image/png"
},
{
"src":"favicons/android-chrome-512x512.png",
"sizes":"512x512",
"type":"image/png"
}],
"theme_color":"#000000",
"background_color":"#000000",
"display":"fullscreen",
"description": "Now Showing and Upcoming Media",
"start_url":"./"
}