AdguardTeam / AdguardTeam/Scriptlets

Add new scriptlet — 'disable-pageview-api'

オープン
#508 コメント 0 件 リアクション 0 件 担当者 1 名 @maximtop が担当を希望しています GitHub で見る
Feature request Priority: P4
主要言語
JavaScript
スター
195
フォーク
33
PR マージ指標
30日以内にマージされた PR はありません

説明

YouTube uses pageview api to show popup "Video paused. Continue watching?" when user is not interacting with the page.

/// disable-pageview-api.js
(function(){
// based on https://addons.mozilla.org/en-US/firefox/addon/disable-page-visibility/
// visibilitychange events are captured and stopped
document.addEventListener("visibilitychange", function(e) {
e.stopImmediatePropagation();
}, true);
// document.visibilityState always returns false
Object.defineProperty(Document.prototype, "hidden", {
get: function hidden() {
return false;
},
enumerable: true,
configurable: true
});
// document.visibilityState always returns "visible"
Object.defineProperty(Document.prototype, "visibilityState", {
get: function visibilityState() {
return "visible";
},
enumerable: true,
configurable: true
});
})()

Discussion on reddit regarding it:
https://www.reddit.com/r/firefox/comments/f0ewaq/any_way_to_disable_pageview_api_via_unlock_origin/

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。