Advertisement
Guest User

Untitled

a guest
Jan 21st, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Grocer Checkbox Ticker
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  Tick specific checkboxes on grocer.nz/stores after 2 seconds of page load
  6. // @author       NovaAlpha
  7. // @match        https://grocer.nz/stores
  8. // @grant        none
  9. // ==/UserScript==
  10.  
  11. // Function to find and tick the checkboxes based on their names
  12. function tickCheckboxes(names) {
  13.     names.forEach(function (name) {
  14.         var checkbox = Array.from(document.querySelectorAll('span.name')).find(function (span) {
  15.             return span.textContent.trim() === name;
  16.         });
  17.         if (checkbox) {
  18.             checkbox.parentElement.querySelector('input[type="checkbox"]').checked = true;
  19.         }
  20.     });
  21. }
  22.  
  23. // Function to run after 2 seconds of page load
  24. function runAfterDelay() {
  25.     // Names of checkboxes to tick
  26.     var checkboxesToTick = [
  27.         'Countdown Botany',
  28.         'Countdown Greenlane',
  29.         'Countdown Highland Park',
  30.         'Countdown Howick',
  31.         'Countdown Mt Eden',
  32.         'Countdown Newmarket',
  33.         'Countdown Pakuranga',
  34.         'Countdown Ponsonby',
  35.         'Countdown St Lukes',
  36.         'Woolworths Grey Lynn',
  37.         'Woolworths Mt Roskill',
  38.         'Woolworths Pt Chevalier',
  39.         'New World Botany',
  40.         'New World Howick',
  41.         'New World Mt Roskill',
  42.         'New World Victoria Park',
  43.         'PAK\'nSAVE Botany',
  44.         'PAK\'nSAVE Mt Albert',
  45.         'PAK\'nSAVE Sylvia Park',
  46.         'The Warehouse'
  47.     ];
  48.  
  49.     // Tick checkboxes after 2 seconds
  50.     tickCheckboxes(checkboxesToTick);
  51. }
  52.  
  53. // Delay execution by 2 seconds
  54. setTimeout(runAfterDelay, 2000);
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement