Bandcamp: I'm Not A Fan

Removes playback limitation and dialog "The time has come to open thy heart/wallet"

目前為 2022-05-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name                  Bandcamp: I'm Not A Fan
// @name:ru               Bandcamp: Я не фанат
// @description           Removes playback limitation and dialog "The time has come to open thy heart/wallet"
// @description:ru        Снимает ограничение воспроизведений и убирает диалог "Пришло время открыть свое сердце/кошелек"
// @namespace             bc-inotafan.user.js
// @version               1.0.3
// @license               MIT
// @author                askornot
// @icon                  https://s4.bcbits.com/img/favicon/safari-pinned-tab.svg
// @match                 https://*.bandcamp.com/*
// @homepageURL           https://greasyfork.org/ru/scripts/438039-bandcamp-i-m-not-a-fan
// @supportURL            https://greasyfork.org/ru/scripts/438039-bandcamp-i-m-not-a-fan/feedback
// @grant                 unsafeWindow
// @run-at                document-end
// @compatible            chrome  Violentmonkey 2.13.0
// @compatible            firefox Tampermonkey 4.13.6136
// ==/UserScript==

((self) => {
  'use strict';

  const { Player, TralbumData } = self;
  if (Player === void 0 || TralbumData === void 0) return;

  const target = 'copy';
  const proto = Player.TrackInfo.prototype;
  const uncap = (o) => (o.is_capped = false);

  const descriptor = Object.getOwnPropertyDescriptor(proto, target);

  Object.defineProperty(proto, target, {
    ...descriptor,
    value: function () {
      uncap(this);
      return descriptor.value.apply(this, arguments);
    },
  });

  Object.defineProperty(TralbumData, 'play_cap_data', {
    configurable: false,
    enumerable: true,
    writable: false,
    value: Object.freeze({
      streaming_limits_enabled: false,
      streaming_limit: Infinity,
    }),
  });
})(unsafeWindow || window);