Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change favicon when busy #1837

Merged
merged 2 commits into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added notebook/static/base/images/favicon-busy.ico
Binary file not shown.
23 changes: 19 additions & 4 deletions notebook/static/notebook/js/notificationarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,27 +242,42 @@ define([
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead');
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 = 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;
// 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');
});

this.events.on('kernel_ready.Kernel', function () {
that.save_widget.update_document_title();
// 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');
});

this.events.on('kernel_idle.Kernel', function () {
that.save_widget.update_document_title();
// 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');
});

this.events.on('kernel_busy.Kernel', function () {
window.document.title='(Busy) '+window.document.title;
// 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');
});

this.events.on('spec_match_found.Kernel', function (evt, data) {
Expand Down
2 changes: 1 addition & 1 deletion notebook/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down