From ffee870176040a77e5bd541a18d1cde002cc23fa Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 3 Jun 2015 04:37:45 +0100 Subject: Move FindMode from vimium_frontend to mode_find --- content_scripts/vimium_frontend.coffee | 43 ---------------------------------- 1 file changed, 43 deletions(-) (limited to 'content_scripts/vimium_frontend.coffee') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 820645bc..b6ca06a2 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -686,38 +686,6 @@ window.handleEnterForFindMode = -> document.body.classList.add("vimiumFindMode") FindModeHistory.saveQuery findModeQuery.rawQuery -class FindMode extends Mode - constructor: (@options = {}) -> - # Save the selection, so findInPlace can restore it. - @initialRange = getCurrentRange() - window.findModeQuery = rawQuery: "" - if @options.returnToViewport - @scrollX = window.scrollX - @scrollY = window.scrollY - super - name: "find" - indicator: false - exitOnClick: true - - HUD.showFindMode() - - exit: (event) -> - super() - handleEscapeForFindMode() if event - - restoreSelection: -> - range = @initialRange - selection = getSelection() - selection.removeAllRanges() - selection.addRange range - - findInPlace: -> - # Restore the selection. That way, we're always searching forward from the same place, so we find the right - # match as the user adds matching characters, or removes previously-matched characters. See #1434. - @restoreSelection() - query = if findModeQuery.isRegex then getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery - window.findModeQueryHasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase }) - # :options is an optional dict. valid parameters are 'caseSensitive' and 'backwards'. window.executeFind = (query, options) -> result = null @@ -897,17 +865,6 @@ window.goNext = -> nextStrings = nextPatterns.split(",").filter( (s) -> s.trim().length ) findAndFollowRel("next") || findAndFollowLink(nextStrings) -getCurrentRange = -> - selection = getSelection() - if selection.type == "None" - range = document.createRange() - range.setStart document.body, 0 - range.setEnd document.body, 0 - range - else - selection.collapseToStart() if selection.type == "Range" - selection.getRangeAt 0 - # Enters find mode. Returns the new find-mode instance. window.enterFindMode = -> Marks.setPreviousPosition() -- cgit v1.2.3