Disable DRM

Disable DRM.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Disable DRM
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.2
// @license      AGPLv3
// @author       jcunews
// @description  Disable DRM.
// @match        *://site-with-fake-drm.nowhere/*
// @grant        unsafeWindow
// @run-at       document-start
// ==/UserScript==

/*
This script is intended for Firefox web browser, but can also be used in Chrome.
When DRM is disabled in Firefox web browser settings, the browser still prompts user to enable DRM when the site requested the DRM's media key.
Some sites don't actually need the media key. i.e. where their video/audio medias are not actually DRM protected.
So, these kind of sites request the media key only for the sake of tracking video views.
This script automatically rejects the media key request so that Firefox don't display the Enable-DRM prompt (which if enabled,
will send a network request to retrieve the media key from the server).
This script must be manually configured for such sites, otherwise it won't do anything.
*/

(window => {
  var rmksa = navigator.requestMediaKeySystemAccess;
  window.navigator.requestMediaKeySystemAccess = function() {
    var rf, pr = new Promise(function(resolve, reject) {
      setTimeout(() => reject(), 20)
    }), pc = pr.catch;
    p.catch = function(fn) {
      rf = fn;
      return pc.apply(this, arguments)
    };
    return pr
  };
})(unsafeWindow)