-
Notifications
You must be signed in to change notification settings - Fork 1
/
slave.html
78 lines (62 loc) · 2.2 KB
/
slave.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>popsicle</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
<style type="text/css">
html,body
{
width: 100%; height: 100%; padding:0; margin:0;
}
.brrr
{
width: 100%; height: 100%; background: #FFF; position: relative;
}
img
{
max-height: 100%; max-width: 100%; height: auto; width: auto; display: block; position: absolute; top: 0; bottom: 0; left: 0; right: 0; box-sizing: border-box; margin: auto;
}
</style>
</head>
<body>
<div class="brrr">
<img id="letterform" src="a.gif"/>
</div>
<!-- load Firebase library -->
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-database.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCuVBF2WWt2tD53KO40S2dungEEx3I6yJQ",
authDomain: "anything-is-popsicle.firebaseapp.com",
databaseURL: "https://anything-is-popsicle.firebaseio.com",
projectId: "anything-is-popsicle",
storageBucket: "",
messagingSenderId: "604298729851"
};
var popsicle_app = firebase.initializeApp(config);
<!-- Commands go here. -->
// console.log("popsicle_app:",popsicle_app.name) ;
popsicle_db = firebase.database();
var image_folder = 'img' ;
var url_string = window.location.href;
var url = new URL(url_string);
var color = url.searchParams.get("color");
var monitor = url.searchParams.get("monitor");
// console.log("color:", color);
// console.log("monitor:", monitor);
var character = firebase.database().ref('popsicles/' + color + '/' + monitor);
character.on('value', function (snapshot) {
// console.log("character:", snapshot.val());
update_character(snapshot.val());
});
function update_character(character) {
letterform = document.getElementById('letterform');
letterform.src = image_folder+'/'+character.toUpperCase() + '.gif';
// letterform.title = character.toLowerCase() ;
}
</script>
</body>
</html>