Grocer.nz Checkbox Ticker

Tick specific checkboxes on grocer.nz/stores after 2 seconds of page load

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Grocer.nz Checkbox Ticker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Tick specific checkboxes on grocer.nz/stores after 2 seconds of page load
// @author       chaoscreater
// @match        https://grocer.nz/stores
// @grant        none
// ==/UserScript==

// Function to find and tick the checkboxes based on their names
function tickCheckboxes(names) {
    names.forEach(function (name) {
        var checkbox = Array.from(document.querySelectorAll('span.name')).find(function (span) {
            return span.textContent.trim() === name;
        });
        if (checkbox) {
            checkbox.parentElement.querySelector('input[type="checkbox"]').checked = true;
        }
    });
}

// Function to run after 2 seconds of page load
function runAfterDelay() {
    // Names of checkboxes to tick
    var checkboxesToTick = [
        'Countdown Botany',
        'Countdown Greenlane',
        'Countdown Highland Park',
        'Countdown Howick',
        'Countdown Mt Eden',
        'Countdown Newmarket',
        'Countdown Pakuranga',
        'Countdown Ponsonby',
        'Countdown St Lukes',
        'Woolworths Grey Lynn',
        'Woolworths Mt Roskill',
        'Woolworths Pt Chevalier',
        'New World Botany',
        'New World Howick',
        'New World Mt Roskill',
        'New World Victoria Park',
        'PAK\'nSAVE Botany',
        'PAK\'nSAVE Mt Albert',
        'PAK\'nSAVE Sylvia Park',
        'The Warehouse'
    ];

    // Tick checkboxes after 2 seconds
    tickCheckboxes(checkboxesToTick);
}

// Delay execution by 2 seconds
setTimeout(runAfterDelay, 2000);