{"id":32,"date":"2024-11-04T16:08:19","date_gmt":"2024-11-04T08:08:19","guid":{"rendered":"https:\/\/www.sodalee.cn\/?p=32"},"modified":"2024-11-04T16:08:19","modified_gmt":"2024-11-04T08:08:19","slug":"bilibili%e8%b7%b3%e8%bf%87%e7%89%87%e5%a4%b4%e7%89%87%e5%b0%be","status":"publish","type":"post","link":"https:\/\/sodalee.top\/?p=32","title":{"rendered":"Bilibili\u8df3\u8fc7\u7247\u5934\u7247\u5c3e"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">\u56e0\u4e3a\u6709\u770b\u5207\u7247\u5267\u7684\u9700\u6c42\uff0c\u6240\u4ee5\u7528chatgpt\u6539\u4e86\u522b\u4eba\u7684\u4ee3\u7801\uff0c\u6dfb\u52a0\u4e86\u51e0\u4e2a\u6309\u94ae\u5c31\u4e0d\u4f1a\u7ed1\u5b9a\u5947\u602a\u7684\u952e\u76d8\u6309\u952e\u8fd8\u5fd8\u4e86\u529f\u80fd\u662f\u5565\u4e86\u3002\u4e0d\u8fc7\u76ee\u524d\u6ca1\u6709\u505a\u672c\u5730\u7684\u8df3\u8fc7\u65f6\u957f\u5b58\u50a8\uff0c\u5e94\u8be5\u4e5f\u4e0d\u9700\u8981\u5427\uff08\u5927\u6982<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>\/\/ ==UserScript==\n\/\/ @name         BiliBili\u8df3\u8fc7\u7247\u5934\u7247\u5c3e\n\/\/ @namespace    http:\/\/tampermonkey.net\/\n\/\/ @version      2024-11-04\n\/\/ @description  \u6dfb\u52a0\u63a7\u5236\u6309\u94ae\u7528\u4e8e\u8df3\u8fc7\u7247\u5934\u7247\u5c3e\u8bbe\u7f6e\n\/\/ @match        *:\/\/www.bilibili.com\/*\n\/\/ @icon         data:image\/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDEuMDY1IiBoZWlnaHQ9IjEyNy43NDciIHZpZ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40MTcuOTQxLjg4NCAxLjM2IDEuMjIzLjM5Mi4zMTYuODYzLjY3IDEuMjM1Ljk1MiAxLjkwNyAxLjQ0My0uMjI2IDQuMDUzLTIuMTMgMi42MDcgMCAwLTItMS41MzUtMi44MDctMi4zMDEtLjQ0LS40MTctLjY4LS45NTYtLjcyLTEuNTkyLS4wNC0uNjU0LjUzNS0xLjI0Ljc5NC0xLjQ5OC45Mi0uOTE0IDEuNzQzLTEuOTY4IDIuNTUtMi44MTIgMS41NzUtMS44IDQuMTIuNDI4IDIuNTQ2IDIuMjI3eiIgc3R5bGU9ImZpbGw6IzIwYjBlMztmaWxsLW9wYWNpdHk6MTtzdHJva2Utd2lkdGg6LjUyNDE1OTtzdHJva2UtZGFzaGFycmF5Om5vbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC03OS4xOTMgLTExMi4wOCkiLz48L3N2Zz4NCg==\n\/\/ @grant        none\n\/\/ ==\/UserScript==\n\nlet skip_IntroLength = 0;\nlet skip_OutroLength = 0;\n\n(function() {\n    'use strict';\n\n    \/\/ \u521b\u5efa\u6309\u94ae\u5bb9\u5668\n    const buttonContainer = document.createElement(\"div\");\n    buttonContainer.style.position = \"fixed\";\n    buttonContainer.style.bottom = \"20px\";\n    buttonContainer.style.right = \"20px\";\n    buttonContainer.style.display = \"flex\";\n    buttonContainer.style.flexDirection = \"column\";\n    buttonContainer.style.gap = \"10px\";\n    buttonContainer.style.zIndex = \"9999\";\n    document.body.appendChild(buttonContainer);\n\n    \/\/ \u521b\u5efa\u624b\u52a8\u8bbe\u7f6e\u6309\u94ae\n    const manualButton = document.createElement(\"button\");\n    manualButton.textContent = \"\u624b\u52a8\u8bbe\u7f6e\u65f6\u957f\";\n    manualButton.style.padding = \"10px\";\n    manualButton.style.backgroundColor = \"#6DD3CE\";\n    manualButton.style.color = \"#fff\";\n    manualButton.style.border = \"none\";\n    manualButton.style.borderRadius = \"5px\";\n    manualButton.style.cursor = \"pointer\";\n    buttonContainer.appendChild(manualButton);\n\n    \/\/ \u521b\u5efa\u8bbe\u5b9a\u7247\u5934\u6309\u94ae\n    const setIntroButton = document.createElement(\"button\");\n    setIntroButton.textContent = \"\u8bbe\u4e3a\u7247\u5934\u65f6\u95f4\";\n    setIntroButton.style.padding = \"10px\";\n    setIntroButton.style.backgroundColor = \"#C8E9A0\";\n    setIntroButton.style.color = \"#fff\";\n    setIntroButton.style.border = \"none\";\n    setIntroButton.style.borderRadius = \"5px\";\n    setIntroButton.style.cursor = \"pointer\";\n    buttonContainer.appendChild(setIntroButton);\n\n    \/\/ \u521b\u5efa\u8bbe\u5b9a\u7247\u5c3e\u6309\u94ae\n    const setOutroButton = document.createElement(\"button\");\n    setOutroButton.textContent = \"\u8bbe\u4e3a\u7247\u5c3e\u65f6\u95f4\";\n    setOutroButton.style.padding = \"10px\";\n    setOutroButton.style.backgroundColor = \"#F7A278\";\n    setOutroButton.style.color = \"#fff\";\n    setOutroButton.style.border = \"none\";\n    setOutroButton.style.borderRadius = \"5px\";\n    setOutroButton.style.cursor = \"pointer\";\n    buttonContainer.appendChild(setOutroButton);\n\n    \/\/ \u624b\u52a8\u8bbe\u7f6e\u8df3\u8fc7\u65f6\u957f\n    manualButton.addEventListener(\"click\", () => {\n        const newIntroLength = prompt(\"\u8bf7\u8f93\u5165\u7247\u5934\u8df3\u8fc7\u65f6\u95f4\uff08\u79d2\uff09:\", skip_IntroLength);\n        const newOutroLength = prompt(\"\u8bf7\u8f93\u5165\u7247\u5c3e\u8df3\u8fc7\u65f6\u95f4\uff08\u79d2\uff09:\", skip_OutroLength);\n\n        if (!isNaN(parseFloat(newIntroLength))) {\n            skip_IntroLength = parseFloat(newIntroLength);\n        }\n        if (!isNaN(parseFloat(newOutroLength))) {\n            skip_OutroLength = parseFloat(newOutroLength);\n        }\n    });\n\n    \/\/ \u8bbe\u7f6e\u5f53\u524d\u64ad\u653e\u65f6\u95f4\u4e3a\u7247\u5934\u65f6\u957f\n    setIntroButton.addEventListener(\"click\", () => {\n        const video = document.querySelector(\"#bilibili-player video\");\n        if (video) {\n            skip_IntroLength = video.currentTime;\n            alert(`\u7247\u5934\u65f6\u957f\u5df2\u8bbe\u7f6e\u4e3a\uff1a${skip_IntroLength.toFixed(2)} \u79d2`);\n        } else {\n            alert(\"\u672a\u627e\u5230\u89c6\u9891\u5143\u7d20\uff01\");\n        }\n    });\n\n    \/\/ \u8bbe\u7f6e\u5f53\u524d\u64ad\u653e\u65f6\u95f4\u4e3a\u7247\u5c3e\u65f6\u957f\n    setOutroButton.addEventListener(\"click\", () => {\n        const video = document.querySelector(\"#bilibili-player video\");\n        if (video) {\n            skip_OutroLength = video.duration - video.currentTime;\n            alert(`\u7247\u5c3e\u65f6\u957f\u5df2\u8bbe\u7f6e\u4e3a\uff1a${skip_OutroLength.toFixed(2)} \u79d2`);\n        } else {\n            alert(\"\u672a\u627e\u5230\u89c6\u9891\u5143\u7d20\uff01\");\n        }\n    });\n\n    \/\/ \u5b9a\u65f6\u8df3\u8fc7\u7247\u5934\u548c\u7247\u5c3e\n    setInterval(() => {\n        const video = document.querySelector(\"#bilibili-player video\");\n        if (video &amp;&amp; !isNaN(video.duration)) {\n            const currentTime = video.currentTime;\n            if (currentTime &lt; skip_IntroLength) {\n                video.currentTime = skip_IntroLength;\n            } else if (currentTime > (video.duration - skip_OutroLength) &amp;&amp; currentTime &lt; (video.duration - 2)) {\n                video.currentTime = video.duration;\n            }\n        }\n    }, 2000);\n})();<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u56e0\u4e3a\u6709\u770b\u5207\u7247\u5267\u7684\u9700\u6c42\uff0c\u6240\u4ee5\u7528chatgpt\u6539\u4e86\u522b\u4eba\u7684\u4ee3\u7801\uff0c\u6dfb\u52a0\u4e86\u51e0\u4e2a\u6309\u94ae\u5c31\u4e0d\u4f1a\u7ed1\u5b9a\u5947\u602a\u7684\u952e\u76d8\u6309\u952e\u8fd8\u5fd8\u4e86\u529f\u80fd\u662f\u5565\u4e86\u3002\u4e0d\u8fc7\u76ee\u524d\u6ca1\u6709\u505a\u672c &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-2"],"_links":{"self":[{"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sodalee.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":3,"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":35,"href":"https:\/\/sodalee.top\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions\/35"}],"wp:attachment":[{"href":"https:\/\/sodalee.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sodalee.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sodalee.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}