UI ve ikon güncellemesi
This commit is contained in:
@@ -8,10 +8,16 @@ const interceptExtensions = [
|
||||
|
||||
chrome.runtime.onInstalled.addListener(() => {
|
||||
chrome.contextMenus.create({
|
||||
id: "dm-link",
|
||||
title: "Download Manager ile İndir",
|
||||
id: "dm-download-link",
|
||||
title: "hDM ile indir",
|
||||
contexts: ["link"]
|
||||
});
|
||||
|
||||
chrome.contextMenus.create({
|
||||
id: "dm-grab-page",
|
||||
title: "Siteyi hDM ile incele",
|
||||
contexts: ["page", "link"]
|
||||
});
|
||||
});
|
||||
|
||||
chrome.downloads.onCreated.addListener((item) => {
|
||||
@@ -36,8 +42,7 @@ chrome.downloads.onCreated.addListener((item) => {
|
||||
});
|
||||
|
||||
chrome.contextMenus.onClicked.addListener((info, tab) => {
|
||||
if (info.menuItemId === "dm-link") {
|
||||
console.log("Context menu tıklandı, bridge'e gönderiliyor:", info.linkUrl);
|
||||
if (info.menuItemId === "dm-download-link") {
|
||||
chrome.runtime.sendNativeMessage(NATIVE_HOST, {
|
||||
action: "add_download",
|
||||
url: info.linkUrl
|
||||
@@ -48,5 +53,17 @@ chrome.contextMenus.onClicked.addListener((info, tab) => {
|
||||
console.log("Bridge Yanıtı:", response);
|
||||
}
|
||||
});
|
||||
} else if (info.menuItemId === "dm-grab-page") {
|
||||
const url = info.linkUrl || info.pageUrl;
|
||||
chrome.runtime.sendNativeMessage(NATIVE_HOST, {
|
||||
action: "open_grabber",
|
||||
url: url
|
||||
}, (response) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
console.error("Bridge Hatası:", chrome.runtime.lastError.message);
|
||||
} else {
|
||||
console.log("Bridge Yanıtı:", response);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user