forked from Takazudo/jQuery.TmplDeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex_nojquery.html
97 lines (91 loc) · 2.6 KB
/
index_nojquery.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
<!doctype html>
<html class="no-js" lang="ja">
<head>
<meta charset="utf-8">
<title>TmplDeck example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="underscore-min.js"></script>
<script src="jsdeferred.js"></script>
<script src="tmpldeck.js"></script>
<script>
var deck = TmplDeck('templates.html');
deck.load().next(function(){
(function() {
var tmpl1 = deck.draw('templateFragmentId1');
var src = _.template(tmpl1)({
title: 'TITLE de gesu yoooooo',
content_noescape: 'contents! <strong>contents</strong>!',
content_escape: 'contents! <strong>contents</strong>!'
});
document.getElementById('placeholder1').innerHTML = src;
}());
(function() {
var placeholder2 = document.getElementById('placeholder2');
placeholder2.innerHTML = _.template(deck.draw('templateFragmentId1'))({
title: 'TITLE de gesu yoooooo',
content_noescape: 'contents! <strong>contents</strong>!',
content_escape: 'contents! <strong>contents</strong>!'
});
}());
(function() {
var placeholder3 = document.getElementById('placeholder3');
placeholder3.innerHTML = deck.tmpl('templateFragmentId2', {
title: 'TITLE de gesu yoooooo',
items: [
{ title: 'title desu', content: 'content <b>desu</b>' },
{ title: 'title desu', content: 'content <b>desu</b>' },
{ title: 'title desu', content: 'content <b>desu</b>' },
{ title: 'title desu', content: 'content <b>desu</b>' }
]
});
}());
(function() {
var placeholder5 = document.getElementById('placeholder5');
placeholder5.innerHTML = deck.tmpl('templateFragmentId4', {
items: [
{ sex: 'male', name: 'Kiteretsu' },
{ sex: 'female', name: 'Miyo' },
{ sex: 'male', name: 'Kouji' },
{ sex: 'male', name: 'Korosuke' },
{ sex: 'male', name: 'Kaoru' }
]
});
}());
});
</script>
<style>
body{
font-family:sans-serif;
font-size:1.3em;
}
.block{
border:1px solid #000;
margin:10px;
padding:10px;
}
th,td{
border:1px solid #000;
padding:.25em .4em;
}
</style>
</head>
<body>
<h1><a href="https://github.com/5509/jQuery.TmplDeck">TmplDeck</a></h1>
<p>depends on: JSDeferred.js, underscore.js</p>
<p>see <a href="templates.html">template file</a></p>
<div id="placeholder1"></div>
<div id="placeholder2"></div>
<div id="placeholder3"></div>
<div id="placeholder4"></div>
<div id="placeholder5"></div>
<script>
/* ready fn test. this call back will be fired as soon as the deck was loaded */
deck.ready(function(){
var placeholder4 = document.getElementById('placeholder4');
placeholder4.innerHTML = deck.tmpl('templateFragmentId3', {
content: 'ready fn test'
});
});
</script>
</body>
</html>