-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcontent.js
More file actions
23 lines (23 loc) · 727 Bytes
/
content.js
File metadata and controls
23 lines (23 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const interval = 500;
const timer = setInterval(() => {
const noWorkspacesIndicator = document.querySelector('h3.jss220.jss227');
/*
* The user has no workspaces.
*/
if(noWorkspacesIndicator !== null) {
// console.log('[Gitpod-Window]: Cannot find any workspaces');
clearInterval(timer);
}
/*
* Query all buttons with "Open" or "Start"
* to set target to _self instead of _blank.
*/
const nodes = document.querySelectorAll('a.jss287.jss290.jss298.jss300.button');
if (nodes.length !== 0) {
// console.log(`[Gitpod-Window]: Find ${nodes.length} workspaces`);
for (let i = 0; i < nodes.length; i++) {
nodes[i].target = '_self';
}
clearInterval(timer);
}
}, interval);