X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5c5ef4d21bc0b4862b31b0b96aab9373357140e1..78644811ca0c6042212788dc67add42bc41fb74c:/project/static/js/views/split.js diff --git a/project/static/js/views/split.js b/project/static/js/views/split.js deleted file mode 100644 index 84f48ead..00000000 --- a/project/static/js/views/split.js +++ /dev/null @@ -1,86 +0,0 @@ -/*globals Class*/ - -var SplitView = Class.extend({ - leftPanelClass: 'splitview-left-panel', - rightPanelClass: 'splitview-right-panel', - splitterClass: 'splitview-splitter', - overlayClass: 'splitview-overlay', - element: null, - - init: function(element) { - this.element = $(element); - this.leftPanel = $(this.leftPanelClass, element); - this.rightPanel = $(this.rightPanelClass, element); - this.splitter = $(this.splitterClass, element); - this.overlay = this._createOverlay(this.overlayClass); - - this.splitter.bind('mousedown.splitview', this.beginResize.bind(this)); - }, - - _createOverlay: function(cssClass) { - var pos = this.root.position(); - return $('
') - .addClass(cssClass) - .css({ - position: 'absolute', - left: pos.left, - top: pos.top, - width: this.root.width(), - height: this.root.height() - }) - .hide() - .appendTo(this.element); - }, - - beginResize: function(event) { - this.hotspotX = event.pageX - this.splitter.position().left; - - $(document) - .bind('mousemove.splitview', this.resizeChanged.bind(this)) - .bind('mouseup.splitview', this.endResize.bind(this)); - - this.overlay.show(); - return false; - }, - - resizeChanged: function(event) { - var old_width = this.overlay.width(); - var delta = event.pageX + this.hotspotX - old_width; - - if(old_width + delta < 12) delta = 12 - old_width; - if(old_width + delta > $(window).width()) { - delta = $(window).width() - old_width; - } - - this.overlay.css({'width': old_width + delta}); - - if(this.overlay.next) { - var left = parseInt(this.overlay.next.css('left'), 10); - this.overlay.next.css('left', left+delta); - } - return false; - }, - - endResize: function(event) { - $(document) - .unbind('mousemove.splitview') - .unbind('mouseup.splitview'); - - this.leftPanel.css({ - left: 0, - right: this.hotspotX - }); - - this.rightPanel.css({ - left: this.hotspotX, - right: 0 - }); - - this.overlay.hide(); - }, - - dispose: function() { - this.splitter.unbind('mousedown.splitview'); - } -}); -