kiến thức Tổng hợp những addon chất cho Firefox / Chromium

Cập nhập Handlers dành cho MPV, hỗ trợ thêm rất nhiều tính năng khi so sánh với phiên bản trước đó, cách sử dụng cũng nhẹ nhàng hơn :D

Nếu các bạn thấy lỗi báo cho mình bởi mình chưa có test kỹ.

Tính năng:
  • Kéo thả link qua bên tay phải để mở qua MPV, kéo qua tay trái để mở qua streamlink, kéo xuống dưới để tải với yt-dlp
  • Hỗ trợ thêm streamlink và yt-dlp
  • Nhẹ và đơn giản hơn so với code cũ gấp tỉ lần, rất dễ cho việc phát triển thêm từ phía các bạn chứ không chỉ mình
  • Có thể tùy ý thêm tính năng nếu các bạn muốn, bởi script này hỗ trợ 8 hướng

Video demo: https://streamable.com/o3sxe1
Cài đặt:
1. Từ addon quản lý Userscript như Violent/Fire/Tamplermonkey, tạo script mới rồi paste chỗ này vào, Save.
JavaScript:
// ==UserScript==
// @name        Handlers Helper
// @namespace   Violentmonkey Scripts
// @match       http*://*/*
// @grant       none
// @version     1.0
// @author      -
// @description Helper for protocol_hook.lua
// ==/UserScript==

(function () {
function GM_btoaUrl(url) {
    return btoa(url).replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
}

    function EA(attr, type) {
        if (attr.startsWith('http')) {
            url = attr;
        }
        if (url == '') {
            var url = location.href;
        }
        var subs = '';
        var s = url;

            var app = 'play';
            if (type != 'vid') {
                var app = type.toLowerCase();
            }
            var bs = GM_btoaUrl(s);
            var url2 = 'mpv://' + app + '/' + bs + '/' + "?referer=" + GM_btoaUrl(location.href);
            if (subs != '') {
                url2 = url2 + '?subs=' + GM_btoaUrl(subs);
            }
            //alert(url2);
            location.href = url2;
    }

    function getDirection(x, y, cx, cy) {
        /*=================
        |                 |
        | 1↖   2↑   3↗ |
        |                 |
        | 4←    5    6→ |
        |                 |
        | 7↙   8↓   9↘ |
        |                 |
        |=================*/
        let d, t;
        if ((cx - x) >= -50 && (cx - x) <= 50 && (cy - y) >= -50 && (cy - y) <= 50) {return 5;}
        if (4 == 4) { //4 directions
            if (Math.abs(cx - x) < Math.abs(cy - y)) {
                d = cy > y ? "8" : "2";
            } else {
                d = cx > x ? "6" : "4";
            }
        } else { //8 directions
            t = (cy - y) / (cx - x);
            if (-0.4142 <= t && t < 0.4142) d = cx > x ? '6' : "4";
            else if (2.4142 <= t || t < -2.4142) d = cy > y ? '8' : '2';
            else if (0.4142 <= t && t < 2.4142) d = cx > x ? '9' : '1';
            else d = cy > y ? '7' : '3';
        }
        return d;
    }
    document.addEventListener('dragstart', function (e) {
        console.log('dragstart');
        var x1 = e.clientX;
        var y1 = e.clientY;
        var dragend = document.addEventListener('dragend', function doEA(e) {
            var x2 = e.clientX;
            var y2 = e.clientY;
            var direction = getDirection(x1, y1, x2, y2);
            //if ((x2 - x1) >= -50 && (x2 - x1) <= 50 && (y2 - y1) >= -50 && (y2 - y1) <= 50) {direction = 5;console.log(5);}
            //if (e.target.nodeName == "A" && e.target.href.match(/youtube.com|youtu.be|streamable.com/)) {
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                window.open(e.target.href, '_blank');
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }
            //}
            console.log(direction);
            this.removeEventListener('dragend', doEA);
        }, false);
    }, false);
})();

