Show More
@@ -41,27 +41,27 b' var IPython = (function (IPython) {' | |||||
41 | // click_callback : function called if user click on notification |
|
41 | // click_callback : function called if user click on notification | |
42 | // could return false to prevent the notification to be dismissed |
|
42 | // could return false to prevent the notification to be dismissed | |
43 | NotificationWidget.prototype.set_message = function (msg, timeout, click_callback) { |
|
43 | NotificationWidget.prototype.set_message = function (msg, timeout, click_callback) { | |
44 | var callback = click_callback || function(){return false}; |
|
44 | var callback = click_callback || function() {return false;}; | |
45 | var that = this; |
|
45 | var that = this; | |
46 | this.element.html(msg); |
|
46 | this.element.html(msg); | |
47 | this.element.fadeIn(100); |
|
47 | this.element.fadeIn(100); | |
48 | if (this.timeout !== null) { |
|
48 | if (this.timeout !== null) { | |
49 | clearTimeout(this.timeout); |
|
49 | clearTimeout(this.timeout); | |
50 | this.timeout = null; |
|
50 | this.timeout = null; | |
51 |
} |
|
51 | } | |
52 | if (timeout !== undefined && timeout >=0) { |
|
52 | if (timeout !== undefined && timeout >=0) { | |
53 | this.timeout = setTimeout(function () { |
|
53 | this.timeout = setTimeout(function () { | |
54 | that.element.fadeOut(100, function () {that.element.html('');}); |
|
54 | that.element.fadeOut(100, function () {that.element.html('');}); | |
55 | that.timeout = null; |
|
55 | that.timeout = null; | |
56 | }, timeout); |
|
56 | }, timeout); | |
57 | } else { |
|
57 | } else { | |
58 | this.element.click(function(){ |
|
58 | this.element.click(function() { | |
59 | if( callback() != false){ |
|
59 | if( callback() != false ) { | |
60 | that.element.fadeOut(100, function () {that.element.html('');}); |
|
60 | that.element.fadeOut(100, function () {that.element.html('');}); | |
61 | that.element.unbind('click') |
|
61 | that.element.unbind('click'); | |
62 | } |
|
62 | } | |
63 | if (that.timeout !== undefined) { |
|
63 | if (that.timeout !== undefined) { | |
64 | that.timeout = undefined |
|
64 | that.timeout = undefined; | |
65 | clearTimeout(that.timeout); |
|
65 | clearTimeout(that.timeout); | |
66 | } |
|
66 | } | |
67 | }); |
|
67 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now