@@ -17,7 +17,11 @@ let vueApp = createApp({
17
17
elapsedtime : null ,
18
18
elapsedtimer : null ,
19
19
starttime : null ,
20
- player : null
20
+ player : null ,
21
+ backgroundimage : null ,
22
+ rotations : {
23
+ interval : null ,
24
+ } ,
21
25
} ;
22
26
} ,
23
27
mounted ( ) {
@@ -64,6 +68,41 @@ let vueApp = createApp({
64
68
var vid = document . getElementById ( "audiocomp" ) ;
65
69
vid . volume = this . config . audio . volume ;
66
70
}
71
+
72
+ this . backgroundimage = this . config . image . source ;
73
+
74
+ if ( this . config . image . random . rotate . active == true ) {
75
+ let position = 0 ;
76
+
77
+ if ( this . config . image . random . rotate . sequenced !== true ) {
78
+ let min = Math . ceil ( 0 ) ;
79
+ let max = Math . floor ( this . config . image . random . sources . length - 1 ) ;
80
+ position = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
81
+ }
82
+
83
+ this . backgroundimage = this . config . image . random . sources [ position ] ;
84
+
85
+ this . rotations . interval = setInterval ( ( ) => {
86
+ if ( this . config . image . random . rotate . sequenced == true ) {
87
+ if ( position < this . config . image . random . sources . length - 1 ) {
88
+ position ++ ;
89
+ } else {
90
+ position = 0 ;
91
+ }
92
+ this . backgroundimage = this . config . image . random . sources [ position ] ;
93
+ } else {
94
+ let min = Math . ceil ( 0 ) ;
95
+ let max = Math . floor ( this . config . image . random . sources . length - 1 ) ;
96
+ let randindex = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
97
+ this . backgroundimage = this . config . image . random . sources [ randindex ] ;
98
+ }
99
+ } , this . config . image . random . rotate . time * 1000 ) ;
100
+ } else if ( this . config . image . random . active == true ) {
101
+ let min = Math . ceil ( 0 ) ;
102
+ let max = Math . floor ( this . config . image . random . sources . length - 1 ) ;
103
+ let randindex = Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
104
+ this . backgroundimage = this . config . image . random . sources [ randindex ] ;
105
+ }
67
106
} ,
68
107
destroyed ( ) {
69
108
this . yt = false ;
@@ -78,13 +117,17 @@ let vueApp = createApp({
78
117
if ( video ) {
79
118
video . pause ( ) ;
80
119
}
120
+
121
+ if ( this . rotations . interval ) {
122
+ clearInterval ( this . rotations . interval ) ;
123
+ }
81
124
} ,
82
125
computed : {
83
126
cssvars ( ) {
84
127
return {
85
128
"--color" : "#fff" ,
86
129
"--backgroundcolor" : this . config . image . backgroundcolor ,
87
- "--backgroundimage" : this . config . image . source ,
130
+ "--backgroundimage" : this . backgroundimage || this . config . image . source ,
88
131
"--loadingcolor" : this . config . loading . color ,
89
132
} ;
90
133
} ,
@@ -99,15 +142,15 @@ let vueApp = createApp({
99
142
height : window . innerHeight ,
100
143
videoId : this . config . youtube . source ,
101
144
playerVars : {
102
- ' playsinline' : 1 ,
103
- ' controls' : 0 ,
104
- ' mute' : this . config . youtube . mute ,
105
- ' autoplay' : 1
145
+ playsinline : 1 ,
146
+ controls : 0 ,
147
+ mute : this . config . youtube . mute ,
148
+ autoplay : 1 ,
106
149
} ,
107
150
events : {
108
151
onReady : that . onPlayerReady ,
109
- onStateChange : that . onPlayerStateChange
110
- }
152
+ onStateChange : that . onPlayerStateChange ,
153
+ } ,
111
154
} ) ;
112
155
}
113
156
} ,
@@ -118,7 +161,7 @@ let vueApp = createApp({
118
161
onPlayerStateChange ( evt ) {
119
162
if ( evt . data === 0 ) {
120
163
if ( this . config . youtube . looped ) {
121
- this . player . playVideo ( ) ;
164
+ this . player . playVideo ( ) ;
122
165
} else if ( this . visible ) {
123
166
this . visible = false ;
124
167
clearInterval ( this . timer ) ;
@@ -127,12 +170,17 @@ let vueApp = createApp({
127
170
} ,
128
171
startCallback ( ) {
129
172
this . timer = setInterval ( ( ) => {
130
- fetch ( this . config . feathercore . active ? `https://feather-core/isgameinitiated` : `https://bcc-loadscreen-helper/isgameinitiated` , {
131
- method : "POST" ,
132
- headers : {
133
- "Content-Type" : "application/json; charset=UTF-8" ,
134
- } ,
135
- } )
173
+ fetch (
174
+ this . config . feathercore . active
175
+ ? `https://feather-core/isgameinitiated`
176
+ : `https://bcc-loadscreen-helper/isgameinitiated` ,
177
+ {
178
+ method : "POST" ,
179
+ headers : {
180
+ "Content-Type" : "application/json; charset=UTF-8" ,
181
+ } ,
182
+ }
183
+ )
136
184
. then ( ( resp ) => resp . json ( ) )
137
185
. then ( ( resp ) => {
138
186
this . loading = false ;
@@ -142,8 +190,12 @@ let vueApp = createApp({
142
190
} else if ( resp . online ) {
143
191
this . loading = false ;
144
192
145
- let isvideolooped = this . config . video . looped == false && this . config . video . active == true
146
- let isYTlooped = this . config . youtube . looped == false && this . config . youtube . active == true
193
+ let isvideolooped =
194
+ this . config . video . looped == false &&
195
+ this . config . video . active == true ;
196
+ let isYTlooped =
197
+ this . config . youtube . looped == false &&
198
+ this . config . youtube . active == true ;
147
199
148
200
if ( ! ( isvideolooped || isYTlooped ) ) {
149
201
this . visible = false ;
@@ -159,5 +211,5 @@ let vueApp = createApp({
159
211
160
212
// Youtube API Shim for vue
161
213
window . onYouTubeIframeAPIReady = ( ) => {
162
- vueApp . initYoutube ( )
214
+ vueApp . initYoutube ( ) ;
163
215
} ;
0 commit comments