-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtm.user.js
45 lines (41 loc) · 1.64 KB
/
tm.user.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
35
36
37
38
39
40
41
42
43
44
45
// ==UserScript==
// @name Steam Market Info
// @namespace https://github.com/inlace
// @version 1.0.3
// @author Inlace
// @description Показывает продажи и медианную цену за сутки
// @supportURL https://github.com/inlace
// @match http://steamcommunity.com/market/listings/*
// @match https://steamcommunity.com/market/listings/*
// @icon https://store.steampowered.com/favicon.ico
// @license MIT
// @grant none
// @run-at document-end
// ==/UserScript==
const link = window.location.href.split("/")[6].split("?")[0]
const appid = window.location.href.split("/")[5]
if (link !== null) {
getVolume(link)
.then(data => addVolume(data.volume,data.median_price));
}
function getVolume(link) {
return fetch(`//steamcommunity.com/market/priceoverview/\
?appid=${appid}¤cy=1&market_hash_name=${link}`)
.then(res => res.json());
}
function addVolume(volume,median) {
var elmDivItem = document.querySelector('#largeiteminfo_item_actions');
if (appid == "570") {
elmDivItem = document.querySelector('#largeiteminfo_item_descriptors');
}
if (elmDivItem !== null) {
if (volume == undefined) {
volume = 'нет'
}
if (median == undefined) {
median = 'нет'
}
elmDivItem.innerHTML += `<div class="descriptor">Продаж в сутки:<span style="color: #5b9ace">${volume}</span></div>`;
elmDivItem.innerHTML += `<div class="descriptor"> </div><div class="descriptor">Медианная цена:<span style="color: #5b9ace">${median}</span></div>`;
}
}