Repository navigation
Expand file tree
/
Copy pathdesk.html
More file actions
110 lines (98 loc) · 2.73 KB
/
Copy pathdesk.html
File metadata and controls
110 lines (98 loc) · 2.73 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Board</title>
<style >
*{
margin: 0;
}
.desk{
width: 50%;
margin-left: 25%;
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
border:2px solid #6f7373;
box-shadow: 0px 0px 15px rgba(0,0,0,0.4);
}
.place_b{
width: 12.5%;
height: auto;
background-color: #818992;
background-size: cover;
}
.place_w{
width: 12.5%;
height: auto;
background-color: #B2BBC6;
background-size: cover;
}
@media screen and (max-width: 1000px){
.desk{
width: 80%;
margin-left: 10%;
}
}
</style>
</head>
<body>
<div class="desk" id="deskk">
</div>
<script>
window.onload = function(){
let desk = document.getElementById('deskk');
heightt = desk.clientWidth + 'px';
desk.style.height = heightt ;
let place_w = document.getElementsByClassName('place_w');
let place_b = document.getElementsByClassName('place_b');
for (let i = 0;i<8;i++){
for(let k = 0;k<8;k++){
if((k+2)%2 == 0 && (i+2)%2 == 1){
desk.insertAdjacentHTML('beforeend','<div class=place_w ></div>');
};
if((k+2)%2 == 1 && (i+2)%2 == 1){
desk.insertAdjacentHTML('beforeend','<div class=place_b ></div>');
};
if((k+2)%2 == 0 && (i+2)%2 == 0){
desk.insertAdjacentHTML('beforeend','<div class=place_b ></div>');
};
if((k+2)%2 == 1 && (i+2)%2 == 0){
desk.insertAdjacentHTML('beforeend','<div class=place_w ></div>');
};
}
}
for(i = 1;i<65;i++){
if( i == 64 || i == 57){
desk.childNodes[i].style.backgroundImage = "url('./figures/wR.png')";
};
if( i == 1 || i == 8){
desk.childNodes[i].style.backgroundImage = "url('./figures/bR.png')";
};
if( i >= 9 && i <= 16){
desk.childNodes[i].style.backgroundImage = "url('./figures/bP.png')";
};
if( i >= 49 && i <= 56){
desk.childNodes[i].style.backgroundImage = "url('./figures/peshka.png')";
};
if( i == 58 || i == 63){
desk.childNodes[i].style.backgroundImage = "url('./figures/wN.png')";
};
if( i == 2 || i == 7){
desk.childNodes[i].style.backgroundImage = "url('./figures/bN.png')";
};
if( i == 3 || i == 6){
desk.childNodes[i].style.backgroundImage = "url('./figures/bB.png')";
};
if( i == 59 || i == 62){
desk.childNodes[i].style.backgroundImage = "url('./figures/wB.png')";
};
desk.childNodes[4].style.backgroundImage = "url('./figures/bQ.png')";
desk.childNodes[5].style.backgroundImage = "url('./figures/bK.png')";
desk.childNodes[60].style.backgroundImage = "url('./figures/wQ.png')";
desk.childNodes[61].style.backgroundImage = "url('./figures/wK.png')";
}
}
</script>
</body>
</html>