Skip to content

Commit

Permalink
add icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick Sanchez committed Oct 1, 2024
1 parent 9dc0141 commit a49e288
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Binary file added icons/potplayer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/vlc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a49e288

Please sign in to comment.