-
-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update functions.js click is always user_interacted #2431
Conversation
hi! @raszpl,
user_interactedthis could ignore clicks on whitespaces (usually by mistake): if (!user_interacted){
if (!/^(primary|secondary|below|masthead|dismissible|panels|chat-container|donation-shelf|player-ads|guide-content)$/.test(event.target.id)
&& !/^body|YTD-(TWO-COLUMN-BROWSE-RESULTS|SEARCH|GUIDE-ENTRY|MINI-GUIDE|REEL-SHELF|WATCH-NEXT-SECONDARY-RESULTS|AD-SLOT)-RENDERER$/.test(event.target.tagName)
){
user_interacted=true
} and for
meant: let PageTime = 0;
function setPageTime() { PageTime = Date.now(); }
document.addEventListener('DOMContentLoaded', setPageTime);
window.addEventListener('load', setPageTime);
window.addEventListener('focus', setPageTime);
window.addEventListener('popstate', setPageTime);
let urlEarlier = location.href.split(/[?#]/)[0];
function checkUrlChange() { const URLnow = location.href.split(/[?#]/)[0];
if (URLnow !== URLearlier) { URLearlier = URLnow; setPageTime(); }
};
setInterval(checkUrlChange, 300); (to be included in our existing event listeners and or consider youtube's events too like they do) |
As long as user clicked any key or mouse it should be enough a signal, this is how all "disable autoplay" extensions I looked into do it. It doesnt really matter where user clicked, click = stop forcing Pause.
after #2384 (comment) I rather you not directly edit my patches and push them under my name :P
The issue is it now requires waiting for player to load, in my testing I would start loading /watch page, click in the spot where video was being rendered and .. nothing would happen because user_interacted wasnt flipped true by my click just because I clicked a split second too early.
#2421 (comment)
"Every time I see a workaround with setimeout its another problem"
What is the reason for that checkUrlChange running constantly in the background? we dont have problem with detecting YT URL change. Anyway all the pausing pains are going away when I finish cooking my local changes. Instead of trapping |
💡 |
that can be called
we can implement more details.
not what i said.
universal example code.
both of our lines say the same. |
No conditions, let user always override pausing. #2042 (comment)