X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/cb900d10b9d0d42b0b6aa035be45dcbaa2f61af6..573b9004c7bc2a6a2b29335155b4ff55d142c6b6:/src/redakcja/static/js/wiki/view_search.js diff --git a/src/redakcja/static/js/wiki/view_search.js b/src/redakcja/static/js/wiki/view_search.js index cad64fba..1421aa91 100644 --- a/src/redakcja/static/js/wiki/view_search.js +++ b/src/redakcja/static/js/wiki/view_search.js @@ -4,57 +4,51 @@ * Perspective */ class SearchPerspective extends $.wiki.SidebarPerspective { + vsplitbar = 'ZNAJDŹ I ZAMIEŃ'; + options = Array(); + constructor(options) { - var old_callback = options.callback || function() { }; + super(options); + var self = this; - options.callback = function(){ - var self = this; + this.editor = null; + this.$element = $("#side-search"); + this.$searchInput = $('#search-input', this.$element); + this.$replaceInput = $('#replace-input', this.$element); + this.$searchButton = $('#search-button', this.$element); + this.$searchPrevButton = $('#search-prev-button', this.$element); + this.$replaceButton = $('#replace-button', this.$element); - this.vsplitbar = 'ZNAJDŹ I ZAMIEŃ'; - this.editor = null; - this.$element = $("#side-search"); - this.$searchInput = $('#search-input', this.$element); - this.$replaceInput = $('#replace-input', this.$element); - this.$searchButton = $('#search-button', this.$element); - this.$searchPrevButton = $('#search-prev-button', this.$element); - this.$replaceButton = $('#replace-button', this.$element); + this.$replaceButton.attr("disabled","disabled"); - this.$replaceButton.attr("disabled","disabled"); - this.options = Array(); - - // handlers - this.$searchInput.change(function(event){ - self.searchCursor = null; - }); - this.$replaceInput.change(function(event){ - self.searchCursor = null; - }); - - $("#side-search input:checkbox").each(function() { - self.options[this.id] = this.checked; - }).change(function(){ - self.options[this.id] = this.checked; - self.searchCursor = null; - }); - - this.$searchButton.click(function(){ - if (!self.search()) - alert('Brak wyników.'); - }); - - this.$searchPrevButton.click(function(){ - if (!self.search(false)) - alert('Brak wyników.'); - }); - - this.$replaceButton.click(function(){ - self.replace(); - }); - - old_callback.call(this); - }; + // handlers + this.$searchInput.change(function(event){ + self.searchCursor = null; + }); + this.$replaceInput.change(function(event){ + self.searchCursor = null; + }); - super(options); + $("#side-search input:checkbox").each(function() { + self.options[this.id] = this.checked; + }).change(function(){ + self.options[this.id] = this.checked; + self.searchCursor = null; + }); + + this.$searchButton.click(function(){ + if (!self.search()) + alert('Brak wyników.'); + }); + + this.$searchPrevButton.click(function(){ + if (!self.search(false)) + alert('Brak wyników.'); + }); + + this.$replaceButton.click(function(){ + self.replace(); + }); } search(forward=true) {