Skip to content

Commit c83d31d

Browse files
authored
feat: Add <Open in Desktop App> button in header (#267)
* fix: quicksell panel renders on top of the item info * feat: open in desktop app * chore: remove extra blank line
1 parent c21a7b3 commit c83d31d

4 files changed

Lines changed: 45 additions & 2 deletions

File tree

_locales/en/messages.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@
601601
"message": "Hide \"Install Steam\" button in header",
602602
"description": "\"Install Steam\" should match what the button on Steam itself in the header says: https://store.steampowered.com/"
603603
},
604+
"options_enhancement_open_desktop_app_button": {
605+
"message": "Add a \"Open in Desktop App\" button in header"
606+
},
604607
"options_enhancement_hide_mobile_app_button": {
605608
"message": "Hide \"Open in Steam\" banner"
606609
},
@@ -665,7 +668,9 @@
665668
"options_builtin_achievements_csrating": {
666669
"message": "Display CS rating history on CS2 achievements page"
667670
},
668-
671+
"open_desktop_app": {
672+
"message": "Open in Desktop App"
673+
},
669674
"boostercreator_available_at_date": {
670675
"message": "You will not be able to create another Booster Pack for this game until $available_date$.",
671676
"description": "\"Booster Pack\" should match how Steam itself names it at: https://steamcommunity.com/tradingcards/boostercreator/",

options/options.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ <h3 data-msg="options_header_enhancements"></h3>
266266
<input type="checkbox" class="option-check" data-option="enhancement-hide-install-button" checked>
267267
<div data-msg="options_enhancement_hide_install_button"></div>
268268
</label>
269+
<label class="checkbox">
270+
<input type="checkbox" class="option-check" data-option="enhancement-open-desktop-app-button">
271+
<div data-msg="options_enhancement_open_desktop_app_button"></div>
272+
</label>
269273
<label class="checkbox">
270274
<input type="checkbox" class="option-check" data-option="enhancement-hide-mobile-app-button">
271275
<div data-msg="options_enhancement_hide_mobile_app_button"></div>

scripts/global.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ document.title === 'We Broke It' )
2121
}
2222
else
2323
{
24-
GetOption( { 'enhancement-hide-install-button': true, 'enhancement-no-linkfilter': false }, ( items ) =>
24+
GetOption( {
25+
'enhancement-hide-install-button': true,
26+
'enhancement-open-desktop-app-button': false,
27+
'enhancement-no-linkfilter': false
28+
}, ( items ) =>
2529
{
2630
if( items[ 'enhancement-hide-install-button' ] )
2731
{
@@ -35,6 +39,20 @@ else
3539
}
3640
}
3741

42+
if( items[ 'enhancement-open-desktop-app-button' ] )
43+
{
44+
const installSteamBtn = document.querySelector( '.header_installsteam_btn' );
45+
46+
if( installSteamBtn )
47+
{
48+
const button = document.createElement( 'a' );
49+
button.className = 'steamdb_open_desktop_app';
50+
button.href = 'steam://openurl/' + window.location;
51+
button.textContent = _t( 'open_desktop_app' );
52+
installSteamBtn.insertAdjacentElement( 'afterend', button );
53+
}
54+
}
55+
3856
if( items[ 'enhancement-no-linkfilter' ] )
3957
{
4058
/** @type {NodeListOf<HTMLAnchorElement>} */

styles/global.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@
4949
.steamdb_trade_error_explained:hover {
5050
text-decoration: underline;
5151
}
52+
53+
.steamdb_open_desktop_app {
54+
display: inline-block;
55+
padding: 0 9px;
56+
margin-left: 4px;
57+
background-color: #5c7e10;
58+
color: #e5e4dc;
59+
60+
&:hover {
61+
background-color: #6c9018;
62+
color: #fff;
63+
transition-property: background;
64+
transition-duration: 250ms;
65+
cursor: pointer;
66+
}
67+
}

0 commit comments

Comments
 (0)