<script src="/components/underscore/underscore-min.js"></script>
<script src="/components/jquery/dist/jquery.min.js"></script>
<script src="/components/promise-polyfill/dist/promise.min.js"></script>

<script src="/components/moment/min/moment-with-locales.min.js"></script>

<script src="/bootstrap-3.3.7/js/bootstrap.js"></script>

<link href="/components/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<script src="/components/bootstrap-daterangepicker/daterangepicker.js"></script>

<link href="/components/summernote/dist/summernote.css" rel="stylesheet">
<script src="/components/summernote/dist/summernote.min.js"></script>

<script src="/components/fetch/fetch.js"></script>
<script src="/components/event-source-polyfill/src/eventsource.min.js"></script>
<script src="/components/handlebars/handlebars.min.js"></script>

<script src="/components/favico.js/favico.js"></script>

<script src="/wd.js"></script>
<script type="text/javascript">
    $(function() {
        $("[rel='tooltip']").tooltip();
    });
</script>

{{#if inboxId}}
    <script>
        var INBOX_ID = '{{inboxId}}';
        var INBOX_UNSEEN = {{inboxUnseen}};
        var FAVICON = new Favico({
            animation:'slide'
        });

        if(INBOX_UNSEEN){
            FAVICON.badge(INBOX_UNSEEN);
        }
    </script>
{{else}}
    <script>
        var INBOX_ID = -1;
        var INBOX_UNSEEN = 0;
        var FAVICON = false;
    </script>
{{/if}}

{{#if successlog}}
<script src="/login-key-handler.js"></script>
<script>
    $(function() {
        // store token about successful auth in this browser
        var successlog = {{{successlog}}};
        loginKeyHandler.set(successlog.username, successlog.value, 'recovery', successlog.days);
    });
</script>
{{/if}}

<script>
window.setTimeout(function(){
    var alerts = document.querySelectorAll('.flash-messages');
    var elm;
    for(var i=0, len = alerts.length; i<len; i++){
        elm = alerts[i];
        if(elm.parentNode){
            elm.parentNode.removeChild(elm);
        }
    }
}, 10 * 1000);

</script>
