-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhex.js
70 lines (66 loc) · 1.66 KB
/
hex.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function hex2a(hexx) {
var hex = hexx.toString();//force conversion
for (i=0;i<hex.length;i++)
{
if (hex.substr(i, 1) == ' ')
hex = hex.substr(0, i) + hex.substr(i+1);
};
var str = '';
for (var i = 0; (i < hex.length && hex.substr(i, 2) !== '00'); i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
return str;
};
function getword2(info,tab) {
console.log("Word " + info.selectionText + " was clicked.");
var word ;
var tw ;
word = info.selectionText;
for (i=0;i<word.length;i++)
{
tw = word.substr(i, 1)
if (( tw === ' ') || (tw === '(') ||(tw ===')' ))
word = word.substr(0, i) + word.substr(i+1);
};
var tol = word.toLowerCase();
tol = tol.substr(0, 4) ;
if (tol === 'http') ;
else
word = 'http://' + word;
chrome.tabs.create({
url: word
})
}
function getword3(info,tab) {
console.log("Word2 " + info.selectionText + " was clicked.");
var word2 ;
word2 = info.selectionText;
word2 = 'https://nhentai.net/g/'+word2
chrome.tabs.create({
url: word2
})
}
function getword(info,tab) {
console.log("Word " + info.selectionText + " was clicked.");
var hexdc ;
hexdc = info.selectionText;
var hexdeco ;
hexdeco = hex2a(hexdc);
chrome.tabs.create({
url: hexdeco
})
}
chrome.contextMenus.create({
title: "Search by hexdecode",
contexts:["selection"],
onclick: getword
});
chrome.contextMenus.create({
title: "Search by del space,),(, ",
contexts:["selection"],
onclick: getword2
});
chrome.contextMenus.create({
title: "Search by nhentai",
contexts:["selection"],
onclick: getword3
});