##// END OF EJS Templates
improve tooltip...
Matthias BUSSONNIER -
Show More
@@ -364,10 +364,36 div.text_cell_render {
364 to {opacity:1;}
364 to {opacity:1;}
365 }
365 }
366
366
367 /*"close" "expand" and "Open in pager button" of
368 /* the tooltip*/
369 .tooltip button{
370 float:right;
371 }
372
373 /*properties of tooltip after "expand"*/
374 .bigtooltip{
375 height:420px;
376 }
377
378 /*properties of tooltip before "expand"*/
379 .smalltooltip{
380 text-overflow: ellipsis;
381 overflow: hidden;
382 height:100px;
383 }
367
384
368 .tooltip{
385 .tooltip{
386 /*transition when "expand"ing tooltip */
387 -webkit-transition-property: height;
388 -webkit-transition-duration: 1s;
389 -moz-transition-property: height;
390 -moz-transition-duration: 1s;
391 transition-property: height;
392 transition-duration: 1s;
393 max-width:700px;
369 border-radius: 0px 10px 10px 10px;
394 border-radius: 0px 10px 10px 10px;
370 box-shadow: 3px 3px 5px #999;
395 box-shadow: 3px 3px 5px #999;
396 /*fade-in animation when inserted*/
371 -webkit-animation: fadeIn 200ms;
397 -webkit-animation: fadeIn 200ms;
372 -moz-animation: fadeIn 200ms;
398 -moz-animation: fadeIn 200ms;
373 animation: fadeIn 200ms;
399 animation: fadeIn 200ms;
@@ -157,20 +157,22 var IPython = (function (IPython) {
157 defstring=reply.definition;
157 defstring=reply.definition;
158 docstring=reply.docstring;
158 docstring=reply.docstring;
159 name=reply.name;
159 name=reply.name;
160 shortened = function(string){
161 if(string.length > 200){
162 return string.trim().substring(0,197)+'...';
163 } else { return string.trim() }
164 }
165
160
166 var that = this;
161 var that = this;
167 var tooltip = $('<div/>').attr('id', 'tooltip').addClass('tooltip');
162 var tooltip = $('<div/>').attr('id', 'tooltip').addClass('tooltip');
168 if(defstring){
163 // remove to have the tooltip not Limited in X and Y
169 defstring_html= $('<pre/>').html(utils.fixConsole(defstring));
164 tooltip.addClass('smalltooltip');
170 tooltip.append(defstring_html);
165 var pre=$('<pre/>').html(utils.fixConsole(docstring));
171 }
166 var expand=$('<button/>').text('Expand...')
172 var pre=$('<pre/>').html(utils.fixConsole(shortened(docstring)));
167 expand.attr('id','expanbutton');
173 var more=$('<button/>').text('more...')
168 expand.addClass('ui-button ui-state-default ui-corner-all');
169 expand.click(function(){
170 tooltip.removeClass('smalltooltip');
171 tooltip.addClass('bigtooltip');
172 $('#expanbutton').remove();
173 setTimeout(function(){that.code_mirror.focus();}, 50);
174 });
175 var more=$('<button/>').text('Open in Pager')
174 more.addClass('ui-button ui-state-default ui-corner-all');
176 more.addClass('ui-button ui-state-default ui-corner-all');
175 more.click(function(){
177 more.click(function(){
176 var msg_id = IPython.notebook.kernel.execute(name+"?");
178 var msg_id = IPython.notebook.kernel.execute(name+"?");
@@ -179,14 +181,20 var IPython = (function (IPython) {
179 setTimeout(function(){that.code_mirror.focus();}, 50);
181 setTimeout(function(){that.code_mirror.focus();}, 50);
180 });
182 });
181
183
182 var close=$('<button/>').text('close')
184 var close=$('<button/>').text('Close')
183 close.addClass('ui-button ui-state-default ui-corner-all');
185 close.addClass('ui-button ui-state-default ui-corner-all');
184 close.click(function(){
186 close.click(function(){
185 CodeCell.prototype.remove_and_cancell_tooltip(that.tooltip_timeout);
187 CodeCell.prototype.remove_and_cancell_tooltip(that.tooltip_timeout);
186 setTimeout(function(){that.code_mirror.focus();}, 50);
188 setTimeout(function(){that.code_mirror.focus();}, 50);
187 });
189 });
188 pre.append(more);
190 //construct the tooltip
189 pre.append(close);
191 tooltip.append(close);
192 tooltip.append(more);
193 tooltip.append(expand);
194 if(defstring){
195 defstring_html= $('<pre/>').html(utils.fixConsole(defstring));
196 tooltip.append(defstring_html);
197 }
190 tooltip.append(pre);
198 tooltip.append(pre);
191 var pos = this.code_mirror.cursorCoords();
199 var pos = this.code_mirror.cursorCoords();
192 tooltip.css('left',pos.x+'px');
200 tooltip.css('left',pos.x+'px');
General Comments 0
You need to be logged in to leave comments. Login now