##// END OF EJS Templates
addClass instead of adding extra_class arg everywhere
Jonathan Frederic -
Show More
@@ -403,7 +403,10 b' var IPython = (function (IPython) {'
403 if (this.prompt_area) {
403 if (this.prompt_area) {
404 toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');
404 toinsert.find('div.prompt').addClass('output_prompt').text('Out[' + n + ']:');
405 }
405 }
406 this.append_mime_type(json, toinsert, 'output_pyout');
406 var inserted = this.append_mime_type(json, toinsert);
407 if (inserted) {
408 inserted.addClass('output_pyout');
409 }
407 this._safe_append(toinsert);
410 this._safe_append(toinsert);
408 // If we just output latex, typeset it.
411 // If we just output latex, typeset it.
409 if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) {
412 if ((json['text/latex'] !== undefined) || (json['text/html'] !== undefined)) {
@@ -422,7 +425,7 b' var IPython = (function (IPython) {'
422 }
425 }
423 s = s + '\n';
426 s = s + '\n';
424 var toinsert = this.create_output_area();
427 var toinsert = this.create_output_area();
425 this.append_text(s, {}, toinsert, 'output_pyerr');
428 this.append_text(s, {}, toinsert).addClass('output_pyerr');
426 this._safe_append(toinsert);
429 this._safe_append(toinsert);
427 }
430 }
428 };
431 };
@@ -461,7 +464,7 b' var IPython = (function (IPython) {'
461
464
462 // If we got here, attach a new div
465 // If we got here, attach a new div
463 var toinsert = this.create_output_area();
466 var toinsert = this.create_output_area();
464 this.append_text(text, {}, toinsert, "output_stream "+subclass);
467 this.append_text(text, {}, toinsert).addClass("output_stream "+subclass);
465 this._safe_append(toinsert);
468 this._safe_append(toinsert);
466 };
469 };
467
470
@@ -485,7 +488,7 b' var IPython = (function (IPython) {'
485 'image/jpeg' : true
488 'image/jpeg' : true
486 };
489 };
487
490
488 OutputArea.prototype.append_mime_type = function (json, element, extra_class) {
491 OutputArea.prototype.append_mime_type = function (json, element) {
489 for (var type_i in OutputArea.display_order) {
492 for (var type_i in OutputArea.display_order) {
490 var type = OutputArea.display_order[type_i];
493 var type = OutputArea.display_order[type_i];
491 var append = OutputArea.append_map[type];
494 var append = OutputArea.append_map[type];
@@ -502,21 +505,18 b' var IPython = (function (IPython) {'
502 }
505 }
503 }
506 }
504 var md = json.metadata || {};
507 var md = json.metadata || {};
505 var toinsert = append.apply(this, [value, md, element, extra_class]);
508 var toinsert = append.apply(this, [value, md, element]);
506 $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]);
509 $([IPython.events]).trigger('output_appended.OutputArea', [type, value, md, toinsert]);
507 return true;
510 return toinsert;
508 }
511 }
509 }
512 }
510 return false;
513 return null;
511 };
514 };
512
515
513
516
514 OutputArea.prototype.append_html = function (html, md, element, extra_class) {
517 OutputArea.prototype.append_html = function (html, md, element) {
515 var type = 'text/html';
518 var type = 'text/html';
516 var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
519 var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
517 if (extra_class){
518 toinsert.addClass(extra_class);
519 }
520 IPython.keyboard_manager.register_events(toinsert);
520 IPython.keyboard_manager.register_events(toinsert);
521 toinsert.append(html);
521 toinsert.append(html);
522 element.append(toinsert);
522 element.append(toinsert);
@@ -524,13 +524,10 b' var IPython = (function (IPython) {'
524 };
524 };
525
525
526
526
527 OutputArea.prototype.append_javascript = function (js, md, element, extra_class) {
527 OutputArea.prototype.append_javascript = function (js, md, element) {
528 // We just eval the JS code, element appears in the local scope.
528 // We just eval the JS code, element appears in the local scope.
529 var type = 'application/javascript';
529 var type = 'application/javascript';
530 var toinsert = this.create_output_subarea(md, "output_javascript", type);
530 var toinsert = this.create_output_subarea(md, "output_javascript", type);
531 if (extra_class){
532 toinsert.addClass(extra_class);
533 }
534 IPython.keyboard_manager.register_events(toinsert);
531 IPython.keyboard_manager.register_events(toinsert);
535 element.append(toinsert);
532 element.append(toinsert);
536 // FIXME TODO : remove `container element for 3.0`
533 // FIXME TODO : remove `container element for 3.0`
@@ -548,16 +545,13 b' var IPython = (function (IPython) {'
548 };
545 };
549
546
550
547
551 OutputArea.prototype.append_text = function (data, md, element, extra_class) {
548 OutputArea.prototype.append_text = function (data, md, element) {
552 var type = 'text/plain';
549 var type = 'text/plain';
553 var toinsert = this.create_output_subarea(md, "output_text", type);
550 var toinsert = this.create_output_subarea(md, "output_text", type);
554 // escape ANSI & HTML specials in plaintext:
551 // escape ANSI & HTML specials in plaintext:
555 data = utils.fixConsole(data);
552 data = utils.fixConsole(data);
556 data = utils.fixCarriageReturn(data);
553 data = utils.fixCarriageReturn(data);
557 data = utils.autoLinkUrls(data);
554 data = utils.autoLinkUrls(data);
558 if (extra_class){
559 toinsert.addClass(extra_class);
560 }
561 // The only user content injected with this HTML call is
555 // The only user content injected with this HTML call is
562 // escaped by the fixConsole() method.
556 // escaped by the fixConsole() method.
563 toinsert.append($("<pre/>").html(data));
557 toinsert.append($("<pre/>").html(data));
@@ -566,12 +560,9 b' var IPython = (function (IPython) {'
566 };
560 };
567
561
568
562
569 OutputArea.prototype.append_svg = function (svg, md, element, extra_class) {
563 OutputArea.prototype.append_svg = function (svg, md, element) {
570 var type = 'image/svg+xml';
564 var type = 'image/svg+xml';
571 var toinsert = this.create_output_subarea(md, "output_svg", type);
565 var toinsert = this.create_output_subarea(md, "output_svg", type);
572 if (extra_class){
573 toinsert.addClass(extra_class);
574 }
575 toinsert.append(svg);
566 toinsert.append(svg);
576 element.append(toinsert);
567 element.append(toinsert);
577 return toinsert;
568 return toinsert;
@@ -622,12 +613,9 b' var IPython = (function (IPython) {'
622 };
613 };
623
614
624
615
625 OutputArea.prototype.append_jpeg = function (jpeg, md, element, extra_class) {
616 OutputArea.prototype.append_jpeg = function (jpeg, md, element) {
626 var type = 'image/jpeg';
617 var type = 'image/jpeg';
627 var toinsert = this.create_output_subarea(md, "output_jpeg", type);
618 var toinsert = this.create_output_subarea(md, "output_jpeg", type);
628 if (extra_class){
629 toinsert.addClass(extra_class);
630 }
631 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
619 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
632 set_width_height(img, md, 'image/jpeg');
620 set_width_height(img, md, 'image/jpeg');
633 this._dblclick_to_reset_size(img);
621 this._dblclick_to_reset_size(img);
@@ -637,12 +625,9 b' var IPython = (function (IPython) {'
637 };
625 };
638
626
639
627
640 OutputArea.prototype.append_pdf = function (pdf, md, element, extra_class) {
628 OutputArea.prototype.append_pdf = function (pdf, md, element) {
641 var type = 'application/pdf';
629 var type = 'application/pdf';
642 var toinsert = this.create_output_subarea(md, "output_pdf", type);
630 var toinsert = this.create_output_subarea(md, "output_pdf", type);
643 if (extra_class){
644 toinsert.addClass(extra_class);
645 }
646 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
631 var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
647 a.attr('target', '_blank');
632 a.attr('target', '_blank');
648 a.text('View PDF')
633 a.text('View PDF')
@@ -651,14 +636,11 b' var IPython = (function (IPython) {'
651 return toinsert;
636 return toinsert;
652 }
637 }
653
638
654 OutputArea.prototype.append_latex = function (latex, md, element, extra_class) {
639 OutputArea.prototype.append_latex = function (latex, md, element) {
655 // This method cannot do the typesetting because the latex first has to
640 // This method cannot do the typesetting because the latex first has to
656 // be on the page.
641 // be on the page.
657 var type = 'text/latex';
642 var type = 'text/latex';
658 var toinsert = this.create_output_subarea(md, "output_latex", type);
643 var toinsert = this.create_output_subarea(md, "output_latex", type);
659 if (extra_class){
660 toinsert.addClass(extra_class);
661 }
662 toinsert.append(latex);
644 toinsert.append(latex);
663 element.append(toinsert);
645 element.append(toinsert);
664 return toinsert;
646 return toinsert;
General Comments 0
You need to be logged in to leave comments. Login now