[實驗script] 顯示回覆用戶ID

12 回覆
9 Like 2 Dislike
2019-06-30 01:32:21
2019-06-30 01:33:36
a.jj_3ZDzjtPixL1b2KTcpS
2019-06-30 01:46:23
咁佢 obfuscate 咗嘅 class name 係咁,我控制唔到喎

2019-06-30 05:13:21
lm
2019-06-30 13:00:51
2019-06-30 13:05:15
2019-06-30 14:42:13
其實冇乜用,應該好似 RES 咁加 tagging 仲有用
2019-07-01 00:43:36
唔一定要用class name
用react redux
// ==UserScript==
// @name         lihkg-com-custom-1
// @namespace    http://example.com/
// @version      0.1
// @description  something
// @author       me
// @match        https://lihkg.com/*
// @grant        none
// ==/UserScript==

(function() {
    let bindListenr = () => {
        let getThread = (state) => {
            if (state.thread !== undefined && state.thread.thread !== undefined) {
                return state.thread.thread;
            }
            return undefined;
        }
        let store = document.getElementById('app')._reactRootContainer._internalRoot.current.memoizedState.element.props.store;
        let lastThread = undefined;
        let dispatched = false;
        let patchReply = (reply, nextFunc) => {
            if (reply.quote !== undefined) {
                return {
                    ...reply,
                    user_nickname: reply.user_nickname + `(#${reply.user.user_id})`,
                    quote: nextFunc(reply.quote, nextFunc)
                }
            } else {
                return {
                    ...reply,
                    user_nickname: reply.user_nickname + `(#${reply.user.user_id})`,
                }
            }
        }
        let handleChange = () => {
            let newState = store.getState();
            let newThread = getThread(newState);
            if (dispatched) {
                dispatched = false;
                return;
            }
            if (lastThread != newThread) {
                lastThread = newThread;
                if (newThread === undefined || newThread.patched == true) {
                    return
                }
                store.dispatch({
                    type: "SET_THREAD",
                    payload: {
                        append: false,
                        thread: {
                            ...newState.thread.thread,
                            item_data: newState.thread.thread.item_data.map(
                                item => patchReply(item, patchReply)
                            ),
                            pages: Object.fromEntries(
                                Object.entries(newState.thread.thread.pages).map(
                                    ([key, value]) => {
                                        return [key, value.map(
                                            item => patchReply(item, patchReply)
                                        )];
                                    }
                                )
                            ),
                            patched: true
                        }
                    }
                });
            }
        }
        handleChange();
        store.subscribe(handleChange);
    }
    window.addEventListener('load', () => {
        setTimeout(bindListenr, 3000);
    })
})();
2019-07-01 22:52:05
連仔多左個P牌tag
2019-07-01 23:36:04

2019-07-01 23:38:50
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