Show More
@@ -1,447 +1,448 b'' | |||
|
1 | 1 | /** |
|
2 | 2 | * Primary styles |
|
3 | 3 | * |
|
4 | 4 | * Author: IPython Development Team |
|
5 | 5 | */ |
|
6 | 6 | |
|
7 | 7 | @import "variables.less"; |
|
8 | 8 | |
|
9 | 9 | body { |
|
10 | 10 | overflow: hidden; |
|
11 | background-color:@notebook_background; | |
|
11 | 12 | } |
|
12 | 13 | |
|
13 | 14 | blockquote { |
|
14 | 15 | border-left: 4px solid #DDD; |
|
15 | 16 | padding: 0 15px; |
|
16 | 17 | color: #777; |
|
17 | 18 | } |
|
18 | 19 | |
|
19 | 20 | span#save_widget { |
|
20 | 21 | padding: 5px; |
|
21 | 22 | margin: 0px 0px 0px 300px; |
|
22 | 23 | display:inline-block; |
|
23 | 24 | } |
|
24 | 25 | |
|
25 | 26 | span#notebook_name { |
|
26 | 27 | height: 1em; |
|
27 | 28 | line-height: 1em; |
|
28 | 29 | padding: 3px; |
|
29 | 30 | border: none; |
|
30 | 31 | font-size: 146.5%; |
|
31 | 32 | } |
|
32 | 33 | |
|
33 | 34 | |
|
34 | 35 | .ui-menubar-item .ui-button .ui-button-text { |
|
35 | 36 | padding: 0.4em 1.0em; |
|
36 | 37 | font-size: 100%; |
|
37 | 38 | } |
|
38 | 39 | |
|
39 | 40 | .ui-menu { |
|
40 | 41 | -moz-box-shadow: 0px 6px 10px -1px #adadad; |
|
41 | 42 | -webkit-box-shadow: 0px 6px 10px -1px #adadad; |
|
42 | 43 | box-shadow: 0px 6px 10px -1px #adadad; |
|
43 | 44 | } |
|
44 | 45 | |
|
45 | 46 | .ui-menu .ui-menu-item a { |
|
46 | 47 | border: 1px solid transparent; |
|
47 | 48 | padding: 2px 1.6em; |
|
48 | 49 | } |
|
49 | 50 | |
|
50 | 51 | .ui-menu .ui-menu-item a.ui-state-focus { |
|
51 | 52 | margin: 0; |
|
52 | 53 | } |
|
53 | 54 | |
|
54 | 55 | .ui-menu hr { |
|
55 | 56 | margin: 0.3em 0; |
|
56 | 57 | } |
|
57 | 58 | |
|
58 | 59 | #menubar_container { |
|
59 | 60 | position: relative; |
|
60 | 61 | } |
|
61 | 62 | |
|
62 | 63 | #notification_area { |
|
63 | 64 | position: absolute; |
|
64 | 65 | right: 0px; |
|
65 | 66 | top: 0px; |
|
66 | 67 | height: 25px; |
|
67 | 68 | padding: 3px 0px; |
|
68 | 69 | padding-right: 3px; |
|
69 | 70 | z-index: 10; |
|
70 | 71 | } |
|
71 | 72 | |
|
72 | 73 | .notification_widget{ |
|
73 | 74 | float : right; |
|
74 | 75 | right: 0px; |
|
75 | 76 | top: 1px; |
|
76 | 77 | height: 25px; |
|
77 | 78 | padding: 3px 6px; |
|
78 | 79 | z-index: 10; |
|
79 | 80 | } |
|
80 | 81 | |
|
81 | 82 | .toolbar { |
|
82 | 83 | padding: 3px 15px; |
|
84 | border-bottom: @borderwidth @border_color solid; | |
|
83 | 85 | } |
|
84 | 86 | |
|
85 | 87 | #maintoolbar > select, #maintoolbar label { |
|
86 | 88 | font-size: 85%; |
|
87 | 89 | margin-left:0.3em; |
|
88 | 90 | margin-right:0.3em; |
|
89 | 91 | |
|
90 | 92 | } |
|
91 | 93 | |
|
92 | 94 | |
|
93 | 95 | div#main_app { |
|
94 | 96 | width: 100%; |
|
95 | 97 | position: relative; |
|
96 | 98 | } |
|
97 | 99 | |
|
98 | 100 | span#quick_help_area { |
|
99 | 101 | position: static; |
|
100 | 102 | padding: 5px 0px; |
|
101 | 103 | margin: 0px 0px 0px 0px; |
|
102 | 104 | } |
|
103 | 105 | |
|
104 | 106 | .help_string { |
|
105 | 107 | float: right; |
|
106 | 108 | width: 170px; |
|
107 | 109 | padding: 0px 5px; |
|
108 | 110 | text-align: left; |
|
109 | 111 | font-size: 85%; |
|
110 | 112 | } |
|
111 | 113 | |
|
112 | 114 | .help_string_label { |
|
113 | 115 | float: right; |
|
114 | 116 | font-size: 85%; |
|
115 | 117 | } |
|
116 | 118 | |
|
117 | 119 | div#notebook_panel { |
|
118 | 120 | margin: 0px 0px 0px 0px; |
|
119 | 121 | padding: 0px; |
|
120 | 122 | } |
|
121 | 123 | |
|
122 | 124 | div#notebook { |
|
123 | 125 | overflow-y: scroll; |
|
124 | 126 | overflow-x: auto; |
|
125 | 127 | width: 100%; |
|
126 | 128 | /* This spaces the cell away from the edge of the notebook area */ |
|
127 | 129 | padding: 5px 5px 15px 5px; |
|
128 | 130 | margin: 0px; |
|
129 | background-color: @notebook_background; | |
|
130 | 131 | } |
|
131 | 132 | |
|
132 | 133 | div#pager_splitter { |
|
133 | 134 | height: 8px; |
|
134 | 135 | } |
|
135 | 136 | |
|
136 | 137 | #pager_container { |
|
137 | 138 | position : relative; |
|
138 | 139 | } |
|
139 | 140 | |
|
140 | 141 | div#pager { |
|
141 | 142 | padding: 15px; |
|
142 | 143 | overflow: auto; |
|
143 | 144 | display: none; |
|
144 | 145 | } |
|
145 | 146 | |
|
146 | 147 | div.ui-widget-content { |
|
147 | 148 | border: 1px solid @border_color; |
|
148 | 149 | outline: none; |
|
149 | 150 | } |
|
150 | 151 | |
|
151 | 152 | .cell { |
|
152 | 153 | border: 1px solid transparent; |
|
153 | 154 | |
|
154 | 155 | &.selected { |
|
155 | 156 | .corner-all; |
|
156 | 157 | background-color:@cell_selected_background; |
|
157 | 158 | border : thin @border_color solid; |
|
158 | 159 | } |
|
159 | 160 | } |
|
160 | 161 | |
|
161 | 162 | div.cell { |
|
162 | 163 | width: 100%; |
|
163 | 164 | padding: 5px 5px 5px 0px; |
|
164 | 165 | /* This acts as a spacer between cells, that is outside the border */ |
|
165 | 166 | margin: 2px 0px 2px 0px; |
|
166 | 167 | outline: none; |
|
167 | 168 | } |
|
168 | 169 | |
|
169 | 170 | div.code_cell { |
|
170 | 171 | } |
|
171 | 172 | |
|
172 | 173 | /* any special styling for code cells that are currently running goes here */ |
|
173 | 174 | div.code_cell.running { |
|
174 | 175 | } |
|
175 | 176 | |
|
176 | 177 | div.prompt { |
|
177 | 178 | /* This needs to be wide enough for 3 digit prompt numbers: In[100]: */ |
|
178 | 179 | width: 11ex; |
|
179 | 180 | /* This 0.4em is tuned to match the padding on the CodeMirror editor. */ |
|
180 | 181 | padding: 0.4em; |
|
181 | 182 | margin: 0px; |
|
182 | 183 | font-family: monospace; |
|
183 | 184 | text-align: right; |
|
184 | 185 | /* This has to match that of the the CodeMirror class line-height below */ |
|
185 | 186 | line-height: 1.231; |
|
186 | 187 | } |
|
187 | 188 | |
|
188 | 189 | div.input { |
|
189 | 190 | page-break-inside: avoid; |
|
190 | 191 | } |
|
191 | 192 | |
|
192 | 193 | /* input_area and input_prompt must match in top border and margin for alignment */ |
|
193 | 194 | div.input_area { |
|
194 | 195 | color: black; |
|
195 | 196 | border: 1px solid @border_color; |
|
196 | 197 | .corner-all; |
|
197 | 198 | background: @cell_background; |
|
198 | 199 | } |
|
199 | 200 | |
|
200 | 201 | div.input_prompt { |
|
201 | 202 | color: navy; |
|
202 | 203 | border-top: 1px solid transparent; |
|
203 | 204 | } |
|
204 | 205 | |
|
205 | 206 | div.output_wrapper { |
|
206 | 207 | /* This is a spacer between the input and output of each cell */ |
|
207 | 208 | margin-top: 5px; |
|
208 | 209 | margin-left: 5px; |
|
209 | 210 | /* FF needs explicit width to stretch */ |
|
210 | 211 | width: 100%; |
|
211 | 212 | /* this position must be relative to enable descendents to be absolute within it */ |
|
212 | 213 | position: relative; |
|
213 | 214 | } |
|
214 | 215 | |
|
215 | 216 | /* class for the output area when it should be height-limited */ |
|
216 | 217 | div.output_scroll { |
|
217 | 218 | /* ideally, this would be max-height, but FF barfs all over that */ |
|
218 | 219 | height: 24em; |
|
219 | 220 | /* FF needs this *and the wrapper* to specify full width, or it will shrinkwrap */ |
|
220 | 221 | width: 100%; |
|
221 | 222 | |
|
222 | 223 | overflow: auto; |
|
223 | 224 | .corner-all; |
|
224 | 225 | box-shadow: inset 0 2px 8px rgba(0, 0, 0, .8); |
|
225 | 226 | } |
|
226 | 227 | |
|
227 | 228 | /* output div while it is collapsed */ |
|
228 | 229 | div.output_collapsed { |
|
229 | 230 | margin-right: 5px; |
|
230 | 231 | } |
|
231 | 232 | |
|
232 | 233 | div.out_prompt_overlay { |
|
233 | 234 | height: 100%; |
|
234 | 235 | padding: 0px; |
|
235 | 236 | position: absolute; |
|
236 | 237 | .corner-all; |
|
237 | 238 | } |
|
238 | 239 | |
|
239 | 240 | div.out_prompt_overlay:hover { |
|
240 | 241 | /* use inner shadow to get border that is computed the same on WebKit/FF */ |
|
241 | 242 | box-shadow: inset 0 0 1px #000; |
|
242 | 243 | background: rgba(240, 240, 240, 0.5); |
|
243 | 244 | } |
|
244 | 245 | |
|
245 | 246 | div.output_prompt { |
|
246 | 247 | color: darkred; |
|
247 | 248 | /* 5px right shift to account for margin in parent container */ |
|
248 | 249 | margin: 0 5px 0 -5px; |
|
249 | 250 | } |
|
250 | 251 | |
|
251 | 252 | /* This class is the outer container of all output sections. */ |
|
252 | 253 | div.output_area { |
|
253 | 254 | padding: 0px; |
|
254 | 255 | page-break-inside: avoid; |
|
255 | 256 | } |
|
256 | 257 | |
|
257 | 258 | |
|
258 | 259 | /* This is needed to protect the pre formating from global settings such |
|
259 | 260 | as that of bootstrap */ |
|
260 | 261 | div.output_area pre { |
|
261 | 262 | font-family: monospace; |
|
262 | 263 | margin: 0; |
|
263 | 264 | padding: 0; |
|
264 | 265 | border: 0; |
|
265 | 266 | font-size: 100%; |
|
266 | 267 | font: inherit; |
|
267 | 268 | vertical-align: baseline; |
|
268 | 269 | color: black; |
|
269 | 270 | background-color: white; |
|
270 | 271 | } |
|
271 | 272 | |
|
272 | 273 | /* This class is for the output subarea inside the output_area and after |
|
273 | 274 | the prompt div. */ |
|
274 | 275 | div.output_subarea { |
|
275 | 276 | padding: 0.44em 0.4em 0.4em 1px; |
|
276 | 277 | } |
|
277 | 278 | |
|
278 | 279 | /* The rest of the output_* classes are for special styling of the different |
|
279 | 280 | output types */ |
|
280 | 281 | |
|
281 | 282 | /* all text output has this class: */ |
|
282 | 283 | div.output_text { |
|
283 | 284 | text-align: left; |
|
284 | 285 | color: black; |
|
285 | 286 | font-family: monospace; |
|
286 | 287 | /* This has to match that of the the CodeMirror class line-height below */ |
|
287 | 288 | line-height: 1.231; |
|
288 | 289 | } |
|
289 | 290 | |
|
290 | 291 | /* stdout/stderr are 'text' as well as 'stream', but pyout/pyerr are *not* streams */ |
|
291 | 292 | div.output_stream { |
|
292 | 293 | padding-top: 0.0em; |
|
293 | 294 | padding-bottom: 0.0em; |
|
294 | 295 | } |
|
295 | 296 | div.output_stdout { |
|
296 | 297 | } |
|
297 | 298 | div.output_stderr { |
|
298 | 299 | background: #fdd; /* very light red background for stderr */ |
|
299 | 300 | } |
|
300 | 301 | |
|
301 | 302 | div.output_latex { |
|
302 | 303 | text-align: left; |
|
303 | 304 | color: black; |
|
304 | 305 | } |
|
305 | 306 | |
|
306 | 307 | div.output_html { |
|
307 | 308 | } |
|
308 | 309 | |
|
309 | 310 | div.output_png { |
|
310 | 311 | } |
|
311 | 312 | |
|
312 | 313 | div.output_jpeg { |
|
313 | 314 | } |
|
314 | 315 | |
|
315 | 316 | div.text_cell { |
|
316 | 317 | padding: 5px 5px 5px 5px; |
|
317 | 318 | } |
|
318 | 319 | |
|
319 | 320 | div.text_cell_input { |
|
320 | 321 | color: black; |
|
321 | 322 | border: 1px solid @border_color; |
|
322 | 323 | .corner-all; |
|
323 | 324 | background: @cell_background; |
|
324 | 325 | } |
|
325 | 326 | |
|
326 | 327 | div.text_cell_render { |
|
327 | 328 | font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; |
|
328 | 329 | outline: none; |
|
329 | 330 | resize: none; |
|
330 | 331 | width: inherit; |
|
331 | 332 | border-style: none; |
|
332 | 333 | padding: 5px; |
|
333 | 334 | color: black; |
|
334 | 335 | } |
|
335 | 336 | |
|
336 | 337 | /* The following gets added to the <head> if it is detected that the user has a |
|
337 | 338 | * monospace font with inconsistent normal/bold/italic height. See |
|
338 | 339 | * notebookmain.js. Such fonts will have keywords vertically offset with |
|
339 | 340 | * respect to the rest of the text. The user should select a better font. |
|
340 | 341 | * See: https://github.com/ipython/ipython/issues/1503 |
|
341 | 342 | * |
|
342 | 343 | * .CodeMirror span { |
|
343 | 344 | * vertical-align: bottom; |
|
344 | 345 | * } |
|
345 | 346 | */ |
|
346 | 347 | |
|
347 | 348 | .CodeMirror { |
|
348 | 349 | line-height: 1.231; /* Changed from 1em to our global default */ |
|
349 | 350 | } |
|
350 | 351 | |
|
351 | 352 | .CodeMirror-scroll { |
|
352 | 353 | height: auto; /* Changed to auto to autogrow */ |
|
353 | 354 | /* The CodeMirror docs are a bit fuzzy on if overflow-y should be hidden or visible.*/ |
|
354 | 355 | /* We have found that if it is visible, vertical scrollbars appear with font size changes.*/ |
|
355 | 356 | overflow-y: hidden; |
|
356 | 357 | overflow-x: auto; /* Changed from auto to remove scrollbar */ |
|
357 | 358 | } |
|
358 | 359 | |
|
359 | 360 | /* CSS font colors for translated ANSI colors. */ |
|
360 | 361 | |
|
361 | 362 | |
|
362 | 363 | .ansiblack {color: black;} |
|
363 | 364 | .ansired {color: darkred;} |
|
364 | 365 | .ansigreen {color: darkgreen;} |
|
365 | 366 | .ansiyellow {color: brown;} |
|
366 | 367 | .ansiblue {color: darkblue;} |
|
367 | 368 | .ansipurple {color: darkviolet;} |
|
368 | 369 | .ansicyan {color: steelblue;} |
|
369 | 370 | .ansigrey {color: grey;} |
|
370 | 371 | .ansibold {font-weight: bold;} |
|
371 | 372 | |
|
372 | 373 | .completions { |
|
373 | 374 | position: absolute; |
|
374 | 375 | z-index: 10; |
|
375 | 376 | overflow: hidden; |
|
376 | 377 | border: 1px solid @border_color; |
|
377 | 378 | } |
|
378 | 379 | |
|
379 | 380 | .completions select { |
|
380 | 381 | background: white; |
|
381 | 382 | outline: none; |
|
382 | 383 | border: none; |
|
383 | 384 | padding: 0px; |
|
384 | 385 | margin: 0px; |
|
385 | 386 | overflow: auto; |
|
386 | 387 | font-family: monospace; |
|
387 | 388 | } |
|
388 | 389 | |
|
389 | 390 | option.context { |
|
390 | 391 | background-color: #DEF7FF; |
|
391 | 392 | } |
|
392 | 393 | option.introspection { |
|
393 | 394 | background-color: #EBF4EB; |
|
394 | 395 | } |
|
395 | 396 | |
|
396 | 397 | /*fixed part of the completion*/ |
|
397 | 398 | .completions p b { |
|
398 | 399 | font-weight:bold; |
|
399 | 400 | } |
|
400 | 401 | |
|
401 | 402 | .completions p { |
|
402 | 403 | background: #DDF; |
|
403 | 404 | /*outline: none; |
|
404 | 405 | padding: 0px;*/ |
|
405 | 406 | border-bottom: black solid 1px; |
|
406 | 407 | padding: 1px; |
|
407 | 408 | font-family: monospace; |
|
408 | 409 | } |
|
409 | 410 | |
|
410 | 411 | pre.dialog { |
|
411 | 412 | background-color: @cell_background; |
|
412 | 413 | border: 1px solid #ddd; |
|
413 | 414 | .corner-all; |
|
414 | 415 | padding: 0.4em; |
|
415 | 416 | padding-left: 2em; |
|
416 | 417 | } |
|
417 | 418 | |
|
418 | 419 | p.dialog { |
|
419 | 420 | padding : 0.2em; |
|
420 | 421 | } |
|
421 | 422 | |
|
422 | 423 | .shortcut_key { |
|
423 | 424 | display: inline-block; |
|
424 | 425 | width: 15ex; |
|
425 | 426 | text-align: right; |
|
426 | 427 | font-family: monospace; |
|
427 | 428 | } |
|
428 | 429 | |
|
429 | 430 | .shortcut_descr { |
|
430 | 431 | } |
|
431 | 432 | |
|
432 | 433 | /* Word-wrap output correctly. This is the CSS3 spelling, though Firefox seems |
|
433 | 434 | to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do. |
|
434 | 435 | */ |
|
435 | 436 | pre, code, kbd, samp { white-space: pre-wrap; } |
|
436 | 437 | |
|
437 | 438 | #fonttest { |
|
438 | 439 | font-family: monospace; |
|
439 | 440 | } |
|
440 | 441 | |
|
441 | 442 | .js-error { |
|
442 | 443 | color: darkred; |
|
443 | 444 | } |
|
444 | 445 | |
|
445 | 446 | |
|
446 | 447 | |
|
447 | 448 |
@@ -1,59 +1,59 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // Global header/site setup. |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var Page = function () { |
|
15 | 15 | this.style(); |
|
16 | 16 | this.bind_events(); |
|
17 | 17 | }; |
|
18 | 18 | |
|
19 | 19 | Page.prototype.style = function () { |
|
20 | 20 | $('div#header').addClass('border-box-sizing'). |
|
21 |
addClass('ui-widget |
|
|
21 | addClass('ui-widget'). | |
|
22 | 22 | css('border-top-style','none'). |
|
23 | 23 | css('border-left-style','none'). |
|
24 | 24 | css('border-right-style','none'); |
|
25 | 25 | $('div#site').addClass('border-box-sizing') |
|
26 | 26 | }; |
|
27 | 27 | |
|
28 | 28 | |
|
29 | 29 | Page.prototype.bind_events = function () { |
|
30 | 30 | }; |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | Page.prototype.show = function () { |
|
34 | 34 | // The header and site divs start out hidden to prevent FLOUC. |
|
35 | 35 | // Main scripts should call this method after styling everything. |
|
36 | 36 | this.show_header(); |
|
37 | 37 | this.show_site(); |
|
38 | 38 | }; |
|
39 | 39 | |
|
40 | 40 | |
|
41 | 41 | Page.prototype.show_header = function () { |
|
42 | 42 | // The header and site divs start out hidden to prevent FLOUC. |
|
43 | 43 | // Main scripts should call this method after styling everything. |
|
44 | 44 | $('div#header').css('display','block'); |
|
45 | 45 | }; |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | Page.prototype.show_site = function () { |
|
49 | 49 | // The header and site divs start out hidden to prevent FLOUC. |
|
50 | 50 | // Main scripts should call this method after styling everything. |
|
51 | 51 | $('div#site').css('display','block'); |
|
52 | 52 | }; |
|
53 | 53 | |
|
54 | 54 | |
|
55 | 55 | IPython.Page = Page; |
|
56 | 56 | |
|
57 | 57 | return IPython; |
|
58 | 58 | |
|
59 | 59 | }(IPython)); |
@@ -1,139 +1,139 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008-2011 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // SaveWidget |
|
10 | 10 | //============================================================================ |
|
11 | 11 | |
|
12 | 12 | var IPython = (function (IPython) { |
|
13 | 13 | |
|
14 | 14 | var utils = IPython.utils; |
|
15 | 15 | |
|
16 | 16 | var SaveWidget = function (selector) { |
|
17 | 17 | this.selector = selector; |
|
18 | 18 | if (this.selector !== undefined) { |
|
19 | 19 | this.element = $(selector); |
|
20 | 20 | this.style(); |
|
21 | 21 | this.bind_events(); |
|
22 | 22 | } |
|
23 | 23 | }; |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | SaveWidget.prototype.style = function () { |
|
27 | 27 | this.element.find('span#save_widget').addClass('ui-widget'); |
|
28 |
this.element.find('span#notebook_name').addClass('ui-widget |
|
|
29 |
this.element.find('span#save_status').addClass('ui-widget |
|
|
28 | this.element.find('span#notebook_name').addClass('ui-widget'); | |
|
29 | this.element.find('span#save_status').addClass('ui-widget') | |
|
30 | 30 | .css({border: 'none', 'margin-left': '20px'}); |
|
31 | 31 | }; |
|
32 | 32 | |
|
33 | 33 | |
|
34 | 34 | SaveWidget.prototype.bind_events = function () { |
|
35 | 35 | var that = this; |
|
36 | 36 | this.element.find('span#notebook_name').click(function () { |
|
37 | 37 | that.rename_notebook(); |
|
38 | 38 | }); |
|
39 | 39 | this.element.find('span#notebook_name').hover(function () { |
|
40 | 40 | $(this).addClass("ui-state-hover"); |
|
41 | 41 | }, function () { |
|
42 | 42 | $(this).removeClass("ui-state-hover"); |
|
43 | 43 | }); |
|
44 | 44 | $([IPython.events]).on('notebook_loaded.Notebook', function () { |
|
45 | 45 | that.set_last_saved(); |
|
46 | 46 | that.update_notebook_name(); |
|
47 | 47 | that.update_document_title(); |
|
48 | 48 | }); |
|
49 | 49 | $([IPython.events]).on('notebook_saved.Notebook', function () { |
|
50 | 50 | that.set_last_saved(); |
|
51 | 51 | that.update_notebook_name(); |
|
52 | 52 | that.update_document_title(); |
|
53 | 53 | }); |
|
54 | 54 | $([IPython.events]).on('notebook_save_failed.Notebook', function () { |
|
55 | 55 | that.set_save_status('Last Save Failed!'); |
|
56 | 56 | }); |
|
57 | 57 | }; |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | SaveWidget.prototype.rename_notebook = function () { |
|
61 | 61 | var that = this; |
|
62 | 62 | var dialog = $('<div/>'); |
|
63 | 63 | dialog.append( |
|
64 | 64 | $('<h3/>').html('Enter a new notebook name:') |
|
65 | 65 | .css({'margin-bottom': '10px'}) |
|
66 | 66 | ); |
|
67 | 67 | dialog.append( |
|
68 | 68 | $('<input/>').attr('type','text').attr('size','25') |
|
69 | 69 | .addClass('ui-widget ui-widget-content') |
|
70 | 70 | .attr('value',IPython.notebook.get_notebook_name()) |
|
71 | 71 | ); |
|
72 | 72 | // $(document).append(dialog); |
|
73 | 73 | dialog.dialog({ |
|
74 | 74 | resizable: false, |
|
75 | 75 | modal: true, |
|
76 | 76 | title: "Rename Notebook", |
|
77 | 77 | closeText: "", |
|
78 | 78 | close: function(event, ui) {$(this).dialog('destroy').remove();}, |
|
79 | 79 | buttons : { |
|
80 | 80 | "OK": function () { |
|
81 | 81 | var new_name = $(this).find('input').attr('value'); |
|
82 | 82 | if (!IPython.notebook.test_notebook_name(new_name)) { |
|
83 | 83 | $(this).find('h3').html( |
|
84 | 84 | "Invalid notebook name. Notebook names must "+ |
|
85 | 85 | "have 1 or more characters and can contain any characters " + |
|
86 | 86 | "except :/\\. Please enter a new notebook name:" |
|
87 | 87 | ); |
|
88 | 88 | } else { |
|
89 | 89 | IPython.notebook.set_notebook_name(new_name); |
|
90 | 90 | IPython.notebook.save_notebook(); |
|
91 | 91 | $(this).dialog('close'); |
|
92 | 92 | } |
|
93 | 93 | }, |
|
94 | 94 | "Cancel": function () { |
|
95 | 95 | $(this).dialog('close'); |
|
96 | 96 | } |
|
97 | 97 | }, |
|
98 | 98 | open : function (event, ui) { |
|
99 | 99 | var that = $(this); |
|
100 | 100 | // Upon ENTER, click the OK button. |
|
101 | 101 | that.find('input[type="text"]').keydown(function (event, ui) { |
|
102 | 102 | if (event.which === utils.keycodes.ENTER) { |
|
103 | 103 | that.parent().find('button').first().click(); |
|
104 | 104 | } |
|
105 | 105 | }); |
|
106 | 106 | } |
|
107 | 107 | }); |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | |
|
111 | 111 | SaveWidget.prototype.update_notebook_name = function () { |
|
112 | 112 | var nbname = IPython.notebook.get_notebook_name(); |
|
113 | 113 | this.element.find('span#notebook_name').html(nbname); |
|
114 | 114 | }; |
|
115 | 115 | |
|
116 | 116 | |
|
117 | 117 | SaveWidget.prototype.update_document_title = function () { |
|
118 | 118 | var nbname = IPython.notebook.get_notebook_name(); |
|
119 | 119 | document.title = nbname; |
|
120 | 120 | }; |
|
121 | 121 | |
|
122 | 122 | |
|
123 | 123 | SaveWidget.prototype.set_save_status = function (msg) { |
|
124 | 124 | this.element.find('span#save_status').html(msg); |
|
125 | 125 | } |
|
126 | 126 | |
|
127 | 127 | |
|
128 | 128 | SaveWidget.prototype.set_last_saved = function () { |
|
129 | 129 | var d = new Date(); |
|
130 | 130 | this.set_save_status('Last saved: '+d.format('mmm dd h:MM TT')); |
|
131 | 131 | }; |
|
132 | 132 | |
|
133 | 133 | |
|
134 | 134 | IPython.SaveWidget = SaveWidget; |
|
135 | 135 | |
|
136 | 136 | return IPython; |
|
137 | 137 | |
|
138 | 138 | }(IPython)); |
|
139 | 139 |
@@ -1,111 +1,111 b'' | |||
|
1 | 1 | //---------------------------------------------------------------------------- |
|
2 | 2 | // Copyright (C) 2008 The IPython Development Team |
|
3 | 3 | // |
|
4 | 4 | // Distributed under the terms of the BSD License. The full license is in |
|
5 | 5 | // the file COPYING, distributed as part of this software. |
|
6 | 6 | //---------------------------------------------------------------------------- |
|
7 | 7 | |
|
8 | 8 | //============================================================================ |
|
9 | 9 | // ToolBar |
|
10 | 10 | //============================================================================ |
|
11 | 11 | /** |
|
12 | 12 | * @module IPython |
|
13 | 13 | * @namespace IPython |
|
14 | 14 | * @submodule ToolBar |
|
15 | 15 | */ |
|
16 | 16 | |
|
17 | 17 | var IPython = (function (IPython) { |
|
18 | 18 | |
|
19 | 19 | /** |
|
20 | 20 | * A generic toolbar on which one can add button |
|
21 | 21 | * @class ToolBar |
|
22 | 22 | * @constructor |
|
23 | 23 | * @param {Dom object} selector |
|
24 | 24 | */ |
|
25 | 25 | var ToolBar = function (selector) { |
|
26 | 26 | this.selector = selector; |
|
27 | 27 | if (this.selector !== undefined) { |
|
28 | 28 | this.element = $(selector); |
|
29 | 29 | this.style(); |
|
30 | 30 | } |
|
31 | 31 | }; |
|
32 | 32 | |
|
33 | 33 | /** |
|
34 | 34 | * add a group of button into the current toolbar. |
|
35 | 35 | * |
|
36 | 36 | * |
|
37 | 37 | * @example |
|
38 | 38 | * |
|
39 | 39 | * IPython.toolbar.add_buttons_group([ |
|
40 | 40 | * { |
|
41 | 41 | * label:'my button', |
|
42 | 42 | * icon:'ui-icon-disk', |
|
43 | 43 | * callback:function(){alert('hoho'), |
|
44 | 44 | * id : 'my_button_id', // this is optional |
|
45 | 45 | * }, |
|
46 | 46 | * { |
|
47 | 47 | * label:'my second button', |
|
48 | 48 | * icon:'ui-icon-scissors', |
|
49 | 49 | * callback:function(){alert('be carefull I cut')} |
|
50 | 50 | * } |
|
51 | 51 | * ], |
|
52 | 52 | * "my_button_group_id" |
|
53 | 53 | * ) |
|
54 | 54 | * |
|
55 | 55 | * @method add_buttons_group |
|
56 | 56 | * @param list {List} |
|
57 | 57 | * List of button of the group, with the following paramter for each : |
|
58 | 58 | * @param list.label {string} text to show on button hover |
|
59 | 59 | * @param list.icon {string} icon to choose from [jQuery ThemeRoller](http://jqueryui.com/themeroller/) |
|
60 | 60 | * @param list.callback {function} function to be called on button click |
|
61 | 61 | * @param [list.id] {String} id to give to the button |
|
62 | 62 | * @param [group_id] {String} optionnal id to give to the group |
|
63 | 63 | * |
|
64 | 64 | */ |
|
65 | 65 | ToolBar.prototype.add_buttons_group = function (list, group_id) { |
|
66 | 66 | var span_group = $('<span/>'); |
|
67 | 67 | if( group_id != undefined ) { |
|
68 | 68 | span_group.attr('id',group_id); |
|
69 | 69 | } |
|
70 | 70 | for(var el in list) { |
|
71 | 71 | var button = $('<button/>').button({ |
|
72 | 72 | icons : {primary : list[el].icon}, |
|
73 | 73 | text : false, |
|
74 | 74 | label : list[el].label |
|
75 | 75 | }); |
|
76 | 76 | var id = list[el].id; |
|
77 | 77 | if( id != undefined ) |
|
78 | 78 | button.attr('id',id); |
|
79 | 79 | var fun = list[el].callback; |
|
80 | 80 | button.click(fun); |
|
81 | 81 | span_group.append(button); |
|
82 | 82 | } |
|
83 | 83 | span_group.buttonset(); |
|
84 | 84 | $(this.selector).append(span_group); |
|
85 | 85 | }; |
|
86 | 86 | |
|
87 | 87 | ToolBar.prototype.style = function () { |
|
88 | 88 | this.element.addClass('border-box-sizing'). |
|
89 |
addClass(' |
|
|
89 | addClass('toolbar'). | |
|
90 | 90 | css('border-top-style','none'). |
|
91 | 91 | css('border-left-style','none'). |
|
92 | 92 | css('border-right-style','none'); |
|
93 | 93 | }; |
|
94 | 94 | |
|
95 | 95 | /** |
|
96 | 96 | * Show and hide toolbar |
|
97 | 97 | * @method toggle |
|
98 | 98 | */ |
|
99 | 99 | ToolBar.prototype.toggle = function () { |
|
100 | 100 | this.element.toggle(); |
|
101 | 101 | if (IPython.layout_manager != undefined) { |
|
102 | 102 | IPython.layout_manager.do_resize(); |
|
103 | 103 | } |
|
104 | 104 | }; |
|
105 | 105 | |
|
106 | 106 | |
|
107 | 107 | IPython.ToolBar = ToolBar; |
|
108 | 108 | |
|
109 | 109 | return IPython; |
|
110 | 110 | |
|
111 | 111 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now