Bandcamp: I'm Not A Fan

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

当前为 2022-01-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Bandcamp: I'm Not A Fan
  3. // @name:ru Bandcamp: Я не фанат
  4. // @description Removes playback limitation and dialog "The time has come to open thy heart/wallet"
  5. // @description:ru Снимает ограничение воспроизведений и убирает диалог "Пришло время открыть свое сердце/кошелек"
  6. // @namespace bc-inotafan.user.js
  7. // @version 1.0.2
  8. // @license MIT
  9. // @author askornot
  10. // @icon https://s4.bcbits.com/img/favicon/safari-pinned-tab.svg
  11. // @match https://*/*
  12. // @homepageURL https://greasyfork.org/ru/scripts/438039-bandcamp-i-m-not-a-fan
  13. // @supportURL https://greasyfork.org/ru/scripts/438039-bandcamp-i-m-not-a-fan/feedback
  14. // @grant unsafeWindow
  15. // @run-at document-end
  16. // @compatible chrome Violentmonkey 2.13.0
  17. // @compatible firefox Tampermonkey 4.13.6136
  18. // ==/UserScript==
  19.  
  20. 'use strict';
  21.  
  22. const W = unsafeWindow || window;
  23.  
  24. const player = W.Player;
  25. if (player === undefined) return;
  26.  
  27. const proxy = (target, index, fn) => {
  28. target = new Proxy(target, {
  29. apply(...args) {
  30. fn(args[index]);
  31. return Reflect.apply(...args);
  32. },
  33. });
  34. };
  35.  
  36. const target = 'copy';
  37. const proto = player.TrackInfo.prototype;
  38. const uncap = (o) => (o.is_capped = false);
  39.  
  40. proxy(proto[target], 1, uncap);
  41.  
  42. const tralbum = W.TralbumData;
  43. if (tralbum === undefined) return;
  44.  
  45. const value = Object.freeze({
  46. streaming_limits_enabled: false,
  47. streaming_limit: Infinity,
  48. });
  49.  
  50. Object.defineProperty(tralbum, 'play_cap_data', {
  51. configurable: false,
  52. enumerable: true,
  53. writable: false,
  54. value,
  55. });
  56.