Skip to content

Instantly share code, notes, and snippets.

@mrk-andreev
Created May 19, 2017 21:01
Show Gist options
  • Save mrk-andreev/2a9c2538fad0b687c27e192d5948834f to your computer and use it in GitHub Desktop.
Save mrk-andreev/2a9c2538fad0b687c27e192d5948834f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name JupyterExt
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @author mrk-andreev
// @match http://localhost:8888/notebooks/*
// @grant none
// ==/UserScript==
(function() {
var FONT_SIZE = '18px';
$('body').append("<style>#notebook-container {width:100% !important;font-size:" + FONT_SIZE + ";}.CodeMirror-lines {font-size:" + FONT_SIZE + " !important;}</style>");
var is_window_in_focus;
$(window).focus(function() {
is_window_in_focus = true;
}).blur(function() {
is_window_in_focus = false;
});
if (Notification.permission !== "denied") {
Notification.requestPermission();
}
var it_try_init;
it_try_init = setInterval(function () {
if (typeof Jupyter !== "undefined") {
Jupyter.notebook.events.on("kernel_idle.Kernel", function(){
if (!is_window_in_focus){
new Notification("[" + Jupyter.notebook.notebook_name + "] is ready");
}
});
clearInterval(it_try_init);
}
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment