FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AtCoderVirtualContestTimer/content-script.js at master · NMLibrary/AtCoderVirtualContestTimer · GitHub
NMLibrary
/
AtCoderVirtualContestTimer
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
AtCoderVirtualContestTimer
/
content-script.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (49 loc) · 1.96 KB
Breadcrumbs
AtCoderVirtualContestTimer
/
content-script.js
Copy path
File metadata and controls
57 lines (49 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
'use strict'
;
function
express
(
)
{
let
now
=
new
Date
(
)
;
let
url
=
location
.
href
;
let
id
=
url
.
match
(
/
\d
+
$
/
)
[
0
]
;
chrome
.
storage
.
local
.
get
(
[
'start'
+
id
,
'end'
+
id
,
'shown'
+
id
]
,
function
(
data
)
{
let
start
=
data
[
"start"
+
id
]
;
let
end
=
data
[
"end"
+
id
]
;
let
shown
=
data
[
"shown"
+
id
]
;
let
startNums
=
start
.
match
(
/
(
\d
+
)
-
(
\d
+
)
-
(
\d
+
)
\s
(
\d
+
)
:
(
\d
+
)
:
(
\d
+
)
/
)
;
startNums
[
2
]
--
;
let
startDate
=
new
Date
(
...
startNums
.
slice
(
1
)
)
;
let
endNums
=
end
.
match
(
/
(
\d
+
)
-
(
\d
+
)
-
(
\d
+
)
\s
(
\d
+
)
:
(
\d
+
)
:
(
\d
+
)
/
)
;
endNums
[
2
]
--
;
let
endDate
=
new
Date
(
...
endNums
.
slice
(
1
)
)
;
if
(
now
>
endDate
&&
shown
<
2
)
{
alert
(
"終了しました"
)
;
chrome
.
storage
.
local
.
set
(
{
[
'shown'
+
id
]
:
2
}
)
;
$
(
"body div#clock"
)
.
text
(
""
)
;
}
else
if
(
now
>
startDate
&&
shown
<
1
)
{
alert
(
"開始しました"
)
;
chrome
.
storage
.
local
.
set
(
{
[
'shown'
+
id
]
:
1
}
)
;
//location.reload();
}
else
if
(
now
<
endDate
&&
shown
==
0
)
{
}
if
(
shown
==
1
)
{
let
remain
=
endDate
-
now
;
if
(
remain
>
0
)
{
let
minute
=
Math
.
floor
(
remain
/
60000
)
;
let
second
=
Math
.
floor
(
(
remain
-
minute
*
60000
)
/
1000
)
;
$
(
"body div#clock"
)
.
text
(
"残り"
+
minute
+
"分"
+
second
+
"秒"
)
;
}
else
{
$
(
"body div#clock"
)
.
text
(
"残り0分0秒"
)
;
}
}
}
)
;
}
;
function
init
(
)
{
let
timeStr
=
$
(
"body div.container h1.page-header small.pull-right"
)
.
text
(
)
;
$
(
"body"
)
.
append
(
"<div id='clock' style='text-align:center;font-size:18pt;'></div>"
)
;
let
match
=
timeStr
.
match
(
/
\d
+
-
\d
+
-
\d
+
\s
\d
+
:
\d
+
:
\d
+
/
g
)
;
let
start
=
match
[
0
]
;
let
end
=
match
[
1
]
;
let
url
=
location
.
href
;
let
id
=
url
.
match
(
/
\d
+
$
/
)
[
0
]
;
chrome
.
storage
.
local
.
set
(
{
[
"start"
+
id
]
:
start
,
[
"end"
+
id
]
:
end
,
[
"shown"
+
id
]
:
0
}
)
;
setInterval
(
express
,
1000
)
;
}
;
init
(
)
;
Back
|
FazBrowse Home
|
New Git URL