Skip to content

Instantly share code, notes, and snippets.

@Luckz
Last active April 17, 2023 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luckz/b392af08d52bdf25d6ade70c58ef739f to your computer and use it in GitHub Desktop.
Save Luckz/b392af08d52bdf25d6ade70c58ef739f to your computer and use it in GitHub Desktop.
SteamStoreCheevoComfort.user.js
// ==UserScript==
// @name Steam Store Cheevo Comfort
// @namespace luckz
// @author luckz
// @version 0.6.0
// @description put them in a better place
// @match https://store.steampowered.com/app/*
// @match https://store.steampowered.com/sub/*
// @grant none
// @downloadURL https://gist.github.com/Luckz/b392af08d52bdf25d6ade70c58ef739f/raw/SteamStoreCheevoComfort.user.js
// @updateURL https://gist.github.com/Luckz/b392af08d52bdf25d6ade70c58ef739f/raw/SteamStoreCheevoComfort.user.js
// ==/UserScript==
/*global $J */
'use strict';
// == Configuration == == Configuration == == Configuration == == Configuration ==
const mode = "advanced"; // basic | advanced => AStats
const fixsearch = true; // false | true => add store search for dev/pub back in when missing; Augmented Steam users should turn this off
const searchemoji = "silly"; // nope | yes | silly => 'SEARCH' or emoji
const claimfix = true; // false | true => green Download button tries to launch stuff. that's bad. fix it.
const claimfixbyreplacing = true; // false | true => fix it by replacing vs by adding a new one.
// ==/Configuration == ==/Configuration == ==/Configuration == ==/Configuration ==
let node;
if ($J('#achievement_block > .communitylink_achievement_images').length > 0){ // Valve doesn't feel like fixing this :F
node = $J('#achievement_block').clone().attr("style","position: relative; float: right; right: 35px; top: -17px; max-height: 36px;").removeAttr('id');
if ($J('.in_queue').length)
node.css('top', '-32.5px');
/* if (mode === 'fancy') {
node.css('right', '70px'); //let node = $J('#achievement_block').clone().attr("style","position: relative; float: right; right: 70px; top: -17px; max-height: 36px;");
;
;
}
else*/ if (mode === 'advanced') {
node.css('right', '20px');
let app = window.location.href.split('/')[4];
// $J('div.communitylink_achievement', node).last() by itself would also work, but ternary = fun.
($J('.communitylink_achivement_plusmore', node).length > 0 ? $J('.communitylink_achivement_plusmore', node) : $J('div.communitylink_achievement', node).last()).after(`<a class="communitylink_achievement communitylink_achivement_plusmore" href="http://astats.astats.nl/Astats/Steam_Game_Info.php?Tab=2&AppID=${app}" style="margin-left: 6px;">AStats</a>`);
node.insertBefore('.queue_ctn > .queue_actions_ctn > .queue_control_button.queue_btn_follow');
}
else //if (mode === 'basic')
;
node.insertBefore('.queue_ctn > .queue_actions_ctn > .queue_control_button.queue_btn_follow');
}
if (fixsearch) {
const [dev, pub, cur] = ['developer', 'publisher', 'curator'];
let template;
switch (searchemoji) {
case 'nope':
template = (type, name) => ` [ <a href="https://store.steampowered.com/search/?${type}=${name}">SEARCH</a> ]`;
break;
case 'yes':
template = (type, name) => ` [ <a href="https://store.steampowered.com/search/?${type}=${name}">🔍</a> ]`;
break;
case 'silly':
default:
template = (type, name) => ` [ <a href="https://store.steampowered.com/search/?${type}=${name}">${type == dev ? '🐢' : '🐍'}</a> ]`;
break;
}
const templateBoth = (name) => ` [ <a href="https://store.steampowered.com/search/?developer=${name}">🐢</a> <a href="https://store.steampowered.com/search/?publisher=${name}">🐍</a> ]`;
$J('div.dev_row > div.summary > a, .details_block span a').each((i,elem) => {
const str = $J(elem).attr('href').split('/')[3];
if ($J(elem).text() == 'Homepage') return; // Augmented Steam compatibility
if (str == dev) {
$J(elem).after(template(dev, $J(elem).text()));
} else if (str == pub) {
$J(elem).after(template(pub, $J(elem).text()));
} else if (str == cur)
$J(elem).after(templateBoth($J(elem).text()));
});
}
if (claimfix && $J('#freeGameBtn').length) {
const btn = $J('#freeGameBtn > .btn_green_steamui :first');
const greenButton = claimfixbyreplacing ? btn : btn.clone();
greenButton.children('span').text('Install / Claim');
greenButton.attr('href', (_, href) => href.replace('steam://run/', 'steam://install/'));
if (!claimfixbyreplacing) btn.after(greenButton);
}
@Korb
Copy link

Korb commented Apr 17, 2023

What exactly does this script do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment