Last active
January 9, 2019 13:45
-
-
Save DenimTornado/39fca3e18fb2056b083d45eccced881f to your computer and use it in GitHub Desktop.
Tampermonkey fifarenderz.com stats
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 New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match http://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var hash = {}, id, name, ovr, position, fullName, playerString; | |
$(function() { | |
id = window.location.pathname.split('/')[2]; | |
name = $('.player-card .name').html(); | |
ovr = $('.player-card .rating').html(); | |
position = $('.player-card .position').html(); | |
fullName = $('.player-header h2').html(); | |
playerString = name + ' ' + position + ' ' + ovr + ' / ' + fullName + ' / ' + id; | |
var elements = $('.row').find('.stat-bundle'); | |
var stats = $(elements).find('.stat-stat'); | |
for (var i = 0; i < stats.length; i++) { | |
var className = stats[i].className.split(' ')[2].slice(5, 8); | |
var value = stats[i].innerText; | |
hash[className] = value; | |
} | |
var firstEight = [ | |
'ACC', | |
'AGG', | |
'AWR', | |
'BAC', | |
'CRO', | |
'DRI', | |
'HEA', | |
'LPA', | |
]; | |
var stats2 = ''; | |
for (var k = 0; k < firstEight.length; k++) { | |
if (k == 0 || hash['ACC'] != hash[firstEight[k]]) { | |
stats2 += hash[firstEight[k]] + ';'; | |
} | |
} | |
var scriptString = 'edit(\'' + stats2.slice(0, stats2.length - 1) + '::29\', ' + hash['ACC'] + ')</br>'; | |
var table = $('<table></table>'); | |
for (var key in hash) { | |
if (!hash.hasOwnProperty(key)) { | |
continue; | |
} | |
$(table).append('<tr><td>' + key + '</td><td> - </td><td>' + hash[key] + '</td></tr>'); | |
} | |
var div = $('<div id="statsPop"></div>'); | |
$(div).css('position', 'fixed'); | |
$(div).css('background-color', '#fff'); | |
$(div).css('top', '126px'); | |
$(div).css('left', '0'); | |
$(div).css('border', '2px solid #000'); | |
$(div).css('z-index', '10'); | |
$(div).css('padding', '10px'); | |
$(div).css('display', 'none'); | |
$(div).append('-- ' + playerString + '</br>'); | |
$(div).append(scriptString); | |
$(div).append('----------------</br>'); | |
$(div).append(table); | |
var showHide = $('<div id="showHide">Show/Hide</div>'); | |
$(showHide).css('position', 'fixed'); | |
$(showHide).css('background-color', '#fff'); | |
$(showHide).css('top', '96px'); | |
$(showHide).css('left', '0'); | |
$(showHide).css('border', '2px solid #000'); | |
$(showHide).css('z-index', '10'); | |
$(showHide).css('height', '30px'); | |
$(showHide).css('padding', '0 10px'); | |
$(showHide).css('cursor', 'pointer'); | |
$(showHide).on('click', function() { | |
$('#statsPop').toggle(); | |
}); | |
$('body').append(showHide); | |
$('body').append(div); | |
}); | |
// Your code here... | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment