-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteam-count-ready-badges.user.js
36 lines (32 loc) · 1.55 KB
/
steam-count-ready-badges.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
// ==UserScript==
// @name Steam Count Ready Badges
// @namespace https://github.com/FiveElementNinja/Steam-Count-Ready-Badges
// @version 0.4
// @description Shows how many badges you have waiting to be crafted on the badges page
// @author Five Element Ninja (@FivElementNinja)
// @match *://steamcommunity.com/id/*/badges*
// @updateURL https://github.com/FiveElementNinja/Steam-Count-Ready-Badges/raw/master/steam-count-ready-badges.user.js
// @downloadURL https://github.com/FiveElementNinja/Steam-Count-Ready-Badges/raw/master/steam-count-ready-badges.user.js
// @run-at document-end
// ==/UserScript==
console.log('Steam Count Ready Badges loaded');
(function () {
var urlParams = new URLSearchParams(window.location.search);
var page = urlParams.get('p');
var total_badges = jQuery('.badge_craft_button').length;
if (page && page > 1 && total_badges > 0) {
total_badges = ((page - 1) * 150) + total_badges;
}
var tooltip = "";
var i = 1;
if (page && page > 1) {
tooltip += "...\n";
i = (page - 1) * 150;
}
jQuery('.badge_craft_button').each(function () {
var title = jQuery(this).parent().parent().parent().children('.badge_title_row').children('.badge_title').clone().children().remove().end().text().trim();
tooltip += i + ' - ' + title + "\n";
i++;
});
jQuery('.profile_paging').append(' | <span title="' + tooltip + '">' + total_badges + ' badge' + ((total_badges == 1) ? '' : 's') + ' ready to craft (<strong><a href="javascript:return false;">?</a></strong>)</span>');
}());