-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eshaan7
committed
Jul 4, 2019
1 parent
0ee48ef
commit 1781442
Showing
21 changed files
with
341 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(function() { | ||
if('serviceWorker' in navigator) { | ||
window.addEventListener('load', () => { | ||
navigator.serviceWorker.register('../sw.js') | ||
.then(function(registration) { | ||
console.log('Service Worker Registered'); | ||
return registration; | ||
}) | ||
.catch(function(err) { | ||
console.error('Unable to register service worker.', err); | ||
}); | ||
navigator.serviceWorker.ready.then(function(registration) { | ||
console.log('Service Worker Ready'); | ||
}); | ||
}); | ||
} | ||
})(); | ||
|
||
let deferredPrompt; | ||
const btnAdd = document.querySelector('#btnAdd'); | ||
|
||
window.addEventListener('beforeinstallprompt', (e) => { | ||
console.log('beforeinstallprompt event fired'); | ||
e.preventDefault(); | ||
deferredPrompt = e; | ||
btnAdd.style.visibility = 'visible'; | ||
}); | ||
|
||
btnAdd.addEventListener('click', (e) => { | ||
btnAdd.style.visibility = 'hidden'; | ||
deferredPrompt.prompt(); | ||
deferredPrompt.userChoice | ||
.then((choiceResult) => { | ||
if (choiceResult.outcome === 'accepted') { | ||
console.log('User accepted the A2HS prompt'); | ||
} else { | ||
console.log('User dismissed the A2HS prompt'); | ||
} | ||
deferredPrompt = null; | ||
}); | ||
}); | ||
|
||
window.addEventListener('appinstalled', (evt) => { | ||
app.logEvent('app', 'installed'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"name": "IPU GPA Calculator", | ||
"short_name": "IPU GPA Calculator", | ||
"description": "This simple flask PWA is to help calculate GPA/Grade for GGSIPU University students.", | ||
"theme_color": "#000", | ||
"background_color": "#fff", | ||
"display": "standalone", | ||
"orientation": "portrait", | ||
"scope": "/", | ||
"start_url": "/", | ||
"icons": [ | ||
{ | ||
"src": "images/icons/icon-36x36.png", | ||
"sizes": "36x36", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-48x48.png", | ||
"sizes": "48x48", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-72x72.png", | ||
"sizes": "72x72", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-96x96.png", | ||
"sizes": "96x96", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-128x128.png", | ||
"sizes": "128x128", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-144x144.png", | ||
"sizes": "144x144", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-152x152.png", | ||
"sizes": "152x152", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-192x192.png", | ||
"sizes": "192x192", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "images/icons/icon-512x512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Offline!</title> | ||
</head> | ||
<body> | ||
<h1>It seems you might be offline!</h1> | ||
<p><a href="/">Go back to home page </a></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
self.addEventListener("install", function(event) { | ||
event.waitUntil(preLoad()); | ||
}); | ||
|
||
var preLoad = function(){ | ||
console.log("Installing web app"); | ||
return caches.open("offline").then(function(cache) { | ||
console.log("caching index and important routes"); | ||
return cache.addAll(["/","/static/js/app.js", "/static/css/main.css", "/static/images/favicon.ico","/home", "/offline.html"]); | ||
}); | ||
}; | ||
|
||
self.addEventListener("fetch", function(event) { | ||
event.respondWith(checkResponse(event.request).catch(function() { | ||
return returnFromCache(event.request); | ||
})); | ||
event.waitUntil(addToCache(event.request)); | ||
}); | ||
|
||
var checkResponse = function(request){ | ||
return new Promise(function(fulfill, reject) { | ||
fetch(request).then(function(response){ | ||
if(response.status !== 404) { | ||
fulfill(response); | ||
} else { | ||
reject(); | ||
} | ||
}, reject); | ||
}); | ||
}; | ||
|
||
var addToCache = function(request){ | ||
return caches.open("offline").then(function (cache) { | ||
return fetch(request).then(function (response) { | ||
console.log(response.url + " was cached"); | ||
return cache.put(request, response); | ||
}); | ||
}); | ||
}; | ||
|
||
var returnFromCache = function(request){ | ||
return caches.open("offline").then(function (cache) { | ||
return cache.match(request).then(function (matching) { | ||
if(!matching || matching.status == 404) { | ||
return cache.match("offline.html"); | ||
} else { | ||
return matching; | ||
} | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<!-- PWA --> | ||
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}"> | ||
<!-- "Metadata. The story behind the data" ~ Elliot Alderson --> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<meta name="description" content="GGSIPU GPA/Grade Calculator"> | ||
<meta name="keywords" content="GGSIPU, IPU, grade, cgpa, Eshaan Bansal, gpa, gpa calculator"> | ||
<meta property="og:description" content="GGSIPU GPA/Grade Calculator"> | ||
<meta property="og:title" content="IPU GPA Calculator"> | ||
<meta property="og:type" content="website"> | ||
<!-- Favicon --> | ||
<link rel='shortcut icon' type='image/x-icon' href="{{ url_for('static', filename='images/favicon.ico') }}"/> | ||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | ||
<!-- Font Awesome --> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"> | ||
<!-- local css --> | ||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/main.css') }}"/> | ||
{% block head %}{% endblock %} | ||
<!-- Title --> | ||
<title>IPU GPA Calculator</title> | ||
</head> | ||
|
||
<body> | ||
|
||
{% block body %} {% endblock %} | ||
<!-- PWA stuff --> | ||
<script type="text/javascript" src="{{ url_for('static', filename='js/app.js') }}"></script> | ||
<script type="text/javascript"> | ||
if (!navigator.serviceWorker.controller) { | ||
navigator.serviceWorker.register("/sw.js").then(function(reg) { | ||
console.log("Service worker has been registered for scope: " + reg.scope); | ||
}); | ||
} | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
File renamed without changes.
Oops, something went wrong.