「Userscript」:修訂間差異
跳至導覽
跳至搜尋
(未顯示同一使用者於中間所作的 1 次修訂) | |||
第36行: | 第36行: | ||
* https://greasyfork.org/en/scripts/15261-facebook-sort-recent-newsfeed-by-default | * https://greasyfork.org/en/scripts/15261-facebook-sort-recent-newsfeed-by-default | ||
* https://greasyfork.org/en/scripts/23661-youtube-hd | * https://greasyfork.org/en/scripts/23661-youtube-hd | ||
* https://greasyfork.org/en/scripts/38090-add-youtube-video-progress | |||
* https://greasyfork.org/en/scripts/383093-twitch-disable-automatic-video-downscale | * https://greasyfork.org/en/scripts/383093-twitch-disable-automatic-video-downscale | ||
* https://greasyfork.org/en/scripts/396936-yt-not-interested-in-one-click | * https://greasyfork.org/en/scripts/396936-yt-not-interested-in-one-click | ||
* https://greasyfork.org/en/scripts/403045-dmhy-bangumi-current-season | * https://greasyfork.org/en/scripts/403045-dmhy-bangumi-current-season | ||
第49行: | 第49行: | ||
* https://en.wikipedia.org/wiki/Userscript | * https://en.wikipedia.org/wiki/Userscript | ||
* https://greasyfork.org/en/users/13655-gslin | |||
=== Hosting === | === Hosting === |
於 2024年9月14日 (六) 14:41 的最新修訂
Userscript是一個讓開發者更容易操作(與修改)網頁的方式,通常是以JavaScript撰寫。
軟體
目前推薦使用開源的Violentmonkey,支援Chromium系列瀏覽器,以及Firefox瀏覽器。
範例
SPA
對於SPA類常用的方式,聽HTML元素的事件(這邊是聽document
元素,可以自己考慮聽更小的範圍):
const ob = new window.MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (...) {
// Uninstall
ob.disconnect();
}
});
});
});
ob.observe(document, {
childList: true,
subtree: true,
});
自用
重新安裝時用的,自己寫的就不列出來了:
- https://greasyfork.org/en/scripts/12493-hacker-news-folding-subtrees
- https://greasyfork.org/en/scripts/15261-facebook-sort-recent-newsfeed-by-default
- https://greasyfork.org/en/scripts/23661-youtube-hd
- https://greasyfork.org/en/scripts/38090-add-youtube-video-progress
- https://greasyfork.org/en/scripts/383093-twitch-disable-automatic-video-downscale
- https://greasyfork.org/en/scripts/396936-yt-not-interested-in-one-click
- https://greasyfork.org/en/scripts/403045-dmhy-bangumi-current-season
- https://greasyfork.org/en/scripts/431970-facebook-ad-block
另外的一些: