From a49e28883df9a5b03475b71b1f086e8fb93369cf Mon Sep 17 00:00:00 2001 From: Rick Sanchez Date: Tue, 1 Oct 2024 09:04:35 +0330 Subject: [PATCH] add icons --- content.js | 34 +++++++++++++++++++++------------- icons/potplayer.png | Bin 0 -> 633 bytes icons/vlc.png | Bin 0 -> 738 bytes 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 icons/potplayer.png create mode 100644 icons/vlc.png diff --git a/content.js b/content.js index 4f9a0f8..afba4a9 100644 --- a/content.js +++ b/content.js @@ -2,24 +2,32 @@ document.querySelectorAll('a').forEach(function (link) { const href = link.getAttribute('href'); if (href && href.match(/\.(mp4|mkv|avi|mov)$/i)) { - // ایجاد دکمه VLC - let vlcButton = document.createElement('button'); - vlcButton.innerText = 'Play in VLC'; - vlcButton.style.margin = '0 5px'; - vlcButton.onclick = function () { + // ایجاد آیکون VLC + let vlcIcon = document.createElement('img'); + vlcIcon.src = chrome.runtime.getURL('icons/vlc.png'); // آدرس آیکون VLC + vlcIcon.alt = 'Play in VLC'; + vlcIcon.style.width = '20px'; + vlcIcon.style.height = '20px'; + vlcIcon.style.margin = '0 5px'; + vlcIcon.style.cursor = 'pointer'; + vlcIcon.onclick = function () { window.location.href = 'vlc://' + href; }; - // ایجاد دکمه PotPlayer - let potButton = document.createElement('button'); - potButton.innerText = 'Play in PotPlayer'; - potButton.style.margin = '0 5px'; - potButton.onclick = function () { + // ایجاد آیکون PotPlayer + let potIcon = document.createElement('img'); + potIcon.src = chrome.runtime.getURL('icons/potplayer.png'); // آدرس آیکون PotPlayer + potIcon.alt = 'Play in PotPlayer'; + potIcon.style.width = '20px'; + potIcon.style.height = '20px'; + potIcon.style.margin = '0 5px'; + potIcon.style.cursor = 'pointer'; + potIcon.onclick = function () { window.location.href = 'potplayer://' + href; }; - // اضافه کردن دکمه‌ها کنار لینک دانلود - link.parentNode.insertBefore(vlcButton, link.nextSibling); - link.parentNode.insertBefore(potButton, vlcButton.nextSibling); + // اضافه کردن آیکون‌ها کنار لینک دانلود + link.parentNode.insertBefore(vlcIcon, link.nextSibling); + link.parentNode.insertBefore(potIcon, vlcIcon.nextSibling); } }); diff --git a/icons/potplayer.png b/icons/potplayer.png new file mode 100644 index 0000000000000000000000000000000000000000..b7792f9b59229c96ac5b5060fc327e5453a7a3a4 GIT binary patch literal 633 zcmV-<0*3vGP)bU+>0NejXP&cb$g$jRb|HQ+Fgx#i-+RpaX4$7F<$X?xW`uyiCZLFU zttPu}I1XJd+Uz|31Nfj4oO4)NL|R)pU>F-kS#biwy$EiP>kkgqS%Ca;3-sr4x?);D zxYIByGx4+1>1YMtW+5AMiFq7}oz>RGNd4;XqH;-dP9e9TaHrPys`U`6OeKF+C3 zBex*8s_|sG2=Co7_{L1T?`5JWiz!TK%9m|pZ*@4Bg+5Q#%k-Wv#WPw&92!W^Ch z-*U3YS$!21$_)^fRBluYV_v{FXca|yG4S*ZBZCE<8YrDeP z$u4|7Sl6AwXtf}1Xq!eG-KMcSJL8+pZrp8_AYva3JNfp_H}8G#+W`MLSQ=JQ_#}*82P^Nu z=^?|FO32)K%;-99>Oi^kR>qzOFd^{4<5+O+;!%{*A^bLntG0;+{6qZWm>s-_hib2d zm}W>^mp8`PKvEQ69p3r^-`xW92+;q$ zi>Xi^BaRg+HXuAR2~*va&@4PbI>CK$JAmy>SVl@-sX&CakkIqNq(FC2qCRp8mRpD9 zd(a2+5Y@L}Y2FBm(@&t~CjvzLSjW!?R zTz?NglLu>VB=T4qp@?Z1xs`w4z}nL*sJD!u&7mwu(N>m-S(7$0HpRAW>I90=2BJM# zXJ#4J>1!CGL6mKdlEs64cIpBK?|dXVSmI32mQg+lJy(Wvz5@H~E%=Qpn4W>=6rlAv zl*=KHo`C$i+%+IAPN>>e=FLzQZ5=qYtOav;491ZWXqo;1V@$%BI2UvhnLAP8>uqom zmd)v!)v?cs4mn6S{BOPDS6 z<8oHRsNxbbolp%zebRJcwZXA?d