2. Tài file protocol_hook.zip bên dưới vào thẳng folder scripts của MPV, giải nén Extract Here.
3. Mở file protocol_hook.lua bằng Notepad rồi tìm dòng local cwd = 'D:/mpv', nếu thư mục chứa MPV của các bạn khác cái này thì tự sửa lại, nhớ dùng / phân cách các phần đường dẫn để đảm bảo tính tương thích nhiều hệ điều hành, giống của mình bên trên ấy.

4. Làm theo phần cài handlers.json ở đây nếu chưa làm.

Thưởng thức thôi.
Lua api có thể lấy được environment variable nên mấy cái path đó chỉ nên để làm giá trị fallback khi người dùng chưa thêm vào env chứ hardcoded hết nó khá dở.
 
Lua api có thể lấy được environment variable nên mấy cái path đó chỉ nên để làm giá trị fallback khi người dùng chưa thêm vào env chứ hardcoded hết nó khá dở.
Mình không phải dân lua nên cái này chắc phải đọc API, làm quả if env...then...env...else...path cho fallback chắc là ok đó nhỉ, tuy nhiên hiện tại vẫn chưa biết bắt đầu từ đâu, nói chung cứ từ từ rồi tính thôi :D
 
@toi la gay :sosad: nhưng cái link mà m3u8 downloader lấy được thì lại không hoạt động, bác có cao kiến gì không?

Mợ mấy ông pháp sư Trung Hoa cho M3U8 dùng shadowRoot cách ly với trang web, phải chơi trò cục súc mới qua, đã cập nhập lại script ở post trên.

Trang test: http://blog.luckly-mjw.cn/tool-show/media-source-extract/example/index.html
Script M3U8 của bạn @boscofz : https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/post-23935535
Kết quả: https://streamable.com/9wv1en

Script mới:
JavaScript:
// ==UserScript==
// @name        Handlers Helper
// @namespace   Violentmonkey Scripts
// @match       http*://*/*
// @grant       none
// @version     1.1
// @author      -
// @description Helper for protocol_hook.lua
// ==/UserScript==

function attachDrag(elem) {

function GM_btoaUrl(url) {
    return btoa(url).replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
}

    function EA(attr, type) {
        console.log(attr, type)
        if (attr.startsWith('http')) {
            url = attr;
        }
        if (url == '') {
            var url = location.href;
        }
        var subs = '';
        var s = url;

            var app = 'play';
            if (type != 'vid') {
                var app = type.toLowerCase();
            }
            var bs = GM_btoaUrl(s);
            var url2 = 'mpv://' + app + '/' + bs + '/' + "?referer=" + GM_btoaUrl(location.href);
            if (subs != '') {
                url2 = url2 + '?subs=' + GM_btoaUrl(subs);
            }
            //alert(url2);
            location.href = url2;
    }

    function getDirection(x, y, cx, cy) {
        /*=================
        |                 |
        | 1↖   2↑   3↗ |
        |                 |
        | 4←    5    6→ |
        |                 |
        | 7↙   8↓   9↘ |
        |                 |
        |=================*/
        let d, t;
        if ((cx - x) >= -50 && (cx - x) <= 50 && (cy - y) >= -50 && (cy - y) <= 50) {return 5;}
        if (4 == 4) { //4 directions
            if (Math.abs(cx - x) < Math.abs(cy - y)) {
                d = cy > y ? "8" : "2";
            } else {
                d = cx > x ? "6" : "4";
            }
        } else { //8 directions
            t = (cy - y) / (cx - x);
            if (-0.4142 <= t && t < 0.4142) d = cx > x ? '6' : "4";
            else if (2.4142 <= t || t < -2.4142) d = cy > y ? '8' : '2';
            else if (0.4142 <= t && t < 2.4142) d = cx > x ? '9' : '1';
            else d = cy > y ? '7' : '3';
        }
        return d;
    }
    elem.addEventListener('dragstart', function (e) {
        //console.log(e.target);
        //console.log(e.target.shadowRoot);
        /*if (e.target.nodeName != "A") {
        e.stopPropagation();
        e.stopImmediatePropagation();
        //e.preventDefault();
        }*/
        console.log('dragstart');
        var x1 = e.clientX;
        var y1 = e.clientY;
        var dragend = elem.addEventListener('dragend', function doEA(e) {
            var x2 = e.clientX;
            var y2 = e.clientY;
            var direction = getDirection(x1, y1, x2, y2);
            //if ((x2 - x1) >= -50 && (x2 - x1) <= 50 && (y2 - y1) >= -50 && (y2 - y1) <= 50) {direction = 5;console.log(5);}
            //if (e.target.nodeName == "A" && e.target.href.match(/youtube.com|youtu.be|streamable.com/)) {
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                window.open(e.target.href, '_blank');
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }
            //}
            console.log(direction);
            this.removeEventListener('dragend', doEA);
        }, false);
    }, false);
}

