favicon2 #15

Merged
kleph merged 3 commits from favicon2 into master 2020-04-09 01:03:53 +02:00
3 changed files with 12 additions and 3 deletions
Showing only changes of commit 9694eb66b4 - Show all commits

View file

@ -2,7 +2,7 @@ FROM python:slim
RUN pip install flask RUN pip install flask
COPY /beer/beer.py /beer.py COPY /beer/beer.py /beer.py
COPY /beer/static /static COPY /beer/templates /templates
COPY /beer/static /static COPY /beer/static /static
EXPOSE 5000 EXPOSE 5000

View file

@ -28,9 +28,18 @@ def index(hours=None, minutes=None):
@app.route('/favicon.ico') @app.route('/favicon.ico')
def favicon(): def favicon():
""" serve the favicon """ """ serve default favicon """
return send_from_directory('static', 'clock-icon.png') return send_from_directory('static', 'clock-icon.png')
@app.route('/favicon/<mode>')
def favicon():
""" serve the favicon according to the timer """
if mode == 'beer':
return send_from_directory('static', 'beer-icon.png')
else:
return send_from_directory('static', 'clock-icon.png')
def main(): def main():
""" main func """ """ main func """
app.run(host='::') app.run(host='::')

View file

@ -85,7 +85,7 @@ var x = setInterval(function() {
if (distance < 0) { if (distance < 0) {
clearInterval(x); clearInterval(x);
document.getElementById("demo").innerHTML = "<blink>BEER TIME !</blink>"; document.getElementById("demo").innerHTML = "<blink>BEER TIME !</blink>";
changeFavicon('beer-icon.png') changeFavicon('/favicon/beer')
} }
}, 1000); }, 1000);
</script> </script>