Last active
February 8, 2019 14:05
-
-
Save sash13/b1d69ba5792d7714aafcdd41ca84c30b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name PidorGameParser | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://konsolech.ga/pidor/* | |
// @match https://chkktri.club/pidor/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var data = JSON.parse(document.getElementsByTagName("pre")[0].textContent); | |
var dataArray = Object.keys(data).map(i => data[i]); | |
dataArray = dataArray.filter(dt => dt.active == true); | |
dataArray = dataArray.filter(dt => dt.pidor_status == false); | |
console.log(dataArray) | |
var fields = ['nick','chance'] | |
var a = document.getElementsByTagName("body"); | |
var t = document.createElement('table'); | |
t.border = '1'; | |
var tableBody = document.createElement('TBODY'); | |
t.appendChild(tableBody); | |
var tr = document.createElement('TR'); | |
tableBody.appendChild(tr); | |
var td = document.createElement('TD'); | |
td.appendChild(document.createTextNode('nick')); | |
tr.appendChild(td); | |
td = document.createElement('TD'); | |
td.appendChild(document.createTextNode('chance')); | |
tr.appendChild(td); | |
for (var i = 0; i < dataArray.length; i++) { | |
tr = document.createElement('TR'); | |
tableBody.appendChild(tr); | |
for (var j = 0; j < fields.length; j++) { | |
td = document.createElement('TD'); | |
td.appendChild(document.createTextNode(dataArray[i][fields[j]])); | |
tr.appendChild(td); | |
} | |
} | |
var parentElement = document.getElementsByClassName('starter-template')[0]; | |
console.log(parentElement) | |
console.log(t) | |
parentElement.appendChild(t); | |
parentElement.insertBefore(t, parentElement.children[0]); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment