Skip to content

Commit 0d76825

Browse files
committed
Remove daily reward claim button
1 parent 7c66eba commit 0d76825

File tree

3 files changed

+0
-234
lines changed

3 files changed

+0
-234
lines changed

_locales/en/messages.json

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -186,40 +186,6 @@
186186
"explore_finished": {
187187
"message": "Queue has been explored."
188188
},
189-
"explore_saleitem_claim": {
190-
"message": "Claim reward"
191-
},
192-
"explore_saleitem_claim_description": {
193-
"message": "Claim the free daily reward if there is one."
194-
},
195-
"explore_saleitem_trying_to_claim": {
196-
"message": "Claiming the daily reward…"
197-
},
198-
"explore_saleitem_cant_claim": {
199-
"message": "No daily reward to claim at this moment."
200-
},
201-
"explore_saleitem_next_item_time": {
202-
"message": "Next item available: $datetime$",
203-
"placeholders": {
204-
"datetime": {
205-
"content": "$1",
206-
"example": "01.07.2024, 20:00:00",
207-
"description": "Date and time format depends on locale set in browser"
208-
}
209-
}
210-
},
211-
"explore_saleitem_claim_failed": {
212-
"message": "Failed to claim the daily reward."
213-
},
214-
"explore_saleitem_success": {
215-
"message": "New reward claimed: $item$.",
216-
"placeholders": {
217-
"item": {
218-
"content": "$1",
219-
"example": "Unicorn Sticker"
220-
}
221-
}
222-
},
223189

224190
"badges_idle_apps": {
225191
"message": "Apps to idle: $amount$",

scripts/store/explore.js

Lines changed: 0 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@ if( !accessToken || !applicationConfig )
2929
let exploreButton;
3030
/** @type {HTMLElement} */
3131
let exploreStatus;
32-
/** @type {HTMLElement} */
33-
let itemButton;
34-
/** @type {HTMLElement} */
35-
let itemStatus;
36-
/** @type {HTMLImageElement} */
37-
let itemImage;
3832

39-
CreateSaleItemContainer();
4033
CreateExploreContainer();
4134

4235
function CreateExploreContainer()
@@ -81,50 +74,6 @@ function CreateExploreContainer()
8174
}, false );
8275
}
8376

84-
function CreateSaleItemContainer()
85-
{
86-
const buttonContainer = document.createElement( 'div' );
87-
buttonContainer.className = 'steamdb_saleitem_claim discovery_queue_customize_ctn';
88-
89-
itemButton = document.createElement( 'div' );
90-
itemButton.className = 'btnv6_blue_hoverfade btn_medium btn_disabled';
91-
const span = document.createElement( 'span' );
92-
span.textContent = _t( 'explore_saleitem_claim' );
93-
itemButton.append( span );
94-
buttonContainer.append( itemButton );
95-
96-
itemStatus = document.createElement( 'div' );
97-
itemStatus.className = 'steamdb_cheat_queue_text';
98-
itemStatus.textContent = _t( 'explore_saleitem_cant_claim' );
99-
buttonContainer.append( itemStatus );
100-
101-
itemImage = document.createElement( 'img' );
102-
itemImage.src = GetLocalResource( 'icons/white.svg' );
103-
itemImage.width = 32;
104-
itemImage.height = 32;
105-
itemImage.style.opacity = '0';
106-
buttonContainer.append( itemImage );
107-
108-
const container = document.querySelector( '.discovery_queue_customize_ctn' );
109-
container.parentNode.insertBefore( buttonContainer, container );
110-
111-
itemButton.addEventListener( 'click', ( ) =>
112-
{
113-
if( itemButton.classList.contains( 'btn_disabled' ) )
114-
{
115-
return;
116-
}
117-
118-
StartViewTransition( () =>
119-
{
120-
itemButton.classList.add( 'btn_disabled' );
121-
ClaimSaleItem();
122-
} );
123-
}, false );
124-
125-
CheckClaimSaleItem();
126-
}
127-
12877
function GenerateQueue( generateFails = 0 )
12978
{
13079
const valveQueueEl = document.getElementById( 'discovery_queue_ctn' );
@@ -258,152 +207,6 @@ function GenerateQueue( generateFails = 0 )
258207
} );
259208
}
260209

