GBF_OPACITY

gbf opacity

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GBF_OPACITY
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  gbf opacity
// @author       Moo_asdsasd5
// @match        *://game.granbluefantasy.jp/
// @grant        GM_addStyle
// @grant        GM_registerMenuCommand
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_addValueChangeListener
// @license MIT
// ==/UserScript==
 
(function() {
    'use strict';
    const opacity = GM_getValue('gbf_opacity')
    if (!opacity) {
        GM_setValue('gbf_opacity', 0.5)
    } else {
        GM_addStyle(
        `
           body, #ready { opacity: ${opacity};}
        `)
    }
    const setOpacity = (num) => {
        return () => {
           GM_setValue('gbf_opacity', num)
        }
    }
    GM_registerMenuCommand('OPACITY_0', setOpacity(0.0));
    GM_registerMenuCommand('OPACITY_0.1', setOpacity(0.1));
    GM_registerMenuCommand('OPACITY_0.2', setOpacity(0.2));
    GM_registerMenuCommand('OPACITY_0.5', setOpacity(0.5));
    GM_registerMenuCommand('OPACITY_1', setOpacity(1));
 
    GM_addValueChangeListener('gbf_opacity', (name, ov, nv) => {
        GM_addStyle(
        `
           body, #ready { opacity: ${nv};}
        `)
    })
    // Your code here...
})();