X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9d566b4741eb66bf09b5c7d213aa8541886e100a..fd28890ac78d5869ac68ec6db7183bc168d03891:/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) {