forked from siko/youdaonote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoudaonote.js
25 lines (20 loc) · 890 Bytes
/
youdaonote.js
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
// Copyright (c) 2012 [email protected]. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
function YoudaoNoteOnClick(info, tab) {
console.log(JSON.stringify(info));
console.log("Youdao Note " + info.menuItemId +
" was clicked, state is now: " + info.checked +
"(previous state was " + info.wasChecked + ")");
CLIP_HOST='http://note.youdao.com/yws';
try{
var x=document.createElement('SCRIPT');
x.type='text/javascript';
x.src=CLIP_HOST+'/YNoteClipper.js?'+(new Date().getTime()/100000);
x.charset='utf-8';
document.getElementsByTagName('head')[0].appendChild(x);
}
catch(e){alert(e);}
}
var youdaonote = chrome.contextMenus.create(
{"title": "Add to Youdao Note", "type": "normal", "onclick":YoudaoNoteOnClick})
console.log("youdaonote:" + youdaonote);