Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
807
Issues
807
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
5fff56d2
Commit
5fff56d2
authored
3 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore); bettwr improve window focusing and correcting position for boost rotator
parent
d5b84390
master
No related merge requests found
Pipeline
#63678335
running with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
boost-rotator.component.ts
...modules/newsfeed/boost-rotator/boost-rotator.component.ts
+22
-10
No files found.
src/app/modules/newsfeed/boost-rotator/boost-rotator.component.ts
View file @
5fff56d2
...
...
@@ -35,6 +35,7 @@ export class NewsfeedBoostRotatorComponent {
rotator
;
running
:
boolean
=
false
;
paused
:
boolean
=
false
;
windowFocused
:
boolean
=
true
;
interval
:
number
=
6
;
channel
:
MindsUser
;
currentPosition
:
number
=
0
;
...
...
@@ -115,7 +116,9 @@ export class NewsfeedBoostRotatorComponent {
}
if
(
!
this
.
running
)
{
this
.
recordImpression
(
this
.
currentPosition
,
true
);
if
(
this
.
currentPosition
===
0
)
{
this
.
recordImpression
(
this
.
currentPosition
,
true
);
}
this
.
start
();
this
.
isVisible
();
}
...
...
@@ -167,7 +170,9 @@ export class NewsfeedBoostRotatorComponent {
this
.
currentPosition
=
0
;
}
if
(
!
this
.
running
)
{
this
.
recordImpression
(
this
.
currentPosition
,
true
);
if
(
this
.
currentPosition
===
0
)
{
this
.
recordImpression
(
this
.
currentPosition
,
true
);
}
this
.
start
();
this
.
isVisible
();
}
...
...
@@ -206,8 +211,12 @@ export class NewsfeedBoostRotatorComponent {
start
()
{
if
(
this
.
rotator
)
window
.
clearInterval
(
this
.
rotator
);
this
.
running
=
true
;
this
.
rotator
=
setInterval
((
e
)
=>
{
if
(
!
this
.
windowFocused
)
{
return
;
}
if
(
this
.
paused
)
{
return
;
}
...
...
@@ -236,17 +245,21 @@ export class NewsfeedBoostRotatorComponent {
//ensure was seen for at least 1 second
if
((
Date
.
now
()
>
this
.
lastTs
+
1000
||
force
)
&&
this
.
boosts
[
position
].
boosted_guid
)
{
this
.
newsfeedService
.
recordView
(
this
.
boosts
[
position
],
true
,
this
.
channel
);
console
.
log
(
'Boost rotator recording impressions for '
+
position
+
' '
+
this
.
boosts
[
position
].
boosted_guid
,
this
.
windowFocused
);
}
this
.
lastTs
=
Date
.
now
();
window
.
localStorage
.
setItem
(
'boost-rotator-offset'
,
this
.
boosts
[
position
].
boosted_guid
);
}
active
()
{
this
.
windowFocused
=
true
;
this
.
isVisible
();
this
.
next
();
// Show a new boost when we open our window again
}
inActive
()
{
this
.
running
=
false
;
this
.
windowFocused
=
false
;
window
.
clearInterval
(
this
.
rotator
);
}
...
...
@@ -268,17 +281,16 @@ export class NewsfeedBoostRotatorComponent {
this
.
recordImpression
(
this
.
currentPosition
,
false
);
}
next
()
{
async
next
()
{
this
.
activities
.
toArray
()[
this
.
currentPosition
].
hide
();
if
(
this
.
currentPosition
+
1
>
this
.
boosts
.
length
-
1
)
{
//this.currentPosition = 0;
this
.
load
()
.
then
(()
=>
{
this
.
currentPosition
++
;
})
.
catch
(()
=>
{
this
.
currentPosition
=
0
;
});
try
{
await
this
.
load
();
this
.
currentPosition
++
;
}
catch
(
e
)
{
this
.
currentPosition
=
0
;
}
}
else
{
this
.
currentPosition
++
;
}
...
...
This diff is collapsed.
Click to expand it.
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