Skip to content

Commit 164d4df

Browse files
# Conflicts: # package.json
2 parents 135c17f + 40bc3a1 commit 164d4df

File tree

132 files changed

+8067
-5788
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+8067
-5788
lines changed

README.md

Lines changed: 1 addition & 516 deletions
Large diffs are not rendered by default.

build/build.html

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<!DOCTYPE html>
22
<html>
3-
43
<head>
54
<title>自定义打包</title>
6-
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
7-
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
8-
9-
<script type="text/javascript" src="http://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
5+
<meta charset="UTF-8">
6+
<link rel="stylesheet" href="../examples/css/bootstrap.min.css">
107
<style type="text/css">
118
body {
129
font: 12px/1.4 Verdana, sans-serif;
@@ -112,11 +109,10 @@
112109
}
113110

114111
#command2 {
115-
width: 100%;
116-
margin: 20px 30px;
112+
width: 90%;
113+
margin: -10px 30px 30px;
117114
}
118115

119-
120116
#toolbar {
121117
padding-bottom: 10px;
122118
border-bottom: 1px solid #ddd;
@@ -143,6 +139,15 @@
143139
margin-left: 30px;
144140
}
145141

142+
#commandIntro {
143+
font-size: 14px;
144+
margin-left: 5px;
145+
}
146+
147+
#commandIntro li {
148+
padding-bottom: 10px
149+
}
150+
146151
</style>
147152
</head>
148153

@@ -157,14 +162,16 @@ <h1>自定义打包</h1>
157162
<div class="description">
158163
<div>Core<span style="font-size: 14px"> --SuperMap iClient9基础核心功能</span></div>
159164
</div>
160-
<div class="deplistContent active"><ul id="deplist" class="deplist"></ul></div>
165+
<div class="deplistContent active">
166+
<ul id="deplist" class="deplist"></ul>
167+
</div>
161168
</section>
162169
<section class="sec">
163170
<div class="description">
164-
<div style="height: 35px;line-height: 35px;">客户端
171+
<div style="height: 30px;line-height: 35px;">客户端
165172
</div>
166173
</div>
167-
<ul id = "client" class="nav nav-tabs clientTabs" style="display: inline-block">
174+
<ul id="client" class="nav nav-tabs clientTabs" style="display: inline-block">
168175
<li role="presentation" class="active"><a href="#ol3select">OL3</a></li>
169176
<li role="presentation"><a href="#leafletselect">Leaflet</a></li>
170177
</ul>
@@ -176,12 +183,19 @@ <h1>自定义打包</h1>
176183
</section>
177184
<section class="sec commandSection">
178185
<div class="description">
179-
<div>自定义打包命令<span style="font-size: 14px;"> --复制命令,在源码根目录执行命令打包</span></div>
186+
<div>自定义打包命令</div>
180187
</div>
188+
<br>
189+
<ol id="commandIntro">
190+
<li>安装Node</li>
191+
<li>在源码根目录运行npm install下载依赖</li>
192+
<li>在源码根目录执行以下命令打包</li>
193+
</ol>
181194
<input type="text" class="form-control" id="command2"/>
182195
</section>
183196
</div>
184-
197+
<script type="text/javascript" src="../examples/js/jquery.js"></script>
198+
<script type="text/javascript" src="../examples/js/bootstrap.js"></script>
185199
<script type="text/javascript" src="deps.js"></script>
186200
<script type="text/javascript" src="build.js"></script>
187201
</body>

