Skip to content

Commit

Permalink
user_interacted #2177
Browse files Browse the repository at this point in the history
  • Loading branch information
ImprovedTube authored May 6, 2024
1 parent 89932d1 commit e56ddb2
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions js&css/web-accessible/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,21 +454,19 @@ ImprovedTube.onkeydown = function () {
}, true);
};

ImprovedTube.onmousedown = function (event) {

window.addEventListener('mousedown', function (event) {
if (ImprovedTube.elements.player && ImprovedTube.elements.player.classList.contains('ad-showing') === false) {
var path = event.composedPath();

for (var i = 0, l = path.length; i < l; i++) {
if (path[i].className
&& path[i].className.indexOf
&& (path[i].className.indexOf('html5-video-container') !== -1
|| path[i].className.indexOf('ytp-play-button') !== -1)) {
ImprovedTube.user_interacted = true;
ImprovedTube.onmousedown = function (event) {
window.addEventListener('mousedown', function (event) {
if (!ImprovedTube.user_interacted) {
setTimeout(function(){ImprovedTube.user_interacted = true},800);
if (ImprovedTube.elements.player && ImprovedTube.elements.player.classList.contains('ad-showing') === false) {
var path = event.composedPath();
for (var i = 0, l = path.length; i < l; i++) {
if (path[i].className
// && path[i].className.indexOf
&& (/html5-(main-video|video-container)|ytp-play-button/.test(path[i].className))
) {ImprovedTube.user_interacted = true;}
}
}

}
}
}, true);
};
Expand Down

0 comments on commit e56ddb2

Please sign in to comment.