Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

won't always work #15

Open
i300220 opened this issue Dec 26, 2020 · 0 comments
Open

won't always work #15

i300220 opened this issue Dec 26, 2020 · 0 comments

Comments

@i300220
Copy link

i300220 commented Dec 26, 2020

Let me explain.

2 issuse here:

1- If the link doesn't exist in the page when the extension is loaded. i.e. if the youtube link is created dynamically in the dom afterwards, it doesn't work and the youtube page is getting fired nevertheless.

What would be required I think is something like that (untested) , fired out periodically.

var cnt = 0;
function manClick(){
var loadNewhref = $("A");
if(loadNewhref.length)
{
if (cnt > 0) return;
cnt++;
loadNewhref.click(
function() {
setTimeout(
function() {
window.addEventListener("click", (event) => {
checkUrl(event);
});
cnt = 0;
window.setInterval(manClick, 30000);
},
20000);
});
window.clearInterval(manClick);
}
};

window.setInterval(manClick, 30000);

2- Also this section in your original code fails sometimes:
if (target.href.includes('youtube.com') || target.href.includes('youtu.be') || target.href.includes('hooktube.com')){
window.stop();
e.stopImmediatePropagation();
e.preventDefault();
let url = 'freetube://' + target.href;
console.log(url);
window.location = url;
return false;
}
}

The youtube windows is fired nevertheless, th freetube does not open, or worst, both start playing simultaneously.

Would be happy to assist.

Here's an example where it fails. I don't think th link will be valid for a long time halas:
https://www.upwork.com/jobs/Create-own-indicator-from-someone-else-indicator-software_~01d3b31336d39f8df2/

Go there and click the youtube link. A youtube window will opn and freetube never open.

Best regards,
Marccel

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant