-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex-zh.html
142 lines (128 loc) · 6.44 KB
/
index-zh.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
<!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>原生 JavaScript,仅 <b>800 字节</b>!却简单、好用的 Timeago 插件</h2>
<div class="navigate" id="navigate">
<a href="#navigate" class="navigate-open">菜单</a>
<ul class="content">
<li><a href="#id-get">获取</a></li=>
<li><a href="#id-reference">引用</a></li>
<li><a href="#id-enable">启用</a></li>
<li><a href="#id-example">示例</a></li>
<li><a href="#id-format">格式</a></li>
<li><a href="#id-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>黑暗模式:</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">获取</h2>
<p>
你可以直接访问Lately.js的 <a href="https://github.com/Tokinx/Lately" target="_blank"
class="pure-button pure-button-primary">GitHub</a>
来获取最新版插件,或通过链接下载Lately.js:
</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">引用</h2>
<p>
只需将lately.js放在您的页面上即可。
</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">启用</h2>
<p>
我们为您提供了非常简便的初始化方法,方便您对程序进行一些个性化设置并正确启用
</p>
<pre class="code prettyprint"><code><script>
window.Lately && Lately.init({ target: 'time, .lately' });
</script></code></pre>
<h2 id="id-example" class="content-subhead">示例</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>上方代码执行效果如下:</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">格式</h2>
<p>
支持可直传JavaScript <code class="code prettyprint">new Date()</code>
对象的时间格式。
</p>
<h2 id="id-localization" class="content-subhead">本地化</h2>
<p>插件默认为 “简体中文” 语言,但是我们提供了非常简单的接口,方便您的本地化修改。</p>
<p>您可以在初始化的时候连同语言一起设置:</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.html#en">English</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>
addEventListener("DOMContentLoaded", () => {
document.querySelector("#is-dark").addEventListener("change", (e) => {
document.body.classList = e.target.checked ? "dark" : "light"
})
window.Lately && Lately.init({ target: 'time, .lately' });
});
</script>
</body>
</html>