File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// ==UserScript==
22// @name Automatically Select First Google Account to Sign In
33// @namespace typpi.online
4- // @version 1.6
5- // @description Selects the first Google account in the Google account selector page
4+ // @version 1.7
5+ // @description Automatically selects the first Google account in the Google account selector page
66// @author Nick2bad4u
77// @match https://accounts.google.com/*
88// @grant none
1717( function ( ) {
1818 'use strict' ;
1919
20+ // Configurable delay for automatic selection (default: 5000ms)
21+ const AUTO_SELECT_DELAY_MS = 5000 ;
22+
2023 // Function to select the first account
2124 const selectFirstAccount = ( ) => {
2225 const firstAccount = Array . from ( document . querySelectorAll ( 'li' ) ) . find ( ( el ) => el . textContent . includes ( '@gmail.com' ) ) ;
4750
4851 // Automatically run the function after 5 seconds
4952 setTimeout ( ( ) => {
50- selectFirstAccount ( ) ;
51- } , 5000 ) ;
53+ if ( Array . from ( document . querySelectorAll ( 'li' ) ) . some ( ( el ) => el . textContent . includes ( '@gmail.com' ) ) ) {
54+ selectFirstAccount ( ) ;
55+ } else {
56+ console . log ( 'Account list not loaded within 5 seconds. Skipping automatic selection.' ) ;
57+ }
58+ } , AUTO_SELECT_DELAY_MS ) ;
5259} ) ( ) ;
You can’t perform that action at this time.
0 commit comments