git hook to fix readme when i commit as well as watchlist populator to speed up setting up all cc's for a deploy
This commit is contained in:
48
src/utils/bookmarklets/rbcWatchlistPopulator.js
Normal file
48
src/utils/bookmarklets/rbcWatchlistPopulator.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
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();
|
||||
})();
|
||||
Reference in New Issue
Block a user