Skip to content

Instantly share code, notes, and snippets.

@splintor
Last active January 11, 2021 16:14
Show Gist options
  • Save splintor/b51f2b04518b90000faf19765d0c8831 to your computer and use it in GitHub Desktop.
Save splintor/b51f2b04518b90000faf19765d0c8831 to your computer and use it in GitHub Desktop.
Google Account Chooser - auto select Wix account
// ==UserScript==
// @name Google Account Chooser - auto select Wix account
// @namespace http://splintor.wordpress.com/
// @version 1.0.4
// @description Automatically login to your @wix.com account in Google Account Chooser
// @author Shmulik Flint
// @match https://accounts.google.com/signin/*
// @match https://accounts.google.com/AccountChooser*
// @match https://accounts.google.com/o/oauth2/auth*
// @match https://accounts.google.com/o/oauth2/v*/auth*
// @downloadURL https://gist.github.com/splintor/b51f2b04518b90000faf19765d0c8831/raw
// @updateURL https://gist.github.com/splintor/b51f2b04518b90000faf19765d0c8831/raw
// ==/UserScript==
(function() {
'use strict';
let timeout = 300; // Minimum time to wait before clicking an account. Without it, Google shows a "Something went wrong" message (but still login).
function clickWixAccount() {
if (document.querySelector('#headingSubtext [data-third-party-email*="@wix"]') ||
!document.querySelector('#headingSubtext') || document.querySelector('#headingSubtext').innerHTML === "") {
const wixAccount = document.querySelector('[id*=\\@wix\\.com] button') || document.querySelector('[data-identifier*="@wix.com"]');
wixAccount && wixAccount.click();
setTimeout(clickWixAccount, timeout);
timeout = timeout * 2;
}
}
setTimeout(clickWixAccount, timeout);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment