49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
/**
|
|
This code is a bookmarklet that populates a watchlist on a web page.
|
|
It defines an array of new securities and a function called populateWatchlist.
|
|
The function finds the input field on the page, iterates over the new securities array,
|
|
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.
|
|
*/
|
|
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);
|
|
}
|
|
}
|
|
populateWatchlist();
|
|
})();
|