-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
158 lines (143 loc) · 7 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Lately.js - 800bytes minimalist 'timeago' plugin.</title>
<meta name="description" content="Based on jQuery, only 800bytes of minimalist 'timeago' plugin.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Tokin">
<link rel="stylesheet" href="./static/style.css">
</head>
<body>
<div id="main">
<div class="header">
<div class="sticky">
<h1><b>Lately</b><b class="ext">.js</b></h1>
<h2>Native JavaScript, only <b>800Byte</b> but simple and easy to use Timeago plugin</h2>
<div class="navigate" id="navigate">
<a href="#navigate" class="navigate-open">Menu</a>
<ul class="content">
<li><a href="#id-get">Get</a></li=>
<li><a href="#id-reference">Reference</a></li>
<li><a href="#id-enable">Enable</a></li>
<li><a href="#id-example">Example</a></li>
<li><a href="#id-format">Format</a></li>
<li><a href="#id-localization">Localization</a></li>
<li><a href="https://github.com/Tokinx/lately" target="_blank">GtiHub</a></li>
</ul>
</div>
<a href="#close" class="navigate-close"></a>
<div class="l2d">
<span>Dark Mode: </span>
<input id="is-dark" name="is-dark" type="checkbox">
<label for="is-dark" class="pure-switch">
<div class="dot"></div>
</label>
</div>
</div>
</div>
<div class="main">
<div class="content">
<h2 id="id-get" class="content-subhead">Get</h2>
<p>
You can access Lately.js' <a href="https://github.com/Tokinx/Lately" target="_blank"
class="pure-button pure-button-primary">GitHub</a> directly to get the latest version of the
plug-in, or download Lately.js via link:
</p>
<p>
<a href="lately.js" class="pure-button" download>🚀 lately.js</a> or <a href="./lately.min.js"
class="pure-button" download>🚀 lately.min.js</a>
</p>
<h2 id="id-reference" class="content-subhead">Reference</h2>
<p>
Just put lately.js on your page.
</p>
<pre
class="code prettyprint"><code><script src="//tokinx.github.io/lately/lately.min.js"></script></code></pre>
<h2 id="id-enable" class="content-subhead">Enable</h2>
<p>
We give you a very simple initialization method so you can personalize your program and enable it
correctly
</p>
<pre class="code prettyprint"><code><script>
window.Lately && Lately.init({ target: 'time, .lately' });
</script></code></pre>
<h2 id="id-example" class="content-subhead">Example</h2>
<pre class="code prettyprint"><code>// DateTime
<time class="lately" datetime="2016-09-28T23:49:41+00:00" itemprop="datePublished" pubdate>2016-September-28</time>
// Title
<a href="#" class="lately" title="2017-02-14 18:56">Any string</a>
// HTML
<a href="#" class="lately">2017-02-12 21:39</a>
</code></pre>
<p>The code above performs as follows:</p>
<ul>
<li>DateTime:<time class="lately" datetime="2016-09-28T23:49:41+00:00" itemprop="datePublished"
pubdate>2016-September-28</time></li>
<li>Title:<a href="#" class="lately" title="2017-02-14 18:56">Any string</a></li>
<li>HTML:<a href="#" class="lately">2017-02-12 21:39</a></li>
</ul>
<h2 id="id-format" class="content-subhead">Format</h2>
<p>
Supports time formats that can be passed directly to JavaScript objects. <code
class="code prettyprint">new Date()</code>
</p>
<h2 id="id-localization" class="content-subhead">Localization</h2>
<p>The plug-in defaults to the "Chinese Simplified" language, but we provide a very simple interface for
your localized modifications.</p>
<p>You can set it up with the language at initialization:</p>
<pre class="code prettyprint"><code><script>
window.Lately && Lately.init({ target: 'time, .lately', lang: {
'second': ' Second',
'minute': ' Minute',
'hour': ' Hour',
'day': ' Days',
'month': ' Month',
'year': ' Years',
'ago': ' Ago',
'error': 'NaN'
}
});
</script></code></pre>
</div>
<div class="footer">
<div class="legal content">
<p class="legal-links">
<a href="https://github.com/Tokinx/Lately" target="_blank">GitHub Project</a> /
<a href="https://biji.io/" target="_blank">Author Blog</a> /
<a href="./index-zh.html">简体中文</a>
</p>
<p class="legal-license">
<a class="logo" href="https://biji.io/"></a> ©
<script>document.write(new Date().getFullYear())</script> Biji.IO. All rights reserved.
</p>
</div>
</div>
</div>
</div>
<script src="./lately.min.js"></script>
<script src="//cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<script>
if (navigator.language.substr(0, 2) === "zh" && location.hash !== "#en") {
window.location.replace('./index-zh.html');
}
addEventListener("DOMContentLoaded", () => {
document.querySelector("#is-dark").addEventListener("change", (e) => {
document.body.classList = e.target.checked ? "dark" : "light"
})
window.Lately && Lately.init({ target: 'time, .lately', lang: {
'second': ' Second',
'minute': ' Minute',
'hour': ' Hour',
'day': ' Days',
'month': ' Month',
'year': ' Years',
'ago': ' Ago',
'error': 'NaN'
}
});
});
</script>
</body>
</html>