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) {
|
||||
var target = ev.target;
|
||||
while(!(target instanceof HTMLAnchorElement)) {
|
||||
var target = ev.target;
|
||||
while(!(target instanceof HTMLAnchorElement)) {
|
||||
target = target.parentNode;
|
||||
if(!target)
|
||||
if(!target)
|
||||
return;
|
||||
}
|
||||
if(!target.href)
|
||||
if(!target.href)
|
||||
return;
|
||||
var url = new URL(target.href);
|
||||
if(url.protocol === 'mpv:')
|
||||
return;
|
||||
var url = new URL(target.href);
|
||||
if(url.protocol === 'mpv:')
|
||||
return;
|
||||
|
||||
|
||||
if((url.origin === 'https://www.youtube.com' && url.pathname === '/watch')) {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var open = document.createElement('a');
|
||||
open.href = 'https://flash.moe/mpv.php?url=' + encodeURIComponent(url.href);
|
||||
open.target = '_blank';
|
||||
document.body.appendChild(open);
|
||||
open.click();
|
||||
document.body.removeChild(open);
|
||||
return false;
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
var open = document.createElement('a');
|
||||
open.href = 'https://flash.moe/mpv.php?url=' + encodeURIComponent(url.href);
|
||||
open.target = '_blank';
|
||||
document.body.appendChild(open);
|
||||
open.click();
|
||||
document.body.removeChild(open);
|
||||
return false;
|
||||
}
|
||||
}, true);
|
||||
|
|
Loading…
Reference in a new issue