-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpanel.js
490 lines (456 loc) · 24.9 KB
/
panel.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
const backgroundPageConnection = chrome.runtime.connect({
name: "panel"
});
backgroundPageConnection.postMessage({
name: "init",
tabId: chrome.devtools.inspectedWindow.tabId
});
let checkedCnt;
const direction = ["up", "down", "left", "right"];
/**
* Make outline on candidates of specific direction
* @param {string} dir colored way
*/
function coloring(dir) {
checkedCnt++;
const preColor = "function find(){ var tmp = __spatialNavigation__.findCandidates(document.activeElement, \"";
chrome.tabs.executeScript({
code: preColor.concat(dir, "\"); if (tmp == undefined) return; var i; for (i = 0 ; i < tmp.length ; i++){ tmp[i].style.outline = \"solid #B0C4DE\"; } } find();")
});
if (checkedCnt == 4) document.getElementById("Button_all").checked = true;
}
/**
* Remove outline on candidates of specific direction
* @param {string} dir decolored way
*/
function decoloring(dir) {
checkedCnt--;
const preDecolor = "function find(){ var tmp = __spatialNavigation__.findCandidates(document.activeElement, \"";
chrome.tabs.executeScript({
code: preDecolor.concat(dir, "\"); if (tmp == undefined) return; var i; for (i = 0 ; i < tmp.length ; i++){ tmp[i].style.outline = \"transparent\"; } } find();")
});
if (checkedCnt < 4) document.getElementById("Button_all").checked = false;
}
/**
* Focusable element button onclick event listener
*/
document.body.addEventListener("click", (event) => {
const id = event.srcElement.id;
if (id == "Whole_page") {
if (document.getElementById(id).checked) {
ChangeCheckAll(true);
document.getElementById("Button_all").checked = true;
chrome.tabs.executeScript({
code: "function paint(){ var tmp = document.body.focusableAreas({'mode': 'all'}); if (tmp == undefined) return; var j; for (j = 0 ; j < tmp.length ; j++){ tmp[j].style.outline = 'solid #B0C4DE'; } } paint();"
});
} else {
ChangeCheckAll(false);
chrome.tabs.executeScript({
code: "function remove(){ var tmp = document.body.focusableAreas({'mode': 'all'}); if (tmp == undefined) return; var j; for (j = 0 ; j < tmp.length ; j++){ tmp[j].style.outline = 'transparent'; } } remove();"
});
document.getElementById("Button_all").checked = false;
}
} else if (id == "Button_all") {
if (document.getElementById(id).checked) ChangeCheckAll(true);
else ChangeCheckAll(false);
} else {
let way = id.substr(7);
if (direction.includes(way)) {
if (document.getElementById(id).checked) coloring(way);
else decoloring(way);
}
}
});
/**
* Check / UnCheck focusable element button (4way)
* @param {boolean} bool true = checked, false = unchecked
*/
function ChangeCheckAll(bool) {
for (let idx = 0; idx < direction.length; idx++) {
try { throw direction[idx]; } catch (way) {
document.getElementById("Button_".concat(way)).checked = bool;
if (bool) {
coloring(way);
checkedCnt = 4;
} else {
decoloring(way);
checkedCnt = 0;
}
}
}
}
/**
*
* Send Message on every focus changing event
*/
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
// remove all outliner
if (checkedCnt != 0) {
ChangeCheckAll(false);
document.getElementById("Whole_page").checked = false;
document.getElementById("Button_all").checked = false;
chrome.tabs.executeScript({
code: "function remove(){ var tmp = document.body.focusableAreas({'mode': 'all'}); if (tmp == undefined) return; var j; for (j = 0 ; j < tmp.length ; j++){ tmp[j].style.outline = 'transparent'; } } remove();"
});
}
// show information of Spatnav on devtool
chrome.devtools.inspectedWindow.eval("document.body.focusableAreas({'mode': 'all'}).length;", { useContentScriptContext: true }, (result) => {
document.getElementById("focus_cnt").innerText = result;
});
chrome.devtools.inspectedWindow.eval("__spatialNavigation__.isContainer(document.activeElement);", { useContentScriptContext: true }, (result) => {
document.getElementById("container").innerText = result;
if (result.toString() == "true") {
document.getElementById("container").style.color = "#0057e7";
} else {
document.getElementById("container").style.color = "#d62d20";
}
});
chrome.devtools.inspectedWindow.eval("document.activeElement.focusableAreas({'mode': 'visible'}).map(a => a.outerHTML);", { useContentScriptContext: true }, (result) => {
if (result.length == 0) {
var parentDiv = document.getElementById("visible");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("visible");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `visible_list_${i + 1}`;
const newDiv = document.createElement("div");
newDiv.id = tempId;
temp = `[${i + 1}] ${result[i].toString().replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
parentDiv.appendChild(newDiv);
}
}
});
// Make list of focusable areas
chrome.devtools.inspectedWindow.eval("document.activeElement.focusableAreas({'mode': 'all'}).map(a => a.outerHTML);", { useContentScriptContext: true }, (result) => {
if (result.length == 0) {
var parentDiv = document.getElementById("all");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("all");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `all_list_${i + 1}`;
const newDiv = document.createElement("div");
newDiv.id = tempId;
temp = `[${i + 1}] ${result[i].toString().replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
parentDiv.appendChild(newDiv);
}
}
});
for (var idx = 0; idx < direction.length; idx++) {
(function () {
const way = direction[idx];
const cmd0 = "__spatialNavigation__.findNextTarget(document.activeElement, \"".concat(way, "\").outerHTML;");
chrome.devtools.inspectedWindow.eval(cmd0, { useContentScriptContext: true }, (result) => {
try { throw result; } catch (res) {
if (res === undefined) document.getElementById(way).innerText = "undefined";
else document.getElementById(way).innerText = res.toString().replace(/(\r\n\t|\n|\r\t)/gm, "");
}
document.getElementById(way).setAttribute("cmd", "next");
});
const cmd1 = "document.activeElement.spatialNavigationSearch('".concat(way, "').outerHTML;");
chrome.devtools.inspectedWindow.eval(cmd1, { useContentScriptContext: true }, (result2) => {
const search_id = "search_".concat(way);
document.getElementById(search_id).setAttribute("cmd", "spatnav_search");
try { throw result2; } catch (res2) {
if (res2 === undefined) { document.getElementById(search_id).innerText = "undefined"; } else { document.getElementById(search_id).innerText = res2.toString().replace(/(\r\n\t|\n|\r\t)/gm, ""); }
}
});
}());
}
// Make list of 4 way candidate
// 1 : up
chrome.devtools.inspectedWindow.eval("function candidates_up(){ var temp = __spatialNavigation__.findCandidates(document.activeElement, 'up'); var distance = []; var i; var dis_candidate = []; for(i = 0; i < temp.length; i++){ distance[i] = __spatialNavigation__.getDistanceFromTarget(document.activeElement, temp[i], 'up'); dis_candidate[i] = [temp[i].outerHTML, distance[i]];} return dis_candidate;} candidates_up();", { useContentScriptContext: true }, (result) => {
if (result.length == 0) {
var parentDiv = document.getElementById("candidates1");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("candidates1");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `candidates_up${i + 1}`;
const newDiv = document.createElement("div");
newDiv.id = tempId;
temp = `[${i + 1}] distance : ${parseInt(result[i][1])}, ${result[i][0].replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
parentDiv.appendChild(newDiv);
}
}
});
// 2: down
chrome.devtools.inspectedWindow.eval("function candidates_down(){ var temp = __spatialNavigation__.findCandidates(document.activeElement, 'down'); var distance = []; var i; var dis_candidate = []; for(i = 0; i < temp.length; i++){ distance[i] = __spatialNavigation__.getDistanceFromTarget(document.activeElement, temp[i], 'down'); dis_candidate[i] = [temp[i].outerHTML, distance[i]];} return dis_candidate;} candidates_down();", { useContentScriptContext: true }, (result) => {
if (result.length == 0) {
var parentDiv = document.getElementById("candidates2");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("candidates2");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `candidates_down${i + 1}`;
const newDiv = document.createElement("div");
newDiv.setAttribute("id", tempId);
temp = `[${i + 1}] distance : ${parseInt(result[i][1])}, ${result[i][0].replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
const currentDiv = document.getElementById("candidates_down");
parentDiv.insertBefore(newDiv, currentDiv);
}
}
});
// 3:left
chrome.devtools.inspectedWindow.eval("function candidates_left(){ var temp = __spatialNavigation__.findCandidates(document.activeElement, 'left'); var distance = []; var i; var dis_candidate = []; for(i = 0; i < temp.length; i++){ distance[i] = __spatialNavigation__.getDistanceFromTarget(document.activeElement, temp[i], 'left'); dis_candidate[i] = [temp[i].outerHTML, distance[i]];} return dis_candidate;} candidates_left();", { useContentScriptContext: true }, (result) => {
if (result == undefined) return;
if (result.length == 0) {
var parentDiv = document.getElementById("candidates3");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("candidates3");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `candidates_left${i + 1}`;
const newDiv = document.createElement("div");
newDiv.setAttribute("id", tempId);
temp = `[${i + 1}] distance : ${parseInt(result[i][1])}, ${result[i][0].replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
const currentDiv = document.getElementById("candidates_left");
parentDiv.insertBefore(newDiv, currentDiv);
}
}
});
// 4: right
chrome.devtools.inspectedWindow.eval("function candidates_right(){ var temp = __spatialNavigation__.findCandidates(document.activeElement, 'right'); var distance = []; var i; var dis_candidate = []; for(i = 0; i < temp.length; i++){ distance[i] = __spatialNavigation__.getDistanceFromTarget(document.activeElement, temp[i], 'right'); dis_candidate[i] = [temp[i].outerHTML, distance[i]];} return dis_candidate;} candidates_right();", { useContentScriptContext: true }, (result) => {
if (result.length == 0) {
var parentDiv = document.getElementById("candidates4");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
const content3 = document.createTextNode("None");
parentDiv.appendChild(content3);
} else {
let i;
let temp;
var parentDiv = document.getElementById("candidates4");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `candidates_right${i + 1}`;
const newDiv = document.createElement("div");
newDiv.setAttribute("id", tempId);
temp = `[${i + 1}] distance : ${parseInt(result[i][1])}, ${result[i][0].replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
const currentDiv = document.getElementById("candidates_right");
parentDiv.insertBefore(newDiv, currentDiv);
}
}
});
// Make list of container
chrome.devtools.inspectedWindow.eval("function container_list(){ var temp = document.activeElement.getSpatialNavigationContainer(); var list = []; var i = 0; while( temp != null){ list[i] = temp; i = i + 1; temp = temp.getSpatialNavigationContainer();} return list.map(a=>a.outerHTML);} container_list();", { useContentScriptContext: true }, (result) => {
if (result === undefined) {
document.getElementById("container_list").innerText = "undefined";
} else {
let i;
let temp;
const parentDiv = document.getElementById("containerlist1");
while (parentDiv.firstChild) {
parentDiv.removeChild(parentDiv.firstChild);
}
for (i = 0; i < result.length; i++) {
const tempId = `container_list${i + 1}`;
const newDiv = document.createElement("div");
newDiv.setAttribute("id", tempId);
temp = `[${i + 1}] ${result[i].replace(/(\r\n\t|\n|\r\t)/gm, "")}`;
const newContent = document.createTextNode(temp);
newDiv.appendChild(newContent);
const currentDiv = document.getElementById("container_list");
parentDiv.insertBefore(newDiv, currentDiv);
}
}
});
});
/**
* Text element mouseover event listener
*/
document.body.addEventListener("mouseover", (event) => {
const id = event.srcElement.id;
if (id) {
if (direction.includes(id)) mouseOver(id);
else if (id.includes("search_")) mouseOver(id);
else if (id.includes("visible_list")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(13)) - 1;
chrome.tabs.executeScript({
code: "var tmp = (document.activeElement.focusableAreas({\"mode\": \"visible\"})[".concat(index, "]); if (tmp) {tmp.style.backgroundColor = \"#FCADAB\"; tmp.style.outline = \"thick #FFC0CB\";}")
});
} else if (id.includes("all_list")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(9)) - 1;
chrome.tabs.executeScript({
code: "var tmp = (document.activeElement.focusableAreas({\"mode\": \"all\"})[".concat(index, "]); if (tmp) {tmp.style.backgroundColor = \"#FCADAB\"; tmp.style.outline = \"thick #FFC0CB\";}")
});
} else if (id.includes("candidates_up")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(13)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"up"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "#FCADAB"; temp[${index}].style.outline = "thick #FFC0CB"}}`
});
} else if (id.includes("candidates_down")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(15)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"down"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "#FCADAB"; temp[${index}].style.outline = "thick #FFC0CB"}}`
});
} else if (id.includes("candidates_left")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(15)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"left"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "#FCADAB"; temp[${index}].style.outline = "thick #FFC0CB"}}`
});
} else if (id.includes("candidates_right")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(16)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"right"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "#FCADAB"; temp[${index}].style.outline = "thick #FFC0CB"}}`
});
} else if (id.includes("container_list")) {
document.getElementById(id).style.color = "#d62d20";
var index = parseInt(id.substr(14)) - 1;
chrome.tabs.executeScript({
code: `var temp = document.activeElement.getSpatialNavigationContainer(); for(var i = 0; i < ${index}; i++) { temp = temp.getSpatialNavigationContainer();} temp.style.backgroundColor = "#FCADAB"; temp.style.outline = "thick #FFC0CB";`
});
}
}
});
/**
* Text element mouseout event listener
*/
document.body.addEventListener("mouseout", (event) => {
const id = event.srcElement.id;
if (id) {
if (direction.includes(id)) mouseOut(id);
else if (id.includes("search_")) mouseOut(id);
else if (id.includes("visible_list")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(13)) - 1;
chrome.tabs.executeScript({
code: "var tmp = (document.activeElement.focusableAreas({\"mode\": \"visible\"})[".concat(index, "]); if (tmp) {tmp.style.backgroundColor = \"transparent\"; tmp.style.outline = \"transparent\";}")
});
} else if (id.includes("all_list")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(9)) - 1;
chrome.tabs.executeScript({
code: "var tmp = (document.activeElement.focusableAreas({\"mode\": \"all\"})[".concat(index, "]); if (tmp) {tmp.style.backgroundColor = \"transparent\"; tmp.style.outline = \"transparent\";}")
});
} else if (id.includes("candidates_up")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(13) - 1);
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"up"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "transparent"; temp[${index}].style.outline = "transparent"}}`
});
} else if (id.includes("candidates_down")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(15)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"down"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "transparent"; temp[${index}].style.outline = "transparent"}}`
});
} else if (id.includes("candidates_left")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(15)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"left"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "transparent"; temp[${index}].style.outline = "transparent"}}`
});
} else if (id.includes("candidates_right")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(16)) - 1;
chrome.tabs.executeScript({
code: `var temp = __spatialNavigation__.findCandidates(document.activeElement,"right"); if (temp){if (temp[${index}]){temp[${index}].style.backgroundColor = "transparent"; temp[${index}].style.outline = "transparent"}}`
});
} else if (id.includes("container_list")) {
document.getElementById(id).style.color = "rgb(61, 60, 60)";
var index = parseInt(id.substr(14)) - 1;
chrome.tabs.executeScript({
code: `var temp = document.activeElement.getSpatialNavigationContainer(); for(var i = 0; i < ${index}; i++) { temp = temp.getSpatialNavigationContainer();} temp.style.backgroundColor = "transparent"; temp.style.outline = "transparent";`
});
}
}
});
/**
* Mouseover / out event of next element text
* @param {string} way coloring direction
*/
function mouseOut(way) {
if ((document.getElementById(way).innerText == "undefined") || (document.getElementById(way) == null)) return;
document.getElementById(way).style.color = "rgb(61, 60, 60)";
if (document.getElementById(way).getAttribute("cmd") == "next") {
chrome.tabs.executeScript({
code: "var tmp = window.__spatialNavigation__.findNextTarget(document.activeElement, \"".concat(way, "\"); if (tmp) {tmp.style.backgroundColor = \"transparent\"; tmp.style.outline = \"transparent\";}")
});
} else if (document.getElementById(way).getAttribute("cmd") == "spatnav_search") {
const realWay = way.substr(7);
chrome.tabs.executeScript({
code: "var tmp = document.activeElement.spatialNavigationSearch(\"".concat(realWay, "\"); if (tmp) {tmp.style.backgroundColor = \"transparent\"; tmp.style.outline = \"transparent\";}")
});
}
}
function mouseOver(way) {
if (document.getElementById(way).innerText == "undefined") return;
document.getElementById(way).style.color = "#d62d20";
if (document.getElementById(way).getAttribute("cmd") == "next") {
chrome.tabs.executeScript({
code: "var tmp = window.__spatialNavigation__.findNextTarget(document.activeElement, \"".concat(way, "\"); if (tmp) {tmp.style.backgroundColor = \"#FCADAB\"; tmp.style.outline = \"thick #FFC0CB\";}")
});
} else if (document.getElementById(way).getAttribute("cmd") == "spatnav_search") {
const realWay = way.substr(7);
chrome.tabs.executeScript({
code: "var tmp = document.activeElement.spatialNavigationSearch(\"".concat(realWay, "\"); if (tmp) {tmp.style.backgroundColor = \"#FCADAB\"; tmp.style.outline = \"thick #FFC0CB\";}")
});
}
}