favicon2 #15
3 changed files with 12 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
11
beer/beer.py
11
beer/beer.py
|
@ -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='::')
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue