SgWin

SG win

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        SgWin
// @namespace   vsgw
// @include     https://www.steamgifts.com/
// @include     https://www.steamgifts.com/giveaway/*
// @icon        https://cdn.steamgifts.com/img/favicon.ico
// @version     1.2
// @grant       none
// @description SG win
// ==/UserScript==


function luck(vl,s) {
   var vls = vl.replace(',','');
   vls = vls.replace(' entries','');
   var vln = Math.ceil(vls/2);
   vls = vln.toString();
   if (vls.length>3) {vls = vls.substr(0,vls.length-3) + ',' + vls.substr(-3)}
   if (s == 1) vls += ' entries'; 
   return(vls);
}

var Nent = document.getElementsByClassName('fa fa-tag');
for(var i = 0; i < Nent.length; i++) {       
    if(Nent[i].className == 'fa fa-tag') {
      Nent[i].parentNode.getElementsByTagName('span')[0].innerHTML = luck(Nent[i].parentNode.getElementsByTagName('span')[0].innerHTML,1);
    }
}
Nent = document.getElementsByClassName('sidebar__navigation__item__count live__entry-count');
for(var i = 0; i < Nent.length; i++) {       
    if(Nent[i].className == 'sidebar__navigation__item__count live__entry-count') {
      Nent[i].innerHTML = luck(Nent[i].innerHTML,0);
    }
}