Show More
@@ -0,0 +1,48 b'' | |||||
|
1 | //---------------------------------------------------------------------------- | |||
|
2 | // Copyright (C) 2012 The IPython Development Team | |||
|
3 | // | |||
|
4 | // Distributed under the terms of the BSD License. The full license is in | |||
|
5 | // the file COPYING, distributed as part of this software. | |||
|
6 | //---------------------------------------------------------------------------- | |||
|
7 | ||||
|
8 | //============================================================================ | |||
|
9 | // Notification widget | |||
|
10 | //============================================================================ | |||
|
11 | ||||
|
12 | var IPython = (function (IPython) { | |||
|
13 | "use strict"; | |||
|
14 | var utils = IPython.utils; | |||
|
15 | ||||
|
16 | ||||
|
17 | var NotificationArea = function (selector) { | |||
|
18 | this.selector = selector; | |||
|
19 | if (this.selector !== undefined) { | |||
|
20 | this.element = $(selector); | |||
|
21 | } | |||
|
22 | }; | |||
|
23 | ||||
|
24 | NotificationArea.prototype.temp_message = function (msg, timeout, css_class) { | |||
|
25 | var uuid = utils.uuid(); | |||
|
26 | var tdiv = $('<div>') | |||
|
27 | .attr('id',uuid) | |||
|
28 | .addClass('notification ui-widget ui-widget-content ui-corner-all') | |||
|
29 | .addClass('border-box-sizing') | |||
|
30 | .addClass(css_class) | |||
|
31 | .hide() | |||
|
32 | .text(msg); | |||
|
33 | ||||
|
34 | $(this.selector).append(tdiv); | |||
|
35 | var tmout = Math.max(1000,timeout); | |||
|
36 | tdiv.fadeIn(100); | |||
|
37 | ||||
|
38 | setTimeout(function () { | |||
|
39 | tdiv.fadeOut(100, function () {tdiv.remove();}); | |||
|
40 | }, timeout) | |||
|
41 | }; | |||
|
42 | ||||
|
43 | IPython.NotificationArea = NotificationArea; | |||
|
44 | ||||
|
45 | return IPython; | |||
|
46 | ||||
|
47 | }(IPython)); | |||
|
48 |
@@ -51,8 +51,17 b' span#notebook_name {' | |||||
51 | position: relative; |
|
51 | position: relative; | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | #notification { |
|
54 | #notification_area { | |
55 | position: absolute; |
|
55 | position: absolute; | |
|
56 | right: 0px; | |||
|
57 | top: 0px; | |||
|
58 | height: 25px; | |||
|
59 | padding: 3px 6px; | |||
|
60 | z-index: 10; | |||
|
61 | } | |||
|
62 | ||||
|
63 | .notification{ | |||
|
64 | float : right; | |||
56 | right: 3px; |
|
65 | right: 3px; | |
57 | top: 3px; |
|
66 | top: 3px; | |
58 | height: 25px; |
|
67 | height: 25px; | |
@@ -60,6 +69,18 b' span#notebook_name {' | |||||
60 | z-index: 10; |
|
69 | z-index: 10; | |
61 | } |
|
70 | } | |
62 |
|
71 | |||
|
72 | .notification.info | |||
|
73 | {color : darkblue;} | |||
|
74 | ||||
|
75 | .notification.safe | |||
|
76 | {color : darkgreen;} | |||
|
77 | ||||
|
78 | .notification.warning | |||
|
79 | {color : darkorange;} | |||
|
80 | ||||
|
81 | .notification.danger | |||
|
82 | { color : darkred } | |||
|
83 | ||||
63 | #toolbar { |
|
84 | #toolbar { | |
64 | padding: 3px 15px; |
|
85 | padding: 3px 15px; | |
65 | } |
|
86 | } |
@@ -27,7 +27,7 b' var IPython = (function (IPython) {' | |||||
27 |
|
27 | |||
28 |
|
28 | |||
29 | NotificationWidget.prototype.style = function () { |
|
29 | NotificationWidget.prototype.style = function () { | |
30 | this.element.addClass('ui-widget ui-widget-content ui-corner-all'); |
|
30 | this.element.addClass('notification ui-widget ui-widget-content ui-corner-all'); | |
31 | this.element.addClass('border-box-sizing'); |
|
31 | this.element.addClass('border-box-sizing'); | |
32 | }; |
|
32 | }; | |
33 |
|
33 |
@@ -152,7 +152,9 b' data-notebook-id={{notebook_id}}' | |||||
152 | </ul> |
|
152 | </ul> | |
153 |
|
153 | |||
154 | </div> |
|
154 | </div> | |
155 |
<div id="notification" |
|
155 | <div id="notification_area"> | |
|
156 | <div id="notification"></div> | |||
|
157 | </div> | |||
156 | </div> |
|
158 | </div> | |
157 |
|
159 | |||
158 |
|
160 | |||
@@ -242,6 +244,7 b' data-notebook-id={{notebook_id}}' | |||||
242 | <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> |
|
244 | <script src="{{ static_url("js/toolbar.js") }}" type="text/javascript" charset="utf-8"></script> | |
243 | <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> |
|
245 | <script src="{{ static_url("js/notebook.js") }}" type="text/javascript" charset="utf-8"></script> | |
244 | <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> |
|
246 | <script src="{{ static_url("js/notificationwidget.js") }}" type="text/javascript" charset="utf-8"></script> | |
|
247 | <script src="{{ static_url("js/notificationarea.js") }}" type="text/javascript" charset="utf-8"></script> | |||
245 | <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> |
|
248 | <script src="{{ static_url("js/tooltip.js") }}" type="text/javascript" charset="utf-8"></script> | |
246 | <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script> |
|
249 | <script src="{{ static_url("js/notebookmain.js") }}" type="text/javascript" charset="utf-8"></script> | |
247 |
|
250 |
General Comments 0
You need to be logged in to leave comments.
Login now