Prerequisites
I tried to reproduce the issue when...
Description
I'm using trusted-click-element to auto-click the high-quality "trial mode" toast on Bilibili for unlogged users.
www.bilibili.com##+js(trusted-click-element, '.bpx-player-toast-wrap .bpx-player-toast-confirm-login, .bpx-player-control-wrap .bpx-player-ctrl-quality-menu-wrap .bpx-player-ctrl-quality-menu-item[data-value="80"]', !cookie:/^DedeUserID=/)
The primary issue is that trusted-click-element only triggers once. It works perfectly on the first video, but when clicking a new video on the same page (SPA navigation), the scriptlet fails to click the new toast.
To test this, I used a Violentmonkey script to hook Object.defineProperty and Object.defineProperties to force-enable the trial mode for every video (since set-constant / trusted-set aren't suitable for this specific scenario). With the hook active, the toast successfully appears on the new video, but the click rule does not click it.
www.bilibili.com##+js(trusted-set, Object.prototype.expStore.isLoginTrialToastExpActive, true) // might break some features.
www.bilibili.com##+js(trusted-set, Object.prototype.isLoginTrialToastExpActive, true) // not work for this case.
www.bilibili.com##+js(trusted-set, Object.prototype.isViewToday, true) // not work for this case.
Questions:
- Is it possible to update
trusted-click-element so it re-triggers after SPA navigations?
- If not, would you ever consider adding a
set-desc trusted-set-desc scriptlet for scenarios requiring Object.defineProperty, Object.defineProperties hooks?
example.com##+js(set-desc, ownerMatch, propMatch, descMatch(get/set/value), constant(replace the get/set/value))
example.com##+js(trusted-set-desc, ownerMatch, propMatch, descMatch(get/set/value), constant(replace the get/set/value))
www.bilibili.com##+js(trusted-set-desc, , isViewToday, isLoginTrialToastExpActive, trueFunc)
Feel free to close this if it's out of scope or if there are no plans for it. Thanks for everything you do!
A specific URL where the issue occurs.
https://www.bilibili.com/video/BV1CDYg69EGL
Steps to Reproduce
(Note: To reproduce this, you must use a userscript to hook Object.defineProperty, Object.defineProperties so the trial toast is forced to appear on subsequent videos. Without the hook, the toast will not show for the new video at all, so the click failure cannot be observed).
- Open the URL in a private window (unlogged).
- Add this rule:
www.bilibili.com##+js(trusted-click-element, '.bpx-player-toast-wrap .bpx-player-toast-confirm-login, .bpx-player-control-wrap .bpx-player-ctrl-quality-menu-wrap .bpx-player-ctrl-quality-menu-item[data-value="80"]', !cookie:/^DedeUserID=/)
- Inject a script (e.g., via Violentmonkey) to hook
Object.defineProperty, Object.defineProperties so the trial mode is forced on for every video.
- Load the page. Notice the rule successfully auto-clicks the trial toast.
- Click a related video on the right sidebar (triggers SPA navigation).
- The trial toast successfully appears for the new video (due to the hook).
- Notice the
trusted-click-element rule does not click the toast this time.
Expected behavior
trusted-click-element should re-arm/trigger again for dynamically loaded elements after SPA navigation.
Actual behavior
trusted-click-element only fires once per page load.
Configuration
Details
uBlock Origin: 1.74.1b7
Firefox: 158
filterset (summary):
network: 0
cosmetic: 0
scriptlet: 0
html: 0
listset (total-discarded, last-updated):
removed:
ublock-filters: null
ublock-badware: null
ublock-privacy: null
ublock-unbreak: null
ublock-quick-fixes: null
easylist: null
easyprivacy: null
urlhaus-1: null
plowe-0: null
default:
user-filters: 0-0, never
filterset (user): [empty]
switchRuleset:
added: [array of 6 redacted]
hostRuleset:
added: [array of 643 redacted]
userSettings:
advancedUserEnabled: true
cloudStorageEnabled: true
cnameUncloakEnabled: false
userFiltersTrusted: true
hiddenSettings:
allowGenericProceduralFilters: true
extensionUpdateForceReload: true
filterAuthorMode: true
trustedListPrefixes: ublock- user- https://raw.githubusercontent.com/JoviDong/
updateAssetBypassBrowserCache: true
supportStats:
allReadyAfter: 187 ms
maxAssetCacheWait: 16 ms
cacheBackend: indexedDB
Prerequisites
I tried to reproduce the issue when...
Description
I'm using
trusted-click-elementto auto-click the high-quality "trial mode" toast on Bilibili for unlogged users.The primary issue is that
trusted-click-elementonly triggers once. It works perfectly on the first video, but when clicking a new video on the same page (SPA navigation), the scriptlet fails to click the new toast.To test this, I used a Violentmonkey script to hook
Object.definePropertyandObject.definePropertiesto force-enable the trial mode for every video (sinceset-constant/trusted-setaren't suitable for this specific scenario). With the hook active, the toast successfully appears on the new video, but the click rule does not click it.Questions:
trusted-click-elementso it re-triggers after SPA navigations?set-desctrusted-set-descscriptlet for scenarios requiringObject.defineProperty,Object.definePropertieshooks?Feel free to close this if it's out of scope or if there are no plans for it. Thanks for everything you do!
A specific URL where the issue occurs.
https://www.bilibili.com/video/BV1CDYg69EGLSteps to Reproduce
(Note: To reproduce this, you must use a userscript to hook
Object.defineProperty,Object.definePropertiesso the trial toast is forced to appear on subsequent videos. Without the hook, the toast will not show for the new video at all, so the click failure cannot be observed).Object.defineProperty,Object.definePropertiesso the trial mode is forced on for every video.trusted-click-elementrule does not click the toast this time.Expected behavior
trusted-click-elementshould re-arm/trigger again for dynamically loaded elements after SPA navigation.Actual behavior
trusted-click-elementonly fires once per page load.Configuration
Details