adds .local/share/millennium and easyeffects

This commit is contained in:
2026-08-06 18:23:36 +02:00
parent f92fb90275
commit 8dc466cbac
2581 changed files with 339035 additions and 0 deletions
@@ -0,0 +1,9 @@
(function(){
window.AdjustVisibleAppTags($J(".popular_tags"));
/*
* Triggers the adjustment of the slider scroll bar.
* https://github.com/SteamDatabase/SteamTracking/blob/ad4e85261f2322eae0b0125e46d7d753bf755730/store.steampowered.com/public/javascript/gamehighlightplayer.js#L101
*/
$J(window).trigger("resize.GameHighlightPlayer");
})();
@@ -0,0 +1,34 @@
(function(){
// https://github.com/SteamDatabase/SteamTracking/blob/8e19832027cf425b5db71c09c878739b5630c66a/steamcommunity.com/public/javascript/workshop_previewplayer.js#L123
const player = window.g_player;
// g_player is null when the shared file only has one screenshot and therefore no highlight strip
if (player === null) { return; }
const elemSlider = window.$("highlight_slider");
const nSliderWidth = player.m_elemStripScroll.getWidth() - player.m_elemStrip.getWidth();
// Shared files with too few screenshots won't have a slider
if (typeof player.slider !== "undefined") {
player.slider.dispose();
}
if (nSliderWidth > 0) {
const newValue = player.slider.value * (nSliderWidth / player.slider.range.end);
player.slider = new (window.Control.Slider)(
elemSlider.down(".handle"),
elemSlider,
{
"range": window.$R(0, nSliderWidth),
"sliderValue": newValue,
"onSlide": player.SliderOnChange.bind(player),
"onChange": player.SliderOnChange.bind(player),
}
);
g_player.SliderOnChange(newValue);
} else {
elemSlider.hide();
}
})();
@@ -0,0 +1,14 @@
(function() {
const params = JSON.parse(document.currentScript.dataset.params);
g_rgDelayedLoadImages = params.images;
// Clear registered image lazy loader watchers
CScrollOffsetWatcher.sm_rgWatchers = [];
// Recreate image lazy loader watchers
for (const node of document.querySelectorAll("div[id^=image_group_scroll_badge_images_]")) {
LoadImageGroupOnScroll(node.id, node.id.slice(19));
}
})();
@@ -0,0 +1,10 @@
(function() {
// Recalculate offsets for each watcher
CScrollOffsetWatcher.sm_rgWatchers.forEach(watcher => { watcher.Recalc(); });
// CScrollOffsetWatcher.OnScroll() expects watchers to be sorted by offset trigger
CScrollOffsetWatcher.sm_rgWatchers.sort((a, b) => a.nOffsetTopTrigger - b.nOffsetTopTrigger);
// Start loading images that meet their thresholds immediately
CScrollOffsetWatcher.OnScroll();
})();
@@ -0,0 +1,26 @@
document.addEventListener("as_GroupsManager", async function(e) {
const {action} = e.detail;
switch(action) {
case "updateSelection":
UpdateSelection();
break;
case "toggleManageFriends":
ToggleManageFriends();
break;
case "selectAll":
SelectAll();
break;
case "selectNone":
SelectNone();
break;
case "selectInverse":
SelectInverse();
break;
}
});
@@ -0,0 +1,10 @@
(function() {
const params = JSON.parse(document.currentScript.dataset.params);
const {groupId} = params;
ToggleManageFriends();
$J("#es_invite_to_group").on("click", () => {
const friends = GetCheckedAccounts("#search_results > .selectable.selected:visible");
InviteUserToGroup(null, groupId, friends);
});
})();
@@ -0,0 +1,5 @@
(function() {
document.getElementById("es_invite_to_group").addEventListener("click", () => {
ExecFriendAction("group_invite", "friends/all");
});
})();
@@ -0,0 +1,7 @@
(function() {
$J(document).ajaxSuccess((event, xhr, settings) => {
if (/\/(friends|groups)(\/common)?\/?\?ajax=1$/.test(settings.url)) {
document.dispatchEvent(new CustomEvent("as_subpageNav"));
}
});
})();
@@ -0,0 +1,43 @@
(function() {
function ensureFn() {
// g_ActiveInventory is sometimes set to null or a different inventory, thus clearing our GoToPage fn
if (typeof g_ActiveInventory.GoToPage === "function") { return; }
g_ActiveInventory.GoToPage = function(page) {
const nPageWidth = this.m_$Inventory.children(".inventory_page:first").width();
const iCurPage = this.m_iCurrentPage;
const iNextPage = Math.min(Math.max(0, --page), this.m_cPages - 1);
const iPages = this.m_cPages;
if (iCurPage < iNextPage) {
if (iCurPage < iPages - 1) {
this.PrepPageTransition(nPageWidth, iCurPage, iNextPage);
this.m_$Inventory.css("left", "0");
this.m_$Inventory.animate({"left": -nPageWidth}, 250, null, () => this.FinishPageTransition(iCurPage, iNextPage));
}
} else if (iCurPage > iNextPage) {
if (iCurPage > 0) {
this.PrepPageTransition(nPageWidth, iCurPage, iNextPage);
this.m_$Inventory.css("left", "-" + nPageWidth + "px");
this.m_$Inventory.animate({"left": 0}, 250, null, () => this.FinishPageTransition(iCurPage, iNextPage));
}
}
};
}
document.getElementById("pagebtn_first").addEventListener("click", () => {
ensureFn();
g_ActiveInventory.GoToPage(1);
});
document.getElementById("pagebtn_last").addEventListener("click", () => {
ensureFn();
g_ActiveInventory.GoToPage(g_ActiveInventory.m_cPages);
});
document.getElementById("es_gotopage_btn").addEventListener("click", () => {
ensureFn();
const page = $("es_pagenumber").value;
if (isNaN(page)) { return; }
g_ActiveInventory.GoToPage(parseInt(page));
});
})();
@@ -0,0 +1,130 @@
(function() {
let lastItem = null;
function dispatchMarketInfo() {
const inv = window.g_ActiveInventory;
const wallet = window.g_rgWalletInfo;
const item = inv.selectedItem;
if (item === lastItem) {
return;
}
lastItem = item;
if (!item) {
document.dispatchEvent(new CustomEvent("as_marketInfo", {detail: null}));
return;
}
// https://github.com/SteamDatabase/SteamTracking/blob/b3abe9c82f9e9d260265591320cac6304e500e58/steamcommunity.com/public/javascript/economy_common.js#L161
const hashName = GetMarketHashName(item.description);
/*
* See https://github.com/IsThereAnyDeal/AugmentedSteam/pull/1047#discussion_r571444376
* Update: For non-Steam items, the text may not have a color, so test date only
*/
const restriction = Array.isArray(item.description.owner_descriptions)
&& item.description.owner_descriptions.some(desc => /\[date\]\d+\[\/date\]/.test(desc.value));
// https://github.com/SteamDatabase/SteamTracking/blob/f26cfc1ec42b8a0c27ca11f4343edbd8dd293255/steamcommunity.com/public/javascript/economy_v2.js#L4468
const publisherFee = item.description.market_fee ?? wallet.wallet_publisher_fee_percent_default;
const contextId = Number(item.contextid);
const globalId = Number(inv.appid);
// Only parse these if the item is a Steam item
let appid, itemType;
if (contextId === 6 && globalId === 753) {
appid = parseInt(hashName); // Should start with "real" appid
itemType = item.description.tags.find(tag => tag.category === "item_class")?.internal_name;
// https://github.com/JustArchiNET/ArchiSteamFarm/blob/f55f58a8ef61ba830ed1bee88e5e895b9e4f479d/ArchiSteamFarm/Steam/Data/InventoryResponse.cs#L150
switch (itemType) {
case "item_class_2":
itemType = "card";
break;
case "item_class_3":
itemType = "profilebackground";
break;
case "item_class_4":
itemType = "emoticon";
break;
case "item_class_5":
itemType = "booster";
break;
case "item_class_6":
itemType = "consumable";
break;
case "item_class_7":
itemType = "gems";
break;
case "item_class_8":
itemType = "profilemodifier";
break;
case "item_class_10":
itemType = "saleitem";
break;
case "item_class_11":
itemType = "sticker";
break;
case "item_class_12":
itemType = "chateffect";
break;
case "item_class_13":
itemType = "miniprofilebackground";
break;
case "item_class_14":
itemType = "avatarframe";
break;
case "item_class_15":
itemType = "animatedavatar";
break;
case "item_class_16":
itemType = "keyboardskin";
break;
default:
itemType = "unknown";
break;
}
}
let hasGooOption = false;
const ownerActions = item.description.owner_actions ?? [];
for (const action of ownerActions) {
if (/GetGooValue/.test(action.link)) {
hasGooOption = true;
}
}
document.dispatchEvent(new CustomEvent("as_marketInfo", {
detail: {
view: window.iActiveSelectView,
sessionId: window.g_sessionID,
marketAllowed: window.g_bMarketAllowed,
country: window.g_strCountryCode,
assetId: item.assetid, // DO NOT cast this to a number as the value might exceed Number.MAX_SAFE_INTEGER
contextId,
globalId,
walletCurrency: wallet.wallet_currency,
marketable: item.description.marketable,
hashName,
publisherFee,
restriction,
appid,
itemType,
hasGooOption
}
}));
}
const observer = new MutationObserver(() => {
dispatchMarketInfo();
});
observer.observe(
document.querySelector("#iteminfo0"), {attributes: true}
)
observer.observe(
document.querySelector("#iteminfo1"), {attributes: true}
)
}());
@@ -0,0 +1,24 @@
/*
* Modified version of GrindIntoGoo from badges.js
* https://github.com/SteamDatabase/SteamTracking/blob/ca5145acba077bee42de2593f6b17a6ed045b5f6/steamcommunity.com/public/javascript/badges.js#L521
*/
(function() {
const params = JSON.parse(document.currentScript.dataset.params);
const {sessionId, assetId, appid} = params;
const ajaxParams = {
sessionid: sessionId,
appid,
assetid: assetId,
contextid: 6
};
$J.get(`${g_strProfileURL}/ajaxgetgoovalue/`, ajaxParams).done(data => {
ajaxParams.goo_value_expected = data.goo_value;
$J.post(`${g_strProfileURL}/ajaxgrindintogoo/`, ajaxParams)
.done(() => {
ReloadCommunityInventory();
});
});
})();
@@ -0,0 +1,3 @@
(function(){
pricehistory_zoomDays(g_plotPriceHistory, g_timePriceHistoryEarliest, g_timePriceHistoryLatest, 365);
})();
@@ -0,0 +1,8 @@
(function(){
pricehistory_zoomDays(
SellItemDialog.m_plotPriceHistory,
SellItemDialog.m_timePriceHistoryEarliest,
SellItemDialog.m_timePriceHistoryLatest,
365
);
})();
@@ -0,0 +1,11 @@
(function(){
// Fix undefined function when clicking on the "show all x comments" button under "uploaded a screenshot" type activity
if (typeof window.Blotter_ShowLargeScreenshot !== "function") {
window.Blotter_ShowLargeScreenshot = (galleryid, showComments) => {
const gallery = g_BlotterGalleries[galleryid];
const ss = gallery.shots[gallery.m_screenshotActive];
ShowModalContent(`${ss.m_modalContentLink}&insideModal=1&showComments=${showComments}`, ss.m_modalContentLinkText, ss.m_modalContentLink, true);
};
}
})();
@@ -0,0 +1,18 @@
(function(){
const oldShowNicknameModal = window.ShowNicknameModal;
// Show current nickname in input box
window.ShowNicknameModal = function() {
oldShowNicknameModal();
const nicknameNode = document.querySelector(".persona_name .nickname");
if (nicknameNode !== null) {
document.querySelector(".newmodal input[type=text]").value = nicknameNode.textContent.trim().slice(1, -1);
}
};
document.querySelector("#es_nickname")?.addEventListener("click", () => {
window.ShowNicknameModal();
window.HideMenu("profile_action_dropdown_link", "profile_action_dropdown");
});
})();
@@ -0,0 +1,10 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
const {query, totalCount, count} = params;
g_oSearchResults.m_iCurrentPage = 0;
g_oSearchResults.m_strQuery = query;
g_oSearchResults.m_cTotalCount = totalCount;
g_oSearchResults.m_cPageSize = count;
g_oSearchResults.UpdatePagingDisplay();
})();
@@ -0,0 +1,50 @@
(function() {
const params = JSON.parse(document.currentScript.dataset.params);
// `CCommentThread` is defined in global.js
if (typeof window.CCommentThread === "undefined") {
return;
}
// https://github.com/SteamDatabase/SteamTracking/blob/18d1c0eed3dcedc81656e3d278b3896253cc5b84/steamcommunity.com/public/javascript/global.js#L2465
const oldDeleteComment = window.CCommentThread.DeleteComment;
window.CCommentThread.DeleteComment = function(id, gidcomment) {
/**
* Forum topics have special handling and show a prompt already
* https://github.com/SteamDatabase/SteamTracking/blob/18d1c0eed3dcedc81656e3d278b3896253cc5b84/steamcommunity.com/public/javascript/forums.js#L1347
*/
if (id.startsWith("ForumTopic")) {
oldDeleteComment.call(this, id, gidcomment);
return;
}
const modal = window.SteamFacade.showConfirmDialog(
"Augmented Steam",
`${params.prompt}<br><br>
<label><input type="checkbox">${params.label}</label>`
);
let checked = false;
document.querySelector(".newmodal input[type=checkbox]").addEventListener("change", e => {
checked = e.currentTarget.checked;
});
modal.then((result) => {
if (checked) {
/*
* Restore old method if don't show is checked, so the prompt is not shown
* when deleting more comments on the same page
*/
window.CCommentThread.DeleteComment = oldDeleteComment;
document.dispatchEvent(new CustomEvent("noDeletionConfirm"));
}
if (result === "OK") oldDeleteComment.call(this, id, gidcomment);
});
};
})();
@@ -0,0 +1,39 @@
(function() {
function onReady() {
window.GDynamicStore.OnReady(() => {
window.dispatchEvent(new CustomEvent("DSReady"));
});
}
function invalidateCache() {
// `GDynamicStore` is defined in dynamicstore.js
if (typeof window.GDynamicStore === "undefined") {
return;
}
const oldFunc = window.GDynamicStore.InvalidateCache;
window.GDynamicStore.InvalidateCache = function(...args) {
oldFunc.call(this, args);
window.dispatchEvent(new CustomEvent("DSInvalidateCache"));
};
}
document.addEventListener("as_DynamicStore", async function(e) {
const {action} = e.detail;
if (!action) {
return;
}
switch(action) {
case "invalidateCache":
invalidateCache();
break;
case "onReady":
onReady();
break;
}
})
})();
@@ -0,0 +1,195 @@
(function() {
class Steam {
// variables
static global(name) {
const parts = name.split(".");
let result = window;
for (let part of parts) {
if (typeof result[part] === "undefined") {
return undefined;
}
result = result[part];
}
return result;
}
static globalSet(name, value) {
window[name] = value;
}
static globalExists(name) {
const parts = name.split(".");
let result = window;
for (let part of parts) {
if (!result[part]) {
return false;
}
result = result[part];
}
return true;
}
// dialogs
static showDialog(strTitle, strDescription, rgModalParams) {
ShowDialog(strTitle, strDescription, rgModalParams);
}
static showConfirmDialog(strTitle, strDescription, strOKButton, strCancelButton, strSecondaryActionButton, bExplicitConfirm, bExplicitDismissal) {
let rgModalParams = {};
if (bExplicitDismissal) {
rgModalParams.bExplicitDismissalOnly = true;
}
return new Promise(resolve => {
ShowConfirmDialog(strTitle, strDescription, strOKButton, strCancelButton, strSecondaryActionButton, rgModalParams)
.done(result => resolve(result)) // "OK" / "SECONDARY"
.fail(() => resolve("CANCEL"));
if (bExplicitConfirm) {
$J(document).off("keyup.SharedConfirmDialog");
}
})
}
static showAlertDialog(strTitle, strDescription, strOKButton) {
return new Promise(resolve => {
ShowAlertDialog(strTitle, strDescription, strOKButton)
.done(result => resolve())
.fail(() => resolve());
})
}
static showBlockingWaitDialog(strTitle, strDescription) {
return new Promise(resolve => {
ShowBlockingWaitDialog(strTitle, strDescription);
resolve();
});
}
static dismissActiveModal(id) {
if (id) {
for (const modal of CModal.s_rgModalStack) {
if (modal.GetContent().find(`#${id}`).length > 0) {
modal.Dismiss();
break;
}
}
} else {
CModal.DismissActiveModal();
}
}
// menu
static showMenu(elemLink, elemPopup, align, valign, bLinkHasBorder) {
ShowMenu(elemLink, elemPopup, align, valign, bLinkHasBorder);
}
static hideMenu(elemLink, elemPopup) {
HideMenu(elemLink, elemPopup);
}
static changeLanguage(strTargetLanguage, bStayOnPage) {
ChangeLanguage(strTargetLanguage, bStayOnPage);
}
// app pages
static collapseLongStrings(selector) {
CollapseLongStrings(selector);
}
static removeFromWishlist(appid, divToHide, divToShowSuccess, divToShowError, navref, divToHide2) {
RemoveFromWishlist(appid, divToHide, divToShowSuccess, divToShowError, navref, divToHide2);
}
static addToWishlist(appid, divToHide, divToShowSuccess, divToShowError, navref, divToHide2) {
AddToWishlist(appid, divToHide, divToShowSuccess, divToShowError, navref, divToHide2);
}
// events
static bindAutoFlyoutEvents() {
BindAutoFlyoutEvents();
}
// tooltips
static vTooltip(selector, isHtml = false) {
const isStore = window.location.host === "store.steampowered.com";
$J(selector).v_tooltip({
"tooltipClass": isStore ? "store_tooltip" : "community_tooltip",
"dataAttr": isHtml ? "data-tooltip-html" : "data-tooltip-text",
"defaultType": isHtml ? "html" : "text",
"replaceExisting": true
});
}
// market
// https://community.fastly.steamstatic.com/public/javascript/economy_common.js
static getItemPriceFromTotal(total) {
return GetItemPriceFromTotal(total, window.g_rgWalletInfo);
}
static getMarketPrices(low, high, currencyCode, publisherFee) {
const rgWallet = window.g_rgWalletInfo;
function getPrice(amount) {
const itemPrice = GetItemPriceFromTotal(amount, rgWallet);
const validPrice = ToValidMarketPrice(itemPrice, rgWallet);
return Math.floor(GetTotalWithFees(validPrice, publisherFee, rgWallet.wallet_fee_percent, rgWallet));
}
const lowAmount = low <= 0 ? 0 : getPrice(low);
const highAmount = getPrice(high);
return {
low: lowAmount,
lowFormatted: v_currencyformat(lowAmount, currencyCode),
high: highAmount,
highFormatted: v_currencyformat(highAmount, currencyCode)
}
}
static vCurrencyFormat(amount, currencyCode) {
return v_currencyformat(amount, currencyCode);
}
// profile home
static openFriendChatInWebChat(steamid, accountid) {
OpenFriendChatInWebChat(steamid, accountid);
}
// edit guide
static submitGuide() {
SubmitGuide();
}
}
document.addEventListener("as_SteamFacade", async function(e) {
const {action, params, id} = e.detail;
if (!action || !Steam[action]) {
return;
}
const result = Steam[action](...params);
if (id) {
document.dispatchEvent(new CustomEvent(id, {
// Remove un-structuredClone-able properties, otherwise this will return `null`
detail: JSON.parse(JSON.stringify((await result) ?? null))
}));
}
});
window.SteamFacade = Steam;
})();
@@ -0,0 +1,8 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
const subids = params.subids;
const bundleid = undefined;
const navdata = undefined;
window.AddItemToCart(subids.length === 1 ? subids[0] : subids, bundleid, navdata);
})();
@@ -0,0 +1,21 @@
(function(){
$J("#es_new_queue").v_tooltip({
tooltipClass: "store_tooltip",
dataAttr: "data-tooltip-text",
defaultType: "text",
replaceExisting: true
});
$J("#es_new_queue").on("click", () => {
const queueType = window.g_eDiscoveryQueueType;
$J.ajax({
"url": `https://store.steampowered.com/explore/next/${queueType}/`,
"type": "POST",
"data": $J("#next_in_queue_form").serialize(),
"success": () => {
window.location.href = `https://store.steampowered.com/explore/startnew/${queueType}/`;
}
// TODO error handling, waiting on #231 and #275 to merge
});
});
})();
@@ -0,0 +1,13 @@
(function(){
/**
* Remove the check for `g_bUserSelectedTrailer` to avoid unmuting the player when switching or seeking video
* https://github.com/SteamDatabase/SteamTracking/blob/b7e8996a9a2a26296df60b252a608b3dc1c96ab1/store.steampowered.com/public/javascript/gamehighlightplayer.js#L33
*/
if (typeof BIsUserGameHighlightAudioEnabled === "function") {
BIsUserGameHighlightAudioEnabled = () => {
const rgMatches = document.cookie.match(/(^|; )bGameHighlightAudioEnabled=([^;]*)/);
return rgMatches && rgMatches[2] === "true";
};
}
})();
@@ -0,0 +1,9 @@
(function(){
document.addEventListener("visibilitychange", function(){
if (document.hidden) {
Object.defineProperty(document, 'visibilityState', {value: 'visible', writable: true});
Object.defineProperty(document, 'hidden', {value: false, writable: true});
document.dispatchEvent(new Event("visibilitychange"));
}
});
})();
@@ -0,0 +1,80 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
const {context, language, minPlaytime, maxPlaytime} = params;
const oldShowFilteredReviews = window.ShowFilteredReviews;
window.ShowFilteredReviews = function() {
oldShowFilteredReviews();
document.dispatchEvent(new CustomEvent("as_filtersChanged"));
};
let filtersChanged = false;
if (context && context !== "review_context_summary") {
const input = document.querySelector(`#${context}`);
if (input) {
filtersChanged = true;
input.checked = true;
}
}
if (language && language !== "review_language_mine") {
const input = document.querySelector(`#${language}`);
if (input) {
filtersChanged = true;
input.checked = true;
}
}
// Playtime filters may not be available on apps with too few reviews
if (document.querySelector("#app_reviews_playtime_range_min") !== null
&& ((minPlaytime && minPlaytime !== "0") || (maxPlaytime && maxPlaytime !== "0"))
) {
filtersChanged = true;
const upperBound = 100;
const min = Number(minPlaytime);
/**
* No maximum means the upper bound, but is stored as 0
* https://github.com/SteamDatabase/SteamTracking/blob/9c64b223ab168c4ce4dacf14fccc3e527f5975ef/store.steampowered.com/public/javascript/game.js#L1651
*/
const max = Number(maxPlaytime);
// Update playtime silder text and hidden inputs (required, the rest are just for visuals)
UpdatePlaytimeFilterValues(min, max);
/**
* Update playtime preset checkbox state
* https://github.com/SteamDatabase/SteamTracking/blob/9c64b223ab168c4ce4dacf14fccc3e527f5975ef/store.steampowered.com/public/javascript/game.js#L1594
*/
$J("input[name=review_playtime_preset]").attr("checked", false); // uncheck all radio buttons
if (max === 0) {
$J(`#review_playtime_preset_${min}`).attr("checked", true);
}
/**
* Update playtime slider display
* https://github.com/SteamDatabase/SteamTracking/blob/9c64b223ab168c4ce4dacf14fccc3e527f5975ef/store.steampowered.com/public/javascript/game.js#L1608
*/
$J("#app_reviews_playtime_slider").slider("values", 0, min * 60 * 60);
$J("#app_reviews_playtime_slider").slider("values", 1, (max || upperBound) * 60 * 60);
}
if (!filtersChanged) { return; }
const loadingEl = document.querySelector("#Reviews_loading");
// Refresh displayed reviews if our script is ran after reviews have started loading
if (loadingEl.style.display === "none") {
oldShowFilteredReviews();
} else if (loadingEl.style.display === "block") {
new MutationObserver((mutations, observer) => {
observer.disconnect();
oldShowFilteredReviews();
}).observe(loadingEl, {"attributes": true});
}
})();
@@ -0,0 +1,6 @@
(function(){
const bcStore = window.uiBroadcastWatchStore;
if (bcStore && bcStore.m_activeVideo) {
bcStore.StopVideo(bcStore.m_activeVideo);
}
})();
@@ -0,0 +1,3 @@
(function(){
$J(window).trigger("resize");
})();
@@ -0,0 +1,9 @@
(function(){
$J(document).ajaxComplete((e, xhr, {url}) => {
const method = (url.endsWith("/") ? url.slice(0, -1) : url).split("/").pop();
if (method === "addtowishlist" || method === "removefromwishlist") {
const response = JSON.parse(xhr.responseText);
document.dispatchEvent(new CustomEvent("addRemoveWishlist", {detail: response.success}));
}
});
})();
@@ -0,0 +1,6 @@
(function(){
// https://github.com/SteamDatabase/SteamTracking/blob/cdf367ce61926a896fe54d710b3ed25d66d7e333/store.steampowered.com/public/javascript/game.js#L1785
window.ShowGotSteamModal = (steamUrl) => {
window.location.assign(steamUrl);
};
})();
@@ -0,0 +1,20 @@
(function(){
/*
* Run our customizer when GHomepage.bInitialRenderComplete is set to `true`
* https://github.com/SteamDatabase/SteamTracking/blob/d22d8df5db80e844f7ae1157dbb8b59532dfe4f8/store.steampowered.com/public/javascript/home.js#L432
*/
if (GHomepage.bInitialRenderComplete) {
document.dispatchEvent(new CustomEvent("renderComplete"));
return;
}
GHomepage = new Proxy(GHomepage, {
set(target, prop, value, ...args) {
if (prop === "bInitialRenderComplete" && value === true) {
document.dispatchEvent(new CustomEvent("renderComplete"));
}
return Reflect.set(target, prop, value, ...args);
}
});
})();
@@ -0,0 +1,42 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
const {collapseName, shouldCollapse} = params;
/*
* https://github.com/SteamDatabase/SteamTracking/blob/a4cdd621a781f2c95d75edecb35c72f6781c01cf/store.steampowered.com/public/javascript/searchpage.js#L927
* InitAutocollapse
*/
const prefs = GetCollapsePrefs();
const block = $J(`.search_collapse_block[data-collapse-name="${collapseName}"]`);
let collapsed;
if (typeof prefs[collapseName] === "undefined") {
prefs[collapseName] = false;
collapsed = false;
} else {
collapsed = prefs[collapseName];
}
collapsed = collapsed && shouldCollapse;
block.children(".block_content").css("height", "");
if (collapsed) {
block.addClass("collapsed");
block.children(".block_content").hide();
}
block.children(".block_header").on("click", () => {
if (block.hasClass("collapsed")) {
prefs[collapseName] = false;
block.children(".block_content").slideDown("fast");
} else {
prefs[collapseName] = true;
block.children(".block_content").slideUp("fast");
}
block.toggleClass("collapsed");
SaveCollapsePrefs(prefs);
});
})();
@@ -0,0 +1,84 @@
(function(){
/*
* The handler set by this function is triggered when the page that infiniscroll will display has changed
* https://github.com/SteamDatabase/SteamTracking/blob/71f26599625ed8b6af3c0e8968c3959405fab5ec/store.steampowered.com/public/javascript/searchpage.js#L614
*/
function setPageChangeHandler() {
const controller = InitInfiniteScroll.oController;
if (controller) {
const oldPageHandler = controller.m_fnPageChangedHandler;
controller.SetPageChangedHandler((...args) => {
oldPageHandler(...args);
document.dispatchEvent(new CustomEvent("searchCompleted", {detail: false}));
});
}
}
// https://github.com/SteamDatabase/SteamTracking/blob/8a120c6dc568670d718f077c735b321a1ac80a29/store.steampowered.com/public/javascript/searchpage.js#L264
const searchOld = window.ExecuteSearch;
window.ExecuteSearch = function(params) {
/*
* The ExecuteSearch function uses the global object g_rgCurrentParameters, that is
* filled by GatherSearchParameters(), and compares it to the new search parameters
* (the object passed to this function).
* If it detects that the two objects are different, it triggers a search request.
* Since the AS filters are all clientside, we don't want to do that and remove
* our added entries from the objects here.
* https://github.com/SteamDatabase/SteamTracking/blob/8a120c6dc568670d718f077c735b321a1ac80a29/store.steampowered.com/public/javascript/searchpage.js#L273
*/
const paramsCopy = {};
Object.assign(paramsCopy, params);
const currentAsParameters = {};
const asParameters = {};
for (const filter in g_rgCurrentParameters) {
if (filter.startsWith("as-")) {
currentAsParameters[filter] = g_rgCurrentParameters[filter];
delete g_rgCurrentParameters[filter];
}
}
for (const filter in params) {
if (filter.startsWith("as-")) {
asParameters[filter] = params[filter];
delete params[filter];
}
}
/*
* If our parameters have changed (this automatically means theirs have not, since
* during different states there is only one change in parameters), there won't be new results.
* Therefore we can already notify the content script that the search completed.
*/
if (Object.toQueryString(currentAsParameters) !== Object.toQueryString(asParameters)) {
document.dispatchEvent(new CustomEvent("searchCompleted", {detail: true}));
}
searchOld(params);
// Restore state such that the next comparison includes AS filters
g_rgCurrentParameters = paramsCopy;
};
// https://github.com/SteamDatabase/SteamTracking/blob/8a120c6dc568670d718f077c735b321a1ac80a29/store.steampowered.com/public/javascript/searchpage.js#L298
const searchCompletedOld = window.SearchCompleted;
window.SearchCompleted = function(...args) {
searchCompletedOld(...args);
// https://github.com/SteamDatabase/SteamTracking/blob/71f26599625ed8b6af3c0e8968c3959405fab5ec/store.steampowered.com/public/javascript/searchpage.js#L319
setPageChangeHandler();
// At this point the new results have been loaded and decorated (by the Dynamic Store)
document.dispatchEvent(new CustomEvent("searchCompleted", {detail: false}));
};
// https://github.com/SteamDatabase/SteamTracking/blob/71f26599625ed8b6af3c0e8968c3959405fab5ec/store.steampowered.com/public/javascript/searchpage.js#L463
setPageChangeHandler();
})();
@@ -0,0 +1,7 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
document.dispatchEvent("as_queryString", {
detail: Object.toQueryString(params)
});
})();
@@ -0,0 +1,6 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
// https://github.com/SteamDatabase/SteamTracking/blob/a4cdd621a781f2c95d75edecb35c72f6781c01cf/store.steampowered.com/public/javascript/searchpage.js#L217
UpdateUrl(params.params);
})();
@@ -0,0 +1,6 @@
(function(){
const params = JSON.parse(document.currentScript.dataset.params);
const {handler, detail} = params
document.dispatchEvent(new CustomEvent(handler, {detail}));
})();