##// END OF EJS Templates
Merge pull request #7605 from minrk/f-the-pager...
Thomas Kluyver -
r20229:f3af2702 merge
parent child Browse files
Show More
@@ -65,7 +65,7 b' define(['
65 this._clocklink = $('<a/>').attr('href', "#");
65 this._clocklink = $('<a/>').attr('href', "#");
66 this._clocklink.attr('role', "button");
66 this._clocklink.attr('role', "button");
67 this._clocklink.addClass('ui-button');
67 this._clocklink.addClass('ui-button');
68 this._clocklink.attr('title', 'Tootip is not dismissed while typing for 10 seconds');
68 this._clocklink.attr('title', 'Tooltip is not dismissed while typing for 10 seconds');
69 var clockspan = $('<span/>').text('Close');
69 var clockspan = $('<span/>').text('Close');
70 clockspan.addClass('ui-icon');
70 clockspan.addClass('ui-icon');
71 clockspan.addClass('ui-icon-clock');
71 clockspan.addClass('ui-icon-clock');
@@ -273,33 +273,38 b' define(['
273 this.name = content.name;
273 this.name = content.name;
274
274
275 // do some math to have the tooltip arrow on more or less on left or right
275 // do some math to have the tooltip arrow on more or less on left or right
276 // width of the editor
276 // position of the editor
277 var w = $(this.code_mirror.getScrollerElement()).width();
277 var cm_pos = $(this.code_mirror.getWrapperElement()).position();
278 // ofset of the editor
278
279 var o = $(this.code_mirror.getScrollerElement()).offset();
279 // anchor and head positions are local within CodeMirror element
280
280 var anchor = this.code_mirror.cursorCoords(false, 'local');
281 // whatever anchor/head order but arrow at mid x selection
281 var head = this.code_mirror.cursorCoords(true, 'local');
282 var anchor = this.code_mirror.cursorCoords(false);
282 // locate the target at the center of anchor, head
283 var head = this.code_mirror.cursorCoords(true);
283 var center_left = (head.left + anchor.left) / 2;
284 var xinit = (head.left+anchor.left)/2;
284 // locate the left edge of the tooltip, at most 450 px left of the arrow
285 var xinter = o.left + (xinit - o.left) / w * (w - 450);
285 var edge_left = Math.max(center_left - 450, 0);
286 var posarrowleft = xinit - xinter;
286 // locate the arrow at the cursor. A 24 px offset seems necessary.
287 var arrow_left = center_left - edge_left - 24;
288
289 // locate left, top within container element
290 var left = (cm_pos.left + edge_left) + 'px';
291 var top = (cm_pos.top + head.bottom + 10) + 'px';
287
292
288 if (this._hidden === false) {
293 if (this._hidden === false) {
289 this.tooltip.animate({
294 this.tooltip.animate({
290 'left': xinter - 30 + 'px',
295 left: left,
291 'top': (head.bottom + 10) + 'px'
296 top: top
292 });
297 });
293 } else {
298 } else {
294 this.tooltip.css({
299 this.tooltip.css({
295 'left': xinter - 30 + 'px'
300 left: left
296 });
301 });
297 this.tooltip.css({
302 this.tooltip.css({
298 'top': (head.bottom + 10) + 'px'
303 top: top
299 });
304 });
300 }
305 }
301 this.arrow.animate({
306 this.arrow.animate({
302 'left': posarrowleft + 'px'
307 'left': arrow_left + 'px'
303 });
308 });
304
309
305 this._hidden = false;
310 this._hidden = false;
@@ -16,7 +16,7 b' div#pager {'
16 z-index: 100;
16 z-index: 100;
17
17
18 /* Hack which prevents jquery ui resizable from changing top. */
18 /* Hack which prevents jquery ui resizable from changing top. */
19 top: inherit !important;
19 top: auto !important;
20
20
21 pre {
21 pre {
22 line-height: @code_line_height;
22 line-height: @code_line_height;
@@ -10909,7 +10909,7 b' div#pager {'
10909 /* Display over codemirror */
10909 /* Display over codemirror */
10910 z-index: 100;
10910 z-index: 100;
10911 /* Hack which prevents jquery ui resizable from changing top. */
10911 /* Hack which prevents jquery ui resizable from changing top. */
10912 top: inherit !important;
10912 top: auto !important;
10913 }
10913 }
10914 div#pager pre {
10914 div#pager pre {
10915 line-height: 1.21429em;
10915 line-height: 1.21429em;
@@ -287,13 +287,18 b' data-notebook-path="{{notebook_path}}"'
287
287
288 {% block site %}
288 {% block site %}
289
289
290
291 <div id="ipython-main-app">
290 <div id="ipython-main-app">
292 <div id="notebook_panel">
291 <div id="notebook_panel">
293 <div id="notebook"></div>
292 <div id="notebook"></div>
294 </div>
293 </div>
295 </div>
294 </div>
296
295
296 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
297
298 {% endblock %}
299
300 {% block after_site %}
301
297 <div id="pager">
302 <div id="pager">
298 <div id="pager-contents">
303 <div id="pager-contents">
299 <div id="pager-container" class="container"></div>
304 <div id="pager-container" class="container"></div>
@@ -301,12 +306,8 b' data-notebook-path="{{notebook_path}}"'
301 <div id='pager-button-area'></div>
306 <div id='pager-button-area'></div>
302 </div>
307 </div>
303
308
304 <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
305
306
307 {% endblock %}
309 {% endblock %}
308
310
309
310 {% block script %}
311 {% block script %}
311 {{super()}}
312 {{super()}}
312 <script type="text/javascript">
313 <script type="text/javascript">
@@ -111,6 +111,9 b''
111 {% endblock %}
111 {% endblock %}
112 </div>
112 </div>
113
113
114 {% block after_site %}
115 {% endblock %}
116
114 {% block script %}
117 {% block script %}
115 {% endblock %}
118 {% endblock %}
116
119
General Comments 0
You need to be logged in to leave comments. Login now