Advertisement
Guest User

wiixzer

a guest
Mar 26th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // WIIXZER TWITCH NOTIFICATION V4
  2.  
  3. $(document).ready(function() {
  4.  
  5.     // Menu
  6.     var title = "fortera-global";
  7.     var isGame = "Tibia";
  8.     var findChannels = "nattank,eliastibianodoido,ddd_pinda,rubini,Abak,Drufoox,gonyxazt,hashtagtitio,xoxim,jardineiroxd,metyzera,kathyzinha,mah_sz,tatoowtv";
  9.  
  10.  
  11.     function setCookie(cname, cvalue, exdays) {
  12.         var d = new Date();
  13.         d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  14.         var expires = "expires=" + d.toUTCString();
  15.         document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"
  16.     }
  17.  
  18.     function getCookie(cname) {
  19.         var name = cname + "=";
  20.         var ca = document.cookie.split(';');
  21.         for (var i = 0; i < ca.length; i++) {
  22.             var c = ca[i];
  23.             while (c.charAt(0) == ' ') {
  24.                 c = c.substring(1)
  25.             }
  26.             if (c.indexOf(name) == 0) {
  27.                 return c.substring(name.length, c.length)
  28.             }
  29.         }
  30.         return ""
  31.     }
  32.     var a = [];
  33.     var c = [];
  34.     var l;
  35.     var t = c.length;
  36.     var state = 1;
  37.  
  38.     function expand() {
  39.         $(".live_popup").animate({
  40.             bottom: 0
  41.         }, 500);
  42.         $("#live_btn").html('<img src="/layouts/tibiacom/arrow_bot.png" alt="Hide streams">');
  43.         state = 1
  44.     }
  45.  
  46.     function hide() {
  47.         $(".live_popup").animate({
  48.             bottom: -100
  49.         }, 500);
  50.         $("#live_btn").html('<img src="/layouts/tibiacom/arrow_top.png" alt="Show streams">');
  51.         state = 0
  52.     }
  53.  
  54.     function show() {
  55.         if(a["length"] == 0) return false;
  56.        
  57.             var t = a[0]["streams"].length;
  58.             var check = false;
  59.  
  60.             for (l = 0; l < t; l++) {
  61.                 var status = a[0]["streams"][l]["channel"]["status"];
  62.                 if(a[0]["streams"][l]["channel"]["game"] == isGame && status.indexOf(title) != -1){                    
  63.                     var check = true;
  64.                 }                        
  65.             }
  66.             if(!check) return;
  67.  
  68.  
  69.         // $("body").append('<div class="live_popup"><div id="live_btn"><i class="fa fa-chevron-left" aria-hidden="true"></i></div><div id="live_popup_ch"></div></div>');
  70.         $("body").append('<div class="live_popup"><button id="live_btn"><img src="/layouts/tibiacom/arrow_bot.png" alt="Hide streams"></button><div id="live_popup_ch"></div></div>');
  71.  
  72.  
  73.         var total = a[0]["_total"];
  74.         var i;
  75.         for (i = 0; i < total; i++) {
  76.             var c = a[0]["streams"][i]["channel"];
  77.             var p = a[0]["streams"][i]["preview"];
  78.             var status = c.status;
  79.             if(status.indexOf(title) == -1) continue;
  80.             if (c.game != isGame) continue;
  81.             if (!c || !p) continue;
  82.             $("#live_popup_ch").append('<div class="item-wiix"><a href="' + c.url + '" target="_blank" title="' + c.display_name + '"><div class="each-stream"><div class="live"><img src="' + p.medium + '" height="54" width="108"  alt="' + c.display_name + '"></div><div class="title"><span>' + c.display_name + '</span></div></div></a></div>');
  83.             // $("#live_popup_ch").append('<a href="' + c.url + '" target="_blank" title="' + c.display_name + '"><div class="each-stream"><div class="live"><img src="' + p.medium + '" height="54" width="108" alt="' + c.display_name + '"></div><div class="title"><span>' + c.display_name + '</span></div></div></a>');
  84.         }  
  85.         setTimeout(function() {
  86.             var c = getCookie("live_btn");
  87.             if (c !== "0") {
  88.                 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
  89.                     hide()
  90.                 } else {
  91.                     expand()
  92.                 }
  93.             } else hide()
  94.         }, 3000);
  95.         $("#live_btn").click(function() {
  96.             if (state) hide();
  97.             else expand();
  98.             setCookie("live_btn", state, 7)
  99.         })
  100.     }
  101.  
  102.     function check() {
  103.         $.ajax({
  104.             url: "https://api.twitch.tv/kraken/streams?channel=" + findChannels,
  105.             dataType: 'json',
  106.             headers: {
  107.                 'Client-ID': '8hpijtqsoexg9yepbs9m9xm3cfgpor'
  108.             },
  109.             success: function(channel) {
  110.                 if (channel["_total"] == 0) return;
  111.                 a.push(channel);
  112.                 console.log('Wiixzer security development running...');
  113.             },
  114.             complete: function() {
  115.                 show()
  116.             },
  117.             error: function(erro){
  118.                 console.log(erro);
  119.             }
  120.         })
  121.     }
  122.     check()
  123. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement