Rename .js/.jsx to .ts/.tsx
This commit is contained in:
parent
257162e5b6
commit
c60d0e7392
151 changed files with 0 additions and 0 deletions
13
src/content/focuses.ts
Normal file
13
src/content/focuses.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import * as doms from 'shared/utils/dom';
|
||||
|
||||
const focusInput = () => {
|
||||
let inputTypes = ['email', 'number', 'search', 'tel', 'text', 'url'];
|
||||
let inputSelector = inputTypes.map(type => `input[type=${type}]`).join(',');
|
||||
let targets = window.document.querySelectorAll(inputSelector + ',textarea');
|
||||
let target = Array.from(targets).find(doms.isVisible);
|
||||
if (target) {
|
||||
target.focus();
|
||||
}
|
||||
};
|
||||
|
||||
export { focusInput };
|
Reference in a new issue