Skip to content

Instantly share code, notes, and snippets.

@hearimm
Last active September 30, 2021 16:03
Show Gist options
  • Save hearimm/bc3d2552df978ae14c889b8fc0fe95f0 to your computer and use it in GitHub Desktop.
Save hearimm/bc3d2552df978ae14c889b8fc0fe95f0 to your computer and use it in GitHub Desktop.
피파22 경매장 최저가
// ==UserScript==
// @name 피파22 경매장 최저가
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.ea.com/fifa/ultimate-team/web-app/
// @grant GM_setClipboard
// ==/UserScript==
'use strict';
// Your code here...
(async function() {
function isIncludeText(url, txt){
return url.includes(txt)
}
let oldXHROpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
// do something with the method, url and etc.
this.addEventListener('load', function() {
// do something with the response text
if( isIncludeText(this.responseURL,'transfermarket')){
var data = this.responseText;
var json = JSON.parse(data);
const mapped = json.auctionInfo.map(x => x.buyNowPrice);
const sorted = mapped.sort((a,b) => { return a - b })
// console.log(sorted);
GM_setClipboard(sorted[0], { type: 'text', mimetype: 'text/plain'})
}
});
return oldXHROpen.apply(this, arguments);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment