diff --git a/notebook/static/base/images/favicon-busy-1.ico b/notebook/static/base/images/favicon-busy-1.ico new file mode 100644 index 0000000000..5b46a82261 Binary files /dev/null and b/notebook/static/base/images/favicon-busy-1.ico differ diff --git a/notebook/static/base/images/favicon-busy-2.ico b/notebook/static/base/images/favicon-busy-2.ico new file mode 100644 index 0000000000..4a8b841c2b Binary files /dev/null and b/notebook/static/base/images/favicon-busy-2.ico differ diff --git a/notebook/static/base/images/favicon-busy-3.ico b/notebook/static/base/images/favicon-busy-3.ico new file mode 100644 index 0000000000..b5edce5733 Binary files /dev/null and b/notebook/static/base/images/favicon-busy-3.ico differ diff --git a/notebook/static/base/images/favicon-busy.ico b/notebook/static/base/images/favicon-busy.ico deleted file mode 100644 index 85f9995a47..0000000000 Binary files a/notebook/static/base/images/favicon-busy.ico and /dev/null differ diff --git a/notebook/static/base/images/favicon-file.ico b/notebook/static/base/images/favicon-file.ico new file mode 100644 index 0000000000..8167018cd0 Binary files /dev/null and b/notebook/static/base/images/favicon-file.ico differ diff --git a/notebook/static/base/images/favicon-notebook.ico b/notebook/static/base/images/favicon-notebook.ico new file mode 100644 index 0000000000..4537e2d989 Binary files /dev/null and b/notebook/static/base/images/favicon-notebook.ico differ diff --git a/notebook/static/base/images/favicon-terminal.ico b/notebook/static/base/images/favicon-terminal.ico new file mode 100644 index 0000000000..ace499a338 Binary files /dev/null and b/notebook/static/base/images/favicon-terminal.ico differ diff --git a/notebook/static/base/js/utils.js b/notebook/static/base/js/utils.js index b70b3ceb65..474b034262 100644 --- a/notebook/static/base/js/utils.js +++ b/notebook/static/base/js/utils.js @@ -1051,6 +1051,17 @@ define([ fn(); } } + + var change_favicon = function (src) { + var link = document.createElement('link'), + oldLink = document.getElementById('favicon'); + link.id = 'favicon'; + link.type = 'image/x-icon'; + link.rel = 'shortcut icon'; + link.href = utils.url_path_join(utils.get_body_data('baseUrl'), src); + if (oldLink) document.head.removeChild(oldLink); + document.head.appendChild(link); + }; var utils = { throttle: throttle, @@ -1101,7 +1112,8 @@ define([ format_datetime: format_datetime, datetime_sort_helper: datetime_sort_helper, dnd_contain_file: dnd_contain_file, - _ansispan:_ansispan + _ansispan:_ansispan, + change_favicon: change_favicon }; return utils; diff --git a/notebook/static/notebook/js/notificationarea.js b/notebook/static/notebook/js/notificationarea.js index 121fc6be2c..89abc33e0d 100644 --- a/notebook/static/notebook/js/notificationarea.js +++ b/notebook/static/notebook/js/notificationarea.js @@ -40,6 +40,23 @@ define([ var $modal_ind_icon = $("#modal_indicator"); var $readonly_ind_icon = $('#readonly-indicator'); var $body = $('body'); + var interval = 0; + + var set_busy_favicon = function(on) { + if (on && !interval) { + var i = 0; + var icons = ['favicon-busy-1.ico', 'favicon-busy-3.ico', 'favicon-busy-3.ico']; + interval = setInterval(function() { + var icon = icons[i % 3]; + utils.change_favicon('/static/base/images/' + icon); + i += 1; + }, 300); + } else { + clearInterval(interval); + utils.change_favicon('/static/base/images/favicon-notebook.ico'); + interval = 0; + } + }; // Listen for the notebook loaded event. Set readonly indicator. this.events.on('notebook_loaded.Notebook', function() { @@ -244,41 +261,30 @@ define([ knw.danger(short, undefined, showMsg); }); - var change_favicon = function (src) { - var link = document.createElement('link'), - oldLink = document.getElementById('favicon'); - link.id = 'favicon'; - link.type = 'image/x-icon'; - link.rel = 'shortcut icon'; - link.href = utils.url_path_join(utils.get_body_data('baseUrl'), src); - if (oldLink) document.head.removeChild(oldLink); - document.head.appendChild(link); - }; - this.events.on('kernel_starting.Kernel kernel_created.Session', function () { // window.document.title='(Starting) '+window.document.title; $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); knw.set_message("Kernel starting, please wait..."); - change_favicon('/static/base/images/favicon-busy.ico'); + set_busy_favicon(true); }); this.events.on('kernel_ready.Kernel', function () { // that.save_widget.update_document_title(); $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); knw.info("Kernel ready", 500); - change_favicon('/static/base/images/favicon.ico'); + set_busy_favicon(false); }); this.events.on('kernel_idle.Kernel', function () { // that.save_widget.update_document_title(); $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle'); - change_favicon('/static/base/images/favicon.ico'); + set_busy_favicon(false); }); this.events.on('kernel_busy.Kernel', function () { // window.document.title='(Busy) '+window.document.title; $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy'); - change_favicon('/static/base/images/favicon-busy.ico'); + set_busy_favicon(true); }); this.events.on('spec_match_found.Kernel', function (evt, data) { diff --git a/notebook/templates/edit.html b/notebook/templates/edit.html index 9cda9fbc7b..8c69952be2 100644 --- a/notebook/templates/edit.html +++ b/notebook/templates/edit.html @@ -2,6 +2,8 @@ {% block title %}{{page_title}}{% endblock %} +{% block favicon %}{% endblock %} + {% block stylesheet %} diff --git a/notebook/templates/notebook.html b/notebook/templates/notebook.html index 53e5ebbb4c..dfa9610e64 100644 --- a/notebook/templates/notebook.html +++ b/notebook/templates/notebook.html @@ -1,5 +1,7 @@ {% extends "page.html" %} +{% block favicon %}{% endblock %} + {% block stylesheet %} {% if mathjax_url %} diff --git a/notebook/templates/terminal.html b/notebook/templates/terminal.html index 945e190703..0a3cfd05c6 100644 --- a/notebook/templates/terminal.html +++ b/notebook/templates/terminal.html @@ -2,6 +2,8 @@ {% block title %}{{page_title}}{% endblock %} +{% block favicon %}{% endblock %} + {% block bodyclasses %}terminal-app {{super()}}{% endblock %} {% block params %}