attachDrag(document)
var attachedeles = [];
document.addEventListener('mouseover', function(e) {
  if (e.target.shadowRoot) {
    if (attachedeles.includes(e.target) == false) {
      console.log(attachedeles);
      attachedeles.push(e.target);
      attachDrag(e.target.shadowRoot);
    }
  }
});
 
Script mới nhìn ngon quá. + Tín dụng cho Khầy Gầy
CGeMDAV.gif
 
Mợ mấy ông pháp sư Trung Hoa cho M3U8 dùng shadowRoot cách ly với trang web, phải chơi trò cục súc mới qua, đã cập nhập lại script ở post trên.

Trang test: http://blog.luckly-mjw.cn/tool-show/media-source-extract/example/index.html
Script M3U8 của bạn @boscofz : https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/post-23935535
Kết quả: https://streamable.com/9wv1en

Script mới:
JavaScript:
// ==UserScript==
// @name        Handlers Helper
// @namespace   Violentmonkey Scripts
// @match       http*://*/*
// @grant       none
// @version     1.1
// @author      -
// @description Helper for protocol_hook.lua
// ==/UserScript==

function attachDrag(elem) {

function GM_btoaUrl(url) {
    return btoa(url).replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
}

    function EA(attr, type) {
        console.log(attr, type)
        if (attr.startsWith('http')) {
            url = attr;
        }
        if (url == '') {
            var url = location.href;
        }
        var subs = '';
        var s = url;

            var app = 'play';
            if (type != 'vid') {
                var app = type.toLowerCase();
            }
            var bs = GM_btoaUrl(s);
            var url2 = 'mpv://' + app + '/' + bs + '/' + "?referer=" + GM_btoaUrl(location.href);
            if (subs != '') {
                url2 = url2 + '?subs=' + GM_btoaUrl(subs);
            }
            //alert(url2);
            location.href = url2;
    }

    function getDirection(x, y, cx, cy) {
        /*=================
        |                 |
        | 1↖   2↑   3↗ |
        |                 |
        | 4←    5    6→ |
        |                 |
        | 7↙   8↓   9↘ |
        |                 |
        |=================*/
        let d, t;
        if ((cx - x) >= -50 && (cx - x) <= 50 && (cy - y) >= -50 && (cy - y) <= 50) {return 5;}
        if (4 == 4) { //4 directions
            if (Math.abs(cx - x) < Math.abs(cy - y)) {
                d = cy > y ? "8" : "2";
            } else {
                d = cx > x ? "6" : "4";
            }
        } else { //8 directions
            t = (cy - y) / (cx - x);
            if (-0.4142 <= t && t < 0.4142) d = cx > x ? '6' : "4";
            else if (2.4142 <= t || t < -2.4142) d = cy > y ? '8' : '2';
            else if (0.4142 <= t && t < 2.4142) d = cx > x ? '9' : '1';
            else d = cy > y ? '7' : '3';
        }
        return d;
    }
    elem.addEventListener('dragstart', function (e) {
        //console.log(e.target);
        //console.log(e.target.shadowRoot);
        /*if (e.target.nodeName != "A") {
        e.stopPropagation();
        e.stopImmediatePropagation();
        //e.preventDefault();
        }*/
        console.log('dragstart');
        var x1 = e.clientX;
        var y1 = e.clientY;
        var dragend = elem.addEventListener('dragend', function doEA(e) {
            var x2 = e.clientX;
            var y2 = e.clientY;
            var direction = getDirection(x1, y1, x2, y2);
            //if ((x2 - x1) >= -50 && (x2 - x1) <= 50 && (y2 - y1) >= -50 && (y2 - y1) <= 50) {direction = 5;console.log(5);}
            //if (e.target.nodeName == "A" && e.target.href.match(/youtube.com|youtu.be|streamable.com/)) {
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                window.open(e.target.href, '_blank');
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }
            //}
            console.log(direction);
            this.removeEventListener('dragend', doEA);
        }, false);
    }, false);
}

