-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
94 lines (89 loc) · 2.56 KB
/
background.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//var i18n = chrome.i18n.getMessage;
var info = {
about: 'register',
// name: i18n('extName'),
name: 'Lojban',
unit: 'word',
first: 1,
badge: "JBO",
items: {
classes: ['loj', 'eng', 'def', 'raf1', 'raf2', 'raf3'],
// names: [i18n('char'), i18n('charcode')],
name: ['loj', 'eng', 'def', 'raf1', 'raf2', 'raf3'],
samples: ['A', '65']
},
wordDef: {
isWord: "a-z,'"
},
max: 100,
styles: {
"outer": {
backgroundColor: "#439c17",
borderRadius: 8,
borderColor: "#51b320",
borderWidth: 3,
},
"loj": {
fontSize: 20,
fontFamily: "sans-serif",
color: "#ffff00",
},
"eng": {
fontSize: 20,
fontFamily: "sans-serif",
},
"def": {
color: "#b3e6b3",
fontSize: 14,
},
"raf1": {
fontSize: 14,
fontFamily: "sans-serif",
},
"raf2": {
fontSize: 14,
fontFamily: "sans-serif",
},
"raf3": {
fontSize: 14,
fontFamily: "sans-serif",
},
}
};
// no that's not random garbage
// it's the extension id of Mouseover Dictionary Framework
if (chrome.extension) {
chrome.extension.sendRequest('fcabdhekhndgdciilfhbmiepfnjabeda', info);
chrome.extension.onRequestExternal.addListener(
function(request, sender, sendResponse) {
switch(request.about) {
case 'available?':
sendResponse(info);
break;
case 'load':
// load external data if needed
// *might* happen more than once before unload...
//alert('load');
try {
window.lojbanDictionary = new LojbanDictionary();
//alert('ok');
} catch (bad) {
//alert('bad');
}
//alert('done');
sendResponse({complete: true});
break;
case 'unload':
// unload external data if it was loaded ...?
sendResponse({complete: true});
break;
case 'firstQuery':
case 'oneTimeQuery':
sendResponse(query(request.text));
break;
default:
sendResponse({});
}
}
);
}