noodlemagazine

noodlemagazine miniscript

  1. // ==UserScript==
  2. // @name noodlemagazine
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.21
  5. // @description noodlemagazine miniscript
  6. // @author xxxxxxxxxxxxxxxxxxxxxx
  7. // @run-at document-start
  8. // @match *://*.noodlemagazine.com/*
  9. // @grant none
  10. // @noframes
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. const jwplayerhook = {
  15. apply: function(target, thisArg, args) {
  16. window.ads = [];
  17. let player = target(...args);
  18. player.setup_ = player.setup;
  19. player.setup = new Proxy(player.setup_, setuphook);
  20. try {
  21. let a = document.createElement('a');
  22. let r = window.location.href.match(/watch\/(.*)\/*/);
  23. let s = null;
  24. r && r.at(1) && (s = `https://vk.com/video${r[1]}`);
  25. let e = document.querySelector("body > div.main > div > div.video_info");
  26. e && s && (a.innerHTML = `<a href=${s}>${s}</a>`) && e.append(a);
  27. } catch(ex) {}
  28. return player;
  29. }
  30. };
  31.  
  32. const setuphook = {
  33. apply: function(target, thisArg, args) {
  34. console.log('Calling setup with arguments:', args);
  35. let argss = args[0];
  36. 'autoPause' in argss && delete argss.autoPause;
  37. 'advertising' in argss && delete argss.advertising;
  38. return target(argss);
  39. }
  40. };
  41.  
  42. Object.defineProperty(window, 'onpopstate', {
  43. get() {
  44. return window._onpopstate;
  45. },
  46. set(v) {
  47. window.jwplayer_ = window.jwplayer;
  48. window.jwplayer = new Proxy(window.jwplayer_, jwplayerhook);
  49. console.log(window.jwplayer);
  50. //debugger;
  51. window._onpopstate = v;
  52. }
  53. });