YouTube Shorts URL 轉換按鈕

將 YouTube Shorts 網址轉換為常規的 YouTube 影片網址。

< 腳本YouTube Shorts URL 轉換按鈕的回應

提問/評論

§
發表於:2025-02-24

Coding改善建議

    const observer = new MutationObserver(function(mutationsList) {
        for (const mutation of mutationsList) {
            if (mutation.type === 'childList') {
                checkAndCreateButton();
            }
        }
    });

改成

    const observer = new MutationObserver(function(mutationsList) {
        for (const mutation of mutationsList) {
            if (mutation.type === 'childList') {
                checkAndCreateButton();
                break;
            }
        }
    });
§
發表於:2025-02-24

最後的

observer.observe(document.documentElement, { childList: true, subtree: true });

改成

observer.observe(document.documentElement, { childList: true, subtree: true });
checkAndCreateButton();
§
發表於:2025-02-24

createButtons生成了兩個,為什麼remove的部份只清除ConvertButton??

§
發表於:2025-02-24
            convertButton.addEventListener('click', convertURL);
            convertButton.addEventListener('auxclick', function(event) {
                convertURL(event);
            });

改成

            convertButton.addEventListener('click', convertURL);
            convertButton.addEventListener('auxclick', convertURL);
§
發表於:2025-02-24
const lang = navigator.language;

改成

const lang = document.documentElement.lang || navigator.language;

            if (data.match.includes(lang)) {

改成

            if (data.match.startsWith(lang)) {
鮪魚大師作者
§
發表於:2025-02-26

感謝大佬指點 有人留言都沒有email通知

發表回覆

登入以回復

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址