attachDrag(document)
var attachedeles = [];
document.addEventListener('mouseover', function(e) {
  if (e.target.shadowRoot) {
    if (attachedeles.includes(e.target) == false) {
      console.log(attachedeles);
      attachedeles.push(e.target);
      attachDrag(e.target.shadowRoot);
    }
  }
});
ngon rồi bác ơi
q67Gd9d.png
 
Mợ mấy ông pháp sư Trung Hoa cho M3U8 dùng shadowRoot cách ly với trang web, phải chơi trò cục súc mới qua, đã cập nhập lại script ở post trên.

Trang test: http://blog.luckly-mjw.cn/tool-show/media-source-extract/example/index.html
Script M3U8 của bạn @boscofz : https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/post-23935535
Kết quả: https://streamable.com/9wv1en

Script mới:
JavaScript:
// ==UserScript==
// @name        Handlers Helper
// @namespace   Violentmonkey Scripts
// @match       http*://*/*
// @grant       none
// @version     1.1
// @author      -
// @description Helper for protocol_hook.lua
// ==/UserScript==

function attachDrag(elem) {

function GM_btoaUrl(url) {
    return btoa(url).replace(/\//g, "_").replace(/\+/g, "-").replace(/\=/g, "");
}

    function EA(attr, type) {
        console.log(attr, type)
        if (attr.startsWith('http')) {
            url = attr;
        }
        if (url == '') {
            var url = location.href;
        }
        var subs = '';
        var s = url;

            var app = 'play';
            if (type != 'vid') {
                var app = type.toLowerCase();
            }
            var bs = GM_btoaUrl(s);
            var url2 = 'mpv://' + app + '/' + bs + '/' + "?referer=" + GM_btoaUrl(location.href);
            if (subs != '') {
                url2 = url2 + '?subs=' + GM_btoaUrl(subs);
            }
            //alert(url2);
            location.href = url2;
    }

    function getDirection(x, y, cx, cy) {
        /*=================
        |                 |
        | 1↖   2↑   3↗ |
        |                 |
        | 4←    5    6→ |
        |                 |
        | 7↙   8↓   9↘ |
        |                 |
        |=================*/
        let d, t;
        if ((cx - x) >= -50 && (cx - x) <= 50 && (cy - y) >= -50 && (cy - y) <= 50) {return 5;}
        if (4 == 4) { //4 directions
            if (Math.abs(cx - x) < Math.abs(cy - y)) {
                d = cy > y ? "8" : "2";
            } else {
                d = cx > x ? "6" : "4";
            }
        } else { //8 directions
            t = (cy - y) / (cx - x);
            if (-0.4142 <= t && t < 0.4142) d = cx > x ? '6' : "4";
            else if (2.4142 <= t || t < -2.4142) d = cy > y ? '8' : '2';
            else if (0.4142 <= t && t < 2.4142) d = cx > x ? '9' : '1';
            else d = cy > y ? '7' : '3';
        }
        return d;
    }
    elem.addEventListener('dragstart', function (e) {
        //console.log(e.target);
        //console.log(e.target.shadowRoot);
        /*if (e.target.nodeName != "A") {
        e.stopPropagation();
        e.stopImmediatePropagation();
        //e.preventDefault();
        }*/
        console.log('dragstart');
        var x1 = e.clientX;
        var y1 = e.clientY;
        var dragend = elem.addEventListener('dragend', function doEA(e) {
            var x2 = e.clientX;
            var y2 = e.clientY;
            var direction = getDirection(x1, y1, x2, y2);
            //if ((x2 - x1) >= -50 && (x2 - x1) <= 50 && (y2 - y1) >= -50 && (y2 - y1) <= 50) {direction = 5;console.log(5);}
            //if (e.target.nodeName == "A" && e.target.href.match(/youtube.com|youtu.be|streamable.com/)) {
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                window.open(e.target.href, '_blank');
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }
            //}
            console.log(direction);
            this.removeEventListener('dragend', doEA);
        }, false);
    }, false);
}

