Skip to content

Commit

Permalink
Merge pull request #1858 from candela97/remove-add-to-cart-no-redirect
Browse files Browse the repository at this point in the history
Remove deprecated features, rework FPlayers
  • Loading branch information
tfedor authored Mar 15, 2024
2 parents 98d1f31 + 74bd761 commit 9f85e1a
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 404 deletions.
59 changes: 20 additions & 39 deletions src/css/augmentedsteam.css
Original file line number Diff line number Diff line change
Expand Up @@ -245,40 +245,6 @@ img.astats_icon {
background-color: #0003 !important;
}

.chart-stat {
float: left;
text-align: center;
width: 120px;
margin-top: 25px;
padding-left: 15px;
}
.chart-stat span {
font-size: 1.8em;
font-weight: 300;
}

.chart-content {
display: flex;
background-color: transparent;
width: 592px;
padding: 2px 12px;
overflow: hidden;
justify-content: space-between;
align-items: flex-end;
}

.chart-footer {
font-size: 11px;
float: right;
padding-top: 5px;
margin-bottom: 20px;
}

#steam-charts .chart-footer,
#steam-spy .chart-footer {
padding-right: 13px;
}

.es_each {
color: #626366;
font-size: 11px;
Expand Down Expand Up @@ -1201,6 +1167,21 @@ video.highlight_movie:hover + .html5_video_overlay {
font-size: 14px;
}

/***************************************
* App pages
* FPlayers
**************************************/
.as_players {
line-height: 20px;
}
.as_players_stat {
color: #8f98a0;
}
.as_players_num {
float: right;
color: #67c1f5;
}

/***************************************
* Store and Community
* add_language_warning(),
Expand Down Expand Up @@ -1966,8 +1947,8 @@ video.highlight_movie:hover + .html5_video_overlay {
}

/***************************************
* Store app pages
* addMetacriticUserScore(),addOpenCritic()
* App pages
* FMetacriticUserScore, FOpenCritic
**************************************/
#game_area_userscore {
margin-top: 6px;
Expand Down Expand Up @@ -2029,8 +2010,8 @@ video.highlight_movie:hover + .html5_video_overlay {
}

/***************************************
* Store app pages
* addBadgeProgress()
* App pages
* FBadgeProgress
**************************************/
.es_badges_progress_block .es_cards_numbers {
padding-top: 10px;
Expand All @@ -2054,7 +2035,7 @@ video.highlight_movie:hover + .html5_video_overlay {
}

/***************************************
* Store app pages
* App pages
* FDLCCheckboxes
**************************************/
#es_selected_btn {
Expand Down
5 changes: 1 addition & 4 deletions src/html/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ <h3 data-locale-text="options.store_general_thirdparty">Options for information
<div data-dynamic="showoc"></div>
<div data-dynamic="showhltb"></div>
<div data-dynamic="showwsgf"></div>
<div data-dynamic="show_steamchart_info"></div>
<div data-dynamic="show_steamspy_info"></div>
<div data-dynamic="show_survey_info"></div>
<div data-dynamic="show_players_info"></div>
<div data-dynamic="showastatslink"></div>
<div data-dynamic="showitadlinks"></div>
<div data-dynamic="showsteamdb"></div>
Expand All @@ -215,7 +213,6 @@ <h2 data-locale-text="options.general" class="js-section-head">General</h2>
<div data-dynamic="show_early_access"></div>
<div data-dynamic="show_alternative_linux_icon"></div>
<div data-dynamic="skip_got_steam"></div>
<div data-dynamic="addtocart_no_redirect"></div>
</div>
</div>

Expand Down
4 changes: 1 addition & 3 deletions src/js/Content/Features/Store/App/CApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {GameId} from "../../../../modulesCore";
import {Background, ContextType} from "../../../modulesContent";
import FMediaExpander from "../../Common/FMediaExpander";
import {CStoreBase} from "../Common/CStoreBase";
import FAddToCartNoRedirect from "../Common/FAddToCartNoRedirect";
import FCustomizer from "../Common/FCustomizer";
import FDRMWarnings from "../Common/FDRMWarnings";
import FExtraLinks from "../Common/FExtraLinks";
Expand Down Expand Up @@ -36,7 +35,7 @@ import FReplaceDevPubLinks from "./FReplaceDevPubLinks";
import FReviewToggleButton from "./FReviewToggleButton";
import FSaveReviewFilters from "./FSaveReviewFilters";
import FShowCoupon from "./FShowCoupon";
import FPlayers from "./FSteamChart";
import FPlayers from "./FPlayers";
import FSteamDeckCompatibility from "./FSteamDeckCompatibility";
import FSteamPeek from "./FSteamPeek";
import FSupportInfo from "./FSupportInfo";
Expand Down Expand Up @@ -96,7 +95,6 @@ export class CApp extends CStoreBase {
FDemoAbovePurchase,
FSaveReviewFilters,
FHideReportedTags,
FAddToCartNoRedirect,
FPatchHighlightPlayer,
FSteamDeckCompatibility,
FRemoveDupeScreenshots,
Expand Down
41 changes: 0 additions & 41 deletions src/js/Content/Features/Store/App/CustomizerFeature.js

This file was deleted.

37 changes: 9 additions & 28 deletions src/js/Content/Features/Store/App/FDLCCheckboxes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {HTML, Localization} from "../../../../modulesCore";
import {Feature, Price, User} from "../../../modulesContent";
import {AddToCart} from "../Common/AddToCart";
import {Feature, Price} from "../../../modulesContent";
import {Page} from "../../Page";

export default class FDLCCheckboxes extends Feature {

Expand Down Expand Up @@ -76,19 +76,12 @@ export default class FDLCCheckboxes extends Feature {
HTML.afterEnd(dlcSection.querySelector(".gameDlcBlocks"), html);
}

const cartForm = document.createElement("form");
cartForm.name = "add_selected_dlc_to_cart";
cartForm.action = "https://store.steampowered.com/cart/";
cartForm.method = "POST";

const subids = new Set();
const cartBtn = dlcSection.querySelector("#es_selected_btn");
cartBtn.before(cartForm);
cartBtn.addEventListener("click", async() => {
if (await AddToCart.checkFeatureHint()) {
AddToCart.post(cartForm);
} else {
cartForm.submit();
}
cartBtn.addEventListener("click", () => {
Page.runInPageContext((subids) => {
window.SteamFacade.addItemToCart(subids.length === 1 ? subids[0] : subids);
}, [Array.from(subids)]);
});

HTML.afterEnd(dlcSection.querySelector(".gradientbg"),
Expand Down Expand Up @@ -122,26 +115,14 @@ export default class FDLCCheckboxes extends Feature {
dlcSection.dispatchEvent(new Event("change"));
});

function createHiddenInput(name, value) {
const input = document.createElement("input");
input.type = "hidden";
input.name = name;
input.value = value;

return input;
}

const inputAction = createHiddenInput("action", "add_to_cart");
const inputSessionId = createHiddenInput("sessionid", User.sessionId);

dlcSection.addEventListener("change", () => {

cartForm.replaceChildren(inputAction, inputSessionId);
subids.clear();

let total = 0;
for (const node of dlcSection.querySelectorAll(".es_dlc_label > input:checked")) {

cartForm.append(createHiddenInput("subid[]", node.dataset.esDlcSubid));
subids.add(Number(node.dataset.esDlcSubid));

if (node.dataset.esDlcPrice) {
total += Number(node.dataset.esDlcPrice);
Expand Down
32 changes: 32 additions & 0 deletions src/js/Content/Features/Store/App/FPlayers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {HTML, Localization} from "../../../../modulesCore";
import {Feature} from "../../../modulesContent";

export default class FPlayers extends Feature {

async checkPrerequisites() {
if (this.context.isDlcLike || this.context.isVideoOrHardware) {
return false;
}

const result = await this.context.data;
if (!result || !result.players) {
return false;
}

this._data = result.players;
return true;
}

apply() {

HTML.afterBegin(".rightcol.game_meta_data",
`<div class="block responsive_apppage_details_right heading">${Localization.str.charts.current}</div>
<div class="block responsive_apppage_details_right as_players">
<div class="block_content_inner">
<div class="as_players_stat">${Localization.str.charts.playing_now}:<span class="as_players_num">${Number(this._data.recent)}</span></div>
<div class="as_players_stat">${Localization.str.charts.peaktoday}:<span class="as_players_num">${Number(this._data.peak_today)}</span></div>
<div class="as_players_stat">${Localization.str.charts.peakall}:<span class="as_players_num">${Number(this._data.peak_all)}</span></div>
</div>
</div>`);
}
}
32 changes: 0 additions & 32 deletions src/js/Content/Features/Store/App/FSteamChart.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/js/Content/Features/Store/Bundle/CBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {CStoreBase} from "../Common/CStoreBase";
import FExtraLinks from "../Common/FExtraLinks";
import FDRMWarnings from "../Common/FDRMWarnings";
import FITADPrices from "../Common/FITADPrices";
import FAddToCartNoRedirect from "../Common/FAddToCartNoRedirect";

export class CBundle extends CStoreBase {

Expand All @@ -14,7 +13,6 @@ export class CBundle extends CStoreBase {
FExtraLinks,
FDRMWarnings,
FITADPrices,
FAddToCartNoRedirect,
]);

this.bundleid = GameId.getBundleid(window.location.host + window.location.pathname);
Expand Down
Loading

0 comments on commit 9f85e1a

Please sign in to comment.