-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
70 lines (61 loc) · 3.3 KB
/
index.html
File metadata and controls
70 lines (61 loc) · 3.3 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
<!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">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<title>Document</title>
</head>
<body class="bg-light">
<div class="container py-3">
<!-- Example 1 -->
<div>
<h3>Example Case 1</h3>
<div class="row">
<div class="col-6">
<p class="border-bottom"><strong>Data</strong></p>
<pre class="example1Data small"></pre>
</div>
<div class="col-6">
<p class="border-bottom"><strong>Template</strong></p>
<pre class="example1Template small"></pre>
</div>
</div>
<p class="border-bottom"><strong>Result</strong></p>
<div class="example1 row py-4"></div>
<script type="text/html" id="tmplExample1">
<div class="col-4">
<div class="card mb-3">
<img class="card-img-top" src="{Image}">
<div class="card-body">
<h4 class="card-title">{ Title }</h4>
<p class="card-text">{ Text | truncateWords:7 }</p>
<p class="card-text">{ Array | join }</p>
<small class="text-muted">{ Date | moment:'MMMM DD, YYYY' }</small>
</div>
<div class="card-footer">
<a href="{Link}" class="card-link">{ LinkText | uppercase }</a>
</div>
</div>
</div>
</script>
</div>
</div>
<script src="./mc.js"></script>
<script>
// Example 1
var Example1Data = [
{ Image: 'https://source.unsplash.com/daily', Title: 'Example Title', Text: 'This is sample text for the card', Date: new Date('09/10/2018'), Link: 'https://google.com', LinkText: 'Click Me' },
{ Image: 'https://source.unsplash.com/daily', Title: 'Example Title', Text: 'This is longer text should be truncated somewhere around here', Date: new Date('09/12/2018') },
{ Image: 'https://source.unsplash.com/daily', Title: 'Example Title', Text: 'This is sample text for the card', Date: new Date('09/15/2018'), Array: ['cat','dog','fish'] },
]
$('.example1Data').html(JSON.stringify(Example1Data, null, 3));
$('.example1Template').html($('#tmplExample1').html().replace(/</g, '<').replace(/>/g, '>').replace(new RegExp($('#tmplExample1').html().match(/\s*\n[\t\s]*/), "g"),'\n'));
$('.example1').html(mc.template.run($('#tmplExample1'), Example1Data));
// Example 2
</script>
</body>
</html>