fds
parent
6993d28e18
commit
2dc99c8d18
|
@ -106,6 +106,8 @@ def before_request():
|
||||||
if 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua or ' firefox/' in ua: g.inferior_browser = True
|
if 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua or ' firefox/' in ua: g.inferior_browser = True
|
||||||
else: g.inferior_browser = False
|
else: g.inferior_browser = False
|
||||||
|
|
||||||
|
g.timestamp = int(time.time())
|
||||||
|
|
||||||
|
|
||||||
@app.teardown_appcontext
|
@app.teardown_appcontext
|
||||||
def teardown_request(error):
|
def teardown_request(error):
|
||||||
|
|
|
@ -426,3 +426,10 @@ def settings_security(v):
|
||||||
def googleplayapp():
|
def googleplayapp():
|
||||||
with open("files/assets/assetlinks.json", "r") as f:
|
with open("files/assets/assetlinks.json", "r") as f:
|
||||||
return Response(f.read(), mimetype='application/json')
|
return Response(f.read(), mimetype='application/json')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.post("/dismiss_mobile_tip")
|
||||||
|
def dismiss_mobile_tip():
|
||||||
|
session["tooltip_last_dismissed"] = int(time.time())
|
||||||
|
return "", 204
|
|
@ -260,4 +260,32 @@
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if request.path == '/' and g.timestamp > session.get('tooltip_last_dismissed',0)+60*60*24*30 and not g.webview %}
|
||||||
|
<div id="mobile-prompt-container" class="fixed-top">
|
||||||
|
<div id="mobile-prompt" href="javascript:void(0)" data-bs-toggle="tooltip" data-bs-container="#mobile-prompt-container" data-bs-placement="top" data-bs-trigger="click" data-bs-original-title="Install the {{SITE_NAME}} webapp by saving this page to your home screen!"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
if (!("standalone" in window.navigator) && !(window.navigator.standalone)) {
|
||||||
|
if (window.innerWidth <= 737) {
|
||||||
|
const tt = bootstrap.Tooltip.getOrCreateInstance(document.getElementById('mobile-prompt'))
|
||||||
|
tt.show()
|
||||||
|
document.getElementsByClassName('tooltip')[0].onclick = function(event){
|
||||||
|
tt.hide()
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.withCredentials=true;
|
||||||
|
xhr.open("POST", '/dismiss_mobile_tip', true);
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#mobile-prompt + .bs-tooltip-bottom {
|
||||||
|
transform: translate3d(98%, 0px, 0px) !important
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue