-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
28 lines (26 loc) · 843 Bytes
/
Copy pathbackground.js
File metadata and controls
28 lines (26 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: "padloom-preview",
title: "Preview on Padloom Mouse Pad",
contexts: ["image"]
});
});
chrome.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId === "padloom-preview") {
// Sayfa başlığını da alalım ki neyle ilgili olduğunu anlayalım
chrome.tabs.sendMessage(tab.id, {
action: "showPreview",
imageUrl: info.srcUrl,
pageTitle: tab.title // Sayfanın başlığı (Örn: Warhammer 40k Wallpapers)
});
}
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "downloadImage") {
chrome.downloads.download({
url: request.url,
filename: 'padloom-custom-design.jpg',
saveAs: true
});
}
});