261-
/**
262-
* @param {Record<string, any>} response
263-
*/
264-
function HandleSaleItemResponse( response )
265-
{
266-
if( response.next_claim_time )
267-
{
268-
const dateFormatter = new Intl.DateTimeFormat( GetLanguage(), {
269-
dateStyle: 'medium',
270-
timeStyle: 'short',
271-
} );
272-
const nextClaimTime = dateFormatter.format( response.next_claim_time * 1000 );
273-
274-
itemStatus.textContent += ' ' + _t( 'explore_saleitem_next_item_time', [ nextClaimTime.toLocaleString() ] );
275-
276-
const timer = ( response.next_claim_time * 1000 ) - Date.now();
277-
278-
setTimeout( () =>
279-
{
280-
itemStatus.textContent = _t( 'explore_saleitem_claim_description' );
281-
itemButton.classList.remove( 'btn_disabled' );
282-
}, timer );
283-
}
284-
285-
if( response.reward_item?.community_item_data )
286-
{
287-
const item = response.reward_item.community_item_data;
288-
const file = item.item_image_small || item.item_image_large;
289-
itemImage.src = `${applicationConfig.MEDIA_CDN_COMMUNITY_URL}images/items/${response.reward_item.appid}/${file}`;
290-
itemImage.title = item.item_title;
291-
itemImage.style.opacity = '1';
292-
}
293-
}
294-
295-
function CheckClaimSaleItem( fails = 0 )
296-
{
297-
const params = new URLSearchParams();
298-
params.set( 'origin', location.origin );
299-
params.set( 'access_token', accessToken );
300-
params.set( 'language', applicationConfig.LANGUAGE );
301-
302-
fetch( `${applicationConfig.WEBAPI_BASE_URL}ISaleItemRewardsService/CanClaimItem/v1/?${params.toString()}` )
303-
.then( ( response ) =>
304-
{
305-
if( !response.ok )
306-
{
307-
throw new Error( `HTTP ${response.status}` );
308-
}
309-
310-
return response.json();
311-
} )
312-
.then( ( data ) =>
313-
{
314-
const response = data.response;
315-
316-
StartViewTransition( () =>
317-
{
318-
if( response.can_claim )
319-
{
320-
itemStatus.textContent = _t( 'explore_saleitem_claim_description' );
321-
itemButton.classList.remove( 'btn_disabled' );
322-
return;
323-
}
324-
325-
itemStatus.textContent = _t( 'explore_saleitem_cant_claim' );
326-
327-
HandleSaleItemResponse( response );
328-
} );
329-
} )
330-
.catch( ( error ) =>
331-
{
332-
WriteLog( 'Failed to find out if a sale item can be claimed', error );
333-
334-
if( ++fails >= 5 )
335-
{
336-
itemStatus.textContent = _t( 'explore_saleitem_cant_claim' );
337-
return;
338-
}
339-
340-
setTimeout( () =>
341-
{
342-
CheckClaimSaleItem( fails );
343-
}, RandomInt( 5000, 10000 ) );
344-
} );
345-
}
346-
347-
function ClaimSaleItem( fails = 0 )
348-
{
349-
itemStatus.textContent = _t( 'explore_saleitem_trying_to_claim' );
350-
351-
const params = new URLSearchParams();
352-
params.set( 'origin', location.origin );
353-
params.set( 'access_token', accessToken );
354-
params.set( 'language', applicationConfig.LANGUAGE );
355-
356-
fetch(
357-
`${applicationConfig.WEBAPI_BASE_URL}ISaleItemRewardsService/ClaimItem/v1/?${params.toString()}`,
358-
{
359-
method: 'POST',
360-
},
361-
)
362-
.then( ( response ) =>
363-
{
364-
if( !response.ok )
365-
{
366-
throw new Error( `HTTP ${response.status}` );
367-
}
368-
369-
return response.json();
370-
} )
371-
.then( ( data ) =>
372-
{
373-
const response = data.response;
374-
375-
if( !response || !response.communityitemid )
376-
{
377-
fails = 10; // If there is no item to claim the response is just empty
378-
throw new Error( 'Unexpected response' );
379-
}
380-
381-
StartViewTransition( () =>
382-
{
383-
const itemTitle = response.reward_item?.community_item_data?.item_title;
384-
itemStatus.textContent = _t( 'explore_saleitem_success', [ itemTitle || `ID #${response.communityitemid}` ] );
385-
386-
HandleSaleItemResponse( response );
387-
} );
388-
} )
389-
.catch( ( error ) =>
390-
{
391-
WriteLog( 'Failed to get a sale item', error );
392-
393-
if( ++fails >= 5 )
394-
{
395-
itemButton.classList.remove( 'btn_disabled' );
396-
itemStatus.textContent = _t( 'explore_saleitem_claim_failed' );
397-
return;
398-
}
399-
400-
setTimeout( () =>
401-
{
402-
ClaimSaleItem( fails );
403-
}, RandomInt( 5000, 10000 ) );
404-
} );
405-
}
406-
407210
/**
408211
* @param {number} min
409212
* @param {number} max

styles/store.css

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ a.steamdb_rating:hover {
238238
margin: 0;
239239
}
240240

241-
.steamdb_saleitem_claim,
242241
.steamdb_cheat_queue {
243242
display: flex;
244243
align-items: center;
@@ -250,7 +249,6 @@ a.steamdb_rating:hover {
250249
border-bottom: 0;
251250
}
252251

253-
.steamdb_saleitem_claim .btn_medium,
254252
.steamdb_cheat_queue .btn_medium {
255253
margin: 0;
256254
}
@@ -267,7 +265,6 @@ a.steamdb_rating:hover {
267265
}
268266

269267
@media (max-width: 500px) {
270-
.steamdb_saleitem_claim,
271268
.steamdb_cheat_queue {
272269
flex-wrap: wrap;
273270
}

0 commit comments

Comments
 (0)