Amenitiz - Hide useless currencies and languages

Hides useless currencies and languages on Amenetiz booking edition

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Amenitiz - Hide useless currencies and languages
// @namespace    http://amenitiz.io
// @version      1.0
// @description  Hides useless currencies and languages on Amenetiz booking edition
// @author       Laurent Chervet
// @license      MIT
// @match        https://*.amenitiz.io/fr/admin/calendar
// @match        https://*.amenitiz.io/fr/admin/clients/show*
// @match        https://*.amenitiz.io/admin/invoice/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=microsoft.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log('ℹ️ Init Amenitiz - Hide useless currencies and languages')

    let scripty_langAndMoney_allowed_currencies = [
        'Swiss Franc'
    ]

    let scripty_langAndMoney_allowed_languages = [
        'allemand',
        'anglais',
        'français',
        'italien'
    ]

    // DANGER ZONE BELOW, CHANGE AT YOUR OWN RISK
    document.body.addEventListener('click', function() {
        let langCounter = 0
        let currenciesCounter = 0
        try {
            for (const option of document.querySelectorAll('#client_account_currency > option')) {
                if (!scripty_langAndMoney_allowed_currencies.includes(option.text) && !option.disabled) {
                    option.parentElement.removeChild(option)
                    currenciesCounter++
                }
            }
            for (const option of document.querySelectorAll('#client_account_language > option')) {
                if (!scripty_langAndMoney_allowed_languages.includes(option.text) && !option.disabled) {
                    option.parentElement.removeChild(option)
                    langCounter++
                }
            }
            if (langCounter > 0 || currenciesCounter > 0) {
                console.log(`✅ Removed ${langCounter} languages and ${currenciesCounter} useless currencies`)
            }
        } catch (e) {}
    })
})();