Skip to content

Instantly share code, notes, and snippets.

@firebotQL
Last active August 30, 2016 07:49
Show Gist options
  • Save firebotQL/a4e1821e66a3b5fa30b4 to your computer and use it in GitHub Desktop.
Save firebotQL/a4e1821e66a3b5fa30b4 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name FaceIT match ranks
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Shows elo and level of player in match screen.
// @author Viaceslavas 'fire_bot' Duk
// @match https://beta.faceit.com/en/csgo/room*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
angular.element(document).ready(function() {
// NOTE: if anyone knows how to plug in into angularjs controller to $watch when "members" has changed/loaded then
// we can get rid of setTimeout and all html scraping boilerplate(and maybe 10 get calls?) please let know. Thanks!
setTimeout(function(){
var matchItems = $(".match-team-member .match-team-member__row");
$(".match-vs .match-team-member__row .match-team-member__name").each(function(idx, el) {
var href = $(el).attr("href");
if (href) {
var splitHref = href.split("/");
var nickIdx = splitHref.length-1;
if (splitHref[nickIdx]) {
$.get("https://api.faceit.com/api/nicknames/" + splitHref[nickIdx], function( data ) {
//debugger;
var csgoPayload = data['payload']['games']['csgo'];
var resultHTML = "<div class='match-team-member__row__item'>";
resultHTML += "<div class='pa-sm'>Level: " + csgoPayload['csgo_skill_level'] + " ELO: <strong>" + csgoPayload['faceit_csgo_elo'] + "</strong></div>";
resultHTML += "</div>";
$(matchItems[idx]).append(resultHTML);
});
}
}
});
}, 3000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment