Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b26bfcad
authored
Apr 22, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: change window focus detection method
parent
606d4527
Pipeline
#60
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
12 deletions
+3
-12
circle/dashboard/static/dashboard/activity.js
+3
-12
No files found.
circle/dashboard/static/dashboard/activity.js
View file @
b26bfcad
...
...
@@ -169,7 +169,7 @@ $(function() {
);
}
else
{
in_progress
=
false
;
if
(
windowHasFocus
===
false
&&
userWantNotifications
()){
if
(
document
.
hasFocus
()
===
false
&&
userWantNotifications
()){
sendNotification
(
generateMessageFromLastActivity
());
}
if
(
reload_vm_detail
)
location
.
reload
();
...
...
@@ -190,17 +190,8 @@ $(function(){
Notification
.
requestPermission
();
});
// Detect window has focus
windowHasFocus
=
true
;
$
(
window
).
blur
(
function
(){
windowHasFocus
=
false
;
});
$
(
window
).
focus
(
function
(){
windowHasFocus
=
true
;
});
function
generateMessageFromLastActivity
(){
var
ac
=
$
(
'div.activity'
).
first
();
var
ac
=
$
(
"div.activity"
).
first
();
var
error
=
ac
.
children
(
".timeline-icon-failed"
).
length
;
var
sign
=
(
error
===
1
)
?
"❌ "
:
"✓ "
;
var
msg
=
ac
.
children
(
"strong"
).
text
().
replace
(
/
\s
+/g
,
" "
);
...
...
@@ -212,7 +203,7 @@ function sendNotification(message) {
if
(
Notification
.
permission
===
"granted"
)
{
var
notification
=
new
Notification
(
message
,
options
);
}
else
if
(
Notification
.
permission
!==
'denied'
)
{
else
if
(
Notification
.
permission
!==
"denied"
)
{
Notification
.
requestPermission
(
function
(
permission
)
{
if
(
permission
===
"granted"
)
{
var
notification
=
new
Notification
(
message
,
options
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment