-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.html
90 lines (90 loc) · 2.45 KB
/
theme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE html>
<html>
<head>
<title>Themes</title>
<style type="text/css">
body {
color:white;
}
.themes {
width:98%;
margin:0 auto;
margin-left:2%;
margin-top:2%;
}
.theme {
background:rgba(0,0,0,0.75);
width:14.1%;
text-align:center;
display:inline-block;
margin-right:2.5%;
margin-bottom:2.5%;
}
.theme img {
width:100%;
}
.theme span {
color:white;
display:block;
padding:10px;
}
.pointer {cursor: pointer;}
.back {
float:right;
margin:18px;
font-size:25px;
text-align:center;
display:block;
line-height:35px;
width:10%;
text-decoration:none;
height:35px;
background:white;
color:black;
border-radius:15px;
}
.back:hover{
border:2px solid white;
background:transparent;
box-sizing:border-box;
color:white;
}
</style>
</head>
<body>
<div>
<h1 style="float:left;" >Themes</h1>
<a href="http://10.12.1.125/index.html" class="back" >Back > </a>
</div><hr style="clear:both;" >
<div class="themes" >
<div class="theme" ><img src="1.jpg" ><button class="pointer" onclick="set(0)">Select</button></div>
</div>
<script type="text/javascript">
if(localStorage.getItem("theme")==null){
localStorage.setItem("theme","1.jpg")
}
document.body.style.background = "url('"+localStorage.getItem("theme")+"')"
document.body.style.backgroundSize = "cover"
var imgs = ["1.jpg","2.jpg","3.jpg","4.jpg","5.jpg","6.jpg","7.jpg","8.jpg","9.jpg","10.jpg","11.jpg","12.jpg","13.jpg","14.jpg","15.jpg","16.jpg","17.jpg","18.jpg","19.jpg","20.jpg","21.jpg","22.jpg","23.jpg","24.jpg","25.jpg","26.jpg","27.jpg","28.jpg","29.jpg","30.jpg","31.jpg","32.jpg","33.jpg","34.jpg","35.jpg","36.jpg","37.jpg","38.jpg","39.jpg","40.jpg","41.jpg","42.jpg","43.jpg","44.jpg","45.jpg","46.jpg","47.jpg","48.jpg","49.jpg","50.jpg"];
render()
function render(){
document.querySelector(".themes").innerHTML=""
for(let i=0;i<imgs.length;i++){
var selectText = "Select"
var textColor = "white"
if(localStorage.theme==imgs[i]){
selectText="Selected"
textColor="green"
}
document.querySelector(".themes").innerHTML+='<div class="theme" ><img src="'+imgs[i]+'" ><span style="color:'+textColor+';" onclick="set('+i+')">'+selectText+'</span></div>';
}
}
function set(i){
localStorage.setItem("theme",imgs[i])
render()
document.body.style.background = "url('"+imgs[i]+"')"
document.body.style.backgroundSize = "cover"
}
</script>
</body>
</html>