forked from aliceui/aliceui.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.html
More file actions
333 lines (310 loc) · 11 KB
/
widget.html
File metadata and controls
333 lines (310 loc) · 11 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alice - 通用样式库</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="nico-spm 0.5.5" />
<link type="image/x-icon" href="../static/favicon.ico" rel="icon">
<link rel="stylesheet" href="../static/css/normalize.css" />
<link rel="stylesheet" href="../static/css/site.css" />
<link rel="stylesheet" href="../static/css/solarized.css" />
<link rel="stylesheet" href="../static/style.css" />
<style>
/* alipay iconfont */
@font-face {
font-family: "rei";
src: url("https://i.alipayobjects.com/common/fonts/rei.eot?20130423"); /* IE9 */
src: url("https://i.alipayobjects.com/common/fonts/rei.eot?20130423#iefix") format("embedded-opentype"), /* IE6-IE8 */
url("https://i.alipayobjects.com/common/fonts/rei.woff?20130423") format("woff"), /* chrome 6+、firefox 3.6+、Safari5.1+、Opera 11+ */
url("https://i.alipayobjects.com/common/fonts/rei.ttf?20130423") format("truetype"), /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */
url("https://i.alipayobjects.com/common/fonts/rei.svg?20130423#rei") format("svg"); /* iOS 4.1- */
}
.iconfont {
font-family: "rei"!important;
font-style: normal;
font-weight: normal;
cursor: default;
-webkit-font-smoothing: antialiased;
}
</style>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1239219615670154" crossorigin="anonymous"></script>
<script src="../static/js/sea.js?nowrap"></script>
<!--[if lt IE 9]>
<script src="../static/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<script src="../dist/bundle.js?nowrap"></script>
<div id="body-wrapper">
<div class="head-area">
<div class="title-area">
<h1>
<a href="../">Alice</a>
</h1>
<p class="description">写样式的更好方式</p>
<img src="/static/alice-top.png" alt="alice" />
</div>
<iframe src="http://ghbtns.com/github-btn.html?user=aliceui&repo=aliceui.org&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="90" height="20"></iframe>
</div>
<div class="nav-area">
<ol class="main-nav">
<li><a href="/"><i title="首页" class="iconfont"></i> 首页</a></li>
<li><a href="build.html">构建模块和样式库</a></li>
<li><a href="framework.html">基础框架</a></li>
<li><a href="javascript.html">JavaScript</a></li>
<li><a href="rule.html">规范和最佳实践</a></li>
<li><a href="start.html">开始使用</a></li>
<li><a href="tool.html">工具</a></li>
<li><a href="widget.html">通用样式库</a></li>
</ol>
</div>
<div class="main-area">
<div class="side-area">
<ul>
<li class="side-loading"><img width="160" alt="加载中..." src="/static/loading.gif"></li>
</ul>
</div>
<script type="text/template" id="list-template">
<li><a href="#"><i class="iconfont" title="单箭头右">å</i></a></li>
</script>
<div class="content-area">
<h1>通用样式库</h1>
<div class="content"><!--filepath:docs/widget.md --> <blockquote>
<p>Life is like a box of chocolate.
<em>「 Forrest Gump 」1994</em></p>
</blockquote>
<p>这里是一套按照 <a href="/docs/rule.html">Alice 规范</a> 和支付宝视觉规范搭建的的通用样式模块库。
找到你需要的模块,复制代码,然后享受生活去吧。</p>
<p><img src="https://i.alipayobjects.com/e/201303/2MQNiaBkFJ.png" alt=""></p>
<hr>
<div class="nico-insert-code"><script >
window['./docs/widget.css'];
</script>
<script type="text/template" id="alice-module">
<div class="alice-module">
<div class="alice-module-head">
<h2 class="alice-module-title">
<a href="#"></a>
</h2>
<span class="alice-module-version"></span>
<p class="alice-module-description"></p>
</div>
</div>
</script>
<script type="text/template" id="alice-module-demo">
<div class="alice-module-demo">
<h3 class="alice-module-subtitle"></h3>
<a class="alice-module-sourcecode" href="javascript:;">查看源码</a>
<div class="alice-module-dom"></div>
<pre class="alice-module-code"></pre>
</div>
</script>
<style>
.alice-module {
border-bottom: 1px solid #eee;
padding: 0;
margin-top: 20px;
margin-bottom: 50px;
font:12px/1.5 tahoma,arial,Hiragino Sans GB,"Microsoft Yahei",\5b8b\4f53;
}
.alice-module-head {
overflow: hidden;
}
.alice-module-title {
margin: 0;
font-size: 28px;
font-family: Trebuchet MS;
display: inline;
}
.alice-module-title a {
color: #7CAE23;
cursor: pointer;
}
.alice-module-link {
font-size: 14px;
}
.alice-module-version {
font-size: 12px;
font-weight: normal;
margin-left: 0.5em;
color: #888;
font-family: Menlo,Monaco,"Courier New",monospace;
}
p.alice-module-description {
font-size: 14px;
color: #888;
margin: 10px 0 20px;
}
.alice-module-demo {
border: 1px solid #eee;
border-bottom: none;
padding: 20px 130px 20px 20px;
position: relative;
}
.alice-module-demo:hover {
background: #fdfdfd;
}
.alice-module-dom {
margin-bottom: 8px;
}
.alice-module-code {
display: none;
margin: 0!important;
}
h3.alice-module-subtitle {
position: absolute;
top: 0;
right: 0;
border-radius: 3px;
margin: 0;
color: #777;
font-size: 12px;
background: #F8F8F8;
border-bottom: 1px solid #ddd;
border-left: 1px solid #ddd;
display: block;
font-size: 12px;
width: 100px;
padding: 5px 10px;
opacity: 0.8;
}
.alice-module-sourcecode {
position: absolute;
right: 125px;
top: 0;
font-size: 12px;
padding: 5px 10px;
background: #EFFFE4;
border-radius: 3px;
display: none;
z-index: 99;
opacity: 0.8;
}
a {
color: #08c;
}
.alice-loading {
margin-bottom: 20px;
}
.black {
font-size: 12px;
padding: 2px;
border-radius: 2px;
background: rgba(0, 0, 0, 0.55);
color: #fff;
}
</style>
<div class="alice-modules"></div>
<script >
var $ = window['jquery'];
var _ = window['underscore'];
var Popup = window['arale-popup'];
$('.alice-modules').on('mouseenter', '.alice-module-demo', function() {
$(this).find('.alice-module-sourcecode').fadeIn(200);
}).on('mouseleave', '.alice-module-demo', function() {
$(this).find('.alice-module-sourcecode').fadeOut(200);
});
new Popup({
trigger: '.alice-module-sourcecode',
template: '<div class="black">源码在下方</div>',
delay: -1,
delegateNode: '.alice-modules'
});
$('.alice-modules').on('click', '.alice-module-sourcecode', function() {
var code = $(this).parent().find('.alice-module-code');
if (code.is(':hidden')) {
code.animate({
opacity: 1,
height: 'toggle'
}, 200);
} else {
code.animate({
opacity: 0,
height: 'toggle'
}, 200);
}
});
$.getJSON('/docs/widgets.json?nowrap', function(data) {
var alias = data || {};
var deps = _.pairs(alias);
_.each(deps, function(dep) {
var name = dep[0].replace('alice-', '');
var version = dep[1];
var moduleNode = $($('#alice-module').html());
moduleNode.find('.alice-module-title a')
.attr('href', '/' + name)
.attr('id', 'modules-' + name)
.html(name);
moduleNode.find('.alice-module-version').html(
'<a href="http://spmjs.io/package/alice-' + name + '" target="_blank">' +
'</a>'
);
moduleNode.appendTo('.alice-modules');
var list = substractTitle(moduleNode.find('h2'));
$.ajax({
url: 'http://docs.spmjs.io/alice-' + name + '/latest/',
dataType: 'html',
success: function(data) {
data = $(data);
moduleNode.find('.alice-module-description')
.html(data.find('.entry-content > p:first-child').html());
data.find('.nico-insert-code').each(function(index, item) {
var demoNode = $($('#alice-module-demo').html());
item = $(item);
if (item.children()[0].tagName === 'LINK' ||
item.children()[0].tagName === 'STYLE') {
return;
}
var subtitle = item.prev().html();
if (item.prev()[0].tagName !== 'H3' || !subtitle) {
subtitle = '默认';
}
demoNode.find('.alice-module-subtitle').html(subtitle);
demoNode.find('.alice-module-dom').html(item.html());
// 直接使用目标页面生成的高亮代码,不再动态渲染
var codeHtml = item.next('.highlight').find('pre').html();
demoNode.find('.alice-module-code').html(codeHtml);
moduleNode.find('.alice-loading').remove();
demoNode.appendTo(moduleNode);
});
// 中文关键词,一般放在 keywords 数组的第一个
// 在这里写到左边索引栏中
var keywords = data.find('.sidebar-wrapper .sidebar-description').data('keyword');
if (keywords) {
list.find('i').html(keywords);
}
}
});
});
});
function substractTitle(item) {
$('.side-loading').remove();
item = item.find('a');
var list = $($('#list-template').html());
list.find('a').html(item.html() + list.find('a').html());
list.find('a').attr('href', '#' + item.attr('id'));
list.appendTo('.side-area ul');
return list;
}
</script></div></div>
</div>
</div>
</div>
<div id="footer-wrapper">
<footer>
<p class="powered">
<a href="http://aralejs.org">Arale</a> •
<a href="http://aliceui.org">Alice</a> •
<a href="http://seajs.org">Sea.js</a> •
<a href="http://spmjs.io">spmjs.io</a> •
<a href="http://lab.lepture.com/nico/">nico-spm</a>
</p>
</footer>
</div>
<script>
window['aliceui.org'].init();
</script>
</body>
</html>