attachDrag(document)
var attachedeles = [];
document.addEventListener('mouseover', function(e) {
  if (e.target.shadowRoot) {
    if (attachedeles.includes(e.target) == false) {
      console.log(attachedeles);
      attachedeles.push(e.target);
      attachDrag(e.target.shadowRoot);
    }
  }
});
kéo thả kiểu gì để mở qua mpv vậy thím, mình đang dùng add on dùng cử chỉ kéo thả chuột để đóng mở tab có ảnh hưởng ko thím
 
kéo thả kiểu gì để mở qua mpv vậy thím, mình đang dùng add on dùng cử chỉ kéo thả chuột để đóng mở tab có ảnh hưởng ko thím
Kéo thả link ấy, kiểu thấy link Youtube kéo xoẹt phát qua tay phải, thấy link Twitch kéo phát qua trái, thấy link muốn chiếm đoạt kéo phát xuống dưới như clip demo.

Còn addon không gây ảnh hưởng vì script của mình dùng chuột trái kéo, addon dùng phải, trên lý thuyết là nước sông không phạm nước giếng.
 
Kéo thả link ấy, kiểu thấy link Youtube kéo xoẹt phát qua tay phải, thấy link Twitch kéo phát qua trái, thấy link muốn chiếm đoạt kéo phát xuống dưới như clip demo.

Còn addon không gây ảnh hưởng vì script của mình dùng chuột trái kéo, addon dùng phải, trên lý thuyết là nước sông không phạm nước giếng.
mình cũng dùng add on kéo link bằng chuột trái thì mở link qua tab mới, như kiểu lướt voz thấy topic nào hay kéo link để xem dần :pudency:
edit: tắt add on đó đi cũng ko kéo đc, ko biết sai ở đâu, file handler mình copy y nguyên của thím
 
mình cũng dùng add on kéo link bằng chuột trái thì mở link qua tab mới, như kiểu lướt voz thấy topic nào hay kéo link để xem dần :pudency:
Thế thì bị phạm nước giếng rồi, hai cái nó oánh nhau thì chắc mình không làm gì được, chắc phải dùng bản cũ của script này thôi: https://voz.vn/t/tong-hop-nhung-addon-chat-cho-firefox-pc-mobile.682181/post-27172396

Bản cũ thì ấn Alt+Chuột phải vào link để mở ra cái menu, chậm hơn chút nhưng mà không dính dáng gì tới 99% addon hay script, mình cố tình cho nó dùng Alt là để vậy, thật ra sửa thành Ctrl cũng ok đó, phần altKey trong script trên sửa thành ctrlKey
 
edit: tắt add on đó đi cũng ko kéo đc, ko biết sai ở đâu, file handler mình copy y nguyên của thím
Thử kiểm tra lại các thao tác cài đặt xem, nãy mình vừa thử ở profile mới thành công.

Chú ý đường dẫn tới thư mục MPV nhé, mặc định là D:\mpv, cần sửa lại cho phù hợp với đường dẫn trong máy.
 
Thử kiểm tra lại các thao tác cài đặt xem, nãy mình vừa thử ở profile mới thành công.