build/build.js

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,65 +14,70 @@ function init() {
1414
for (var i = 0; i < lists.length; i++) {
1515
var checks = lists[i].getElementsByTagName('input');
1616
for (var j = 0; j < checks.length; j++) {
17+
if (checks[j].id === 'Core') {
18+
continue;
19+
}
1720
checks[j].checked = selectAll;
1821
}
1922
var lis = lists[i].getElementsByTagName('li');
2023
for (var n = 0; n < checks.length; n++) {
24+
if (checks[n].id === 'Core') {
25+
continue;
26+
}
2127
lis[n].className = (selectAll) ? 'active' : '';
2228
}
2329
}
2430
updateCommand();
2531
return false;
2632
}
33+
2734
addModule('Core', deplist, true);
2835
$('#deplist li')[0].className = 'active';
29-
for(var ol3Module in ol3Modules){
36+
for (var ol3Module in ol3Modules) {
3037
var title = ol3Modules[ol3Module].title;
3138
addGroup('ol3', title, ol3Modules[ol3Module].description, $('#ol3select')[0]);
32-
for(var module in ol3Modules[ol3Module]){
33-
if(module === 'title' || module === 'description'){
39+
for (var module in ol3Modules[ol3Module]) {
40+
if (module === 'title' || module === 'description') {
3441
continue;
3542
}
36-
addModule(module, $('#ol3_' + title)[0]);
43+
addModule(module, $('#ol3_' + title)[0], false, ol3Modules[ol3Module][module].name);
3744
}
3845
}
3946
for (var leafletModule in leafletModules) {
4047
var title = leafletModules[leafletModule].title;
4148
addGroup('leaflet', title, leafletModules[leafletModule].description, $('#leafletselect')[0]);
42-
for(var module in leafletModules[leafletModule]){
43-
if(module === 'title' || module === 'description'){
49+
for (var module in leafletModules[leafletModule]) {
50+
if (module === 'title' || module === 'description') {
4451
continue;
4552
}
46-
addModule(module, $('#leaflet_' + title)[0]);
53+
addModule(module, $('#leaflet_' + title)[0], false, leafletModules[leafletModule][module].name);
4754
}
4855
}
4956
updateCommand();
5057

5158
$('.clientTabs li a').click(function (e) {
5259
e.preventDefault()
53-
if(this.innerHTML === 'Leaflet'){
54-
var checks = $('.deplist input');
55-
for (var i = 0; i < checks.length; i++) {
56-
if(checks[i].id.indexOf('ol3_') !== -1 && checks[i].checked){
57-
checks[i].checked = false;
58-
checks[i].parentNode.className = '';
59-
}
60-
}
60+
if (this.innerHTML === 'Leaflet') {
61+
cancelChecked('ol3');
6162
}
62-
if(this.innerHTML === 'OL3'){
63-
var checks = $('.deplist input');
64-
for (var i = 0; i < checks.length; i++) {
65-
if(checks[i].id.indexOf('leaflet_') !== -1 && checks[i].checked){
66-
checks[i].checked = false;
67-
checks[i].parentNode.className = '';
68-
}
69-
}
63+
if (this.innerHTML === 'OL3') {
64+
cancelChecked('leaflet');
7065
}
7166
updateCommand();
7267
$(this).tab('show');
7368
})
7469
}
7570

71+
function cancelChecked(clientName) {
72+
var checks = $('#' + clientName + 'select .deplist input');
73+
for (var i = 0; i < checks.length; i++) {
74+
if (checks[i].checked) {
75+
checks[i].checked = false;
76+
checks[i].parentNode.className = '';
77+
}
78+
}
79+
}
80+
7681
function addGroup(client, title, description, div) {
7782
var ul = document.createElement('ul');
7883
ul.id = client + '_' + title;
@@ -86,22 +91,25 @@ function addGroup(client, title, description, div) {
8691
div.appendChild(ul);
8792
}
8893

89-
function addModule(name, list, checked) {
94+
function addModule(title, list, checked, name) {
9095
var li = document.createElement('li');
9196
var content = document.createElement('div');
9297
var label = document.createElement('label');
9398
var check = document.createElement('input');
9499
check.type = 'checkbox';
95-
check.id = name;
100+
check.id = title;
96101
check.checked = (checked) ? 'checked' : '';
97102
check.onchange = onCheckboxChange;
98103
li.appendChild(check);
99-
label.htmlFor = name;
104+
label.htmlFor = title;
100105
li.appendChild(label);
101106
content.className = 'item';
102-
content.appendChild(document.createTextNode(name.substring(name.indexOf('_') + 1)));
107+
if (!name) {
108+
name = title;
109+
}
110+
content.appendChild(document.createTextNode(name));
103111
li.appendChild(content);
104-
if(!checked){
112+
if (!checked) {
105113
li.onclick = onModuleClick;
106114
}
107115
list.appendChild(li);
@@ -120,27 +128,35 @@ function updateCommand() {
120128
var modulePaths = '';
121129
for (var i = 0; i < deplistItems.length; i++) {
122130
if (deplistItems[i].checked) {
123-
for (var coreModule in coreModules) {
124-
modulePaths += coreModule + ',';
125-
}
131+
modulePaths = "Core" + ','
126132
}
127133
}
128134
var deplistItems2 = $('.deplist li input');
129135
for (var i = 0; i < deplistItems2.length; i++) {
136+
if (deplistItems2[i].id === "Core") {
137+
continue;
138+
}
130139
if (deplistItems2[i].checked) {
131140
modulePaths += deplistItems2[i].id + ',';
132141
}
133142
}
134143
modulePaths = modulePaths.substring(0, modulePaths.length - 1);
135-
if (modulePaths.indexOf('Leaflet') !== -1) {
136-
commandInput.value = modulePaths === '' ? modulePaths : 'npm run package - leaflet ' + modulePaths;
137-
return;
144+
commandInput.value = modulePaths === '' ? modulePaths : 'npm run package - ' + getKey() + " " + modulePaths;
145+
}
146+
147+
function getKey() {
148+
var key = "core";
149+
for (var check in $('#ol3select .deplist li input')) {
150+
if ($('#ol3select .deplist li input')[check].checked) {
151+
key = "ol3";
152+
}
138153
}
139-
if (modulePaths.indexOf('OL3') !== -1) {
140-
commandInput.value = modulePaths === '' ? modulePaths : 'npm run package - ol3 ' + modulePaths;
141-
return;
154+
for (var check in $('#leafletselect .deplist li input')) {
155+
if ($('#leafletselect .deplist li input')[check].checked) {
156+
key = "leaflet";
157+
}
142158
}
143-
commandInput.value = modulePaths === '' ? modulePaths : 'npm run package - core ' + modulePaths;
159+
return key;
144160
}
145161

146162
function onCheckboxChange() {

0 commit comments

Comments
 (0)