##// END OF EJS Templates
improve tooltip...
Matthias BUSSONNIER -
Show More
@@ -364,10 +364,36 div.text_cell_render {
364 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 385 .tooltip{
369 border-radius: 0px 10px 10px 10px;
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;
394 border-radius: 0px 10px 10px 10px;
370 395 box-shadow: 3px 3px 5px #999;
396 /*fade-in animation when inserted*/
371 397 -webkit-animation: fadeIn 200ms;
372 398 -moz-animation: fadeIn 200ms;
373 399 animation: fadeIn 200ms;
@@ -157,20 +157,22 var IPython = (function (IPython) {
157 157 defstring=reply.definition;
158 158 docstring=reply.docstring;
159 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 161 var that = this;
167 162 var tooltip = $('<div/>').attr('id', 'tooltip').addClass('tooltip');
168 if(defstring){
169 defstring_html= $('<pre/>').html(utils.fixConsole(defstring));
170 tooltip.append(defstring_html);
171 }
172 var pre=$('<pre/>').html(utils.fixConsole(shortened(docstring)));
173 var more=$('<button/>').text('more...')
163 // remove to have the tooltip not Limited in X and Y
164 tooltip.addClass('smalltooltip');
165 var pre=$('<pre/>').html(utils.fixConsole(docstring));
166 var expand=$('<button/>').text('Expand...')
167 expand.attr('id','expanbutton');
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 176 more.addClass('ui-button ui-state-default ui-corner-all');
175 177 more.click(function(){
176 178 var msg_id = IPython.notebook.kernel.execute(name+"?");
@@ -179,14 +181,20 var IPython = (function (IPython) {
179 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 185 close.addClass('ui-button ui-state-default ui-corner-all');
184 186 close.click(function(){
185 187 CodeCell.prototype.remove_and_cancell_tooltip(that.tooltip_timeout);
186 188 setTimeout(function(){that.code_mirror.focus();}, 50);
187 189 });
188 pre.append(more);
189 pre.append(close);
190 //construct the tooltip
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 198 tooltip.append(pre);
191 199 var pos = this.code_mirror.cursorCoords();
192 200 tooltip.css('left',pos.x+'px');
General Comments 0
You need to be logged in to leave comments. Login now