forked from Takazudo/jQuery.TmplDeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
82 lines (78 loc) · 2.14 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
<!doctype html>
<html class="no-js" lang="ja">
<head>
<meta charset="utf-8">
<title>jQuery.TmplDeck example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="jquery.tmpldeck.js"></script>
<script src="underscore-min.js"></script>
<script>
var deck = $.TmplDeck('templates.html');
deck.load().done(function(){
/* basic */
$(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>!'
});
$('#placeholder1').html(src);
});
/* tested with _.template */
$(function(){
$('#placeholder2').html(_.template(deck.draw('templateFragmentId1'))({
title: 'TITLE de gesu yoooooo',
content_noescape: 'contents! <strong>contents</strong>!',
content_escape: 'contents! <strong>contents</strong>!'
}));
});
/* _.template shortcut */
$(function(){
$('#placeholder3').append(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>' }
]
}));
});
});
</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/Takazudo/jQuery.TmplDeck">jQuery.TmplDeck</a></h1>
<p>depends on: jQuery, 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>
<script>
/* ready fn test. this call back will be fired as soon as the deck was loaded */
deck.ready(function(){
$('#placeholder4').append(deck.tmpl('templateFragmentId3', {
content: 'ready fn test'
}));
});
</script>
</body>
</html>