Chú ý đường dẫn tới thư mục MPV nhé, mặc định là D:\mpv, cần sửa lại cho phù hợp với đường dẫn trong máy.
thử ở profile mới thì đc mà profile cũ ko đc thím à, để ý ở profile mới nó có hỏi mở trong cửa sổ mới hay đại loại gì đó hay ko nhưng ở profile cũ ko thấy hỏi
 
thử ở profile mới thì đc mà profile cũ ko đc thím à, để ý ở profile mới nó có hỏi mở trong cửa sổ mới hay đại loại gì đó hay ko nhưng ở profile cũ ko thấy hỏi
Vậy nếu trường hợp này nghĩa là chắc chắn đường dẫn đúng, handlers.json đúng thì đoán do script/addon nào đó tắt mất khả năng kéo thả.
 
Vậy nếu trường hợp này nghĩa là chắc chắn đường dẫn đúng, handlers.json đúng thì đoán do script/addon nào đó tắt mất khả năng kéo thả.
file handler của profile cũ có vấn đề thím à, cái add on có cho phép ngoại lệ trang web ko dùng tác vụ kéo thả đc mà bị cái giờ kéo để mở link (không phải link mở video) thì nó cứ đòi mở bằng mpv, chắc phải lựa chọn dùng 1 trong 2 rồi :pudency:
 
file handler của profile cũ có vấn đề thím à, cái add on có cho phép ngoại lệ trang web ko dùng tác vụ kéo thả đc mà bị cái giờ kéo để mở link (không phải link mở video) thì nó cứ đòi mở bằng mpv, chắc phải lựa chọn dùng 1 trong 2 rồi :pudency:
Hoặc biến luôn Handers Helper thành addon trên, tuy nhiên sẽ phải tự mod lại phần này:

Code:
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                window.open(e.target.href, '_blank');
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }

Script của mình kéo lên nghĩa là mở sang tab mới, nhưng mà nên dùng GM_openInTab (https://wiki.greasespot.net/GM.openInTab) vì nó hỗ trợ mở sang tab nền mà không bị chuyển tab.

// @grant none sửa thành // @grant GM_openInTab

Code:
            if (direction == 6) { //right
                console.log('MPV :' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'vid');
            } else if (direction == 4) { //left
                console.log('Streamlink: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'stream');
            } else if (direction == 2) { //up
                console.log('Open: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                GM_openInTab(e.target.href);
            } else if (direction == 8) { //down
                console.log('YTDL: ' + e.target.href);
                console.log(x1, y1, x2, y2, direction);
                EA(e.target.href, 'ytdl');
            }

Ngoài ra tự thêm các tính năng khác, nhưng đóng tab thì không làm được với Userscript do hạn chế API.

Sửa if (4 == 4) { //4 directions thành if (8 == 4) { //4 directions để bật 8 hướng cho script, mặc định chỉ 4 hướng cho nó đơn giản.

Hướng:
Code:
        /*=================
        |                 |
        | 1↖   2↑   3↗ |
        |                 |
        | 4←    5    6→ |
        |                 |
        | 7↙   8↓   9↘ |
        |                 |
        |=================*/

Nói chung hiện tại mình chỉ cứu được tính năng kéo mở tab nếu muốn bỏ addon kia.
 
Cập nhập thông tin về Floorp bản mới sắp tới 11.4.0, Private Container (chính là giống addon Temporary Container), nghĩa là cái container sẽ tự xóa trắng sau khi tắt đi mở lại:


Và Profile Switcher để không phải vào about:profiles nữa:


Đang hóng native tải đa luồng với PWA.

Cũng hóng tiếp Floorp nó lên Firefox 117 hay 118 để hưởng lợi vụ tăng tốc của Firefox, Floorp hiện tại là dựa trên Firefox ESR 115, và nó đã nhanh gấp x2 115, nếu nó hấp thụ tinh túy từ 117 và 118 thì khó mà tưởng tượng.
 
Back
Top