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