Last active
March 7, 2025 23:59
-
-
Save kdmsnr/08594ce619a4b46c6ac378293836854b to your computer and use it in GitHub Desktop.
Remove watched programs for TVer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove watched programs for TVer | |
// @namespace https://kdmsnr.com | |
// @version 0.1.3 | |
// @description Remove watched programs from the mypage of TVer | |
// @author kdmsnr | |
// @match https://tver.jp/mypage/fav | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// 監視を行うコールバック関数 | |
const observerCallback = (mutationsList, observer) => { | |
for(let mutation of mutationsList) { | |
if (mutation.type === 'childList') { | |
// 特定の要素が追加されたかをチェック | |
let elements = document.querySelectorAll("[class^='mypage-content-item_container']"); | |
if(elements.length > 0){ | |
// ここでスクリプトを実行 | |
let watchedElements = Array.from(elements).filter(element => { | |
let progressBar = element.querySelector("[class^='ProgressBar_progress']"); | |
return progressBar && progressBar.style.width === '100%'; | |
}); | |
watchedElements.forEach(e => {e.style.display = 'none'}); | |
// 必要に応じて監視を停止 | |
// observer.disconnect(); | |
} | |
} | |
} | |
}; | |
// MutationObserverのインスタンスを作成 | |
const observer = new MutationObserver(observerCallback); | |
// オブザーバーの設定 | |
const config = { childList: true, subtree: true }; | |
// 監視を開始 | |
observer.observe(document.body, config); | |
})(); |
使用させていただいているのですが、視聴済動画が消えません・・・
Tampermonkey 使用しています。ヘルプ頂けると助かります。
昨日、サイトの構造が変わったみたいですね。修正してみましたが、どうでしょうか。
早速のご対応ありがとうございます。
完璧です。本当に助かりました。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ご使用のブラウザにTampermonkeyの機能拡張をインストールしてから、右上の[Raw]をクリックするとインストールできる。