-
Notifications
You must be signed in to change notification settings - Fork 0
/
wayfarer-rating-top-right-corner.js
34 lines (31 loc) · 1.41 KB
/
wayfarer-rating-top-right-corner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name Wayfarer Rating Top Right Corner
// @namespace https://github.com/Smooklu/wayfarer-rating-top-right-corner
// @version 0.1
// @description Adds your Wayfarer rating in the top right corner.
// @author Smooklu
// @match https://wayfarer.nianticlabs.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var request = new XMLHttpRequest();
request.addEventListener("load", function(evt){
if (request.status == 200) {
console.log('Profile loaded!')
var rating = document.createElement('section');
rating.innerText = request.response.body.getElementsByClassName('rating-bar__segment--active')[0].innerText;
rating.className = 'rating-bar__segment rating-bar__segment--active'
rating.style = 'border-radius:20px 20px 20px 20px; text-transform:capitalize; margin-right:10px;'
rating.title = request.response.body.getElementsByClassName('rating-bar__segment--active')[0].getAttribute('uib-tooltip')
var profilepic = document.getElementsByClassName('inner-container')[1].children[0]
document.body.children[0].children[2].insertBefore(rating,profilepic)
}
else{
console.log("Couldn't load profile!")
}
}, false);
request.open('GET', 'profile', true)
request.responseType = "document"
request.send();
})();