{% extends 'layouts/default.html' %}

{% set title = gateway.title %}

{% block content %}
{% include 'wifidog/_facebook.html' %}

<portal gateway={{ gateway.id }} time_left={{ voucher and voucher.time_left }}></portal>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='tags/property.tag') }}" type="riot/tag"></script>
<script src="{{ url_for('static', filename='tags/portal.tag') }}" type="riot/tag"></script>
{% if voucher %}
<script>
Zepto(function($) {
    var time_left = {{ voucher.time_left }};

    if(time_left > 0) {
        setInterval(function() {
            time_left--;
            $('#time_left').html(time_left);
        }, 60000);
    }

    if(time_left > 5) {
        setTimeout(function() {
            new Notification('Your session is about to expire. You have 5 minutes left.');
        }, (time_left - 5) * 60000);
    }
});
</script>
{% endif %}
{% endblock %}

{% extends 'layouts/default.html' %}

{% set title = gateway.title %}

{% block content %}
{% include 'wifidog/_facebook.html' %}

<portal gateway={{ gateway.id }} time_left={{ voucher and voucher.time_left }}></portal>
{% endblock %}

{% block scripts %}
<script src="{{ url_for('static', filename='tags/property.tag') }}" type="riot/tag"></script>
<script src="{{ url_for('static', filename='tags/portal.tag') }}" type="riot/tag"></script>
{% if voucher %}
<script>
Zepto(function($) {
    var time_left = {{ voucher.time_left }};

    if(time_left > 0) {
        setInterval(function() {
            time_left--;
            $('#time_left').html(time_left);
        }, 60000);
    }

    if(time_left > 5) {
        setTimeout(function() {
            new Notification('Your session is about to expire. You have 5 minutes left.');
        }, (time_left - 5) * 60000);
    }

    if(time_left > 10) {
        setTimeout(function() {
            new Notification('Your session is about to expire. You have 10 minutes left.');
        }, (time_left - 10) * 60000);
    }
});
</script>
{% endif %}
{% endblock %}

Add notification at 10 minutes
Add notification at 10 minutes
