Foodora - Highlight items (EN|FI|+)

Highlight items on Foodora (fantasy / fantasia highlighted by default) (EN|FI|+)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Foodora - Highlight items (EN|FI|+)
// @namespace    1N07
// @version      0.4.2
// @description  Highlight items on Foodora (fantasy / fantasia highlighted by default) (EN|FI|+)
// @author       1N07
// @license      unlicense
// @match        https://www.foodora.fi/*restaurant/*
// @match        https://www.foodora.se/*restaurant/*
// @match        https://www.foodora.no/*restaurant/*
// @match        https://www.foodora.hu/*restaurant/*
// @match        https://www.foodora.cz/*restaurant/*
// @match        https://www.foodora.at/*restaurant/*
// @icon         https://www.google.com/s2/favicons?domain=foodora.fi
// @compatible   firefox Only tested on Firefox with Tampermonkey, but should probably work on pretty much all browsers and script managers
// @compatible   chrome Only tested on Firefox with Tampermonkey, but should probably work on pretty much all browsers and script managers
// @compatible   opera Only tested on Firefox with Tampermonkey, but should probably work on pretty much all browsers and script managers
// @compatible   edge Only tested on Firefox with Tampermonkey, but should probably work on pretty much all browsers and script managers
// @compatible   safari Only tested on Firefox with Tampermonkey, but should probably work on pretty much all browsers and script managers
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //Note, names are not case sensitive
    var names = [
        "my choice",
        "your choice",
        "fantasy",
        "oma valinta",
        "kuten haluatte",
        "fantasia"
    ];

    setInterval(CheckForOmaValinta, 200);

    function CheckForOmaValinta() {
        let found = document.querySelectorAll("[data-testid='menu-product-name']:not(.highlight-checked)");
        for(let i = 0; i < found.length; i++)
        {
            found[i].classList.add("highlight-checked");
            for(let j = 0; j < names.length; j++)
            {
                if(found[i].innerHTML.toLowerCase().includes(names[j].toLowerCase()))
                {
                    let target = found[i];
                    while(!target.classList.contains('product-tile'))
                        target = target.parentNode;
                    target = target.getElementsByClassName("product-tile__animation-overlay")[0];
                    target.style.backgroundColor = "rgba(112, 255, 60, 0.33)";
                    j = names.length; //break inner loop
                }
            }
        }
    }
})();