|
449 | 449 | * init: function ($window) {
|
450 | 450 | * // called when creating the new window
|
451 | 451 | * // you can modify the new window object - it's jquery object
|
| 452 | + * // you must return the modified window object |
452 | 453 | * },
|
453 | 454 | * load: function ($window) {
|
454 | 455 | * // called when the page is successfully loaded
|
|
478 | 479 | * $myWindow.move(position) to move the window to the given position
|
479 | 480 | * if no position is given it may be determined from the mouse position
|
480 | 481 | *
|
| 482 | + * For custom content in the window you can use body() function: |
| 483 | + * $myWindow.body().append($('<div>').addClass('important-div')) |
| 484 | + * |
481 | 485 | * @author Kryštof Tulinger
|
482 | 486 | */
|
483 | 487 | (function (browserWindow, document, $, $script) {
|
|
596 | 600 | }
|
597 | 601 |
|
598 | 602 | this.addCallback('init', function ($window) {
|
599 |
| - var $top, $close, $controls |
| 603 | + var $top, $close, $controls, $header, $body; |
600 | 604 |
|
601 | 605 | $top = $("<div>").addClass('clearfix')
|
602 | 606 | .append($("<div>").addClass("pull-left").append($("<b>").text(this.options.title || "Window")))
|
603 |
| - .append($close = $("<a href=\"#\" class=\"pull-right minimize\">x</a>")) |
| 607 | + .append($("<div>").addClass('pull-right').append($close = $("<a href=\"#\" class=\"minimize\">x</a>"))) |
| 608 | + |
| 609 | + $header = $("<div>").addClass('window-header') |
| 610 | + .append($top); |
604 | 611 |
|
605 |
| - $controls = $('<div>') |
606 |
| - .addClass('clearfix') |
| 612 | + $body = $("<div>").addClass("window-body") |
607 | 613 | .append(self.$errors = $('<div>').css('text-align', 'center'))
|
608 | 614 |
|
609 | 615 | $window = $("<div>")
|
610 | 616 | .addClass('window')
|
611 | 617 | .addClass('diff_navigation_style')
|
612 | 618 | .css('z-index', 15000)
|
613 | 619 | .hide()
|
614 |
| - .append($top) |
615 |
| - .append($("<hr>")) |
616 |
| - .append($controls) |
| 620 | + .append($header) |
| 621 | + .append($body); |
617 | 622 |
|
618 | 623 | $close.click(function () {
|
619 | 624 | $window.hide()
|
620 | 625 | return false;
|
621 | 626 | });
|
622 | 627 |
|
| 628 | + /** |
| 629 | + * Get the element for the window body. |
| 630 | + * This should be used to place your desired content. |
| 631 | + * |
| 632 | + * The returned object has a method {@code window()} |
| 633 | + * which returns the whole window. |
| 634 | + * |
| 635 | + * {@code $window} is equivalent to {@code $window.body().window()} |
| 636 | + * |
| 637 | + * @returns jQuery object of the window body |
| 638 | + */ |
| 639 | + $window.body = function () { |
| 640 | + $body.window = function () { |
| 641 | + return $window; |
| 642 | + } |
| 643 | + return $body; |
| 644 | + } |
| 645 | + |
623 | 646 | /**
|
624 | 647 | * Display custom error message in the window
|
625 | 648 | * @param {string} msg message
|
|
703 | 726 | that.clientY = e.clientY;
|
704 | 727 | })
|
705 | 728 | $(document).keyup(function (e) {
|
706 |
| - var key = e.keyCode |
| 729 | + var key = e.keyCode; |
707 | 730 | switch (key) {
|
708 | 731 | case 27: // esc
|
709 | 732 | that.$window.hide();
|
|
832 | 855 | return $window
|
833 | 856 | .attr('id', 'intelli_win')
|
834 | 857 | .addClass('intelli-window')
|
| 858 | + .body() |
835 | 859 | .append($controls)
|
836 | 860 | .append($("<h2>").addClass('symbol-name'))
|
837 | 861 | .append($("<span>").addClass('symbol-description'))
|
|
841 | 865 | .append($("<h5>").text("In project \"" + this.project + "\""))
|
842 | 866 | .append($secondList)
|
843 | 867 | .append($("<h5>").text("On Google"))
|
844 |
| - .append($thirdList); |
| 868 | + .append($thirdList) |
| 869 | + .window(); |
845 | 870 | },
|
846 | 871 | load: function ($window) {
|
847 | 872 | var that = this;
|
|
1055 | 1080 | .addClass('messages-window')
|
1056 | 1081 | .addClass('diff_navigation_style')
|
1057 | 1082 | .css({top: '150px', right: '20px'})
|
| 1083 | + .body() |
1058 | 1084 | .append(this.$messages = $("<div>"))
|
| 1085 | + .window(); |
1059 | 1086 | },
|
1060 | 1087 | load: function ($window) {
|
1061 | 1088 | $window.mouseenter(function () {
|
|
1128 | 1155 | .addClass('scopes-window')
|
1129 | 1156 | .addClass('diff_navigation_style')
|
1130 | 1157 | .css({top: '150px', right: '20px'})
|
| 1158 | + .body() |
1131 | 1159 | .append(this.$scopes = $("<div>"))
|
| 1160 | + .window(); |
1132 | 1161 | },
|
1133 | 1162 | load: function ($window) {
|
1134 | 1163 | $window.hide().css('top', $("#content").offset().top + 10 + 'px')
|
|
1194 | 1223 | .attr('id', 'navigate_win')
|
1195 | 1224 | .addClass('navigate-window')
|
1196 | 1225 | .addClass('diff_navigation_style')
|
1197 |
| - .css({top: '150px', right: '20px'}) |
| 1226 | + .addClass('diff_navigation_style') |
| 1227 | + .css({top: '150px', right: '20px', height: this.defaultHeight + 'px'}) |
| 1228 | + .body() |
1198 | 1229 | .append(this.$content)
|
| 1230 | + .window(); |
1199 | 1231 | },
|
1200 | 1232 | load: function ($window) {
|
1201 | 1233 | var that = this
|
|
1254 | 1286 | }, options || {
|
1255 | 1287 | }), $.extend({
|
1256 | 1288 | $content: $('<div>'),
|
| 1289 | + defaultHeight: 480, |
1257 | 1290 | buildLink: function (href, name, c) {
|
1258 | 1291 | return $('<a>').attr('href', '#' + href).attr('title', this.escapeHtml(name)).addClass(c).html(this.escapeHtml(name)).click(lnshow)
|
1259 | 1292 | },
|
|
1278 | 1311 | $.scopesWindow.is(':visible')) {
|
1279 | 1312 | a.top = $.scopesWindow.position().top + $.scopesWindow.outerHeight() + 20;
|
1280 | 1313 | }
|
1281 |
| - a.height = Math.min(parseFloat($w.css('max-height')) || 480, $(browserWindow).outerHeight() - a.top - ($w.outerHeight(true) - $w.height()) - 20); |
| 1314 | + a.height = Math.min(parseFloat($w.css('max-height')) || this.defaultHeight, $(browserWindow).outerHeight() - a.top - ($w.outerHeight(true) - $w.height()) - 20); |
1282 | 1315 |
|
1283 | 1316 | if (a.height == $w.height() && a.top == this.getTopOffset())
|
1284 | 1317 | return $w;
|
|
0 commit comments