哎呦不错哦(学会看简介 不支持黑号)

好东西哦(⊙﹏⊙)

< Feedback on 哎呦不错哦(学会看简介 不支持黑号)

Review: Good - script works

目前版本出現以下Error,請修正

原因是以下Coding導致不可用


    let user_data_api = get_user_data_api();

    let user_data = user_data_api.get();



    function get_user_data_api() {
        return {
            get() {
                const default_user_data = {
                    "open_recommend_shorts": 'off',
                    "open_recommend_movie": 'off',
                    "open_recommend_popular": 'off',
                    "open_recommend_liveroom": 'off',
                    "open_recommend_playables": "off",
                    "language": 'zh-CN',
                    "channel_infos": {
                        "ids": [],
                        "names": []
                    },
                    "shorts_list": [],
                    "login": false,
                    "shorts_parase_delay": 2000
                };
                let diff = false;
                let tmp_user_data = GM_getValue(channel_id);
                if (!tmp_user_data) {
                    tmp_user_data = default_user_data;
                    diff = true;
                }
                for (let key in default_user_data) {
                    if (!(key in tmp_user_data)) {
                        diff = true;
                        tmp_user_data[key] = default_user_data[key];
                    }
                }
                let tmp_login = channel_id !== 'default';
                if (tmp_user_data.login !== tmp_login) {
                    diff = true;
                    tmp_user_data.login = tmp_login;
                }
                (diff || this.update(tmp_user_data)) && GM_setValue(channel_id, tmp_user_data);
                return tmp_user_data;
            },
            set() {
                return GM_setValue(channel_id, user_data);
            },
            update(tmp_user_data) {
                let diff = false;
                last_version = GM_getValue('last_version', -1);
                if (last_version === -1) {
                    tmp_user_data.open_recommend_shorts = GM_getValue("open_recommend_shorts", "off");
                    tmp_user_data.open_recommend_movie = GM_getValue("open_recommend_movie", "off");
                    tmp_user_data.open_recommend_popular = GM_getValue("open_recommend_popular", "off");
                    tmp_user_data.open_recommend_liveroom = GM_getValue("open_recommend_liveroom", "off");
                    diff = true;
                }
                if (typeof (tmp_user_data.open_recommend_shorts) === 'boolean') {
                    tmp_user_data.open_recommend_shorts = user_data.open_recommend_shorts ? 'on' : 'off';
                    tmp_user_data.open_recommend_movie = user_data.open_recommend_movie ? 'on' : 'off';
                    tmp_user_data.open_recommend_popular = user_data.open_recommend_popular ? 'on' : 'off';
                    tmp_user_data.open_recommend_liveroom = user_data.open_recommend_liveroom ? 'on' : 'off';
                    diff = true;
                }
                last_version !== GM_info.script.version && GM_setValue("last_version", GM_info.script.version);
                return diff;
            }
        };
    }

執行 user_data = user_data_api.get();的時候,user_data還沒有設置就被引用 ( tmp_user_data.open_recommend_shorts = user_data.open_recommend_shorts ? 'on' : 'off';

1.4.2已修正了,感謝

随便啦...Author
§
Posted: 2024-05-02

ok,確實是我疏忽了,抱歉抱歉

Post reply

Sign in to post a reply.