Show More
@@ -18,18 +18,23 b' var IPython = (function (IPython) {' | |||||
18 |
|
18 | |||
19 | var Tooltip = function (notebook) { |
|
19 | var Tooltip = function (notebook) { | |
20 | this.tooltip = $('#tooltip'); |
|
20 | this.tooltip = $('#tooltip'); | |
|
21 | ||||
|
22 | // contain the button in the upper right corner | |||
21 | this.buttons = $('<div/>') |
|
23 | this.buttons = $('<div/>') | |
22 | .addClass('tooltipbuttons'); |
|
24 | .addClass('tooltipbuttons'); | |
|
25 | ||||
|
26 | // will contain the docstring | |||
23 | this.text = $('<div/>') |
|
27 | this.text = $('<div/>') | |
24 | .addClass('tooltiptext') |
|
28 | .addClass('tooltiptext') | |
25 | .addClass('smalltooltip'); |
|
29 | .addClass('smalltooltip'); | |
26 | this.tooltip.css('left',50+'px'); |
|
|||
27 | this.tooltip.css('top',50+'px'); |
|
|||
28 |
|
30 | |||
29 | var tooltip = this.tooltip; |
|
31 | var tooltip = this.tooltip; | |
30 | var text = this.text; |
|
32 | var text = this.text; | |
31 |
|
33 | |||
32 | var expandspan=$('<span/>').text('Expand') |
|
34 | // build the buttons menu on the upper right | |
|
35 | ||||
|
36 | // expand the tooltip to see more | |||
|
37 | var expandspan=$('<span/>').text('Expand') | |||
33 | .addClass('ui-icon') |
|
38 | .addClass('ui-icon') | |
34 | .addClass('ui-icon-plus'); |
|
39 | .addClass('ui-icon-plus'); | |
35 | var expandlink=$('<a/>').attr('href',"#") |
|
40 | var expandlink=$('<a/>').attr('href',"#") | |
@@ -44,11 +49,10 b' var IPython = (function (IPython) {' | |||||
44 | //setTimeout(function(){that.code_mirror.focus();}, 50); |
|
49 | //setTimeout(function(){that.code_mirror.focus();}, 50); | |
45 | }); |
|
50 | }); | |
46 |
|
51 | |||
|
52 | // open in pager | |||
47 | var morelink=$('<a/>').attr('href',"#"); |
|
53 | var morelink=$('<a/>').attr('href',"#"); | |
48 | morelink.attr('role',"button"); |
|
54 | morelink.attr('role',"button"); | |
49 | morelink.addClass('ui-button'); |
|
55 | morelink.addClass('ui-button'); | |
50 | //morelink.addClass("ui-corner-all"); //rounded corner |
|
|||
51 | //morelink.addClass('ui-state-default'); |
|
|||
52 | var morespan=$('<span/>').text('Open in Pager'); |
|
56 | var morespan=$('<span/>').text('Open in Pager'); | |
53 | morespan.addClass('ui-icon'); |
|
57 | morespan.addClass('ui-icon'); | |
54 | morespan.addClass('ui-icon-arrowstop-l-n'); |
|
58 | morespan.addClass('ui-icon-arrowstop-l-n'); | |
@@ -60,11 +64,10 b' var IPython = (function (IPython) {' | |||||
60 | setTimeout(function(){that.code_mirror.focus();}, 50); |
|
64 | setTimeout(function(){that.code_mirror.focus();}, 50); | |
61 | }); |
|
65 | }); | |
62 |
|
66 | |||
|
67 | // close the tooltip | |||
63 | var closelink=$('<a/>').attr('href',"#"); |
|
68 | var closelink=$('<a/>').attr('href',"#"); | |
64 | closelink.attr('role',"button"); |
|
69 | closelink.attr('role',"button"); | |
65 | closelink.addClass('ui-button'); |
|
70 | closelink.addClass('ui-button'); | |
66 | //closelink.addClass("ui-corner-all"); //rounded corner |
|
|||
67 | //closelink.adClass('ui-state-default'); // grey background and blue cross |
|
|||
68 | var closespan=$('<span/>').text('Close'); |
|
71 | var closespan=$('<span/>').text('Close'); | |
69 | closespan.addClass('ui-icon'); |
|
72 | closespan.addClass('ui-icon'); | |
70 | closespan.addClass('ui-icon-close'); |
|
73 | closespan.addClass('ui-icon-close'); | |
@@ -72,15 +75,19 b' var IPython = (function (IPython) {' | |||||
72 | closelink.click(function(){ |
|
75 | closelink.click(function(){ | |
73 | tooltip.addClass('hide'); |
|
76 | tooltip.addClass('hide'); | |
74 | }); |
|
77 | }); | |
75 | //construct the tooltip |
|
78 | ||
|
79 | //construct the tooltip | |||
|
80 | // add in the reverse order you want them to appear | |||
76 | this.buttons.append(closelink); |
|
81 | this.buttons.append(closelink); | |
77 | this.buttons.append(expandlink); |
|
82 | this.buttons.append(expandlink); | |
78 | this.buttons.append(morelink); |
|
83 | this.buttons.append(morelink); | |
79 |
|
84 | |||
|
85 | // we need a phony element to make the small arrow | |||
|
86 | // of the tooltip in css | |||
|
87 | // we could try to move the arrow later | |||
80 | arrow = $('<div/>').addClass('pretooltiparrow'); |
|
88 | arrow = $('<div/>').addClass('pretooltiparrow'); | |
81 | this.tooltip.append(arrow); |
|
89 | this.tooltip.append(arrow); | |
82 | this.tooltip.append(this.buttons); |
|
90 | this.tooltip.append(this.buttons); | |
83 | this.tooltip.append(this.buttons); |
|
|||
84 | this.tooltip.append(this.text); |
|
91 | this.tooltip.append(this.text); | |
85 | }; |
|
92 | }; | |
86 |
|
93 |
General Comments 0
You need to be logged in to leave comments.
Login now