Fix tabs
This commit is contained in:
parent
5d4b3fe298
commit
2059682fb5
1 changed files with 16 additions and 16 deletions
|
@ -27,28 +27,28 @@ mpv %URL:~0,1%%URL:~5,255%
|
||||||
**/
|
**/
|
||||||
|
|
||||||
window.addEventListener('click', function(ev) {
|
window.addEventListener('click', function(ev) {
|
||||||
var target = ev.target;
|
var target = ev.target;
|
||||||
while(!(target instanceof HTMLAnchorElement)) {
|
while(!(target instanceof HTMLAnchorElement)) {
|
||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
if(!target)
|
if(!target)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!target.href)
|
if(!target.href)
|
||||||
|
return;
|
||||||
|
var url = new URL(target.href);
|
||||||
|
if(url.protocol === 'mpv:')
|
||||||
return;
|
return;
|
||||||
var url = new URL(target.href);
|
|
||||||
if(url.protocol === 'mpv:')
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
if((url.origin === 'https://www.youtube.com' && url.pathname === '/watch')) {
|
if((url.origin === 'https://www.youtube.com' && url.pathname === '/watch')) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
var open = document.createElement('a');
|
var open = document.createElement('a');
|
||||||
open.href = 'https://flash.moe/mpv.php?url=' + encodeURIComponent(url.href);
|
open.href = 'https://flash.moe/mpv.php?url=' + encodeURIComponent(url.href);
|
||||||
open.target = '_blank';
|
open.target = '_blank';
|
||||||
document.body.appendChild(open);
|
document.body.appendChild(open);
|
||||||
open.click();
|
open.click();
|
||||||
document.body.removeChild(open);
|
document.body.removeChild(open);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
Loading…
Reference in a new issue