AdguardTeam / AdguardTeam/Scriptlets

Add new scriptlet — 'disable-pageview-api'

Đang mở
#508 0 bình luận 0 reaction 1 người được giao Được @maximtop nhận Xem trên GitHub
Feature request Priority: P4
Ngôn ngữ chính
JavaScript
Star
195
Fork
33
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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/

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.