4 <title>Leaflet Build Helper
</title>
6 <script type=
"text/javascript" src=
"deps.js"></script>
8 <style type=
"text/css">
10 font: 12px/1.4 Verdana
, sans-serif
;
26 border-top: 1px solid
#eee;
62 <h1>Leaflet Build Helper
</h1>
65 <a id=
"select-all" href=
"#all">Select All
</a> |
66 <a id=
"deselect-all" href=
"#none">Deselect All
</a>
69 <ul id=
"deplist"></ul>
72 Run this command in the build directory:
<br />
73 <input type=
"text" id=
"command" />
77 <script type=
"text/javascript">
78 var deplist
= document
.getElementById('deplist'),
79 commandInput
= document
.getElementById('command');
81 document
.getElementById('select-all').onclick = function() {
82 var checks
= deplist
.getElementsByTagName('input');
83 for (var i
= 0; i
< checks
.length
; i
++) {
84 checks
[i
].checked
= true;
90 document
.getElementById('deselect-all').onclick = function() {
91 var checks
= deplist
.getElementsByTagName('input');
92 for (var i
= 0; i
< checks
.length
; i
++) {
93 if (!checks
[i
].disabled
) {
94 checks
[i
].checked
= false;
101 function updateCommand() {
103 var checks
= deplist
.getElementsByTagName('input');
104 for (var i
= 0; i
< checks
.length
; i
++) {
105 if (checks
[i
].checked
) {
106 var srcs
= deps
[checks
[i
].id
].src
;
107 for (var j
= 0; j
< srcs
.length
; j
++) {
108 files
[srcs
[j
]] = true;
113 var command
= 'java -jar ../lib/closure-compiler/compiler.jar ';
114 for (var src
in files
) {
115 command
+= '--js ../src/' + src
+ ' ';
117 command
+= '--js_output_file ../dist/leaflet-custom.js';
119 commandInput
.value
= command
;
122 commandInput
.onclick = function() {
123 commandInput
.focus();
124 commandInput
.select();
127 function onCheckboxChange() {
129 var depDeps
= deps
[this.id
].deps
;
130 if (!depDeps
) { return; }
131 for (var i
= 0; i
< depDeps
.length
; i
++) {
132 var check
= document
.getElementById(depDeps
[i
]);
133 if (!check
.checked
) {
134 check
.checked
= true;
139 var checks
= deplist
.getElementsByTagName('input');
140 for (var i
= 0; i
< checks
.length
; i
++) {
141 var dep
= deps
[checks
[i
].id
];
142 if (!dep
.deps
) { continue; }
143 for (var j
= 0; j
< dep
.deps
.length
; j
++) {
144 if (dep
.deps
[j
] == this.id
) {
145 if (checks
[i
].checked
) {
146 checks
[i
].checked
= false;
147 checks
[i
].onchange();
156 for (var name
in deps
) {
157 var li
= document
.createElement('li');
159 if (deps
[name
].heading
) {
160 var heading
= document
.createElement('li');
161 heading
.className
= 'heading';
162 heading
.appendChild(document
.createTextNode(deps
[name
].heading
));
163 deplist
.appendChild(heading
);
166 var div
= document
.createElement('div');
168 var label
= document
.createElement('label');
170 var check
= document
.createElement('input');
171 check
.type
= 'checkbox';
173 label
.appendChild(check
);
174 check
.onchange
= onCheckboxChange
;
176 if (name
== 'Core') {
177 check
.checked
= true;
178 check
.disabled
= true;
181 label
.appendChild(document
.createTextNode(name
));
182 label
.htmlFor
= name
;
184 li
.appendChild(label
);
186 var desc
= document
.createElement('span');
187 desc
.className
= 'desc';
188 desc
.appendChild(document
.createTextNode(deps
[name
].desc
));
190 var depText
= deps
[name
].deps
&& deps
[name
].deps
.join(', ');
192 var depspan
= document
.createElement('span');
193 depspan
.className
= 'deps';
194 depspan
.appendChild(document
.createTextNode('Deps: ' + depText
));
197 div
.appendChild(desc
);
198 div
.appendChild(document
.createElement('br'));
199 if (depText
) { div
.appendChild(depspan
); }
203 deplist
.appendChild(li
);