-
Notifications
You must be signed in to change notification settings - Fork 2
/
indexRefs.ts
37 lines (36 loc) · 1.13 KB
/
indexRefs.ts
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
import * as winMgr from "./../../../req/main/winMgr";
/**
* Triggers indexing for every ref seq in the first input window
*
* @export
* @returns {Promise<void>}
*/
export async function indexRefs() : Promise<void>
{
return new Promise<void>(async (resolve,reject) => {
setTimeout(async function(){
console.log("indexing ref seqs");
let input = winMgr.getFreeWebContents();
if(!input || input.length == 0)
{
console.log("Failed to open input window");
process.exit(1);
}
await input[0].executeJavaScript(`
let els = document.getElementsByTagName("td");
let isIndex = /Index/;
for(let i = 0; i != els.length; ++i)
{
console.log(els[i]);
if(els[i].id && isIndex.test(els[i].id))
{
console.log("clicked "+els[i]);
els[i].click();
break;
}
}
`);
resolve();
},1500);
});
}