Марков Сергей Викторович
2 years ago
6 changed files with 61 additions and 13 deletions
@ -1,2 +1,2 @@
|
||||
primary_html: "index.html" |
||||
secondary_html: "index.html" |
||||
secondary_html: "secondary.html" |
||||
|
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<link rel="stylesheet" href="style.css" class="style"> |
||||
<script type="text/javascript" src="wallpapper.js"></script> |
||||
<script type="text/javascript"> |
||||
function initGreeter() { |
||||
let defaultWallpapper = window.localStorage.getItem(DEFAULT_WALLPAPPER); |
||||
if(defaultWallpapper) { |
||||
updateWallpapper(defaultWallpapper); |
||||
} |
||||
} |
||||
|
||||
window.addEventListener("GreeterReady", initGreeter) |
||||
</script> |
||||
<title>Example Theme</title> |
||||
</head> |
||||
<body /> |
||||
</html> |
@ -0,0 +1,30 @@
|
||||
const DEFAULT_WALLPAPPER = "defaultWallpapper"; |
||||
const WALLPAPPER_ELEMENT = "wallpappers"; |
||||
|
||||
|
||||
function setWallpapper(wallpapper) { |
||||
console.log(wallpapper) |
||||
var body = document.getElementsByTagName('body')[0]; |
||||
body.style.backgroundImage = wallpapper; |
||||
} |
||||
|
||||
function updateWallpapper(wallpapper) { |
||||
let wall_file = `url(wallpappers/${wallpapper})` |
||||
if (wallpapper === 'User') { |
||||
setWallpapper(`url(wallpappers/Rosatomflot.jpg)`) |
||||
theme_utils.dirlist(`/usr/share/web-greeter/themes/basealt/wallpappers`, true, (images) => { |
||||
if(images) { |
||||
console.log(images) |
||||
for (let i = 0; i < images.length; i++) { |
||||
let image = images[i] |
||||
if(image.indexOf("/wallpapper.png") == image.length - 15) { |
||||
setWallpapper(`url(${image})`) |
||||
console.log(wall_file) |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
setWallpapper(`url(wallpappers/${wallpapper})`) |
||||
} |
||||
} |
Loading…
Reference in new issue