-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
98 lines (81 loc) · 2.48 KB
/
index.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
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>miniquery</title>
<style media="screen">
.container {
font-size: 2em;
}
.shaded {
color: gray;
}
</style>
<script src="lib/miniquery.js"></script>
</head>
<body>
<h3>Hall of Demos</h3>
<button type="button" name="button-sweet" onclick="demoSweetSelector()">SweetSelector</button>
<button type="button" name="button-dom" onclick="demoDOM()">DOM</button>
<button type="button" name="button-event" onclick="demoEventDispatcher()">EventDispatcher</button>
<button type="button" name="button-ajax" onclick="demoAjax()">AJAX Request</button>
<button type="button" name="button-alias" onclick="demoMiniQuery()">Namespace miniquery</button>
<button type="button" name="button-alias" onclick="demoAlias()">Alias $</button>
<hr>
<h3>Hall of Elements</h3>
<div class="container">
<div id="eyed">id: eyed</div>
<div class="klass">class: klass 1</div>
<a class="klass" href="#hello">Hello!</a>
<div class="klass">class: klass 2</div>
</div>
</body>
<script>
function demoSweetSelector() {
console.log(`SweetSelector.select('#eyed')`)
console.log(SweetSelector.select('#eyed'))
console.log(`SweetSelector.select('.klass')`)
console.log(SweetSelector.select('.klass'))
console.log(`SweetSelector.select('a')`)
console.log(SweetSelector.select('a'))
}
function demoDOM() {
DOM.hide('.klass')
DOM.show('.klass')
DOM.removeClass('.klass', 'shaded')
DOM.addClass('.klass', 'shaded')
}
function demoEventDispatcher() {
EventDispatcher.on('.klass', 'click', function() {
console.log("Awesome")
})
}
function demoAjax() {
AjaxWrapper.request({
url: 'http://localhost:3000/',
type: 'GET',
success: function(data) {
console.log("Success: ", data)
},
fail: function() {
console.log("ERROR")
}
})
}
function demoMiniQuery() {
// miniquery
miniquery("#eyed").hide()
setTimeout(function() {
miniquery("#eyed").show()
}, 2000)
}
function demoAlias() {
$("#eyed").hide()
setTimeout(function() {
$("#eyed").show()
}, 2000)
}
</script>
</html>