Updated all bookmarklets to just be functions and we can use utils/bookmarkletMaker.js to generate the bookmarklets in the console for now.

This commit is contained in:
Greg Jacobs
2024-06-12 13:04:47 -04:00
parent 3f25aef4f2
commit e2c5035011
26 changed files with 587 additions and 380 deletions

View File

@@ -6,43 +6,43 @@ and sets the value of the input field to each security in the array.
It then triggers events to simulate user input and key presses to add the security to the watchlist.
The process repeats for each security in the array with a delay of 2.5 seconds between each iteration.
The code is executed when the bookmarklet is clicked on the web page.
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
*/
javascript: (function () {
const newSecurities = [
'AMX',
'VNORP',
'AMBKP',
'CSU.DB',
'NFLX',
'ICFSSUSN',
'ICRP',
'LDSVF',
'AMTPQ',
'DSHKP',
'AITRR',
'URW',
'AP.UN',
'PVF.WT'
];
function populateWatchlist() {
const foundInputs = document.querySelectorAll('.rbc-typeahead-search-input');
const input = foundInputs && foundInputs.length > 1 ? foundInputs[1] : null;
if (input) {
let index = 0;
const interval = setInterval(() => {
if (index >= newSecurities.length) {
clearInterval(interval);
return;
}
input.value = newSecurities[index];
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new Event('change', { bubbles: true }));
setTimeout(() => {
input.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13 }));
}, 1000);
index++;
}, 2500);
}
const newSecurities = [
'AMX',
'VNORP',
'AMBKP',
'CSU.DB',
'NFLX',
'ICFSSUSN',
'ICRP',
'LDSVF',
'AMTPQ',
'DSHKP',
'AITRR',
'URW',
'AP.UN',
'PVF.WT'
];
function populateWatchlist() {
const foundInputs = document.querySelectorAll('.rbc-typeahead-search-input');
const input = foundInputs && foundInputs.length > 1 ? foundInputs[1] : null;
if (input) {
let index = 0;
const interval = setInterval(() => {
if (index >= newSecurities.length) {
clearInterval(interval);
return;
}
input.value = newSecurities[index];
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new Event('change', { bubbles: true }));
setTimeout(() => {
input.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13 }));
}, 1000);
index++;
}, 2500);
}
populateWatchlist();
})();
}
populateWatchlist();