Skip to content

Commit c3ddeec

Browse files
committed
3.6
1 parent 780b5d5 commit c3ddeec

File tree

8 files changed

+169
-161
lines changed

8 files changed

+169
-161
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ _site
2121
sea-modules
2222
.cache
2323
spm_modules
24+
node_modules

_templates/layout.html

+7-12
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,17 @@
5555
<script src="{{static_url('js/sea.js?nowrap')}}"></script>
5656
{%- endif %}
5757

58-
<script>
59-
seajs.config({
60-
base: "{{content_url('')}}",
61-
alias: {{deps|json_encode}}
62-
});
63-
</script>
6458
<!--[if lt IE 9]>
6559
<script src="{{static_url('js/html5shiv.js')}}"></script>
6660
<![endif]-->
6761
{%- endblock %}
6862
{%- block afterstyle %}{% endblock %}
69-
<script>
70-
seajs.use(['arale-sticky', '/static/side'], function(Sticky, side) {
71-
Sticky('.side-area', 20);
72-
side.init();
73-
});
74-
</script>
63+
7564
</head>
7665
<body>
66+
67+
<script src="{{content_url('')}}dist/bundle.js?nowrap"></script>
68+
7769
<div id="body-wrapper">
7870
<div class="head-area">
7971
<div class="title-area">
@@ -142,6 +134,9 @@ <h1>{{post.title}}</h1>
142134
</p>
143135
</footer>
144136
</div>
137+
<script>
138+
window['aliceui.org'].init();
139+
</script>
145140
</body>
146141
</html>
147142

