AlkantarClanX12

Your IP : 3.141.29.145


Current Path : /proc/thread-self/root/proc/self/root/home/thanudqk/thanpokertour.com/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/home/thanudqk/thanpokertour.com/app.js

var getJSON = function(url, callback) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', url, true);
    xhr.responseType = 'json';
    xhr.onload = function() {
      var status = xhr.status;
      if (status === 200) {
        callback(null, xhr.response);
      } else {
        callback(status, xhr.response);
      }
    };
    xhr.send();
  };

  Number.prototype.pad = function(size) {
        var s = String(this);
        while (s.length < (size || 2)) {s = "0" + s;}
        return s;
    }
  
  var app = new Vue({
    el: '#App',
    data: {
      table: [],
    },
    mounted(){
      getJSON('https://international-promo.firebaseio.com/VN1v3JMFcUjDrhZHH4QBBsKpkB78Bcy7cNWkXqKRr0Yl50/data.json',
        (err, data) => {
          data.shift()
          this.table = data;
      });
    },
    computed:{
        top10(){
            return this.table.splice(0, 10)
        }
    },
    methods: {
      formatNumber(amount, decimalCount = 2, decimal = ".", thousands = ",") {
        try {
          decimalCount = Math.abs(decimalCount);
          decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
      
          const negativeSign = amount < 0 ? "-" : "";
      
          let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
          let j = (i.length > 3) ? i.length % 3 : 0;
      
          return negativeSign + (j ? i.substr(0, j) + thousands : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) + (decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
        } catch (e) {
          console.log(e)
        }
      },
      padNumber(n, offset = false){
        var start = 0
        if(offset){
          start += 10
        }
          return (parseInt((start+n)) + 1).pad(2)
      }
    }
  })