Skip to content

Commit 8bd3139

Browse files
committed
Add ProtonDB button
1 parent 30ccbb1 commit 8bd3139

File tree

7 files changed

+149
-1
lines changed

7 files changed

+149
-1
lines changed

_locales/en/messages.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"view_on_pcgamingwiki": {
3434
"message": "View on PCGamingWiki"
3535
},
36+
"view_on_protondb": {
37+
"message": "View on ProtonDB"
38+
},
3639
"view_your_achievements": {
3740
"message": "Personal achievements"
3841
},
@@ -553,6 +556,9 @@
553556
"options_button_pcgw": {
554557
"message": "Display PCGamingWiki button on product pages"
555558
},
559+
"options_button_protondb": {
560+
"message": "Display ProtonDB button on product pages"
561+
},
556562
"options_button_sub": {
557563
"message": "Display a button on package pages"
558564
},

_locales/fr/messages.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"view_on_pcgamingwiki": {
3232
"message": "Voir sur PCGamingWiki"
3333
},
34+
"view_on_protondb": {
35+
"message": "Voir sur ProtonDB"
36+
},
3437
"view_your_achievements": {
3538
"message": "Succès personnels"
3639
},
@@ -531,6 +534,9 @@
531534
"options_button_pcgw": {
532535
"message": "Afficher le bouton PCGamingWiki sur les pages des produits"
533536
},
537+
"options_button_protondb": {
538+
"message": "Afficher le bouton ProtonDB sur les pages des produits"
539+
},
534540
"options_button_sub": {
535541
"message": "Afficher un bouton sur les pages des packages"
536542
},

icons/protondb.svg

Lines changed: 42 additions & 0 deletions
Loading

manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171

7272
"icons/white.svg",
7373
"icons/pcgamingwiki.svg",
74+
"icons/protondb.svg",
7475
"icons/steamhunters.svg",
7576
"icons/image.svg",
7677
"icons/achievements_completed.svg",

options/options.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ <h3 data-msg="options_header_buttons_and_links"></h3>
122122
<input type="checkbox" class="option-check" data-option="button-pcgw" checked>
123123
<div data-msg="options_button_pcgw"></div>
124124
</label>
125+
<label class="checkbox">
126+
<input type="checkbox" class="option-check" data-option="button-protondb" checked>
127+
<div data-msg="options_button_protondb"></div>
128+
</label>
125129
<label class="checkbox">
126130
<input type="checkbox" class="option-check" data-option="button-sub" checked>
127131
<div data-msg="options_button_sub"></div>

scripts/community/gamehub.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
GetOption( {
55
'button-gamehub': true,
66
'button-pcgw': true,
7+
'button-protondb': true,
78
}, ( items ) =>
89
{
910
const container = document.querySelector( '.apphub_OtherSiteInfo' );
@@ -69,7 +70,7 @@ GetOption( {
6970
{
7071
const link = document.createElement( 'a' );
7172
link.className = 'btnv6_blue_hoverfade btn_medium btn_steamdb';
72-
link.href = 'https://pcgamingwiki.com/api/appid.php?appid=' + GetCurrentAppID() + '&utm_source=SteamDB';
73+
link.href = 'https://pcgamingwiki.com/api/appid.php?appid=' + GetCurrentAppID() + '?utm_source=SteamDB';
7374

7475
const element = document.createElement( 'span' );
7576
element.dataset.tooltipText = _t( 'view_on_pcgamingwiki' );
@@ -93,5 +94,34 @@ GetOption( {
9394
responsiveMenu.append( link.cloneNode( true ) );
9495
}
9596
}
97+
98+
if( items[ 'button-protondb' ] )
99+
{
100+
const link = document.createElement( 'a' );
101+
link.className = 'btnv6_blue_hoverfade btn_medium btn_steamdb';
102+
link.href = 'https://www.protondb.com/app/' + GetCurrentAppID() + '?utm_source=SteamDB';
103+
104+
const element = document.createElement( 'span' );
105+
element.dataset.tooltipText = _t( 'view_on_protondb' );
106+
link.appendChild( element );
107+
108+
const image = document.createElement( 'img' );
109+
image.className = 'ico16';
110+
image.src = GetLocalResource( 'icons/protondb.svg' );
111+
112+
element.appendChild( image );
113+
114+
container.insertBefore( link, container.firstChild );
115+
116+
container.insertBefore( document.createTextNode( ' ' ), link.nextSibling );
117+
118+
const responsiveMenu = document.querySelector( '.apphub_ResponsiveMenuCtn' );
119+
120+
if( responsiveMenu )
121+
{
122+
responsiveMenu.append( document.createTextNode( ' ' ) );
123+
responsiveMenu.append( link.cloneNode( true ) );
124+
}
125+
}
96126
}
97127
} );

scripts/store/app.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ else
1414
GetOption( {
1515
'button-app': true,
1616
'button-pcgw': true,
17+
'button-protondb': true,
1718
'link-subid': true,
1819
'online-stats': true,
1920
'steamdb-lowest-price': true,
@@ -185,6 +186,64 @@ else
185186
}
186187
}
187188

189+
if( items[ 'button-protondb' ] )
190+
{
191+
let container = document.querySelector( '.apphub_OtherSiteInfo' );
192+
193+
if( !container )
194+
{
195+
// Steam China has no community hub
196+
const headerStandardTop = document.querySelector( '.apphub_HeaderStandardTop' );
197+
198+
if( headerStandardTop )
199+
{
200+
container = document.createElement( 'div' );
201+
container.className = 'apphub_OtherSiteInfo';
202+
headerStandardTop.prepend( container );
203+
}
204+
}
205+
206+
if( container )
207+
{
208+
const link = document.createElement( 'a' );
209+
link.className = 'btnv6_blue_hoverfade btn_medium btn_steamdb';
210+
link.href = 'https://www.protondb.com/app/' + GetCurrentAppID() + '?utm_source=SteamDB';
211+
212+
const element = document.createElement( 'span' );
213+
element.dataset.tooltipText = _t( 'view_on_protondb' );
214+
link.appendChild( element );
215+
216+
const image = document.createElement( 'img' );
217+
image.className = 'ico16';
218+
image.src = GetLocalResource( 'icons/protondb.svg' );
219+
220+
element.appendChild( image );
221+
222+
container.insertBefore( link, container.firstChild );
223+
container.insertBefore( document.createTextNode( ' ' ), link.nextSibling );
224+
}
225+
226+
const lastLinkBar = document.querySelector( '#appDetailsUnderlinedLinks .linkbar:last-child' );
227+
228+
if( lastLinkBar )
229+
{
230+
const link = document.createElement( 'a' );
231+
link.className = 'linkbar linkbar_steamdb';
232+
link.href = 'https://www.protondb.com/app/' + GetCurrentAppID() + '?utm_source=SteamDB';
233+
234+
const image = document.createElement( 'img' );
235+
image.src = GetLocalResource( 'icons/protondb.svg' );
236+
link.append( image );
237+
238+
const span = document.createElement( 'span' );
239+
span.className = 'social_account';
240+
span.textContent = _t( 'view_on_protondb' );
241+
link.append( span );
242+
243+
lastLinkBar.insertAdjacentElement( 'afterend', link );
244+
}
245+
}
246+
188247
if( items[ 'link-subid' ] )
189248
{
190249
// Find each "add to cart" button

0 commit comments

Comments
 (0)