Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub.io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peyton Tanzillo
hub.io
Commits
46176f3d
Commit
46176f3d
authored
6 years ago
by
Joey Ballentine
Browse files
Options
Downloads
Patches
Plain Diff
Made recommended content load in a random order
parent
8c4ad6ed
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
script.js
+16
-5
16 additions, 5 deletions
script.js
with
16 additions
and
5 deletions
script.js
+
16
−
5
View file @
46176f3d
...
@@ -99,7 +99,7 @@ let SpongeBob = new Media(
...
@@ -99,7 +99,7 @@ let SpongeBob = new Media(
"
Spongeboy me bob
"
,
"
Spongeboy me bob
"
,
[
new
Season
(
10
),
new
Season
(
10
),
new
Season
(
10
),
new
Season
(
10
)],
[
new
Season
(
10
),
new
Season
(
10
),
new
Season
(
10
),
new
Season
(
10
)],
[
"
Prime Video
"
],
[
"
Prime Video
"
],
'
Content/spongebob.jpg
'
,
'
Content/spongebob
-example
.jpg
'
,
"
spongebob
"
);
"
spongebob
"
);
let
Friends
=
new
Media
(
let
Friends
=
new
Media
(
...
@@ -150,6 +150,17 @@ let Avengers = new Media(
...
@@ -150,6 +150,17 @@ let Avengers = new Media(
let
Medias
=
[
TheOffice
,
SouthPark
,
DragonBallZ
,
Dark
,
WestWorld
,
HighCastle
,
SpongeBob
,
Friends
,
GameOfThrones
,
Shameless
,
Avengers
];
let
Medias
=
[
TheOffice
,
SouthPark
,
DragonBallZ
,
Dark
,
WestWorld
,
HighCastle
,
SpongeBob
,
Friends
,
GameOfThrones
,
Shameless
,
Avengers
];
let
RecommendedContent
=
[];
for
(
let
i
=
0
;
i
<
Medias
.
length
;)
{
let
maybeMedia
=
Medias
[
Math
.
floor
(
Math
.
random
()
*
Medias
.
length
)];
if
(
!
RecommendedContent
.
includes
(
maybeMedia
))
{
RecommendedContent
.
push
(
maybeMedia
);
i
++
;
}
}
// == The rest of the code == //
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
//Code when hamburger is clicked
//Code when hamburger is clicked
$
(
'
.hamburger-content
'
).
hide
();
$
(
'
.hamburger-content
'
).
hide
();
...
@@ -271,10 +282,10 @@ $(document).ready(function() {
...
@@ -271,10 +282,10 @@ $(document).ready(function() {
function
updateList
()
{
function
updateList
()
{
$
(
'
#recommended
'
).
empty
();
$
(
'
#recommended
'
).
empty
();
let
activeServices
=
findActiveServices
();
let
activeServices
=
findActiveServices
();
for
(
var
i
=
0
;
i
<
Medias
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
RecommendedContent
.
length
;
i
++
)
{
for
(
service
of
activeServices
)
{
for
(
service
of
activeServices
)
{
if
(
Medias
[
i
].
services
[
0
].
toLowerCase
().
replace
(
/
\s
+/g
,
''
)
===
service
)
{
if
(
RecommendedContent
[
i
].
services
[
0
].
toLowerCase
().
replace
(
/
\s
+/g
,
''
)
===
service
)
{
AddElement
(
Medias
[
i
],
"
#recommended
"
);
AddElement
(
RecommendedContent
[
i
],
"
#recommended
"
);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment