Просмотр исходного кода

Set of wallpapers for login page (#1214)

CauseFX 7 лет назад
Родитель
Сommit
815406976b
1 измененных файлов с 14 добавлено и 2 удалено
  1. 14 2
      js/functions.js

+ 14 - 2
js/functions.js

@@ -3894,12 +3894,12 @@ function loadAppearance(appearance){
 	if(appearance.loginWallpaper !== ''){
 	if(appearance.loginWallpaper !== ''){
 		cssSettings += `
 		cssSettings += `
 		    .login-register {
 		    .login-register {
-			    background: url(`+appearance.loginWallpaper+`) center center/cover no-repeat!important;
+			    background: url(`+randomCSV(appearance.loginWallpaper)+`) center center/cover no-repeat!important;
 			    height: 100%;
 			    height: 100%;
 			    position: fixed;
 			    position: fixed;
 		    }
 		    }
 			.lock-screen {
 			.lock-screen {
-				background: url(`+appearance.loginWallpaper+`) center center/cover no-repeat!important;
+				background: url(`+randomCSV(appearance.loginWallpaper)+`) center center/cover no-repeat!important;
 			    height: 100%;
 			    height: 100%;
 			    position: fixed;
 			    position: fixed;
 			    z-index: 1001;
 			    z-index: 1001;
@@ -3923,6 +3923,18 @@ function loadAppearance(appearance){
         $('#custom-css').html(appearance.customCss);
         $('#custom-css').html(appearance.customCss);
     }
     }
 }
 }
+function randomCSV(values){
+    if(typeof values == 'string'){
+        if(values.includes(',')){
+            var csv = values.split(',');
+            var luckyNumber = Math.floor(Math.random() * csv.length);
+            return csv[luckyNumber];
+        }else{
+            return values;
+        }
+    }
+    return false;
+}
 function loadCustomJava(appearance){
 function loadCustomJava(appearance){
     if(appearance.customThemeJava !== ''){
     if(appearance.customThemeJava !== ''){
         $('#custom-theme-javascript').html(appearance.customThemeJava);
         $('#custom-theme-javascript').html(appearance.customThemeJava);