Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
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
Show 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() {
...
@@ -169,7 +169,7 @@ $(function() {
);
);
}
else
{
}
else
{
in_progress
=
false
;
in_progress
=
false
;
if
(
windowHasFocus
===
false
&&
userWantNotifications
()){
if
(
document
.
hasFocus
()
===
false
&&
userWantNotifications
()){
sendNotification
(
generateMessageFromLastActivity
());
sendNotification
(
generateMessageFromLastActivity
());
}
}
if
(
reload_vm_detail
)
location
.
reload
();
if
(
reload_vm_detail
)
location
.
reload
();
...
@@ -190,17 +190,8 @@ $(function(){
...
@@ -190,17 +190,8 @@ $(function(){
Notification
.
requestPermission
();
Notification
.
requestPermission
();
});
});
// Detect window has focus
windowHasFocus
=
true
;
$
(
window
).
blur
(
function
(){
windowHasFocus
=
false
;
});
$
(
window
).
focus
(
function
(){
windowHasFocus
=
true
;
});
function
generateMessageFromLastActivity
(){
function
generateMessageFromLastActivity
(){
var
ac
=
$
(
'div.activity'
).
first
();
var
ac
=
$
(
"div.activity"
).
first
();
var
error
=
ac
.
children
(
".timeline-icon-failed"
).
length
;
var
error
=
ac
.
children
(
".timeline-icon-failed"
).
length
;
var
sign
=
(
error
===
1
)
?
"❌ "
:
"✓ "
;
var
sign
=
(
error
===
1
)
?
"❌ "
:
"✓ "
;
var
msg
=
ac
.
children
(
"strong"
).
text
().
replace
(
/
\s
+/g
,
" "
);
var
msg
=
ac
.
children
(
"strong"
).
text
().
replace
(
/
\s
+/g
,
" "
);
...
@@ -212,7 +203,7 @@ function sendNotification(message) {
...
@@ -212,7 +203,7 @@ function sendNotification(message) {
if
(
Notification
.
permission
===
"granted"
)
{
if
(
Notification
.
permission
===
"granted"
)
{
var
notification
=
new
Notification
(
message
,
options
);
var
notification
=
new
Notification
(
message
,
options
);
}
}
else
if
(
Notification
.
permission
!==
'denied'
)
{
else
if
(
Notification
.
permission
!==
"denied"
)
{
Notification
.
requestPermission
(
function
(
permission
)
{
Notification
.
requestPermission
(
function
(
permission
)
{
if
(
permission
===
"granted"
)
{
if
(
permission
===
"granted"
)
{
var
notification
=
new
Notification
(
message
,
options
);
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