Guest User

Untitled

a guest
Feb 26th, 2020
123
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery.ajaxSetup({ async: false });
  2. var data = []
  3.  
  4. function getDateStamp() {
  5.     var today = new Date();
  6.     var dd = today.getDate();
  7.     var mm = today.getMonth() + 1;
  8.     var yyyy = today.getFullYear();
  9.     var h = today.getHours();
  10.     var m = today.getMinutes();
  11.     var s = today.getSeconds();
  12.     if (dd < 10) { dd = '0' + dd }
  13.     if (mm < 10) { mm = '0' + mm }
  14.     if (h < 10) { h = '0' + h }
  15.     if (m < 10) { m = '0' + m }
  16.     if (s < 10) { s = '0' + s }
  17.     return '[' + h + ':' + m + ':' + s + '] - ' + dd + '/' + mm + '/' + yyyy;
  18. }
  19.  
  20. function loader(items, thingToDo, allDone) {
  21.     if (!items) {
  22.         return;
  23.     }
  24.     if ("undefined" === items.length) {
  25.         items = [items];
  26.     }
  27.     var count = items.length;
  28.     var thingToDoCompleted = function (items, i) {
  29.         count--;
  30.         if (0 == count) {
  31.             allDone(items);
  32.         }
  33.     };
  34.     for (var i = 0; i < items.length; i++) {
  35.         thingToDo(items, i, thingToDoCompleted);
  36.     }
  37. }
  38.  
  39. function loadImage(data, i, onComplete) {
  40.     var onLoad = function (e) {
  41.         var style = [
  42.             'font-size: 1px;',
  43.             'padding: ' +  110 + 'px ' + 100 + 'px;',
  44.             'background-size: ' + 100 + 'px ' + 150 + 'px;',
  45.             'background: no-repeat url(' + data[i].url + ');'
  46.         ].join(' ');
  47.         console.log('Name', data[i].name)
  48.         console.log('%c ', style);
  49.         console.log(data[i].data.join('\n'))
  50.         onComplete();
  51.     }
  52.     var img = new Image();
  53.     img.addEventListener("load", onLoad, false);
  54.     img.src = data[i].url;
  55. }
  56.  
  57. var profileList = ['https://ts5.travian.asia/spieler.php?uid=165',
  58.     'https://ts5.travian.asia/spieler.php?uid=47',
  59.     'https://ts5.travian.asia/spieler.php?uid=4',
  60.     'https://ts5.travian.asia/spieler.php?uid=54',
  61.     'https://ts5.travian.asia/spieler.php?uid=7',
  62.     'https://ts5.travian.asia/spieler.php?uid=488',
  63.     'https://ts5.travian.asia/spieler.php?uid=529',
  64.     'https://ts5.travian.asia/spieler.php?uid=986']
  65.  
  66. var image = []
  67.  
  68. for (var i = 0; i < profileList.length; i++) {
  69.     $.get(profileList[i], (pRes) => {
  70.         var n = $($.parseHTML(pRes)).find('#content .titleInHeader')[0].innerText.replace(/\n/g, '').replace(/\t/g, '')
  71.         var u = $($.parseHTML(pRes)).find('.player img.heroImage')[0].src
  72.         image[i] = { name: n, url: u, data: [] }
  73.         var y = 0;
  74.         $($.parseHTML(pRes)).find('#villages tbody tr').get().forEach(e => {
  75.             if (y < 2) {
  76.                 image[i].data.push(getDateStamp() + ' ID: ' + $($.parseHTML(pRes)).find('#content .titleInHeader')[0].innerText.replace(/\n/g, '').replace(/\t/g, '') + ' : ' + e.cells[0].innerText.replace(/\n/g, '').replace(/\t/g, '') + ':' + e.cells[3].innerText.replace(/\n/g, '').replace(/\t/g, '') + ' POP: ' + e.cells[2].innerText.replace(/\n/g, '').replace(/\t/g, ''))
  77.             }
  78.  
  79.  
  80.             y++
  81.         })
  82.     })
  83. }
  84. loader(image, loadImage, function () {
  85. });
RAW Paste Data