-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent_script.js
73 lines (40 loc) · 1.23 KB
/
content_script.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
( async function () {
function wait ( time ) {
return new Promise( function ( resolve ) {
setTimeout( resolve, time );
});
};
function wait_for ( selector ) {
return new Promise( function ( resolve ) {
var interval = setInterval( () => {
var element = document.querySelector( selector );
if ( element ) {
clearInterval( interval );
resolve( element );
};
}, 200 );
});
};
await wait_for( "span.Di" );
location.hash = "#inbox/p2";
await wait( 50 );
location.hash = "#settings/general";
await wait( 50 );
var select = await wait_for( "select.rA" );
var option = document.createElement( "option" );
option.value = "200";
option.innerText = "200";
select.prepend( option );
option.selected = true;
select.value = 200;
select.dispatchEvent( new Event( "change" ) );
await wait( 50 );
document.querySelector( "button[guidedhelpid='save_changes_button']" ).click();
await wait( 50 );
var button = await wait_for( "button[name='ok']" );
button.click();
location.hash = "#inbox";
await wait( 50 );
var button = await wait_for( "button[name='ok']" );
button.click();
} () );