diff options
Diffstat (limited to 'src/content/actions')
-rw-r--r-- | src/content/actions/find.ts | 18 | ||||
-rw-r--r-- | src/content/actions/index.ts | 3 | ||||
-rw-r--r-- | src/content/actions/input.ts | 3 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/content/actions/find.ts b/src/content/actions/find.ts index 6dd2ae6..53e03ae 100644 --- a/src/content/actions/find.ts +++ b/src/content/actions/find.ts @@ -9,6 +9,20 @@ import * as messages from '../../shared/messages'; import * as actions from './index'; import * as consoleFrames from '../console-frames'; +interface MyWindow extends Window { + find( + aString: string, + aCaseSensitive?: boolean, + aBackwards?: boolean, + aWrapAround?: boolean, + aWholeWord?: boolean, + aSearchInFrames?: boolean, + aShowDialog?: boolean): boolean; +} + +// eslint-disable-next-line no-var, vars-on-top, init-declarations +declare var window: MyWindow; + const find = (str: string, backwards: boolean): boolean => { let caseSensitive = false; let wrapScan = true; @@ -18,7 +32,7 @@ const find = (str: string, backwards: boolean): boolean => { // because of same origin policy // eslint-disable-next-line no-extra-parens - let found = (<any>window).find(str, caseSensitive, backwards, wrapScan); + let found = window.find(str, caseSensitive, backwards, wrapScan); if (found) { return found; } @@ -28,7 +42,7 @@ const find = (str: string, backwards: boolean): boolean => { } // eslint-disable-next-line no-extra-parens - return (<any>window).find(str, caseSensitive, backwards, wrapScan); + return window.find(str, caseSensitive, backwards, wrapScan); }; // eslint-disable-next-line max-statements diff --git a/src/content/actions/index.ts b/src/content/actions/index.ts index a259211..8aa9c23 100644 --- a/src/content/actions/index.ts +++ b/src/content/actions/index.ts @@ -1,5 +1,6 @@ import Redux from 'redux'; import Settings from '../../shared/Settings'; +import * as keyUtils from '../../shared/utils/keys'; // Enable/disable export const ADDON_SET_ENABLED = 'addon.set.enabled'; @@ -51,7 +52,7 @@ export interface SettingSetAction extends Redux.Action { export interface InputKeyPressAction extends Redux.Action { type: typeof INPUT_KEY_PRESS; - key: string; + key: keyUtils.Key; } export interface InputClearKeysAction extends Redux.Action { diff --git a/src/content/actions/input.ts b/src/content/actions/input.ts index 21c912e..1df6452 100644 --- a/src/content/actions/input.ts +++ b/src/content/actions/input.ts @@ -1,6 +1,7 @@ import * as actions from './index'; +import * as keyUtils from '../../shared/utils/keys'; -const keyPress = (key: string): actions.InputAction => { +const keyPress = (key: keyUtils.Key): actions.InputAction => { return { type: actions.INPUT_KEY_PRESS, key, |