I tried various ways (changed @match
directive, tried @run-at xxx
many combination), but can’t figure out the way to prompt the login only at the good time. When I open the page, I need to refresh the page to be able to run the script. This is the bug I need to fix. The goal is to promt()
when the virtual keyboard is loaded.
I’m pretty sure I’m missing something, but don’t know what.
This is my user-script:
// ==UserScript==
// @name Boursorama
// @namespace GillesQuenot
// @version 20241013
// @description xxx
// @author Gilles Quenot
// @match https://clients.boursobank.com/connexion/saisie-mot-de-passe*
// ==/UserScript==
(function() {
'use strict';
function myFunction() {
var targetElement = document.querySelector('ul.password-input li:nth-last-of-type(1) button.sasmap__key');
if (!targetElement && !targetElement.complete) {
// The element is not loaded yet, try again later
setTimeout(myFunction, 500)
} else {
var login = window.prompt('login');
}
};
window.addEventListener('load', function() {
setTimeout(myFunction, 500)
}, false);
})();
Also tried this way, but exactly the same bug:
// ==UserScript==
// @name Boursorama
// @namespace GillesQuenot
// @version 20241009
// @require https://cdn.jsdelivr.net/gh/CoeJoder/[email protected]/waitForKeyElements.js
// @description xxx
// @author Gilles Quenot
// @match https://clients.boursobank.com/connexion/saisie-mot-de-passe
// ==/UserScript==
(function() {
'use strict';
waitForKeyElements('ul.password-input li:nth-last-of-type(1) button.sasmap__key', (element) => {
var login = window.prompt('login');
});
})();
Any way to fix this?