|
@@ -68,11 +68,12 @@
|
|
Background Wallpaper
|
|
Background Wallpaper
|
|
<div class="sub header">Set your desktop background wallpaper theme.</div>
|
|
<div class="sub header">Set your desktop background wallpaper theme.</div>
|
|
</h4>
|
|
</h4>
|
|
- <select id="wallpaperlist" class="ui fluid dropdown" onchange="handleBackgroundSelectionChange(this.value);">
|
|
|
|
|
|
+ <select id="wallpaperlist" class="ui fluid dropdown allowSelectDefaultThemes" onchange="handleBackgroundSelectionChange(this.value);">
|
|
<option value="">Wallpaper Packs</option>
|
|
<option value="">Wallpaper Packs</option>
|
|
</select>
|
|
</select>
|
|
- <br>
|
|
|
|
- <button class="ui small green right floated button" onclick="applyWallpaper();"><i class="checkmark icon"></i> Apply Wallpaper</button>
|
|
|
|
|
|
+ <small>This option will be disabled by default if you have set your "User Defined Wallpaper" in Advance tab.</small>
|
|
|
|
+ <br> <br>
|
|
|
|
+ <button class="ui small green right floated button allowSelectDefaultThemes" onclick="applyWallpaper();"><i class="checkmark icon"></i> Apply Wallpaper</button>
|
|
<br><br><br>
|
|
<br><br><br>
|
|
<div class="ui green segment" style="display:none" id="wallpaperChangeConfirm">
|
|
<div class="ui green segment" style="display:none" id="wallpaperChangeConfirm">
|
|
<h4 class="ui header">
|
|
<h4 class="ui header">
|
|
@@ -165,17 +166,28 @@
|
|
|
|
|
|
|
|
|
|
//Startup process
|
|
//Startup process
|
|
- initCurrentBackgroundPreview();
|
|
|
|
initDefaultBackgroundChangeValue();
|
|
initDefaultBackgroundChangeValue();
|
|
- initUserDefinedWallpaperFolder();
|
|
|
|
|
|
+ initUserDefinedWallpaperFolder(function(themeName){
|
|
|
|
+ initCurrentBackgroundPreview(themeName);
|
|
|
|
+ });
|
|
|
|
|
|
- function initUserDefinedWallpaperFolder(){
|
|
|
|
- var userDefinedFolder = localStorage.getItem("ao/desktop/backgroundoverwrite");
|
|
|
|
- if (userDefinedFolder == null){
|
|
|
|
- $("#userSelectedFolderPath").text("Disabled");
|
|
|
|
- }else{
|
|
|
|
- $("#userSelectedFolderPath").text(userDefinedFolder);
|
|
|
|
- }
|
|
|
|
|
|
+ //Return the data stored in the theme settings
|
|
|
|
+ //Will return either theme pack name or path for user defined folder
|
|
|
|
+ function initUserDefinedWallpaperFolder(callback = undefined){
|
|
|
|
+ $.get("../../system/desktop/theme?get=true", function(data) {
|
|
|
|
+ if (data.includes(":/")){
|
|
|
|
+ //This is a path
|
|
|
|
+ $("#userSelectedFolderPath").text(data);
|
|
|
|
+ $(".allowSelectDefaultThemes").addClass("disabled");
|
|
|
|
+ }else{
|
|
|
|
+ $("#userSelectedFolderPath").text("Disabled");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (callback != undefined){
|
|
|
|
+ callback(data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -221,15 +233,37 @@
|
|
var filepath = filedata[i].filepath;
|
|
var filepath = filedata[i].filepath;
|
|
|
|
|
|
//Save the overwrite folder path
|
|
//Save the overwrite folder path
|
|
- localStorage.setItem("ao/desktop/backgroundoverwrite",filepath);
|
|
|
|
$("#userSelectedFolderPath").text(filepath);
|
|
$("#userSelectedFolderPath").text(filepath);
|
|
|
|
+ $.get("../../system/desktop/theme?set=" + filepath, function(data) {
|
|
|
|
+ //Reload desktop background pack
|
|
|
|
+ if (ao_module_virtualDesktop){
|
|
|
|
+ parent.changeDesktopTheme(filepath);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //Disable change to system build in themes
|
|
|
|
+ $(".allowSelectDefaultThemes").addClass("disabled");
|
|
|
|
+
|
|
|
|
+ //Load the preview
|
|
|
|
+ initCurrentBackgroundPreview();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
function clearUserSelectedFolder(){
|
|
function clearUserSelectedFolder(){
|
|
//Clear user selected folder
|
|
//Clear user selected folder
|
|
- localStorage.removeItem("ao/desktop/backgroundoverwrite");
|
|
|
|
- initUserDefinedWallpaperFolder();
|
|
|
|
|
|
+ $.get("../../system/desktop/theme?set=default", function(data) {
|
|
|
|
+ //Reload desktop background pack
|
|
|
|
+ if (ao_module_virtualDesktop){
|
|
|
|
+ parent.changeDesktopTheme("default");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //Re-enable the default theme seelct
|
|
|
|
+ $(".allowSelectDefaultThemes").removeClass("disabled");
|
|
|
|
+ $("#userSelectedFolderPath").text("Disabled");
|
|
|
|
+
|
|
|
|
+ initUserDefinedWallpaperFolder();
|
|
|
|
+ initCurrentBackgroundPreview();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
function initCurrentBackgroundPreview(){
|
|
function initCurrentBackgroundPreview(){
|
|
@@ -253,32 +287,55 @@
|
|
//Get the user theme settings
|
|
//Get the user theme settings
|
|
$(".backgroundpreview").attr('src','../../img/desktop/bg/nobg.jpg');
|
|
$(".backgroundpreview").attr('src','../../img/desktop/bg/nobg.jpg');
|
|
|
|
|
|
- //Check if the theme exists
|
|
|
|
- var themeExists = false;
|
|
|
|
- var targetThemeObject;
|
|
|
|
- desktopThemeList.forEach(theme => {
|
|
|
|
- if (theme.Theme == data){
|
|
|
|
- //Theme exists
|
|
|
|
- themeExists = true;
|
|
|
|
- targetThemeObject = theme;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
|
|
- if (themeExists == false){
|
|
|
|
- //This theme not exists. Do not load preview
|
|
|
|
- $("#wallpaperlist").dropdown("set selected","Default");
|
|
|
|
|
|
+ //Check if the theme is custom path
|
|
|
|
+ if (data.includes(":/")){
|
|
|
|
+ //Is path. Load path preview
|
|
|
|
+ $.get("../../system/desktop/theme?load=" + data, function(imagelist){
|
|
|
|
+ //Load background preview
|
|
|
|
+ loadBackgroundPreviewForCustomFolder(imagelist);
|
|
|
|
+ //End of startup process
|
|
|
|
+ isStartingUp = false;
|
|
|
|
+ });
|
|
}else{
|
|
}else{
|
|
- loadBackgroundPreview(targetThemeObject);
|
|
|
|
- var themeName = data.charAt(0).toUpperCase() + data.slice(1)
|
|
|
|
- $("#wallpaperlist").dropdown("set selected",themeName);
|
|
|
|
|
|
+ //Check if the theme exists
|
|
|
|
+ var themeExists = false;
|
|
|
|
+ var targetThemeObject;
|
|
|
|
+ desktopThemeList.forEach(theme => {
|
|
|
|
+ if (theme.Theme == data){
|
|
|
|
+ //Theme exists
|
|
|
|
+ themeExists = true;
|
|
|
|
+ targetThemeObject = theme;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (themeExists == false){
|
|
|
|
+ //This theme not exists. Do not load preview
|
|
|
|
+ $("#wallpaperlist").dropdown("set selected","Default");
|
|
|
|
+ }else{
|
|
|
|
+ loadBackgroundPreview(targetThemeObject);
|
|
|
|
+ var themeName = data.charAt(0).toUpperCase() + data.slice(1)
|
|
|
|
+ $("#wallpaperlist").dropdown("set selected",themeName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //End of startup process
|
|
|
|
+ isStartingUp = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- //End of startup process
|
|
|
|
- isStartingUp = false;
|
|
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function loadBackgroundPreviewForCustomFolder(imageList){
|
|
|
|
+ $("#backgroundPreviewList").html("");
|
|
|
|
+ $("#mainBackground").attr("src","../../media/?file=" + imageList[0]);
|
|
|
|
+
|
|
|
|
+ for (var i = 1; i < imageList.length; i++){
|
|
|
|
+ $("#backgroundPreviewList").append(`<div class="four wide column">
|
|
|
|
+ <img class="ui fluid image backgroundpreview" src="${"../../media/?file=" + imageList[i]}">
|
|
|
|
+ </div>`);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
function loadBackgroundPreview(targetThemeObject){
|
|
function loadBackgroundPreview(targetThemeObject){
|
|
$("#backgroundPreviewList").html("");
|
|
$("#backgroundPreviewList").html("");
|
|
var imageList = targetThemeObject.Bglist;
|
|
var imageList = targetThemeObject.Bglist;
|