-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheventPage.js
More file actions
28 lines (26 loc) · 849 Bytes
/
eventPage.js
File metadata and controls
28 lines (26 loc) · 849 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
//Creating a Context Menu
var menuItem = {
"id": "CopyTracker",
"title": "Copy to Copy Tracker",
"contexts": ["selection"]
};
chrome.contextMenus.create(menuItem);
chrome.contextMenus.onClicked.addListener((data)=>{
if(data.menuItemId=="CopyTracker"){
let copys = new Array();
chrome.storage.sync.get(['copyTracker','limit'], function(result) {
if(result.copyTracker!= undefined){
copys = (result.copyTracker);
}
//To keep maintain the limit
let lim = result.limit!=undefined?result.limit:10;
let no = copys.length;
while(no>=lim){
copys.shift();
no--;
}
copys.push(data.selectionText);
chrome.storage.sync.set({"copyTracker": copys});
});
}
})