NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Sorare - quick check auctions
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description Quick check of the auctions in SorareData page.
// @author You
// @match https://www.soraredata.com/ongoingAuctions
// @icon https://www.google.com/s2/favicons?domain=soraredata.com
// @grant none
// @license MIT
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==
(function() {
'use strict';
window.addEventListener("load", () => {
addButton("Quick Check offers");
});
// Your code here...
function quickCheckOffers() {
$('.grid > .eZKQvz').each(function(index) {
// valeurs
let firstBox = $(this);
let ethValues = firstBox.find('.iGcTdH');
let ethVal = ethValues.find('.jFxkxg').text();
let num = ethVal.match(/[\d\.]+/g);
let ethValNum = parseFloat(num[0]);
let marketVal = ethValues.find('div[data-tip="Best market price"] .CryQi').text();
let marketValNum = marketVal.match(/[\d\.]+/g);
if (marketValNum == null) {
marketValNum = 10000000;
} else {
marketValNum = parseFloat(marketValNum[0]);
}
//percent 5 games.
let pointValues = firstBox.find('.cOHQFr');
let percent5Game = pointValues.find("span[data-tip='% of games played over the past 5 games']").text();
let percent5GameNum = percent5Game.match(/[\d\.]+/g);
percent5GameNum = parseInt(percent5GameNum[0]);
//points 5 games.
let points5Game = pointValues.find("span[data-tip='Average score over the past 5 games']").text();
let points5GameNum = points5Game.match(/[\d\.]+/g);
points5GameNum = parseInt(points5GameNum[0]);
if ((ethValNum < marketValNum) && percent5GameNum >= 80 && points5GameNum >= 50) {
firstBox.css('border', '5px solid rgb(0,0,255)');
} else if ((ethValNum < marketValNum) && percent5GameNum >= 80) {
firstBox.css('border', '5px solid rgb(0,255,0)');
} else if (ethValNum < marketValNum) {
firstBox.css('border', '5px solid yellow');
}
if (ethValNum >= marketValNum) {
firstBox.css('border', '5px solid red');
}
if (marketValNum == 10000000) {
firstBox.css('border', '5px solid grey');
}
});
}
function addButton(text, onclick, cssObj) {
cssObj = cssObj || {
position: "fixed",
bottom: "5%",
right: "1%",
"z-index": 3,
fontWeight: "600",
fontSize: "14px",
backgroundColor: "#00cccc",
color: "white",
border: "none",
padding: "10px 20px"
};
let button = document.createElement("button"),
btnStyle = button.style;
document.body.appendChild(button);
button.innerHTML = text;
// Setting function for button when it is clicked.
button.onclick = quickCheckOffers;
Object.keys(cssObj).forEach(key => (btnStyle[key] = cssObj[key]));
return button;
}
})();