diff --git a/html/admin/js/views/shellView.js b/html/admin/js/views/shellView.js index 710dfdbd52..9d38362bb0 100644 --- a/html/admin/js/views/shellView.js +++ b/html/admin/js/views/shellView.js @@ -2,6 +2,8 @@ /*global require, exports, Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/ var shellView = Backbone.View.extend({ + resizing: false, + el: '#content', events: { 'click #editor-run' : 'submitEditor', @@ -16,19 +18,33 @@ var shellView = Backbone.View.extend({ this.replShell(); this.editor(); - var windowHeight = $(window).height() - 200; - $('#shell_workspace').height(windowHeight); - $("#shell_workspace").splitter({ dock: true }); - $("#shell_workspace").trigger("resize", [ 200 ]); $('.vsplitbar').append('
'); + this.resize(); $.gritter.removeAll(); + // evil: the resize event is globally bound to window, but there is + // no elegant alternative... (is there?) + var self = this; + $(window).resize(function () { + self.resize(); + }); + return this; }, + resize: function () { + // prevent endless recursion + if (! this.resizing) { + this.resizing = true; + var windowHeight = $(window).height() - 200; + $('#shell_workspace').height(windowHeight); + $("#shell_workspace").trigger("resize", [ 200 ]); + this.resizing = false; + } + }, renderEditor: function () { var editor = ace.edit("editor"); editor.resize();