-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.js
More file actions
30 lines (25 loc) · 711 Bytes
/
sample.js
File metadata and controls
30 lines (25 loc) · 711 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
29
30
// Written by Bogdan Pshonyak & Mark Muego
// for CodeDay Seattle, Fall 2015.
var selText;
// The onClicked callback function.
function onClickHandler(info, tab) {
chrome.tabs.executeScript(
tab.id, {
code: 'getSel()',
allFrames: true
}
);
}
chrome.contextMenus.onClicked.addListener(onClickHandler);
// Set up context menu tree at install time.
chrome.runtime.onInstalled.addListener(function() {
// Create one test item for each context type.
var context = "selection";
var title = "Simplify Text!";
var id = chrome.contextMenus.create({
"title": title,
"contexts": [context],
"id": "context" + context
});
console.log("'" + context + "' item:" + id);
});