From f40ae1fd6c69f6d40fae2304bea6832059deb05e Mon Sep 17 00:00:00 2001 From: Jack Nolddor <1280022+nolddor@users.noreply.github.com> Date: Fri, 27 Jun 2025 19:44:09 +0200 Subject: [PATCH 1/4] fix: enhancement-no-linkfilter does not check port --- scripts/global.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/global.js b/scripts/global.js index 7479c06ec..12594a7c8 100644 --- a/scripts/global.js +++ b/scripts/global.js @@ -38,7 +38,7 @@ else if( items[ 'enhancement-no-linkfilter' ] ) { /** @type {NodeListOf} */ - const links = document.querySelectorAll( 'a[href^="https://steamcommunity.com/linkfilter/"]' ); + const links = document.querySelectorAll( 'a[href^="https://steamcommunity.com/linkfilter/"], a[href^="https://steamcommunity.com:/linkfilter/"]' ); for( const link of links ) { From 1ffb96f4d0e05fb83e9a4da7e6f99636836611fc Mon Sep 17 00:00:00 2001 From: Jack Nolddor <1280022+nolddor@users.noreply.github.com> Date: Sat, 28 Jun 2025 10:40:19 +0200 Subject: [PATCH 2/4] Revert "fix: enhancement-no-linkfilter does not check port" This reverts commit f40ae1fd6c69f6d40fae2304bea6832059deb05e. --- scripts/global.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/global.js b/scripts/global.js index 12594a7c8..7479c06ec 100644 --- a/scripts/global.js +++ b/scripts/global.js @@ -38,7 +38,7 @@ else if( items[ 'enhancement-no-linkfilter' ] ) { /** @type {NodeListOf} */ - const links = document.querySelectorAll( 'a[href^="https://steamcommunity.com/linkfilter/"], a[href^="https://steamcommunity.com:/linkfilter/"]' ); + const links = document.querySelectorAll( 'a[href^="https://steamcommunity.com/linkfilter/"]' ); for( const link of links ) { From 40083216fac17731ec35ac478042db26af674692 Mon Sep 17 00:00:00 2001 From: Jack Nolddor <1280022+nolddor@users.noreply.github.com> Date: Sat, 28 Jun 2025 11:03:28 +0200 Subject: [PATCH 3/4] feat: omit linkfilter page --- manifest.json | 12 ++++++++++++ scripts/community/linkfilter.js | 21 +++++++++++++++++++++ scripts/community/linkfilter_injected.js | 18 ++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 scripts/community/linkfilter.js create mode 100644 scripts/community/linkfilter_injected.js diff --git a/manifest.json b/manifest.json index 3eb91a46a..75a6a8fb9 100644 --- a/manifest.json +++ b/manifest.json @@ -73,6 +73,7 @@ "scripts/community/inventory.js", "scripts/community/agecheck_injected.js", + "scripts/community/linkfilter_injected.js", "scripts/community/filedetails_award_injected.js", "scripts/community/market_injected.js", "scripts/community/multibuy_injected.js", @@ -570,6 +571,17 @@ "scripts/community/agecheck.js" ] }, + { + "run_at": "document_start", + "matches": + [ + "https://steamcommunity.com/linkfilter/*" + ], + "js": + [ + "scripts/community/linkfilter.js" + ] + }, { "all_frames": true, "matches": diff --git a/scripts/community/linkfilter.js b/scripts/community/linkfilter.js new file mode 100644 index 000000000..7b8f286f0 --- /dev/null +++ b/scripts/community/linkfilter.js @@ -0,0 +1,21 @@ +'use strict'; + +GetOption( { 'enhancement-no-linkfilter': false }, ( items ) => +{ + if( items[ 'enhancement-no-linkfilter' ] ) + { + const element = document.createElement( 'script' ); + element.id = 'steamdb_skip_linkfilter'; + element.type = 'text/javascript'; + element.src = GetLocalResource( 'scripts/community/linkfilter_injected.js' ); + + if( document.head ) + { + document.head.insertBefore( element, document.head.firstChild ); + } + else + { + document.documentElement.appendChild( element ); + } + } +} ); diff --git a/scripts/community/linkfilter_injected.js b/scripts/community/linkfilter_injected.js new file mode 100644 index 000000000..3140f8e68 --- /dev/null +++ b/scripts/community/linkfilter_injected.js @@ -0,0 +1,18 @@ +'use strict'; + +( ( () => +{ + if( window.location && window.location.search ) + { + const params = new URLSearchParams( window.location.search ); + + if( params.has( 'u' ) ) + { + window.location.replace( params.get( 'u' ) ); + } + else if( params.has( 'url' ) ) + { + window.location.replace( params.get( 'url' ) ); + } + } +} )() ); From e2e8855993297ef706f2a94477137c9f7ff591e3 Mon Sep 17 00:00:00 2001 From: Jack Nolddor <1280022+nolddor@users.noreply.github.com> Date: Sat, 28 Jun 2025 14:39:58 +0200 Subject: [PATCH 4/4] fix: get rid of unnecessary inject --- manifest.json | 1 - scripts/community/linkfilter.js | 22 +++++++++++----------- scripts/community/linkfilter_injected.js | 18 ------------------ 3 files changed, 11 insertions(+), 30 deletions(-) delete mode 100644 scripts/community/linkfilter_injected.js diff --git a/manifest.json b/manifest.json index 75a6a8fb9..ce845138c 100644 --- a/manifest.json +++ b/manifest.json @@ -73,7 +73,6 @@ "scripts/community/inventory.js", "scripts/community/agecheck_injected.js", - "scripts/community/linkfilter_injected.js", "scripts/community/filedetails_award_injected.js", "scripts/community/market_injected.js", "scripts/community/multibuy_injected.js", diff --git a/scripts/community/linkfilter.js b/scripts/community/linkfilter.js index 7b8f286f0..0ec2fe3b8 100644 --- a/scripts/community/linkfilter.js +++ b/scripts/community/linkfilter.js @@ -4,18 +4,18 @@ GetOption( { 'enhancement-no-linkfilter': false }, ( items ) => { if( items[ 'enhancement-no-linkfilter' ] ) { - const element = document.createElement( 'script' ); - element.id = 'steamdb_skip_linkfilter'; - element.type = 'text/javascript'; - element.src = GetLocalResource( 'scripts/community/linkfilter_injected.js' ); - - if( document.head ) - { - document.head.insertBefore( element, document.head.firstChild ); - } - else + if( window.location && window.location.search ) { - document.documentElement.appendChild( element ); + const params = new URLSearchParams( window.location.search ); + + if( params.has( 'u' ) ) + { + window.location.replace( params.get( 'u' ) ); + } + else if( params.has( 'url' ) ) + { + window.location.replace( params.get( 'url' ) ); + } } } } ); diff --git a/scripts/community/linkfilter_injected.js b/scripts/community/linkfilter_injected.js deleted file mode 100644 index 3140f8e68..000000000 --- a/scripts/community/linkfilter_injected.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -( ( () => -{ - if( window.location && window.location.search ) - { - const params = new URLSearchParams( window.location.search ); - - if( params.has( 'u' ) ) - { - window.location.replace( params.get( 'u' ) ); - } - else if( params.has( 'url' ) ) - { - window.location.replace( params.get( 'url' ) ); - } - } -} )() );