docs/framework.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,16 @@ Alice 引入了一个优秀的 CSS3 [动画库](http://aliceui.org/animate) 。
242242
<div id="test1" class="animate-demo">点击我</div>
243243
<div id="test2" class="animate-demo">点击我</div>
244244

245-
<script>
246-
seajs.use(['jquery'], function($) {
247-
$('#test1').click(function() {
248-
$(this).addClass('animated bounceOutLeft');
249-
});
250-
$('#test2').click(function() {
251-
$(this).addClass('animated rotateInUpRight');
252-
});
245+
````
246+
247+
````javascript
248+
var $ = require('jquery');
249+
$('#test1').click(function() {
250+
$(this).addClass('animated bounceOutLeft');
251+
});
252+
$('#test2').click(function() {
253+
$(this).addClass('animated rotateInUpRight');
253254
});
254-
</script>
255255
````
256256

257257
所有的动画效果请点击 [daneden.me/animate](http://daneden.github.io/animate.css/) 查看。

docs/javascript.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ Alice 中的 tab 模块就非常适合和 Switchable 进行配合。
5858

5959

6060
````html
61-
<link href="/alice-tab/1.1.0/index.css" rel="stylesheet">
6261
<style>
6362
.panel {
6463
display: none;
@@ -93,6 +92,7 @@ Alice 中的 tab 模块就非常适合和 Switchable 进行配合。
9392
上面是 DOM 结构和样式文件。然后加上 Switchable 的代码。更多使用方式请访问 [文档](http://aralejs.org/switchable) 。
9493

9594
````js
95+
require('alice-tab');
9696
var Switchable = require('arale-switchable');
9797

9898
new Switchable.Tabs({
@@ -110,11 +110,11 @@ new Switchable.Tabs({
110110
可以和 [alice.select](http://aliceui.org/select/) 进行配合。
111111

112112
````html
113-
<link href="/alice-select/1.1.0/dist/select.css" rel="stylesheet">
114113
<input type="text" id="input" placeholder="请输入 a">
115114
````
116115

117116
````js
117+
require('alice-select');
118118
var $ = require('jquery');
119119
var AutoComplete = require('arale-autocomplete');
120120
new AutoComplete({
@@ -129,8 +129,6 @@ new AutoComplete({
129129
[Popup](http://aralejs.org/popup) 的职责是有触发元素的浮层交互,可以和 [alice/button-dropdown](http://aliceui.org/button-dropdown/) 配合使用。
130130

131131
````html
132-
<link href="/alice-button-dropdown/1.3.0/index.css" rel="stylesheet">
133-
134132
<div class="ui-button-dropdown">
135133
<a class="ui-button ui-button-lorange ui-dbutton ui-dbutton-orange" id="popup-trigger">
136134
<span class="ui-dbutton-self">下拉菜单</span>
@@ -154,6 +152,7 @@ new AutoComplete({
154152
````
155153

156154
````js
155+
require('alice-button-dropdown');
157156
var Popup = require('arale-popup');
158157
new Popup({
159158
trigger: '#popup-trigger',
@@ -204,10 +203,10 @@ new Tip({
204203

205204
````html
206205
<button class="ui-button ui-button-lorange" id="confirmbox">Please click me!!!</button>
207-
<link href="/arale-dialog/1.4.0/src/dialog.css" rel="stylesheet">
208206
````
209207

210208
````js
209+
require('arale-dialog/src/dialog.css');
211210
var Dialog = require('arale-dialog');
212211

213212
new Dialog.ConfirmBox({

docs/widget.css

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
@import url("alice-box");
2-
@import url("alice-button-dropdown");
3-
@import url("alice-form");
4-
@import url("alice-button");
5-
@import url("alice-list");
6-
@import url("alice-nav");
7-
@import url("alice-paging");
8-
@import url("alice-poptip");
9-
@import url("alice-table");
10-
@import url("alice-tipbox");
11-
@import url("alice-tiptext");
12-
@import url("alice-select");
13-
@import url("alice-loading");
14-
@import url("alice-step");
1+
@import url("~alice-box");
2+
@import url("~alice-button-dropdown");
3+
@import url("~alice-form");
4+
@import url("~alice-button");
5+
@import url("~alice-list");
6+
@import url("~alice-nav");
7+
@import url("~alice-paging");
8+
@import url("~alice-poptip");
9+
@import url("~alice-table");
10+
@import url("~alice-tipbox");
11+
@import url("~alice-tiptext");
12+
@import url("~alice-select");
13+
@import url("~alice-loading");
14+
@import url("~alice-step");

docs/widget.md

+96-97
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
---
1717

1818
`````html
19-
<link rel="stylesheet" href="/docs/widget.css">
19+
<script type="text/spm">
20+
require('./widget.css');
21+
</script>
2022

2123
<script type="text/template" id="alice-module">
2224
<div class="alice-module">
@@ -138,110 +140,107 @@ a {
138140

139141
<div class="alice-modules"></div>
140142

141-
<script type="text/javascript">
142-
seajs.use(['jquery', 'underscore', 'arale-popup'], function($, _, Popup) {
143+
<script type="text/spm">
144+
var $ = require('jquery');
145+
var _ = require('underscore');
146+
var Popup = require('arale-popup');
143147
144-
$('.alice-modules').on('mouseenter', '.alice-module-demo', function() {
145-
$(this).find('.alice-module-sourcecode').fadeIn(200);
146-
}).on('mouseleave', '.alice-module-demo', function() {
147-
$(this).find('.alice-module-sourcecode').fadeOut(200);
148-
});
148+
$('.alice-modules').on('mouseenter', '.alice-module-demo', function() {
149+
$(this).find('.alice-module-sourcecode').fadeIn(200);
150+
}).on('mouseleave', '.alice-module-demo', function() {
151+
$(this).find('.alice-module-sourcecode').fadeOut(200);
152+
});
149153
150-
new Popup({
151-
trigger: '.alice-module-sourcecode',
152-
template: '<div class="black">源码在下方</div>',
153-
delay: -1,
154-
delegateNode: '.alice-modules'
155-
});
154+
new Popup({
155+
trigger: '.alice-module-sourcecode',
156+
template: '<div class="black">源码在下方</div>',
157+
delay: -1,
158+
delegateNode: '.alice-modules'
159+
});
156160
157-
$('.alice-modules').on('click', '.alice-module-sourcecode', function() {
158-
var code = $(this).parent().find('.alice-module-code');
159-
if (code.is(':hidden')) {
160-
code.animate({
161-
opacity: 1,
162-
height: 'toggle'
163-
}, 200);
164-
} else {
165-
code.animate({
166-
opacity: 0,
167-
height: 'toggle'
168-
}, 200);
169-
}
170-
});
161+
$('.alice-modules').on('click', '.alice-module-sourcecode', function() {
162+
var code = $(this).parent().find('.alice-module-code');
163+
if (code.is(':hidden')) {
164+
code.animate({
165+
opacity: 1,
166+
height: 'toggle'
167+
}, 200);
168+
} else {
169+
code.animate({
170+
opacity: 0,
171+
height: 'toggle'
172+
}, 200);
173+
}
174+
});
171175
172-
$.getJSON('/docs/widgets.json?nowrap', function(data) {
173-
var alias = data || {};
174-
var deps = _.pairs(alias);
175-
_.each(deps, function(dep) {
176-
var name = dep[0].replace('alice-', '');
177-
var version = dep[1];
178-
179-
var moduleNode = $($('#alice-module').html());
180-
moduleNode.find('.alice-module-title a')
181-
.attr('href', '/' + name)
182-
.attr('id', 'modules-' + name)
183-
.html(name);
184-
moduleNode.find('.alice-module-version').html(
185-
'<a href="http://spmjs.io/package/alice-' + name + '" target="_blank">' +
186-
'<img src="http://spmjs.io/badge/alice-' + name + '">' +
187-
'</a>'
188-
);
189-
moduleNode.appendTo('.alice-modules');
190-
var list = substractTitle(moduleNode.find('h2'));
191-
192-
$.ajax({
193-
url: 'http://docs.spmjs.io/alice-' + name + '/latest/',
194-
dataType: 'html',
195-
success: function(data) {
196-
data = $(data);
197-
moduleNode.find('.alice-module-description')
198-
.html(data.find('.entry-content > p:first-child').html());
199-
200-
data.find('.nico-insert-code').each(function(index, item) {
201-
var demoNode = $($('#alice-module-demo').html());
202-
item = $(item);
203-
if (item.children()[0].tagName === 'LINK' ||
204-
item.children()[0].tagName === 'STYLE') {
205-
return;
206-
}
207-
var subtitle = item.prev().html();
208-
if (item.prev()[0].tagName !== 'H3' || !subtitle) {
209-
subtitle = '默认';
210-
}
211-
demoNode.find('.alice-module-subtitle').html(subtitle);
212-
demoNode.find('.alice-module-dom').html(item.html());
213-
// 直接使用目标页面生成的高亮代码,不再动态渲染
214-
var codeHtml = item.next('.highlight').find('pre').html();
215-
demoNode.find('.alice-module-code').html(codeHtml);
216-
217-
moduleNode.find('.alice-loading').remove();
218-
demoNode.appendTo(moduleNode);
219-
});
220-
221-
// 中文关键词,一般放在 keywords 数组的第一个
222-
// 在这里写到左边索引栏中
223-
var keywords = data.find('.sidebar-wrapper .sidebar-description').data('keyword');
224-
if (keywords) {
225-
list.find('i').html(keywords);
176+
$.getJSON('/docs/widgets.json?nowrap', function(data) {
177+
var alias = data || {};
178+
var deps = _.pairs(alias);
179+
_.each(deps, function(dep) {
180+
var name = dep[0].replace('alice-', '');
181+
var version = dep[1];
182+
183+
var moduleNode = $($('#alice-module').html());
184+
moduleNode.find('.alice-module-title a')
185+
.attr('href', '/' + name)
186+
.attr('id', 'modules-' + name)
187+
.html(name);
188+
moduleNode.find('.alice-module-version').html(
189+
'<a href="http://spmjs.io/package/alice-' + name + '" target="_blank">' +
190+
'<img src="http://spmjs.io/badge/alice-' + name + '">' +
191+
'</a>'
192+
);
193+
moduleNode.appendTo('.alice-modules');
194+
var list = substractTitle(moduleNode.find('h2'));
195+
196+
$.ajax({
197+
url: 'http://docs.spmjs.io/alice-' + name + '/latest/',
198+
dataType: 'html',
199+
success: function(data) {
200+
data = $(data);
201+
moduleNode.find('.alice-module-description')
202+
.html(data.find('.entry-content > p:first-child').html());
203+
204+
data.find('.nico-insert-code').each(function(index, item) {
205+
var demoNode = $($('#alice-module-demo').html());
206+
item = $(item);
207+
if (item.children()[0].tagName === 'LINK' ||
208+
item.children()[0].tagName === 'STYLE') {
209+
return;
226210
}
211+
var subtitle = item.prev().html();
212+
if (item.prev()[0].tagName !== 'H3' || !subtitle) {
213+
subtitle = '默认';
214+
}
215+
demoNode.find('.alice-module-subtitle').html(subtitle);
216+
demoNode.find('.alice-module-dom').html(item.html());
217+
// 直接使用目标页面生成的高亮代码,不再动态渲染
218+
var codeHtml = item.next('.highlight').find('pre').html();
219+
demoNode.find('.alice-module-code').html(codeHtml);
220+
221+
moduleNode.find('.alice-loading').remove();
222+
demoNode.appendTo(moduleNode);
223+
});
224+
225+
// 中文关键词,一般放在 keywords 数组的第一个
226+
// 在这里写到左边索引栏中
227+
var keywords = data.find('.sidebar-wrapper .sidebar-description').data('keyword');
228+
if (keywords) {
229+
list.find('i').html(keywords);
227230
}
228-
});
229-
});
230-
seajs.use('/static/side', function(side) {
231-
side.init();
231+
}
232232
});
233233
});
234-
235-
function substractTitle(item) {
236-
$('.side-loading').remove();
237-
item = item.find('a');
238-
var list = $($('#list-template').html());
239-
list.find('a').html(item.html() + list.find('a').html());
240-
list.find('a').attr('href', '#' + item.attr('id'));
241-
list.appendTo('.side-area ul');
242-
return list;
243-
}
244-
245234
});
235+
236+
function substractTitle(item) {
237+
$('.side-loading').remove();
238+
item = item.find('a');
239+
var list = $($('#list-template').html());
240+
list.find('a').html(item.html() + list.find('a').html());
241+
list.find('a').attr('href', '#' + item.attr('id'));
242+
list.appendTo('.side-area ul');
243+
return list;
244+
}
246245
</script>
247246
`````

0 commit comments

Comments
 (0)