Change favicon when busy

Grant Nestor 10 years ago
parent b10479bb40
commit e832689923

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@ -254,15 +254,28 @@ define([
$kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle');
knw.info("Kernel ready", 500);
});
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 = src;
if (oldLink) document.head.removeChild(oldLink);
document.head.appendChild(link);
};
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' + '?=' + Math.random());
});
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' + '?=' + Math.random());
});
this.events.on('spec_match_found.Kernel', function (evt, data) {

@ -5,7 +5,7 @@
<meta charset="utf-8">
<title>{% block title %}Jupyter Notebook{% endblock %}</title>
{% block favicon %}<link rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">{% endblock %}
{% block favicon %}<link id="favicon" rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">{% endblock %}
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="{{static_url("components/jquery-ui/themes/smoothness/jquery-ui.min.css") }}" type="text/css" />
<link rel="stylesheet" href="{{static_url("components/jquery-typeahead/dist/jquery.typeahead.min.css") }}" type="text/css" />

Loading…
Cancel
Save