Advertisement
Fapka

SUSH

May 2nd, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        SUSH (Stream Hider)
  3. // @author      fapka
  4. // @namespace   fapkamaster@gmail.com
  5. // @description Ukrywa wybrane transmisje z listy ogólnej, według listy w skrypcie.
  6. // @include     https://showup.tv/
  7. // @include     https://showup.tv/?pc=HISGQ73N50D70
  8. // @version     1.9.69
  9. // @run-at      document-end
  10. // @grant       none
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. var ref_int = 3; //Częstotliwość odświeżania statystyk (raz na 3 odświeżenia listy transmisji).
  15. var _users = ['BlowJobQueen', 'PIEPRZYCmiSIEchce', 'Nowozency', 'RichGirlAnn',
  16.               'mojezycie', 'esperansa21', 'bosestopyblondynki',
  17.               'wspolnezabawy327', 'DEMoni', 'lubi_czarnulki', 'FuckYouBitch', 'tinia', 'maredytka', 'ladypassion832', 'niunia232',
  18. ];
  19.  
  20. var trans_counter = $('body > div.container.page__home > div.row.pageheader > div.large-6.columns.large-text-right > h4');
  21. var matches = trans_counter.text().match(/(\d[\d\.]*)/g);
  22. var number1 = Number(matches[0]);
  23. var number2 = Number(matches[1]);
  24. var con_stats = [number1, number2], allow_ref = 0;
  25.  
  26. console.info && console.info('%c «%s» %c—— %c %s && to ignore: '+_users.length,
  27.         'background:#000000; color:#7ebe45', GM_info.script.name,
  28.         'background:#000000; color:dimgray',
  29.         'background:#3c424d; color:#ffffff', GM_info.script.version);
  30.  
  31. heartbeat();
  32.  
  33. function refreshStats(){
  34.     allow_ref++;
  35.     if ( allow_ref % ref_int == 0 )
  36.     {
  37.         $.ajax({
  38.             type : "get",
  39.             url : "https://showup.tv/site/trans_list/get_stats?pc=HISGQ73N50D70",
  40.             dataType : "json",
  41.             success : function(data) {
  42.                 //console.log(data)
  43.                 //let con1 = JSON.parse(data); //Zrób obiekt zamiast JSONa: connections: "6977" transmissions: 127
  44.                 var cont2 = Object.values(data); //Zrób Arraya zamiast obiektu: ["6977", 127]
  45.                 con_stats[1] = parseInt(cont2[0]);
  46.                 con_stats[0] = cont2[1];
  47.             },
  48.             //error:function(e){ console.error(e); }
  49.         });
  50.     }
  51. }
  52.  
  53. function heartbeat() {
  54.     //Kod ze starego SU:
  55.     //var $streams = $('#transList .stream a.stream-overlay[href]'),
  56.     var $streams = $('#streamList > li > a'),
  57.         hiddens = [];
  58.  
  59.     $streams.each(function(i, e) {
  60.         var url = e.getAttribute('href'),
  61.             p = url.lastIndexOf('/'),
  62.             streamer = (p >= 0) && url.substr(p + 1);
  63.  
  64.         if ( streamer && _users.indexOf(streamer) >= 0 ) {
  65.             $(e).closest('.stream').remove();
  66.             hiddens.push(streamer);
  67.         }
  68.     });
  69.  
  70.     if ( !$streams.length || hiddens.length > 0 ) {
  71.         var text = '[SH] ' + $streams.length + ' streams';
  72.         if ( hiddens.length > 0 )
  73.         {
  74.             refreshStats();
  75.             var newtext = con_stats[0]+" transmisji i "+con_stats[1]+" oglądających, w tym "+hiddens.length+" ukrytych (z "+$streams.length+")";
  76.             trans_counter.text(newtext);
  77.  
  78.             text += ' / ' + hiddens.length+ ' hidden (' +
  79.                 hiddens.sort((a, b) => a.localeCompare(b)).join(', ') + ')';
  80.             //console.log(text);
  81.         }
  82.     }
  83.  
  84.     $('img.lazy').trigger('appear');
  85. }
  86.  
  87. (function(open) {
  88.     XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  89.         this.addEventListener('readystatechange', function(event) {
  90.             if ( this.readyState === 4 &&
  91.                     (this.responseURL === 'https://showup.tv/site/trans_list/get_list/bottom' ||
  92.                     this.responseURL === 'https://showup.tv/site/trans_list/get_list/big') )
  93.                 setTimeout(heartbeat, 0);
  94.         }, false);
  95.         return open.apply(this, arguments);
  96.     };
  97. })(XMLHttpRequest.prototype.open);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement