Version Description
- No more style conflicts. Removed the support for wp_head and wp_footer by default in themes. Action was taken due to large complaints about the CSS and JS conflicts from other plugins.
- Fixed some bugs from template front-ends.
- Improved the mobile responsiveness in default templates further.
- Add all available WordPress user roles as the options for Skipping setting.
Download this release
Release Info
Developer | ceylonsystems |
Plugin | IgniteUp – Coming Soon and Maintenance Mode |
Version | 3.3 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 3.3
- igniteup.php +4 -2
- includes/class-admin-options.php +1 -1
- includes/class-coming-soon-creator.php +516 -405
- includes/core-helpers.php +32 -0
- includes/css/codemirror/codemirror.css +340 -0
- includes/css/codemirror/ttcn.css +64 -0
- includes/css/main.css +11 -4
- includes/images/help-get-templates-1.jpg +0 -0
- includes/images/help-get-templates-2.jpg +0 -0
- includes/images/help-get-templates-3.jpg +0 -0
- includes/images/{help-get-templates.jpg → help-get-templates-4.jpg} +0 -0
- includes/js/codemirror/codemirror.js +9351 -0
- includes/js/codemirror/css.js +830 -0
- includes/js/codemirror/htmlmixed.js +152 -0
- includes/js/codemirror/javascript.js +813 -0
- includes/js/codemirror/xml.js +394 -0
- includes/js/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
- includes/js/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
- includes/js/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
- includes/js/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
- includes/js/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
- includes/js/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
- includes/js/jquery-ui/jquery-ui.min.css +7 -0
- includes/js/jquery-ui/jquery-ui.min.js +13 -0
- includes/js/jquery-ui/jquery-ui.structure.min.css +5 -0
- includes/js/jquery-ui/jquery-ui.theme.min.css +5 -0
- includes/js/jquery.min.js +4 -0
- includes/js/main.js +132 -81
- includes/templates/believe.php +67 -65
- includes/templates/believe/believe.php +43 -47
- includes/templates/believe/css/main.css +10 -1
- includes/templates/glass.php +68 -66
- includes/templates/glass/css/main.css +10 -1
- includes/templates/glass/glass.php +128 -112
- includes/templates/launcher.php +83 -84
- includes/templates/launcher/launcher.php +195 -191
- includes/templates/offline.php +74 -72
- includes/templates/offline/css/main.css +2 -2
- includes/templates/offline/offline.php +32 -31
- includes/views/temp-general-options.php +36 -34
- includes/views/temp-help.php +18 -4
- includes/views/temp-siderbar-ad.php +11 -2
- readme.txt +9 -3
igniteup.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: IgniteUp
|
4 |
Plugin URI: http://getigniteup.com
|
5 |
Description: IgniteUp is a powerful plugin which allows you to keep your site on launchpad till ignite-up and to build amazing coming soon pages.
|
6 |
-
Version: 3.
|
7 |
Author: Ceylon Systems
|
8 |
Author URI: http://getigniteup.com
|
9 |
License: GPLv2 or later
|
@@ -12,5 +12,7 @@
|
|
12 |
*/
|
13 |
|
14 |
require_once 'includes/core-import.php';
|
|
|
|
|
|
|
15 |
|
16 |
-
new CSComingSoonCreator(__FILE__, '3.2');
|
3 |
Plugin Name: IgniteUp
|
4 |
Plugin URI: http://getigniteup.com
|
5 |
Description: IgniteUp is a powerful plugin which allows you to keep your site on launchpad till ignite-up and to build amazing coming soon pages.
|
6 |
+
Version: 3.3
|
7 |
Author: Ceylon Systems
|
8 |
Author URI: http://getigniteup.com
|
9 |
License: GPLv2 or later
|
12 |
*/
|
13 |
|
14 |
require_once 'includes/core-import.php';
|
15 |
+
require_once 'includes/core-helpers.php';
|
16 |
+
|
17 |
+
new CSComingSoonCreator(__FILE__, '3.3');
|
18 |
|
|
includes/class-admin-options.php
CHANGED
@@ -40,7 +40,7 @@ class CSAdminOptions {
|
|
40 |
}
|
41 |
|
42 |
private function getNameFromFilePath($file) {
|
43 |
-
$ss =
|
44 |
$remove_ext = explode('.', end($ss));
|
45 |
unset($remove_ext[(count($remove_ext) - 1)]);
|
46 |
return implode('', $remove_ext);
|
40 |
}
|
41 |
|
42 |
private function getNameFromFilePath($file) {
|
43 |
+
$ss = preg_split('/', $file);
|
44 |
$remove_ext = explode('.', end($ss));
|
45 |
unset($remove_ext[(count($remove_ext) - 1)]);
|
46 |
return implode('', $remove_ext);
|
includes/class-coming-soon-creator.php
CHANGED
@@ -3,34 +3,36 @@
|
|
3 |
class CSComingSoonCreator {
|
4 |
|
5 |
public function __construct($file = NULL, $version = NULL) {
|
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 |
/*
|
@@ -41,22 +43,22 @@ class CSComingSoonCreator {
|
|
41 |
*/
|
42 |
|
43 |
private function setConstants($file, $version = NULL) {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
57 |
|
58 |
-
|
59 |
-
|
60 |
}
|
61 |
|
62 |
/*
|
@@ -66,473 +68,582 @@ class CSComingSoonCreator {
|
|
66 |
*/
|
67 |
|
68 |
public function setMenus() {
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
}
|
74 |
|
75 |
private function greenToPublishTheme() {
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
}
|
88 |
|
89 |
public function loadThemeScripts() {
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
}
|
100 |
|
101 |
public function dequeScripts() {
|
102 |
-
|
103 |
-
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
}
|
119 |
|
120 |
public function myThemeRedirect($original_template) {
|
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 |
public function loadAdminScripts() {
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
|
168 |
public static function getDefaultTemplateList() {
|
169 |
-
|
170 |
}
|
171 |
|
172 |
public function customMimes($existing_mimes = array()) {
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
}
|
177 |
|
178 |
public function activateTemplate() {
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
}
|
184 |
|
185 |
public function deleteTemplate() {
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
}
|
195 |
|
196 |
private function getActiveTemplateObject() {
|
197 |
-
|
198 |
-
|
199 |
}
|
200 |
|
201 |
public function makeTemplateOptionsGlobal() {
|
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 |
private function checkIfEnabled() {
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
}
|
232 |
|
233 |
private function checkForSkipping() {
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
}
|
244 |
|
245 |
private function checkForWhiteListedIPs() {
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
}
|
267 |
|
268 |
private function checkForGetRequest() {
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
}
|
281 |
|
282 |
public function showAdminBarMenu() {
|
283 |
-
|
284 |
-
|
285 |
|
286 |
-
|
287 |
|
288 |
-
|
289 |
-
|
290 |
|
291 |
-
|
292 |
}
|
293 |
|
294 |
public function subscribeEmail() {
|
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 |
public function sendContactForm() {
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
// Create the email and send the message
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
}
|
345 |
|
346 |
private function subscribeToMailingLists($name, $email) {
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
}
|
394 |
|
395 |
private function convertToCsv($input_array, $output_file_name, $delimiter) {
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
}
|
405 |
|
406 |
public function createCsvFile() {
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
}
|
420 |
|
421 |
public function createBccFile() {
|
422 |
-
|
423 |
-
|
424 |
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
}
|
438 |
|
439 |
public function removeSubscribers() {
|
440 |
|
441 |
-
|
442 |
-
|
443 |
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
}
|
451 |
|
452 |
public function load_languages() {
|
453 |
-
|
454 |
}
|
455 |
|
456 |
public function showWelcomeMessage() {
|
457 |
-
|
458 |
-
|
459 |
|
460 |
// set options for showing welcome message.
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
//-------------
|
468 |
}
|
469 |
|
470 |
-
public function
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
}
|
476 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
477 |
public function noncompatible_theme_notice() {
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
}
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
public function adminSubscribe() {
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
}
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
}
|
537 |
|
538 |
}
|
3 |
class CSComingSoonCreator {
|
4 |
|
5 |
public function __construct($file = NULL, $version = NULL) {
|
6 |
+
$this->setConstants($file, $version);
|
7 |
+
|
8 |
+
add_action('admin_menu', array($this, 'setMenus'));
|
9 |
+
add_action('admin_enqueue_scripts', array($this, 'loadAdminScripts'));
|
10 |
+
add_action('wp_enqueue_scripts', array($this, 'dequeScripts'), 99998); //TODO: deprecate this
|
11 |
+
add_action('wp_enqueue_scripts', array($this, 'loadThemeScripts'), 99999); //TODO: deprecate this
|
12 |
+
add_action('wp_head', array($this, 'wpHeadForOldThemes')); //TODO: deprecate this
|
13 |
+
add_action('admin_init', array('CSAdminOptions', 'registerOptions'));
|
14 |
+
add_action('admin_init', array('CSAdminOptions', 'registerGeneralOptions'));
|
15 |
+
add_action('admin_init', array($this, 'removeSubscribers'));
|
16 |
+
add_action('igniteup_head', array($this, 'headStatics'));
|
17 |
+
add_action('igniteup_footer', array($this, 'footerScripts'));
|
18 |
+
add_action("template_include", array($this, 'myThemeRedirect'));
|
19 |
+
add_action('upload_mimes', array($this, 'customMimes'));
|
20 |
+
add_action('admin_init', array($this, 'activateTemplate'));
|
21 |
+
add_action('admin_init', array($this, 'deleteTemplate'));
|
22 |
+
add_action('admin_init', array($this, 'showWelcomeMessage'));
|
23 |
+
add_action('init', array($this, 'makeTemplateOptionsGlobal'));
|
24 |
+
register_activation_hook(CSCS_FILE, array('CSAdminOptions', 'setDefaultOptions'));
|
25 |
+
add_action('wp_ajax_nopriv_subscribe_email', array($this, 'subscribeEmail'));
|
26 |
+
add_action('wp_ajax_subscribe_email', array($this, 'subscribeEmail'));
|
27 |
+
add_action('wp_ajax_igniteup_admin_subscribe', array($this, 'adminSubscribe'));
|
28 |
+
add_action('wp_ajax_nopriv_contact_form', array($this, 'sendContactForm'));
|
29 |
+
add_action('wp_ajax_contact_form', array($this, 'sendContactForm'));
|
30 |
+
add_action('admin_init', array($this, 'createCsvFile'));
|
31 |
+
add_action('admin_init', array($this, 'createBccFile'));
|
32 |
+
add_action('admin_bar_menu', array($this, 'showAdminBarMenu'), 1000);
|
33 |
+
add_action('after_setup_theme', array($this, 'load_languages'));
|
34 |
+
add_action('admin_notices', array($this, 'noncompatible_theme_notice'));
|
35 |
+
new CSComingSoonDbMigrations();
|
36 |
}
|
37 |
|
38 |
/*
|
43 |
*/
|
44 |
|
45 |
private function setConstants($file, $version = NULL) {
|
46 |
+
global $wpdb;
|
47 |
+
define('CSCS_TEXT_DOMAIN', 'igniteup');
|
48 |
+
define('CSCS_DEFTEMP_OPTION', 'cscs_default_template');
|
49 |
+
define('CSCS_TEMPLATEOPTION_PREFIX', 'cscs_tempoption_');
|
50 |
+
define('CSCS_GENEROPTION_PREFIX', 'cscs_generpotion_');
|
51 |
+
define('CSCS_CAPABILITY_PREFIX', 'cscs_cap_');
|
52 |
+
define('CSCS_DBTABLE_PREFIX', $wpdb->prefix . 'cscs_db_');
|
53 |
+
define('CSCS_DBTABLE_SUBSCRIPTS', 'subscriptions');
|
54 |
+
define('CSCS_DEFAULT_TEMPLATE', CSAdminOptions::getDefTemplate());
|
55 |
+
define('CSCS_DEFAULT_TEMPLATE_LIST', '["launcher", "believe","offline","glass"]');
|
56 |
|
57 |
+
if (!empty($file))
|
58 |
+
define('CSCS_FILE', $file);
|
59 |
|
60 |
+
if (!empty($version))
|
61 |
+
define('CSCS_CURRENT_VERSION', $version);
|
62 |
}
|
63 |
|
64 |
/*
|
68 |
*/
|
69 |
|
70 |
public function setMenus() {
|
71 |
+
add_menu_page('IgniteUp', __('IgniteUp', CSCS_TEXT_DOMAIN), 'manage_options', 'cscs_templates', '', '', 39);
|
72 |
+
add_submenu_page('cscs_templates', __('Templates', CSCS_TEXT_DOMAIN), __('Templates', CSCS_TEXT_DOMAIN), 'manage_options', 'cscs_templates', array('CSAdminOptions', 'templatePage'));
|
73 |
+
add_submenu_page('cscs_templates', __('Subscribers', CSCS_TEXT_DOMAIN), __('Subscribers', CSCS_TEXT_DOMAIN), 'manage_options', 'cscs_subscribers', array('CSAdminOptions', 'subscribersPage'));
|
74 |
+
add_submenu_page('cscs_templates', __('Options', CSCS_TEXT_DOMAIN), __('Options', CSCS_TEXT_DOMAIN), 'manage_options', 'cscs_options', array('CSAdminOptions', 'optionsPage'));
|
75 |
}
|
76 |
|
77 |
private function greenToPublishTheme() {
|
78 |
+
if (isset($_REQUEST['igniteup']) && $_REQUEST['igniteup'] == 'force')
|
79 |
+
return TRUE;
|
80 |
+
if (!$this->checkIfEnabled())
|
81 |
+
return FALSE;
|
82 |
+
if ($this->checkForSkipping())
|
83 |
+
return FALSE;
|
84 |
+
if ($this->checkForWhiteListedIPs())
|
85 |
+
return FALSE;
|
86 |
+
if ($this->checkForGetRequest())
|
87 |
+
return FALSE;
|
88 |
+
return TRUE;
|
89 |
}
|
90 |
|
91 |
public function loadThemeScripts() {
|
92 |
+
wp_enqueue_style('igniteup-front-compulsory', plugin_dir_url(CSCS_FILE) . 'includes/css/front-compulsory.css', array(), CSCS_CURRENT_VERSION);
|
93 |
+
if (!$this->greenToPublishTheme())
|
94 |
+
return;
|
95 |
|
96 |
+
do_action('cscs_theme_scripts_' . CSCS_DEFAULT_TEMPLATE);
|
97 |
+
wp_enqueue_style('igniteup-front', plugin_dir_url(CSCS_FILE) . 'includes/css/front.css', array(), CSCS_CURRENT_VERSION);
|
98 |
|
99 |
+
$custom_css = get_option(CSCS_GENEROPTION_PREFIX . 'customcss', '');
|
100 |
+
wp_add_inline_style('igniteup-front', $custom_css);
|
101 |
}
|
102 |
|
103 |
public function dequeScripts() {
|
104 |
+
if (!$this->greenToPublishTheme())
|
105 |
+
return;
|
106 |
|
107 |
+
$skip_scr = array('colors', 'wp-admin', 'login', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'press-this', 'ie', 'admin-bar');
|
108 |
+
global $wp_styles;
|
109 |
+
if (!is_a($wp_styles, 'WP_Styles'))
|
110 |
+
return;
|
111 |
+
$registered_array = $wp_styles->registered;
|
112 |
+
if (!is_array($registered_array))
|
113 |
+
$registered_array = array();
|
114 |
|
115 |
+
foreach ($registered_array as $script) {
|
116 |
+
if (isset($script->handle) && !in_array($script->handle, $skip_scr)) {
|
117 |
+
wp_dequeue_style($script->handle);
|
118 |
+
}
|
119 |
+
}
|
120 |
}
|
121 |
|
122 |
public function myThemeRedirect($original_template) {
|
123 |
+
if (!$this->greenToPublishTheme())
|
124 |
+
return $original_template;
|
125 |
|
126 |
+
/*
|
127 |
+
* If option is set, send the header 503.
|
128 |
+
*/
|
129 |
+
if (get_option(CSCS_GENEROPTION_PREFIX . 'send_status', '1') == '1') {
|
130 |
+
$protocol = "HTTP/1.0";
|
131 |
+
if ("HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"])
|
132 |
+
$protocol = "HTTP/1.1";
|
133 |
+
header("$protocol 503 Service Unavailable", true, 503);
|
134 |
+
header("Retry-After: 3600");
|
135 |
+
}
|
136 |
|
137 |
+
global $wp;
|
138 |
+
$file = dirname(__FILE__) . '/templates/' . CSCS_DEFAULT_TEMPLATE . '/' . CSCS_DEFAULT_TEMPLATE . '.php';
|
139 |
+
$template_data = $this->getActiveTemplateObject();
|
140 |
|
141 |
+
if (isset($template_data['plugin_file']) && !empty($template_data['plugin_file']))
|
142 |
+
$file = dirname($template_data['plugin_file']) . '/template/index.php';
|
143 |
|
144 |
+
if (file_exists($file))
|
145 |
+
include $file;
|
146 |
+
die();
|
147 |
}
|
148 |
|
149 |
public function loadAdminScripts() {
|
150 |
+
wp_enqueue_style('rockyton-icon', plugin_dir_url(CSCS_FILE) . 'includes/css/icons/styles.css', array(), CSCS_CURRENT_VERSION);
|
151 |
+
wp_enqueue_style('igniteup', plugin_dir_url(CSCS_FILE) . 'includes/css/main.css', array(), CSCS_CURRENT_VERSION);
|
152 |
+
wp_enqueue_style('bootstrap-switch', plugin_dir_url(CSCS_FILE) . 'includes/css/bootstrap-switch.min.css', array(), CSCS_CURRENT_VERSION);
|
153 |
+
|
154 |
+
if (isset($_GET['page']) && ($_GET['page'] == 'cscs_options' || $_GET['page'] == 'cscs_subscribers')) {
|
155 |
+
wp_enqueue_style('wp-color-picker');
|
156 |
+
|
157 |
+
wp_enqueue_style('codemirror-main', plugin_dir_url(CSCS_FILE) . 'includes/css/codemirror/codemirror.css');
|
158 |
+
wp_enqueue_style('codemirror-theme', plugin_dir_url(CSCS_FILE) . 'includes/css/codemirror/ttcn.css');
|
159 |
+
wp_enqueue_style('jquery-timepicker-css', plugin_dir_url(CSCS_FILE) . 'includes/css/jquery.timepicker.min.css');
|
160 |
+
wp_enqueue_script('jquery');
|
161 |
+
|
162 |
+
wp_enqueue_script('jquery-form', false, array('jquery'));
|
163 |
+
wp_enqueue_script('jquery-timepicker', plugin_dir_url(CSCS_FILE) . 'includes/js/jquery.timepicker.min.js', array('jquery'), CSCS_CURRENT_VERSION, true);
|
164 |
+
wp_enqueue_script('jquery-ui-accordion', false, array('jquery'));
|
165 |
+
wp_enqueue_script('jquery-ui-datepicker');
|
166 |
+
wp_enqueue_style('jquery-ui-theme', '//code.jquery.com/ui/1.11.4/themes/flick/jquery-ui.css');
|
167 |
+
wp_enqueue_script('bootstrap-switch', plugin_dir_url(CSCS_FILE) . 'includes/js/bootstrap-switch.min.js', array('jquery'), CSCS_CURRENT_VERSION, true);
|
168 |
+
wp_enqueue_script('igniteup', plugin_dir_url(CSCS_FILE) . 'includes/js/main.js', array('jquery', 'wp-color-picker', 'jquery-timepicker'), CSCS_CURRENT_VERSION, true);
|
169 |
+
wp_enqueue_script('codemirror-main', plugin_dir_url(CSCS_FILE) . 'includes/js/codemirror/codemirror.js', array(), CSCS_CURRENT_VERSION, true);
|
170 |
+
wp_enqueue_script('codemirror-helper-css', plugin_dir_url(CSCS_FILE) . 'includes/js/codemirror/css.js', array('codemirror-main'), CSCS_CURRENT_VERSION, true);
|
171 |
+
wp_enqueue_script('codemirror-helper-js', plugin_dir_url(CSCS_FILE) . 'includes/js/codemirror/javascript.js', array('codemirror-main'), CSCS_CURRENT_VERSION, true);
|
172 |
+
wp_enqueue_script('codemirror-helper-xml', plugin_dir_url(CSCS_FILE) . 'includes/js/codemirror/xml.js', array('codemirror-main'), CSCS_CURRENT_VERSION, true);
|
173 |
+
wp_enqueue_script('codemirror-helper-html', plugin_dir_url(CSCS_FILE) . 'includes/js/codemirror/htmlmixed.js', array('codemirror-main', 'codemirror-helper-css', 'codemirror-helper-js', 'codemirror-helper-xml'), CSCS_CURRENT_VERSION, true);
|
174 |
+
wp_enqueue_media();
|
175 |
+
}
|
176 |
}
|
177 |
|
178 |
public static function getDefaultTemplateList() {
|
179 |
+
return json_decode(CSCS_DEFAULT_TEMPLATE_LIST, TRUE);
|
180 |
}
|
181 |
|
182 |
public function customMimes($existing_mimes = array()) {
|
183 |
+
$existing_mimes['zip'] = 'application/zip';
|
184 |
+
$existing_mimes['gz'] = 'application/x-gzip';
|
185 |
+
return $existing_mimes;
|
186 |
}
|
187 |
|
188 |
public function activateTemplate() {
|
189 |
+
if (!isset($_POST['activate_template']) || empty($_POST['activate_template']))
|
190 |
+
return;
|
191 |
+
update_option(CSCS_DEFTEMP_OPTION, $_POST['activate_template']);
|
192 |
+
header('Location: ' . $_SERVER['REQUEST_URI'] . '&activated=yes');
|
193 |
}
|
194 |
|
195 |
public function deleteTemplate() {
|
196 |
+
if (!isset($_POST['delete_template']) || empty($_POST['delete_template']))
|
197 |
+
return;
|
198 |
+
$folder_name = $_POST['delete_template'];
|
199 |
+
$path = dirname(CSCS_FILE) . '/includes/templates/';
|
200 |
+
array_map('unlink', glob($path . $folder_name . '/*.*'));
|
201 |
+
rmdir($path . $folder_name);
|
202 |
+
unlink($path . '/' . $folder_name . '.php');
|
203 |
+
header('Location: ' . $_SERVER['REQUEST_URI']);
|
204 |
}
|
205 |
|
206 |
private function getActiveTemplateObject() {
|
207 |
+
$templates = CSAdminOptions::getTemplates();
|
208 |
+
return $templates[CSCS_DEFAULT_TEMPLATE];
|
209 |
}
|
210 |
|
211 |
public function makeTemplateOptionsGlobal() {
|
212 |
+
$temp = $this->getActiveTemplateObject();
|
213 |
+
$arr = array();
|
214 |
+
if (isset($temp['options'])) {
|
215 |
+
foreach ($temp['options'] as $key => $field) {
|
216 |
+
$option_key = CSCS_TEMPLATEOPTION_PREFIX . CSCS_DEFAULT_TEMPLATE . '_' . $key;
|
217 |
+
$saved_value = get_option($option_key, isset($field['def']) ? $field['def'] : '');
|
218 |
+
$arr[$key] = $saved_value;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
$general_options = CSAdminOptions::$gener_options;
|
223 |
+
foreach ($general_options as $opt) {
|
224 |
+
$arr['general_' . $opt] = get_option(CSCS_GENEROPTION_PREFIX . $opt, '');
|
225 |
+
}
|
226 |
+
|
227 |
+
$common_options = CSAdminOptions::$common_options;
|
228 |
+
foreach ($common_options as $opt) {
|
229 |
+
$arr['common_' . $opt] = get_option(CSCS_GENEROPTION_PREFIX . $opt, '');
|
230 |
+
}
|
231 |
+
|
232 |
+
global $the_cs_template_options;
|
233 |
+
$the_cs_template_options = $arr;
|
234 |
}
|
235 |
|
236 |
private function checkIfEnabled() {
|
237 |
+
$get = get_option(CSCS_GENEROPTION_PREFIX . 'enable', '');
|
238 |
+
if ($get == '1')
|
239 |
+
return TRUE;
|
240 |
+
return FALSE;
|
241 |
}
|
242 |
|
243 |
private function checkForSkipping() {
|
244 |
+
if (!is_user_logged_in())
|
245 |
+
return FALSE;
|
246 |
+
$skipfor = get_option(CSCS_GENEROPTION_PREFIX . 'skipfor');
|
247 |
+
$skip_for_array = empty($skipfor) ? array() : json_decode($skipfor, TRUE);
|
248 |
+
global $current_user;
|
249 |
+
$user_roles = $current_user->roles;
|
250 |
+
if (in_array($user_roles[0], $skip_for_array))
|
251 |
+
return TRUE;
|
252 |
+
return FALSE;
|
253 |
}
|
254 |
|
255 |
private function checkForWhiteListedIPs() {
|
256 |
+
$text = get_option(CSCS_GENEROPTION_PREFIX . 'whitelisted_ips', '');
|
257 |
+
if (empty($text))
|
258 |
+
return FALSE;
|
259 |
+
|
260 |
+
$text_br = nl2br(trim($text));
|
261 |
+
$iplist = explode("<br />", $text_br);
|
262 |
+
|
263 |
+
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
264 |
+
//check ip from share internet
|
265 |
+
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
266 |
+
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
267 |
+
//to check ip is pass from proxy
|
268 |
+
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
269 |
+
} else {
|
270 |
+
$ip = $_SERVER['REMOTE_ADDR'];
|
271 |
+
}
|
272 |
+
$trimmed_ips = array_map('trim', $iplist);
|
273 |
+
if (in_array($ip, $trimmed_ips))
|
274 |
+
return TRUE;
|
275 |
+
return FALSE;
|
276 |
}
|
277 |
|
278 |
private function checkForGetRequest() {
|
279 |
+
$slug = CSCS_GENEROPTION_PREFIX . 'skip_with_get_request';
|
280 |
+
$cookie_slug = 'igniteup_skip';
|
281 |
+
$savedGet = get_option($slug, '');
|
282 |
|
283 |
+
if (isset($_GET['ign_skip']) && $_GET['ign_skip'] == $savedGet || //Check if GET has set
|
284 |
+
isset($_COOKIE[$cookie_slug]) && $_COOKIE[$cookie_slug] == $savedGet) { //Check if COOKIE has set
|
285 |
+
if (!isset($_COOKIE[$cookie_slug])) //Create cookie if not set
|
286 |
+
setcookie($cookie_slug, $savedGet);
|
287 |
+
return TRUE; //Skip igniteup
|
288 |
+
}
|
289 |
+
return FALSE; //Show igniteup
|
290 |
}
|
291 |
|
292 |
public function showAdminBarMenu() {
|
293 |
+
if (!$this->checkIfEnabled())
|
294 |
+
return;
|
295 |
|
296 |
+
global $wp_admin_bar;
|
297 |
|
298 |
+
if (!is_super_admin() || !is_admin_bar_showing())
|
299 |
+
return;
|
300 |
|
301 |
+
$wp_admin_bar->add_menu(array('id' => 'igniteup_enabled', 'title' => __('IgniteUp: Enabled', CSCS_TEXT_DOMAIN), 'href' => admin_url('admin.php?page=cscs_options')));
|
302 |
}
|
303 |
|
304 |
public function subscribeEmail() {
|
305 |
+
$email = isset($_REQUEST['cs_email']) ? trim($_REQUEST['cs_email']) : '';
|
306 |
+
$errorInput = CSAdminOptions::getDefaultStrings('alert_error_invalid_email');
|
307 |
+
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
308 |
+
echo json_encode(array('status' => FALSE, 'error' => TRUE, 'message' => $errorInput));
|
309 |
+
wp_die();
|
310 |
+
}
|
311 |
+
$name = '';
|
312 |
+
if (!empty($_REQUEST['cs_name']))
|
313 |
+
$name = $_REQUEST['cs_name'];
|
314 |
+
|
315 |
+
global $wpdb;
|
316 |
+
$errorAlreadyExists = CSAdminOptions::getDefaultStrings('alert_error_already_exists');
|
317 |
+
$wpdb->get_results("SELECT id FROM " . CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS . " WHERE email = '$email'", 'ARRAY_A');
|
318 |
+
if ($wpdb->num_rows > 0) {
|
319 |
+
echo json_encode(array('status' => FALSE, 'error' => TRUE, 'message' => $errorAlreadyExists));
|
320 |
+
wp_die();
|
321 |
+
}
|
322 |
+
|
323 |
+
$wpdb->insert(CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS, array('name' => $name, 'email' => $email));
|
324 |
+
$this->subscribeToMailingLists($name, $email);
|
325 |
+
if (get_option(CSCS_GENEROPTION_PREFIX . 'get_email_on_subscribe') == 'on')
|
326 |
+
$this->notifySubscriber($email, $name);
|
327 |
+
echo json_encode(array('status' => TRUE, 'error' => FALSE));
|
328 |
+
wp_die();
|
329 |
}
|
330 |
|
331 |
public function sendContactForm() {
|
332 |
+
$name = trim($_REQUEST['contact_name']);
|
333 |
+
$email = trim($_REQUEST['contact_email']);
|
334 |
+
$subject = isset($_REQUEST['contact_subject']) ? trim($_REQUEST['contact_subject']) : NULL;
|
335 |
+
$message = trim($_REQUEST['contact_message']);
|
336 |
// Create the email and send the message
|
337 |
+
$cs_receive_email_addr = CSCS_GENEROPTION_PREFIX . 'receive_email_addr';
|
338 |
+
$admin_email = get_bloginfo('admin_email');
|
339 |
+
$to = get_option($cs_receive_email_addr, $admin_email);
|
340 |
+
$email_subject = sprintf(__('%1$s Sent you a Message via %2$s Contact Form', CSCS_TEXT_DOMAIN), $name, get_bloginfo('name'));
|
341 |
+
$subjectHTML = isset($subject) ? "<h3>" . nl2br(str_replace("\'", "'", $subject)) . "</h3>" : '';
|
342 |
+
$email_body = "<html><body>" .
|
343 |
+
$subjectHTML .
|
344 |
+
"<p>" . nl2br(str_replace("\'", "'", $message)) . "</p><hr>" .
|
345 |
+
"<h4>" . __('This message was sent to you via IgniteUp Contact Form', CSCS_TEXT_DOMAIN) . "</h4>" .
|
346 |
+
"<p>" . __('Name:', CSCS_TEXT_DOMAIN) . " $name<br>" .
|
347 |
+
__('Email:', CSCS_TEXT_DOMAIN) . " $email</p>" .
|
348 |
+
"<p>" . __('You can reply the sender directly by replying to this email.', CSCS_TEXT_DOMAIN) . "</p>" .
|
349 |
+
"</body></html>";
|
350 |
+
$url = get_bloginfo('url');
|
351 |
+
$status = wp_mail($to, $email_subject, $email_body, array("Reply-To: $email", "MIME-Version: 1.0", "Content-Type: text/html; charset=UTF-8"));
|
352 |
+
echo json_encode(array('success' => $status));
|
353 |
+
wp_die();
|
354 |
}
|
355 |
|
356 |
private function subscribeToMailingLists($name, $email) {
|
357 |
+
$enabled = get_option(CSCS_GENEROPTION_PREFIX . 'enable_integration');
|
358 |
+
if ($enabled !== '1')
|
359 |
+
return;
|
360 |
+
|
361 |
+
$cs_name_int_save_to_val = get_option(CSCS_GENEROPTION_PREFIX . 'save_email_to', '');
|
362 |
+
|
363 |
+
switch ($cs_name_int_save_to_val) {
|
364 |
+
case 'mailchimp':
|
365 |
+
$cs_mailchimp_api_key = get_option(CSCS_GENEROPTION_PREFIX . 'mailchimp_api', '');
|
366 |
+
if (empty($cs_mailchimp_api_key))
|
367 |
+
return;
|
368 |
+
|
369 |
+
$cs_mailchimp_list = get_option(CSCS_GENEROPTION_PREFIX . 'mailchimp_list', '');
|
370 |
+
if (empty($cs_mailchimp_list))
|
371 |
+
return;
|
372 |
+
|
373 |
+
$MailChimp = new IgniteUpMailChimp($cs_mailchimp_api_key);
|
374 |
+
$return = $MailChimp->call('lists/subscribe', array(
|
375 |
+
'id' => $cs_mailchimp_list,
|
376 |
+
'email' => array('email' => $email),
|
377 |
+
'merge_vars' => array('EMAIL' => $email, 'FNAME' => $name, 'LNAME' => '')
|
378 |
+
));
|
379 |
+
update_option(CSCS_GENEROPTION_PREFIX . 'integrat_return', serialize($return));
|
380 |
+
break;
|
381 |
+
case 'mailpoet':
|
382 |
+
$cs_mailpet_list_val = get_option(CSCS_GENEROPTION_PREFIX . 'mailpoet_list', '');
|
383 |
+
|
384 |
+
if (empty($cs_mailpet_list_val))
|
385 |
+
return;
|
386 |
+
|
387 |
+
$user_data = array(
|
388 |
+
'email' => $email,
|
389 |
+
'firstname' => $name
|
390 |
+
);
|
391 |
+
|
392 |
+
$data_subscriber = array(
|
393 |
+
'user' => $user_data,
|
394 |
+
'user_list' => array('list_ids' => array($cs_mailpet_list_val))
|
395 |
+
);
|
396 |
+
|
397 |
+
$helper_user = WYSIJA::get('user', 'helper');
|
398 |
+
$helper_user->addSubscriber($data_subscriber);
|
399 |
+
break;
|
400 |
+
default:
|
401 |
+
break;
|
402 |
+
}
|
403 |
}
|
404 |
|
405 |
private function convertToCsv($input_array, $output_file_name, $delimiter) {
|
406 |
+
$temp_memory = fopen('php://memory', 'w');
|
407 |
+
foreach ($input_array as $line) {
|
408 |
+
fputcsv($temp_memory, $line, $delimiter);
|
409 |
+
}
|
410 |
+
fseek($temp_memory, 0);
|
411 |
+
header('Content-Type: application/csv');
|
412 |
+
header('Content-Disposition: attachement; filename="' . $output_file_name . '";');
|
413 |
+
fpassthru($temp_memory);
|
414 |
}
|
415 |
|
416 |
public function createCsvFile() {
|
417 |
+
if (!isset($_GET['rockython_createcsv']) || !isset($_GET['sub']))
|
418 |
+
return;
|
419 |
+
global $wpdb;
|
420 |
+
$subs = $wpdb->get_results("SELECT * FROM " . CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS);
|
421 |
+
$csv_array = array();
|
422 |
+
$csv_array[] = array('Name', 'Email');
|
423 |
|
424 |
+
foreach ($subs as $sub):
|
425 |
+
$csv_array[] = array(!empty($sub->name) ? $sub->email : '', !empty($sub->email) ? $sub->email : '');
|
426 |
+
endforeach;
|
427 |
+
$this->convertToCsv($csv_array, 'igniteup_subscribers_' . time() . '.csv', ',');
|
428 |
+
exit();
|
429 |
}
|
430 |
|
431 |
public function createBccFile() {
|
432 |
+
if (!isset($_GET['rockython_createbcc']) || !isset($_GET['sub']))
|
433 |
+
return;
|
434 |
|
435 |
+
$textTitle = 'igniteup_subscribers_' . time() . '.txt';
|
436 |
+
global $wpdb;
|
437 |
+
$subs = $wpdb->get_results("SELECT * FROM " . CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS);
|
438 |
|
439 |
+
$bccArray = array();
|
440 |
+
foreach ($subs as $reg):
|
441 |
+
$bccArray[] = $reg->name . ' <' . $reg->email . '>';
|
442 |
+
endforeach;
|
443 |
+
header('Content-type: text/plain; charset=utf-8');
|
444 |
+
header('Content-Disposition: attachement; filename="' . $textTitle . '";');
|
445 |
+
echo implode(", ", $bccArray);
|
446 |
+
exit();
|
447 |
}
|
448 |
|
449 |
public function removeSubscribers() {
|
450 |
|
451 |
+
if (!isset($_REQUEST['action']) || $_REQUEST['action'] !== 'trash')
|
452 |
+
return;
|
453 |
|
454 |
+
global $wpdb;
|
455 |
+
$subs = $wpdb->get_results("SELECT * FROM " . CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS . ' ORDER BY id DESC');
|
456 |
+
for ($i = 1; $i <= $subs[0]->id; $i++) {
|
457 |
+
if (isset($_REQUEST['subscriber']) && in_array($i . '', $_REQUEST['subscriber']))
|
458 |
+
$wpdb->delete(CSCS_DBTABLE_PREFIX . CSCS_DBTABLE_SUBSCRIPTS, array('id' => $i));
|
459 |
+
}
|
460 |
}
|
461 |
|
462 |
public function load_languages() {
|
463 |
+
load_plugin_textdomain(CSCS_TEXT_DOMAIN, false, dirname(plugin_basename(CSCS_FILE)) . '/localization/');
|
464 |
}
|
465 |
|
466 |
public function showWelcomeMessage() {
|
467 |
+
if (defined('DOING_AJAX') && DOING_AJAX)
|
468 |
+
return;
|
469 |
|
470 |
// set options for showing welcome message.
|
471 |
+
$prev_version = get_option(CSCS_GENEROPTION_PREFIX . 'version', '1.0');
|
472 |
+
if (floatval(CSCS_CURRENT_VERSION) !== floatval($prev_version) && floatval(CSCS_CURRENT_VERSION) > floatval($prev_version)) {
|
473 |
+
update_option(CSCS_GENEROPTION_PREFIX . 'version', '' . CSCS_CURRENT_VERSION);
|
474 |
+
wp_redirect(admin_url('admin.php?page=cscs_options§ion=help'));
|
475 |
+
exit;
|
476 |
+
}
|
477 |
//-------------
|
478 |
}
|
479 |
|
480 |
+
public function headStatics() {
|
481 |
+
/*
|
482 |
+
* Favicon
|
483 |
+
*/
|
484 |
+
$favicon_url = get_option(CSCS_GENEROPTION_PREFIX . 'favicon_url');
|
485 |
+
if (!empty($favicon_url))
|
486 |
+
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
|
487 |
+
|
488 |
+
/*
|
489 |
+
* Custom script required by IgniteUp
|
490 |
+
*/
|
491 |
+
echo '<script type="text/javascript">igniteup_ajaxurl = "' . admin_url('admin-ajax.php') . '";</script>';
|
492 |
+
|
493 |
+
/*
|
494 |
+
* Do action for template styles
|
495 |
+
*/
|
496 |
+
|
497 |
+
do_action('igniteup_styles_' . CSCS_DEFAULT_TEMPLATE);
|
498 |
+
|
499 |
+
/*
|
500 |
+
* Custom CSS and Header scritps field
|
501 |
+
*/
|
502 |
+
$custom_css = get_option(CSCS_GENEROPTION_PREFIX . 'customcss', '');
|
503 |
+
?>
|
504 |
+
<style>#wp-admin-bar-igniteup_enabled{background-color: #C70000 !important;}
|
505 |
+
#wp-admin-bar-igniteup_enabled:hover a{background: #A20A0A !important;color: #FFFFFF !important;}
|
506 |
+
body::before{background: none !important;}<?php echo $custom_css; ?>
|
507 |
+
</style>
|
508 |
+
<?php
|
509 |
}
|
510 |
|
511 |
+
/*
|
512 |
+
*
|
513 |
+
* WP Head elements for older theme versions
|
514 |
+
*
|
515 |
+
*/
|
516 |
+
|
517 |
+
public function wpHeadForOldThemes() {
|
518 |
+
$favicon_url = get_option(CSCS_GENEROPTION_PREFIX . 'favicon_url');
|
519 |
+
if (!empty($favicon_url))
|
520 |
+
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
|
521 |
+
echo '<script type="text/javascript">igniteup_ajaxurl = "' . admin_url('admin-ajax.php') . '";</script>';
|
522 |
+
}
|
523 |
+
|
524 |
+
/*
|
525 |
+
*
|
526 |
+
* Publish footer scripts
|
527 |
+
*
|
528 |
+
*/
|
529 |
+
|
530 |
+
public function footerScripts() {
|
531 |
+
/*
|
532 |
+
* Do action for template scripts
|
533 |
+
*/
|
534 |
+
|
535 |
+
do_action('igniteup_scripts_' . CSCS_DEFAULT_TEMPLATE);
|
536 |
+
}
|
537 |
+
|
538 |
+
/*
|
539 |
+
*
|
540 |
+
* Enable an admin notice if there are incompatible templates
|
541 |
+
*
|
542 |
+
*/
|
543 |
+
|
544 |
public function noncompatible_theme_notice() {
|
545 |
+
if (!CSAdminOptions::getTemplates(TRUE)) //Check if any non-compatible theme exists.
|
546 |
+
return;
|
547 |
+
?>
|
548 |
+
<div class="error">
|
549 |
+
<p><?php printf(__('There\'re themes not supporting current IgniteUp version (%1$s). To fix <a href="%2$s">Update IgniteUp</a> now!', CSCS_TEXT_DOMAIN), 'v' . CSCS_CURRENT_VERSION, admin_url('update-core.php')); ?></p>
|
550 |
+
</div>
|
551 |
+
<?php
|
552 |
}
|
553 |
|
554 |
+
/*
|
555 |
+
*
|
556 |
+
* Help page subscription form action
|
557 |
+
*
|
558 |
+
*/
|
559 |
+
|
560 |
public function adminSubscribe() {
|
561 |
+
header('Content-type: application/json; charset=utf-8');
|
562 |
+
$email = $_POST['admin_filled_email'];
|
563 |
+
$error = FALSE;
|
564 |
+
$message = '';
|
565 |
+
if (empty($email)) {
|
566 |
+
echo json_encode(array('error' => TRUE, 'message' => 'Please provide your email address!'));
|
567 |
+
wp_die();
|
568 |
+
}
|
569 |
+
|
570 |
+
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
571 |
+
echo json_encode(array('error' => TRUE, 'message' => 'Please enter a valid email address!'));
|
572 |
+
wp_die();
|
573 |
+
}
|
574 |
+
|
575 |
+
$resp = wp_remote_post('http://getigniteup.com/api/subscribe', array(
|
576 |
+
'body' => array('ignitmailsubscr' => TRUE, 'ignitmailaddress' => $email),
|
577 |
+
'timeout' => 20
|
578 |
+
)
|
579 |
+
);
|
580 |
+
|
581 |
+
if (is_wp_error($resp)) {
|
582 |
+
$error = TRUE;
|
583 |
+
$message = 'Something went wrong. Please try again!';
|
584 |
+
}
|
585 |
+
|
586 |
+
$curr_user = get_current_user_id();
|
587 |
+
if (!$error && !empty($curr_user)) {
|
588 |
+
update_user_meta($curr_user, 'igniteup_admin_subscribed', '1');
|
589 |
+
}
|
590 |
+
|
591 |
+
echo json_encode(array('error' => $error, 'message' => $message));
|
592 |
+
wp_die();
|
593 |
+
}
|
594 |
+
|
595 |
+
/*
|
596 |
+
*
|
597 |
+
* Notify admin about a new subscriber
|
598 |
+
*
|
599 |
+
*/
|
600 |
+
|
601 |
+
public function notifySubscriber($email, $name = NULL) {
|
602 |
+
$cs_receive_email_addr = CSCS_GENEROPTION_PREFIX . 'receive_email_addr';
|
603 |
+
$admin_email = get_bloginfo('admin_email');
|
604 |
+
$to = get_option($cs_receive_email_addr, $admin_email);
|
605 |
+
$email_subject = __("You have a new subscriber!", CSCS_TEXT_DOMAIN);
|
606 |
+
$email_body = "<html><body>" .
|
607 |
+
"<h4>" . __('You have a new subscriber to your website via IgniteUp subscribe form.', CSCS_TEXT_DOMAIN) . "</h4>" .
|
608 |
+
"<p>" . __('Name:', CSCS_TEXT_DOMAIN) . " $name<br>" .
|
609 |
+
__('Email:', CSCS_TEXT_DOMAIN) . " $email</p>" .
|
610 |
+
"<p><a href='" . admin_url('admin.php?page=cscs_subscribers') . "'>View all subscribers</a></p>" .
|
611 |
+
"</body></html>";
|
612 |
+
|
613 |
+
$status = wp_mail($to, $email_subject, $email_body, array("MIME-Version: 1.0", "Content-Type: text/html; charset=UTF-8"));
|
614 |
+
return $status;
|
615 |
+
}
|
616 |
+
|
617 |
+
/*
|
618 |
+
*
|
619 |
+
* Igniteup_head action
|
620 |
+
*
|
621 |
+
*/
|
622 |
+
|
623 |
+
public static function perfomIgniteUpHead() {
|
624 |
+
do_action('igniteup_head');
|
625 |
+
}
|
626 |
+
|
627 |
+
/*
|
628 |
+
*
|
629 |
+
* Igniteup_footer action
|
630 |
+
*
|
631 |
+
*/
|
632 |
+
|
633 |
+
public static function perfomIgniteUpFooter() {
|
634 |
+
do_action('igniteup_footer');
|
635 |
+
}
|
636 |
+
|
637 |
+
/*
|
638 |
+
*
|
639 |
+
* Read theme options
|
640 |
+
*
|
641 |
+
*/
|
642 |
+
|
643 |
+
public static function igniteUpGetOption($key, $default = NULL) {
|
644 |
+
global $the_cs_template_options;
|
645 |
+
$value = !empty($the_cs_template_options[$key]) ? $the_cs_template_options[$key] : $default;
|
646 |
+
return $value;
|
647 |
}
|
648 |
|
649 |
}
|
includes/core-helpers.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
*
|
5 |
+
* igniteup_head global function
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
|
9 |
+
function igniteup_head() {
|
10 |
+
CSComingSoonCreator::perfomIgniteUpHead();
|
11 |
+
}
|
12 |
+
|
13 |
+
/*
|
14 |
+
*
|
15 |
+
* igniteup_footer global function
|
16 |
+
*
|
17 |
+
*/
|
18 |
+
|
19 |
+
function igniteup_footer() {
|
20 |
+
CSComingSoonCreator::perfomIgniteUpFooter();
|
21 |
+
}
|
22 |
+
|
23 |
+
/*
|
24 |
+
*
|
25 |
+
* igniteup_get_option global function
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
|
29 |
+
function igniteup_get_option($key, $default = NULL) {
|
30 |
+
$value = CSComingSoonCreator::igniteUpGetOption($key, $default);
|
31 |
+
return $value;
|
32 |
+
}
|
includes/css/codemirror/codemirror.css
ADDED
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* BASICS */
|
2 |
+
|
3 |
+
.CodeMirror {
|
4 |
+
/* Set height, width, borders, and global font properties here */
|
5 |
+
font-family: monospace;
|
6 |
+
height: 300px;
|
7 |
+
color: black;
|
8 |
+
}
|
9 |
+
|
10 |
+
/* PADDING */
|
11 |
+
|
12 |
+
.CodeMirror-lines {
|
13 |
+
padding: 4px 0; /* Vertical padding around content */
|
14 |
+
}
|
15 |
+
.CodeMirror pre {
|
16 |
+
padding: 0 4px; /* Horizontal padding of content */
|
17 |
+
}
|
18 |
+
|
19 |
+
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
20 |
+
background-color: white; /* The little square between H and V scrollbars */
|
21 |
+
}
|
22 |
+
|
23 |
+
/* GUTTER */
|
24 |
+
|
25 |
+
.CodeMirror-gutters {
|
26 |
+
border-right: 1px solid #ddd;
|
27 |
+
background-color: #f7f7f7;
|
28 |
+
white-space: nowrap;
|
29 |
+
}
|
30 |
+
.CodeMirror-linenumbers {}
|
31 |
+
.CodeMirror-linenumber {
|
32 |
+
padding: 0 3px 0 5px;
|
33 |
+
min-width: 20px;
|
34 |
+
text-align: right;
|
35 |
+
color: #999;
|
36 |
+
white-space: nowrap;
|
37 |
+
}
|
38 |
+
|
39 |
+
.CodeMirror-guttermarker { color: black; }
|
40 |
+
.CodeMirror-guttermarker-subtle { color: #999; }
|
41 |
+
|
42 |
+
/* CURSOR */
|
43 |
+
|
44 |
+
.CodeMirror-cursor {
|
45 |
+
border-left: 1px solid black;
|
46 |
+
border-right: none;
|
47 |
+
width: 0;
|
48 |
+
}
|
49 |
+
/* Shown when moving in bi-directional text */
|
50 |
+
.CodeMirror div.CodeMirror-secondarycursor {
|
51 |
+
border-left: 1px solid silver;
|
52 |
+
}
|
53 |
+
.cm-fat-cursor .CodeMirror-cursor {
|
54 |
+
width: auto;
|
55 |
+
border: 0 !important;
|
56 |
+
background: #7e7;
|
57 |
+
}
|
58 |
+
.cm-fat-cursor div.CodeMirror-cursors {
|
59 |
+
z-index: 1;
|
60 |
+
}
|
61 |
+
|
62 |
+
.cm-animate-fat-cursor {
|
63 |
+
width: auto;
|
64 |
+
border: 0;
|
65 |
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
66 |
+
-moz-animation: blink 1.06s steps(1) infinite;
|
67 |
+
animation: blink 1.06s steps(1) infinite;
|
68 |
+
background-color: #7e7;
|
69 |
+
}
|
70 |
+
@-moz-keyframes blink {
|
71 |
+
0% {}
|
72 |
+
50% { background-color: transparent; }
|
73 |
+
100% {}
|
74 |
+
}
|
75 |
+
@-webkit-keyframes blink {
|
76 |
+
0% {}
|
77 |
+
50% { background-color: transparent; }
|
78 |
+
100% {}
|
79 |
+
}
|
80 |
+
@keyframes blink {
|
81 |
+
0% {}
|
82 |
+
50% { background-color: transparent; }
|
83 |
+
100% {}
|
84 |
+
}
|
85 |
+
|
86 |
+
/* Can style cursor different in overwrite (non-insert) mode */
|
87 |
+
.CodeMirror-overwrite .CodeMirror-cursor {}
|
88 |
+
|
89 |
+
.cm-tab { display: inline-block; text-decoration: inherit; }
|
90 |
+
|
91 |
+
.CodeMirror-rulers {
|
92 |
+
position: absolute;
|
93 |
+
left: 0; right: 0; top: -50px; bottom: -20px;
|
94 |
+
overflow: hidden;
|
95 |
+
}
|
96 |
+
.CodeMirror-ruler {
|
97 |
+
border-left: 1px solid #ccc;
|
98 |
+
top: 0; bottom: 0;
|
99 |
+
position: absolute;
|
100 |
+
}
|
101 |
+
|
102 |
+
/* DEFAULT THEME */
|
103 |
+
|
104 |
+
.cm-s-default .cm-header {color: blue;}
|
105 |
+
.cm-s-default .cm-quote {color: #090;}
|
106 |
+
.cm-negative {color: #d44;}
|
107 |
+
.cm-positive {color: #292;}
|
108 |
+
.cm-header, .cm-strong {font-weight: bold;}
|
109 |
+
.cm-em {font-style: italic;}
|
110 |
+
.cm-link {text-decoration: underline;}
|
111 |
+
.cm-strikethrough {text-decoration: line-through;}
|
112 |
+
|
113 |
+
.cm-s-default .cm-keyword {color: #708;}
|
114 |
+
.cm-s-default .cm-atom {color: #219;}
|
115 |
+
.cm-s-default .cm-number {color: #164;}
|
116 |
+
.cm-s-default .cm-def {color: #00f;}
|
117 |
+
.cm-s-default .cm-variable,
|
118 |
+
.cm-s-default .cm-punctuation,
|
119 |
+
.cm-s-default .cm-property,
|
120 |
+
.cm-s-default .cm-operator {}
|
121 |
+
.cm-s-default .cm-variable-2 {color: #05a;}
|
122 |
+
.cm-s-default .cm-variable-3 {color: #085;}
|
123 |
+
.cm-s-default .cm-comment {color: #a50;}
|
124 |
+
.cm-s-default .cm-string {color: #a11;}
|
125 |
+
.cm-s-default .cm-string-2 {color: #f50;}
|
126 |
+
.cm-s-default .cm-meta {color: #555;}
|
127 |
+
.cm-s-default .cm-qualifier {color: #555;}
|
128 |
+
.cm-s-default .cm-builtin {color: #30a;}
|
129 |
+
.cm-s-default .cm-bracket {color: #997;}
|
130 |
+
.cm-s-default .cm-tag {color: #170;}
|
131 |
+
.cm-s-default .cm-attribute {color: #00c;}
|
132 |
+
.cm-s-default .cm-hr {color: #999;}
|
133 |
+
.cm-s-default .cm-link {color: #00c;}
|
134 |
+
|
135 |
+
.cm-s-default .cm-error {color: #f00;}
|
136 |
+
.cm-invalidchar {color: #f00;}
|
137 |
+
|
138 |
+
.CodeMirror-composing { border-bottom: 2px solid; }
|
139 |
+
|
140 |
+
/* Default styles for common addons */
|
141 |
+
|
142 |
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
143 |
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
144 |
+
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
145 |
+
.CodeMirror-activeline-background {background: #e8f2ff;}
|
146 |
+
|
147 |
+
/* STOP */
|
148 |
+
|
149 |
+
/* The rest of this file contains styles related to the mechanics of
|
150 |
+
the editor. You probably shouldn't touch them. */
|
151 |
+
|
152 |
+
.CodeMirror {
|
153 |
+
position: relative;
|
154 |
+
overflow: hidden;
|
155 |
+
background: white;
|
156 |
+
}
|
157 |
+
|
158 |
+
.CodeMirror-scroll {
|
159 |
+
overflow: scroll !important; /* Things will break if this is overridden */
|
160 |
+
/* 30px is the magic margin used to hide the element's real scrollbars */
|
161 |
+
/* See overflow: hidden in .CodeMirror */
|
162 |
+
margin-bottom: -30px; margin-right: -30px;
|
163 |
+
padding-bottom: 30px;
|
164 |
+
height: 100%;
|
165 |
+
outline: none; /* Prevent dragging from highlighting the element */
|
166 |
+
position: relative;
|
167 |
+
}
|
168 |
+
.CodeMirror-sizer {
|
169 |
+
position: relative;
|
170 |
+
border-right: 30px solid transparent;
|
171 |
+
}
|
172 |
+
|
173 |
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
174 |
+
before actual scrolling happens, thus preventing shaking and
|
175 |
+
flickering artifacts. */
|
176 |
+
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
177 |
+
position: absolute;
|
178 |
+
z-index: 6;
|
179 |
+
display: none;
|
180 |
+
}
|
181 |
+
.CodeMirror-vscrollbar {
|
182 |
+
right: 0; top: 0;
|
183 |
+
overflow-x: hidden;
|
184 |
+
overflow-y: scroll;
|
185 |
+
}
|
186 |
+
.CodeMirror-hscrollbar {
|
187 |
+
bottom: 0; left: 0;
|
188 |
+
overflow-y: hidden;
|
189 |
+
overflow-x: scroll;
|
190 |
+
}
|
191 |
+
.CodeMirror-scrollbar-filler {
|
192 |
+
right: 0; bottom: 0;
|
193 |
+
}
|
194 |
+
.CodeMirror-gutter-filler {
|
195 |
+
left: 0; bottom: 0;
|
196 |
+
}
|
197 |
+
|
198 |
+
.CodeMirror-gutters {
|
199 |
+
position: absolute; left: 0; top: 0;
|
200 |
+
min-height: 100%;
|
201 |
+
z-index: 3;
|
202 |
+
}
|
203 |
+
.CodeMirror-gutter {
|
204 |
+
white-space: normal;
|
205 |
+
height: 100%;
|
206 |
+
display: inline-block;
|
207 |
+
vertical-align: top;
|
208 |
+
margin-bottom: -30px;
|
209 |
+
}
|
210 |
+
.CodeMirror-gutter-wrapper {
|
211 |
+
position: absolute;
|
212 |
+
z-index: 4;
|
213 |
+
background: none !important;
|
214 |
+
border: none !important;
|
215 |
+
}
|
216 |
+
.CodeMirror-gutter-background {
|
217 |
+
position: absolute;
|
218 |
+
top: 0; bottom: 0;
|
219 |
+
z-index: 4;
|
220 |
+
}
|
221 |
+
.CodeMirror-gutter-elt {
|
222 |
+
position: absolute;
|
223 |
+
cursor: default;
|
224 |
+
z-index: 4;
|
225 |
+
}
|
226 |
+
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
|
227 |
+
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
|
228 |
+
|
229 |
+
.CodeMirror-lines {
|
230 |
+
cursor: text;
|
231 |
+
min-height: 1px; /* prevents collapsing before first draw */
|
232 |
+
}
|
233 |
+
.CodeMirror pre {
|
234 |
+
/* Reset some styles that the rest of the page might have set */
|
235 |
+
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
236 |
+
border-width: 0;
|
237 |
+
background: transparent;
|
238 |
+
font-family: inherit;
|
239 |
+
font-size: inherit;
|
240 |
+
margin: 0;
|
241 |
+
white-space: pre;
|
242 |
+
word-wrap: normal;
|
243 |
+
line-height: inherit;
|
244 |
+
color: inherit;
|
245 |
+
z-index: 2;
|
246 |
+
position: relative;
|
247 |
+
overflow: visible;
|
248 |
+
-webkit-tap-highlight-color: transparent;
|
249 |
+
-webkit-font-variant-ligatures: contextual;
|
250 |
+
font-variant-ligatures: contextual;
|
251 |
+
}
|
252 |
+
.CodeMirror-wrap pre {
|
253 |
+
word-wrap: break-word;
|
254 |
+
white-space: pre-wrap;
|
255 |
+
word-break: normal;
|
256 |
+
}
|
257 |
+
|
258 |
+
.CodeMirror-linebackground {
|
259 |
+
position: absolute;
|
260 |
+
left: 0; right: 0; top: 0; bottom: 0;
|
261 |
+
z-index: 0;
|
262 |
+
}
|
263 |
+
|
264 |
+
.CodeMirror-linewidget {
|
265 |
+
position: relative;
|
266 |
+
z-index: 2;
|
267 |
+
overflow: auto;
|
268 |
+
}
|
269 |
+
|
270 |
+
.CodeMirror-widget {}
|
271 |
+
|
272 |
+
.CodeMirror-rtl pre { direction: rtl; }
|
273 |
+
|
274 |
+
.CodeMirror-code {
|
275 |
+
outline: none;
|
276 |
+
}
|
277 |
+
|
278 |
+
/* Force content-box sizing for the elements where we expect it */
|
279 |
+
.CodeMirror-scroll,
|
280 |
+
.CodeMirror-sizer,
|
281 |
+
.CodeMirror-gutter,
|
282 |
+
.CodeMirror-gutters,
|
283 |
+
.CodeMirror-linenumber {
|
284 |
+
-moz-box-sizing: content-box;
|
285 |
+
box-sizing: content-box;
|
286 |
+
}
|
287 |
+
|
288 |
+
.CodeMirror-measure {
|
289 |
+
position: absolute;
|
290 |
+
width: 100%;
|
291 |
+
height: 0;
|
292 |
+
overflow: hidden;
|
293 |
+
visibility: hidden;
|
294 |
+
}
|
295 |
+
|
296 |
+
.CodeMirror-cursor {
|
297 |
+
position: absolute;
|
298 |
+
pointer-events: none;
|
299 |
+
}
|
300 |
+
.CodeMirror-measure pre { position: static; }
|
301 |
+
|
302 |
+
div.CodeMirror-cursors {
|
303 |
+
visibility: hidden;
|
304 |
+
position: relative;
|
305 |
+
z-index: 3;
|
306 |
+
}
|
307 |
+
div.CodeMirror-dragcursors {
|
308 |
+
visibility: visible;
|
309 |
+
}
|
310 |
+
|
311 |
+
.CodeMirror-focused div.CodeMirror-cursors {
|
312 |
+
visibility: visible;
|
313 |
+
}
|
314 |
+
|
315 |
+
.CodeMirror-selected { background: #d9d9d9; }
|
316 |
+
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
317 |
+
.CodeMirror-crosshair { cursor: crosshair; }
|
318 |
+
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
319 |
+
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
320 |
+
|
321 |
+
.cm-searching {
|
322 |
+
background: #ffa;
|
323 |
+
background: rgba(255, 255, 0, .4);
|
324 |
+
}
|
325 |
+
|
326 |
+
/* Used to force a border model for a node */
|
327 |
+
.cm-force-border { padding-right: .1px; }
|
328 |
+
|
329 |
+
@media print {
|
330 |
+
/* Hide the cursor when printing */
|
331 |
+
.CodeMirror div.CodeMirror-cursors {
|
332 |
+
visibility: hidden;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
/* See issue #2901 */
|
337 |
+
.cm-tab-wrap-hack:after { content: ''; }
|
338 |
+
|
339 |
+
/* Help users use markselection to safely style text background */
|
340 |
+
span.CodeMirror-selectedtext { background: none; }
|
includes/css/codemirror/ttcn.css
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.cm-s-ttcn .cm-quote { color: #090; }
|
2 |
+
.cm-s-ttcn .cm-negative { color: #d44; }
|
3 |
+
.cm-s-ttcn .cm-positive { color: #292; }
|
4 |
+
.cm-s-ttcn .cm-header, .cm-strong { font-weight: bold; }
|
5 |
+
.cm-s-ttcn .cm-em { font-style: italic; }
|
6 |
+
.cm-s-ttcn .cm-link { text-decoration: underline; }
|
7 |
+
.cm-s-ttcn .cm-strikethrough { text-decoration: line-through; }
|
8 |
+
.cm-s-ttcn .cm-header { color: #00f; font-weight: bold; }
|
9 |
+
|
10 |
+
.cm-s-ttcn .cm-atom { color: #219; }
|
11 |
+
.cm-s-ttcn .cm-attribute { color: #00c; }
|
12 |
+
.cm-s-ttcn .cm-bracket { color: #997; }
|
13 |
+
.cm-s-ttcn .cm-comment { color: #333333; }
|
14 |
+
.cm-s-ttcn .cm-def { color: #00f; }
|
15 |
+
.cm-s-ttcn .cm-em { font-style: italic; }
|
16 |
+
.cm-s-ttcn .cm-error { color: #f00; }
|
17 |
+
.cm-s-ttcn .cm-hr { color: #999; }
|
18 |
+
.cm-s-ttcn .cm-invalidchar { color: #f00; }
|
19 |
+
.cm-s-ttcn .cm-keyword { font-weight:bold; }
|
20 |
+
.cm-s-ttcn .cm-link { color: #00c; text-decoration: underline; }
|
21 |
+
.cm-s-ttcn .cm-meta { color: #555; }
|
22 |
+
.cm-s-ttcn .cm-negative { color: #d44; }
|
23 |
+
.cm-s-ttcn .cm-positive { color: #292; }
|
24 |
+
.cm-s-ttcn .cm-qualifier { color: #555; }
|
25 |
+
.cm-s-ttcn .cm-strikethrough { text-decoration: line-through; }
|
26 |
+
.cm-s-ttcn .cm-string { color: #006400; }
|
27 |
+
.cm-s-ttcn .cm-string-2 { color: #f50; }
|
28 |
+
.cm-s-ttcn .cm-strong { font-weight: bold; }
|
29 |
+
.cm-s-ttcn .cm-tag { color: #170; }
|
30 |
+
.cm-s-ttcn .cm-variable { color: #8B2252; }
|
31 |
+
.cm-s-ttcn .cm-variable-2 { color: #05a; }
|
32 |
+
.cm-s-ttcn .cm-variable-3 { color: #085; }
|
33 |
+
|
34 |
+
.cm-s-ttcn .cm-invalidchar { color: #f00; }
|
35 |
+
|
36 |
+
/* ASN */
|
37 |
+
.cm-s-ttcn .cm-accessTypes,
|
38 |
+
.cm-s-ttcn .cm-compareTypes { color: #27408B; }
|
39 |
+
.cm-s-ttcn .cm-cmipVerbs { color: #8B2252; }
|
40 |
+
.cm-s-ttcn .cm-modifier { color:#D2691E; }
|
41 |
+
.cm-s-ttcn .cm-status { color:#8B4545; }
|
42 |
+
.cm-s-ttcn .cm-storage { color:#A020F0; }
|
43 |
+
.cm-s-ttcn .cm-tags { color:#006400; }
|
44 |
+
|
45 |
+
/* CFG */
|
46 |
+
.cm-s-ttcn .cm-externalCommands { color: #8B4545; font-weight:bold; }
|
47 |
+
.cm-s-ttcn .cm-fileNCtrlMaskOptions,
|
48 |
+
.cm-s-ttcn .cm-sectionTitle { color: #2E8B57; font-weight:bold; }
|
49 |
+
|
50 |
+
/* TTCN */
|
51 |
+
.cm-s-ttcn .cm-booleanConsts,
|
52 |
+
.cm-s-ttcn .cm-otherConsts,
|
53 |
+
.cm-s-ttcn .cm-verdictConsts { color: #006400; }
|
54 |
+
.cm-s-ttcn .cm-configOps,
|
55 |
+
.cm-s-ttcn .cm-functionOps,
|
56 |
+
.cm-s-ttcn .cm-portOps,
|
57 |
+
.cm-s-ttcn .cm-sutOps,
|
58 |
+
.cm-s-ttcn .cm-timerOps,
|
59 |
+
.cm-s-ttcn .cm-verdictOps { color: #0000FF; }
|
60 |
+
.cm-s-ttcn .cm-preprocessor,
|
61 |
+
.cm-s-ttcn .cm-templateMatch,
|
62 |
+
.cm-s-ttcn .cm-ttcn3Macros { color: #27408B; }
|
63 |
+
.cm-s-ttcn .cm-types { color: #A52A2A; font-weight:bold; }
|
64 |
+
.cm-s-ttcn .cm-visibilityModifiers { font-weight:bold; }
|
includes/css/main.css
CHANGED
@@ -38,7 +38,7 @@ body.igniteup_page_cscs_options .cs-hidden-section{display: none;}
|
|
38 |
box-shadow: 2px 2px 5px 0px rgba(117,189,189,1);}
|
39 |
.igniteup_page_cscs_options .update-page .help-page-col-last{margin-right: 0;}
|
40 |
.igniteup_page_cscs_options .update-page a.blog_read{font-size: 12px;margin-left: 12px;}
|
41 |
-
.igniteup_page_cscs_options .update-page .help-page-widget h2{font-weight: 600;font-size: 23px;}
|
42 |
.igniteup_page_cscs_options .update-page .help-page-widget p{font-size: 16px;color: #777;}
|
43 |
.igniteup_page_cscs_options .update-page .changelog h3{color:#539030;}
|
44 |
.igniteup_page_cscs_options .update-page .changelog .changelog-main-list li.main-item{font-size: 21px; color: #0073AA; margin-bottom: 20px;display: inline-block;}
|
@@ -115,13 +115,16 @@ Changes on jQuery UI
|
|
115 |
.igniteup-options{
|
116 |
width: 100%;
|
117 |
}
|
118 |
-
.igniteup-
|
119 |
display: none;
|
120 |
-
background: #F44236;
|
121 |
padding: 1px;
|
122 |
}
|
|
|
|
|
|
|
|
|
123 |
@media(min-width:768px){
|
124 |
-
.igniteup-
|
125 |
width:25%;
|
126 |
float: right;
|
127 |
display: block;
|
@@ -130,4 +133,8 @@ Changes on jQuery UI
|
|
130 |
width:74%;
|
131 |
float: left;
|
132 |
}
|
|
|
|
|
|
|
|
|
133 |
}
|
38 |
box-shadow: 2px 2px 5px 0px rgba(117,189,189,1);}
|
39 |
.igniteup_page_cscs_options .update-page .help-page-col-last{margin-right: 0;}
|
40 |
.igniteup_page_cscs_options .update-page a.blog_read{font-size: 12px;margin-left: 12px;}
|
41 |
+
.igniteup_page_cscs_options .update-page .help-page-widget h2{font-weight: 600;font-size: 23px;margin-top: 5px;}
|
42 |
.igniteup_page_cscs_options .update-page .help-page-widget p{font-size: 16px;color: #777;}
|
43 |
.igniteup_page_cscs_options .update-page .changelog h3{color:#539030;}
|
44 |
.igniteup_page_cscs_options .update-page .changelog .changelog-main-list li.main-item{font-size: 21px; color: #0073AA; margin-bottom: 20px;display: inline-block;}
|
115 |
.igniteup-options{
|
116 |
width: 100%;
|
117 |
}
|
118 |
+
.igniteup-banners{
|
119 |
display: none;
|
|
|
120 |
padding: 1px;
|
121 |
}
|
122 |
+
.igniteup-promo-temp{
|
123 |
+
width:100%;
|
124 |
+
margin-bottom: 20px;
|
125 |
+
}
|
126 |
@media(min-width:768px){
|
127 |
+
.igniteup-banners{
|
128 |
width:25%;
|
129 |
float: right;
|
130 |
display: block;
|
133 |
width:74%;
|
134 |
float: left;
|
135 |
}
|
136 |
+
}
|
137 |
+
|
138 |
+
.CodeMirror{
|
139 |
+
border: 1px solid #bababa;
|
140 |
}
|
includes/images/help-get-templates-1.jpg
ADDED
Binary file
|
includes/images/help-get-templates-2.jpg
ADDED
Binary file
|
includes/images/help-get-templates-3.jpg
ADDED
Binary file
|
includes/images/{help-get-templates.jpg → help-get-templates-4.jpg}
RENAMED
File without changes
|
includes/js/codemirror/codemirror.js
ADDED
@@ -0,0 +1,9351 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
// This is CodeMirror (http://codemirror.net), a code editor
|
5 |
+
// implemented in JavaScript on top of the browser's DOM.
|
6 |
+
//
|
7 |
+
// You can find some technical background for some of the code below
|
8 |
+
// at http://marijnhaverbeke.nl/blog/#cm-internals .
|
9 |
+
|
10 |
+
(function (global, factory) {
|
11 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
12 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
13 |
+
(global.CodeMirror = factory());
|
14 |
+
}(this, (function () { 'use strict';
|
15 |
+
|
16 |
+
// Kludges for bugs and behavior differences that can't be feature
|
17 |
+
// detected are enabled based on userAgent etc sniffing.
|
18 |
+
var userAgent = navigator.userAgent
|
19 |
+
var platform = navigator.platform
|
20 |
+
|
21 |
+
var gecko = /gecko\/\d/i.test(userAgent)
|
22 |
+
var ie_upto10 = /MSIE \d/.test(userAgent)
|
23 |
+
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
|
24 |
+
var edge = /Edge\/(\d+)/.exec(userAgent)
|
25 |
+
var ie = ie_upto10 || ie_11up || edge
|
26 |
+
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
|
27 |
+
var webkit = !edge && /WebKit\//.test(userAgent)
|
28 |
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
|
29 |
+
var chrome = !edge && /Chrome\//.test(userAgent)
|
30 |
+
var presto = /Opera\//.test(userAgent)
|
31 |
+
var safari = /Apple Computer/.test(navigator.vendor)
|
32 |
+
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
|
33 |
+
var phantom = /PhantomJS/.test(userAgent)
|
34 |
+
|
35 |
+
var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
|
36 |
+
var android = /Android/.test(userAgent)
|
37 |
+
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
38 |
+
var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
|
39 |
+
var mac = ios || /Mac/.test(platform)
|
40 |
+
var chromeOS = /\bCrOS\b/.test(userAgent)
|
41 |
+
var windows = /win/i.test(platform)
|
42 |
+
|
43 |
+
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
|
44 |
+
if (presto_version) { presto_version = Number(presto_version[1]) }
|
45 |
+
if (presto_version && presto_version >= 15) { presto = false; webkit = true }
|
46 |
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
47 |
+
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
|
48 |
+
var captureRightClick = gecko || (ie && ie_version >= 9)
|
49 |
+
|
50 |
+
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
|
51 |
+
|
52 |
+
var rmClass = function(node, cls) {
|
53 |
+
var current = node.className
|
54 |
+
var match = classTest(cls).exec(current)
|
55 |
+
if (match) {
|
56 |
+
var after = current.slice(match.index + match[0].length)
|
57 |
+
node.className = current.slice(0, match.index) + (after ? match[1] + after : "")
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
function removeChildren(e) {
|
62 |
+
for (var count = e.childNodes.length; count > 0; --count)
|
63 |
+
{ e.removeChild(e.firstChild) }
|
64 |
+
return e
|
65 |
+
}
|
66 |
+
|
67 |
+
function removeChildrenAndAdd(parent, e) {
|
68 |
+
return removeChildren(parent).appendChild(e)
|
69 |
+
}
|
70 |
+
|
71 |
+
function elt(tag, content, className, style) {
|
72 |
+
var e = document.createElement(tag)
|
73 |
+
if (className) { e.className = className }
|
74 |
+
if (style) { e.style.cssText = style }
|
75 |
+
if (typeof content == "string") { e.appendChild(document.createTextNode(content)) }
|
76 |
+
else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } }
|
77 |
+
return e
|
78 |
+
}
|
79 |
+
// wrapper for elt, which removes the elt from the accessibility tree
|
80 |
+
function eltP(tag, content, className, style) {
|
81 |
+
var e = elt(tag, content, className, style)
|
82 |
+
e.setAttribute("role", "presentation")
|
83 |
+
return e
|
84 |
+
}
|
85 |
+
|
86 |
+
var range
|
87 |
+
if (document.createRange) { range = function(node, start, end, endNode) {
|
88 |
+
var r = document.createRange()
|
89 |
+
r.setEnd(endNode || node, end)
|
90 |
+
r.setStart(node, start)
|
91 |
+
return r
|
92 |
+
} }
|
93 |
+
else { range = function(node, start, end) {
|
94 |
+
var r = document.body.createTextRange()
|
95 |
+
try { r.moveToElementText(node.parentNode) }
|
96 |
+
catch(e) { return r }
|
97 |
+
r.collapse(true)
|
98 |
+
r.moveEnd("character", end)
|
99 |
+
r.moveStart("character", start)
|
100 |
+
return r
|
101 |
+
} }
|
102 |
+
|
103 |
+
function contains(parent, child) {
|
104 |
+
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
|
105 |
+
{ child = child.parentNode }
|
106 |
+
if (parent.contains)
|
107 |
+
{ return parent.contains(child) }
|
108 |
+
do {
|
109 |
+
if (child.nodeType == 11) { child = child.host }
|
110 |
+
if (child == parent) { return true }
|
111 |
+
} while (child = child.parentNode)
|
112 |
+
}
|
113 |
+
|
114 |
+
function activeElt() {
|
115 |
+
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
|
116 |
+
// IE < 10 will throw when accessed while the page is loading or in an iframe.
|
117 |
+
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
|
118 |
+
var activeElement
|
119 |
+
try {
|
120 |
+
activeElement = document.activeElement
|
121 |
+
} catch(e) {
|
122 |
+
activeElement = document.body || null
|
123 |
+
}
|
124 |
+
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
|
125 |
+
{ activeElement = activeElement.shadowRoot.activeElement }
|
126 |
+
return activeElement
|
127 |
+
}
|
128 |
+
|
129 |
+
function addClass(node, cls) {
|
130 |
+
var current = node.className
|
131 |
+
if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls }
|
132 |
+
}
|
133 |
+
function joinClasses(a, b) {
|
134 |
+
var as = a.split(" ")
|
135 |
+
for (var i = 0; i < as.length; i++)
|
136 |
+
{ if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } }
|
137 |
+
return b
|
138 |
+
}
|
139 |
+
|
140 |
+
var selectInput = function(node) { node.select() }
|
141 |
+
if (ios) // Mobile Safari apparently has a bug where select() is broken.
|
142 |
+
{ selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } }
|
143 |
+
else if (ie) // Suppress mysterious IE10 errors
|
144 |
+
{ selectInput = function(node) { try { node.select() } catch(_e) {} } }
|
145 |
+
|
146 |
+
function bind(f) {
|
147 |
+
var args = Array.prototype.slice.call(arguments, 1)
|
148 |
+
return function(){return f.apply(null, args)}
|
149 |
+
}
|
150 |
+
|
151 |
+
function copyObj(obj, target, overwrite) {
|
152 |
+
if (!target) { target = {} }
|
153 |
+
for (var prop in obj)
|
154 |
+
{ if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
155 |
+
{ target[prop] = obj[prop] } }
|
156 |
+
return target
|
157 |
+
}
|
158 |
+
|
159 |
+
// Counts the column offset in a string, taking tabs into account.
|
160 |
+
// Used mostly to find indentation.
|
161 |
+
function countColumn(string, end, tabSize, startIndex, startValue) {
|
162 |
+
if (end == null) {
|
163 |
+
end = string.search(/[^\s\u00a0]/)
|
164 |
+
if (end == -1) { end = string.length }
|
165 |
+
}
|
166 |
+
for (var i = startIndex || 0, n = startValue || 0;;) {
|
167 |
+
var nextTab = string.indexOf("\t", i)
|
168 |
+
if (nextTab < 0 || nextTab >= end)
|
169 |
+
{ return n + (end - i) }
|
170 |
+
n += nextTab - i
|
171 |
+
n += tabSize - (n % tabSize)
|
172 |
+
i = nextTab + 1
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
var Delayed = function() {this.id = null};
|
177 |
+
Delayed.prototype.set = function (ms, f) {
|
178 |
+
clearTimeout(this.id)
|
179 |
+
this.id = setTimeout(f, ms)
|
180 |
+
};
|
181 |
+
|
182 |
+
function indexOf(array, elt) {
|
183 |
+
for (var i = 0; i < array.length; ++i)
|
184 |
+
{ if (array[i] == elt) { return i } }
|
185 |
+
return -1
|
186 |
+
}
|
187 |
+
|
188 |
+
// Number of pixels added to scroller and sizer to hide scrollbar
|
189 |
+
var scrollerGap = 30
|
190 |
+
|
191 |
+
// Returned or thrown by various protocols to signal 'I'm not
|
192 |
+
// handling this'.
|
193 |
+
var Pass = {toString: function(){return "CodeMirror.Pass"}}
|
194 |
+
|
195 |
+
// Reused option objects for setSelection & friends
|
196 |
+
var sel_dontScroll = {scroll: false};
|
197 |
+
var sel_mouse = {origin: "*mouse"};
|
198 |
+
var sel_move = {origin: "+move"};
|
199 |
+
// The inverse of countColumn -- find the offset that corresponds to
|
200 |
+
// a particular column.
|
201 |
+
function findColumn(string, goal, tabSize) {
|
202 |
+
for (var pos = 0, col = 0;;) {
|
203 |
+
var nextTab = string.indexOf("\t", pos)
|
204 |
+
if (nextTab == -1) { nextTab = string.length }
|
205 |
+
var skipped = nextTab - pos
|
206 |
+
if (nextTab == string.length || col + skipped >= goal)
|
207 |
+
{ return pos + Math.min(skipped, goal - col) }
|
208 |
+
col += nextTab - pos
|
209 |
+
col += tabSize - (col % tabSize)
|
210 |
+
pos = nextTab + 1
|
211 |
+
if (col >= goal) { return pos }
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
var spaceStrs = [""]
|
216 |
+
function spaceStr(n) {
|
217 |
+
while (spaceStrs.length <= n)
|
218 |
+
{ spaceStrs.push(lst(spaceStrs) + " ") }
|
219 |
+
return spaceStrs[n]
|
220 |
+
}
|
221 |
+
|
222 |
+
function lst(arr) { return arr[arr.length-1] }
|
223 |
+
|
224 |
+
function map(array, f) {
|
225 |
+
var out = []
|
226 |
+
for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) }
|
227 |
+
return out
|
228 |
+
}
|
229 |
+
|
230 |
+
function insertSorted(array, value, score) {
|
231 |
+
var pos = 0, priority = score(value)
|
232 |
+
while (pos < array.length && score(array[pos]) <= priority) { pos++ }
|
233 |
+
array.splice(pos, 0, value)
|
234 |
+
}
|
235 |
+
|
236 |
+
function nothing() {}
|
237 |
+
|
238 |
+
function createObj(base, props) {
|
239 |
+
var inst
|
240 |
+
if (Object.create) {
|
241 |
+
inst = Object.create(base)
|
242 |
+
} else {
|
243 |
+
nothing.prototype = base
|
244 |
+
inst = new nothing()
|
245 |
+
}
|
246 |
+
if (props) { copyObj(props, inst) }
|
247 |
+
return inst
|
248 |
+
}
|
249 |
+
|
250 |
+
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
|
251 |
+
function isWordCharBasic(ch) {
|
252 |
+
return /\w/.test(ch) || ch > "\x80" &&
|
253 |
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
|
254 |
+
}
|
255 |
+
function isWordChar(ch, helper) {
|
256 |
+
if (!helper) { return isWordCharBasic(ch) }
|
257 |
+
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
|
258 |
+
return helper.test(ch)
|
259 |
+
}
|
260 |
+
|
261 |
+
function isEmpty(obj) {
|
262 |
+
for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
|
263 |
+
return true
|
264 |
+
}
|
265 |
+
|
266 |
+
// Extending unicode characters. A series of a non-extending char +
|
267 |
+
// any number of extending chars is treated as a single unit as far
|
268 |
+
// as editing and measuring is concerned. This is not fully correct,
|
269 |
+
// since some scripts/fonts/browsers also treat other configurations
|
270 |
+
// of code points as a group.
|
271 |
+
var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
|
272 |
+
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
|
273 |
+
|
274 |
+
// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
|
275 |
+
function skipExtendingChars(str, pos, dir) {
|
276 |
+
while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir }
|
277 |
+
return pos
|
278 |
+
}
|
279 |
+
|
280 |
+
// Returns the value from the range [`from`; `to`] that satisfies
|
281 |
+
// `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
|
282 |
+
function findFirst(pred, from, to) {
|
283 |
+
for (;;) {
|
284 |
+
if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
|
285 |
+
var mid = Math.floor((from + to) / 2)
|
286 |
+
if (pred(mid)) { to = mid }
|
287 |
+
else { from = mid }
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
// The display handles the DOM integration, both for input reading
|
292 |
+
// and content drawing. It holds references to DOM nodes and
|
293 |
+
// display-related state.
|
294 |
+
|
295 |
+
function Display(place, doc, input) {
|
296 |
+
var d = this
|
297 |
+
this.input = input
|
298 |
+
|
299 |
+
// Covers bottom-right square when both scrollbars are present.
|
300 |
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
|
301 |
+
d.scrollbarFiller.setAttribute("cm-not-content", "true")
|
302 |
+
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
303 |
+
// and h scrollbar is present.
|
304 |
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
|
305 |
+
d.gutterFiller.setAttribute("cm-not-content", "true")
|
306 |
+
// Will contain the actual code, positioned to cover the viewport.
|
307 |
+
d.lineDiv = eltP("div", null, "CodeMirror-code")
|
308 |
+
// Elements are added to these to represent selection and cursors.
|
309 |
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
|
310 |
+
d.cursorDiv = elt("div", null, "CodeMirror-cursors")
|
311 |
+
// A visibility: hidden element used to find the size of things.
|
312 |
+
d.measure = elt("div", null, "CodeMirror-measure")
|
313 |
+
// When lines outside of the viewport are measured, they are drawn in this.
|
314 |
+
d.lineMeasure = elt("div", null, "CodeMirror-measure")
|
315 |
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
316 |
+
d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
317 |
+
null, "position: relative; outline: none")
|
318 |
+
var lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
|
319 |
+
// Moved around its parent to cover visible view.
|
320 |
+
d.mover = elt("div", [lines], null, "position: relative")
|
321 |
+
// Set to the height of the document, allowing scrolling.
|
322 |
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
|
323 |
+
d.sizerWidth = null
|
324 |
+
// Behavior of elts with overflow: auto and padding is
|
325 |
+
// inconsistent across browsers. This is used to ensure the
|
326 |
+
// scrollable area is big enough.
|
327 |
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
|
328 |
+
// Will contain the gutters, if any.
|
329 |
+
d.gutters = elt("div", null, "CodeMirror-gutters")
|
330 |
+
d.lineGutter = null
|
331 |
+
// Actual scrollable element.
|
332 |
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
|
333 |
+
d.scroller.setAttribute("tabIndex", "-1")
|
334 |
+
// The element in which the editor lives.
|
335 |
+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
|
336 |
+
|
337 |
+
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
338 |
+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
|
339 |
+
if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true }
|
340 |
+
|
341 |
+
if (place) {
|
342 |
+
if (place.appendChild) { place.appendChild(d.wrapper) }
|
343 |
+
else { place(d.wrapper) }
|
344 |
+
}
|
345 |
+
|
346 |
+
// Current rendered range (may be bigger than the view window).
|
347 |
+
d.viewFrom = d.viewTo = doc.first
|
348 |
+
d.reportedViewFrom = d.reportedViewTo = doc.first
|
349 |
+
// Information about the rendered lines.
|
350 |
+
d.view = []
|
351 |
+
d.renderedView = null
|
352 |
+
// Holds info about a single rendered line when it was rendered
|
353 |
+
// for measurement, while not in view.
|
354 |
+
d.externalMeasured = null
|
355 |
+
// Empty space (in pixels) above the view
|
356 |
+
d.viewOffset = 0
|
357 |
+
d.lastWrapHeight = d.lastWrapWidth = 0
|
358 |
+
d.updateLineNumbers = null
|
359 |
+
|
360 |
+
d.nativeBarWidth = d.barHeight = d.barWidth = 0
|
361 |
+
d.scrollbarsClipped = false
|
362 |
+
|
363 |
+
// Used to only resize the line number gutter when necessary (when
|
364 |
+
// the amount of lines crosses a boundary that makes its width change)
|
365 |
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
|
366 |
+
// Set to true when a non-horizontal-scrolling line widget is
|
367 |
+
// added. As an optimization, line widget aligning is skipped when
|
368 |
+
// this is false.
|
369 |
+
d.alignWidgets = false
|
370 |
+
|
371 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
|
372 |
+
|
373 |
+
// Tracks the maximum line length so that the horizontal scrollbar
|
374 |
+
// can be kept static when scrolling.
|
375 |
+
d.maxLine = null
|
376 |
+
d.maxLineLength = 0
|
377 |
+
d.maxLineChanged = false
|
378 |
+
|
379 |
+
// Used for measuring wheel scrolling granularity
|
380 |
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
|
381 |
+
|
382 |
+
// True when shift is held down.
|
383 |
+
d.shift = false
|
384 |
+
|
385 |
+
// Used to track whether anything happened since the context menu
|
386 |
+
// was opened.
|
387 |
+
d.selForContextMenu = null
|
388 |
+
|
389 |
+
d.activeTouch = null
|
390 |
+
|
391 |
+
input.init(d)
|
392 |
+
}
|
393 |
+
|
394 |
+
// Find the line object corresponding to the given line number.
|
395 |
+
function getLine(doc, n) {
|
396 |
+
n -= doc.first
|
397 |
+
if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
|
398 |
+
var chunk = doc
|
399 |
+
while (!chunk.lines) {
|
400 |
+
for (var i = 0;; ++i) {
|
401 |
+
var child = chunk.children[i], sz = child.chunkSize()
|
402 |
+
if (n < sz) { chunk = child; break }
|
403 |
+
n -= sz
|
404 |
+
}
|
405 |
+
}
|
406 |
+
return chunk.lines[n]
|
407 |
+
}
|
408 |
+
|
409 |
+
// Get the part of a document between two positions, as an array of
|
410 |
+
// strings.
|
411 |
+
function getBetween(doc, start, end) {
|
412 |
+
var out = [], n = start.line
|
413 |
+
doc.iter(start.line, end.line + 1, function (line) {
|
414 |
+
var text = line.text
|
415 |
+
if (n == end.line) { text = text.slice(0, end.ch) }
|
416 |
+
if (n == start.line) { text = text.slice(start.ch) }
|
417 |
+
out.push(text)
|
418 |
+
++n
|
419 |
+
})
|
420 |
+
return out
|
421 |
+
}
|
422 |
+
// Get the lines between from and to, as array of strings.
|
423 |
+
function getLines(doc, from, to) {
|
424 |
+
var out = []
|
425 |
+
doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value
|
426 |
+
return out
|
427 |
+
}
|
428 |
+
|
429 |
+
// Update the height of a line, propagating the height change
|
430 |
+
// upwards to parent nodes.
|
431 |
+
function updateLineHeight(line, height) {
|
432 |
+
var diff = height - line.height
|
433 |
+
if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }
|
434 |
+
}
|
435 |
+
|
436 |
+
// Given a line object, find its line number by walking up through
|
437 |
+
// its parent links.
|
438 |
+
function lineNo(line) {
|
439 |
+
if (line.parent == null) { return null }
|
440 |
+
var cur = line.parent, no = indexOf(cur.lines, line)
|
441 |
+
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
442 |
+
for (var i = 0;; ++i) {
|
443 |
+
if (chunk.children[i] == cur) { break }
|
444 |
+
no += chunk.children[i].chunkSize()
|
445 |
+
}
|
446 |
+
}
|
447 |
+
return no + cur.first
|
448 |
+
}
|
449 |
+
|
450 |
+
// Find the line at the given vertical position, using the height
|
451 |
+
// information in the document tree.
|
452 |
+
function lineAtHeight(chunk, h) {
|
453 |
+
var n = chunk.first
|
454 |
+
outer: do {
|
455 |
+
for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
|
456 |
+
var child = chunk.children[i$1], ch = child.height
|
457 |
+
if (h < ch) { chunk = child; continue outer }
|
458 |
+
h -= ch
|
459 |
+
n += child.chunkSize()
|
460 |
+
}
|
461 |
+
return n
|
462 |
+
} while (!chunk.lines)
|
463 |
+
var i = 0
|
464 |
+
for (; i < chunk.lines.length; ++i) {
|
465 |
+
var line = chunk.lines[i], lh = line.height
|
466 |
+
if (h < lh) { break }
|
467 |
+
h -= lh
|
468 |
+
}
|
469 |
+
return n + i
|
470 |
+
}
|
471 |
+
|
472 |
+
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
|
473 |
+
|
474 |
+
function lineNumberFor(options, i) {
|
475 |
+
return String(options.lineNumberFormatter(i + options.firstLineNumber))
|
476 |
+
}
|
477 |
+
|
478 |
+
// A Pos instance represents a position within the text.
|
479 |
+
function Pos(line, ch, sticky) {
|
480 |
+
if ( sticky === void 0 ) sticky = null;
|
481 |
+
|
482 |
+
if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
|
483 |
+
this.line = line
|
484 |
+
this.ch = ch
|
485 |
+
this.sticky = sticky
|
486 |
+
}
|
487 |
+
|
488 |
+
// Compare two positions, return 0 if they are the same, a negative
|
489 |
+
// number when a is less, and a positive number otherwise.
|
490 |
+
function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
|
491 |
+
|
492 |
+
function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
|
493 |
+
|
494 |
+
function copyPos(x) {return Pos(x.line, x.ch)}
|
495 |
+
function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
|
496 |
+
function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
|
497 |
+
|
498 |
+
// Most of the external API clips given positions to make sure they
|
499 |
+
// actually exist within the document.
|
500 |
+
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
|
501 |
+
function clipPos(doc, pos) {
|
502 |
+
if (pos.line < doc.first) { return Pos(doc.first, 0) }
|
503 |
+
var last = doc.first + doc.size - 1
|
504 |
+
if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
|
505 |
+
return clipToLen(pos, getLine(doc, pos.line).text.length)
|
506 |
+
}
|
507 |
+
function clipToLen(pos, linelen) {
|
508 |
+
var ch = pos.ch
|
509 |
+
if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
|
510 |
+
else if (ch < 0) { return Pos(pos.line, 0) }
|
511 |
+
else { return pos }
|
512 |
+
}
|
513 |
+
function clipPosArray(doc, array) {
|
514 |
+
var out = []
|
515 |
+
for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) }
|
516 |
+
return out
|
517 |
+
}
|
518 |
+
|
519 |
+
// Optimize some code when these features are not used.
|
520 |
+
var sawReadOnlySpans = false;
|
521 |
+
var sawCollapsedSpans = false;
|
522 |
+
function seeReadOnlySpans() {
|
523 |
+
sawReadOnlySpans = true
|
524 |
+
}
|
525 |
+
|
526 |
+
function seeCollapsedSpans() {
|
527 |
+
sawCollapsedSpans = true
|
528 |
+
}
|
529 |
+
|
530 |
+
// TEXTMARKER SPANS
|
531 |
+
|
532 |
+
function MarkedSpan(marker, from, to) {
|
533 |
+
this.marker = marker
|
534 |
+
this.from = from; this.to = to
|
535 |
+
}
|
536 |
+
|
537 |
+
// Search an array of spans for a span matching the given marker.
|
538 |
+
function getMarkedSpanFor(spans, marker) {
|
539 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
540 |
+
var span = spans[i]
|
541 |
+
if (span.marker == marker) { return span }
|
542 |
+
} }
|
543 |
+
}
|
544 |
+
// Remove a span from an array, returning undefined if no spans are
|
545 |
+
// left (we don't store arrays for lines without spans).
|
546 |
+
function removeMarkedSpan(spans, span) {
|
547 |
+
var r
|
548 |
+
for (var i = 0; i < spans.length; ++i)
|
549 |
+
{ if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }
|
550 |
+
return r
|
551 |
+
}
|
552 |
+
// Add a span to a line.
|
553 |
+
function addMarkedSpan(line, span) {
|
554 |
+
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]
|
555 |
+
span.marker.attachLine(line)
|
556 |
+
}
|
557 |
+
|
558 |
+
// Used for the algorithm that adjusts markers for a change in the
|
559 |
+
// document. These functions cut an array of spans at a given
|
560 |
+
// character position, returning an array of remaining chunks (or
|
561 |
+
// undefined if nothing remains).
|
562 |
+
function markedSpansBefore(old, startCh, isInsert) {
|
563 |
+
var nw
|
564 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
565 |
+
var span = old[i], marker = span.marker
|
566 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
|
567 |
+
if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
|
568 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
|
569 |
+
;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
|
570 |
+
}
|
571 |
+
} }
|
572 |
+
return nw
|
573 |
+
}
|
574 |
+
function markedSpansAfter(old, endCh, isInsert) {
|
575 |
+
var nw
|
576 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
577 |
+
var span = old[i], marker = span.marker
|
578 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
|
579 |
+
if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
|
580 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
|
581 |
+
;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
|
582 |
+
span.to == null ? null : span.to - endCh))
|
583 |
+
}
|
584 |
+
} }
|
585 |
+
return nw
|
586 |
+
}
|
587 |
+
|
588 |
+
// Given a change object, compute the new set of marker spans that
|
589 |
+
// cover the line in which the change took place. Removes spans
|
590 |
+
// entirely within the change, reconnects spans belonging to the
|
591 |
+
// same marker that appear on both sides of the change, and cuts off
|
592 |
+
// spans partially within the change. Returns an array of span
|
593 |
+
// arrays with one element for each line in (after) the change.
|
594 |
+
function stretchSpansOverChange(doc, change) {
|
595 |
+
if (change.full) { return null }
|
596 |
+
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
|
597 |
+
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
|
598 |
+
if (!oldFirst && !oldLast) { return null }
|
599 |
+
|
600 |
+
var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0
|
601 |
+
// Get the spans that 'stick out' on both sides
|
602 |
+
var first = markedSpansBefore(oldFirst, startCh, isInsert)
|
603 |
+
var last = markedSpansAfter(oldLast, endCh, isInsert)
|
604 |
+
|
605 |
+
// Next, merge those two ends
|
606 |
+
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0)
|
607 |
+
if (first) {
|
608 |
+
// Fix up .to properties of first
|
609 |
+
for (var i = 0; i < first.length; ++i) {
|
610 |
+
var span = first[i]
|
611 |
+
if (span.to == null) {
|
612 |
+
var found = getMarkedSpanFor(last, span.marker)
|
613 |
+
if (!found) { span.to = startCh }
|
614 |
+
else if (sameLine) { span.to = found.to == null ? null : found.to + offset }
|
615 |
+
}
|
616 |
+
}
|
617 |
+
}
|
618 |
+
if (last) {
|
619 |
+
// Fix up .from in last (or move them into first in case of sameLine)
|
620 |
+
for (var i$1 = 0; i$1 < last.length; ++i$1) {
|
621 |
+
var span$1 = last[i$1]
|
622 |
+
if (span$1.to != null) { span$1.to += offset }
|
623 |
+
if (span$1.from == null) {
|
624 |
+
var found$1 = getMarkedSpanFor(first, span$1.marker)
|
625 |
+
if (!found$1) {
|
626 |
+
span$1.from = offset
|
627 |
+
if (sameLine) { (first || (first = [])).push(span$1) }
|
628 |
+
}
|
629 |
+
} else {
|
630 |
+
span$1.from += offset
|
631 |
+
if (sameLine) { (first || (first = [])).push(span$1) }
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}
|
635 |
+
// Make sure we didn't create any zero-length spans
|
636 |
+
if (first) { first = clearEmptySpans(first) }
|
637 |
+
if (last && last != first) { last = clearEmptySpans(last) }
|
638 |
+
|
639 |
+
var newMarkers = [first]
|
640 |
+
if (!sameLine) {
|
641 |
+
// Fill gap with whole-line-spans
|
642 |
+
var gap = change.text.length - 2, gapMarkers
|
643 |
+
if (gap > 0 && first)
|
644 |
+
{ for (var i$2 = 0; i$2 < first.length; ++i$2)
|
645 |
+
{ if (first[i$2].to == null)
|
646 |
+
{ (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } }
|
647 |
+
for (var i$3 = 0; i$3 < gap; ++i$3)
|
648 |
+
{ newMarkers.push(gapMarkers) }
|
649 |
+
newMarkers.push(last)
|
650 |
+
}
|
651 |
+
return newMarkers
|
652 |
+
}
|
653 |
+
|
654 |
+
// Remove spans that are empty and don't have a clearWhenEmpty
|
655 |
+
// option of false.
|
656 |
+
function clearEmptySpans(spans) {
|
657 |
+
for (var i = 0; i < spans.length; ++i) {
|
658 |
+
var span = spans[i]
|
659 |
+
if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
|
660 |
+
{ spans.splice(i--, 1) }
|
661 |
+
}
|
662 |
+
if (!spans.length) { return null }
|
663 |
+
return spans
|
664 |
+
}
|
665 |
+
|
666 |
+
// Used to 'clip' out readOnly ranges when making a change.
|
667 |
+
function removeReadOnlyRanges(doc, from, to) {
|
668 |
+
var markers = null
|
669 |
+
doc.iter(from.line, to.line + 1, function (line) {
|
670 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
671 |
+
var mark = line.markedSpans[i].marker
|
672 |
+
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
673 |
+
{ (markers || (markers = [])).push(mark) }
|
674 |
+
} }
|
675 |
+
})
|
676 |
+
if (!markers) { return null }
|
677 |
+
var parts = [{from: from, to: to}]
|
678 |
+
for (var i = 0; i < markers.length; ++i) {
|
679 |
+
var mk = markers[i], m = mk.find(0)
|
680 |
+
for (var j = 0; j < parts.length; ++j) {
|
681 |
+
var p = parts[j]
|
682 |
+
if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
|
683 |
+
var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to)
|
684 |
+
if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
|
685 |
+
{ newParts.push({from: p.from, to: m.from}) }
|
686 |
+
if (dto > 0 || !mk.inclusiveRight && !dto)
|
687 |
+
{ newParts.push({from: m.to, to: p.to}) }
|
688 |
+
parts.splice.apply(parts, newParts)
|
689 |
+
j += newParts.length - 3
|
690 |
+
}
|
691 |
+
}
|
692 |
+
return parts
|
693 |
+
}
|
694 |
+
|
695 |
+
// Connect or disconnect spans from a line.
|
696 |
+
function detachMarkedSpans(line) {
|
697 |
+
var spans = line.markedSpans
|
698 |
+
if (!spans) { return }
|
699 |
+
for (var i = 0; i < spans.length; ++i)
|
700 |
+
{ spans[i].marker.detachLine(line) }
|
701 |
+
line.markedSpans = null
|
702 |
+
}
|
703 |
+
function attachMarkedSpans(line, spans) {
|
704 |
+
if (!spans) { return }
|
705 |
+
for (var i = 0; i < spans.length; ++i)
|
706 |
+
{ spans[i].marker.attachLine(line) }
|
707 |
+
line.markedSpans = spans
|
708 |
+
}
|
709 |
+
|
710 |
+
// Helpers used when computing which overlapping collapsed span
|
711 |
+
// counts as the larger one.
|
712 |
+
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
|
713 |
+
function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
|
714 |
+
|
715 |
+
// Returns a number indicating which of two overlapping collapsed
|
716 |
+
// spans is larger (and thus includes the other). Falls back to
|
717 |
+
// comparing ids when the spans cover exactly the same range.
|
718 |
+
function compareCollapsedMarkers(a, b) {
|
719 |
+
var lenDiff = a.lines.length - b.lines.length
|
720 |
+
if (lenDiff != 0) { return lenDiff }
|
721 |
+
var aPos = a.find(), bPos = b.find()
|
722 |
+
var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
|
723 |
+
if (fromCmp) { return -fromCmp }
|
724 |
+
var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
|
725 |
+
if (toCmp) { return toCmp }
|
726 |
+
return b.id - a.id
|
727 |
+
}
|
728 |
+
|
729 |
+
// Find out whether a line ends or starts in a collapsed span. If
|
730 |
+
// so, return the marker for that span.
|
731 |
+
function collapsedSpanAtSide(line, start) {
|
732 |
+
var sps = sawCollapsedSpans && line.markedSpans, found
|
733 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
734 |
+
sp = sps[i]
|
735 |
+
if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
|
736 |
+
(!found || compareCollapsedMarkers(found, sp.marker) < 0))
|
737 |
+
{ found = sp.marker }
|
738 |
+
} }
|
739 |
+
return found
|
740 |
+
}
|
741 |
+
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
|
742 |
+
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
|
743 |
+
|
744 |
+
// Test whether there exists a collapsed span that partially
|
745 |
+
// overlaps (covers the start or end, but not both) of a new span.
|
746 |
+
// Such overlap is not allowed.
|
747 |
+
function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
|
748 |
+
var line = getLine(doc, lineNo)
|
749 |
+
var sps = sawCollapsedSpans && line.markedSpans
|
750 |
+
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
751 |
+
var sp = sps[i]
|
752 |
+
if (!sp.marker.collapsed) { continue }
|
753 |
+
var found = sp.marker.find(0)
|
754 |
+
var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
|
755 |
+
var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
|
756 |
+
if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
|
757 |
+
if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
|
758 |
+
fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
|
759 |
+
{ return true }
|
760 |
+
} }
|
761 |
+
}
|
762 |
+
|
763 |
+
// A visual line is a line as drawn on the screen. Folding, for
|
764 |
+
// example, can cause multiple logical lines to appear on the same
|
765 |
+
// visual line. This finds the start of the visual line that the
|
766 |
+
// given line is part of (usually that is the line itself).
|
767 |
+
function visualLine(line) {
|
768 |
+
var merged
|
769 |
+
while (merged = collapsedSpanAtStart(line))
|
770 |
+
{ line = merged.find(-1, true).line }
|
771 |
+
return line
|
772 |
+
}
|
773 |
+
|
774 |
+
function visualLineEnd(line) {
|
775 |
+
var merged
|
776 |
+
while (merged = collapsedSpanAtEnd(line))
|
777 |
+
{ line = merged.find(1, true).line }
|
778 |
+
return line
|
779 |
+
}
|
780 |
+
|
781 |
+
// Returns an array of logical lines that continue the visual line
|
782 |
+
// started by the argument, or undefined if there are no such lines.
|
783 |
+
function visualLineContinued(line) {
|
784 |
+
var merged, lines
|
785 |
+
while (merged = collapsedSpanAtEnd(line)) {
|
786 |
+
line = merged.find(1, true).line
|
787 |
+
;(lines || (lines = [])).push(line)
|
788 |
+
}
|
789 |
+
return lines
|
790 |
+
}
|
791 |
+
|
792 |
+
// Get the line number of the start of the visual line that the
|
793 |
+
// given line number is part of.
|
794 |
+
function visualLineNo(doc, lineN) {
|
795 |
+
var line = getLine(doc, lineN), vis = visualLine(line)
|
796 |
+
if (line == vis) { return lineN }
|
797 |
+
return lineNo(vis)
|
798 |
+
}
|
799 |
+
|
800 |
+
// Get the line number of the start of the next visual line after
|
801 |
+
// the given line.
|
802 |
+
function visualLineEndNo(doc, lineN) {
|
803 |
+
if (lineN > doc.lastLine()) { return lineN }
|
804 |
+
var line = getLine(doc, lineN), merged
|
805 |
+
if (!lineIsHidden(doc, line)) { return lineN }
|
806 |
+
while (merged = collapsedSpanAtEnd(line))
|
807 |
+
{ line = merged.find(1, true).line }
|
808 |
+
return lineNo(line) + 1
|
809 |
+
}
|
810 |
+
|
811 |
+
// Compute whether a line is hidden. Lines count as hidden when they
|
812 |
+
// are part of a visual line that starts with another line, or when
|
813 |
+
// they are entirely covered by collapsed, non-widget span.
|
814 |
+
function lineIsHidden(doc, line) {
|
815 |
+
var sps = sawCollapsedSpans && line.markedSpans
|
816 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
817 |
+
sp = sps[i]
|
818 |
+
if (!sp.marker.collapsed) { continue }
|
819 |
+
if (sp.from == null) { return true }
|
820 |
+
if (sp.marker.widgetNode) { continue }
|
821 |
+
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
822 |
+
{ return true }
|
823 |
+
} }
|
824 |
+
}
|
825 |
+
function lineIsHiddenInner(doc, line, span) {
|
826 |
+
if (span.to == null) {
|
827 |
+
var end = span.marker.find(1, true)
|
828 |
+
return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
|
829 |
+
}
|
830 |
+
if (span.marker.inclusiveRight && span.to == line.text.length)
|
831 |
+
{ return true }
|
832 |
+
for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
|
833 |
+
sp = line.markedSpans[i]
|
834 |
+
if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
|
835 |
+
(sp.to == null || sp.to != span.from) &&
|
836 |
+
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
837 |
+
lineIsHiddenInner(doc, line, sp)) { return true }
|
838 |
+
}
|
839 |
+
}
|
840 |
+
|
841 |
+
// Find the height above the given line.
|
842 |
+
function heightAtLine(lineObj) {
|
843 |
+
lineObj = visualLine(lineObj)
|
844 |
+
|
845 |
+
var h = 0, chunk = lineObj.parent
|
846 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
847 |
+
var line = chunk.lines[i]
|
848 |
+
if (line == lineObj) { break }
|
849 |
+
else { h += line.height }
|
850 |
+
}
|
851 |
+
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
852 |
+
for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
|
853 |
+
var cur = p.children[i$1]
|
854 |
+
if (cur == chunk) { break }
|
855 |
+
else { h += cur.height }
|
856 |
+
}
|
857 |
+
}
|
858 |
+
return h
|
859 |
+
}
|
860 |
+
|
861 |
+
// Compute the character length of a line, taking into account
|
862 |
+
// collapsed ranges (see markText) that might hide parts, and join
|
863 |
+
// other lines onto it.
|
864 |
+
function lineLength(line) {
|
865 |
+
if (line.height == 0) { return 0 }
|
866 |
+
var len = line.text.length, merged, cur = line
|
867 |
+
while (merged = collapsedSpanAtStart(cur)) {
|
868 |
+
var found = merged.find(0, true)
|
869 |
+
cur = found.from.line
|
870 |
+
len += found.from.ch - found.to.ch
|
871 |
+
}
|
872 |
+
cur = line
|
873 |
+
while (merged = collapsedSpanAtEnd(cur)) {
|
874 |
+
var found$1 = merged.find(0, true)
|
875 |
+
len -= cur.text.length - found$1.from.ch
|
876 |
+
cur = found$1.to.line
|
877 |
+
len += cur.text.length - found$1.to.ch
|
878 |
+
}
|
879 |
+
return len
|
880 |
+
}
|
881 |
+
|
882 |
+
// Find the longest line in the document.
|
883 |
+
function findMaxLine(cm) {
|
884 |
+
var d = cm.display, doc = cm.doc
|
885 |
+
d.maxLine = getLine(doc, doc.first)
|
886 |
+
d.maxLineLength = lineLength(d.maxLine)
|
887 |
+
d.maxLineChanged = true
|
888 |
+
doc.iter(function (line) {
|
889 |
+
var len = lineLength(line)
|
890 |
+
if (len > d.maxLineLength) {
|
891 |
+
d.maxLineLength = len
|
892 |
+
d.maxLine = line
|
893 |
+
}
|
894 |
+
})
|
895 |
+
}
|
896 |
+
|
897 |
+
// BIDI HELPERS
|
898 |
+
|
899 |
+
function iterateBidiSections(order, from, to, f) {
|
900 |
+
if (!order) { return f(from, to, "ltr") }
|
901 |
+
var found = false
|
902 |
+
for (var i = 0; i < order.length; ++i) {
|
903 |
+
var part = order[i]
|
904 |
+
if (part.from < to && part.to > from || from == to && part.to == from) {
|
905 |
+
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr")
|
906 |
+
found = true
|
907 |
+
}
|
908 |
+
}
|
909 |
+
if (!found) { f(from, to, "ltr") }
|
910 |
+
}
|
911 |
+
|
912 |
+
var bidiOther = null
|
913 |
+
function getBidiPartAt(order, ch, sticky) {
|
914 |
+
var found
|
915 |
+
bidiOther = null
|
916 |
+
for (var i = 0; i < order.length; ++i) {
|
917 |
+
var cur = order[i]
|
918 |
+
if (cur.from < ch && cur.to > ch) { return i }
|
919 |
+
if (cur.to == ch) {
|
920 |
+
if (cur.from != cur.to && sticky == "before") { found = i }
|
921 |
+
else { bidiOther = i }
|
922 |
+
}
|
923 |
+
if (cur.from == ch) {
|
924 |
+
if (cur.from != cur.to && sticky != "before") { found = i }
|
925 |
+
else { bidiOther = i }
|
926 |
+
}
|
927 |
+
}
|
928 |
+
return found != null ? found : bidiOther
|
929 |
+
}
|
930 |
+
|
931 |
+
// Bidirectional ordering algorithm
|
932 |
+
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
933 |
+
// that this (partially) implements.
|
934 |
+
|
935 |
+
// One-char codes used for character types:
|
936 |
+
// L (L): Left-to-Right
|
937 |
+
// R (R): Right-to-Left
|
938 |
+
// r (AL): Right-to-Left Arabic
|
939 |
+
// 1 (EN): European Number
|
940 |
+
// + (ES): European Number Separator
|
941 |
+
// % (ET): European Number Terminator
|
942 |
+
// n (AN): Arabic Number
|
943 |
+
// , (CS): Common Number Separator
|
944 |
+
// m (NSM): Non-Spacing Mark
|
945 |
+
// b (BN): Boundary Neutral
|
946 |
+
// s (B): Paragraph Separator
|
947 |
+
// t (S): Segment Separator
|
948 |
+
// w (WS): Whitespace
|
949 |
+
// N (ON): Other Neutrals
|
950 |
+
|
951 |
+
// Returns null if characters are ordered as they appear
|
952 |
+
// (left-to-right), or an array of sections ({from, to, level}
|
953 |
+
// objects) in the order in which they occur visually.
|
954 |
+
var bidiOrdering = (function() {
|
955 |
+
// Character types for codepoints 0 to 0xff
|
956 |
+
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
|
957 |
+
// Character types for codepoints 0x600 to 0x6f9
|
958 |
+
var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
|
959 |
+
function charType(code) {
|
960 |
+
if (code <= 0xf7) { return lowTypes.charAt(code) }
|
961 |
+
else if (0x590 <= code && code <= 0x5f4) { return "R" }
|
962 |
+
else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
|
963 |
+
else if (0x6ee <= code && code <= 0x8ac) { return "r" }
|
964 |
+
else if (0x2000 <= code && code <= 0x200b) { return "w" }
|
965 |
+
else if (code == 0x200c) { return "b" }
|
966 |
+
else { return "L" }
|
967 |
+
}
|
968 |
+
|
969 |
+
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
|
970 |
+
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
|
971 |
+
|
972 |
+
function BidiSpan(level, from, to) {
|
973 |
+
this.level = level
|
974 |
+
this.from = from; this.to = to
|
975 |
+
}
|
976 |
+
|
977 |
+
return function(str, direction) {
|
978 |
+
var outerType = direction == "ltr" ? "L" : "R"
|
979 |
+
|
980 |
+
if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
|
981 |
+
var len = str.length, types = []
|
982 |
+
for (var i = 0; i < len; ++i)
|
983 |
+
{ types.push(charType(str.charCodeAt(i))) }
|
984 |
+
|
985 |
+
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
986 |
+
// change the type of the NSM to the type of the previous
|
987 |
+
// character. If the NSM is at the start of the level run, it will
|
988 |
+
// get the type of sor.
|
989 |
+
for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
|
990 |
+
var type = types[i$1]
|
991 |
+
if (type == "m") { types[i$1] = prev }
|
992 |
+
else { prev = type }
|
993 |
+
}
|
994 |
+
|
995 |
+
// W2. Search backwards from each instance of a European number
|
996 |
+
// until the first strong type (R, L, AL, or sor) is found. If an
|
997 |
+
// AL is found, change the type of the European number to Arabic
|
998 |
+
// number.
|
999 |
+
// W3. Change all ALs to R.
|
1000 |
+
for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
|
1001 |
+
var type$1 = types[i$2]
|
1002 |
+
if (type$1 == "1" && cur == "r") { types[i$2] = "n" }
|
1003 |
+
else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } }
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
// W4. A single European separator between two European numbers
|
1007 |
+
// changes to a European number. A single common separator between
|
1008 |
+
// two numbers of the same type changes to that type.
|
1009 |
+
for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
|
1010 |
+
var type$2 = types[i$3]
|
1011 |
+
if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" }
|
1012 |
+
else if (type$2 == "," && prev$1 == types[i$3+1] &&
|
1013 |
+
(prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 }
|
1014 |
+
prev$1 = type$2
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
// W5. A sequence of European terminators adjacent to European
|
1018 |
+
// numbers changes to all European numbers.
|
1019 |
+
// W6. Otherwise, separators and terminators change to Other
|
1020 |
+
// Neutral.
|
1021 |
+
for (var i$4 = 0; i$4 < len; ++i$4) {
|
1022 |
+
var type$3 = types[i$4]
|
1023 |
+
if (type$3 == ",") { types[i$4] = "N" }
|
1024 |
+
else if (type$3 == "%") {
|
1025 |
+
var end = (void 0)
|
1026 |
+
for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
|
1027 |
+
var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
|
1028 |
+
for (var j = i$4; j < end; ++j) { types[j] = replace }
|
1029 |
+
i$4 = end - 1
|
1030 |
+
}
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
// W7. Search backwards from each instance of a European number
|
1034 |
+
// until the first strong type (R, L, or sor) is found. If an L is
|
1035 |
+
// found, then change the type of the European number to L.
|
1036 |
+
for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
|
1037 |
+
var type$4 = types[i$5]
|
1038 |
+
if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" }
|
1039 |
+
else if (isStrong.test(type$4)) { cur$1 = type$4 }
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
// N1. A sequence of neutrals takes the direction of the
|
1043 |
+
// surrounding strong text if the text on both sides has the same
|
1044 |
+
// direction. European and Arabic numbers act as if they were R in
|
1045 |
+
// terms of their influence on neutrals. Start-of-level-run (sor)
|
1046 |
+
// and end-of-level-run (eor) are used at level run boundaries.
|
1047 |
+
// N2. Any remaining neutrals take the embedding direction.
|
1048 |
+
for (var i$6 = 0; i$6 < len; ++i$6) {
|
1049 |
+
if (isNeutral.test(types[i$6])) {
|
1050 |
+
var end$1 = (void 0)
|
1051 |
+
for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
|
1052 |
+
var before = (i$6 ? types[i$6-1] : outerType) == "L"
|
1053 |
+
var after = (end$1 < len ? types[end$1] : outerType) == "L"
|
1054 |
+
var replace$1 = before == after ? (before ? "L" : "R") : outerType
|
1055 |
+
for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 }
|
1056 |
+
i$6 = end$1 - 1
|
1057 |
+
}
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
// Here we depart from the documented algorithm, in order to avoid
|
1061 |
+
// building up an actual levels array. Since there are only three
|
1062 |
+
// levels (0, 1, 2) in an implementation that doesn't take
|
1063 |
+
// explicit embedding into account, we can build up the order on
|
1064 |
+
// the fly, without following the level-based algorithm.
|
1065 |
+
var order = [], m
|
1066 |
+
for (var i$7 = 0; i$7 < len;) {
|
1067 |
+
if (countsAsLeft.test(types[i$7])) {
|
1068 |
+
var start = i$7
|
1069 |
+
for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
|
1070 |
+
order.push(new BidiSpan(0, start, i$7))
|
1071 |
+
} else {
|
1072 |
+
var pos = i$7, at = order.length
|
1073 |
+
for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
|
1074 |
+
for (var j$2 = pos; j$2 < i$7;) {
|
1075 |
+
if (countsAsNum.test(types[j$2])) {
|
1076 |
+
if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) }
|
1077 |
+
var nstart = j$2
|
1078 |
+
for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
|
1079 |
+
order.splice(at, 0, new BidiSpan(2, nstart, j$2))
|
1080 |
+
pos = j$2
|
1081 |
+
} else { ++j$2 }
|
1082 |
+
}
|
1083 |
+
if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) }
|
1084 |
+
}
|
1085 |
+
}
|
1086 |
+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
1087 |
+
order[0].from = m[0].length
|
1088 |
+
order.unshift(new BidiSpan(0, 0, m[0].length))
|
1089 |
+
}
|
1090 |
+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
1091 |
+
lst(order).to -= m[0].length
|
1092 |
+
order.push(new BidiSpan(0, len - m[0].length, len))
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
return direction == "rtl" ? order.reverse() : order
|
1096 |
+
}
|
1097 |
+
})()
|
1098 |
+
|
1099 |
+
// Get the bidi ordering for the given line (and cache it). Returns
|
1100 |
+
// false for lines that are fully left-to-right, and an array of
|
1101 |
+
// BidiSpan objects otherwise.
|
1102 |
+
function getOrder(line, direction) {
|
1103 |
+
var order = line.order
|
1104 |
+
if (order == null) { order = line.order = bidiOrdering(line.text, direction) }
|
1105 |
+
return order
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
function moveCharLogically(line, ch, dir) {
|
1109 |
+
var target = skipExtendingChars(line.text, ch + dir, dir)
|
1110 |
+
return target < 0 || target > line.text.length ? null : target
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
function moveLogically(line, start, dir) {
|
1114 |
+
var ch = moveCharLogically(line, start.ch, dir)
|
1115 |
+
return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
function endOfLine(visually, cm, lineObj, lineNo, dir) {
|
1119 |
+
if (visually) {
|
1120 |
+
var order = getOrder(lineObj, cm.doc.direction)
|
1121 |
+
if (order) {
|
1122 |
+
var part = dir < 0 ? lst(order) : order[0]
|
1123 |
+
var moveInStorageOrder = (dir < 0) == (part.level == 1)
|
1124 |
+
var sticky = moveInStorageOrder ? "after" : "before"
|
1125 |
+
var ch
|
1126 |
+
// With a wrapped rtl chunk (possibly spanning multiple bidi parts),
|
1127 |
+
// it could be that the last bidi part is not on the last visual line,
|
1128 |
+
// since visual lines contain content order-consecutive chunks.
|
1129 |
+
// Thus, in rtl, we are looking for the first (content-order) character
|
1130 |
+
// in the rtl chunk that is on the last line (that is, the same line
|
1131 |
+
// as the last (content-order) character).
|
1132 |
+
if (part.level > 0) {
|
1133 |
+
var prep = prepareMeasureForLine(cm, lineObj)
|
1134 |
+
ch = dir < 0 ? lineObj.text.length - 1 : 0
|
1135 |
+
var targetTop = measureCharPrepared(cm, prep, ch).top
|
1136 |
+
ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch)
|
1137 |
+
if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1) }
|
1138 |
+
} else { ch = dir < 0 ? part.to : part.from }
|
1139 |
+
return new Pos(lineNo, ch, sticky)
|
1140 |
+
}
|
1141 |
+
}
|
1142 |
+
return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
function moveVisually(cm, line, start, dir) {
|
1146 |
+
var bidi = getOrder(line, cm.doc.direction)
|
1147 |
+
if (!bidi) { return moveLogically(line, start, dir) }
|
1148 |
+
if (start.ch >= line.text.length) {
|
1149 |
+
start.ch = line.text.length
|
1150 |
+
start.sticky = "before"
|
1151 |
+
} else if (start.ch <= 0) {
|
1152 |
+
start.ch = 0
|
1153 |
+
start.sticky = "after"
|
1154 |
+
}
|
1155 |
+
var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]
|
1156 |
+
if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
|
1157 |
+
// Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
|
1158 |
+
// nothing interesting happens.
|
1159 |
+
return moveLogically(line, start, dir)
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }
|
1163 |
+
var prep
|
1164 |
+
var getWrappedLineExtent = function (ch) {
|
1165 |
+
if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
|
1166 |
+
prep = prep || prepareMeasureForLine(cm, line)
|
1167 |
+
return wrappedLineExtentChar(cm, line, prep, ch)
|
1168 |
+
}
|
1169 |
+
var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch)
|
1170 |
+
|
1171 |
+
if (cm.doc.direction == "rtl" || part.level == 1) {
|
1172 |
+
var moveInStorageOrder = (part.level == 1) == (dir < 0)
|
1173 |
+
var ch = mv(start, moveInStorageOrder ? 1 : -1)
|
1174 |
+
if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
|
1175 |
+
// Case 2: We move within an rtl part or in an rtl editor on the same visual line
|
1176 |
+
var sticky = moveInStorageOrder ? "before" : "after"
|
1177 |
+
return new Pos(start.line, ch, sticky)
|
1178 |
+
}
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
// Case 3: Could not move within this bidi part in this visual line, so leave
|
1182 |
+
// the current bidi part
|
1183 |
+
|
1184 |
+
var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
|
1185 |
+
var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
|
1186 |
+
? new Pos(start.line, mv(ch, 1), "before")
|
1187 |
+
: new Pos(start.line, ch, "after"); }
|
1188 |
+
|
1189 |
+
for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
|
1190 |
+
var part = bidi[partPos]
|
1191 |
+
var moveInStorageOrder = (dir > 0) == (part.level != 1)
|
1192 |
+
var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1)
|
1193 |
+
if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
|
1194 |
+
ch = moveInStorageOrder ? part.from : mv(part.to, -1)
|
1195 |
+
if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
// Case 3a: Look for other bidi parts on the same visual line
|
1200 |
+
var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)
|
1201 |
+
if (res) { return res }
|
1202 |
+
|
1203 |
+
// Case 3b: Look for other bidi parts on the next visual line
|
1204 |
+
var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)
|
1205 |
+
if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
|
1206 |
+
res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh))
|
1207 |
+
if (res) { return res }
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
// Case 4: Nowhere to move
|
1211 |
+
return null
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
// EVENT HANDLING
|
1215 |
+
|
1216 |
+
// Lightweight event framework. on/off also work on DOM nodes,
|
1217 |
+
// registering native DOM handlers.
|
1218 |
+
|
1219 |
+
var noHandlers = []
|
1220 |
+
|
1221 |
+
var on = function(emitter, type, f) {
|
1222 |
+
if (emitter.addEventListener) {
|
1223 |
+
emitter.addEventListener(type, f, false)
|
1224 |
+
} else if (emitter.attachEvent) {
|
1225 |
+
emitter.attachEvent("on" + type, f)
|
1226 |
+
} else {
|
1227 |
+
var map = emitter._handlers || (emitter._handlers = {})
|
1228 |
+
map[type] = (map[type] || noHandlers).concat(f)
|
1229 |
+
}
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
function getHandlers(emitter, type) {
|
1233 |
+
return emitter._handlers && emitter._handlers[type] || noHandlers
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
function off(emitter, type, f) {
|
1237 |
+
if (emitter.removeEventListener) {
|
1238 |
+
emitter.removeEventListener(type, f, false)
|
1239 |
+
} else if (emitter.detachEvent) {
|
1240 |
+
emitter.detachEvent("on" + type, f)
|
1241 |
+
} else {
|
1242 |
+
var map = emitter._handlers, arr = map && map[type]
|
1243 |
+
if (arr) {
|
1244 |
+
var index = indexOf(arr, f)
|
1245 |
+
if (index > -1)
|
1246 |
+
{ map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) }
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
function signal(emitter, type /*, values...*/) {
|
1252 |
+
var handlers = getHandlers(emitter, type)
|
1253 |
+
if (!handlers.length) { return }
|
1254 |
+
var args = Array.prototype.slice.call(arguments, 2)
|
1255 |
+
for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) }
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
// The DOM events that CodeMirror handles can be overridden by
|
1259 |
+
// registering a (non-DOM) handler on the editor for the event name,
|
1260 |
+
// and preventDefault-ing the event in that handler.
|
1261 |
+
function signalDOMEvent(cm, e, override) {
|
1262 |
+
if (typeof e == "string")
|
1263 |
+
{ e = {type: e, preventDefault: function() { this.defaultPrevented = true }} }
|
1264 |
+
signal(cm, override || e.type, cm, e)
|
1265 |
+
return e_defaultPrevented(e) || e.codemirrorIgnore
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
function signalCursorActivity(cm) {
|
1269 |
+
var arr = cm._handlers && cm._handlers.cursorActivity
|
1270 |
+
if (!arr) { return }
|
1271 |
+
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
|
1272 |
+
for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
|
1273 |
+
{ set.push(arr[i]) } }
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
function hasHandler(emitter, type) {
|
1277 |
+
return getHandlers(emitter, type).length > 0
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
// Add on and off methods to a constructor's prototype, to make
|
1281 |
+
// registering events on such objects more convenient.
|
1282 |
+
function eventMixin(ctor) {
|
1283 |
+
ctor.prototype.on = function(type, f) {on(this, type, f)}
|
1284 |
+
ctor.prototype.off = function(type, f) {off(this, type, f)}
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
// Due to the fact that we still support jurassic IE versions, some
|
1288 |
+
// compatibility wrappers are needed.
|
1289 |
+
|
1290 |
+
function e_preventDefault(e) {
|
1291 |
+
if (e.preventDefault) { e.preventDefault() }
|
1292 |
+
else { e.returnValue = false }
|
1293 |
+
}
|
1294 |
+
function e_stopPropagation(e) {
|
1295 |
+
if (e.stopPropagation) { e.stopPropagation() }
|
1296 |
+
else { e.cancelBubble = true }
|
1297 |
+
}
|
1298 |
+
function e_defaultPrevented(e) {
|
1299 |
+
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
|
1300 |
+
}
|
1301 |
+
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
|
1302 |
+
|
1303 |
+
function e_target(e) {return e.target || e.srcElement}
|
1304 |
+
function e_button(e) {
|
1305 |
+
var b = e.which
|
1306 |
+
if (b == null) {
|
1307 |
+
if (e.button & 1) { b = 1 }
|
1308 |
+
else if (e.button & 2) { b = 3 }
|
1309 |
+
else if (e.button & 4) { b = 2 }
|
1310 |
+
}
|
1311 |
+
if (mac && e.ctrlKey && b == 1) { b = 3 }
|
1312 |
+
return b
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
// Detect drag-and-drop
|
1316 |
+
var dragAndDrop = function() {
|
1317 |
+
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
1318 |
+
// couldn't get it to work yet.
|
1319 |
+
if (ie && ie_version < 9) { return false }
|
1320 |
+
var div = elt('div')
|
1321 |
+
return "draggable" in div || "dragDrop" in div
|
1322 |
+
}()
|
1323 |
+
|
1324 |
+
var zwspSupported
|
1325 |
+
function zeroWidthElement(measure) {
|
1326 |
+
if (zwspSupported == null) {
|
1327 |
+
var test = elt("span", "\u200b")
|
1328 |
+
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
|
1329 |
+
if (measure.firstChild.offsetHeight != 0)
|
1330 |
+
{ zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) }
|
1331 |
+
}
|
1332 |
+
var node = zwspSupported ? elt("span", "\u200b") :
|
1333 |
+
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
|
1334 |
+
node.setAttribute("cm-text", "")
|
1335 |
+
return node
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
// Feature-detect IE's crummy client rect reporting for bidi text
|
1339 |
+
var badBidiRects
|
1340 |
+
function hasBadBidiRects(measure) {
|
1341 |
+
if (badBidiRects != null) { return badBidiRects }
|
1342 |
+
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
|
1343 |
+
var r0 = range(txt, 0, 1).getBoundingClientRect()
|
1344 |
+
var r1 = range(txt, 1, 2).getBoundingClientRect()
|
1345 |
+
removeChildren(measure)
|
1346 |
+
if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
|
1347 |
+
return badBidiRects = (r1.right - r0.right < 3)
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
// See if "".split is the broken IE version, if so, provide an
|
1351 |
+
// alternative way to split lines.
|
1352 |
+
var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
|
1353 |
+
var pos = 0, result = [], l = string.length
|
1354 |
+
while (pos <= l) {
|
1355 |
+
var nl = string.indexOf("\n", pos)
|
1356 |
+
if (nl == -1) { nl = string.length }
|
1357 |
+
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
|
1358 |
+
var rt = line.indexOf("\r")
|
1359 |
+
if (rt != -1) {
|
1360 |
+
result.push(line.slice(0, rt))
|
1361 |
+
pos += rt + 1
|
1362 |
+
} else {
|
1363 |
+
result.push(line)
|
1364 |
+
pos = nl + 1
|
1365 |
+
}
|
1366 |
+
}
|
1367 |
+
return result
|
1368 |
+
} : function (string) { return string.split(/\r\n?|\n/); }
|
1369 |
+
|
1370 |
+
var hasSelection = window.getSelection ? function (te) {
|
1371 |
+
try { return te.selectionStart != te.selectionEnd }
|
1372 |
+
catch(e) { return false }
|
1373 |
+
} : function (te) {
|
1374 |
+
var range
|
1375 |
+
try {range = te.ownerDocument.selection.createRange()}
|
1376 |
+
catch(e) {}
|
1377 |
+
if (!range || range.parentElement() != te) { return false }
|
1378 |
+
return range.compareEndPoints("StartToEnd", range) != 0
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
var hasCopyEvent = (function () {
|
1382 |
+
var e = elt("div")
|
1383 |
+
if ("oncopy" in e) { return true }
|
1384 |
+
e.setAttribute("oncopy", "return;")
|
1385 |
+
return typeof e.oncopy == "function"
|
1386 |
+
})()
|
1387 |
+
|
1388 |
+
var badZoomedRects = null
|
1389 |
+
function hasBadZoomedRects(measure) {
|
1390 |
+
if (badZoomedRects != null) { return badZoomedRects }
|
1391 |
+
var node = removeChildrenAndAdd(measure, elt("span", "x"))
|
1392 |
+
var normal = node.getBoundingClientRect()
|
1393 |
+
var fromRange = range(node, 0, 1).getBoundingClientRect()
|
1394 |
+
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
var modes = {};
|
1398 |
+
var mimeModes = {};
|
1399 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
1400 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
1401 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
1402 |
+
function defineMode(name, mode) {
|
1403 |
+
if (arguments.length > 2)
|
1404 |
+
{ mode.dependencies = Array.prototype.slice.call(arguments, 2) }
|
1405 |
+
modes[name] = mode
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
function defineMIME(mime, spec) {
|
1409 |
+
mimeModes[mime] = spec
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
// Given a MIME type, a {name, ...options} config object, or a name
|
1413 |
+
// string, return a mode config object.
|
1414 |
+
function resolveMode(spec) {
|
1415 |
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
1416 |
+
spec = mimeModes[spec]
|
1417 |
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
1418 |
+
var found = mimeModes[spec.name]
|
1419 |
+
if (typeof found == "string") { found = {name: found} }
|
1420 |
+
spec = createObj(found, spec)
|
1421 |
+
spec.name = found.name
|
1422 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
1423 |
+
return resolveMode("application/xml")
|
1424 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
|
1425 |
+
return resolveMode("application/json")
|
1426 |
+
}
|
1427 |
+
if (typeof spec == "string") { return {name: spec} }
|
1428 |
+
else { return spec || {name: "null"} }
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
// Given a mode spec (anything that resolveMode accepts), find and
|
1432 |
+
// initialize an actual mode object.
|
1433 |
+
function getMode(options, spec) {
|
1434 |
+
spec = resolveMode(spec)
|
1435 |
+
var mfactory = modes[spec.name]
|
1436 |
+
if (!mfactory) { return getMode(options, "text/plain") }
|
1437 |
+
var modeObj = mfactory(options, spec)
|
1438 |
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
1439 |
+
var exts = modeExtensions[spec.name]
|
1440 |
+
for (var prop in exts) {
|
1441 |
+
if (!exts.hasOwnProperty(prop)) { continue }
|
1442 |
+
if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] }
|
1443 |
+
modeObj[prop] = exts[prop]
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
modeObj.name = spec.name
|
1447 |
+
if (spec.helperType) { modeObj.helperType = spec.helperType }
|
1448 |
+
if (spec.modeProps) { for (var prop$1 in spec.modeProps)
|
1449 |
+
{ modeObj[prop$1] = spec.modeProps[prop$1] } }
|
1450 |
+
|
1451 |
+
return modeObj
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
// This can be used to attach properties to mode objects from
|
1455 |
+
// outside the actual mode definition.
|
1456 |
+
var modeExtensions = {}
|
1457 |
+
function extendMode(mode, properties) {
|
1458 |
+
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
|
1459 |
+
copyObj(properties, exts)
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
function copyState(mode, state) {
|
1463 |
+
if (state === true) { return state }
|
1464 |
+
if (mode.copyState) { return mode.copyState(state) }
|
1465 |
+
var nstate = {}
|
1466 |
+
for (var n in state) {
|
1467 |
+
var val = state[n]
|
1468 |
+
if (val instanceof Array) { val = val.concat([]) }
|
1469 |
+
nstate[n] = val
|
1470 |
+
}
|
1471 |
+
return nstate
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
// Given a mode and a state (for that mode), find the inner mode and
|
1475 |
+
// state at the position that the state refers to.
|
1476 |
+
function innerMode(mode, state) {
|
1477 |
+
var info
|
1478 |
+
while (mode.innerMode) {
|
1479 |
+
info = mode.innerMode(state)
|
1480 |
+
if (!info || info.mode == mode) { break }
|
1481 |
+
state = info.state
|
1482 |
+
mode = info.mode
|
1483 |
+
}
|
1484 |
+
return info || {mode: mode, state: state}
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
function startState(mode, a1, a2) {
|
1488 |
+
return mode.startState ? mode.startState(a1, a2) : true
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
// STRING STREAM
|
1492 |
+
|
1493 |
+
// Fed to the mode parsers, provides helper functions to make
|
1494 |
+
// parsers more succinct.
|
1495 |
+
|
1496 |
+
var StringStream = function(string, tabSize) {
|
1497 |
+
this.pos = this.start = 0
|
1498 |
+
this.string = string
|
1499 |
+
this.tabSize = tabSize || 8
|
1500 |
+
this.lastColumnPos = this.lastColumnValue = 0
|
1501 |
+
this.lineStart = 0
|
1502 |
+
};
|
1503 |
+
|
1504 |
+
StringStream.prototype.eol = function () {return this.pos >= this.string.length};
|
1505 |
+
StringStream.prototype.sol = function () {return this.pos == this.lineStart};
|
1506 |
+
StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
|
1507 |
+
StringStream.prototype.next = function () {
|
1508 |
+
if (this.pos < this.string.length)
|
1509 |
+
{ return this.string.charAt(this.pos++) }
|
1510 |
+
};
|
1511 |
+
StringStream.prototype.eat = function (match) {
|
1512 |
+
var ch = this.string.charAt(this.pos)
|
1513 |
+
var ok
|
1514 |
+
if (typeof match == "string") { ok = ch == match }
|
1515 |
+
else { ok = ch && (match.test ? match.test(ch) : match(ch)) }
|
1516 |
+
if (ok) {++this.pos; return ch}
|
1517 |
+
};
|
1518 |
+
StringStream.prototype.eatWhile = function (match) {
|
1519 |
+
var start = this.pos
|
1520 |
+
while (this.eat(match)){}
|
1521 |
+
return this.pos > start
|
1522 |
+
};
|
1523 |
+
StringStream.prototype.eatSpace = function () {
|
1524 |
+
var this$1 = this;
|
1525 |
+
|
1526 |
+
var start = this.pos
|
1527 |
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos }
|
1528 |
+
return this.pos > start
|
1529 |
+
};
|
1530 |
+
StringStream.prototype.skipToEnd = function () {this.pos = this.string.length};
|
1531 |
+
StringStream.prototype.skipTo = function (ch) {
|
1532 |
+
var found = this.string.indexOf(ch, this.pos)
|
1533 |
+
if (found > -1) {this.pos = found; return true}
|
1534 |
+
};
|
1535 |
+
StringStream.prototype.backUp = function (n) {this.pos -= n};
|
1536 |
+
StringStream.prototype.column = function () {
|
1537 |
+
if (this.lastColumnPos < this.start) {
|
1538 |
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
|
1539 |
+
this.lastColumnPos = this.start
|
1540 |
+
}
|
1541 |
+
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1542 |
+
};
|
1543 |
+
StringStream.prototype.indentation = function () {
|
1544 |
+
return countColumn(this.string, null, this.tabSize) -
|
1545 |
+
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1546 |
+
};
|
1547 |
+
StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
|
1548 |
+
if (typeof pattern == "string") {
|
1549 |
+
var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }
|
1550 |
+
var substr = this.string.substr(this.pos, pattern.length)
|
1551 |
+
if (cased(substr) == cased(pattern)) {
|
1552 |
+
if (consume !== false) { this.pos += pattern.length }
|
1553 |
+
return true
|
1554 |
+
}
|
1555 |
+
} else {
|
1556 |
+
var match = this.string.slice(this.pos).match(pattern)
|
1557 |
+
if (match && match.index > 0) { return null }
|
1558 |
+
if (match && consume !== false) { this.pos += match[0].length }
|
1559 |
+
return match
|
1560 |
+
}
|
1561 |
+
};
|
1562 |
+
StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
|
1563 |
+
StringStream.prototype.hideFirstChars = function (n, inner) {
|
1564 |
+
this.lineStart += n
|
1565 |
+
try { return inner() }
|
1566 |
+
finally { this.lineStart -= n }
|
1567 |
+
};
|
1568 |
+
|
1569 |
+
// Compute a style array (an array starting with a mode generation
|
1570 |
+
// -- for invalidation -- followed by pairs of end positions and
|
1571 |
+
// style strings), which is used to highlight the tokens on the
|
1572 |
+
// line.
|
1573 |
+
function highlightLine(cm, line, state, forceToEnd) {
|
1574 |
+
// A styles array always starts with a number identifying the
|
1575 |
+
// mode/overlays that it is based on (for easy invalidation).
|
1576 |
+
var st = [cm.state.modeGen], lineClasses = {}
|
1577 |
+
// Compute the base array of styles
|
1578 |
+
runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
|
1579 |
+
lineClasses, forceToEnd)
|
1580 |
+
|
1581 |
+
// Run overlays, adjust style array.
|
1582 |
+
var loop = function ( o ) {
|
1583 |
+
var overlay = cm.state.overlays[o], i = 1, at = 0
|
1584 |
+
runMode(cm, line.text, overlay.mode, true, function (end, style) {
|
1585 |
+
var start = i
|
1586 |
+
// Ensure there's a token end at the current position, and that i points at it
|
1587 |
+
while (at < end) {
|
1588 |
+
var i_end = st[i]
|
1589 |
+
if (i_end > end)
|
1590 |
+
{ st.splice(i, 1, end, st[i+1], i_end) }
|
1591 |
+
i += 2
|
1592 |
+
at = Math.min(end, i_end)
|
1593 |
+
}
|
1594 |
+
if (!style) { return }
|
1595 |
+
if (overlay.opaque) {
|
1596 |
+
st.splice(start, i - start, end, "overlay " + style)
|
1597 |
+
i = start + 2
|
1598 |
+
} else {
|
1599 |
+
for (; start < i; start += 2) {
|
1600 |
+
var cur = st[start+1]
|
1601 |
+
st[start+1] = (cur ? cur + " " : "") + "overlay " + style
|
1602 |
+
}
|
1603 |
+
}
|
1604 |
+
}, lineClasses)
|
1605 |
+
};
|
1606 |
+
|
1607 |
+
for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
|
1608 |
+
|
1609 |
+
return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
|
1610 |
+
}
|
1611 |
+
|
1612 |
+
function getLineStyles(cm, line, updateFrontier) {
|
1613 |
+
if (!line.styles || line.styles[0] != cm.state.modeGen) {
|
1614 |
+
var state = getStateBefore(cm, lineNo(line))
|
1615 |
+
var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state)
|
1616 |
+
line.stateAfter = state
|
1617 |
+
line.styles = result.styles
|
1618 |
+
if (result.classes) { line.styleClasses = result.classes }
|
1619 |
+
else if (line.styleClasses) { line.styleClasses = null }
|
1620 |
+
if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++ }
|
1621 |
+
}
|
1622 |
+
return line.styles
|
1623 |
+
}
|
1624 |
+
|
1625 |
+
function getStateBefore(cm, n, precise) {
|
1626 |
+
var doc = cm.doc, display = cm.display
|
1627 |
+
if (!doc.mode.startState) { return true }
|
1628 |
+
var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter
|
1629 |
+
if (!state) { state = startState(doc.mode) }
|
1630 |
+
else { state = copyState(doc.mode, state) }
|
1631 |
+
doc.iter(pos, n, function (line) {
|
1632 |
+
processLine(cm, line.text, state)
|
1633 |
+
var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo
|
1634 |
+
line.stateAfter = save ? copyState(doc.mode, state) : null
|
1635 |
+
++pos
|
1636 |
+
})
|
1637 |
+
if (precise) { doc.frontier = pos }
|
1638 |
+
return state
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
// Lightweight form of highlight -- proceed over this line and
|
1642 |
+
// update state, but don't save a style array. Used for lines that
|
1643 |
+
// aren't currently visible.
|
1644 |
+
function processLine(cm, text, state, startAt) {
|
1645 |
+
var mode = cm.doc.mode
|
1646 |
+
var stream = new StringStream(text, cm.options.tabSize)
|
1647 |
+
stream.start = stream.pos = startAt || 0
|
1648 |
+
if (text == "") { callBlankLine(mode, state) }
|
1649 |
+
while (!stream.eol()) {
|
1650 |
+
readToken(mode, stream, state)
|
1651 |
+
stream.start = stream.pos
|
1652 |
+
}
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
function callBlankLine(mode, state) {
|
1656 |
+
if (mode.blankLine) { return mode.blankLine(state) }
|
1657 |
+
if (!mode.innerMode) { return }
|
1658 |
+
var inner = innerMode(mode, state)
|
1659 |
+
if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
function readToken(mode, stream, state, inner) {
|
1663 |
+
for (var i = 0; i < 10; i++) {
|
1664 |
+
if (inner) { inner[0] = innerMode(mode, state).mode }
|
1665 |
+
var style = mode.token(stream, state)
|
1666 |
+
if (stream.pos > stream.start) { return style }
|
1667 |
+
}
|
1668 |
+
throw new Error("Mode " + mode.name + " failed to advance stream.")
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
// Utility for getTokenAt and getLineTokens
|
1672 |
+
function takeToken(cm, pos, precise, asArray) {
|
1673 |
+
var getObj = function (copy) { return ({
|
1674 |
+
start: stream.start, end: stream.pos,
|
1675 |
+
string: stream.current(),
|
1676 |
+
type: style || null,
|
1677 |
+
state: copy ? copyState(doc.mode, state) : state
|
1678 |
+
}); }
|
1679 |
+
|
1680 |
+
var doc = cm.doc, mode = doc.mode, style
|
1681 |
+
pos = clipPos(doc, pos)
|
1682 |
+
var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise)
|
1683 |
+
var stream = new StringStream(line.text, cm.options.tabSize), tokens
|
1684 |
+
if (asArray) { tokens = [] }
|
1685 |
+
while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
|
1686 |
+
stream.start = stream.pos
|
1687 |
+
style = readToken(mode, stream, state)
|
1688 |
+
if (asArray) { tokens.push(getObj(true)) }
|
1689 |
+
}
|
1690 |
+
return asArray ? tokens : getObj()
|
1691 |
+
}
|
1692 |
+
|
1693 |
+
function extractLineClasses(type, output) {
|
1694 |
+
if (type) { for (;;) {
|
1695 |
+
var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/)
|
1696 |
+
if (!lineClass) { break }
|
1697 |
+
type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length)
|
1698 |
+
var prop = lineClass[1] ? "bgClass" : "textClass"
|
1699 |
+
if (output[prop] == null)
|
1700 |
+
{ output[prop] = lineClass[2] }
|
1701 |
+
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
|
1702 |
+
{ output[prop] += " " + lineClass[2] }
|
1703 |
+
} }
|
1704 |
+
return type
|
1705 |
+
}
|
1706 |
+
|
1707 |
+
// Run the given mode's parser over a line, calling f for each token.
|
1708 |
+
function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
|
1709 |
+
var flattenSpans = mode.flattenSpans
|
1710 |
+
if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans }
|
1711 |
+
var curStart = 0, curStyle = null
|
1712 |
+
var stream = new StringStream(text, cm.options.tabSize), style
|
1713 |
+
var inner = cm.options.addModeClass && [null]
|
1714 |
+
if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses) }
|
1715 |
+
while (!stream.eol()) {
|
1716 |
+
if (stream.pos > cm.options.maxHighlightLength) {
|
1717 |
+
flattenSpans = false
|
1718 |
+
if (forceToEnd) { processLine(cm, text, state, stream.pos) }
|
1719 |
+
stream.pos = text.length
|
1720 |
+
style = null
|
1721 |
+
} else {
|
1722 |
+
style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses)
|
1723 |
+
}
|
1724 |
+
if (inner) {
|
1725 |
+
var mName = inner[0].name
|
1726 |
+
if (mName) { style = "m-" + (style ? mName + " " + style : mName) }
|
1727 |
+
}
|
1728 |
+
if (!flattenSpans || curStyle != style) {
|
1729 |
+
while (curStart < stream.start) {
|
1730 |
+
curStart = Math.min(stream.start, curStart + 5000)
|
1731 |
+
f(curStart, curStyle)
|
1732 |
+
}
|
1733 |
+
curStyle = style
|
1734 |
+
}
|
1735 |
+
stream.start = stream.pos
|
1736 |
+
}
|
1737 |
+
while (curStart < stream.pos) {
|
1738 |
+
// Webkit seems to refuse to render text nodes longer than 57444
|
1739 |
+
// characters, and returns inaccurate measurements in nodes
|
1740 |
+
// starting around 5000 chars.
|
1741 |
+
var pos = Math.min(stream.pos, curStart + 5000)
|
1742 |
+
f(pos, curStyle)
|
1743 |
+
curStart = pos
|
1744 |
+
}
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
// Finds the line to start with when starting a parse. Tries to
|
1748 |
+
// find a line with a stateAfter, so that it can start with a
|
1749 |
+
// valid state. If that fails, it returns the line with the
|
1750 |
+
// smallest indentation, which tends to need the least context to
|
1751 |
+
// parse correctly.
|
1752 |
+
function findStartLine(cm, n, precise) {
|
1753 |
+
var minindent, minline, doc = cm.doc
|
1754 |
+
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
|
1755 |
+
for (var search = n; search > lim; --search) {
|
1756 |
+
if (search <= doc.first) { return doc.first }
|
1757 |
+
var line = getLine(doc, search - 1)
|
1758 |
+
if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
|
1759 |
+
var indented = countColumn(line.text, null, cm.options.tabSize)
|
1760 |
+
if (minline == null || minindent > indented) {
|
1761 |
+
minline = search - 1
|
1762 |
+
minindent = indented
|
1763 |
+
}
|
1764 |
+
}
|
1765 |
+
return minline
|
1766 |
+
}
|
1767 |
+
|
1768 |
+
// LINE DATA STRUCTURE
|
1769 |
+
|
1770 |
+
// Line objects. These hold state related to a line, including
|
1771 |
+
// highlighting info (the styles array).
|
1772 |
+
var Line = function(text, markedSpans, estimateHeight) {
|
1773 |
+
this.text = text
|
1774 |
+
attachMarkedSpans(this, markedSpans)
|
1775 |
+
this.height = estimateHeight ? estimateHeight(this) : 1
|
1776 |
+
};
|
1777 |
+
|
1778 |
+
Line.prototype.lineNo = function () { return lineNo(this) };
|
1779 |
+
eventMixin(Line)
|
1780 |
+
|
1781 |
+
// Change the content (text, markers) of a line. Automatically
|
1782 |
+
// invalidates cached information and tries to re-estimate the
|
1783 |
+
// line's height.
|
1784 |
+
function updateLine(line, text, markedSpans, estimateHeight) {
|
1785 |
+
line.text = text
|
1786 |
+
if (line.stateAfter) { line.stateAfter = null }
|
1787 |
+
if (line.styles) { line.styles = null }
|
1788 |
+
if (line.order != null) { line.order = null }
|
1789 |
+
detachMarkedSpans(line)
|
1790 |
+
attachMarkedSpans(line, markedSpans)
|
1791 |
+
var estHeight = estimateHeight ? estimateHeight(line) : 1
|
1792 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight) }
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
// Detach a line from the document tree and its markers.
|
1796 |
+
function cleanUpLine(line) {
|
1797 |
+
line.parent = null
|
1798 |
+
detachMarkedSpans(line)
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
// Convert a style as returned by a mode (either null, or a string
|
1802 |
+
// containing one or more styles) to a CSS style. This is cached,
|
1803 |
+
// and also looks for line-wide styles.
|
1804 |
+
var styleToClassCache = {};
|
1805 |
+
var styleToClassCacheWithMode = {};
|
1806 |
+
function interpretTokenStyle(style, options) {
|
1807 |
+
if (!style || /^\s*$/.test(style)) { return null }
|
1808 |
+
var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache
|
1809 |
+
return cache[style] ||
|
1810 |
+
(cache[style] = style.replace(/\S+/g, "cm-$&"))
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
// Render the DOM representation of the text of a line. Also builds
|
1814 |
+
// up a 'line map', which points at the DOM nodes that represent
|
1815 |
+
// specific stretches of text, and is used by the measuring code.
|
1816 |
+
// The returned object contains the DOM node, this map, and
|
1817 |
+
// information about line-wide styles that were set by the mode.
|
1818 |
+
function buildLineContent(cm, lineView) {
|
1819 |
+
// The padding-right forces the element to have a 'border', which
|
1820 |
+
// is needed on Webkit to be able to get line-level bounding
|
1821 |
+
// rectangles for it (in measureChar).
|
1822 |
+
var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)
|
1823 |
+
var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
|
1824 |
+
col: 0, pos: 0, cm: cm,
|
1825 |
+
trailingSpace: false,
|
1826 |
+
splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}
|
1827 |
+
lineView.measure = {}
|
1828 |
+
|
1829 |
+
// Iterate over the logical lines that make up this visual line.
|
1830 |
+
for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
|
1831 |
+
var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)
|
1832 |
+
builder.pos = 0
|
1833 |
+
builder.addToken = buildToken
|
1834 |
+
// Optionally wire in some hacks into the token-rendering
|
1835 |
+
// algorithm, to deal with browser quirks.
|
1836 |
+
if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
|
1837 |
+
{ builder.addToken = buildTokenBadBidi(builder.addToken, order) }
|
1838 |
+
builder.map = []
|
1839 |
+
var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)
|
1840 |
+
insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))
|
1841 |
+
if (line.styleClasses) {
|
1842 |
+
if (line.styleClasses.bgClass)
|
1843 |
+
{ builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") }
|
1844 |
+
if (line.styleClasses.textClass)
|
1845 |
+
{ builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") }
|
1846 |
+
}
|
1847 |
+
|
1848 |
+
// Ensure at least a single node is present, for measuring.
|
1849 |
+
if (builder.map.length == 0)
|
1850 |
+
{ builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }
|
1851 |
+
|
1852 |
+
// Store the map and a cache object for the current logical line
|
1853 |
+
if (i == 0) {
|
1854 |
+
lineView.measure.map = builder.map
|
1855 |
+
lineView.measure.cache = {}
|
1856 |
+
} else {
|
1857 |
+
;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
|
1858 |
+
;(lineView.measure.caches || (lineView.measure.caches = [])).push({})
|
1859 |
+
}
|
1860 |
+
}
|
1861 |
+
|
1862 |
+
// See issue #2901
|
1863 |
+
if (webkit) {
|
1864 |
+
var last = builder.content.lastChild
|
1865 |
+
if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
|
1866 |
+
{ builder.content.className = "cm-tab-wrap-hack" }
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
signal(cm, "renderLine", cm, lineView.line, builder.pre)
|
1870 |
+
if (builder.pre.className)
|
1871 |
+
{ builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") }
|
1872 |
+
|
1873 |
+
return builder
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
function defaultSpecialCharPlaceholder(ch) {
|
1877 |
+
var token = elt("span", "\u2022", "cm-invalidchar")
|
1878 |
+
token.title = "\\u" + ch.charCodeAt(0).toString(16)
|
1879 |
+
token.setAttribute("aria-label", token.title)
|
1880 |
+
return token
|
1881 |
+
}
|
1882 |
+
|
1883 |
+
// Build up the DOM representation for a single token, and add it to
|
1884 |
+
// the line map. Takes care to render special characters separately.
|
1885 |
+
function buildToken(builder, text, style, startStyle, endStyle, title, css) {
|
1886 |
+
if (!text) { return }
|
1887 |
+
var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
|
1888 |
+
var special = builder.cm.state.specialChars, mustWrap = false
|
1889 |
+
var content
|
1890 |
+
if (!special.test(text)) {
|
1891 |
+
builder.col += text.length
|
1892 |
+
content = document.createTextNode(displayText)
|
1893 |
+
builder.map.push(builder.pos, builder.pos + text.length, content)
|
1894 |
+
if (ie && ie_version < 9) { mustWrap = true }
|
1895 |
+
builder.pos += text.length
|
1896 |
+
} else {
|
1897 |
+
content = document.createDocumentFragment()
|
1898 |
+
var pos = 0
|
1899 |
+
while (true) {
|
1900 |
+
special.lastIndex = pos
|
1901 |
+
var m = special.exec(text)
|
1902 |
+
var skipped = m ? m.index - pos : text.length - pos
|
1903 |
+
if (skipped) {
|
1904 |
+
var txt = document.createTextNode(displayText.slice(pos, pos + skipped))
|
1905 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) }
|
1906 |
+
else { content.appendChild(txt) }
|
1907 |
+
builder.map.push(builder.pos, builder.pos + skipped, txt)
|
1908 |
+
builder.col += skipped
|
1909 |
+
builder.pos += skipped
|
1910 |
+
}
|
1911 |
+
if (!m) { break }
|
1912 |
+
pos += skipped + 1
|
1913 |
+
var txt$1 = (void 0)
|
1914 |
+
if (m[0] == "\t") {
|
1915 |
+
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize
|
1916 |
+
txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"))
|
1917 |
+
txt$1.setAttribute("role", "presentation")
|
1918 |
+
txt$1.setAttribute("cm-text", "\t")
|
1919 |
+
builder.col += tabWidth
|
1920 |
+
} else if (m[0] == "\r" || m[0] == "\n") {
|
1921 |
+
txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"))
|
1922 |
+
txt$1.setAttribute("cm-text", m[0])
|
1923 |
+
builder.col += 1
|
1924 |
+
} else {
|
1925 |
+
txt$1 = builder.cm.options.specialCharPlaceholder(m[0])
|
1926 |
+
txt$1.setAttribute("cm-text", m[0])
|
1927 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) }
|
1928 |
+
else { content.appendChild(txt$1) }
|
1929 |
+
builder.col += 1
|
1930 |
+
}
|
1931 |
+
builder.map.push(builder.pos, builder.pos + 1, txt$1)
|
1932 |
+
builder.pos++
|
1933 |
+
}
|
1934 |
+
}
|
1935 |
+
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
|
1936 |
+
if (style || startStyle || endStyle || mustWrap || css) {
|
1937 |
+
var fullStyle = style || ""
|
1938 |
+
if (startStyle) { fullStyle += startStyle }
|
1939 |
+
if (endStyle) { fullStyle += endStyle }
|
1940 |
+
var token = elt("span", [content], fullStyle, css)
|
1941 |
+
if (title) { token.title = title }
|
1942 |
+
return builder.content.appendChild(token)
|
1943 |
+
}
|
1944 |
+
builder.content.appendChild(content)
|
1945 |
+
}
|
1946 |
+
|
1947 |
+
function splitSpaces(text, trailingBefore) {
|
1948 |
+
if (text.length > 1 && !/ /.test(text)) { return text }
|
1949 |
+
var spaceBefore = trailingBefore, result = ""
|
1950 |
+
for (var i = 0; i < text.length; i++) {
|
1951 |
+
var ch = text.charAt(i)
|
1952 |
+
if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
|
1953 |
+
{ ch = "\u00a0" }
|
1954 |
+
result += ch
|
1955 |
+
spaceBefore = ch == " "
|
1956 |
+
}
|
1957 |
+
return result
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
// Work around nonsense dimensions being reported for stretches of
|
1961 |
+
// right-to-left text.
|
1962 |
+
function buildTokenBadBidi(inner, order) {
|
1963 |
+
return function (builder, text, style, startStyle, endStyle, title, css) {
|
1964 |
+
style = style ? style + " cm-force-border" : "cm-force-border"
|
1965 |
+
var start = builder.pos, end = start + text.length
|
1966 |
+
for (;;) {
|
1967 |
+
// Find the part that overlaps with the start of this text
|
1968 |
+
var part = (void 0)
|
1969 |
+
for (var i = 0; i < order.length; i++) {
|
1970 |
+
part = order[i]
|
1971 |
+
if (part.to > start && part.from <= start) { break }
|
1972 |
+
}
|
1973 |
+
if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
|
1974 |
+
inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css)
|
1975 |
+
startStyle = null
|
1976 |
+
text = text.slice(part.to - start)
|
1977 |
+
start = part.to
|
1978 |
+
}
|
1979 |
+
}
|
1980 |
+
}
|
1981 |
+
|
1982 |
+
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
1983 |
+
var widget = !ignoreWidget && marker.widgetNode
|
1984 |
+
if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) }
|
1985 |
+
if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
|
1986 |
+
if (!widget)
|
1987 |
+
{ widget = builder.content.appendChild(document.createElement("span")) }
|
1988 |
+
widget.setAttribute("cm-marker", marker.id)
|
1989 |
+
}
|
1990 |
+
if (widget) {
|
1991 |
+
builder.cm.display.input.setUneditable(widget)
|
1992 |
+
builder.content.appendChild(widget)
|
1993 |
+
}
|
1994 |
+
builder.pos += size
|
1995 |
+
builder.trailingSpace = false
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
// Outputs a number of spans to make up a line, taking highlighting
|
1999 |
+
// and marked text into account.
|
2000 |
+
function insertLineContent(line, builder, styles) {
|
2001 |
+
var spans = line.markedSpans, allText = line.text, at = 0
|
2002 |
+
if (!spans) {
|
2003 |
+
for (var i$1 = 1; i$1 < styles.length; i$1+=2)
|
2004 |
+
{ builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }
|
2005 |
+
return
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
var len = allText.length, pos = 0, i = 1, text = "", style, css
|
2009 |
+
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed
|
2010 |
+
for (;;) {
|
2011 |
+
if (nextChange == pos) { // Update current marker set
|
2012 |
+
spanStyle = spanEndStyle = spanStartStyle = title = css = ""
|
2013 |
+
collapsed = null; nextChange = Infinity
|
2014 |
+
var foundBookmarks = [], endStyles = (void 0)
|
2015 |
+
for (var j = 0; j < spans.length; ++j) {
|
2016 |
+
var sp = spans[j], m = sp.marker
|
2017 |
+
if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
|
2018 |
+
foundBookmarks.push(m)
|
2019 |
+
} else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
|
2020 |
+
if (sp.to != null && sp.to != pos && nextChange > sp.to) {
|
2021 |
+
nextChange = sp.to
|
2022 |
+
spanEndStyle = ""
|
2023 |
+
}
|
2024 |
+
if (m.className) { spanStyle += " " + m.className }
|
2025 |
+
if (m.css) { css = (css ? css + ";" : "") + m.css }
|
2026 |
+
if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle }
|
2027 |
+
if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }
|
2028 |
+
if (m.title && !title) { title = m.title }
|
2029 |
+
if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
|
2030 |
+
{ collapsed = sp }
|
2031 |
+
} else if (sp.from > pos && nextChange > sp.from) {
|
2032 |
+
nextChange = sp.from
|
2033 |
+
}
|
2034 |
+
}
|
2035 |
+
if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
|
2036 |
+
{ if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } }
|
2037 |
+
|
2038 |
+
if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
|
2039 |
+
{ buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } }
|
2040 |
+
if (collapsed && (collapsed.from || 0) == pos) {
|
2041 |
+
buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
|
2042 |
+
collapsed.marker, collapsed.from == null)
|
2043 |
+
if (collapsed.to == null) { return }
|
2044 |
+
if (collapsed.to == pos) { collapsed = false }
|
2045 |
+
}
|
2046 |
+
}
|
2047 |
+
if (pos >= len) { break }
|
2048 |
+
|
2049 |
+
var upto = Math.min(len, nextChange)
|
2050 |
+
while (true) {
|
2051 |
+
if (text) {
|
2052 |
+
var end = pos + text.length
|
2053 |
+
if (!collapsed) {
|
2054 |
+
var tokenText = end > upto ? text.slice(0, upto - pos) : text
|
2055 |
+
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
2056 |
+
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css)
|
2057 |
+
}
|
2058 |
+
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
|
2059 |
+
pos = end
|
2060 |
+
spanStartStyle = ""
|
2061 |
+
}
|
2062 |
+
text = allText.slice(at, at = styles[i++])
|
2063 |
+
style = interpretTokenStyle(styles[i++], builder.cm.options)
|
2064 |
+
}
|
2065 |
+
}
|
2066 |
+
}
|
2067 |
+
|
2068 |
+
|
2069 |
+
// These objects are used to represent the visible (currently drawn)
|
2070 |
+
// part of the document. A LineView may correspond to multiple
|
2071 |
+
// logical lines, if those are connected by collapsed ranges.
|
2072 |
+
function LineView(doc, line, lineN) {
|
2073 |
+
// The starting line
|
2074 |
+
this.line = line
|
2075 |
+
// Continuing lines, if any
|
2076 |
+
this.rest = visualLineContinued(line)
|
2077 |
+
// Number of logical lines in this visual line
|
2078 |
+
this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1
|
2079 |
+
this.node = this.text = null
|
2080 |
+
this.hidden = lineIsHidden(doc, line)
|
2081 |
+
}
|
2082 |
+
|
2083 |
+
// Create a range of LineView objects for the given lines.
|
2084 |
+
function buildViewArray(cm, from, to) {
|
2085 |
+
var array = [], nextPos
|
2086 |
+
for (var pos = from; pos < to; pos = nextPos) {
|
2087 |
+
var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)
|
2088 |
+
nextPos = pos + view.size
|
2089 |
+
array.push(view)
|
2090 |
+
}
|
2091 |
+
return array
|
2092 |
+
}
|
2093 |
+
|
2094 |
+
var operationGroup = null
|
2095 |
+
|
2096 |
+
function pushOperation(op) {
|
2097 |
+
if (operationGroup) {
|
2098 |
+
operationGroup.ops.push(op)
|
2099 |
+
} else {
|
2100 |
+
op.ownsGroup = operationGroup = {
|
2101 |
+
ops: [op],
|
2102 |
+
delayedCallbacks: []
|
2103 |
+
}
|
2104 |
+
}
|
2105 |
+
}
|
2106 |
+
|
2107 |
+
function fireCallbacksForOps(group) {
|
2108 |
+
// Calls delayed callbacks and cursorActivity handlers until no
|
2109 |
+
// new ones appear
|
2110 |
+
var callbacks = group.delayedCallbacks, i = 0
|
2111 |
+
do {
|
2112 |
+
for (; i < callbacks.length; i++)
|
2113 |
+
{ callbacks[i].call(null) }
|
2114 |
+
for (var j = 0; j < group.ops.length; j++) {
|
2115 |
+
var op = group.ops[j]
|
2116 |
+
if (op.cursorActivityHandlers)
|
2117 |
+
{ while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
|
2118 |
+
{ op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } }
|
2119 |
+
}
|
2120 |
+
} while (i < callbacks.length)
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
function finishOperation(op, endCb) {
|
2124 |
+
var group = op.ownsGroup
|
2125 |
+
if (!group) { return }
|
2126 |
+
|
2127 |
+
try { fireCallbacksForOps(group) }
|
2128 |
+
finally {
|
2129 |
+
operationGroup = null
|
2130 |
+
endCb(group)
|
2131 |
+
}
|
2132 |
+
}
|
2133 |
+
|
2134 |
+
var orphanDelayedCallbacks = null
|
2135 |
+
|
2136 |
+
// Often, we want to signal events at a point where we are in the
|
2137 |
+
// middle of some work, but don't want the handler to start calling
|
2138 |
+
// other methods on the editor, which might be in an inconsistent
|
2139 |
+
// state or simply not expect any other events to happen.
|
2140 |
+
// signalLater looks whether there are any handlers, and schedules
|
2141 |
+
// them to be executed when the last operation ends, or, if no
|
2142 |
+
// operation is active, when a timeout fires.
|
2143 |
+
function signalLater(emitter, type /*, values...*/) {
|
2144 |
+
var arr = getHandlers(emitter, type)
|
2145 |
+
if (!arr.length) { return }
|
2146 |
+
var args = Array.prototype.slice.call(arguments, 2), list
|
2147 |
+
if (operationGroup) {
|
2148 |
+
list = operationGroup.delayedCallbacks
|
2149 |
+
} else if (orphanDelayedCallbacks) {
|
2150 |
+
list = orphanDelayedCallbacks
|
2151 |
+
} else {
|
2152 |
+
list = orphanDelayedCallbacks = []
|
2153 |
+
setTimeout(fireOrphanDelayed, 0)
|
2154 |
+
}
|
2155 |
+
var loop = function ( i ) {
|
2156 |
+
list.push(function () { return arr[i].apply(null, args); })
|
2157 |
+
};
|
2158 |
+
|
2159 |
+
for (var i = 0; i < arr.length; ++i)
|
2160 |
+
loop( i );
|
2161 |
+
}
|
2162 |
+
|
2163 |
+
function fireOrphanDelayed() {
|
2164 |
+
var delayed = orphanDelayedCallbacks
|
2165 |
+
orphanDelayedCallbacks = null
|
2166 |
+
for (var i = 0; i < delayed.length; ++i) { delayed[i]() }
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
// When an aspect of a line changes, a string is added to
|
2170 |
+
// lineView.changes. This updates the relevant part of the line's
|
2171 |
+
// DOM structure.
|
2172 |
+
function updateLineForChanges(cm, lineView, lineN, dims) {
|
2173 |
+
for (var j = 0; j < lineView.changes.length; j++) {
|
2174 |
+
var type = lineView.changes[j]
|
2175 |
+
if (type == "text") { updateLineText(cm, lineView) }
|
2176 |
+
else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) }
|
2177 |
+
else if (type == "class") { updateLineClasses(cm, lineView) }
|
2178 |
+
else if (type == "widget") { updateLineWidgets(cm, lineView, dims) }
|
2179 |
+
}
|
2180 |
+
lineView.changes = null
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
// Lines with gutter elements, widgets or a background class need to
|
2184 |
+
// be wrapped, and have the extra elements added to the wrapper div
|
2185 |
+
function ensureLineWrapped(lineView) {
|
2186 |
+
if (lineView.node == lineView.text) {
|
2187 |
+
lineView.node = elt("div", null, null, "position: relative")
|
2188 |
+
if (lineView.text.parentNode)
|
2189 |
+
{ lineView.text.parentNode.replaceChild(lineView.node, lineView.text) }
|
2190 |
+
lineView.node.appendChild(lineView.text)
|
2191 |
+
if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 }
|
2192 |
+
}
|
2193 |
+
return lineView.node
|
2194 |
+
}
|
2195 |
+
|
2196 |
+
function updateLineBackground(cm, lineView) {
|
2197 |
+
var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
|
2198 |
+
if (cls) { cls += " CodeMirror-linebackground" }
|
2199 |
+
if (lineView.background) {
|
2200 |
+
if (cls) { lineView.background.className = cls }
|
2201 |
+
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
|
2202 |
+
} else if (cls) {
|
2203 |
+
var wrap = ensureLineWrapped(lineView)
|
2204 |
+
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
|
2205 |
+
cm.display.input.setUneditable(lineView.background)
|
2206 |
+
}
|
2207 |
+
}
|
2208 |
+
|
2209 |
+
// Wrapper around buildLineContent which will reuse the structure
|
2210 |
+
// in display.externalMeasured when possible.
|
2211 |
+
function getLineContent(cm, lineView) {
|
2212 |
+
var ext = cm.display.externalMeasured
|
2213 |
+
if (ext && ext.line == lineView.line) {
|
2214 |
+
cm.display.externalMeasured = null
|
2215 |
+
lineView.measure = ext.measure
|
2216 |
+
return ext.built
|
2217 |
+
}
|
2218 |
+
return buildLineContent(cm, lineView)
|
2219 |
+
}
|
2220 |
+
|
2221 |
+
// Redraw the line's text. Interacts with the background and text
|
2222 |
+
// classes because the mode may output tokens that influence these
|
2223 |
+
// classes.
|
2224 |
+
function updateLineText(cm, lineView) {
|
2225 |
+
var cls = lineView.text.className
|
2226 |
+
var built = getLineContent(cm, lineView)
|
2227 |
+
if (lineView.text == lineView.node) { lineView.node = built.pre }
|
2228 |
+
lineView.text.parentNode.replaceChild(built.pre, lineView.text)
|
2229 |
+
lineView.text = built.pre
|
2230 |
+
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
2231 |
+
lineView.bgClass = built.bgClass
|
2232 |
+
lineView.textClass = built.textClass
|
2233 |
+
updateLineClasses(cm, lineView)
|
2234 |
+
} else if (cls) {
|
2235 |
+
lineView.text.className = cls
|
2236 |
+
}
|
2237 |
+
}
|
2238 |
+
|
2239 |
+
function updateLineClasses(cm, lineView) {
|
2240 |
+
updateLineBackground(cm, lineView)
|
2241 |
+
if (lineView.line.wrapClass)
|
2242 |
+
{ ensureLineWrapped(lineView).className = lineView.line.wrapClass }
|
2243 |
+
else if (lineView.node != lineView.text)
|
2244 |
+
{ lineView.node.className = "" }
|
2245 |
+
var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
|
2246 |
+
lineView.text.className = textClass || ""
|
2247 |
+
}
|
2248 |
+
|
2249 |
+
function updateLineGutter(cm, lineView, lineN, dims) {
|
2250 |
+
if (lineView.gutter) {
|
2251 |
+
lineView.node.removeChild(lineView.gutter)
|
2252 |
+
lineView.gutter = null
|
2253 |
+
}
|
2254 |
+
if (lineView.gutterBackground) {
|
2255 |
+
lineView.node.removeChild(lineView.gutterBackground)
|
2256 |
+
lineView.gutterBackground = null
|
2257 |
+
}
|
2258 |
+
if (lineView.line.gutterClass) {
|
2259 |
+
var wrap = ensureLineWrapped(lineView)
|
2260 |
+
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
2261 |
+
("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"))
|
2262 |
+
cm.display.input.setUneditable(lineView.gutterBackground)
|
2263 |
+
wrap.insertBefore(lineView.gutterBackground, lineView.text)
|
2264 |
+
}
|
2265 |
+
var markers = lineView.line.gutterMarkers
|
2266 |
+
if (cm.options.lineNumbers || markers) {
|
2267 |
+
var wrap$1 = ensureLineWrapped(lineView)
|
2268 |
+
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"))
|
2269 |
+
cm.display.input.setUneditable(gutterWrap)
|
2270 |
+
wrap$1.insertBefore(gutterWrap, lineView.text)
|
2271 |
+
if (lineView.line.gutterClass)
|
2272 |
+
{ gutterWrap.className += " " + lineView.line.gutterClass }
|
2273 |
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
2274 |
+
{ lineView.lineNumber = gutterWrap.appendChild(
|
2275 |
+
elt("div", lineNumberFor(cm.options, lineN),
|
2276 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
2277 |
+
("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) }
|
2278 |
+
if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
|
2279 |
+
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]
|
2280 |
+
if (found)
|
2281 |
+
{ gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
|
2282 |
+
("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) }
|
2283 |
+
} }
|
2284 |
+
}
|
2285 |
+
}
|
2286 |
+
|
2287 |
+
function updateLineWidgets(cm, lineView, dims) {
|
2288 |
+
if (lineView.alignable) { lineView.alignable = null }
|
2289 |
+
for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
|
2290 |
+
next = node.nextSibling
|
2291 |
+
if (node.className == "CodeMirror-linewidget")
|
2292 |
+
{ lineView.node.removeChild(node) }
|
2293 |
+
}
|
2294 |
+
insertLineWidgets(cm, lineView, dims)
|
2295 |
+
}
|
2296 |
+
|
2297 |
+
// Build a line's DOM representation from scratch
|
2298 |
+
function buildLineElement(cm, lineView, lineN, dims) {
|
2299 |
+
var built = getLineContent(cm, lineView)
|
2300 |
+
lineView.text = lineView.node = built.pre
|
2301 |
+
if (built.bgClass) { lineView.bgClass = built.bgClass }
|
2302 |
+
if (built.textClass) { lineView.textClass = built.textClass }
|
2303 |
+
|
2304 |
+
updateLineClasses(cm, lineView)
|
2305 |
+
updateLineGutter(cm, lineView, lineN, dims)
|
2306 |
+
insertLineWidgets(cm, lineView, dims)
|
2307 |
+
return lineView.node
|
2308 |
+
}
|
2309 |
+
|
2310 |
+
// A lineView may contain multiple logical lines (when merged by
|
2311 |
+
// collapsed spans). The widgets for all of them need to be drawn.
|
2312 |
+
function insertLineWidgets(cm, lineView, dims) {
|
2313 |
+
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
|
2314 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2315 |
+
{ insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
2319 |
+
if (!line.widgets) { return }
|
2320 |
+
var wrap = ensureLineWrapped(lineView)
|
2321 |
+
for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
2322 |
+
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget")
|
2323 |
+
if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") }
|
2324 |
+
positionLineWidget(widget, node, lineView, dims)
|
2325 |
+
cm.display.input.setUneditable(node)
|
2326 |
+
if (allowAbove && widget.above)
|
2327 |
+
{ wrap.insertBefore(node, lineView.gutter || lineView.text) }
|
2328 |
+
else
|
2329 |
+
{ wrap.appendChild(node) }
|
2330 |
+
signalLater(widget, "redraw")
|
2331 |
+
}
|
2332 |
+
}
|
2333 |
+
|
2334 |
+
function positionLineWidget(widget, node, lineView, dims) {
|
2335 |
+
if (widget.noHScroll) {
|
2336 |
+
;(lineView.alignable || (lineView.alignable = [])).push(node)
|
2337 |
+
var width = dims.wrapperWidth
|
2338 |
+
node.style.left = dims.fixedPos + "px"
|
2339 |
+
if (!widget.coverGutter) {
|
2340 |
+
width -= dims.gutterTotalWidth
|
2341 |
+
node.style.paddingLeft = dims.gutterTotalWidth + "px"
|
2342 |
+
}
|
2343 |
+
node.style.width = width + "px"
|
2344 |
+
}
|
2345 |
+
if (widget.coverGutter) {
|
2346 |
+
node.style.zIndex = 5
|
2347 |
+
node.style.position = "relative"
|
2348 |
+
if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" }
|
2349 |
+
}
|
2350 |
+
}
|
2351 |
+
|
2352 |
+
function widgetHeight(widget) {
|
2353 |
+
if (widget.height != null) { return widget.height }
|
2354 |
+
var cm = widget.doc.cm
|
2355 |
+
if (!cm) { return 0 }
|
2356 |
+
if (!contains(document.body, widget.node)) {
|
2357 |
+
var parentStyle = "position: relative;"
|
2358 |
+
if (widget.coverGutter)
|
2359 |
+
{ parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" }
|
2360 |
+
if (widget.noHScroll)
|
2361 |
+
{ parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" }
|
2362 |
+
removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
|
2363 |
+
}
|
2364 |
+
return widget.height = widget.node.parentNode.offsetHeight
|
2365 |
+
}
|
2366 |
+
|
2367 |
+
// Return true when the given mouse event happened in a widget
|
2368 |
+
function eventInWidget(display, e) {
|
2369 |
+
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
2370 |
+
if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
|
2371 |
+
(n.parentNode == display.sizer && n != display.mover))
|
2372 |
+
{ return true }
|
2373 |
+
}
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
// POSITION MEASUREMENT
|
2377 |
+
|
2378 |
+
function paddingTop(display) {return display.lineSpace.offsetTop}
|
2379 |
+
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
2380 |
+
function paddingH(display) {
|
2381 |
+
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
2382 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"))
|
2383 |
+
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
|
2384 |
+
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
|
2385 |
+
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data }
|
2386 |
+
return data
|
2387 |
+
}
|
2388 |
+
|
2389 |
+
function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
|
2390 |
+
function displayWidth(cm) {
|
2391 |
+
return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
|
2392 |
+
}
|
2393 |
+
function displayHeight(cm) {
|
2394 |
+
return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
// Ensure the lineView.wrapping.heights array is populated. This is
|
2398 |
+
// an array of bottom offsets for the lines that make up a drawn
|
2399 |
+
// line. When lineWrapping is on, there might be more than one
|
2400 |
+
// height.
|
2401 |
+
function ensureLineHeights(cm, lineView, rect) {
|
2402 |
+
var wrapping = cm.options.lineWrapping
|
2403 |
+
var curWidth = wrapping && displayWidth(cm)
|
2404 |
+
if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
|
2405 |
+
var heights = lineView.measure.heights = []
|
2406 |
+
if (wrapping) {
|
2407 |
+
lineView.measure.width = curWidth
|
2408 |
+
var rects = lineView.text.firstChild.getClientRects()
|
2409 |
+
for (var i = 0; i < rects.length - 1; i++) {
|
2410 |
+
var cur = rects[i], next = rects[i + 1]
|
2411 |
+
if (Math.abs(cur.bottom - next.bottom) > 2)
|
2412 |
+
{ heights.push((cur.bottom + next.top) / 2 - rect.top) }
|
2413 |
+
}
|
2414 |
+
}
|
2415 |
+
heights.push(rect.bottom - rect.top)
|
2416 |
+
}
|
2417 |
+
}
|
2418 |
+
|
2419 |
+
// Find a line map (mapping character offsets to text nodes) and a
|
2420 |
+
// measurement cache for the given line number. (A line view might
|
2421 |
+
// contain multiple lines when collapsed ranges are present.)
|
2422 |
+
function mapFromLineView(lineView, line, lineN) {
|
2423 |
+
if (lineView.line == line)
|
2424 |
+
{ return {map: lineView.measure.map, cache: lineView.measure.cache} }
|
2425 |
+
for (var i = 0; i < lineView.rest.length; i++)
|
2426 |
+
{ if (lineView.rest[i] == line)
|
2427 |
+
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
|
2428 |
+
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
2429 |
+
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
2430 |
+
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
2431 |
+
}
|
2432 |
+
|
2433 |
+
// Render a line into the hidden node display.externalMeasured. Used
|
2434 |
+
// when measurement is needed for a line that's not in the viewport.
|
2435 |
+
function updateExternalMeasurement(cm, line) {
|
2436 |
+
line = visualLine(line)
|
2437 |
+
var lineN = lineNo(line)
|
2438 |
+
var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)
|
2439 |
+
view.lineN = lineN
|
2440 |
+
var built = view.built = buildLineContent(cm, view)
|
2441 |
+
view.text = built.pre
|
2442 |
+
removeChildrenAndAdd(cm.display.lineMeasure, built.pre)
|
2443 |
+
return view
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
// Get a {top, bottom, left, right} box (in line-local coordinates)
|
2447 |
+
// for a given character.
|
2448 |
+
function measureChar(cm, line, ch, bias) {
|
2449 |
+
return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
|
2450 |
+
}
|
2451 |
+
|
2452 |
+
// Find a line view that corresponds to the given line number.
|
2453 |
+
function findViewForLine(cm, lineN) {
|
2454 |
+
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
|
2455 |
+
{ return cm.display.view[findViewIndex(cm, lineN)] }
|
2456 |
+
var ext = cm.display.externalMeasured
|
2457 |
+
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
|
2458 |
+
{ return ext }
|
2459 |
+
}
|
2460 |
+
|
2461 |
+
// Measurement can be split in two steps, the set-up work that
|
2462 |
+
// applies to the whole line, and the measurement of the actual
|
2463 |
+
// character. Functions like coordsChar, that need to do a lot of
|
2464 |
+
// measurements in a row, can thus ensure that the set-up work is
|
2465 |
+
// only done once.
|
2466 |
+
function prepareMeasureForLine(cm, line) {
|
2467 |
+
var lineN = lineNo(line)
|
2468 |
+
var view = findViewForLine(cm, lineN)
|
2469 |
+
if (view && !view.text) {
|
2470 |
+
view = null
|
2471 |
+
} else if (view && view.changes) {
|
2472 |
+
updateLineForChanges(cm, view, lineN, getDimensions(cm))
|
2473 |
+
cm.curOp.forceUpdate = true
|
2474 |
+
}
|
2475 |
+
if (!view)
|
2476 |
+
{ view = updateExternalMeasurement(cm, line) }
|
2477 |
+
|
2478 |
+
var info = mapFromLineView(view, line, lineN)
|
2479 |
+
return {
|
2480 |
+
line: line, view: view, rect: null,
|
2481 |
+
map: info.map, cache: info.cache, before: info.before,
|
2482 |
+
hasHeights: false
|
2483 |
+
}
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
// Given a prepared measurement object, measures the position of an
|
2487 |
+
// actual character (or fetches it from the cache).
|
2488 |
+
function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
|
2489 |
+
if (prepared.before) { ch = -1 }
|
2490 |
+
var key = ch + (bias || ""), found
|
2491 |
+
if (prepared.cache.hasOwnProperty(key)) {
|
2492 |
+
found = prepared.cache[key]
|
2493 |
+
} else {
|
2494 |
+
if (!prepared.rect)
|
2495 |
+
{ prepared.rect = prepared.view.text.getBoundingClientRect() }
|
2496 |
+
if (!prepared.hasHeights) {
|
2497 |
+
ensureLineHeights(cm, prepared.view, prepared.rect)
|
2498 |
+
prepared.hasHeights = true
|
2499 |
+
}
|
2500 |
+
found = measureCharInner(cm, prepared, ch, bias)
|
2501 |
+
if (!found.bogus) { prepared.cache[key] = found }
|
2502 |
+
}
|
2503 |
+
return {left: found.left, right: found.right,
|
2504 |
+
top: varHeight ? found.rtop : found.top,
|
2505 |
+
bottom: varHeight ? found.rbottom : found.bottom}
|
2506 |
+
}
|
2507 |
+
|
2508 |
+
var nullRect = {left: 0, right: 0, top: 0, bottom: 0}
|
2509 |
+
|
2510 |
+
function nodeAndOffsetInLineMap(map, ch, bias) {
|
2511 |
+
var node, start, end, collapse, mStart, mEnd
|
2512 |
+
// First, search the line map for the text node corresponding to,
|
2513 |
+
// or closest to, the target character.
|
2514 |
+
for (var i = 0; i < map.length; i += 3) {
|
2515 |
+
mStart = map[i]
|
2516 |
+
mEnd = map[i + 1]
|
2517 |
+
if (ch < mStart) {
|
2518 |
+
start = 0; end = 1
|
2519 |
+
collapse = "left"
|
2520 |
+
} else if (ch < mEnd) {
|
2521 |
+
start = ch - mStart
|
2522 |
+
end = start + 1
|
2523 |
+
} else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
|
2524 |
+
end = mEnd - mStart
|
2525 |
+
start = end - 1
|
2526 |
+
if (ch >= mEnd) { collapse = "right" }
|
2527 |
+
}
|
2528 |
+
if (start != null) {
|
2529 |
+
node = map[i + 2]
|
2530 |
+
if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
|
2531 |
+
{ collapse = bias }
|
2532 |
+
if (bias == "left" && start == 0)
|
2533 |
+
{ while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
|
2534 |
+
node = map[(i -= 3) + 2]
|
2535 |
+
collapse = "left"
|
2536 |
+
} }
|
2537 |
+
if (bias == "right" && start == mEnd - mStart)
|
2538 |
+
{ while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
|
2539 |
+
node = map[(i += 3) + 2]
|
2540 |
+
collapse = "right"
|
2541 |
+
} }
|
2542 |
+
break
|
2543 |
+
}
|
2544 |
+
}
|
2545 |
+
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
|
2546 |
+
}
|
2547 |
+
|
2548 |
+
function getUsefulRect(rects, bias) {
|
2549 |
+
var rect = nullRect
|
2550 |
+
if (bias == "left") { for (var i = 0; i < rects.length; i++) {
|
2551 |
+
if ((rect = rects[i]).left != rect.right) { break }
|
2552 |
+
} } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
|
2553 |
+
if ((rect = rects[i$1]).left != rect.right) { break }
|
2554 |
+
} }
|
2555 |
+
return rect
|
2556 |
+
}
|
2557 |
+
|
2558 |
+
function measureCharInner(cm, prepared, ch, bias) {
|
2559 |
+
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
|
2560 |
+
var node = place.node, start = place.start, end = place.end, collapse = place.collapse
|
2561 |
+
|
2562 |
+
var rect
|
2563 |
+
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
2564 |
+
for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
2565 |
+
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start }
|
2566 |
+
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end }
|
2567 |
+
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
|
2568 |
+
{ rect = node.parentNode.getBoundingClientRect() }
|
2569 |
+
else
|
2570 |
+
{ rect = getUsefulRect(range(node, start, end).getClientRects(), bias) }
|
2571 |
+
if (rect.left || rect.right || start == 0) { break }
|
2572 |
+
end = start
|
2573 |
+
start = start - 1
|
2574 |
+
collapse = "right"
|
2575 |
+
}
|
2576 |
+
if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) }
|
2577 |
+
} else { // If it is a widget, simply get the box for the whole widget.
|
2578 |
+
if (start > 0) { collapse = bias = "right" }
|
2579 |
+
var rects
|
2580 |
+
if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
|
2581 |
+
{ rect = rects[bias == "right" ? rects.length - 1 : 0] }
|
2582 |
+
else
|
2583 |
+
{ rect = node.getBoundingClientRect() }
|
2584 |
+
}
|
2585 |
+
if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
|
2586 |
+
var rSpan = node.parentNode.getClientRects()[0]
|
2587 |
+
if (rSpan)
|
2588 |
+
{ rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} }
|
2589 |
+
else
|
2590 |
+
{ rect = nullRect }
|
2591 |
+
}
|
2592 |
+
|
2593 |
+
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top
|
2594 |
+
var mid = (rtop + rbot) / 2
|
2595 |
+
var heights = prepared.view.measure.heights
|
2596 |
+
var i = 0
|
2597 |
+
for (; i < heights.length - 1; i++)
|
2598 |
+
{ if (mid < heights[i]) { break } }
|
2599 |
+
var top = i ? heights[i - 1] : 0, bot = heights[i]
|
2600 |
+
var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
|
2601 |
+
right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
|
2602 |
+
top: top, bottom: bot}
|
2603 |
+
if (!rect.left && !rect.right) { result.bogus = true }
|
2604 |
+
if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot }
|
2605 |
+
|
2606 |
+
return result
|
2607 |
+
}
|
2608 |
+
|
2609 |
+
// Work around problem with bounding client rects on ranges being
|
2610 |
+
// returned incorrectly when zoomed on IE10 and below.
|
2611 |
+
function maybeUpdateRectForZooming(measure, rect) {
|
2612 |
+
if (!window.screen || screen.logicalXDPI == null ||
|
2613 |
+
screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
|
2614 |
+
{ return rect }
|
2615 |
+
var scaleX = screen.logicalXDPI / screen.deviceXDPI
|
2616 |
+
var scaleY = screen.logicalYDPI / screen.deviceYDPI
|
2617 |
+
return {left: rect.left * scaleX, right: rect.right * scaleX,
|
2618 |
+
top: rect.top * scaleY, bottom: rect.bottom * scaleY}
|
2619 |
+
}
|
2620 |
+
|
2621 |
+
function clearLineMeasurementCacheFor(lineView) {
|
2622 |
+
if (lineView.measure) {
|
2623 |
+
lineView.measure.cache = {}
|
2624 |
+
lineView.measure.heights = null
|
2625 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2626 |
+
{ lineView.measure.caches[i] = {} } }
|
2627 |
+
}
|
2628 |
+
}
|
2629 |
+
|
2630 |
+
function clearLineMeasurementCache(cm) {
|
2631 |
+
cm.display.externalMeasure = null
|
2632 |
+
removeChildren(cm.display.lineMeasure)
|
2633 |
+
for (var i = 0; i < cm.display.view.length; i++)
|
2634 |
+
{ clearLineMeasurementCacheFor(cm.display.view[i]) }
|
2635 |
+
}
|
2636 |
+
|
2637 |
+
function clearCaches(cm) {
|
2638 |
+
clearLineMeasurementCache(cm)
|
2639 |
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null
|
2640 |
+
if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true }
|
2641 |
+
cm.display.lineNumChars = null
|
2642 |
+
}
|
2643 |
+
|
2644 |
+
function pageScrollX() {
|
2645 |
+
// Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
|
2646 |
+
// which causes page_Offset and bounding client rects to use
|
2647 |
+
// different reference viewports and invalidate our calculations.
|
2648 |
+
if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
|
2649 |
+
return window.pageXOffset || (document.documentElement || document.body).scrollLeft
|
2650 |
+
}
|
2651 |
+
function pageScrollY() {
|
2652 |
+
if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
|
2653 |
+
return window.pageYOffset || (document.documentElement || document.body).scrollTop
|
2654 |
+
}
|
2655 |
+
|
2656 |
+
// Converts a {top, bottom, left, right} box from line-local
|
2657 |
+
// coordinates into another coordinate system. Context may be one of
|
2658 |
+
// "line", "div" (display.lineDiv), "local"./null (editor), "window",
|
2659 |
+
// or "page".
|
2660 |
+
function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
|
2661 |
+
if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
|
2662 |
+
var size = widgetHeight(lineObj.widgets[i])
|
2663 |
+
rect.top += size; rect.bottom += size
|
2664 |
+
} } }
|
2665 |
+
if (context == "line") { return rect }
|
2666 |
+
if (!context) { context = "local" }
|
2667 |
+
var yOff = heightAtLine(lineObj)
|
2668 |
+
if (context == "local") { yOff += paddingTop(cm.display) }
|
2669 |
+
else { yOff -= cm.display.viewOffset }
|
2670 |
+
if (context == "page" || context == "window") {
|
2671 |
+
var lOff = cm.display.lineSpace.getBoundingClientRect()
|
2672 |
+
yOff += lOff.top + (context == "window" ? 0 : pageScrollY())
|
2673 |
+
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX())
|
2674 |
+
rect.left += xOff; rect.right += xOff
|
2675 |
+
}
|
2676 |
+
rect.top += yOff; rect.bottom += yOff
|
2677 |
+
return rect
|
2678 |
+
}
|
2679 |
+
|
2680 |
+
// Coverts a box from "div" coords to another coordinate system.
|
2681 |
+
// Context may be "window", "page", "div", or "local"./null.
|
2682 |
+
function fromCoordSystem(cm, coords, context) {
|
2683 |
+
if (context == "div") { return coords }
|
2684 |
+
var left = coords.left, top = coords.top
|
2685 |
+
// First move into "page" coordinate system
|
2686 |
+
if (context == "page") {
|
2687 |
+
left -= pageScrollX()
|
2688 |
+
top -= pageScrollY()
|
2689 |
+
} else if (context == "local" || !context) {
|
2690 |
+
var localBox = cm.display.sizer.getBoundingClientRect()
|
2691 |
+
left += localBox.left
|
2692 |
+
top += localBox.top
|
2693 |
+
}
|
2694 |
+
|
2695 |
+
var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
|
2696 |
+
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
|
2697 |
+
}
|
2698 |
+
|
2699 |
+
function charCoords(cm, pos, context, lineObj, bias) {
|
2700 |
+
if (!lineObj) { lineObj = getLine(cm.doc, pos.line) }
|
2701 |
+
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
|
2702 |
+
}
|
2703 |
+
|
2704 |
+
// Returns a box for a given cursor position, which may have an
|
2705 |
+
// 'other' property containing the position of the secondary cursor
|
2706 |
+
// on a bidi boundary.
|
2707 |
+
// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
|
2708 |
+
// and after `char - 1` in writing order of `char - 1`
|
2709 |
+
// A cursor Pos(line, char, "after") is on the same visual line as `char`
|
2710 |
+
// and before `char` in writing order of `char`
|
2711 |
+
// Examples (upper-case letters are RTL, lower-case are LTR):
|
2712 |
+
// Pos(0, 1, ...)
|
2713 |
+
// before after
|
2714 |
+
// ab a|b a|b
|
2715 |
+
// aB a|B aB|
|
2716 |
+
// Ab |Ab A|b
|
2717 |
+
// AB B|A B|A
|
2718 |
+
// Every position after the last character on a line is considered to stick
|
2719 |
+
// to the last character on the line.
|
2720 |
+
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
|
2721 |
+
lineObj = lineObj || getLine(cm.doc, pos.line)
|
2722 |
+
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }
|
2723 |
+
function get(ch, right) {
|
2724 |
+
var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight)
|
2725 |
+
if (right) { m.left = m.right; } else { m.right = m.left }
|
2726 |
+
return intoCoordSystem(cm, lineObj, m, context)
|
2727 |
+
}
|
2728 |
+
var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky
|
2729 |
+
if (ch >= lineObj.text.length) {
|
2730 |
+
ch = lineObj.text.length
|
2731 |
+
sticky = "before"
|
2732 |
+
} else if (ch <= 0) {
|
2733 |
+
ch = 0
|
2734 |
+
sticky = "after"
|
2735 |
+
}
|
2736 |
+
if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
|
2737 |
+
|
2738 |
+
function getBidi(ch, partPos, invert) {
|
2739 |
+
var part = order[partPos], right = (part.level % 2) != 0
|
2740 |
+
return get(invert ? ch - 1 : ch, right != invert)
|
2741 |
+
}
|
2742 |
+
var partPos = getBidiPartAt(order, ch, sticky)
|
2743 |
+
var other = bidiOther
|
2744 |
+
var val = getBidi(ch, partPos, sticky == "before")
|
2745 |
+
if (other != null) { val.other = getBidi(ch, other, sticky != "before") }
|
2746 |
+
return val
|
2747 |
+
}
|
2748 |
+
|
2749 |
+
// Used to cheaply estimate the coordinates for a position. Used for
|
2750 |
+
// intermediate scroll updates.
|
2751 |
+
function estimateCoords(cm, pos) {
|
2752 |
+
var left = 0
|
2753 |
+
pos = clipPos(cm.doc, pos)
|
2754 |
+
if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }
|
2755 |
+
var lineObj = getLine(cm.doc, pos.line)
|
2756 |
+
var top = heightAtLine(lineObj) + paddingTop(cm.display)
|
2757 |
+
return {left: left, right: left, top: top, bottom: top + lineObj.height}
|
2758 |
+
}
|
2759 |
+
|
2760 |
+
// Positions returned by coordsChar contain some extra information.
|
2761 |
+
// xRel is the relative x position of the input coordinates compared
|
2762 |
+
// to the found position (so xRel > 0 means the coordinates are to
|
2763 |
+
// the right of the character position, for example). When outside
|
2764 |
+
// is true, that means the coordinates lie outside the line's
|
2765 |
+
// vertical range.
|
2766 |
+
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
2767 |
+
var pos = Pos(line, ch, sticky)
|
2768 |
+
pos.xRel = xRel
|
2769 |
+
if (outside) { pos.outside = true }
|
2770 |
+
return pos
|
2771 |
+
}
|
2772 |
+
|
2773 |
+
// Compute the character position closest to the given coordinates.
|
2774 |
+
// Input must be lineSpace-local ("div" coordinate system).
|
2775 |
+
function coordsChar(cm, x, y) {
|
2776 |
+
var doc = cm.doc
|
2777 |
+
y += cm.display.viewOffset
|
2778 |
+
if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
|
2779 |
+
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1
|
2780 |
+
if (lineN > last)
|
2781 |
+
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
|
2782 |
+
if (x < 0) { x = 0 }
|
2783 |
+
|
2784 |
+
var lineObj = getLine(doc, lineN)
|
2785 |
+
for (;;) {
|
2786 |
+
var found = coordsCharInner(cm, lineObj, lineN, x, y)
|
2787 |
+
var merged = collapsedSpanAtEnd(lineObj)
|
2788 |
+
var mergedPos = merged && merged.find(0, true)
|
2789 |
+
if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
|
2790 |
+
{ lineN = lineNo(lineObj = mergedPos.to.line) }
|
2791 |
+
else
|
2792 |
+
{ return found }
|
2793 |
+
}
|
2794 |
+
}
|
2795 |
+
|
2796 |
+
function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
|
2797 |
+
var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); }
|
2798 |
+
var end = lineObj.text.length
|
2799 |
+
var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0)
|
2800 |
+
end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end)
|
2801 |
+
return {begin: begin, end: end}
|
2802 |
+
}
|
2803 |
+
|
2804 |
+
function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
|
2805 |
+
var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top
|
2806 |
+
return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
|
2807 |
+
}
|
2808 |
+
|
2809 |
+
function coordsCharInner(cm, lineObj, lineNo, x, y) {
|
2810 |
+
y -= heightAtLine(lineObj)
|
2811 |
+
var begin = 0, end = lineObj.text.length
|
2812 |
+
var preparedMeasure = prepareMeasureForLine(cm, lineObj)
|
2813 |
+
var pos
|
2814 |
+
var order = getOrder(lineObj, cm.doc.direction)
|
2815 |
+
if (order) {
|
2816 |
+
if (cm.options.lineWrapping) {
|
2817 |
+
;var assign;
|
2818 |
+
((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign))
|
2819 |
+
}
|
2820 |
+
pos = new Pos(lineNo, begin)
|
2821 |
+
var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left
|
2822 |
+
var dir = beginLeft < x ? 1 : -1
|
2823 |
+
var prevDiff, diff = beginLeft - x, prevPos
|
2824 |
+
do {
|
2825 |
+
prevDiff = diff
|
2826 |
+
prevPos = pos
|
2827 |
+
pos = moveVisually(cm, lineObj, pos, dir)
|
2828 |
+
if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
|
2829 |
+
pos = prevPos
|
2830 |
+
break
|
2831 |
+
}
|
2832 |
+
diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x
|
2833 |
+
} while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
|
2834 |
+
if (Math.abs(diff) > Math.abs(prevDiff)) {
|
2835 |
+
if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
|
2836 |
+
pos = prevPos
|
2837 |
+
}
|
2838 |
+
} else {
|
2839 |
+
var ch = findFirst(function (ch) {
|
2840 |
+
var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line")
|
2841 |
+
if (box.top > y) {
|
2842 |
+
// For the cursor stickiness
|
2843 |
+
end = Math.min(ch, end)
|
2844 |
+
return true
|
2845 |
+
}
|
2846 |
+
else if (box.bottom <= y) { return false }
|
2847 |
+
else if (box.left > x) { return true }
|
2848 |
+
else if (box.right < x) { return false }
|
2849 |
+
else { return (x - box.left < box.right - x) }
|
2850 |
+
}, begin, end)
|
2851 |
+
ch = skipExtendingChars(lineObj.text, ch, 1)
|
2852 |
+
pos = new Pos(lineNo, ch, ch == end ? "before" : "after")
|
2853 |
+
}
|
2854 |
+
var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure)
|
2855 |
+
if (y < coords.top || coords.bottom < y) { pos.outside = true }
|
2856 |
+
pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0)
|
2857 |
+
return pos
|
2858 |
+
}
|
2859 |
+
|
2860 |
+
var measureText
|
2861 |
+
// Compute the default text height.
|
2862 |
+
function textHeight(display) {
|
2863 |
+
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
2864 |
+
if (measureText == null) {
|
2865 |
+
measureText = elt("pre")
|
2866 |
+
// Measure a bunch of lines, for browsers that compute
|
2867 |
+
// fractional heights.
|
2868 |
+
for (var i = 0; i < 49; ++i) {
|
2869 |
+
measureText.appendChild(document.createTextNode("x"))
|
2870 |
+
measureText.appendChild(elt("br"))
|
2871 |
+
}
|
2872 |
+
measureText.appendChild(document.createTextNode("x"))
|
2873 |
+
}
|
2874 |
+
removeChildrenAndAdd(display.measure, measureText)
|
2875 |
+
var height = measureText.offsetHeight / 50
|
2876 |
+
if (height > 3) { display.cachedTextHeight = height }
|
2877 |
+
removeChildren(display.measure)
|
2878 |
+
return height || 1
|
2879 |
+
}
|
2880 |
+
|
2881 |
+
// Compute the default character width.
|
2882 |
+
function charWidth(display) {
|
2883 |
+
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
2884 |
+
var anchor = elt("span", "xxxxxxxxxx")
|
2885 |
+
var pre = elt("pre", [anchor])
|
2886 |
+
removeChildrenAndAdd(display.measure, pre)
|
2887 |
+
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
|
2888 |
+
if (width > 2) { display.cachedCharWidth = width }
|
2889 |
+
return width || 10
|
2890 |
+
}
|
2891 |
+
|
2892 |
+
// Do a bulk-read of the DOM positions and sizes needed to draw the
|
2893 |
+
// view, so that we don't interleave reading and writing to the DOM.
|
2894 |
+
function getDimensions(cm) {
|
2895 |
+
var d = cm.display, left = {}, width = {}
|
2896 |
+
var gutterLeft = d.gutters.clientLeft
|
2897 |
+
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
2898 |
+
left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft
|
2899 |
+
width[cm.options.gutters[i]] = n.clientWidth
|
2900 |
+
}
|
2901 |
+
return {fixedPos: compensateForHScroll(d),
|
2902 |
+
gutterTotalWidth: d.gutters.offsetWidth,
|
2903 |
+
gutterLeft: left,
|
2904 |
+
gutterWidth: width,
|
2905 |
+
wrapperWidth: d.wrapper.clientWidth}
|
2906 |
+
}
|
2907 |
+
|
2908 |
+
// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
|
2909 |
+
// but using getBoundingClientRect to get a sub-pixel-accurate
|
2910 |
+
// result.
|
2911 |
+
function compensateForHScroll(display) {
|
2912 |
+
return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
// Returns a function that estimates the height of a line, to use as
|
2916 |
+
// first approximation until the line becomes visible (and is thus
|
2917 |
+
// properly measurable).
|
2918 |
+
function estimateHeight(cm) {
|
2919 |
+
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping
|
2920 |
+
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)
|
2921 |
+
return function (line) {
|
2922 |
+
if (lineIsHidden(cm.doc, line)) { return 0 }
|
2923 |
+
|
2924 |
+
var widgetsHeight = 0
|
2925 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
|
2926 |
+
if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }
|
2927 |
+
} }
|
2928 |
+
|
2929 |
+
if (wrapping)
|
2930 |
+
{ return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
|
2931 |
+
else
|
2932 |
+
{ return widgetsHeight + th }
|
2933 |
+
}
|
2934 |
+
}
|
2935 |
+
|
2936 |
+
function estimateLineHeights(cm) {
|
2937 |
+
var doc = cm.doc, est = estimateHeight(cm)
|
2938 |
+
doc.iter(function (line) {
|
2939 |
+
var estHeight = est(line)
|
2940 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight) }
|
2941 |
+
})
|
2942 |
+
}
|
2943 |
+
|
2944 |
+
// Given a mouse event, find the corresponding position. If liberal
|
2945 |
+
// is false, it checks whether a gutter or scrollbar was clicked,
|
2946 |
+
// and returns null if it was. forRect is used by rectangular
|
2947 |
+
// selections, and tries to estimate a character position even for
|
2948 |
+
// coordinates beyond the right of the text.
|
2949 |
+
function posFromMouse(cm, e, liberal, forRect) {
|
2950 |
+
var display = cm.display
|
2951 |
+
if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
|
2952 |
+
|
2953 |
+
var x, y, space = display.lineSpace.getBoundingClientRect()
|
2954 |
+
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
2955 |
+
try { x = e.clientX - space.left; y = e.clientY - space.top }
|
2956 |
+
catch (e) { return null }
|
2957 |
+
var coords = coordsChar(cm, x, y), line
|
2958 |
+
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
|
2959 |
+
var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
|
2960 |
+
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
|
2961 |
+
}
|
2962 |
+
return coords
|
2963 |
+
}
|
2964 |
+
|
2965 |
+
// Find the view element corresponding to a given line. Return null
|
2966 |
+
// when the line isn't visible.
|
2967 |
+
function findViewIndex(cm, n) {
|
2968 |
+
if (n >= cm.display.viewTo) { return null }
|
2969 |
+
n -= cm.display.viewFrom
|
2970 |
+
if (n < 0) { return null }
|
2971 |
+
var view = cm.display.view
|
2972 |
+
for (var i = 0; i < view.length; i++) {
|
2973 |
+
n -= view[i].size
|
2974 |
+
if (n < 0) { return i }
|
2975 |
+
}
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
function updateSelection(cm) {
|
2979 |
+
cm.display.input.showSelection(cm.display.input.prepareSelection())
|
2980 |
+
}
|
2981 |
+
|
2982 |
+
function prepareSelection(cm, primary) {
|
2983 |
+
var doc = cm.doc, result = {}
|
2984 |
+
var curFragment = result.cursors = document.createDocumentFragment()
|
2985 |
+
var selFragment = result.selection = document.createDocumentFragment()
|
2986 |
+
|
2987 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
2988 |
+
if (primary === false && i == doc.sel.primIndex) { continue }
|
2989 |
+
var range = doc.sel.ranges[i]
|
2990 |
+
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
|
2991 |
+
var collapsed = range.empty()
|
2992 |
+
if (collapsed || cm.options.showCursorWhenSelecting)
|
2993 |
+
{ drawSelectionCursor(cm, range.head, curFragment) }
|
2994 |
+
if (!collapsed)
|
2995 |
+
{ drawSelectionRange(cm, range, selFragment) }
|
2996 |
+
}
|
2997 |
+
return result
|
2998 |
+
}
|
2999 |
+
|
3000 |
+
// Draws a cursor for the given range
|
3001 |
+
function drawSelectionCursor(cm, head, output) {
|
3002 |
+
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
|
3003 |
+
|
3004 |
+
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
|
3005 |
+
cursor.style.left = pos.left + "px"
|
3006 |
+
cursor.style.top = pos.top + "px"
|
3007 |
+
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
|
3008 |
+
|
3009 |
+
if (pos.other) {
|
3010 |
+
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
3011 |
+
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
|
3012 |
+
otherCursor.style.display = ""
|
3013 |
+
otherCursor.style.left = pos.other.left + "px"
|
3014 |
+
otherCursor.style.top = pos.other.top + "px"
|
3015 |
+
otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"
|
3016 |
+
}
|
3017 |
+
}
|
3018 |
+
|
3019 |
+
// Draws the given range as a highlighted selection
|
3020 |
+
function drawSelectionRange(cm, range, output) {
|
3021 |
+
var display = cm.display, doc = cm.doc
|
3022 |
+
var fragment = document.createDocumentFragment()
|
3023 |
+
var padding = paddingH(cm.display), leftSide = padding.left
|
3024 |
+
var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right
|
3025 |
+
|
3026 |
+
function add(left, top, width, bottom) {
|
3027 |
+
if (top < 0) { top = 0 }
|
3028 |
+
top = Math.round(top)
|
3029 |
+
bottom = Math.round(bottom)
|
3030 |
+
fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")))
|
3031 |
+
}
|
3032 |
+
|
3033 |
+
function drawForLine(line, fromArg, toArg) {
|
3034 |
+
var lineObj = getLine(doc, line)
|
3035 |
+
var lineLen = lineObj.text.length
|
3036 |
+
var start, end
|
3037 |
+
function coords(ch, bias) {
|
3038 |
+
return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
|
3042 |
+
var leftPos = coords(from, "left"), rightPos, left, right
|
3043 |
+
if (from == to) {
|
3044 |
+
rightPos = leftPos
|
3045 |
+
left = right = leftPos.left
|
3046 |
+
} else {
|
3047 |
+
rightPos = coords(to - 1, "right")
|
3048 |
+
if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }
|
3049 |
+
left = leftPos.left
|
3050 |
+
right = rightPos.right
|
3051 |
+
}
|
3052 |
+
if (fromArg == null && from == 0) { left = leftSide }
|
3053 |
+
if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
|
3054 |
+
add(left, leftPos.top, null, leftPos.bottom)
|
3055 |
+
left = leftSide
|
3056 |
+
if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }
|
3057 |
+
}
|
3058 |
+
if (toArg == null && to == lineLen) { right = rightSide }
|
3059 |
+
if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
|
3060 |
+
{ start = leftPos }
|
3061 |
+
if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
|
3062 |
+
{ end = rightPos }
|
3063 |
+
if (left < leftSide + 1) { left = leftSide }
|
3064 |
+
add(left, rightPos.top, right - left, rightPos.bottom)
|
3065 |
+
})
|
3066 |
+
return {start: start, end: end}
|
3067 |
+
}
|
3068 |
+
|
3069 |
+
var sFrom = range.from(), sTo = range.to()
|
3070 |
+
if (sFrom.line == sTo.line) {
|
3071 |
+
drawForLine(sFrom.line, sFrom.ch, sTo.ch)
|
3072 |
+
} else {
|
3073 |
+
var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)
|
3074 |
+
var singleVLine = visualLine(fromLine) == visualLine(toLine)
|
3075 |
+
var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end
|
3076 |
+
var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start
|
3077 |
+
if (singleVLine) {
|
3078 |
+
if (leftEnd.top < rightStart.top - 2) {
|
3079 |
+
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)
|
3080 |
+
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)
|
3081 |
+
} else {
|
3082 |
+
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)
|
3083 |
+
}
|
3084 |
+
}
|
3085 |
+
if (leftEnd.bottom < rightStart.top)
|
3086 |
+
{ add(leftSide, leftEnd.bottom, null, rightStart.top) }
|
3087 |
+
}
|
3088 |
+
|
3089 |
+
output.appendChild(fragment)
|
3090 |
+
}
|
3091 |
+
|
3092 |
+
// Cursor-blinking
|
3093 |
+
function restartBlink(cm) {
|
3094 |
+
if (!cm.state.focused) { return }
|
3095 |
+
var display = cm.display
|
3096 |
+
clearInterval(display.blinker)
|
3097 |
+
var on = true
|
3098 |
+
display.cursorDiv.style.visibility = ""
|
3099 |
+
if (cm.options.cursorBlinkRate > 0)
|
3100 |
+
{ display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
|
3101 |
+
cm.options.cursorBlinkRate) }
|
3102 |
+
else if (cm.options.cursorBlinkRate < 0)
|
3103 |
+
{ display.cursorDiv.style.visibility = "hidden" }
|
3104 |
+
}
|
3105 |
+
|
3106 |
+
function ensureFocus(cm) {
|
3107 |
+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
|
3108 |
+
}
|
3109 |
+
|
3110 |
+
function delayBlurEvent(cm) {
|
3111 |
+
cm.state.delayingBlurEvent = true
|
3112 |
+
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
3113 |
+
cm.state.delayingBlurEvent = false
|
3114 |
+
onBlur(cm)
|
3115 |
+
} }, 100)
|
3116 |
+
}
|
3117 |
+
|
3118 |
+
function onFocus(cm, e) {
|
3119 |
+
if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false }
|
3120 |
+
|
3121 |
+
if (cm.options.readOnly == "nocursor") { return }
|
3122 |
+
if (!cm.state.focused) {
|
3123 |
+
signal(cm, "focus", cm, e)
|
3124 |
+
cm.state.focused = true
|
3125 |
+
addClass(cm.display.wrapper, "CodeMirror-focused")
|
3126 |
+
// This test prevents this from firing when a context
|
3127 |
+
// menu is closed (since the input reset would kill the
|
3128 |
+
// select-all detection hack)
|
3129 |
+
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
3130 |
+
cm.display.input.reset()
|
3131 |
+
if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730
|
3132 |
+
}
|
3133 |
+
cm.display.input.receivedFocus()
|
3134 |
+
}
|
3135 |
+
restartBlink(cm)
|
3136 |
+
}
|
3137 |
+
function onBlur(cm, e) {
|
3138 |
+
if (cm.state.delayingBlurEvent) { return }
|
3139 |
+
|
3140 |
+
if (cm.state.focused) {
|
3141 |
+
signal(cm, "blur", cm, e)
|
3142 |
+
cm.state.focused = false
|
3143 |
+
rmClass(cm.display.wrapper, "CodeMirror-focused")
|
3144 |
+
}
|
3145 |
+
clearInterval(cm.display.blinker)
|
3146 |
+
setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150)
|
3147 |
+
}
|
3148 |
+
|
3149 |
+
// Read the actual heights of the rendered lines, and update their
|
3150 |
+
// stored heights to match.
|
3151 |
+
function updateHeightsInViewport(cm) {
|
3152 |
+
var display = cm.display
|
3153 |
+
var prevBottom = display.lineDiv.offsetTop
|
3154 |
+
for (var i = 0; i < display.view.length; i++) {
|
3155 |
+
var cur = display.view[i], height = (void 0)
|
3156 |
+
if (cur.hidden) { continue }
|
3157 |
+
if (ie && ie_version < 8) {
|
3158 |
+
var bot = cur.node.offsetTop + cur.node.offsetHeight
|
3159 |
+
height = bot - prevBottom
|
3160 |
+
prevBottom = bot
|
3161 |
+
} else {
|
3162 |
+
var box = cur.node.getBoundingClientRect()
|
3163 |
+
height = box.bottom - box.top
|
3164 |
+
}
|
3165 |
+
var diff = cur.line.height - height
|
3166 |
+
if (height < 2) { height = textHeight(display) }
|
3167 |
+
if (diff > .001 || diff < -.001) {
|
3168 |
+
updateLineHeight(cur.line, height)
|
3169 |
+
updateWidgetHeight(cur.line)
|
3170 |
+
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
|
3171 |
+
{ updateWidgetHeight(cur.rest[j]) } }
|
3172 |
+
}
|
3173 |
+
}
|
3174 |
+
}
|
3175 |
+
|
3176 |
+
// Read and store the height of line widgets associated with the
|
3177 |
+
// given line.
|
3178 |
+
function updateWidgetHeight(line) {
|
3179 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
|
3180 |
+
{ line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }
|
3181 |
+
}
|
3182 |
+
|
3183 |
+
// Compute the lines that are visible in a given viewport (defaults
|
3184 |
+
// the the current scroll position). viewport may contain top,
|
3185 |
+
// height, and ensure (see op.scrollToPos) properties.
|
3186 |
+
function visibleLines(display, doc, viewport) {
|
3187 |
+
var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
|
3188 |
+
top = Math.floor(top - paddingTop(display))
|
3189 |
+
var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
|
3190 |
+
|
3191 |
+
var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
|
3192 |
+
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
3193 |
+
// forces those lines into the viewport (if possible).
|
3194 |
+
if (viewport && viewport.ensure) {
|
3195 |
+
var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
|
3196 |
+
if (ensureFrom < from) {
|
3197 |
+
from = ensureFrom
|
3198 |
+
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
|
3199 |
+
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
3200 |
+
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
|
3201 |
+
to = ensureTo
|
3202 |
+
}
|
3203 |
+
}
|
3204 |
+
return {from: from, to: Math.max(to, from + 1)}
|
3205 |
+
}
|
3206 |
+
|
3207 |
+
// Re-align line numbers and gutter marks to compensate for
|
3208 |
+
// horizontal scrolling.
|
3209 |
+
function alignHorizontally(cm) {
|
3210 |
+
var display = cm.display, view = display.view
|
3211 |
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
|
3212 |
+
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
|
3213 |
+
var gutterW = display.gutters.offsetWidth, left = comp + "px"
|
3214 |
+
for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
|
3215 |
+
if (cm.options.fixedGutter) {
|
3216 |
+
if (view[i].gutter)
|
3217 |
+
{ view[i].gutter.style.left = left }
|
3218 |
+
if (view[i].gutterBackground)
|
3219 |
+
{ view[i].gutterBackground.style.left = left }
|
3220 |
+
}
|
3221 |
+
var align = view[i].alignable
|
3222 |
+
if (align) { for (var j = 0; j < align.length; j++)
|
3223 |
+
{ align[j].style.left = left } }
|
3224 |
+
} }
|
3225 |
+
if (cm.options.fixedGutter)
|
3226 |
+
{ display.gutters.style.left = (comp + gutterW) + "px" }
|
3227 |
+
}
|
3228 |
+
|
3229 |
+
// Used to ensure that the line number gutter is still the right
|
3230 |
+
// size for the current document size. Returns true when an update
|
3231 |
+
// is needed.
|
3232 |
+
function maybeUpdateLineNumberWidth(cm) {
|
3233 |
+
if (!cm.options.lineNumbers) { return false }
|
3234 |
+
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
|
3235 |
+
if (last.length != display.lineNumChars) {
|
3236 |
+
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
3237 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt"))
|
3238 |
+
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
|
3239 |
+
display.lineGutter.style.width = ""
|
3240 |
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
|
3241 |
+
display.lineNumWidth = display.lineNumInnerWidth + padding
|
3242 |
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
|
3243 |
+
display.lineGutter.style.width = display.lineNumWidth + "px"
|
3244 |
+
updateGutterSpace(cm)
|
3245 |
+
return true
|
3246 |
+
}
|
3247 |
+
return false
|
3248 |
+
}
|
3249 |
+
|
3250 |
+
// SCROLLING THINGS INTO VIEW
|
3251 |
+
|
3252 |
+
// If an editor sits on the top or bottom of the window, partially
|
3253 |
+
// scrolled out of view, this ensures that the cursor is visible.
|
3254 |
+
function maybeScrollWindow(cm, rect) {
|
3255 |
+
if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
|
3256 |
+
|
3257 |
+
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null
|
3258 |
+
if (rect.top + box.top < 0) { doScroll = true }
|
3259 |
+
else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false }
|
3260 |
+
if (doScroll != null && !phantom) {
|
3261 |
+
var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"))
|
3262 |
+
cm.display.lineSpace.appendChild(scrollNode)
|
3263 |
+
scrollNode.scrollIntoView(doScroll)
|
3264 |
+
cm.display.lineSpace.removeChild(scrollNode)
|
3265 |
+
}
|
3266 |
+
}
|
3267 |
+
|
3268 |
+
// Scroll a given position into view (immediately), verifying that
|
3269 |
+
// it actually became visible (as line heights are accurately
|
3270 |
+
// measured, the position of something may 'drift' during drawing).
|
3271 |
+
function scrollPosIntoView(cm, pos, end, margin) {
|
3272 |
+
if (margin == null) { margin = 0 }
|
3273 |
+
var rect
|
3274 |
+
for (var limit = 0; limit < 5; limit++) {
|
3275 |
+
var changed = false
|
3276 |
+
var coords = cursorCoords(cm, pos)
|
3277 |
+
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)
|
3278 |
+
rect = {left: Math.min(coords.left, endCoords.left),
|
3279 |
+
top: Math.min(coords.top, endCoords.top) - margin,
|
3280 |
+
right: Math.max(coords.left, endCoords.left),
|
3281 |
+
bottom: Math.max(coords.bottom, endCoords.bottom) + margin}
|
3282 |
+
var scrollPos = calculateScrollPos(cm, rect)
|
3283 |
+
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft
|
3284 |
+
if (scrollPos.scrollTop != null) {
|
3285 |
+
updateScrollTop(cm, scrollPos.scrollTop)
|
3286 |
+
if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }
|
3287 |
+
}
|
3288 |
+
if (scrollPos.scrollLeft != null) {
|
3289 |
+
setScrollLeft(cm, scrollPos.scrollLeft)
|
3290 |
+
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }
|
3291 |
+
}
|
3292 |
+
if (!changed) { break }
|
3293 |
+
}
|
3294 |
+
return rect
|
3295 |
+
}
|
3296 |
+
|
3297 |
+
// Scroll a given set of coordinates into view (immediately).
|
3298 |
+
function scrollIntoView(cm, rect) {
|
3299 |
+
var scrollPos = calculateScrollPos(cm, rect)
|
3300 |
+
if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop) }
|
3301 |
+
if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }
|
3302 |
+
}
|
3303 |
+
|
3304 |
+
// Calculate a new scroll position needed to scroll the given
|
3305 |
+
// rectangle into view. Returns an object with scrollTop and
|
3306 |
+
// scrollLeft properties. When these are undefined, the
|
3307 |
+
// vertical/horizontal position does not need to be adjusted.
|
3308 |
+
function calculateScrollPos(cm, rect) {
|
3309 |
+
var display = cm.display, snapMargin = textHeight(cm.display)
|
3310 |
+
if (rect.top < 0) { rect.top = 0 }
|
3311 |
+
var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop
|
3312 |
+
var screen = displayHeight(cm), result = {}
|
3313 |
+
if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen }
|
3314 |
+
var docBottom = cm.doc.height + paddingVert(display)
|
3315 |
+
var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin
|
3316 |
+
if (rect.top < screentop) {
|
3317 |
+
result.scrollTop = atTop ? 0 : rect.top
|
3318 |
+
} else if (rect.bottom > screentop + screen) {
|
3319 |
+
var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)
|
3320 |
+
if (newTop != screentop) { result.scrollTop = newTop }
|
3321 |
+
}
|
3322 |
+
|
3323 |
+
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft
|
3324 |
+
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)
|
3325 |
+
var tooWide = rect.right - rect.left > screenw
|
3326 |
+
if (tooWide) { rect.right = rect.left + screenw }
|
3327 |
+
if (rect.left < 10)
|
3328 |
+
{ result.scrollLeft = 0 }
|
3329 |
+
else if (rect.left < screenleft)
|
3330 |
+
{ result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)) }
|
3331 |
+
else if (rect.right > screenw + screenleft - 3)
|
3332 |
+
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw }
|
3333 |
+
return result
|
3334 |
+
}
|
3335 |
+
|
3336 |
+
// Store a relative adjustment to the scroll position in the current
|
3337 |
+
// operation (to be applied when the operation finishes).
|
3338 |
+
function addToScrollTop(cm, top) {
|
3339 |
+
if (top == null) { return }
|
3340 |
+
resolveScrollToPos(cm)
|
3341 |
+
cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top
|
3342 |
+
}
|
3343 |
+
|
3344 |
+
// Make sure that at the end of the operation the current cursor is
|
3345 |
+
// shown.
|
3346 |
+
function ensureCursorVisible(cm) {
|
3347 |
+
resolveScrollToPos(cm)
|
3348 |
+
var cur = cm.getCursor(), from = cur, to = cur
|
3349 |
+
if (!cm.options.lineWrapping) {
|
3350 |
+
from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur
|
3351 |
+
to = Pos(cur.line, cur.ch + 1)
|
3352 |
+
}
|
3353 |
+
cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin}
|
3354 |
+
}
|
3355 |
+
|
3356 |
+
function scrollToCoords(cm, x, y) {
|
3357 |
+
if (x != null || y != null) { resolveScrollToPos(cm) }
|
3358 |
+
if (x != null) { cm.curOp.scrollLeft = x }
|
3359 |
+
if (y != null) { cm.curOp.scrollTop = y }
|
3360 |
+
}
|
3361 |
+
|
3362 |
+
function scrollToRange(cm, range) {
|
3363 |
+
resolveScrollToPos(cm)
|
3364 |
+
cm.curOp.scrollToPos = range
|
3365 |
+
}
|
3366 |
+
|
3367 |
+
// When an operation has its scrollToPos property set, and another
|
3368 |
+
// scroll action is applied before the end of the operation, this
|
3369 |
+
// 'simulates' scrolling that position into view in a cheap way, so
|
3370 |
+
// that the effect of intermediate scroll commands is not ignored.
|
3371 |
+
function resolveScrollToPos(cm) {
|
3372 |
+
var range = cm.curOp.scrollToPos
|
3373 |
+
if (range) {
|
3374 |
+
cm.curOp.scrollToPos = null
|
3375 |
+
var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)
|
3376 |
+
scrollToCoordsRange(cm, from, to, range.margin)
|
3377 |
+
}
|
3378 |
+
}
|
3379 |
+
|
3380 |
+
function scrollToCoordsRange(cm, from, to, margin) {
|
3381 |
+
var sPos = calculateScrollPos(cm, {
|
3382 |
+
left: Math.min(from.left, to.left),
|
3383 |
+
top: Math.min(from.top, to.top) - margin,
|
3384 |
+
right: Math.max(from.right, to.right),
|
3385 |
+
bottom: Math.max(from.bottom, to.bottom) + margin
|
3386 |
+
})
|
3387 |
+
scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop)
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
// Sync the scrollable area and scrollbars, ensure the viewport
|
3391 |
+
// covers the visible area.
|
3392 |
+
function updateScrollTop(cm, val) {
|
3393 |
+
if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
|
3394 |
+
if (!gecko) { updateDisplaySimple(cm, {top: val}) }
|
3395 |
+
setScrollTop(cm, val, true)
|
3396 |
+
if (gecko) { updateDisplaySimple(cm) }
|
3397 |
+
startWorker(cm, 100)
|
3398 |
+
}
|
3399 |
+
|
3400 |
+
function setScrollTop(cm, val, forceScroll) {
|
3401 |
+
val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)
|
3402 |
+
if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
|
3403 |
+
cm.doc.scrollTop = val
|
3404 |
+
cm.display.scrollbars.setScrollTop(val)
|
3405 |
+
if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val }
|
3406 |
+
}
|
3407 |
+
|
3408 |
+
// Sync scroller and scrollbar, ensure the gutter elements are
|
3409 |
+
// aligned.
|
3410 |
+
function setScrollLeft(cm, val, isScroller, forceScroll) {
|
3411 |
+
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)
|
3412 |
+
if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
|
3413 |
+
cm.doc.scrollLeft = val
|
3414 |
+
alignHorizontally(cm)
|
3415 |
+
if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val }
|
3416 |
+
cm.display.scrollbars.setScrollLeft(val)
|
3417 |
+
}
|
3418 |
+
|
3419 |
+
// SCROLLBARS
|
3420 |
+
|
3421 |
+
// Prepare DOM reads needed to update the scrollbars. Done in one
|
3422 |
+
// shot to minimize update/measure roundtrips.
|
3423 |
+
function measureForScrollbars(cm) {
|
3424 |
+
var d = cm.display, gutterW = d.gutters.offsetWidth
|
3425 |
+
var docH = Math.round(cm.doc.height + paddingVert(cm.display))
|
3426 |
+
return {
|
3427 |
+
clientHeight: d.scroller.clientHeight,
|
3428 |
+
viewHeight: d.wrapper.clientHeight,
|
3429 |
+
scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
|
3430 |
+
viewWidth: d.wrapper.clientWidth,
|
3431 |
+
barLeft: cm.options.fixedGutter ? gutterW : 0,
|
3432 |
+
docHeight: docH,
|
3433 |
+
scrollHeight: docH + scrollGap(cm) + d.barHeight,
|
3434 |
+
nativeBarWidth: d.nativeBarWidth,
|
3435 |
+
gutterWidth: gutterW
|
3436 |
+
}
|
3437 |
+
}
|
3438 |
+
|
3439 |
+
var NativeScrollbars = function(place, scroll, cm) {
|
3440 |
+
this.cm = cm
|
3441 |
+
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
|
3442 |
+
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
|
3443 |
+
place(vert); place(horiz)
|
3444 |
+
|
3445 |
+
on(vert, "scroll", function () {
|
3446 |
+
if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") }
|
3447 |
+
})
|
3448 |
+
on(horiz, "scroll", function () {
|
3449 |
+
if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") }
|
3450 |
+
})
|
3451 |
+
|
3452 |
+
this.checkedZeroWidth = false
|
3453 |
+
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
3454 |
+
if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" }
|
3455 |
+
};
|
3456 |
+
|
3457 |
+
NativeScrollbars.prototype.update = function (measure) {
|
3458 |
+
var needsH = measure.scrollWidth > measure.clientWidth + 1
|
3459 |
+
var needsV = measure.scrollHeight > measure.clientHeight + 1
|
3460 |
+
var sWidth = measure.nativeBarWidth
|
3461 |
+
|
3462 |
+
if (needsV) {
|
3463 |
+
this.vert.style.display = "block"
|
3464 |
+
this.vert.style.bottom = needsH ? sWidth + "px" : "0"
|
3465 |
+
var totalHeight = measure.viewHeight - (needsH ? sWidth : 0)
|
3466 |
+
// A bug in IE8 can cause this value to be negative, so guard it.
|
3467 |
+
this.vert.firstChild.style.height =
|
3468 |
+
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"
|
3469 |
+
} else {
|
3470 |
+
this.vert.style.display = ""
|
3471 |
+
this.vert.firstChild.style.height = "0"
|
3472 |
+
}
|
3473 |
+
|
3474 |
+
if (needsH) {
|
3475 |
+
this.horiz.style.display = "block"
|
3476 |
+
this.horiz.style.right = needsV ? sWidth + "px" : "0"
|
3477 |
+
this.horiz.style.left = measure.barLeft + "px"
|
3478 |
+
var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)
|
3479 |
+
this.horiz.firstChild.style.width =
|
3480 |
+
Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"
|
3481 |
+
} else {
|
3482 |
+
this.horiz.style.display = ""
|
3483 |
+
this.horiz.firstChild.style.width = "0"
|
3484 |
+
}
|
3485 |
+
|
3486 |
+
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
|
3487 |
+
if (sWidth == 0) { this.zeroWidthHack() }
|
3488 |
+
this.checkedZeroWidth = true
|
3489 |
+
}
|
3490 |
+
|
3491 |
+
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
|
3492 |
+
};
|
3493 |
+
|
3494 |
+
NativeScrollbars.prototype.setScrollLeft = function (pos) {
|
3495 |
+
if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos }
|
3496 |
+
if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") }
|
3497 |
+
};
|
3498 |
+
|
3499 |
+
NativeScrollbars.prototype.setScrollTop = function (pos) {
|
3500 |
+
if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos }
|
3501 |
+
if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert") }
|
3502 |
+
};
|
3503 |
+
|
3504 |
+
NativeScrollbars.prototype.zeroWidthHack = function () {
|
3505 |
+
var w = mac && !mac_geMountainLion ? "12px" : "18px"
|
3506 |
+
this.horiz.style.height = this.vert.style.width = w
|
3507 |
+
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"
|
3508 |
+
this.disableHoriz = new Delayed
|
3509 |
+
this.disableVert = new Delayed
|
3510 |
+
};
|
3511 |
+
|
3512 |
+
NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
|
3513 |
+
bar.style.pointerEvents = "auto"
|
3514 |
+
function maybeDisable() {
|
3515 |
+
// To find out whether the scrollbar is still visible, we
|
3516 |
+
// check whether the element under the pixel in the bottom
|
3517 |
+
// right corner of the scrollbar box is the scrollbar box
|
3518 |
+
// itself (when the bar is still visible) or its filler child
|
3519 |
+
// (when the bar is hidden). If it is still visible, we keep
|
3520 |
+
// it enabled, if it's hidden, we disable pointer events.
|
3521 |
+
var box = bar.getBoundingClientRect()
|
3522 |
+
var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
|
3523 |
+
: document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)
|
3524 |
+
if (elt != bar) { bar.style.pointerEvents = "none" }
|
3525 |
+
else { delay.set(1000, maybeDisable) }
|
3526 |
+
}
|
3527 |
+
delay.set(1000, maybeDisable)
|
3528 |
+
};
|
3529 |
+
|
3530 |
+
NativeScrollbars.prototype.clear = function () {
|
3531 |
+
var parent = this.horiz.parentNode
|
3532 |
+
parent.removeChild(this.horiz)
|
3533 |
+
parent.removeChild(this.vert)
|
3534 |
+
};
|
3535 |
+
|
3536 |
+
var NullScrollbars = function () {};
|
3537 |
+
|
3538 |
+
NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
|
3539 |
+
NullScrollbars.prototype.setScrollLeft = function () {};
|
3540 |
+
NullScrollbars.prototype.setScrollTop = function () {};
|
3541 |
+
NullScrollbars.prototype.clear = function () {};
|
3542 |
+
|
3543 |
+
function updateScrollbars(cm, measure) {
|
3544 |
+
if (!measure) { measure = measureForScrollbars(cm) }
|
3545 |
+
var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight
|
3546 |
+
updateScrollbarsInner(cm, measure)
|
3547 |
+
for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
|
3548 |
+
if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
|
3549 |
+
{ updateHeightsInViewport(cm) }
|
3550 |
+
updateScrollbarsInner(cm, measureForScrollbars(cm))
|
3551 |
+
startWidth = cm.display.barWidth; startHeight = cm.display.barHeight
|
3552 |
+
}
|
3553 |
+
}
|
3554 |
+
|
3555 |
+
// Re-synchronize the fake scrollbars with the actual size of the
|
3556 |
+
// content.
|
3557 |
+
function updateScrollbarsInner(cm, measure) {
|
3558 |
+
var d = cm.display
|
3559 |
+
var sizes = d.scrollbars.update(measure)
|
3560 |
+
|
3561 |
+
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"
|
3562 |
+
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"
|
3563 |
+
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
|
3564 |
+
|
3565 |
+
if (sizes.right && sizes.bottom) {
|
3566 |
+
d.scrollbarFiller.style.display = "block"
|
3567 |
+
d.scrollbarFiller.style.height = sizes.bottom + "px"
|
3568 |
+
d.scrollbarFiller.style.width = sizes.right + "px"
|
3569 |
+
} else { d.scrollbarFiller.style.display = "" }
|
3570 |
+
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
3571 |
+
d.gutterFiller.style.display = "block"
|
3572 |
+
d.gutterFiller.style.height = sizes.bottom + "px"
|
3573 |
+
d.gutterFiller.style.width = measure.gutterWidth + "px"
|
3574 |
+
} else { d.gutterFiller.style.display = "" }
|
3575 |
+
}
|
3576 |
+
|
3577 |
+
var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}
|
3578 |
+
|
3579 |
+
function initScrollbars(cm) {
|
3580 |
+
if (cm.display.scrollbars) {
|
3581 |
+
cm.display.scrollbars.clear()
|
3582 |
+
if (cm.display.scrollbars.addClass)
|
3583 |
+
{ rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
|
3587 |
+
cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller)
|
3588 |
+
// Prevent clicks in the scrollbars from killing focus
|
3589 |
+
on(node, "mousedown", function () {
|
3590 |
+
if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0) }
|
3591 |
+
})
|
3592 |
+
node.setAttribute("cm-not-content", "true")
|
3593 |
+
}, function (pos, axis) {
|
3594 |
+
if (axis == "horizontal") { setScrollLeft(cm, pos) }
|
3595 |
+
else { updateScrollTop(cm, pos) }
|
3596 |
+
}, cm)
|
3597 |
+
if (cm.display.scrollbars.addClass)
|
3598 |
+
{ addClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
|
3599 |
+
}
|
3600 |
+
|
3601 |
+
// Operations are used to wrap a series of changes to the editor
|
3602 |
+
// state in such a way that each change won't have to update the
|
3603 |
+
// cursor and display (which would be awkward, slow, and
|
3604 |
+
// error-prone). Instead, display updates are batched and then all
|
3605 |
+
// combined and executed at once.
|
3606 |
+
|
3607 |
+
var nextOpId = 0
|
3608 |
+
// Start a new operation.
|
3609 |
+
function startOperation(cm) {
|
3610 |
+
cm.curOp = {
|
3611 |
+
cm: cm,
|
3612 |
+
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
3613 |
+
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
3614 |
+
forceUpdate: false, // Used to force a redraw
|
3615 |
+
updateInput: null, // Whether to reset the input textarea
|
3616 |
+
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
3617 |
+
changeObjs: null, // Accumulated changes, for firing change events
|
3618 |
+
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
3619 |
+
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
3620 |
+
selectionChanged: false, // Whether the selection needs to be redrawn
|
3621 |
+
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
3622 |
+
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
3623 |
+
scrollToPos: null, // Used to scroll to a specific position
|
3624 |
+
focus: false,
|
3625 |
+
id: ++nextOpId // Unique ID
|
3626 |
+
}
|
3627 |
+
pushOperation(cm.curOp)
|
3628 |
+
}
|
3629 |
+
|
3630 |
+
// Finish an operation, updating the display and signalling delayed events
|
3631 |
+
function endOperation(cm) {
|
3632 |
+
var op = cm.curOp
|
3633 |
+
finishOperation(op, function (group) {
|
3634 |
+
for (var i = 0; i < group.ops.length; i++)
|
3635 |
+
{ group.ops[i].cm.curOp = null }
|
3636 |
+
endOperations(group)
|
3637 |
+
})
|
3638 |
+
}
|
3639 |
+
|
3640 |
+
// The DOM updates done when an operation finishes are batched so
|
3641 |
+
// that the minimum number of relayouts are required.
|
3642 |
+
function endOperations(group) {
|
3643 |
+
var ops = group.ops
|
3644 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3645 |
+
{ endOperation_R1(ops[i]) }
|
3646 |
+
for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
|
3647 |
+
{ endOperation_W1(ops[i$1]) }
|
3648 |
+
for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
|
3649 |
+
{ endOperation_R2(ops[i$2]) }
|
3650 |
+
for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
|
3651 |
+
{ endOperation_W2(ops[i$3]) }
|
3652 |
+
for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
|
3653 |
+
{ endOperation_finish(ops[i$4]) }
|
3654 |
+
}
|
3655 |
+
|
3656 |
+
function endOperation_R1(op) {
|
3657 |
+
var cm = op.cm, display = cm.display
|
3658 |
+
maybeClipScrollbars(cm)
|
3659 |
+
if (op.updateMaxLine) { findMaxLine(cm) }
|
3660 |
+
|
3661 |
+
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
3662 |
+
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
3663 |
+
op.scrollToPos.to.line >= display.viewTo) ||
|
3664 |
+
display.maxLineChanged && cm.options.lineWrapping
|
3665 |
+
op.update = op.mustUpdate &&
|
3666 |
+
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
|
3667 |
+
}
|
3668 |
+
|
3669 |
+
function endOperation_W1(op) {
|
3670 |
+
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
|
3671 |
+
}
|
3672 |
+
|
3673 |
+
function endOperation_R2(op) {
|
3674 |
+
var cm = op.cm, display = cm.display
|
3675 |
+
if (op.updatedDisplay) { updateHeightsInViewport(cm) }
|
3676 |
+
|
3677 |
+
op.barMeasure = measureForScrollbars(cm)
|
3678 |
+
|
3679 |
+
// If the max line changed since it was last measured, measure it,
|
3680 |
+
// and ensure the document's width matches it.
|
3681 |
+
// updateDisplay_W2 will use these properties to do the actual resizing
|
3682 |
+
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
3683 |
+
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
|
3684 |
+
cm.display.sizerWidth = op.adjustWidthTo
|
3685 |
+
op.barMeasure.scrollWidth =
|
3686 |
+
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
|
3687 |
+
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
|
3688 |
+
}
|
3689 |
+
|
3690 |
+
if (op.updatedDisplay || op.selectionChanged)
|
3691 |
+
{ op.preparedSelection = display.input.prepareSelection(op.focus) }
|
3692 |
+
}
|
3693 |
+
|
3694 |
+
function endOperation_W2(op) {
|
3695 |
+
var cm = op.cm
|
3696 |
+
|
3697 |
+
if (op.adjustWidthTo != null) {
|
3698 |
+
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
|
3699 |
+
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
3700 |
+
{ setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) }
|
3701 |
+
cm.display.maxLineChanged = false
|
3702 |
+
}
|
3703 |
+
|
3704 |
+
var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())
|
3705 |
+
if (op.preparedSelection)
|
3706 |
+
{ cm.display.input.showSelection(op.preparedSelection, takeFocus) }
|
3707 |
+
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
3708 |
+
{ updateScrollbars(cm, op.barMeasure) }
|
3709 |
+
if (op.updatedDisplay)
|
3710 |
+
{ setDocumentHeight(cm, op.barMeasure) }
|
3711 |
+
|
3712 |
+
if (op.selectionChanged) { restartBlink(cm) }
|
3713 |
+
|
3714 |
+
if (cm.state.focused && op.updateInput)
|
3715 |
+
{ cm.display.input.reset(op.typing) }
|
3716 |
+
if (takeFocus) { ensureFocus(op.cm) }
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
function endOperation_finish(op) {
|
3720 |
+
var cm = op.cm, display = cm.display, doc = cm.doc
|
3721 |
+
|
3722 |
+
if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) }
|
3723 |
+
|
3724 |
+
// Abort mouse wheel delta measurement, when scrolling explicitly
|
3725 |
+
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
3726 |
+
{ display.wheelStartX = display.wheelStartY = null }
|
3727 |
+
|
3728 |
+
// Propagate the scroll position to the actual DOM scroller
|
3729 |
+
if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll) }
|
3730 |
+
|
3731 |
+
if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true) }
|
3732 |
+
// If we need to scroll a specific position into view, do so.
|
3733 |
+
if (op.scrollToPos) {
|
3734 |
+
var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
3735 |
+
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
|
3736 |
+
maybeScrollWindow(cm, rect)
|
3737 |
+
}
|
3738 |
+
|
3739 |
+
// Fire events for markers that are hidden/unidden by editing or
|
3740 |
+
// undoing
|
3741 |
+
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
|
3742 |
+
if (hidden) { for (var i = 0; i < hidden.length; ++i)
|
3743 |
+
{ if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } }
|
3744 |
+
if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
|
3745 |
+
{ if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } }
|
3746 |
+
|
3747 |
+
if (display.wrapper.offsetHeight)
|
3748 |
+
{ doc.scrollTop = cm.display.scroller.scrollTop }
|
3749 |
+
|
3750 |
+
// Fire change events, and delayed event handlers
|
3751 |
+
if (op.changeObjs)
|
3752 |
+
{ signal(cm, "changes", cm, op.changeObjs) }
|
3753 |
+
if (op.update)
|
3754 |
+
{ op.update.finish() }
|
3755 |
+
}
|
3756 |
+
|
3757 |
+
// Run the given function in an operation
|
3758 |
+
function runInOp(cm, f) {
|
3759 |
+
if (cm.curOp) { return f() }
|
3760 |
+
startOperation(cm)
|
3761 |
+
try { return f() }
|
3762 |
+
finally { endOperation(cm) }
|
3763 |
+
}
|
3764 |
+
// Wraps a function in an operation. Returns the wrapped function.
|
3765 |
+
function operation(cm, f) {
|
3766 |
+
return function() {
|
3767 |
+
if (cm.curOp) { return f.apply(cm, arguments) }
|
3768 |
+
startOperation(cm)
|
3769 |
+
try { return f.apply(cm, arguments) }
|
3770 |
+
finally { endOperation(cm) }
|
3771 |
+
}
|
3772 |
+
}
|
3773 |
+
// Used to add methods to editor and doc instances, wrapping them in
|
3774 |
+
// operations.
|
3775 |
+
function methodOp(f) {
|
3776 |
+
return function() {
|
3777 |
+
if (this.curOp) { return f.apply(this, arguments) }
|
3778 |
+
startOperation(this)
|
3779 |
+
try { return f.apply(this, arguments) }
|
3780 |
+
finally { endOperation(this) }
|
3781 |
+
}
|
3782 |
+
}
|
3783 |
+
function docMethodOp(f) {
|
3784 |
+
return function() {
|
3785 |
+
var cm = this.cm
|
3786 |
+
if (!cm || cm.curOp) { return f.apply(this, arguments) }
|
3787 |
+
startOperation(cm)
|
3788 |
+
try { return f.apply(this, arguments) }
|
3789 |
+
finally { endOperation(cm) }
|
3790 |
+
}
|
3791 |
+
}
|
3792 |
+
|
3793 |
+
// Updates the display.view data structure for a given change to the
|
3794 |
+
// document. From and to are in pre-change coordinates. Lendiff is
|
3795 |
+
// the amount of lines added or subtracted by the change. This is
|
3796 |
+
// used for changes that span multiple lines, or change the way
|
3797 |
+
// lines are divided into visual lines. regLineChange (below)
|
3798 |
+
// registers single-line changes.
|
3799 |
+
function regChange(cm, from, to, lendiff) {
|
3800 |
+
if (from == null) { from = cm.doc.first }
|
3801 |
+
if (to == null) { to = cm.doc.first + cm.doc.size }
|
3802 |
+
if (!lendiff) { lendiff = 0 }
|
3803 |
+
|
3804 |
+
var display = cm.display
|
3805 |
+
if (lendiff && to < display.viewTo &&
|
3806 |
+
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
3807 |
+
{ display.updateLineNumbers = from }
|
3808 |
+
|
3809 |
+
cm.curOp.viewChanged = true
|
3810 |
+
|
3811 |
+
if (from >= display.viewTo) { // Change after
|
3812 |
+
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
3813 |
+
{ resetView(cm) }
|
3814 |
+
} else if (to <= display.viewFrom) { // Change before
|
3815 |
+
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
3816 |
+
resetView(cm)
|
3817 |
+
} else {
|
3818 |
+
display.viewFrom += lendiff
|
3819 |
+
display.viewTo += lendiff
|
3820 |
+
}
|
3821 |
+
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
3822 |
+
resetView(cm)
|
3823 |
+
} else if (from <= display.viewFrom) { // Top overlap
|
3824 |
+
var cut = viewCuttingPoint(cm, to, to + lendiff, 1)
|
3825 |
+
if (cut) {
|
3826 |
+
display.view = display.view.slice(cut.index)
|
3827 |
+
display.viewFrom = cut.lineN
|
3828 |
+
display.viewTo += lendiff
|
3829 |
+
} else {
|
3830 |
+
resetView(cm)
|
3831 |
+
}
|
3832 |
+
} else if (to >= display.viewTo) { // Bottom overlap
|
3833 |
+
var cut$1 = viewCuttingPoint(cm, from, from, -1)
|
3834 |
+
if (cut$1) {
|
3835 |
+
display.view = display.view.slice(0, cut$1.index)
|
3836 |
+
display.viewTo = cut$1.lineN
|
3837 |
+
} else {
|
3838 |
+
resetView(cm)
|
3839 |
+
}
|
3840 |
+
} else { // Gap in the middle
|
3841 |
+
var cutTop = viewCuttingPoint(cm, from, from, -1)
|
3842 |
+
var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
|
3843 |
+
if (cutTop && cutBot) {
|
3844 |
+
display.view = display.view.slice(0, cutTop.index)
|
3845 |
+
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
3846 |
+
.concat(display.view.slice(cutBot.index))
|
3847 |
+
display.viewTo += lendiff
|
3848 |
+
} else {
|
3849 |
+
resetView(cm)
|
3850 |
+
}
|
3851 |
+
}
|
3852 |
+
|
3853 |
+
var ext = display.externalMeasured
|
3854 |
+
if (ext) {
|
3855 |
+
if (to < ext.lineN)
|
3856 |
+
{ ext.lineN += lendiff }
|
3857 |
+
else if (from < ext.lineN + ext.size)
|
3858 |
+
{ display.externalMeasured = null }
|
3859 |
+
}
|
3860 |
+
}
|
3861 |
+
|
3862 |
+
// Register a change to a single line. Type must be one of "text",
|
3863 |
+
// "gutter", "class", "widget"
|
3864 |
+
function regLineChange(cm, line, type) {
|
3865 |
+
cm.curOp.viewChanged = true
|
3866 |
+
var display = cm.display, ext = cm.display.externalMeasured
|
3867 |
+
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
3868 |
+
{ display.externalMeasured = null }
|
3869 |
+
|
3870 |
+
if (line < display.viewFrom || line >= display.viewTo) { return }
|
3871 |
+
var lineView = display.view[findViewIndex(cm, line)]
|
3872 |
+
if (lineView.node == null) { return }
|
3873 |
+
var arr = lineView.changes || (lineView.changes = [])
|
3874 |
+
if (indexOf(arr, type) == -1) { arr.push(type) }
|
3875 |
+
}
|
3876 |
+
|
3877 |
+
// Clear the view.
|
3878 |
+
function resetView(cm) {
|
3879 |
+
cm.display.viewFrom = cm.display.viewTo = cm.doc.first
|
3880 |
+
cm.display.view = []
|
3881 |
+
cm.display.viewOffset = 0
|
3882 |
+
}
|
3883 |
+
|
3884 |
+
function viewCuttingPoint(cm, oldN, newN, dir) {
|
3885 |
+
var index = findViewIndex(cm, oldN), diff, view = cm.display.view
|
3886 |
+
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
3887 |
+
{ return {index: index, lineN: newN} }
|
3888 |
+
var n = cm.display.viewFrom
|
3889 |
+
for (var i = 0; i < index; i++)
|
3890 |
+
{ n += view[i].size }
|
3891 |
+
if (n != oldN) {
|
3892 |
+
if (dir > 0) {
|
3893 |
+
if (index == view.length - 1) { return null }
|
3894 |
+
diff = (n + view[index].size) - oldN
|
3895 |
+
index++
|
3896 |
+
} else {
|
3897 |
+
diff = n - oldN
|
3898 |
+
}
|
3899 |
+
oldN += diff; newN += diff
|
3900 |
+
}
|
3901 |
+
while (visualLineNo(cm.doc, newN) != newN) {
|
3902 |
+
if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
|
3903 |
+
newN += dir * view[index - (dir < 0 ? 1 : 0)].size
|
3904 |
+
index += dir
|
3905 |
+
}
|
3906 |
+
return {index: index, lineN: newN}
|
3907 |
+
}
|
3908 |
+
|
3909 |
+
// Force the view to cover a given range, adding empty view element
|
3910 |
+
// or clipping off existing ones as needed.
|
3911 |
+
function adjustView(cm, from, to) {
|
3912 |
+
var display = cm.display, view = display.view
|
3913 |
+
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
3914 |
+
display.view = buildViewArray(cm, from, to)
|
3915 |
+
display.viewFrom = from
|
3916 |
+
} else {
|
3917 |
+
if (display.viewFrom > from)
|
3918 |
+
{ display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) }
|
3919 |
+
else if (display.viewFrom < from)
|
3920 |
+
{ display.view = display.view.slice(findViewIndex(cm, from)) }
|
3921 |
+
display.viewFrom = from
|
3922 |
+
if (display.viewTo < to)
|
3923 |
+
{ display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) }
|
3924 |
+
else if (display.viewTo > to)
|
3925 |
+
{ display.view = display.view.slice(0, findViewIndex(cm, to)) }
|
3926 |
+
}
|
3927 |
+
display.viewTo = to
|
3928 |
+
}
|
3929 |
+
|
3930 |
+
// Count the number of lines in the view whose DOM representation is
|
3931 |
+
// out of date (or nonexistent).
|
3932 |
+
function countDirtyView(cm) {
|
3933 |
+
var view = cm.display.view, dirty = 0
|
3934 |
+
for (var i = 0; i < view.length; i++) {
|
3935 |
+
var lineView = view[i]
|
3936 |
+
if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }
|
3937 |
+
}
|
3938 |
+
return dirty
|
3939 |
+
}
|
3940 |
+
|
3941 |
+
// HIGHLIGHT WORKER
|
3942 |
+
|
3943 |
+
function startWorker(cm, time) {
|
3944 |
+
if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
|
3945 |
+
{ cm.state.highlight.set(time, bind(highlightWorker, cm)) }
|
3946 |
+
}
|
3947 |
+
|
3948 |
+
function highlightWorker(cm) {
|
3949 |
+
var doc = cm.doc
|
3950 |
+
if (doc.frontier < doc.first) { doc.frontier = doc.first }
|
3951 |
+
if (doc.frontier >= cm.display.viewTo) { return }
|
3952 |
+
var end = +new Date + cm.options.workTime
|
3953 |
+
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier))
|
3954 |
+
var changedLines = []
|
3955 |
+
|
3956 |
+
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
|
3957 |
+
if (doc.frontier >= cm.display.viewFrom) { // Visible
|
3958 |
+
var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength
|
3959 |
+
var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true)
|
3960 |
+
line.styles = highlighted.styles
|
3961 |
+
var oldCls = line.styleClasses, newCls = highlighted.classes
|
3962 |
+
if (newCls) { line.styleClasses = newCls }
|
3963 |
+
else if (oldCls) { line.styleClasses = null }
|
3964 |
+
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
3965 |
+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
|
3966 |
+
for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] }
|
3967 |
+
if (ischange) { changedLines.push(doc.frontier) }
|
3968 |
+
line.stateAfter = tooLong ? state : copyState(doc.mode, state)
|
3969 |
+
} else {
|
3970 |
+
if (line.text.length <= cm.options.maxHighlightLength)
|
3971 |
+
{ processLine(cm, line.text, state) }
|
3972 |
+
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null
|
3973 |
+
}
|
3974 |
+
++doc.frontier
|
3975 |
+
if (+new Date > end) {
|
3976 |
+
startWorker(cm, cm.options.workDelay)
|
3977 |
+
return true
|
3978 |
+
}
|
3979 |
+
})
|
3980 |
+
if (changedLines.length) { runInOp(cm, function () {
|
3981 |
+
for (var i = 0; i < changedLines.length; i++)
|
3982 |
+
{ regLineChange(cm, changedLines[i], "text") }
|
3983 |
+
}) }
|
3984 |
+
}
|
3985 |
+
|
3986 |
+
// DISPLAY DRAWING
|
3987 |
+
|
3988 |
+
var DisplayUpdate = function(cm, viewport, force) {
|
3989 |
+
var display = cm.display
|
3990 |
+
|
3991 |
+
this.viewport = viewport
|
3992 |
+
// Store some values that we'll need later (but don't want to force a relayout for)
|
3993 |
+
this.visible = visibleLines(display, cm.doc, viewport)
|
3994 |
+
this.editorIsHidden = !display.wrapper.offsetWidth
|
3995 |
+
this.wrapperHeight = display.wrapper.clientHeight
|
3996 |
+
this.wrapperWidth = display.wrapper.clientWidth
|
3997 |
+
this.oldDisplayWidth = displayWidth(cm)
|
3998 |
+
this.force = force
|
3999 |
+
this.dims = getDimensions(cm)
|
4000 |
+
this.events = []
|
4001 |
+
};
|
4002 |
+
|
4003 |
+
DisplayUpdate.prototype.signal = function (emitter, type) {
|
4004 |
+
if (hasHandler(emitter, type))
|
4005 |
+
{ this.events.push(arguments) }
|
4006 |
+
};
|
4007 |
+
DisplayUpdate.prototype.finish = function () {
|
4008 |
+
var this$1 = this;
|
4009 |
+
|
4010 |
+
for (var i = 0; i < this.events.length; i++)
|
4011 |
+
{ signal.apply(null, this$1.events[i]) }
|
4012 |
+
};
|
4013 |
+
|
4014 |
+
function maybeClipScrollbars(cm) {
|
4015 |
+
var display = cm.display
|
4016 |
+
if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
|
4017 |
+
display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth
|
4018 |
+
display.heightForcer.style.height = scrollGap(cm) + "px"
|
4019 |
+
display.sizer.style.marginBottom = -display.nativeBarWidth + "px"
|
4020 |
+
display.sizer.style.borderRightWidth = scrollGap(cm) + "px"
|
4021 |
+
display.scrollbarsClipped = true
|
4022 |
+
}
|
4023 |
+
}
|
4024 |
+
|
4025 |
+
function selectionSnapshot(cm) {
|
4026 |
+
if (cm.hasFocus()) { return null }
|
4027 |
+
var active = activeElt()
|
4028 |
+
if (!active || !contains(cm.display.lineDiv, active)) { return null }
|
4029 |
+
var result = {activeElt: active}
|
4030 |
+
if (window.getSelection) {
|
4031 |
+
var sel = window.getSelection()
|
4032 |
+
if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
|
4033 |
+
result.anchorNode = sel.anchorNode
|
4034 |
+
result.anchorOffset = sel.anchorOffset
|
4035 |
+
result.focusNode = sel.focusNode
|
4036 |
+
result.focusOffset = sel.focusOffset
|
4037 |
+
}
|
4038 |
+
}
|
4039 |
+
return result
|
4040 |
+
}
|
4041 |
+
|
4042 |
+
function restoreSelection(snapshot) {
|
4043 |
+
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
|
4044 |
+
snapshot.activeElt.focus()
|
4045 |
+
if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
|
4046 |
+
var sel = window.getSelection(), range = document.createRange()
|
4047 |
+
range.setEnd(snapshot.anchorNode, snapshot.anchorOffset)
|
4048 |
+
range.collapse(false)
|
4049 |
+
sel.removeAllRanges()
|
4050 |
+
sel.addRange(range)
|
4051 |
+
sel.extend(snapshot.focusNode, snapshot.focusOffset)
|
4052 |
+
}
|
4053 |
+
}
|
4054 |
+
|
4055 |
+
// Does the actual updating of the line display. Bails out
|
4056 |
+
// (returning false) when there is nothing to be done and forced is
|
4057 |
+
// false.
|
4058 |
+
function updateDisplayIfNeeded(cm, update) {
|
4059 |
+
var display = cm.display, doc = cm.doc
|
4060 |
+
|
4061 |
+
if (update.editorIsHidden) {
|
4062 |
+
resetView(cm)
|
4063 |
+
return false
|
4064 |
+
}
|
4065 |
+
|
4066 |
+
// Bail out if the visible area is already rendered and nothing changed.
|
4067 |
+
if (!update.force &&
|
4068 |
+
update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
|
4069 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
|
4070 |
+
display.renderedView == display.view && countDirtyView(cm) == 0)
|
4071 |
+
{ return false }
|
4072 |
+
|
4073 |
+
if (maybeUpdateLineNumberWidth(cm)) {
|
4074 |
+
resetView(cm)
|
4075 |
+
update.dims = getDimensions(cm)
|
4076 |
+
}
|
4077 |
+
|
4078 |
+
// Compute a suitable new viewport (from & to)
|
4079 |
+
var end = doc.first + doc.size
|
4080 |
+
var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)
|
4081 |
+
var to = Math.min(end, update.visible.to + cm.options.viewportMargin)
|
4082 |
+
if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }
|
4083 |
+
if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }
|
4084 |
+
if (sawCollapsedSpans) {
|
4085 |
+
from = visualLineNo(cm.doc, from)
|
4086 |
+
to = visualLineEndNo(cm.doc, to)
|
4087 |
+
}
|
4088 |
+
|
4089 |
+
var different = from != display.viewFrom || to != display.viewTo ||
|
4090 |
+
display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth
|
4091 |
+
adjustView(cm, from, to)
|
4092 |
+
|
4093 |
+
display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))
|
4094 |
+
// Position the mover div to align with the current scroll position
|
4095 |
+
cm.display.mover.style.top = display.viewOffset + "px"
|
4096 |
+
|
4097 |
+
var toUpdate = countDirtyView(cm)
|
4098 |
+
if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
|
4099 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
|
4100 |
+
{ return false }
|
4101 |
+
|
4102 |
+
// For big changes, we hide the enclosing element during the
|
4103 |
+
// update, since that speeds up the operations on most browsers.
|
4104 |
+
var selSnapshot = selectionSnapshot(cm)
|
4105 |
+
if (toUpdate > 4) { display.lineDiv.style.display = "none" }
|
4106 |
+
patchDisplay(cm, display.updateLineNumbers, update.dims)
|
4107 |
+
if (toUpdate > 4) { display.lineDiv.style.display = "" }
|
4108 |
+
display.renderedView = display.view
|
4109 |
+
// There might have been a widget with a focused element that got
|
4110 |
+
// hidden or updated, if so re-focus it.
|
4111 |
+
restoreSelection(selSnapshot)
|
4112 |
+
|
4113 |
+
// Prevent selection and cursors from interfering with the scroll
|
4114 |
+
// width and height.
|
4115 |
+
removeChildren(display.cursorDiv)
|
4116 |
+
removeChildren(display.selectionDiv)
|
4117 |
+
display.gutters.style.height = display.sizer.style.minHeight = 0
|
4118 |
+
|
4119 |
+
if (different) {
|
4120 |
+
display.lastWrapHeight = update.wrapperHeight
|
4121 |
+
display.lastWrapWidth = update.wrapperWidth
|
4122 |
+
startWorker(cm, 400)
|
4123 |
+
}
|
4124 |
+
|
4125 |
+
display.updateLineNumbers = null
|
4126 |
+
|
4127 |
+
return true
|
4128 |
+
}
|
4129 |
+
|
4130 |
+
function postUpdateDisplay(cm, update) {
|
4131 |
+
var viewport = update.viewport
|
4132 |
+
|
4133 |
+
for (var first = true;; first = false) {
|
4134 |
+
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
4135 |
+
// Clip forced viewport to actual scrollable area.
|
4136 |
+
if (viewport && viewport.top != null)
|
4137 |
+
{ viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} }
|
4138 |
+
// Updated line heights might result in the drawn area not
|
4139 |
+
// actually covering the viewport. Keep looping until it does.
|
4140 |
+
update.visible = visibleLines(cm.display, cm.doc, viewport)
|
4141 |
+
if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
|
4142 |
+
{ break }
|
4143 |
+
}
|
4144 |
+
if (!updateDisplayIfNeeded(cm, update)) { break }
|
4145 |
+
updateHeightsInViewport(cm)
|
4146 |
+
var barMeasure = measureForScrollbars(cm)
|
4147 |
+
updateSelection(cm)
|
4148 |
+
updateScrollbars(cm, barMeasure)
|
4149 |
+
setDocumentHeight(cm, barMeasure)
|
4150 |
+
}
|
4151 |
+
|
4152 |
+
update.signal(cm, "update", cm)
|
4153 |
+
if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
|
4154 |
+
update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo)
|
4155 |
+
cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo
|
4156 |
+
}
|
4157 |
+
}
|
4158 |
+
|
4159 |
+
function updateDisplaySimple(cm, viewport) {
|
4160 |
+
var update = new DisplayUpdate(cm, viewport)
|
4161 |
+
if (updateDisplayIfNeeded(cm, update)) {
|
4162 |
+
updateHeightsInViewport(cm)
|
4163 |
+
postUpdateDisplay(cm, update)
|
4164 |
+
var barMeasure = measureForScrollbars(cm)
|
4165 |
+
updateSelection(cm)
|
4166 |
+
updateScrollbars(cm, barMeasure)
|
4167 |
+
setDocumentHeight(cm, barMeasure)
|
4168 |
+
update.finish()
|
4169 |
+
}
|
4170 |
+
}
|
4171 |
+
|
4172 |
+
// Sync the actual display DOM structure with display.view, removing
|
4173 |
+
// nodes for lines that are no longer in view, and creating the ones
|
4174 |
+
// that are not there yet, and updating the ones that are out of
|
4175 |
+
// date.
|
4176 |
+
function patchDisplay(cm, updateNumbersFrom, dims) {
|
4177 |
+
var display = cm.display, lineNumbers = cm.options.lineNumbers
|
4178 |
+
var container = display.lineDiv, cur = container.firstChild
|
4179 |
+
|
4180 |
+
function rm(node) {
|
4181 |
+
var next = node.nextSibling
|
4182 |
+
// Works around a throw-scroll bug in OS X Webkit
|
4183 |
+
if (webkit && mac && cm.display.currentWheelTarget == node)
|
4184 |
+
{ node.style.display = "none" }
|
4185 |
+
else
|
4186 |
+
{ node.parentNode.removeChild(node) }
|
4187 |
+
return next
|
4188 |
+
}
|
4189 |
+
|
4190 |
+
var view = display.view, lineN = display.viewFrom
|
4191 |
+
// Loop over the elements in the view, syncing cur (the DOM nodes
|
4192 |
+
// in display.lineDiv) with the view as we go.
|
4193 |
+
for (var i = 0; i < view.length; i++) {
|
4194 |
+
var lineView = view[i]
|
4195 |
+
if (lineView.hidden) {
|
4196 |
+
} else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
|
4197 |
+
var node = buildLineElement(cm, lineView, lineN, dims)
|
4198 |
+
container.insertBefore(node, cur)
|
4199 |
+
} else { // Already drawn
|
4200 |
+
while (cur != lineView.node) { cur = rm(cur) }
|
4201 |
+
var updateNumber = lineNumbers && updateNumbersFrom != null &&
|
4202 |
+
updateNumbersFrom <= lineN && lineView.lineNumber
|
4203 |
+
if (lineView.changes) {
|
4204 |
+
if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false }
|
4205 |
+
updateLineForChanges(cm, lineView, lineN, dims)
|
4206 |
+
}
|
4207 |
+
if (updateNumber) {
|
4208 |
+
removeChildren(lineView.lineNumber)
|
4209 |
+
lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))
|
4210 |
+
}
|
4211 |
+
cur = lineView.node.nextSibling
|
4212 |
+
}
|
4213 |
+
lineN += lineView.size
|
4214 |
+
}
|
4215 |
+
while (cur) { cur = rm(cur) }
|
4216 |
+
}
|
4217 |
+
|
4218 |
+
function updateGutterSpace(cm) {
|
4219 |
+
var width = cm.display.gutters.offsetWidth
|
4220 |
+
cm.display.sizer.style.marginLeft = width + "px"
|
4221 |
+
}
|
4222 |
+
|
4223 |
+
function setDocumentHeight(cm, measure) {
|
4224 |
+
cm.display.sizer.style.minHeight = measure.docHeight + "px"
|
4225 |
+
cm.display.heightForcer.style.top = measure.docHeight + "px"
|
4226 |
+
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"
|
4227 |
+
}
|
4228 |
+
|
4229 |
+
// Rebuild the gutter elements, ensure the margin to the left of the
|
4230 |
+
// code matches their width.
|
4231 |
+
function updateGutters(cm) {
|
4232 |
+
var gutters = cm.display.gutters, specs = cm.options.gutters
|
4233 |
+
removeChildren(gutters)
|
4234 |
+
var i = 0
|
4235 |
+
for (; i < specs.length; ++i) {
|
4236 |
+
var gutterClass = specs[i]
|
4237 |
+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
|
4238 |
+
if (gutterClass == "CodeMirror-linenumbers") {
|
4239 |
+
cm.display.lineGutter = gElt
|
4240 |
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
|
4241 |
+
}
|
4242 |
+
}
|
4243 |
+
gutters.style.display = i ? "" : "none"
|
4244 |
+
updateGutterSpace(cm)
|
4245 |
+
}
|
4246 |
+
|
4247 |
+
// Make sure the gutters options contains the element
|
4248 |
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
4249 |
+
function setGuttersForLineNumbers(options) {
|
4250 |
+
var found = indexOf(options.gutters, "CodeMirror-linenumbers")
|
4251 |
+
if (found == -1 && options.lineNumbers) {
|
4252 |
+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
|
4253 |
+
} else if (found > -1 && !options.lineNumbers) {
|
4254 |
+
options.gutters = options.gutters.slice(0)
|
4255 |
+
options.gutters.splice(found, 1)
|
4256 |
+
}
|
4257 |
+
}
|
4258 |
+
|
4259 |
+
var wheelSamples = 0;
|
4260 |
+
var wheelPixelsPerUnit = null;
|
4261 |
+
// Fill in a browser-detected starting value on browsers where we
|
4262 |
+
// know one. These don't have to be accurate -- the result of them
|
4263 |
+
// being wrong would just be a slight flicker on the first wheel
|
4264 |
+
// scroll (if it is large enough).
|
4265 |
+
if (ie) { wheelPixelsPerUnit = -.53 }
|
4266 |
+
else if (gecko) { wheelPixelsPerUnit = 15 }
|
4267 |
+
else if (chrome) { wheelPixelsPerUnit = -.7 }
|
4268 |
+
else if (safari) { wheelPixelsPerUnit = -1/3 }
|
4269 |
+
|
4270 |
+
function wheelEventDelta(e) {
|
4271 |
+
var dx = e.wheelDeltaX, dy = e.wheelDeltaY
|
4272 |
+
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail }
|
4273 |
+
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail }
|
4274 |
+
else if (dy == null) { dy = e.wheelDelta }
|
4275 |
+
return {x: dx, y: dy}
|
4276 |
+
}
|
4277 |
+
function wheelEventPixels(e) {
|
4278 |
+
var delta = wheelEventDelta(e)
|
4279 |
+
delta.x *= wheelPixelsPerUnit
|
4280 |
+
delta.y *= wheelPixelsPerUnit
|
4281 |
+
return delta
|
4282 |
+
}
|
4283 |
+
|
4284 |
+
function onScrollWheel(cm, e) {
|
4285 |
+
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
|
4286 |
+
|
4287 |
+
var display = cm.display, scroll = display.scroller
|
4288 |
+
// Quit if there's nothing to scroll here
|
4289 |
+
var canScrollX = scroll.scrollWidth > scroll.clientWidth
|
4290 |
+
var canScrollY = scroll.scrollHeight > scroll.clientHeight
|
4291 |
+
if (!(dx && canScrollX || dy && canScrollY)) { return }
|
4292 |
+
|
4293 |
+
// Webkit browsers on OS X abort momentum scrolls when the target
|
4294 |
+
// of the scroll event is removed from the scrollable element.
|
4295 |
+
// This hack (see related code in patchDisplay) makes sure the
|
4296 |
+
// element is kept around.
|
4297 |
+
if (dy && mac && webkit) {
|
4298 |
+
outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
|
4299 |
+
for (var i = 0; i < view.length; i++) {
|
4300 |
+
if (view[i].node == cur) {
|
4301 |
+
cm.display.currentWheelTarget = cur
|
4302 |
+
break outer
|
4303 |
+
}
|
4304 |
+
}
|
4305 |
+
}
|
4306 |
+
}
|
4307 |
+
|
4308 |
+
// On some browsers, horizontal scrolling will cause redraws to
|
4309 |
+
// happen before the gutter has been realigned, causing it to
|
4310 |
+
// wriggle around in a most unseemly way. When we have an
|
4311 |
+
// estimated pixels/delta value, we just handle horizontal
|
4312 |
+
// scrolling entirely here. It'll be slightly off from native, but
|
4313 |
+
// better than glitching out.
|
4314 |
+
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
|
4315 |
+
if (dy && canScrollY)
|
4316 |
+
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)) }
|
4317 |
+
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit))
|
4318 |
+
// Only prevent default scrolling if vertical scrolling is
|
4319 |
+
// actually possible. Otherwise, it causes vertical scroll
|
4320 |
+
// jitter on OSX trackpads when deltaX is small and deltaY
|
4321 |
+
// is large (issue #3579)
|
4322 |
+
if (!dy || (dy && canScrollY))
|
4323 |
+
{ e_preventDefault(e) }
|
4324 |
+
display.wheelStartX = null // Abort measurement, if in progress
|
4325 |
+
return
|
4326 |
+
}
|
4327 |
+
|
4328 |
+
// 'Project' the visible viewport to cover the area that is being
|
4329 |
+
// scrolled into view (if we know enough to estimate it).
|
4330 |
+
if (dy && wheelPixelsPerUnit != null) {
|
4331 |
+
var pixels = dy * wheelPixelsPerUnit
|
4332 |
+
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight
|
4333 |
+
if (pixels < 0) { top = Math.max(0, top + pixels - 50) }
|
4334 |
+
else { bot = Math.min(cm.doc.height, bot + pixels + 50) }
|
4335 |
+
updateDisplaySimple(cm, {top: top, bottom: bot})
|
4336 |
+
}
|
4337 |
+
|
4338 |
+
if (wheelSamples < 20) {
|
4339 |
+
if (display.wheelStartX == null) {
|
4340 |
+
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
|
4341 |
+
display.wheelDX = dx; display.wheelDY = dy
|
4342 |
+
setTimeout(function () {
|
4343 |
+
if (display.wheelStartX == null) { return }
|
4344 |
+
var movedX = scroll.scrollLeft - display.wheelStartX
|
4345 |
+
var movedY = scroll.scrollTop - display.wheelStartY
|
4346 |
+
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
4347 |
+
(movedX && display.wheelDX && movedX / display.wheelDX)
|
4348 |
+
display.wheelStartX = display.wheelStartY = null
|
4349 |
+
if (!sample) { return }
|
4350 |
+
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)
|
4351 |
+
++wheelSamples
|
4352 |
+
}, 200)
|
4353 |
+
} else {
|
4354 |
+
display.wheelDX += dx; display.wheelDY += dy
|
4355 |
+
}
|
4356 |
+
}
|
4357 |
+
}
|
4358 |
+
|
4359 |
+
// Selection objects are immutable. A new one is created every time
|
4360 |
+
// the selection changes. A selection is one or more non-overlapping
|
4361 |
+
// (and non-touching) ranges, sorted, and an integer that indicates
|
4362 |
+
// which one is the primary selection (the one that's scrolled into
|
4363 |
+
// view, that getCursor returns, etc).
|
4364 |
+
var Selection = function(ranges, primIndex) {
|
4365 |
+
this.ranges = ranges
|
4366 |
+
this.primIndex = primIndex
|
4367 |
+
};
|
4368 |
+
|
4369 |
+
Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
|
4370 |
+
|
4371 |
+
Selection.prototype.equals = function (other) {
|
4372 |
+
var this$1 = this;
|
4373 |
+
|
4374 |
+
if (other == this) { return true }
|
4375 |
+
if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
|
4376 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4377 |
+
var here = this$1.ranges[i], there = other.ranges[i]
|
4378 |
+
if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
|
4379 |
+
}
|
4380 |
+
return true
|
4381 |
+
};
|
4382 |
+
|
4383 |
+
Selection.prototype.deepCopy = function () {
|
4384 |
+
var this$1 = this;
|
4385 |
+
|
4386 |
+
var out = []
|
4387 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4388 |
+
{ out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) }
|
4389 |
+
return new Selection(out, this.primIndex)
|
4390 |
+
};
|
4391 |
+
|
4392 |
+
Selection.prototype.somethingSelected = function () {
|
4393 |
+
var this$1 = this;
|
4394 |
+
|
4395 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4396 |
+
{ if (!this$1.ranges[i].empty()) { return true } }
|
4397 |
+
return false
|
4398 |
+
};
|
4399 |
+
|
4400 |
+
Selection.prototype.contains = function (pos, end) {
|
4401 |
+
var this$1 = this;
|
4402 |
+
|
4403 |
+
if (!end) { end = pos }
|
4404 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4405 |
+
var range = this$1.ranges[i]
|
4406 |
+
if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
|
4407 |
+
{ return i }
|
4408 |
+
}
|
4409 |
+
return -1
|
4410 |
+
};
|
4411 |
+
|
4412 |
+
var Range = function(anchor, head) {
|
4413 |
+
this.anchor = anchor; this.head = head
|
4414 |
+
};
|
4415 |
+
|
4416 |
+
Range.prototype.from = function () { return minPos(this.anchor, this.head) };
|
4417 |
+
Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
|
4418 |
+
Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
|
4419 |
+
|
4420 |
+
// Take an unsorted, potentially overlapping set of ranges, and
|
4421 |
+
// build a selection out of it. 'Consumes' ranges array (modifying
|
4422 |
+
// it).
|
4423 |
+
function normalizeSelection(ranges, primIndex) {
|
4424 |
+
var prim = ranges[primIndex]
|
4425 |
+
ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })
|
4426 |
+
primIndex = indexOf(ranges, prim)
|
4427 |
+
for (var i = 1; i < ranges.length; i++) {
|
4428 |
+
var cur = ranges[i], prev = ranges[i - 1]
|
4429 |
+
if (cmp(prev.to(), cur.from()) >= 0) {
|
4430 |
+
var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
|
4431 |
+
var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
|
4432 |
+
if (i <= primIndex) { --primIndex }
|
4433 |
+
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
|
4434 |
+
}
|
4435 |
+
}
|
4436 |
+
return new Selection(ranges, primIndex)
|
4437 |
+
}
|
4438 |
+
|
4439 |
+
function simpleSelection(anchor, head) {
|
4440 |
+
return new Selection([new Range(anchor, head || anchor)], 0)
|
4441 |
+
}
|
4442 |
+
|
4443 |
+
// Compute the position of the end of a change (its 'to' property
|
4444 |
+
// refers to the pre-change end).
|
4445 |
+
function changeEnd(change) {
|
4446 |
+
if (!change.text) { return change.to }
|
4447 |
+
return Pos(change.from.line + change.text.length - 1,
|
4448 |
+
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
|
4449 |
+
}
|
4450 |
+
|
4451 |
+
// Adjust a position to refer to the post-change position of the
|
4452 |
+
// same text, or the end of the change if the change covers it.
|
4453 |
+
function adjustForChange(pos, change) {
|
4454 |
+
if (cmp(pos, change.from) < 0) { return pos }
|
4455 |
+
if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
|
4456 |
+
|
4457 |
+
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
|
4458 |
+
if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }
|
4459 |
+
return Pos(line, ch)
|
4460 |
+
}
|
4461 |
+
|
4462 |
+
function computeSelAfterChange(doc, change) {
|
4463 |
+
var out = []
|
4464 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4465 |
+
var range = doc.sel.ranges[i]
|
4466 |
+
out.push(new Range(adjustForChange(range.anchor, change),
|
4467 |
+
adjustForChange(range.head, change)))
|
4468 |
+
}
|
4469 |
+
return normalizeSelection(out, doc.sel.primIndex)
|
4470 |
+
}
|
4471 |
+
|
4472 |
+
function offsetPos(pos, old, nw) {
|
4473 |
+
if (pos.line == old.line)
|
4474 |
+
{ return Pos(nw.line, pos.ch - old.ch + nw.ch) }
|
4475 |
+
else
|
4476 |
+
{ return Pos(nw.line + (pos.line - old.line), pos.ch) }
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
// Used by replaceSelections to allow moving the selection to the
|
4480 |
+
// start or around the replaced test. Hint may be "start" or "around".
|
4481 |
+
function computeReplacedSel(doc, changes, hint) {
|
4482 |
+
var out = []
|
4483 |
+
var oldPrev = Pos(doc.first, 0), newPrev = oldPrev
|
4484 |
+
for (var i = 0; i < changes.length; i++) {
|
4485 |
+
var change = changes[i]
|
4486 |
+
var from = offsetPos(change.from, oldPrev, newPrev)
|
4487 |
+
var to = offsetPos(changeEnd(change), oldPrev, newPrev)
|
4488 |
+
oldPrev = change.to
|
4489 |
+
newPrev = to
|
4490 |
+
if (hint == "around") {
|
4491 |
+
var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
|
4492 |
+
out[i] = new Range(inv ? to : from, inv ? from : to)
|
4493 |
+
} else {
|
4494 |
+
out[i] = new Range(from, from)
|
4495 |
+
}
|
4496 |
+
}
|
4497 |
+
return new Selection(out, doc.sel.primIndex)
|
4498 |
+
}
|
4499 |
+
|
4500 |
+
// Used to get the editor into a consistent state again when options change.
|
4501 |
+
|
4502 |
+
function loadMode(cm) {
|
4503 |
+
cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
|
4504 |
+
resetModeState(cm)
|
4505 |
+
}
|
4506 |
+
|
4507 |
+
function resetModeState(cm) {
|
4508 |
+
cm.doc.iter(function (line) {
|
4509 |
+
if (line.stateAfter) { line.stateAfter = null }
|
4510 |
+
if (line.styles) { line.styles = null }
|
4511 |
+
})
|
4512 |
+
cm.doc.frontier = cm.doc.first
|
4513 |
+
startWorker(cm, 100)
|
4514 |
+
cm.state.modeGen++
|
4515 |
+
if (cm.curOp) { regChange(cm) }
|
4516 |
+
}
|
4517 |
+
|
4518 |
+
// DOCUMENT DATA STRUCTURE
|
4519 |
+
|
4520 |
+
// By default, updates that start and end at the beginning of a line
|
4521 |
+
// are treated specially, in order to make the association of line
|
4522 |
+
// widgets and marker elements with the text behave more intuitive.
|
4523 |
+
function isWholeLineUpdate(doc, change) {
|
4524 |
+
return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
|
4525 |
+
(!doc.cm || doc.cm.options.wholeLineUpdateBefore)
|
4526 |
+
}
|
4527 |
+
|
4528 |
+
// Perform a change on the document data structure.
|
4529 |
+
function updateDoc(doc, change, markedSpans, estimateHeight) {
|
4530 |
+
function spansFor(n) {return markedSpans ? markedSpans[n] : null}
|
4531 |
+
function update(line, text, spans) {
|
4532 |
+
updateLine(line, text, spans, estimateHeight)
|
4533 |
+
signalLater(line, "change", line, change)
|
4534 |
+
}
|
4535 |
+
function linesFor(start, end) {
|
4536 |
+
var result = []
|
4537 |
+
for (var i = start; i < end; ++i)
|
4538 |
+
{ result.push(new Line(text[i], spansFor(i), estimateHeight)) }
|
4539 |
+
return result
|
4540 |
+
}
|
4541 |
+
|
4542 |
+
var from = change.from, to = change.to, text = change.text
|
4543 |
+
var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)
|
4544 |
+
var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line
|
4545 |
+
|
4546 |
+
// Adjust the line structure
|
4547 |
+
if (change.full) {
|
4548 |
+
doc.insert(0, linesFor(0, text.length))
|
4549 |
+
doc.remove(text.length, doc.size - text.length)
|
4550 |
+
} else if (isWholeLineUpdate(doc, change)) {
|
4551 |
+
// This is a whole-line replace. Treated specially to make
|
4552 |
+
// sure line objects move the way they are supposed to.
|
4553 |
+
var added = linesFor(0, text.length - 1)
|
4554 |
+
update(lastLine, lastLine.text, lastSpans)
|
4555 |
+
if (nlines) { doc.remove(from.line, nlines) }
|
4556 |
+
if (added.length) { doc.insert(from.line, added) }
|
4557 |
+
} else if (firstLine == lastLine) {
|
4558 |
+
if (text.length == 1) {
|
4559 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
|
4560 |
+
} else {
|
4561 |
+
var added$1 = linesFor(1, text.length - 1)
|
4562 |
+
added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
|
4563 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
|
4564 |
+
doc.insert(from.line + 1, added$1)
|
4565 |
+
}
|
4566 |
+
} else if (text.length == 1) {
|
4567 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
|
4568 |
+
doc.remove(from.line + 1, nlines)
|
4569 |
+
} else {
|
4570 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
|
4571 |
+
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
|
4572 |
+
var added$2 = linesFor(1, text.length - 1)
|
4573 |
+
if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }
|
4574 |
+
doc.insert(from.line + 1, added$2)
|
4575 |
+
}
|
4576 |
+
|
4577 |
+
signalLater(doc, "change", doc, change)
|
4578 |
+
}
|
4579 |
+
|
4580 |
+
// Call f for all linked documents.
|
4581 |
+
function linkedDocs(doc, f, sharedHistOnly) {
|
4582 |
+
function propagate(doc, skip, sharedHist) {
|
4583 |
+
if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
|
4584 |
+
var rel = doc.linked[i]
|
4585 |
+
if (rel.doc == skip) { continue }
|
4586 |
+
var shared = sharedHist && rel.sharedHist
|
4587 |
+
if (sharedHistOnly && !shared) { continue }
|
4588 |
+
f(rel.doc, shared)
|
4589 |
+
propagate(rel.doc, doc, shared)
|
4590 |
+
} }
|
4591 |
+
}
|
4592 |
+
propagate(doc, null, true)
|
4593 |
+
}
|
4594 |
+
|
4595 |
+
// Attach a document to an editor.
|
4596 |
+
function attachDoc(cm, doc) {
|
4597 |
+
if (doc.cm) { throw new Error("This document is already in use.") }
|
4598 |
+
cm.doc = doc
|
4599 |
+
doc.cm = cm
|
4600 |
+
estimateLineHeights(cm)
|
4601 |
+
loadMode(cm)
|
4602 |
+
setDirectionClass(cm)
|
4603 |
+
if (!cm.options.lineWrapping) { findMaxLine(cm) }
|
4604 |
+
cm.options.mode = doc.modeOption
|
4605 |
+
regChange(cm)
|
4606 |
+
}
|
4607 |
+
|
4608 |
+
function setDirectionClass(cm) {
|
4609 |
+
;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
|
4610 |
+
}
|
4611 |
+
|
4612 |
+
function directionChanged(cm) {
|
4613 |
+
runInOp(cm, function () {
|
4614 |
+
setDirectionClass(cm)
|
4615 |
+
regChange(cm)
|
4616 |
+
})
|
4617 |
+
}
|
4618 |
+
|
4619 |
+
function History(startGen) {
|
4620 |
+
// Arrays of change events and selections. Doing something adds an
|
4621 |
+
// event to done and clears undo. Undoing moves events from done
|
4622 |
+
// to undone, redoing moves them in the other direction.
|
4623 |
+
this.done = []; this.undone = []
|
4624 |
+
this.undoDepth = Infinity
|
4625 |
+
// Used to track when changes can be merged into a single undo
|
4626 |
+
// event
|
4627 |
+
this.lastModTime = this.lastSelTime = 0
|
4628 |
+
this.lastOp = this.lastSelOp = null
|
4629 |
+
this.lastOrigin = this.lastSelOrigin = null
|
4630 |
+
// Used by the isClean() method
|
4631 |
+
this.generation = this.maxGeneration = startGen || 1
|
4632 |
+
}
|
4633 |
+
|
4634 |
+
// Create a history change event from an updateDoc-style change
|
4635 |
+
// object.
|
4636 |
+
function historyChangeFromChange(doc, change) {
|
4637 |
+
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}
|
4638 |
+
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)
|
4639 |
+
linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)
|
4640 |
+
return histChange
|
4641 |
+
}
|
4642 |
+
|
4643 |
+
// Pop all selection events off the end of a history array. Stop at
|
4644 |
+
// a change event.
|
4645 |
+
function clearSelectionEvents(array) {
|
4646 |
+
while (array.length) {
|
4647 |
+
var last = lst(array)
|
4648 |
+
if (last.ranges) { array.pop() }
|
4649 |
+
else { break }
|
4650 |
+
}
|
4651 |
+
}
|
4652 |
+
|
4653 |
+
// Find the top change event in the history. Pop off selection
|
4654 |
+
// events that are in the way.
|
4655 |
+
function lastChangeEvent(hist, force) {
|
4656 |
+
if (force) {
|
4657 |
+
clearSelectionEvents(hist.done)
|
4658 |
+
return lst(hist.done)
|
4659 |
+
} else if (hist.done.length && !lst(hist.done).ranges) {
|
4660 |
+
return lst(hist.done)
|
4661 |
+
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
|
4662 |
+
hist.done.pop()
|
4663 |
+
return lst(hist.done)
|
4664 |
+
}
|
4665 |
+
}
|
4666 |
+
|
4667 |
+
// Register a change in the history. Merges changes that are within
|
4668 |
+
// a single operation, or are close together with an origin that
|
4669 |
+
// allows merging (starting with "+") into a single event.
|
4670 |
+
function addChangeToHistory(doc, change, selAfter, opId) {
|
4671 |
+
var hist = doc.history
|
4672 |
+
hist.undone.length = 0
|
4673 |
+
var time = +new Date, cur
|
4674 |
+
var last
|
4675 |
+
|
4676 |
+
if ((hist.lastOp == opId ||
|
4677 |
+
hist.lastOrigin == change.origin && change.origin &&
|
4678 |
+
((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
|
4679 |
+
change.origin.charAt(0) == "*")) &&
|
4680 |
+
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
|
4681 |
+
// Merge this change into the last event
|
4682 |
+
last = lst(cur.changes)
|
4683 |
+
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
|
4684 |
+
// Optimized case for simple insertion -- don't want to add
|
4685 |
+
// new changesets for every character typed
|
4686 |
+
last.to = changeEnd(change)
|
4687 |
+
} else {
|
4688 |
+
// Add new sub-event
|
4689 |
+
cur.changes.push(historyChangeFromChange(doc, change))
|
4690 |
+
}
|
4691 |
+
} else {
|
4692 |
+
// Can not be merged, start a new event.
|
4693 |
+
var before = lst(hist.done)
|
4694 |
+
if (!before || !before.ranges)
|
4695 |
+
{ pushSelectionToHistory(doc.sel, hist.done) }
|
4696 |
+
cur = {changes: [historyChangeFromChange(doc, change)],
|
4697 |
+
generation: hist.generation}
|
4698 |
+
hist.done.push(cur)
|
4699 |
+
while (hist.done.length > hist.undoDepth) {
|
4700 |
+
hist.done.shift()
|
4701 |
+
if (!hist.done[0].ranges) { hist.done.shift() }
|
4702 |
+
}
|
4703 |
+
}
|
4704 |
+
hist.done.push(selAfter)
|
4705 |
+
hist.generation = ++hist.maxGeneration
|
4706 |
+
hist.lastModTime = hist.lastSelTime = time
|
4707 |
+
hist.lastOp = hist.lastSelOp = opId
|
4708 |
+
hist.lastOrigin = hist.lastSelOrigin = change.origin
|
4709 |
+
|
4710 |
+
if (!last) { signal(doc, "historyAdded") }
|
4711 |
+
}
|
4712 |
+
|
4713 |
+
function selectionEventCanBeMerged(doc, origin, prev, sel) {
|
4714 |
+
var ch = origin.charAt(0)
|
4715 |
+
return ch == "*" ||
|
4716 |
+
ch == "+" &&
|
4717 |
+
prev.ranges.length == sel.ranges.length &&
|
4718 |
+
prev.somethingSelected() == sel.somethingSelected() &&
|
4719 |
+
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
|
4720 |
+
}
|
4721 |
+
|
4722 |
+
// Called whenever the selection changes, sets the new selection as
|
4723 |
+
// the pending selection in the history, and pushes the old pending
|
4724 |
+
// selection into the 'done' array when it was significantly
|
4725 |
+
// different (in number of selected ranges, emptiness, or time).
|
4726 |
+
function addSelectionToHistory(doc, sel, opId, options) {
|
4727 |
+
var hist = doc.history, origin = options && options.origin
|
4728 |
+
|
4729 |
+
// A new event is started when the previous origin does not match
|
4730 |
+
// the current, or the origins don't allow matching. Origins
|
4731 |
+
// starting with * are always merged, those starting with + are
|
4732 |
+
// merged when similar and close together in time.
|
4733 |
+
if (opId == hist.lastSelOp ||
|
4734 |
+
(origin && hist.lastSelOrigin == origin &&
|
4735 |
+
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
|
4736 |
+
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
|
4737 |
+
{ hist.done[hist.done.length - 1] = sel }
|
4738 |
+
else
|
4739 |
+
{ pushSelectionToHistory(sel, hist.done) }
|
4740 |
+
|
4741 |
+
hist.lastSelTime = +new Date
|
4742 |
+
hist.lastSelOrigin = origin
|
4743 |
+
hist.lastSelOp = opId
|
4744 |
+
if (options && options.clearRedo !== false)
|
4745 |
+
{ clearSelectionEvents(hist.undone) }
|
4746 |
+
}
|
4747 |
+
|
4748 |
+
function pushSelectionToHistory(sel, dest) {
|
4749 |
+
var top = lst(dest)
|
4750 |
+
if (!(top && top.ranges && top.equals(sel)))
|
4751 |
+
{ dest.push(sel) }
|
4752 |
+
}
|
4753 |
+
|
4754 |
+
// Used to store marked span information in the history.
|
4755 |
+
function attachLocalSpans(doc, change, from, to) {
|
4756 |
+
var existing = change["spans_" + doc.id], n = 0
|
4757 |
+
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
|
4758 |
+
if (line.markedSpans)
|
4759 |
+
{ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans }
|
4760 |
+
++n
|
4761 |
+
})
|
4762 |
+
}
|
4763 |
+
|
4764 |
+
// When un/re-doing restores text containing marked spans, those
|
4765 |
+
// that have been explicitly cleared should not be restored.
|
4766 |
+
function removeClearedSpans(spans) {
|
4767 |
+
if (!spans) { return null }
|
4768 |
+
var out
|
4769 |
+
for (var i = 0; i < spans.length; ++i) {
|
4770 |
+
if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } }
|
4771 |
+
else if (out) { out.push(spans[i]) }
|
4772 |
+
}
|
4773 |
+
return !out ? spans : out.length ? out : null
|
4774 |
+
}
|
4775 |
+
|
4776 |
+
// Retrieve and filter the old marked spans stored in a change event.
|
4777 |
+
function getOldSpans(doc, change) {
|
4778 |
+
var found = change["spans_" + doc.id]
|
4779 |
+
if (!found) { return null }
|
4780 |
+
var nw = []
|
4781 |
+
for (var i = 0; i < change.text.length; ++i)
|
4782 |
+
{ nw.push(removeClearedSpans(found[i])) }
|
4783 |
+
return nw
|
4784 |
+
}
|
4785 |
+
|
4786 |
+
// Used for un/re-doing changes from the history. Combines the
|
4787 |
+
// result of computing the existing spans with the set of spans that
|
4788 |
+
// existed in the history (so that deleting around a span and then
|
4789 |
+
// undoing brings back the span).
|
4790 |
+
function mergeOldSpans(doc, change) {
|
4791 |
+
var old = getOldSpans(doc, change)
|
4792 |
+
var stretched = stretchSpansOverChange(doc, change)
|
4793 |
+
if (!old) { return stretched }
|
4794 |
+
if (!stretched) { return old }
|
4795 |
+
|
4796 |
+
for (var i = 0; i < old.length; ++i) {
|
4797 |
+
var oldCur = old[i], stretchCur = stretched[i]
|
4798 |
+
if (oldCur && stretchCur) {
|
4799 |
+
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
4800 |
+
var span = stretchCur[j]
|
4801 |
+
for (var k = 0; k < oldCur.length; ++k)
|
4802 |
+
{ if (oldCur[k].marker == span.marker) { continue spans } }
|
4803 |
+
oldCur.push(span)
|
4804 |
+
}
|
4805 |
+
} else if (stretchCur) {
|
4806 |
+
old[i] = stretchCur
|
4807 |
+
}
|
4808 |
+
}
|
4809 |
+
return old
|
4810 |
+
}
|
4811 |
+
|
4812 |
+
// Used both to provide a JSON-safe object in .getHistory, and, when
|
4813 |
+
// detaching a document, to split the history in two
|
4814 |
+
function copyHistoryArray(events, newGroup, instantiateSel) {
|
4815 |
+
var copy = []
|
4816 |
+
for (var i = 0; i < events.length; ++i) {
|
4817 |
+
var event = events[i]
|
4818 |
+
if (event.ranges) {
|
4819 |
+
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)
|
4820 |
+
continue
|
4821 |
+
}
|
4822 |
+
var changes = event.changes, newChanges = []
|
4823 |
+
copy.push({changes: newChanges})
|
4824 |
+
for (var j = 0; j < changes.length; ++j) {
|
4825 |
+
var change = changes[j], m = (void 0)
|
4826 |
+
newChanges.push({from: change.from, to: change.to, text: change.text})
|
4827 |
+
if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
|
4828 |
+
if (indexOf(newGroup, Number(m[1])) > -1) {
|
4829 |
+
lst(newChanges)[prop] = change[prop]
|
4830 |
+
delete change[prop]
|
4831 |
+
}
|
4832 |
+
} } }
|
4833 |
+
}
|
4834 |
+
}
|
4835 |
+
return copy
|
4836 |
+
}
|
4837 |
+
|
4838 |
+
// The 'scroll' parameter given to many of these indicated whether
|
4839 |
+
// the new cursor position should be scrolled into view after
|
4840 |
+
// modifying the selection.
|
4841 |
+
|
4842 |
+
// If shift is held or the extend flag is set, extends a range to
|
4843 |
+
// include a given position (and optionally a second position).
|
4844 |
+
// Otherwise, simply returns the range between the given positions.
|
4845 |
+
// Used for cursor motion and such.
|
4846 |
+
function extendRange(doc, range, head, other) {
|
4847 |
+
if (doc.cm && doc.cm.display.shift || doc.extend) {
|
4848 |
+
var anchor = range.anchor
|
4849 |
+
if (other) {
|
4850 |
+
var posBefore = cmp(head, anchor) < 0
|
4851 |
+
if (posBefore != (cmp(other, anchor) < 0)) {
|
4852 |
+
anchor = head
|
4853 |
+
head = other
|
4854 |
+
} else if (posBefore != (cmp(head, other) < 0)) {
|
4855 |
+
head = other
|
4856 |
+
}
|
4857 |
+
}
|
4858 |
+
return new Range(anchor, head)
|
4859 |
+
} else {
|
4860 |
+
return new Range(other || head, head)
|
4861 |
+
}
|
4862 |
+
}
|
4863 |
+
|
4864 |
+
// Extend the primary selection range, discard the rest.
|
4865 |
+
function extendSelection(doc, head, other, options) {
|
4866 |
+
setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)
|
4867 |
+
}
|
4868 |
+
|
4869 |
+
// Extend all selections (pos is an array of selections with length
|
4870 |
+
// equal the number of selections)
|
4871 |
+
function extendSelections(doc, heads, options) {
|
4872 |
+
var out = []
|
4873 |
+
for (var i = 0; i < doc.sel.ranges.length; i++)
|
4874 |
+
{ out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) }
|
4875 |
+
var newSel = normalizeSelection(out, doc.sel.primIndex)
|
4876 |
+
setSelection(doc, newSel, options)
|
4877 |
+
}
|
4878 |
+
|
4879 |
+
// Updates a single range in the selection.
|
4880 |
+
function replaceOneSelection(doc, i, range, options) {
|
4881 |
+
var ranges = doc.sel.ranges.slice(0)
|
4882 |
+
ranges[i] = range
|
4883 |
+
setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)
|
4884 |
+
}
|
4885 |
+
|
4886 |
+
// Reset the selection to a single range.
|
4887 |
+
function setSimpleSelection(doc, anchor, head, options) {
|
4888 |
+
setSelection(doc, simpleSelection(anchor, head), options)
|
4889 |
+
}
|
4890 |
+
|
4891 |
+
// Give beforeSelectionChange handlers a change to influence a
|
4892 |
+
// selection update.
|
4893 |
+
function filterSelectionChange(doc, sel, options) {
|
4894 |
+
var obj = {
|
4895 |
+
ranges: sel.ranges,
|
4896 |
+
update: function(ranges) {
|
4897 |
+
var this$1 = this;
|
4898 |
+
|
4899 |
+
this.ranges = []
|
4900 |
+
for (var i = 0; i < ranges.length; i++)
|
4901 |
+
{ this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
|
4902 |
+
clipPos(doc, ranges[i].head)) }
|
4903 |
+
},
|
4904 |
+
origin: options && options.origin
|
4905 |
+
}
|
4906 |
+
signal(doc, "beforeSelectionChange", doc, obj)
|
4907 |
+
if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) }
|
4908 |
+
if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
|
4909 |
+
else { return sel }
|
4910 |
+
}
|
4911 |
+
|
4912 |
+
function setSelectionReplaceHistory(doc, sel, options) {
|
4913 |
+
var done = doc.history.done, last = lst(done)
|
4914 |
+
if (last && last.ranges) {
|
4915 |
+
done[done.length - 1] = sel
|
4916 |
+
setSelectionNoUndo(doc, sel, options)
|
4917 |
+
} else {
|
4918 |
+
setSelection(doc, sel, options)
|
4919 |
+
}
|
4920 |
+
}
|
4921 |
+
|
4922 |
+
// Set a new selection.
|
4923 |
+
function setSelection(doc, sel, options) {
|
4924 |
+
setSelectionNoUndo(doc, sel, options)
|
4925 |
+
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
|
4926 |
+
}
|
4927 |
+
|
4928 |
+
function setSelectionNoUndo(doc, sel, options) {
|
4929 |
+
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
4930 |
+
{ sel = filterSelectionChange(doc, sel, options) }
|
4931 |
+
|
4932 |
+
var bias = options && options.bias ||
|
4933 |
+
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
|
4934 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
|
4935 |
+
|
4936 |
+
if (!(options && options.scroll === false) && doc.cm)
|
4937 |
+
{ ensureCursorVisible(doc.cm) }
|
4938 |
+
}
|
4939 |
+
|
4940 |
+
function setSelectionInner(doc, sel) {
|
4941 |
+
if (sel.equals(doc.sel)) { return }
|
4942 |
+
|
4943 |
+
doc.sel = sel
|
4944 |
+
|
4945 |
+
if (doc.cm) {
|
4946 |
+
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true
|
4947 |
+
signalCursorActivity(doc.cm)
|
4948 |
+
}
|
4949 |
+
signalLater(doc, "cursorActivity", doc)
|
4950 |
+
}
|
4951 |
+
|
4952 |
+
// Verify that the selection does not partially select any atomic
|
4953 |
+
// marked ranges.
|
4954 |
+
function reCheckSelection(doc) {
|
4955 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))
|
4956 |
+
}
|
4957 |
+
|
4958 |
+
// Return a selection that does not partially select any atomic
|
4959 |
+
// ranges.
|
4960 |
+
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
4961 |
+
var out
|
4962 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
4963 |
+
var range = sel.ranges[i]
|
4964 |
+
var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
|
4965 |
+
var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
|
4966 |
+
var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
|
4967 |
+
if (out || newAnchor != range.anchor || newHead != range.head) {
|
4968 |
+
if (!out) { out = sel.ranges.slice(0, i) }
|
4969 |
+
out[i] = new Range(newAnchor, newHead)
|
4970 |
+
}
|
4971 |
+
}
|
4972 |
+
return out ? normalizeSelection(out, sel.primIndex) : sel
|
4973 |
+
}
|
4974 |
+
|
4975 |
+
function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
|
4976 |
+
var line = getLine(doc, pos.line)
|
4977 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
4978 |
+
var sp = line.markedSpans[i], m = sp.marker
|
4979 |
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
4980 |
+
(sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
4981 |
+
if (mayClear) {
|
4982 |
+
signal(m, "beforeCursorEnter")
|
4983 |
+
if (m.explicitlyCleared) {
|
4984 |
+
if (!line.markedSpans) { break }
|
4985 |
+
else {--i; continue}
|
4986 |
+
}
|
4987 |
+
}
|
4988 |
+
if (!m.atomic) { continue }
|
4989 |
+
|
4990 |
+
if (oldPos) {
|
4991 |
+
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0)
|
4992 |
+
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
4993 |
+
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) }
|
4994 |
+
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
4995 |
+
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
4996 |
+
}
|
4997 |
+
|
4998 |
+
var far = m.find(dir < 0 ? -1 : 1)
|
4999 |
+
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
5000 |
+
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null) }
|
5001 |
+
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
5002 |
+
}
|
5003 |
+
} }
|
5004 |
+
return pos
|
5005 |
+
}
|
5006 |
+
|
5007 |
+
// Ensure a given position is not inside an atomic range.
|
5008 |
+
function skipAtomic(doc, pos, oldPos, bias, mayClear) {
|
5009 |
+
var dir = bias || 1
|
5010 |
+
var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
|
5011 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
|
5012 |
+
skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
|
5013 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
|
5014 |
+
if (!found) {
|
5015 |
+
doc.cantEdit = true
|
5016 |
+
return Pos(doc.first, 0)
|
5017 |
+
}
|
5018 |
+
return found
|
5019 |
+
}
|
5020 |
+
|
5021 |
+
function movePos(doc, pos, dir, line) {
|
5022 |
+
if (dir < 0 && pos.ch == 0) {
|
5023 |
+
if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
|
5024 |
+
else { return null }
|
5025 |
+
} else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
|
5026 |
+
if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
|
5027 |
+
else { return null }
|
5028 |
+
} else {
|
5029 |
+
return new Pos(pos.line, pos.ch + dir)
|
5030 |
+
}
|
5031 |
+
}
|
5032 |
+
|
5033 |
+
function selectAll(cm) {
|
5034 |
+
cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
|
5035 |
+
}
|
5036 |
+
|
5037 |
+
// UPDATING
|
5038 |
+
|
5039 |
+
// Allow "beforeChange" event handlers to influence a change
|
5040 |
+
function filterChange(doc, change, update) {
|
5041 |
+
var obj = {
|
5042 |
+
canceled: false,
|
5043 |
+
from: change.from,
|
5044 |
+
to: change.to,
|
5045 |
+
text: change.text,
|
5046 |
+
origin: change.origin,
|
5047 |
+
cancel: function () { return obj.canceled = true; }
|
5048 |
+
}
|
5049 |
+
if (update) { obj.update = function (from, to, text, origin) {
|
5050 |
+
if (from) { obj.from = clipPos(doc, from) }
|
5051 |
+
if (to) { obj.to = clipPos(doc, to) }
|
5052 |
+
if (text) { obj.text = text }
|
5053 |
+
if (origin !== undefined) { obj.origin = origin }
|
5054 |
+
} }
|
5055 |
+
signal(doc, "beforeChange", doc, obj)
|
5056 |
+
if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) }
|
5057 |
+
|
5058 |
+
if (obj.canceled) { return null }
|
5059 |
+
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
|
5060 |
+
}
|
5061 |
+
|
5062 |
+
// Apply a change to a document, and add it to the document's
|
5063 |
+
// history, and propagating it to all linked documents.
|
5064 |
+
function makeChange(doc, change, ignoreReadOnly) {
|
5065 |
+
if (doc.cm) {
|
5066 |
+
if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
|
5067 |
+
if (doc.cm.state.suppressEdits) { return }
|
5068 |
+
}
|
5069 |
+
|
5070 |
+
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
5071 |
+
change = filterChange(doc, change, true)
|
5072 |
+
if (!change) { return }
|
5073 |
+
}
|
5074 |
+
|
5075 |
+
// Possibly split or suppress the update based on the presence
|
5076 |
+
// of read-only spans in its range.
|
5077 |
+
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)
|
5078 |
+
if (split) {
|
5079 |
+
for (var i = split.length - 1; i >= 0; --i)
|
5080 |
+
{ makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) }
|
5081 |
+
} else {
|
5082 |
+
makeChangeInner(doc, change)
|
5083 |
+
}
|
5084 |
+
}
|
5085 |
+
|
5086 |
+
function makeChangeInner(doc, change) {
|
5087 |
+
if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
|
5088 |
+
var selAfter = computeSelAfterChange(doc, change)
|
5089 |
+
addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)
|
5090 |
+
|
5091 |
+
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))
|
5092 |
+
var rebased = []
|
5093 |
+
|
5094 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5095 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5096 |
+
rebaseHist(doc.history, change)
|
5097 |
+
rebased.push(doc.history)
|
5098 |
+
}
|
5099 |
+
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))
|
5100 |
+
})
|
5101 |
+
}
|
5102 |
+
|
5103 |
+
// Revert a change stored in a document's history.
|
5104 |
+
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
|
5105 |
+
if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
|
5106 |
+
|
5107 |
+
var hist = doc.history, event, selAfter = doc.sel
|
5108 |
+
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done
|
5109 |
+
|
5110 |
+
// Verify that there is a useable event (so that ctrl-z won't
|
5111 |
+
// needlessly clear selection events)
|
5112 |
+
var i = 0
|
5113 |
+
for (; i < source.length; i++) {
|
5114 |
+
event = source[i]
|
5115 |
+
if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
|
5116 |
+
{ break }
|
5117 |
+
}
|
5118 |
+
if (i == source.length) { return }
|
5119 |
+
hist.lastOrigin = hist.lastSelOrigin = null
|
5120 |
+
|
5121 |
+
for (;;) {
|
5122 |
+
event = source.pop()
|
5123 |
+
if (event.ranges) {
|
5124 |
+
pushSelectionToHistory(event, dest)
|
5125 |
+
if (allowSelectionOnly && !event.equals(doc.sel)) {
|
5126 |
+
setSelection(doc, event, {clearRedo: false})
|
5127 |
+
return
|
5128 |
+
}
|
5129 |
+
selAfter = event
|
5130 |
+
}
|
5131 |
+
else { break }
|
5132 |
+
}
|
5133 |
+
|
5134 |
+
// Build up a reverse change object to add to the opposite history
|
5135 |
+
// stack (redo when undoing, and vice versa).
|
5136 |
+
var antiChanges = []
|
5137 |
+
pushSelectionToHistory(selAfter, dest)
|
5138 |
+
dest.push({changes: antiChanges, generation: hist.generation})
|
5139 |
+
hist.generation = event.generation || ++hist.maxGeneration
|
5140 |
+
|
5141 |
+
var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")
|
5142 |
+
|
5143 |
+
var loop = function ( i ) {
|
5144 |
+
var change = event.changes[i]
|
5145 |
+
change.origin = type
|
5146 |
+
if (filter && !filterChange(doc, change, false)) {
|
5147 |
+
source.length = 0
|
5148 |
+
return {}
|
5149 |
+
}
|
5150 |
+
|
5151 |
+
antiChanges.push(historyChangeFromChange(doc, change))
|
5152 |
+
|
5153 |
+
var after = i ? computeSelAfterChange(doc, change) : lst(source)
|
5154 |
+
makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))
|
5155 |
+
if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) }
|
5156 |
+
var rebased = []
|
5157 |
+
|
5158 |
+
// Propagate to the linked documents
|
5159 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5160 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5161 |
+
rebaseHist(doc.history, change)
|
5162 |
+
rebased.push(doc.history)
|
5163 |
+
}
|
5164 |
+
makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))
|
5165 |
+
})
|
5166 |
+
};
|
5167 |
+
|
5168 |
+
for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
|
5169 |
+
var returned = loop( i$1 );
|
5170 |
+
|
5171 |
+
if ( returned ) return returned.v;
|
5172 |
+
}
|
5173 |
+
}
|
5174 |
+
|
5175 |
+
// Sub-views need their line numbers shifted when text is added
|
5176 |
+
// above or below them in the parent document.
|
5177 |
+
function shiftDoc(doc, distance) {
|
5178 |
+
if (distance == 0) { return }
|
5179 |
+
doc.first += distance
|
5180 |
+
doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
|
5181 |
+
Pos(range.anchor.line + distance, range.anchor.ch),
|
5182 |
+
Pos(range.head.line + distance, range.head.ch)
|
5183 |
+
); }), doc.sel.primIndex)
|
5184 |
+
if (doc.cm) {
|
5185 |
+
regChange(doc.cm, doc.first, doc.first - distance, distance)
|
5186 |
+
for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
|
5187 |
+
{ regLineChange(doc.cm, l, "gutter") }
|
5188 |
+
}
|
5189 |
+
}
|
5190 |
+
|
5191 |
+
// More lower-level change function, handling only a single document
|
5192 |
+
// (not linked ones).
|
5193 |
+
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
5194 |
+
if (doc.cm && !doc.cm.curOp)
|
5195 |
+
{ return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
|
5196 |
+
|
5197 |
+
if (change.to.line < doc.first) {
|
5198 |
+
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))
|
5199 |
+
return
|
5200 |
+
}
|
5201 |
+
if (change.from.line > doc.lastLine()) { return }
|
5202 |
+
|
5203 |
+
// Clip the change to the size of this doc
|
5204 |
+
if (change.from.line < doc.first) {
|
5205 |
+
var shift = change.text.length - 1 - (doc.first - change.from.line)
|
5206 |
+
shiftDoc(doc, shift)
|
5207 |
+
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
5208 |
+
text: [lst(change.text)], origin: change.origin}
|
5209 |
+
}
|
5210 |
+
var last = doc.lastLine()
|
5211 |
+
if (change.to.line > last) {
|
5212 |
+
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
5213 |
+
text: [change.text[0]], origin: change.origin}
|
5214 |
+
}
|
5215 |
+
|
5216 |
+
change.removed = getBetween(doc, change.from, change.to)
|
5217 |
+
|
5218 |
+
if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }
|
5219 |
+
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }
|
5220 |
+
else { updateDoc(doc, change, spans) }
|
5221 |
+
setSelectionNoUndo(doc, selAfter, sel_dontScroll)
|
5222 |
+
}
|
5223 |
+
|
5224 |
+
// Handle the interaction of a change to a document with the editor
|
5225 |
+
// that this document is part of.
|
5226 |
+
function makeChangeSingleDocInEditor(cm, change, spans) {
|
5227 |
+
var doc = cm.doc, display = cm.display, from = change.from, to = change.to
|
5228 |
+
|
5229 |
+
var recomputeMaxLength = false, checkWidthStart = from.line
|
5230 |
+
if (!cm.options.lineWrapping) {
|
5231 |
+
checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))
|
5232 |
+
doc.iter(checkWidthStart, to.line + 1, function (line) {
|
5233 |
+
if (line == display.maxLine) {
|
5234 |
+
recomputeMaxLength = true
|
5235 |
+
return true
|
5236 |
+
}
|
5237 |
+
})
|
5238 |
+
}
|
5239 |
+
|
5240 |
+
if (doc.sel.contains(change.from, change.to) > -1)
|
5241 |
+
{ signalCursorActivity(cm) }
|
5242 |
+
|
5243 |
+
updateDoc(doc, change, spans, estimateHeight(cm))
|
5244 |
+
|
5245 |
+
if (!cm.options.lineWrapping) {
|
5246 |
+
doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
|
5247 |
+
var len = lineLength(line)
|
5248 |
+
if (len > display.maxLineLength) {
|
5249 |
+
display.maxLine = line
|
5250 |
+
display.maxLineLength = len
|
5251 |
+
display.maxLineChanged = true
|
5252 |
+
recomputeMaxLength = false
|
5253 |
+
}
|
5254 |
+
})
|
5255 |
+
if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }
|
5256 |
+
}
|
5257 |
+
|
5258 |
+
// Adjust frontier, schedule worker
|
5259 |
+
doc.frontier = Math.min(doc.frontier, from.line)
|
5260 |
+
startWorker(cm, 400)
|
5261 |
+
|
5262 |
+
var lendiff = change.text.length - (to.line - from.line) - 1
|
5263 |
+
// Remember that these lines changed, for updating the display
|
5264 |
+
if (change.full)
|
5265 |
+
{ regChange(cm) }
|
5266 |
+
else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
|
5267 |
+
{ regLineChange(cm, from.line, "text") }
|
5268 |
+
else
|
5269 |
+
{ regChange(cm, from.line, to.line + 1, lendiff) }
|
5270 |
+
|
5271 |
+
var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change")
|
5272 |
+
if (changeHandler || changesHandler) {
|
5273 |
+
var obj = {
|
5274 |
+
from: from, to: to,
|
5275 |
+
text: change.text,
|
5276 |
+
removed: change.removed,
|
5277 |
+
origin: change.origin
|
5278 |
+
}
|
5279 |
+
if (changeHandler) { signalLater(cm, "change", cm, obj) }
|
5280 |
+
if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) }
|
5281 |
+
}
|
5282 |
+
cm.display.selForContextMenu = null
|
5283 |
+
}
|
5284 |
+
|
5285 |
+
function replaceRange(doc, code, from, to, origin) {
|
5286 |
+
if (!to) { to = from }
|
5287 |
+
if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp }
|
5288 |
+
if (typeof code == "string") { code = doc.splitLines(code) }
|
5289 |
+
makeChange(doc, {from: from, to: to, text: code, origin: origin})
|
5290 |
+
}
|
5291 |
+
|
5292 |
+
// Rebasing/resetting history to deal with externally-sourced changes
|
5293 |
+
|
5294 |
+
function rebaseHistSelSingle(pos, from, to, diff) {
|
5295 |
+
if (to < pos.line) {
|
5296 |
+
pos.line += diff
|
5297 |
+
} else if (from < pos.line) {
|
5298 |
+
pos.line = from
|
5299 |
+
pos.ch = 0
|
5300 |
+
}
|
5301 |
+
}
|
5302 |
+
|
5303 |
+
// Tries to rebase an array of history events given a change in the
|
5304 |
+
// document. If the change touches the same lines as the event, the
|
5305 |
+
// event, and everything 'behind' it, is discarded. If the change is
|
5306 |
+
// before the event, the event's positions are updated. Uses a
|
5307 |
+
// copy-on-write scheme for the positions, to avoid having to
|
5308 |
+
// reallocate them all on every rebase, but also avoid problems with
|
5309 |
+
// shared position objects being unsafely updated.
|
5310 |
+
function rebaseHistArray(array, from, to, diff) {
|
5311 |
+
for (var i = 0; i < array.length; ++i) {
|
5312 |
+
var sub = array[i], ok = true
|
5313 |
+
if (sub.ranges) {
|
5314 |
+
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
|
5315 |
+
for (var j = 0; j < sub.ranges.length; j++) {
|
5316 |
+
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
|
5317 |
+
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
|
5318 |
+
}
|
5319 |
+
continue
|
5320 |
+
}
|
5321 |
+
for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
|
5322 |
+
var cur = sub.changes[j$1]
|
5323 |
+
if (to < cur.from.line) {
|
5324 |
+
cur.from = Pos(cur.from.line + diff, cur.from.ch)
|
5325 |
+
cur.to = Pos(cur.to.line + diff, cur.to.ch)
|
5326 |
+
} else if (from <= cur.to.line) {
|
5327 |
+
ok = false
|
5328 |
+
break
|
5329 |
+
}
|
5330 |
+
}
|
5331 |
+
if (!ok) {
|
5332 |
+
array.splice(0, i + 1)
|
5333 |
+
i = 0
|
5334 |
+
}
|
5335 |
+
}
|
5336 |
+
}
|
5337 |
+
|
5338 |
+
function rebaseHist(hist, change) {
|
5339 |
+
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1
|
5340 |
+
rebaseHistArray(hist.done, from, to, diff)
|
5341 |
+
rebaseHistArray(hist.undone, from, to, diff)
|
5342 |
+
}
|
5343 |
+
|
5344 |
+
// Utility for applying a change to a line by handle or number,
|
5345 |
+
// returning the number and optionally registering the line as
|
5346 |
+
// changed.
|
5347 |
+
function changeLine(doc, handle, changeType, op) {
|
5348 |
+
var no = handle, line = handle
|
5349 |
+
if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) }
|
5350 |
+
else { no = lineNo(handle) }
|
5351 |
+
if (no == null) { return null }
|
5352 |
+
if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }
|
5353 |
+
return line
|
5354 |
+
}
|
5355 |
+
|
5356 |
+
// The document is represented as a BTree consisting of leaves, with
|
5357 |
+
// chunk of lines in them, and branches, with up to ten leaves or
|
5358 |
+
// other branch nodes below them. The top node is always a branch
|
5359 |
+
// node, and is the document object itself (meaning it has
|
5360 |
+
// additional methods and properties).
|
5361 |
+
//
|
5362 |
+
// All nodes have parent links. The tree is used both to go from
|
5363 |
+
// line numbers to line objects, and to go from objects to numbers.
|
5364 |
+
// It also indexes by height, and is used to convert between height
|
5365 |
+
// and line object, and to find the total height of the document.
|
5366 |
+
//
|
5367 |
+
// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
|
5368 |
+
|
5369 |
+
var LeafChunk = function(lines) {
|
5370 |
+
var this$1 = this;
|
5371 |
+
|
5372 |
+
this.lines = lines
|
5373 |
+
this.parent = null
|
5374 |
+
var height = 0
|
5375 |
+
for (var i = 0; i < lines.length; ++i) {
|
5376 |
+
lines[i].parent = this$1
|
5377 |
+
height += lines[i].height
|
5378 |
+
}
|
5379 |
+
this.height = height
|
5380 |
+
};
|
5381 |
+
|
5382 |
+
LeafChunk.prototype.chunkSize = function () { return this.lines.length };
|
5383 |
+
|
5384 |
+
// Remove the n lines at offset 'at'.
|
5385 |
+
LeafChunk.prototype.removeInner = function (at, n) {
|
5386 |
+
var this$1 = this;
|
5387 |
+
|
5388 |
+
for (var i = at, e = at + n; i < e; ++i) {
|
5389 |
+
var line = this$1.lines[i]
|
5390 |
+
this$1.height -= line.height
|
5391 |
+
cleanUpLine(line)
|
5392 |
+
signalLater(line, "delete")
|
5393 |
+
}
|
5394 |
+
this.lines.splice(at, n)
|
5395 |
+
};
|
5396 |
+
|
5397 |
+
// Helper used to collapse a small branch into a single leaf.
|
5398 |
+
LeafChunk.prototype.collapse = function (lines) {
|
5399 |
+
lines.push.apply(lines, this.lines)
|
5400 |
+
};
|
5401 |
+
|
5402 |
+
// Insert the given array of lines at offset 'at', count them as
|
5403 |
+
// having the given height.
|
5404 |
+
LeafChunk.prototype.insertInner = function (at, lines, height) {
|
5405 |
+
var this$1 = this;
|
5406 |
+
|
5407 |
+
this.height += height
|
5408 |
+
this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at))
|
5409 |
+
for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 }
|
5410 |
+
};
|
5411 |
+
|
5412 |
+
// Used to iterate over a part of the tree.
|
5413 |
+
LeafChunk.prototype.iterN = function (at, n, op) {
|
5414 |
+
var this$1 = this;
|
5415 |
+
|
5416 |
+
for (var e = at + n; at < e; ++at)
|
5417 |
+
{ if (op(this$1.lines[at])) { return true } }
|
5418 |
+
};
|
5419 |
+
|
5420 |
+
var BranchChunk = function(children) {
|
5421 |
+
var this$1 = this;
|
5422 |
+
|
5423 |
+
this.children = children
|
5424 |
+
var size = 0, height = 0
|
5425 |
+
for (var i = 0; i < children.length; ++i) {
|
5426 |
+
var ch = children[i]
|
5427 |
+
size += ch.chunkSize(); height += ch.height
|
5428 |
+
ch.parent = this$1
|
5429 |
+
}
|
5430 |
+
this.size = size
|
5431 |
+
this.height = height
|
5432 |
+
this.parent = null
|
5433 |
+
};
|
5434 |
+
|
5435 |
+
BranchChunk.prototype.chunkSize = function () { return this.size };
|
5436 |
+
|
5437 |
+
BranchChunk.prototype.removeInner = function (at, n) {
|
5438 |
+
var this$1 = this;
|
5439 |
+
|
5440 |
+
this.size -= n
|
5441 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5442 |
+
var child = this$1.children[i], sz = child.chunkSize()
|
5443 |
+
if (at < sz) {
|
5444 |
+
var rm = Math.min(n, sz - at), oldHeight = child.height
|
5445 |
+
child.removeInner(at, rm)
|
5446 |
+
this$1.height -= oldHeight - child.height
|
5447 |
+
if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null }
|
5448 |
+
if ((n -= rm) == 0) { break }
|
5449 |
+
at = 0
|
5450 |
+
} else { at -= sz }
|
5451 |
+
}
|
5452 |
+
// If the result is smaller than 25 lines, ensure that it is a
|
5453 |
+
// single leaf node.
|
5454 |
+
if (this.size - n < 25 &&
|
5455 |
+
(this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
|
5456 |
+
var lines = []
|
5457 |
+
this.collapse(lines)
|
5458 |
+
this.children = [new LeafChunk(lines)]
|
5459 |
+
this.children[0].parent = this
|
5460 |
+
}
|
5461 |
+
};
|
5462 |
+
|
5463 |
+
BranchChunk.prototype.collapse = function (lines) {
|
5464 |
+
var this$1 = this;
|
5465 |
+
|
5466 |
+
for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines) }
|
5467 |
+
};
|
5468 |
+
|
5469 |
+
BranchChunk.prototype.insertInner = function (at, lines, height) {
|
5470 |
+
var this$1 = this;
|
5471 |
+
|
5472 |
+
this.size += lines.length
|
5473 |
+
this.height += height
|
5474 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5475 |
+
var child = this$1.children[i], sz = child.chunkSize()
|
5476 |
+
if (at <= sz) {
|
5477 |
+
child.insertInner(at, lines, height)
|
5478 |
+
if (child.lines && child.lines.length > 50) {
|
5479 |
+
// To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
|
5480 |
+
// Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
|
5481 |
+
var remaining = child.lines.length % 25 + 25
|
5482 |
+
for (var pos = remaining; pos < child.lines.length;) {
|
5483 |
+
var leaf = new LeafChunk(child.lines.slice(pos, pos += 25))
|
5484 |
+
child.height -= leaf.height
|
5485 |
+
this$1.children.splice(++i, 0, leaf)
|
5486 |
+
leaf.parent = this$1
|
5487 |
+
}
|
5488 |
+
child.lines = child.lines.slice(0, remaining)
|
5489 |
+
this$1.maybeSpill()
|
5490 |
+
}
|
5491 |
+
break
|
5492 |
+
}
|
5493 |
+
at -= sz
|
5494 |
+
}
|
5495 |
+
};
|
5496 |
+
|
5497 |
+
// When a node has grown, check whether it should be split.
|
5498 |
+
BranchChunk.prototype.maybeSpill = function () {
|
5499 |
+
if (this.children.length <= 10) { return }
|
5500 |
+
var me = this
|
5501 |
+
do {
|
5502 |
+
var spilled = me.children.splice(me.children.length - 5, 5)
|
5503 |
+
var sibling = new BranchChunk(spilled)
|
5504 |
+
if (!me.parent) { // Become the parent node
|
5505 |
+
var copy = new BranchChunk(me.children)
|
5506 |
+
copy.parent = me
|
5507 |
+
me.children = [copy, sibling]
|
5508 |
+
me = copy
|
5509 |
+
} else {
|
5510 |
+
me.size -= sibling.size
|
5511 |
+
me.height -= sibling.height
|
5512 |
+
var myIndex = indexOf(me.parent.children, me)
|
5513 |
+
me.parent.children.splice(myIndex + 1, 0, sibling)
|
5514 |
+
}
|
5515 |
+
sibling.parent = me.parent
|
5516 |
+
} while (me.children.length > 10)
|
5517 |
+
me.parent.maybeSpill()
|
5518 |
+
};
|
5519 |
+
|
5520 |
+
BranchChunk.prototype.iterN = function (at, n, op) {
|
5521 |
+
var this$1 = this;
|
5522 |
+
|
5523 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5524 |
+
var child = this$1.children[i], sz = child.chunkSize()
|
5525 |
+
if (at < sz) {
|
5526 |
+
var used = Math.min(n, sz - at)
|
5527 |
+
if (child.iterN(at, used, op)) { return true }
|
5528 |
+
if ((n -= used) == 0) { break }
|
5529 |
+
at = 0
|
5530 |
+
} else { at -= sz }
|
5531 |
+
}
|
5532 |
+
};
|
5533 |
+
|
5534 |
+
// Line widgets are block elements displayed above or below a line.
|
5535 |
+
|
5536 |
+
var LineWidget = function(doc, node, options) {
|
5537 |
+
var this$1 = this;
|
5538 |
+
|
5539 |
+
if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
|
5540 |
+
{ this$1[opt] = options[opt] } } }
|
5541 |
+
this.doc = doc
|
5542 |
+
this.node = node
|
5543 |
+
};
|
5544 |
+
|
5545 |
+
LineWidget.prototype.clear = function () {
|
5546 |
+
var this$1 = this;
|
5547 |
+
|
5548 |
+
var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line)
|
5549 |
+
if (no == null || !ws) { return }
|
5550 |
+
for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } }
|
5551 |
+
if (!ws.length) { line.widgets = null }
|
5552 |
+
var height = widgetHeight(this)
|
5553 |
+
updateLineHeight(line, Math.max(0, line.height - height))
|
5554 |
+
if (cm) {
|
5555 |
+
runInOp(cm, function () {
|
5556 |
+
adjustScrollWhenAboveVisible(cm, line, -height)
|
5557 |
+
regLineChange(cm, no, "widget")
|
5558 |
+
})
|
5559 |
+
signalLater(cm, "lineWidgetCleared", cm, this, no)
|
5560 |
+
}
|
5561 |
+
};
|
5562 |
+
|
5563 |
+
LineWidget.prototype.changed = function () {
|
5564 |
+
var this$1 = this;
|
5565 |
+
|
5566 |
+
var oldH = this.height, cm = this.doc.cm, line = this.line
|
5567 |
+
this.height = null
|
5568 |
+
var diff = widgetHeight(this) - oldH
|
5569 |
+
if (!diff) { return }
|
5570 |
+
updateLineHeight(line, line.height + diff)
|
5571 |
+
if (cm) {
|
5572 |
+
runInOp(cm, function () {
|
5573 |
+
cm.curOp.forceUpdate = true
|
5574 |
+
adjustScrollWhenAboveVisible(cm, line, diff)
|
5575 |
+
signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line))
|
5576 |
+
})
|
5577 |
+
}
|
5578 |
+
};
|
5579 |
+
eventMixin(LineWidget)
|
5580 |
+
|
5581 |
+
function adjustScrollWhenAboveVisible(cm, line, diff) {
|
5582 |
+
if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
|
5583 |
+
{ addToScrollTop(cm, diff) }
|
5584 |
+
}
|
5585 |
+
|
5586 |
+
function addLineWidget(doc, handle, node, options) {
|
5587 |
+
var widget = new LineWidget(doc, node, options)
|
5588 |
+
var cm = doc.cm
|
5589 |
+
if (cm && widget.noHScroll) { cm.display.alignWidgets = true }
|
5590 |
+
changeLine(doc, handle, "widget", function (line) {
|
5591 |
+
var widgets = line.widgets || (line.widgets = [])
|
5592 |
+
if (widget.insertAt == null) { widgets.push(widget) }
|
5593 |
+
else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) }
|
5594 |
+
widget.line = line
|
5595 |
+
if (cm && !lineIsHidden(doc, line)) {
|
5596 |
+
var aboveVisible = heightAtLine(line) < doc.scrollTop
|
5597 |
+
updateLineHeight(line, line.height + widgetHeight(widget))
|
5598 |
+
if (aboveVisible) { addToScrollTop(cm, widget.height) }
|
5599 |
+
cm.curOp.forceUpdate = true
|
5600 |
+
}
|
5601 |
+
return true
|
5602 |
+
})
|
5603 |
+
signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
|
5604 |
+
return widget
|
5605 |
+
}
|
5606 |
+
|
5607 |
+
// TEXTMARKERS
|
5608 |
+
|
5609 |
+
// Created with markText and setBookmark methods. A TextMarker is a
|
5610 |
+
// handle that can be used to clear or find a marked position in the
|
5611 |
+
// document. Line objects hold arrays (markedSpans) containing
|
5612 |
+
// {from, to, marker} object pointing to such marker objects, and
|
5613 |
+
// indicating that such a marker is present on that line. Multiple
|
5614 |
+
// lines may point to the same marker when it spans across lines.
|
5615 |
+
// The spans will have null for their from/to properties when the
|
5616 |
+
// marker continues beyond the start/end of the line. Markers have
|
5617 |
+
// links back to the lines they currently touch.
|
5618 |
+
|
5619 |
+
// Collapsed markers have unique ids, in order to be able to order
|
5620 |
+
// them, which is needed for uniquely determining an outer marker
|
5621 |
+
// when they overlap (they may nest, but not partially overlap).
|
5622 |
+
var nextMarkerId = 0
|
5623 |
+
|
5624 |
+
var TextMarker = function(doc, type) {
|
5625 |
+
this.lines = []
|
5626 |
+
this.type = type
|
5627 |
+
this.doc = doc
|
5628 |
+
this.id = ++nextMarkerId
|
5629 |
+
};
|
5630 |
+
|
5631 |
+
// Clear the marker.
|
5632 |
+
TextMarker.prototype.clear = function () {
|
5633 |
+
var this$1 = this;
|
5634 |
+
|
5635 |
+
if (this.explicitlyCleared) { return }
|
5636 |
+
var cm = this.doc.cm, withOp = cm && !cm.curOp
|
5637 |
+
if (withOp) { startOperation(cm) }
|
5638 |
+
if (hasHandler(this, "clear")) {
|
5639 |
+
var found = this.find()
|
5640 |
+
if (found) { signalLater(this, "clear", found.from, found.to) }
|
5641 |
+
}
|
5642 |
+
var min = null, max = null
|
5643 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5644 |
+
var line = this$1.lines[i]
|
5645 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1)
|
5646 |
+
if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") }
|
5647 |
+
else if (cm) {
|
5648 |
+
if (span.to != null) { max = lineNo(line) }
|
5649 |
+
if (span.from != null) { min = lineNo(line) }
|
5650 |
+
}
|
5651 |
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span)
|
5652 |
+
if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
|
5653 |
+
{ updateLineHeight(line, textHeight(cm.display)) }
|
5654 |
+
}
|
5655 |
+
if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
|
5656 |
+
var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual)
|
5657 |
+
if (len > cm.display.maxLineLength) {
|
5658 |
+
cm.display.maxLine = visual
|
5659 |
+
cm.display.maxLineLength = len
|
5660 |
+
cm.display.maxLineChanged = true
|
5661 |
+
}
|
5662 |
+
} }
|
5663 |
+
|
5664 |
+
if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) }
|
5665 |
+
this.lines.length = 0
|
5666 |
+
this.explicitlyCleared = true
|
5667 |
+
if (this.atomic && this.doc.cantEdit) {
|
5668 |
+
this.doc.cantEdit = false
|
5669 |
+
if (cm) { reCheckSelection(cm.doc) }
|
5670 |
+
}
|
5671 |
+
if (cm) { signalLater(cm, "markerCleared", cm, this, min, max) }
|
5672 |
+
if (withOp) { endOperation(cm) }
|
5673 |
+
if (this.parent) { this.parent.clear() }
|
5674 |
+
};
|
5675 |
+
|
5676 |
+
// Find the position of the marker in the document. Returns a {from,
|
5677 |
+
// to} object by default. Side can be passed to get a specific side
|
5678 |
+
// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
|
5679 |
+
// Pos objects returned contain a line object, rather than a line
|
5680 |
+
// number (used to prevent looking up the same line twice).
|
5681 |
+
TextMarker.prototype.find = function (side, lineObj) {
|
5682 |
+
var this$1 = this;
|
5683 |
+
|
5684 |
+
if (side == null && this.type == "bookmark") { side = 1 }
|
5685 |
+
var from, to
|
5686 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5687 |
+
var line = this$1.lines[i]
|
5688 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1)
|
5689 |
+
if (span.from != null) {
|
5690 |
+
from = Pos(lineObj ? line : lineNo(line), span.from)
|
5691 |
+
if (side == -1) { return from }
|
5692 |
+
}
|
5693 |
+
if (span.to != null) {
|
5694 |
+
to = Pos(lineObj ? line : lineNo(line), span.to)
|
5695 |
+
if (side == 1) { return to }
|
5696 |
+
}
|
5697 |
+
}
|
5698 |
+
return from && {from: from, to: to}
|
5699 |
+
};
|
5700 |
+
|
5701 |
+
// Signals that the marker's widget changed, and surrounding layout
|
5702 |
+
// should be recomputed.
|
5703 |
+
TextMarker.prototype.changed = function () {
|
5704 |
+
var this$1 = this;
|
5705 |
+
|
5706 |
+
var pos = this.find(-1, true), widget = this, cm = this.doc.cm
|
5707 |
+
if (!pos || !cm) { return }
|
5708 |
+
runInOp(cm, function () {
|
5709 |
+
var line = pos.line, lineN = lineNo(pos.line)
|
5710 |
+
var view = findViewForLine(cm, lineN)
|
5711 |
+
if (view) {
|
5712 |
+
clearLineMeasurementCacheFor(view)
|
5713 |
+
cm.curOp.selectionChanged = cm.curOp.forceUpdate = true
|
5714 |
+
}
|
5715 |
+
cm.curOp.updateMaxLine = true
|
5716 |
+
if (!lineIsHidden(widget.doc, line) && widget.height != null) {
|
5717 |
+
var oldHeight = widget.height
|
5718 |
+
widget.height = null
|
5719 |
+
var dHeight = widgetHeight(widget) - oldHeight
|
5720 |
+
if (dHeight)
|
5721 |
+
{ updateLineHeight(line, line.height + dHeight) }
|
5722 |
+
}
|
5723 |
+
signalLater(cm, "markerChanged", cm, this$1)
|
5724 |
+
})
|
5725 |
+
};
|
5726 |
+
|
5727 |
+
TextMarker.prototype.attachLine = function (line) {
|
5728 |
+
if (!this.lines.length && this.doc.cm) {
|
5729 |
+
var op = this.doc.cm.curOp
|
5730 |
+
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
5731 |
+
{ (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) }
|
5732 |
+
}
|
5733 |
+
this.lines.push(line)
|
5734 |
+
};
|
5735 |
+
|
5736 |
+
TextMarker.prototype.detachLine = function (line) {
|
5737 |
+
this.lines.splice(indexOf(this.lines, line), 1)
|
5738 |
+
if (!this.lines.length && this.doc.cm) {
|
5739 |
+
var op = this.doc.cm.curOp
|
5740 |
+
;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)
|
5741 |
+
}
|
5742 |
+
};
|
5743 |
+
eventMixin(TextMarker)
|
5744 |
+
|
5745 |
+
// Create a marker, wire it up to the right lines, and
|
5746 |
+
function markText(doc, from, to, options, type) {
|
5747 |
+
// Shared markers (across linked documents) are handled separately
|
5748 |
+
// (markTextShared will call out to this again, once per
|
5749 |
+
// document).
|
5750 |
+
if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
|
5751 |
+
// Ensure we are in an operation.
|
5752 |
+
if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
|
5753 |
+
|
5754 |
+
var marker = new TextMarker(doc, type), diff = cmp(from, to)
|
5755 |
+
if (options) { copyObj(options, marker, false) }
|
5756 |
+
// Don't connect empty markers unless clearWhenEmpty is false
|
5757 |
+
if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
|
5758 |
+
{ return marker }
|
5759 |
+
if (marker.replacedWith) {
|
5760 |
+
// Showing up as a widget implies collapsed (widget replaces text)
|
5761 |
+
marker.collapsed = true
|
5762 |
+
marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget")
|
5763 |
+
if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") }
|
5764 |
+
if (options.insertLeft) { marker.widgetNode.insertLeft = true }
|
5765 |
+
}
|
5766 |
+
if (marker.collapsed) {
|
5767 |
+
if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
|
5768 |
+
from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
|
5769 |
+
{ throw new Error("Inserting collapsed marker partially overlapping an existing one") }
|
5770 |
+
seeCollapsedSpans()
|
5771 |
+
}
|
5772 |
+
|
5773 |
+
if (marker.addToHistory)
|
5774 |
+
{ addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) }
|
5775 |
+
|
5776 |
+
var curLine = from.line, cm = doc.cm, updateMaxLine
|
5777 |
+
doc.iter(curLine, to.line + 1, function (line) {
|
5778 |
+
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
|
5779 |
+
{ updateMaxLine = true }
|
5780 |
+
if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) }
|
5781 |
+
addMarkedSpan(line, new MarkedSpan(marker,
|
5782 |
+
curLine == from.line ? from.ch : null,
|
5783 |
+
curLine == to.line ? to.ch : null))
|
5784 |
+
++curLine
|
5785 |
+
})
|
5786 |
+
// lineIsHidden depends on the presence of the spans, so needs a second pass
|
5787 |
+
if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
|
5788 |
+
if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) }
|
5789 |
+
}) }
|
5790 |
+
|
5791 |
+
if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) }
|
5792 |
+
|
5793 |
+
if (marker.readOnly) {
|
5794 |
+
seeReadOnlySpans()
|
5795 |
+
if (doc.history.done.length || doc.history.undone.length)
|
5796 |
+
{ doc.clearHistory() }
|
5797 |
+
}
|
5798 |
+
if (marker.collapsed) {
|
5799 |
+
marker.id = ++nextMarkerId
|
5800 |
+
marker.atomic = true
|
5801 |
+
}
|
5802 |
+
if (cm) {
|
5803 |
+
// Sync editor state
|
5804 |
+
if (updateMaxLine) { cm.curOp.updateMaxLine = true }
|
5805 |
+
if (marker.collapsed)
|
5806 |
+
{ regChange(cm, from.line, to.line + 1) }
|
5807 |
+
else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
|
5808 |
+
{ for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } }
|
5809 |
+
if (marker.atomic) { reCheckSelection(cm.doc) }
|
5810 |
+
signalLater(cm, "markerAdded", cm, marker)
|
5811 |
+
}
|
5812 |
+
return marker
|
5813 |
+
}
|
5814 |
+
|
5815 |
+
// SHARED TEXTMARKERS
|
5816 |
+
|
5817 |
+
// A shared marker spans multiple linked documents. It is
|
5818 |
+
// implemented as a meta-marker-object controlling multiple normal
|
5819 |
+
// markers.
|
5820 |
+
var SharedTextMarker = function(markers, primary) {
|
5821 |
+
var this$1 = this;
|
5822 |
+
|
5823 |
+
this.markers = markers
|
5824 |
+
this.primary = primary
|
5825 |
+
for (var i = 0; i < markers.length; ++i)
|
5826 |
+
{ markers[i].parent = this$1 }
|
5827 |
+
};
|
5828 |
+
|
5829 |
+
SharedTextMarker.prototype.clear = function () {
|
5830 |
+
var this$1 = this;
|
5831 |
+
|
5832 |
+
if (this.explicitlyCleared) { return }
|
5833 |
+
this.explicitlyCleared = true
|
5834 |
+
for (var i = 0; i < this.markers.length; ++i)
|
5835 |
+
{ this$1.markers[i].clear() }
|
5836 |
+
signalLater(this, "clear")
|
5837 |
+
};
|
5838 |
+
|
5839 |
+
SharedTextMarker.prototype.find = function (side, lineObj) {
|
5840 |
+
return this.primary.find(side, lineObj)
|
5841 |
+
};
|
5842 |
+
eventMixin(SharedTextMarker)
|
5843 |
+
|
5844 |
+
function markTextShared(doc, from, to, options, type) {
|
5845 |
+
options = copyObj(options)
|
5846 |
+
options.shared = false
|
5847 |
+
var markers = [markText(doc, from, to, options, type)], primary = markers[0]
|
5848 |
+
var widget = options.widgetNode
|
5849 |
+
linkedDocs(doc, function (doc) {
|
5850 |
+
if (widget) { options.widgetNode = widget.cloneNode(true) }
|
5851 |
+
markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type))
|
5852 |
+
for (var i = 0; i < doc.linked.length; ++i)
|
5853 |
+
{ if (doc.linked[i].isParent) { return } }
|
5854 |
+
primary = lst(markers)
|
5855 |
+
})
|
5856 |
+
return new SharedTextMarker(markers, primary)
|
5857 |
+
}
|
5858 |
+
|
5859 |
+
function findSharedMarkers(doc) {
|
5860 |
+
return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
|
5861 |
+
}
|
5862 |
+
|
5863 |
+
function copySharedMarkers(doc, markers) {
|
5864 |
+
for (var i = 0; i < markers.length; i++) {
|
5865 |
+
var marker = markers[i], pos = marker.find()
|
5866 |
+
var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to)
|
5867 |
+
if (cmp(mFrom, mTo)) {
|
5868 |
+
var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type)
|
5869 |
+
marker.markers.push(subMark)
|
5870 |
+
subMark.parent = marker
|
5871 |
+
}
|
5872 |
+
}
|
5873 |
+
}
|
5874 |
+
|
5875 |
+
function detachSharedMarkers(markers) {
|
5876 |
+
var loop = function ( i ) {
|
5877 |
+
var marker = markers[i], linked = [marker.primary.doc]
|
5878 |
+
linkedDocs(marker.primary.doc, function (d) { return linked.push(d); })
|
5879 |
+
for (var j = 0; j < marker.markers.length; j++) {
|
5880 |
+
var subMarker = marker.markers[j]
|
5881 |
+
if (indexOf(linked, subMarker.doc) == -1) {
|
5882 |
+
subMarker.parent = null
|
5883 |
+
marker.markers.splice(j--, 1)
|
5884 |
+
}
|
5885 |
+
}
|
5886 |
+
};
|
5887 |
+
|
5888 |
+
for (var i = 0; i < markers.length; i++) loop( i );
|
5889 |
+
}
|
5890 |
+
|
5891 |
+
var nextDocId = 0
|
5892 |
+
var Doc = function(text, mode, firstLine, lineSep, direction) {
|
5893 |
+
if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
|
5894 |
+
if (firstLine == null) { firstLine = 0 }
|
5895 |
+
|
5896 |
+
BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
|
5897 |
+
this.first = firstLine
|
5898 |
+
this.scrollTop = this.scrollLeft = 0
|
5899 |
+
this.cantEdit = false
|
5900 |
+
this.cleanGeneration = 1
|
5901 |
+
this.frontier = firstLine
|
5902 |
+
var start = Pos(firstLine, 0)
|
5903 |
+
this.sel = simpleSelection(start)
|
5904 |
+
this.history = new History(null)
|
5905 |
+
this.id = ++nextDocId
|
5906 |
+
this.modeOption = mode
|
5907 |
+
this.lineSep = lineSep
|
5908 |
+
this.direction = (direction == "rtl") ? "rtl" : "ltr"
|
5909 |
+
this.extend = false
|
5910 |
+
|
5911 |
+
if (typeof text == "string") { text = this.splitLines(text) }
|
5912 |
+
updateDoc(this, {from: start, to: start, text: text})
|
5913 |
+
setSelection(this, simpleSelection(start), sel_dontScroll)
|
5914 |
+
}
|
5915 |
+
|
5916 |
+
Doc.prototype = createObj(BranchChunk.prototype, {
|
5917 |
+
constructor: Doc,
|
5918 |
+
// Iterate over the document. Supports two forms -- with only one
|
5919 |
+
// argument, it calls that for each line in the document. With
|
5920 |
+
// three, it iterates over the range given by the first two (with
|
5921 |
+
// the second being non-inclusive).
|
5922 |
+
iter: function(from, to, op) {
|
5923 |
+
if (op) { this.iterN(from - this.first, to - from, op) }
|
5924 |
+
else { this.iterN(this.first, this.first + this.size, from) }
|
5925 |
+
},
|
5926 |
+
|
5927 |
+
// Non-public interface for adding and removing lines.
|
5928 |
+
insert: function(at, lines) {
|
5929 |
+
var height = 0
|
5930 |
+
for (var i = 0; i < lines.length; ++i) { height += lines[i].height }
|
5931 |
+
this.insertInner(at - this.first, lines, height)
|
5932 |
+
},
|
5933 |
+
remove: function(at, n) { this.removeInner(at - this.first, n) },
|
5934 |
+
|
5935 |
+
// From here, the methods are part of the public interface. Most
|
5936 |
+
// are also available from CodeMirror (editor) instances.
|
5937 |
+
|
5938 |
+
getValue: function(lineSep) {
|
5939 |
+
var lines = getLines(this, this.first, this.first + this.size)
|
5940 |
+
if (lineSep === false) { return lines }
|
5941 |
+
return lines.join(lineSep || this.lineSeparator())
|
5942 |
+
},
|
5943 |
+
setValue: docMethodOp(function(code) {
|
5944 |
+
var top = Pos(this.first, 0), last = this.first + this.size - 1
|
5945 |
+
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
5946 |
+
text: this.splitLines(code), origin: "setValue", full: true}, true)
|
5947 |
+
if (this.cm) { scrollToCoords(this.cm, 0, 0) }
|
5948 |
+
setSelection(this, simpleSelection(top), sel_dontScroll)
|
5949 |
+
}),
|
5950 |
+
replaceRange: function(code, from, to, origin) {
|
5951 |
+
from = clipPos(this, from)
|
5952 |
+
to = to ? clipPos(this, to) : from
|
5953 |
+
replaceRange(this, code, from, to, origin)
|
5954 |
+
},
|
5955 |
+
getRange: function(from, to, lineSep) {
|
5956 |
+
var lines = getBetween(this, clipPos(this, from), clipPos(this, to))
|
5957 |
+
if (lineSep === false) { return lines }
|
5958 |
+
return lines.join(lineSep || this.lineSeparator())
|
5959 |
+
},
|
5960 |
+
|
5961 |
+
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
|
5962 |
+
|
5963 |
+
getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
|
5964 |
+
getLineNumber: function(line) {return lineNo(line)},
|
5965 |
+
|
5966 |
+
getLineHandleVisualStart: function(line) {
|
5967 |
+
if (typeof line == "number") { line = getLine(this, line) }
|
5968 |
+
return visualLine(line)
|
5969 |
+
},
|
5970 |
+
|
5971 |
+
lineCount: function() {return this.size},
|
5972 |
+
firstLine: function() {return this.first},
|
5973 |
+
lastLine: function() {return this.first + this.size - 1},
|
5974 |
+
|
5975 |
+
clipPos: function(pos) {return clipPos(this, pos)},
|
5976 |
+
|
5977 |
+
getCursor: function(start) {
|
5978 |
+
var range = this.sel.primary(), pos
|
5979 |
+
if (start == null || start == "head") { pos = range.head }
|
5980 |
+
else if (start == "anchor") { pos = range.anchor }
|
5981 |
+
else if (start == "end" || start == "to" || start === false) { pos = range.to() }
|
5982 |
+
else { pos = range.from() }
|
5983 |
+
return pos
|
5984 |
+
},
|
5985 |
+
listSelections: function() { return this.sel.ranges },
|
5986 |
+
somethingSelected: function() {return this.sel.somethingSelected()},
|
5987 |
+
|
5988 |
+
setCursor: docMethodOp(function(line, ch, options) {
|
5989 |
+
setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options)
|
5990 |
+
}),
|
5991 |
+
setSelection: docMethodOp(function(anchor, head, options) {
|
5992 |
+
setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)
|
5993 |
+
}),
|
5994 |
+
extendSelection: docMethodOp(function(head, other, options) {
|
5995 |
+
extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)
|
5996 |
+
}),
|
5997 |
+
extendSelections: docMethodOp(function(heads, options) {
|
5998 |
+
extendSelections(this, clipPosArray(this, heads), options)
|
5999 |
+
}),
|
6000 |
+
extendSelectionsBy: docMethodOp(function(f, options) {
|
6001 |
+
var heads = map(this.sel.ranges, f)
|
6002 |
+
extendSelections(this, clipPosArray(this, heads), options)
|
6003 |
+
}),
|
6004 |
+
setSelections: docMethodOp(function(ranges, primary, options) {
|
6005 |
+
var this$1 = this;
|
6006 |
+
|
6007 |
+
if (!ranges.length) { return }
|
6008 |
+
var out = []
|
6009 |
+
for (var i = 0; i < ranges.length; i++)
|
6010 |
+
{ out[i] = new Range(clipPos(this$1, ranges[i].anchor),
|
6011 |
+
clipPos(this$1, ranges[i].head)) }
|
6012 |
+
if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex) }
|
6013 |
+
setSelection(this, normalizeSelection(out, primary), options)
|
6014 |
+
}),
|
6015 |
+
addSelection: docMethodOp(function(anchor, head, options) {
|
6016 |
+
var ranges = this.sel.ranges.slice(0)
|
6017 |
+
ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))
|
6018 |
+
setSelection(this, normalizeSelection(ranges, ranges.length - 1), options)
|
6019 |
+
}),
|
6020 |
+
|
6021 |
+
getSelection: function(lineSep) {
|
6022 |
+
var this$1 = this;
|
6023 |
+
|
6024 |
+
var ranges = this.sel.ranges, lines
|
6025 |
+
for (var i = 0; i < ranges.length; i++) {
|
6026 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
|
6027 |
+
lines = lines ? lines.concat(sel) : sel
|
6028 |
+
}
|
6029 |
+
if (lineSep === false) { return lines }
|
6030 |
+
else { return lines.join(lineSep || this.lineSeparator()) }
|
6031 |
+
},
|
6032 |
+
getSelections: function(lineSep) {
|
6033 |
+
var this$1 = this;
|
6034 |
+
|
6035 |
+
var parts = [], ranges = this.sel.ranges
|
6036 |
+
for (var i = 0; i < ranges.length; i++) {
|
6037 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
|
6038 |
+
if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()) }
|
6039 |
+
parts[i] = sel
|
6040 |
+
}
|
6041 |
+
return parts
|
6042 |
+
},
|
6043 |
+
replaceSelection: function(code, collapse, origin) {
|
6044 |
+
var dup = []
|
6045 |
+
for (var i = 0; i < this.sel.ranges.length; i++)
|
6046 |
+
{ dup[i] = code }
|
6047 |
+
this.replaceSelections(dup, collapse, origin || "+input")
|
6048 |
+
},
|
6049 |
+
replaceSelections: docMethodOp(function(code, collapse, origin) {
|
6050 |
+
var this$1 = this;
|
6051 |
+
|
6052 |
+
var changes = [], sel = this.sel
|
6053 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
6054 |
+
var range = sel.ranges[i]
|
6055 |
+
changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin}
|
6056 |
+
}
|
6057 |
+
var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse)
|
6058 |
+
for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
|
6059 |
+
{ makeChange(this$1, changes[i$1]) }
|
6060 |
+
if (newSel) { setSelectionReplaceHistory(this, newSel) }
|
6061 |
+
else if (this.cm) { ensureCursorVisible(this.cm) }
|
6062 |
+
}),
|
6063 |
+
undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}),
|
6064 |
+
redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}),
|
6065 |
+
undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}),
|
6066 |
+
redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}),
|
6067 |
+
|
6068 |
+
setExtending: function(val) {this.extend = val},
|
6069 |
+
getExtending: function() {return this.extend},
|
6070 |
+
|
6071 |
+
historySize: function() {
|
6072 |
+
var hist = this.history, done = 0, undone = 0
|
6073 |
+
for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } }
|
6074 |
+
for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } }
|
6075 |
+
return {undo: done, redo: undone}
|
6076 |
+
},
|
6077 |
+
clearHistory: function() {this.history = new History(this.history.maxGeneration)},
|
6078 |
+
|
6079 |
+
markClean: function() {
|
6080 |
+
this.cleanGeneration = this.changeGeneration(true)
|
6081 |
+
},
|
6082 |
+
changeGeneration: function(forceSplit) {
|
6083 |
+
if (forceSplit)
|
6084 |
+
{ this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null }
|
6085 |
+
return this.history.generation
|
6086 |
+
},
|
6087 |
+
isClean: function (gen) {
|
6088 |
+
return this.history.generation == (gen || this.cleanGeneration)
|
6089 |
+
},
|
6090 |
+
|
6091 |
+
getHistory: function() {
|
6092 |
+
return {done: copyHistoryArray(this.history.done),
|
6093 |
+
undone: copyHistoryArray(this.history.undone)}
|
6094 |
+
},
|
6095 |
+
setHistory: function(histData) {
|
6096 |
+
var hist = this.history = new History(this.history.maxGeneration)
|
6097 |
+
hist.done = copyHistoryArray(histData.done.slice(0), null, true)
|
6098 |
+
hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)
|
6099 |
+
},
|
6100 |
+
|
6101 |
+
setGutterMarker: docMethodOp(function(line, gutterID, value) {
|
6102 |
+
return changeLine(this, line, "gutter", function (line) {
|
6103 |
+
var markers = line.gutterMarkers || (line.gutterMarkers = {})
|
6104 |
+
markers[gutterID] = value
|
6105 |
+
if (!value && isEmpty(markers)) { line.gutterMarkers = null }
|
6106 |
+
return true
|
6107 |
+
})
|
6108 |
+
}),
|
6109 |
+
|
6110 |
+
clearGutter: docMethodOp(function(gutterID) {
|
6111 |
+
var this$1 = this;
|
6112 |
+
|
6113 |
+
this.iter(function (line) {
|
6114 |
+
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
|
6115 |
+
changeLine(this$1, line, "gutter", function () {
|
6116 |
+
line.gutterMarkers[gutterID] = null
|
6117 |
+
if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null }
|
6118 |
+
return true
|
6119 |
+
})
|
6120 |
+
}
|
6121 |
+
})
|
6122 |
+
}),
|
6123 |
+
|
6124 |
+
lineInfo: function(line) {
|
6125 |
+
var n
|
6126 |
+
if (typeof line == "number") {
|
6127 |
+
if (!isLine(this, line)) { return null }
|
6128 |
+
n = line
|
6129 |
+
line = getLine(this, line)
|
6130 |
+
if (!line) { return null }
|
6131 |
+
} else {
|
6132 |
+
n = lineNo(line)
|
6133 |
+
if (n == null) { return null }
|
6134 |
+
}
|
6135 |
+
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
|
6136 |
+
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
|
6137 |
+
widgets: line.widgets}
|
6138 |
+
},
|
6139 |
+
|
6140 |
+
addLineClass: docMethodOp(function(handle, where, cls) {
|
6141 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6142 |
+
var prop = where == "text" ? "textClass"
|
6143 |
+
: where == "background" ? "bgClass"
|
6144 |
+
: where == "gutter" ? "gutterClass" : "wrapClass"
|
6145 |
+
if (!line[prop]) { line[prop] = cls }
|
6146 |
+
else if (classTest(cls).test(line[prop])) { return false }
|
6147 |
+
else { line[prop] += " " + cls }
|
6148 |
+
return true
|
6149 |
+
})
|
6150 |
+
}),
|
6151 |
+
removeLineClass: docMethodOp(function(handle, where, cls) {
|
6152 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6153 |
+
var prop = where == "text" ? "textClass"
|
6154 |
+
: where == "background" ? "bgClass"
|
6155 |
+
: where == "gutter" ? "gutterClass" : "wrapClass"
|
6156 |
+
var cur = line[prop]
|
6157 |
+
if (!cur) { return false }
|
6158 |
+
else if (cls == null) { line[prop] = null }
|
6159 |
+
else {
|
6160 |
+
var found = cur.match(classTest(cls))
|
6161 |
+
if (!found) { return false }
|
6162 |
+
var end = found.index + found[0].length
|
6163 |
+
line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null
|
6164 |
+
}
|
6165 |
+
return true
|
6166 |
+
})
|
6167 |
+
}),
|
6168 |
+
|
6169 |
+
addLineWidget: docMethodOp(function(handle, node, options) {
|
6170 |
+
return addLineWidget(this, handle, node, options)
|
6171 |
+
}),
|
6172 |
+
removeLineWidget: function(widget) { widget.clear() },
|
6173 |
+
|
6174 |
+
markText: function(from, to, options) {
|
6175 |
+
return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
|
6176 |
+
},
|
6177 |
+
setBookmark: function(pos, options) {
|
6178 |
+
var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
|
6179 |
+
insertLeft: options && options.insertLeft,
|
6180 |
+
clearWhenEmpty: false, shared: options && options.shared,
|
6181 |
+
handleMouseEvents: options && options.handleMouseEvents}
|
6182 |
+
pos = clipPos(this, pos)
|
6183 |
+
return markText(this, pos, pos, realOpts, "bookmark")
|
6184 |
+
},
|
6185 |
+
findMarksAt: function(pos) {
|
6186 |
+
pos = clipPos(this, pos)
|
6187 |
+
var markers = [], spans = getLine(this, pos.line).markedSpans
|
6188 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
6189 |
+
var span = spans[i]
|
6190 |
+
if ((span.from == null || span.from <= pos.ch) &&
|
6191 |
+
(span.to == null || span.to >= pos.ch))
|
6192 |
+
{ markers.push(span.marker.parent || span.marker) }
|
6193 |
+
} }
|
6194 |
+
return markers
|
6195 |
+
},
|
6196 |
+
findMarks: function(from, to, filter) {
|
6197 |
+
from = clipPos(this, from); to = clipPos(this, to)
|
6198 |
+
var found = [], lineNo = from.line
|
6199 |
+
this.iter(from.line, to.line + 1, function (line) {
|
6200 |
+
var spans = line.markedSpans
|
6201 |
+
if (spans) { for (var i = 0; i < spans.length; i++) {
|
6202 |
+
var span = spans[i]
|
6203 |
+
if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
|
6204 |
+
span.from == null && lineNo != from.line ||
|
6205 |
+
span.from != null && lineNo == to.line && span.from >= to.ch) &&
|
6206 |
+
(!filter || filter(span.marker)))
|
6207 |
+
{ found.push(span.marker.parent || span.marker) }
|
6208 |
+
} }
|
6209 |
+
++lineNo
|
6210 |
+
})
|
6211 |
+
return found
|
6212 |
+
},
|
6213 |
+
getAllMarks: function() {
|
6214 |
+
var markers = []
|
6215 |
+
this.iter(function (line) {
|
6216 |
+
var sps = line.markedSpans
|
6217 |
+
if (sps) { for (var i = 0; i < sps.length; ++i)
|
6218 |
+
{ if (sps[i].from != null) { markers.push(sps[i].marker) } } }
|
6219 |
+
})
|
6220 |
+
return markers
|
6221 |
+
},
|
6222 |
+
|
6223 |
+
posFromIndex: function(off) {
|
6224 |
+
var ch, lineNo = this.first, sepSize = this.lineSeparator().length
|
6225 |
+
this.iter(function (line) {
|
6226 |
+
var sz = line.text.length + sepSize
|
6227 |
+
if (sz > off) { ch = off; return true }
|
6228 |
+
off -= sz
|
6229 |
+
++lineNo
|
6230 |
+
})
|
6231 |
+
return clipPos(this, Pos(lineNo, ch))
|
6232 |
+
},
|
6233 |
+
indexFromPos: function (coords) {
|
6234 |
+
coords = clipPos(this, coords)
|
6235 |
+
var index = coords.ch
|
6236 |
+
if (coords.line < this.first || coords.ch < 0) { return 0 }
|
6237 |
+
var sepSize = this.lineSeparator().length
|
6238 |
+
this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
|
6239 |
+
index += line.text.length + sepSize
|
6240 |
+
})
|
6241 |
+
return index
|
6242 |
+
},
|
6243 |
+
|
6244 |
+
copy: function(copyHistory) {
|
6245 |
+
var doc = new Doc(getLines(this, this.first, this.first + this.size),
|
6246 |
+
this.modeOption, this.first, this.lineSep, this.direction)
|
6247 |
+
doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft
|
6248 |
+
doc.sel = this.sel
|
6249 |
+
doc.extend = false
|
6250 |
+
if (copyHistory) {
|
6251 |
+
doc.history.undoDepth = this.history.undoDepth
|
6252 |
+
doc.setHistory(this.getHistory())
|
6253 |
+
}
|
6254 |
+
return doc
|
6255 |
+
},
|
6256 |
+
|
6257 |
+
linkedDoc: function(options) {
|
6258 |
+
if (!options) { options = {} }
|
6259 |
+
var from = this.first, to = this.first + this.size
|
6260 |
+
if (options.from != null && options.from > from) { from = options.from }
|
6261 |
+
if (options.to != null && options.to < to) { to = options.to }
|
6262 |
+
var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction)
|
6263 |
+
if (options.sharedHist) { copy.history = this.history
|
6264 |
+
; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist})
|
6265 |
+
copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]
|
6266 |
+
copySharedMarkers(copy, findSharedMarkers(this))
|
6267 |
+
return copy
|
6268 |
+
},
|
6269 |
+
unlinkDoc: function(other) {
|
6270 |
+
var this$1 = this;
|
6271 |
+
|
6272 |
+
if (other instanceof CodeMirror) { other = other.doc }
|
6273 |
+
if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
|
6274 |
+
var link = this$1.linked[i]
|
6275 |
+
if (link.doc != other) { continue }
|
6276 |
+
this$1.linked.splice(i, 1)
|
6277 |
+
other.unlinkDoc(this$1)
|
6278 |
+
detachSharedMarkers(findSharedMarkers(this$1))
|
6279 |
+
break
|
6280 |
+
} }
|
6281 |
+
// If the histories were shared, split them again
|
6282 |
+
if (other.history == this.history) {
|
6283 |
+
var splitIds = [other.id]
|
6284 |
+
linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true)
|
6285 |
+
other.history = new History(null)
|
6286 |
+
other.history.done = copyHistoryArray(this.history.done, splitIds)
|
6287 |
+
other.history.undone = copyHistoryArray(this.history.undone, splitIds)
|
6288 |
+
}
|
6289 |
+
},
|
6290 |
+
iterLinkedDocs: function(f) {linkedDocs(this, f)},
|
6291 |
+
|
6292 |
+
getMode: function() {return this.mode},
|
6293 |
+
getEditor: function() {return this.cm},
|
6294 |
+
|
6295 |
+
splitLines: function(str) {
|
6296 |
+
if (this.lineSep) { return str.split(this.lineSep) }
|
6297 |
+
return splitLinesAuto(str)
|
6298 |
+
},
|
6299 |
+
lineSeparator: function() { return this.lineSep || "\n" },
|
6300 |
+
|
6301 |
+
setDirection: docMethodOp(function (dir) {
|
6302 |
+
if (dir != "rtl") { dir = "ltr" }
|
6303 |
+
if (dir == this.direction) { return }
|
6304 |
+
this.direction = dir
|
6305 |
+
this.iter(function (line) { return line.order = null; })
|
6306 |
+
if (this.cm) { directionChanged(this.cm) }
|
6307 |
+
})
|
6308 |
+
})
|
6309 |
+
|
6310 |
+
// Public alias.
|
6311 |
+
Doc.prototype.eachLine = Doc.prototype.iter
|
6312 |
+
|
6313 |
+
// Kludge to work around strange IE behavior where it'll sometimes
|
6314 |
+
// re-fire a series of drag-related events right after the drop (#1551)
|
6315 |
+
var lastDrop = 0
|
6316 |
+
|
6317 |
+
function onDrop(e) {
|
6318 |
+
var cm = this
|
6319 |
+
clearDragCursor(cm)
|
6320 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
|
6321 |
+
{ return }
|
6322 |
+
e_preventDefault(e)
|
6323 |
+
if (ie) { lastDrop = +new Date }
|
6324 |
+
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files
|
6325 |
+
if (!pos || cm.isReadOnly()) { return }
|
6326 |
+
// Might be a file drop, in which case we simply extract the text
|
6327 |
+
// and insert it.
|
6328 |
+
if (files && files.length && window.FileReader && window.File) {
|
6329 |
+
var n = files.length, text = Array(n), read = 0
|
6330 |
+
var loadFile = function (file, i) {
|
6331 |
+
if (cm.options.allowDropFileTypes &&
|
6332 |
+
indexOf(cm.options.allowDropFileTypes, file.type) == -1)
|
6333 |
+
{ return }
|
6334 |
+
|
6335 |
+
var reader = new FileReader
|
6336 |
+
reader.onload = operation(cm, function () {
|
6337 |
+
var content = reader.result
|
6338 |
+
if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = "" }
|
6339 |
+
text[i] = content
|
6340 |
+
if (++read == n) {
|
6341 |
+
pos = clipPos(cm.doc, pos)
|
6342 |
+
var change = {from: pos, to: pos,
|
6343 |
+
text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
|
6344 |
+
origin: "paste"}
|
6345 |
+
makeChange(cm.doc, change)
|
6346 |
+
setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)))
|
6347 |
+
}
|
6348 |
+
})
|
6349 |
+
reader.readAsText(file)
|
6350 |
+
}
|
6351 |
+
for (var i = 0; i < n; ++i) { loadFile(files[i], i) }
|
6352 |
+
} else { // Normal drop
|
6353 |
+
// Don't do a replace if the drop happened inside of the selected text.
|
6354 |
+
if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
|
6355 |
+
cm.state.draggingText(e)
|
6356 |
+
// Ensure the editor is re-focused
|
6357 |
+
setTimeout(function () { return cm.display.input.focus(); }, 20)
|
6358 |
+
return
|
6359 |
+
}
|
6360 |
+
try {
|
6361 |
+
var text$1 = e.dataTransfer.getData("Text")
|
6362 |
+
if (text$1) {
|
6363 |
+
var selected
|
6364 |
+
if (cm.state.draggingText && !cm.state.draggingText.copy)
|
6365 |
+
{ selected = cm.listSelections() }
|
6366 |
+
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos))
|
6367 |
+
if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
|
6368 |
+
{ replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag") } }
|
6369 |
+
cm.replaceSelection(text$1, "around", "paste")
|
6370 |
+
cm.display.input.focus()
|
6371 |
+
}
|
6372 |
+
}
|
6373 |
+
catch(e){}
|
6374 |
+
}
|
6375 |
+
}
|
6376 |
+
|
6377 |
+
function onDragStart(cm, e) {
|
6378 |
+
if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
|
6379 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
|
6380 |
+
|
6381 |
+
e.dataTransfer.setData("Text", cm.getSelection())
|
6382 |
+
e.dataTransfer.effectAllowed = "copyMove"
|
6383 |
+
|
6384 |
+
// Use dummy image instead of default browsers image.
|
6385 |
+
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
|
6386 |
+
if (e.dataTransfer.setDragImage && !safari) {
|
6387 |
+
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;")
|
6388 |
+
img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
|
6389 |
+
if (presto) {
|
6390 |
+
img.width = img.height = 1
|
6391 |
+
cm.display.wrapper.appendChild(img)
|
6392 |
+
// Force a relayout, or Opera won't use our image for some obscure reason
|
6393 |
+
img._top = img.offsetTop
|
6394 |
+
}
|
6395 |
+
e.dataTransfer.setDragImage(img, 0, 0)
|
6396 |
+
if (presto) { img.parentNode.removeChild(img) }
|
6397 |
+
}
|
6398 |
+
}
|
6399 |
+
|
6400 |
+
function onDragOver(cm, e) {
|
6401 |
+
var pos = posFromMouse(cm, e)
|
6402 |
+
if (!pos) { return }
|
6403 |
+
var frag = document.createDocumentFragment()
|
6404 |
+
drawSelectionCursor(cm, pos, frag)
|
6405 |
+
if (!cm.display.dragCursor) {
|
6406 |
+
cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors")
|
6407 |
+
cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv)
|
6408 |
+
}
|
6409 |
+
removeChildrenAndAdd(cm.display.dragCursor, frag)
|
6410 |
+
}
|
6411 |
+
|
6412 |
+
function clearDragCursor(cm) {
|
6413 |
+
if (cm.display.dragCursor) {
|
6414 |
+
cm.display.lineSpace.removeChild(cm.display.dragCursor)
|
6415 |
+
cm.display.dragCursor = null
|
6416 |
+
}
|
6417 |
+
}
|
6418 |
+
|
6419 |
+
// These must be handled carefully, because naively registering a
|
6420 |
+
// handler for each editor will cause the editors to never be
|
6421 |
+
// garbage collected.
|
6422 |
+
|
6423 |
+
function forEachCodeMirror(f) {
|
6424 |
+
if (!document.body.getElementsByClassName) { return }
|
6425 |
+
var byClass = document.body.getElementsByClassName("CodeMirror")
|
6426 |
+
for (var i = 0; i < byClass.length; i++) {
|
6427 |
+
var cm = byClass[i].CodeMirror
|
6428 |
+
if (cm) { f(cm) }
|
6429 |
+
}
|
6430 |
+
}
|
6431 |
+
|
6432 |
+
var globalsRegistered = false
|
6433 |
+
function ensureGlobalHandlers() {
|
6434 |
+
if (globalsRegistered) { return }
|
6435 |
+
registerGlobalHandlers()
|
6436 |
+
globalsRegistered = true
|
6437 |
+
}
|
6438 |
+
function registerGlobalHandlers() {
|
6439 |
+
// When the window resizes, we need to refresh active editors.
|
6440 |
+
var resizeTimer
|
6441 |
+
on(window, "resize", function () {
|
6442 |
+
if (resizeTimer == null) { resizeTimer = setTimeout(function () {
|
6443 |
+
resizeTimer = null
|
6444 |
+
forEachCodeMirror(onResize)
|
6445 |
+
}, 100) }
|
6446 |
+
})
|
6447 |
+
// When the window loses focus, we want to show the editor as blurred
|
6448 |
+
on(window, "blur", function () { return forEachCodeMirror(onBlur); })
|
6449 |
+
}
|
6450 |
+
// Called when the window resizes
|
6451 |
+
function onResize(cm) {
|
6452 |
+
var d = cm.display
|
6453 |
+
if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
|
6454 |
+
{ return }
|
6455 |
+
// Might be a text scaling operation, clear size caches.
|
6456 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
|
6457 |
+
d.scrollbarsClipped = false
|
6458 |
+
cm.setSize()
|
6459 |
+
}
|
6460 |
+
|
6461 |
+
var keyNames = {
|
6462 |
+
3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
6463 |
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
6464 |
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
6465 |
+
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
|
6466 |
+
106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
|
6467 |
+
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
6468 |
+
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
|
6469 |
+
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
|
6470 |
+
}
|
6471 |
+
|
6472 |
+
// Number keys
|
6473 |
+
for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i) }
|
6474 |
+
// Alphabetic keys
|
6475 |
+
for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1) }
|
6476 |
+
// Function keys
|
6477 |
+
for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2 }
|
6478 |
+
|
6479 |
+
var keyMap = {}
|
6480 |
+
|
6481 |
+
keyMap.basic = {
|
6482 |
+
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
6483 |
+
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
6484 |
+
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
|
6485 |
+
"Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
6486 |
+
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
|
6487 |
+
"Esc": "singleSelection"
|
6488 |
+
}
|
6489 |
+
// Note that the save and find-related commands aren't defined by
|
6490 |
+
// default. User code or addons can define them. Unknown commands
|
6491 |
+
// are simply ignored.
|
6492 |
+
keyMap.pcDefault = {
|
6493 |
+
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
6494 |
+
"Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
|
6495 |
+
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
6496 |
+
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
6497 |
+
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
6498 |
+
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
6499 |
+
"Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
|
6500 |
+
fallthrough: "basic"
|
6501 |
+
}
|
6502 |
+
// Very basic readline/emacs-style bindings, which are standard on Mac.
|
6503 |
+
keyMap.emacsy = {
|
6504 |
+
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
6505 |
+
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
6506 |
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
|
6507 |
+
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
|
6508 |
+
"Ctrl-O": "openLine"
|
6509 |
+
}
|
6510 |
+
keyMap.macDefault = {
|
6511 |
+
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
|
6512 |
+
"Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
|
6513 |
+
"Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
|
6514 |
+
"Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
|
6515 |
+
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
6516 |
+
"Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
|
6517 |
+
"Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
|
6518 |
+
fallthrough: ["basic", "emacsy"]
|
6519 |
+
}
|
6520 |
+
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault
|
6521 |
+
|
6522 |
+
// KEYMAP DISPATCH
|
6523 |
+
|
6524 |
+
function normalizeKeyName(name) {
|
6525 |
+
var parts = name.split(/-(?!$)/)
|
6526 |
+
name = parts[parts.length - 1]
|
6527 |
+
var alt, ctrl, shift, cmd
|
6528 |
+
for (var i = 0; i < parts.length - 1; i++) {
|
6529 |
+
var mod = parts[i]
|
6530 |
+
if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true }
|
6531 |
+
else if (/^a(lt)?$/i.test(mod)) { alt = true }
|
6532 |
+
else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true }
|
6533 |
+
else if (/^s(hift)?$/i.test(mod)) { shift = true }
|
6534 |
+
else { throw new Error("Unrecognized modifier name: " + mod) }
|
6535 |
+
}
|
6536 |
+
if (alt) { name = "Alt-" + name }
|
6537 |
+
if (ctrl) { name = "Ctrl-" + name }
|
6538 |
+
if (cmd) { name = "Cmd-" + name }
|
6539 |
+
if (shift) { name = "Shift-" + name }
|
6540 |
+
return name
|
6541 |
+
}
|
6542 |
+
|
6543 |
+
// This is a kludge to keep keymaps mostly working as raw objects
|
6544 |
+
// (backwards compatibility) while at the same time support features
|
6545 |
+
// like normalization and multi-stroke key bindings. It compiles a
|
6546 |
+
// new normalized keymap, and then updates the old object to reflect
|
6547 |
+
// this.
|
6548 |
+
function normalizeKeyMap(keymap) {
|
6549 |
+
var copy = {}
|
6550 |
+
for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
|
6551 |
+
var value = keymap[keyname]
|
6552 |
+
if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
|
6553 |
+
if (value == "...") { delete keymap[keyname]; continue }
|
6554 |
+
|
6555 |
+
var keys = map(keyname.split(" "), normalizeKeyName)
|
6556 |
+
for (var i = 0; i < keys.length; i++) {
|
6557 |
+
var val = (void 0), name = (void 0)
|
6558 |
+
if (i == keys.length - 1) {
|
6559 |
+
name = keys.join(" ")
|
6560 |
+
val = value
|
6561 |
+
} else {
|
6562 |
+
name = keys.slice(0, i + 1).join(" ")
|
6563 |
+
val = "..."
|
6564 |
+
}
|
6565 |
+
var prev = copy[name]
|
6566 |
+
if (!prev) { copy[name] = val }
|
6567 |
+
else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
|
6568 |
+
}
|
6569 |
+
delete keymap[keyname]
|
6570 |
+
} }
|
6571 |
+
for (var prop in copy) { keymap[prop] = copy[prop] }
|
6572 |
+
return keymap
|
6573 |
+
}
|
6574 |
+
|
6575 |
+
function lookupKey(key, map, handle, context) {
|
6576 |
+
map = getKeyMap(map)
|
6577 |
+
var found = map.call ? map.call(key, context) : map[key]
|
6578 |
+
if (found === false) { return "nothing" }
|
6579 |
+
if (found === "...") { return "multi" }
|
6580 |
+
if (found != null && handle(found)) { return "handled" }
|
6581 |
+
|
6582 |
+
if (map.fallthrough) {
|
6583 |
+
if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
|
6584 |
+
{ return lookupKey(key, map.fallthrough, handle, context) }
|
6585 |
+
for (var i = 0; i < map.fallthrough.length; i++) {
|
6586 |
+
var result = lookupKey(key, map.fallthrough[i], handle, context)
|
6587 |
+
if (result) { return result }
|
6588 |
+
}
|
6589 |
+
}
|
6590 |
+
}
|
6591 |
+
|
6592 |
+
// Modifier key presses don't count as 'real' key presses for the
|
6593 |
+
// purpose of keymap fallthrough.
|
6594 |
+
function isModifierKey(value) {
|
6595 |
+
var name = typeof value == "string" ? value : keyNames[value.keyCode]
|
6596 |
+
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
|
6597 |
+
}
|
6598 |
+
|
6599 |
+
// Look up the name of a key as indicated by an event object.
|
6600 |
+
function keyName(event, noShift) {
|
6601 |
+
if (presto && event.keyCode == 34 && event["char"]) { return false }
|
6602 |
+
var base = keyNames[event.keyCode], name = base
|
6603 |
+
if (name == null || event.altGraphKey) { return false }
|
6604 |
+
if (event.altKey && base != "Alt") { name = "Alt-" + name }
|
6605 |
+
if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name }
|
6606 |
+
if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name }
|
6607 |
+
if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name }
|
6608 |
+
return name
|
6609 |
+
}
|
6610 |
+
|
6611 |
+
function getKeyMap(val) {
|
6612 |
+
return typeof val == "string" ? keyMap[val] : val
|
6613 |
+
}
|
6614 |
+
|
6615 |
+
// Helper for deleting text near the selection(s), used to implement
|
6616 |
+
// backspace, delete, and similar functionality.
|
6617 |
+
function deleteNearSelection(cm, compute) {
|
6618 |
+
var ranges = cm.doc.sel.ranges, kill = []
|
6619 |
+
// Build up a set of ranges to kill first, merging overlapping
|
6620 |
+
// ranges.
|
6621 |
+
for (var i = 0; i < ranges.length; i++) {
|
6622 |
+
var toKill = compute(ranges[i])
|
6623 |
+
while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
|
6624 |
+
var replaced = kill.pop()
|
6625 |
+
if (cmp(replaced.from, toKill.from) < 0) {
|
6626 |
+
toKill.from = replaced.from
|
6627 |
+
break
|
6628 |
+
}
|
6629 |
+
}
|
6630 |
+
kill.push(toKill)
|
6631 |
+
}
|
6632 |
+
// Next, remove those actual ranges.
|
6633 |
+
runInOp(cm, function () {
|
6634 |
+
for (var i = kill.length - 1; i >= 0; i--)
|
6635 |
+
{ replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") }
|
6636 |
+
ensureCursorVisible(cm)
|
6637 |
+
})
|
6638 |
+
}
|
6639 |
+
|
6640 |
+
// Commands are parameter-less actions that can be performed on an
|
6641 |
+
// editor, mostly used for keybindings.
|
6642 |
+
var commands = {
|
6643 |
+
selectAll: selectAll,
|
6644 |
+
singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
|
6645 |
+
killLine: function (cm) { return deleteNearSelection(cm, function (range) {
|
6646 |
+
if (range.empty()) {
|
6647 |
+
var len = getLine(cm.doc, range.head.line).text.length
|
6648 |
+
if (range.head.ch == len && range.head.line < cm.lastLine())
|
6649 |
+
{ return {from: range.head, to: Pos(range.head.line + 1, 0)} }
|
6650 |
+
else
|
6651 |
+
{ return {from: range.head, to: Pos(range.head.line, len)} }
|
6652 |
+
} else {
|
6653 |
+
return {from: range.from(), to: range.to()}
|
6654 |
+
}
|
6655 |
+
}); },
|
6656 |
+
deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
|
6657 |
+
from: Pos(range.from().line, 0),
|
6658 |
+
to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
|
6659 |
+
}); }); },
|
6660 |
+
delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
|
6661 |
+
from: Pos(range.from().line, 0), to: range.from()
|
6662 |
+
}); }); },
|
6663 |
+
delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
|
6664 |
+
var top = cm.charCoords(range.head, "div").top + 5
|
6665 |
+
var leftPos = cm.coordsChar({left: 0, top: top}, "div")
|
6666 |
+
return {from: leftPos, to: range.from()}
|
6667 |
+
}); },
|
6668 |
+
delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
|
6669 |
+
var top = cm.charCoords(range.head, "div").top + 5
|
6670 |
+
var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
|
6671 |
+
return {from: range.from(), to: rightPos }
|
6672 |
+
}); },
|
6673 |
+
undo: function (cm) { return cm.undo(); },
|
6674 |
+
redo: function (cm) { return cm.redo(); },
|
6675 |
+
undoSelection: function (cm) { return cm.undoSelection(); },
|
6676 |
+
redoSelection: function (cm) { return cm.redoSelection(); },
|
6677 |
+
goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
|
6678 |
+
goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
|
6679 |
+
goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
|
6680 |
+
{origin: "+move", bias: 1}
|
6681 |
+
); },
|
6682 |
+
goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
|
6683 |
+
{origin: "+move", bias: 1}
|
6684 |
+
); },
|
6685 |
+
goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
|
6686 |
+
{origin: "+move", bias: -1}
|
6687 |
+
); },
|
6688 |
+
goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6689 |
+
var top = cm.charCoords(range.head, "div").top + 5
|
6690 |
+
return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
|
6691 |
+
}, sel_move); },
|
6692 |
+
goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6693 |
+
var top = cm.charCoords(range.head, "div").top + 5
|
6694 |
+
return cm.coordsChar({left: 0, top: top}, "div")
|
6695 |
+
}, sel_move); },
|
6696 |
+
goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
|
6697 |
+
var top = cm.charCoords(range.head, "div").top + 5
|
6698 |
+
var pos = cm.coordsChar({left: 0, top: top}, "div")
|
6699 |
+
if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
|
6700 |
+
return pos
|
6701 |
+
}, sel_move); },
|
6702 |
+
goLineUp: function (cm) { return cm.moveV(-1, "line"); },
|
6703 |
+
goLineDown: function (cm) { return cm.moveV(1, "line"); },
|
6704 |
+
goPageUp: function (cm) { return cm.moveV(-1, "page"); },
|
6705 |
+
goPageDown: function (cm) { return cm.moveV(1, "page"); },
|
6706 |
+
goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
|
6707 |
+
goCharRight: function (cm) { return cm.moveH(1, "char"); },
|
6708 |
+
goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
|
6709 |
+
goColumnRight: function (cm) { return cm.moveH(1, "column"); },
|
6710 |
+
goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
|
6711 |
+
goGroupRight: function (cm) { return cm.moveH(1, "group"); },
|
6712 |
+
goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
|
6713 |
+
goWordRight: function (cm) { return cm.moveH(1, "word"); },
|
6714 |
+
delCharBefore: function (cm) { return cm.deleteH(-1, "char"); },
|
6715 |
+
delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
|
6716 |
+
delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
|
6717 |
+
delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
|
6718 |
+
delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
|
6719 |
+
delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
|
6720 |
+
indentAuto: function (cm) { return cm.indentSelection("smart"); },
|
6721 |
+
indentMore: function (cm) { return cm.indentSelection("add"); },
|
6722 |
+
indentLess: function (cm) { return cm.indentSelection("subtract"); },
|
6723 |
+
insertTab: function (cm) { return cm.replaceSelection("\t"); },
|
6724 |
+
insertSoftTab: function (cm) {
|
6725 |
+
var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize
|
6726 |
+
for (var i = 0; i < ranges.length; i++) {
|
6727 |
+
var pos = ranges[i].from()
|
6728 |
+
var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize)
|
6729 |
+
spaces.push(spaceStr(tabSize - col % tabSize))
|
6730 |
+
}
|
6731 |
+
cm.replaceSelections(spaces)
|
6732 |
+
},
|
6733 |
+
defaultTab: function (cm) {
|
6734 |
+
if (cm.somethingSelected()) { cm.indentSelection("add") }
|
6735 |
+
else { cm.execCommand("insertTab") }
|
6736 |
+
},
|
6737 |
+
// Swap the two chars left and right of each selection's head.
|
6738 |
+
// Move cursor behind the two swapped characters afterwards.
|
6739 |
+
//
|
6740 |
+
// Doesn't consider line feeds a character.
|
6741 |
+
// Doesn't scan more than one line above to find a character.
|
6742 |
+
// Doesn't do anything on an empty line.
|
6743 |
+
// Doesn't do anything with non-empty selections.
|
6744 |
+
transposeChars: function (cm) { return runInOp(cm, function () {
|
6745 |
+
var ranges = cm.listSelections(), newSel = []
|
6746 |
+
for (var i = 0; i < ranges.length; i++) {
|
6747 |
+
if (!ranges[i].empty()) { continue }
|
6748 |
+
var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text
|
6749 |
+
if (line) {
|
6750 |
+
if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1) }
|
6751 |
+
if (cur.ch > 0) {
|
6752 |
+
cur = new Pos(cur.line, cur.ch + 1)
|
6753 |
+
cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
|
6754 |
+
Pos(cur.line, cur.ch - 2), cur, "+transpose")
|
6755 |
+
} else if (cur.line > cm.doc.first) {
|
6756 |
+
var prev = getLine(cm.doc, cur.line - 1).text
|
6757 |
+
if (prev) {
|
6758 |
+
cur = new Pos(cur.line, 1)
|
6759 |
+
cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
|
6760 |
+
prev.charAt(prev.length - 1),
|
6761 |
+
Pos(cur.line - 1, prev.length - 1), cur, "+transpose")
|
6762 |
+
}
|
6763 |
+
}
|
6764 |
+
}
|
6765 |
+
newSel.push(new Range(cur, cur))
|
6766 |
+
}
|
6767 |
+
cm.setSelections(newSel)
|
6768 |
+
}); },
|
6769 |
+
newlineAndIndent: function (cm) { return runInOp(cm, function () {
|
6770 |
+
var sels = cm.listSelections()
|
6771 |
+
for (var i = sels.length - 1; i >= 0; i--)
|
6772 |
+
{ cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input") }
|
6773 |
+
sels = cm.listSelections()
|
6774 |
+
for (var i$1 = 0; i$1 < sels.length; i$1++)
|
6775 |
+
{ cm.indentLine(sels[i$1].from().line, null, true) }
|
6776 |
+
ensureCursorVisible(cm)
|
6777 |
+
}); },
|
6778 |
+
openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
|
6779 |
+
toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
|
6780 |
+
}
|
6781 |
+
|
6782 |
+
|
6783 |
+
function lineStart(cm, lineN) {
|
6784 |
+
var line = getLine(cm.doc, lineN)
|
6785 |
+
var visual = visualLine(line)
|
6786 |
+
if (visual != line) { lineN = lineNo(visual) }
|
6787 |
+
return endOfLine(true, cm, visual, lineN, 1)
|
6788 |
+
}
|
6789 |
+
function lineEnd(cm, lineN) {
|
6790 |
+
var line = getLine(cm.doc, lineN)
|
6791 |
+
var visual = visualLineEnd(line)
|
6792 |
+
if (visual != line) { lineN = lineNo(visual) }
|
6793 |
+
return endOfLine(true, cm, line, lineN, -1)
|
6794 |
+
}
|
6795 |
+
function lineStartSmart(cm, pos) {
|
6796 |
+
var start = lineStart(cm, pos.line)
|
6797 |
+
var line = getLine(cm.doc, start.line)
|
6798 |
+
var order = getOrder(line, cm.doc.direction)
|
6799 |
+
if (!order || order[0].level == 0) {
|
6800 |
+
var firstNonWS = Math.max(0, line.text.search(/\S/))
|
6801 |
+
var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
|
6802 |
+
return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
|
6803 |
+
}
|
6804 |
+
return start
|
6805 |
+
}
|
6806 |
+
|
6807 |
+
// Run a handler that was bound to a key.
|
6808 |
+
function doHandleBinding(cm, bound, dropShift) {
|
6809 |
+
if (typeof bound == "string") {
|
6810 |
+
bound = commands[bound]
|
6811 |
+
if (!bound) { return false }
|
6812 |
+
}
|
6813 |
+
// Ensure previous input has been read, so that the handler sees a
|
6814 |
+
// consistent view of the document
|
6815 |
+
cm.display.input.ensurePolled()
|
6816 |
+
var prevShift = cm.display.shift, done = false
|
6817 |
+
try {
|
6818 |
+
if (cm.isReadOnly()) { cm.state.suppressEdits = true }
|
6819 |
+
if (dropShift) { cm.display.shift = false }
|
6820 |
+
done = bound(cm) != Pass
|
6821 |
+
} finally {
|
6822 |
+
cm.display.shift = prevShift
|
6823 |
+
cm.state.suppressEdits = false
|
6824 |
+
}
|
6825 |
+
return done
|
6826 |
+
}
|
6827 |
+
|
6828 |
+
function lookupKeyForEditor(cm, name, handle) {
|
6829 |
+
for (var i = 0; i < cm.state.keyMaps.length; i++) {
|
6830 |
+
var result = lookupKey(name, cm.state.keyMaps[i], handle, cm)
|
6831 |
+
if (result) { return result }
|
6832 |
+
}
|
6833 |
+
return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
|
6834 |
+
|| lookupKey(name, cm.options.keyMap, handle, cm)
|
6835 |
+
}
|
6836 |
+
|
6837 |
+
var stopSeq = new Delayed
|
6838 |
+
function dispatchKey(cm, name, e, handle) {
|
6839 |
+
var seq = cm.state.keySeq
|
6840 |
+
if (seq) {
|
6841 |
+
if (isModifierKey(name)) { return "handled" }
|
6842 |
+
stopSeq.set(50, function () {
|
6843 |
+
if (cm.state.keySeq == seq) {
|
6844 |
+
cm.state.keySeq = null
|
6845 |
+
cm.display.input.reset()
|
6846 |
+
}
|
6847 |
+
})
|
6848 |
+
name = seq + " " + name
|
6849 |
+
}
|
6850 |
+
var result = lookupKeyForEditor(cm, name, handle)
|
6851 |
+
|
6852 |
+
if (result == "multi")
|
6853 |
+
{ cm.state.keySeq = name }
|
6854 |
+
if (result == "handled")
|
6855 |
+
{ signalLater(cm, "keyHandled", cm, name, e) }
|
6856 |
+
|
6857 |
+
if (result == "handled" || result == "multi") {
|
6858 |
+
e_preventDefault(e)
|
6859 |
+
restartBlink(cm)
|
6860 |
+
}
|
6861 |
+
|
6862 |
+
if (seq && !result && /\'$/.test(name)) {
|
6863 |
+
e_preventDefault(e)
|
6864 |
+
return true
|
6865 |
+
}
|
6866 |
+
return !!result
|
6867 |
+
}
|
6868 |
+
|
6869 |
+
// Handle a key from the keydown event.
|
6870 |
+
function handleKeyBinding(cm, e) {
|
6871 |
+
var name = keyName(e, true)
|
6872 |
+
if (!name) { return false }
|
6873 |
+
|
6874 |
+
if (e.shiftKey && !cm.state.keySeq) {
|
6875 |
+
// First try to resolve full name (including 'Shift-'). Failing
|
6876 |
+
// that, see if there is a cursor-motion command (starting with
|
6877 |
+
// 'go') bound to the keyname without 'Shift-'.
|
6878 |
+
return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
|
6879 |
+
|| dispatchKey(cm, name, e, function (b) {
|
6880 |
+
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
|
6881 |
+
{ return doHandleBinding(cm, b) }
|
6882 |
+
})
|
6883 |
+
} else {
|
6884 |
+
return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
|
6885 |
+
}
|
6886 |
+
}
|
6887 |
+
|
6888 |
+
// Handle a key from the keypress event
|
6889 |
+
function handleCharBinding(cm, e, ch) {
|
6890 |
+
return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
|
6891 |
+
}
|
6892 |
+
|
6893 |
+
var lastStoppedKey = null
|
6894 |
+
function onKeyDown(e) {
|
6895 |
+
var cm = this
|
6896 |
+
cm.curOp.focus = activeElt()
|
6897 |
+
if (signalDOMEvent(cm, e)) { return }
|
6898 |
+
// IE does strange things with escape.
|
6899 |
+
if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false }
|
6900 |
+
var code = e.keyCode
|
6901 |
+
cm.display.shift = code == 16 || e.shiftKey
|
6902 |
+
var handled = handleKeyBinding(cm, e)
|
6903 |
+
if (presto) {
|
6904 |
+
lastStoppedKey = handled ? code : null
|
6905 |
+
// Opera has no cut event... we try to at least catch the key combo
|
6906 |
+
if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
|
6907 |
+
{ cm.replaceSelection("", null, "cut") }
|
6908 |
+
}
|
6909 |
+
|
6910 |
+
// Turn mouse into crosshair when Alt is held on Mac.
|
6911 |
+
if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
|
6912 |
+
{ showCrossHair(cm) }
|
6913 |
+
}
|
6914 |
+
|
6915 |
+
function showCrossHair(cm) {
|
6916 |
+
var lineDiv = cm.display.lineDiv
|
6917 |
+
addClass(lineDiv, "CodeMirror-crosshair")
|
6918 |
+
|
6919 |
+
function up(e) {
|
6920 |
+
if (e.keyCode == 18 || !e.altKey) {
|
6921 |
+
rmClass(lineDiv, "CodeMirror-crosshair")
|
6922 |
+
off(document, "keyup", up)
|
6923 |
+
off(document, "mouseover", up)
|
6924 |
+
}
|
6925 |
+
}
|
6926 |
+
on(document, "keyup", up)
|
6927 |
+
on(document, "mouseover", up)
|
6928 |
+
}
|
6929 |
+
|
6930 |
+
function onKeyUp(e) {
|
6931 |
+
if (e.keyCode == 16) { this.doc.sel.shift = false }
|
6932 |
+
signalDOMEvent(this, e)
|
6933 |
+
}
|
6934 |
+
|
6935 |
+
function onKeyPress(e) {
|
6936 |
+
var cm = this
|
6937 |
+
if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
|
6938 |
+
var keyCode = e.keyCode, charCode = e.charCode
|
6939 |
+
if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
|
6940 |
+
if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
|
6941 |
+
var ch = String.fromCharCode(charCode == null ? keyCode : charCode)
|
6942 |
+
// Some browsers fire keypress events for backspace
|
6943 |
+
if (ch == "\x08") { return }
|
6944 |
+
if (handleCharBinding(cm, e, ch)) { return }
|
6945 |
+
cm.display.input.onKeyPress(e)
|
6946 |
+
}
|
6947 |
+
|
6948 |
+
// A mouse down can be a single click, double click, triple click,
|
6949 |
+
// start of selection drag, start of text drag, new cursor
|
6950 |
+
// (ctrl-click), rectangle drag (alt-drag), or xwin
|
6951 |
+
// middle-click-paste. Or it might be a click on something we should
|
6952 |
+
// not interfere with, such as a scrollbar or widget.
|
6953 |
+
function onMouseDown(e) {
|
6954 |
+
var cm = this, display = cm.display
|
6955 |
+
if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
|
6956 |
+
display.input.ensurePolled()
|
6957 |
+
display.shift = e.shiftKey
|
6958 |
+
|
6959 |
+
if (eventInWidget(display, e)) {
|
6960 |
+
if (!webkit) {
|
6961 |
+
// Briefly turn off draggability, to allow widgets to do
|
6962 |
+
// normal dragging things.
|
6963 |
+
display.scroller.draggable = false
|
6964 |
+
setTimeout(function () { return display.scroller.draggable = true; }, 100)
|
6965 |
+
}
|
6966 |
+
return
|
6967 |
+
}
|
6968 |
+
if (clickInGutter(cm, e)) { return }
|
6969 |
+
var start = posFromMouse(cm, e)
|
6970 |
+
window.focus()
|
6971 |
+
|
6972 |
+
switch (e_button(e)) {
|
6973 |
+
case 1:
|
6974 |
+
// #3261: make sure, that we're not starting a second selection
|
6975 |
+
if (cm.state.selectingText)
|
6976 |
+
{ cm.state.selectingText(e) }
|
6977 |
+
else if (start)
|
6978 |
+
{ leftButtonDown(cm, e, start) }
|
6979 |
+
else if (e_target(e) == display.scroller)
|
6980 |
+
{ e_preventDefault(e) }
|
6981 |
+
break
|
6982 |
+
case 2:
|
6983 |
+
if (webkit) { cm.state.lastMiddleDown = +new Date }
|
6984 |
+
if (start) { extendSelection(cm.doc, start) }
|
6985 |
+
setTimeout(function () { return display.input.focus(); }, 20)
|
6986 |
+
e_preventDefault(e)
|
6987 |
+
break
|
6988 |
+
case 3:
|
6989 |
+
if (captureRightClick) { onContextMenu(cm, e) }
|
6990 |
+
else { delayBlurEvent(cm) }
|
6991 |
+
break
|
6992 |
+
}
|
6993 |
+
}
|
6994 |
+
|
6995 |
+
var lastClick;
|
6996 |
+
var lastDoubleClick;
|
6997 |
+
function leftButtonDown(cm, e, start) {
|
6998 |
+
if (ie) { setTimeout(bind(ensureFocus, cm), 0) }
|
6999 |
+
else { cm.curOp.focus = activeElt() }
|
7000 |
+
|
7001 |
+
var now = +new Date, type
|
7002 |
+
if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
|
7003 |
+
type = "triple"
|
7004 |
+
} else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
|
7005 |
+
type = "double"
|
7006 |
+
lastDoubleClick = {time: now, pos: start}
|
7007 |
+
} else {
|
7008 |
+
type = "single"
|
7009 |
+
lastClick = {time: now, pos: start}
|
7010 |
+
}
|
7011 |
+
|
7012 |
+
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained
|
7013 |
+
if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
|
7014 |
+
type == "single" && (contained = sel.contains(start)) > -1 &&
|
7015 |
+
(cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
|
7016 |
+
(cmp(contained.to(), start) > 0 || start.xRel < 0))
|
7017 |
+
{ leftButtonStartDrag(cm, e, start, modifier) }
|
7018 |
+
else
|
7019 |
+
{ leftButtonSelect(cm, e, start, type, modifier) }
|
7020 |
+
}
|
7021 |
+
|
7022 |
+
// Start a text drag. When it ends, see if any dragging actually
|
7023 |
+
// happen, and treat as a click if it didn't.
|
7024 |
+
function leftButtonStartDrag(cm, e, start, modifier) {
|
7025 |
+
var display = cm.display, moved = false
|
7026 |
+
var dragEnd = operation(cm, function (e) {
|
7027 |
+
if (webkit) { display.scroller.draggable = false }
|
7028 |
+
cm.state.draggingText = false
|
7029 |
+
off(document, "mouseup", dragEnd)
|
7030 |
+
off(document, "mousemove", mouseMove)
|
7031 |
+
off(display.scroller, "dragstart", dragStart)
|
7032 |
+
off(display.scroller, "drop", dragEnd)
|
7033 |
+
if (!moved) {
|
7034 |
+
e_preventDefault(e)
|
7035 |
+
if (!modifier)
|
7036 |
+
{ extendSelection(cm.doc, start) }
|
7037 |
+
// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
|
7038 |
+
if (webkit || ie && ie_version == 9)
|
7039 |
+
{ setTimeout(function () {document.body.focus(); display.input.focus()}, 20) }
|
7040 |
+
else
|
7041 |
+
{ display.input.focus() }
|
7042 |
+
}
|
7043 |
+
})
|
7044 |
+
var mouseMove = function(e2) {
|
7045 |
+
moved = moved || Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) >= 10
|
7046 |
+
}
|
7047 |
+
var dragStart = function () { return moved = true; }
|
7048 |
+
// Let the drag handler handle this.
|
7049 |
+
if (webkit) { display.scroller.draggable = true }
|
7050 |
+
cm.state.draggingText = dragEnd
|
7051 |
+
dragEnd.copy = mac ? e.altKey : e.ctrlKey
|
7052 |
+
// IE's approach to draggable
|
7053 |
+
if (display.scroller.dragDrop) { display.scroller.dragDrop() }
|
7054 |
+
on(document, "mouseup", dragEnd)
|
7055 |
+
on(document, "mousemove", mouseMove)
|
7056 |
+
on(display.scroller, "dragstart", dragStart)
|
7057 |
+
on(display.scroller, "drop", dragEnd)
|
7058 |
+
|
7059 |
+
delayBlurEvent(cm)
|
7060 |
+
setTimeout(function () { return display.input.focus(); }, 20)
|
7061 |
+
}
|
7062 |
+
|
7063 |
+
// Normal selection, as opposed to text dragging.
|
7064 |
+
function leftButtonSelect(cm, e, start, type, addNew) {
|
7065 |
+
var display = cm.display, doc = cm.doc
|
7066 |
+
e_preventDefault(e)
|
7067 |
+
|
7068 |
+
var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges
|
7069 |
+
if (addNew && !e.shiftKey) {
|
7070 |
+
ourIndex = doc.sel.contains(start)
|
7071 |
+
if (ourIndex > -1)
|
7072 |
+
{ ourRange = ranges[ourIndex] }
|
7073 |
+
else
|
7074 |
+
{ ourRange = new Range(start, start) }
|
7075 |
+
} else {
|
7076 |
+
ourRange = doc.sel.primary()
|
7077 |
+
ourIndex = doc.sel.primIndex
|
7078 |
+
}
|
7079 |
+
|
7080 |
+
if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
|
7081 |
+
type = "rect"
|
7082 |
+
if (!addNew) { ourRange = new Range(start, start) }
|
7083 |
+
start = posFromMouse(cm, e, true, true)
|
7084 |
+
ourIndex = -1
|
7085 |
+
} else if (type == "double") {
|
7086 |
+
var word = cm.findWordAt(start)
|
7087 |
+
if (cm.display.shift || doc.extend)
|
7088 |
+
{ ourRange = extendRange(doc, ourRange, word.anchor, word.head) }
|
7089 |
+
else
|
7090 |
+
{ ourRange = word }
|
7091 |
+
} else if (type == "triple") {
|
7092 |
+
var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)))
|
7093 |
+
if (cm.display.shift || doc.extend)
|
7094 |
+
{ ourRange = extendRange(doc, ourRange, line.anchor, line.head) }
|
7095 |
+
else
|
7096 |
+
{ ourRange = line }
|
7097 |
+
} else {
|
7098 |
+
ourRange = extendRange(doc, ourRange, start)
|
7099 |
+
}
|
7100 |
+
|
7101 |
+
if (!addNew) {
|
7102 |
+
ourIndex = 0
|
7103 |
+
setSelection(doc, new Selection([ourRange], 0), sel_mouse)
|
7104 |
+
startSel = doc.sel
|
7105 |
+
} else if (ourIndex == -1) {
|
7106 |
+
ourIndex = ranges.length
|
7107 |
+
setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
|
7108 |
+
{scroll: false, origin: "*mouse"})
|
7109 |
+
} else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
|
7110 |
+
setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
|
7111 |
+
{scroll: false, origin: "*mouse"})
|
7112 |
+
startSel = doc.sel
|
7113 |
+
} else {
|
7114 |
+
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)
|
7115 |
+
}
|
7116 |
+
|
7117 |
+
var lastPos = start
|
7118 |
+
function extendTo(pos) {
|
7119 |
+
if (cmp(lastPos, pos) == 0) { return }
|
7120 |
+
lastPos = pos
|
7121 |
+
|
7122 |
+
if (type == "rect") {
|
7123 |
+
var ranges = [], tabSize = cm.options.tabSize
|
7124 |
+
var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)
|
7125 |
+
var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)
|
7126 |
+
var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)
|
7127 |
+
for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
|
7128 |
+
line <= end; line++) {
|
7129 |
+
var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)
|
7130 |
+
if (left == right)
|
7131 |
+
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) }
|
7132 |
+
else if (text.length > leftPos)
|
7133 |
+
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))) }
|
7134 |
+
}
|
7135 |
+
if (!ranges.length) { ranges.push(new Range(start, start)) }
|
7136 |
+
setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
|
7137 |
+
{origin: "*mouse", scroll: false})
|
7138 |
+
cm.scrollIntoView(pos)
|
7139 |
+
} else {
|
7140 |
+
var oldRange = ourRange
|
7141 |
+
var anchor = oldRange.anchor, head = pos
|
7142 |
+
if (type != "single") {
|
7143 |
+
var range
|
7144 |
+
if (type == "double")
|
7145 |
+
{ range = cm.findWordAt(pos) }
|
7146 |
+
else
|
7147 |
+
{ range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0))) }
|
7148 |
+
if (cmp(range.anchor, anchor) > 0) {
|
7149 |
+
head = range.head
|
7150 |
+
anchor = minPos(oldRange.from(), range.anchor)
|
7151 |
+
} else {
|
7152 |
+
head = range.anchor
|
7153 |
+
anchor = maxPos(oldRange.to(), range.head)
|
7154 |
+
}
|
7155 |
+
}
|
7156 |
+
var ranges$1 = startSel.ranges.slice(0)
|
7157 |
+
ranges$1[ourIndex] = new Range(clipPos(doc, anchor), head)
|
7158 |
+
setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse)
|
7159 |
+
}
|
7160 |
+
}
|
7161 |
+
|
7162 |
+
var editorSize = display.wrapper.getBoundingClientRect()
|
7163 |
+
// Used to ensure timeout re-tries don't fire when another extend
|
7164 |
+
// happened in the meantime (clearTimeout isn't reliable -- at
|
7165 |
+
// least on Chrome, the timeouts still happen even when cleared,
|
7166 |
+
// if the clear happens after their scheduled firing time).
|
7167 |
+
var counter = 0
|
7168 |
+
|
7169 |
+
function extend(e) {
|
7170 |
+
var curCount = ++counter
|
7171 |
+
var cur = posFromMouse(cm, e, true, type == "rect")
|
7172 |
+
if (!cur) { return }
|
7173 |
+
if (cmp(cur, lastPos) != 0) {
|
7174 |
+
cm.curOp.focus = activeElt()
|
7175 |
+
extendTo(cur)
|
7176 |
+
var visible = visibleLines(display, doc)
|
7177 |
+
if (cur.line >= visible.to || cur.line < visible.from)
|
7178 |
+
{ setTimeout(operation(cm, function () {if (counter == curCount) { extend(e) }}), 150) }
|
7179 |
+
} else {
|
7180 |
+
var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0
|
7181 |
+
if (outside) { setTimeout(operation(cm, function () {
|
7182 |
+
if (counter != curCount) { return }
|
7183 |
+
display.scroller.scrollTop += outside
|
7184 |
+
extend(e)
|
7185 |
+
}), 50) }
|
7186 |
+
}
|
7187 |
+
}
|
7188 |
+
|
7189 |
+
function done(e) {
|
7190 |
+
cm.state.selectingText = false
|
7191 |
+
counter = Infinity
|
7192 |
+
e_preventDefault(e)
|
7193 |
+
display.input.focus()
|
7194 |
+
off(document, "mousemove", move)
|
7195 |
+
off(document, "mouseup", up)
|
7196 |
+
doc.history.lastSelOrigin = null
|
7197 |
+
}
|
7198 |
+
|
7199 |
+
var move = operation(cm, function (e) {
|
7200 |
+
if (!e_button(e)) { done(e) }
|
7201 |
+
else { extend(e) }
|
7202 |
+
})
|
7203 |
+
var up = operation(cm, done)
|
7204 |
+
cm.state.selectingText = up
|
7205 |
+
on(document, "mousemove", move)
|
7206 |
+
on(document, "mouseup", up)
|
7207 |
+
}
|
7208 |
+
|
7209 |
+
|
7210 |
+
// Determines whether an event happened in the gutter, and fires the
|
7211 |
+
// handlers for the corresponding event.
|
7212 |
+
function gutterEvent(cm, e, type, prevent) {
|
7213 |
+
var mX, mY
|
7214 |
+
try { mX = e.clientX; mY = e.clientY }
|
7215 |
+
catch(e) { return false }
|
7216 |
+
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
|
7217 |
+
if (prevent) { e_preventDefault(e) }
|
7218 |
+
|
7219 |
+
var display = cm.display
|
7220 |
+
var lineBox = display.lineDiv.getBoundingClientRect()
|
7221 |
+
|
7222 |
+
if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
|
7223 |
+
mY -= lineBox.top - display.viewOffset
|
7224 |
+
|
7225 |
+
for (var i = 0; i < cm.options.gutters.length; ++i) {
|
7226 |
+
var g = display.gutters.childNodes[i]
|
7227 |
+
if (g && g.getBoundingClientRect().right >= mX) {
|
7228 |
+
var line = lineAtHeight(cm.doc, mY)
|
7229 |
+
var gutter = cm.options.gutters[i]
|
7230 |
+
signal(cm, type, cm, line, gutter, e)
|
7231 |
+
return e_defaultPrevented(e)
|
7232 |
+
}
|
7233 |
+
}
|
7234 |
+
}
|
7235 |
+
|
7236 |
+
function clickInGutter(cm, e) {
|
7237 |
+
return gutterEvent(cm, e, "gutterClick", true)
|
7238 |
+
}
|
7239 |
+
|
7240 |
+
// CONTEXT MENU HANDLING
|
7241 |
+
|
7242 |
+
// To make the context menu work, we need to briefly unhide the
|
7243 |
+
// textarea (making it as unobtrusive as possible) to let the
|
7244 |
+
// right-click take effect on it.
|
7245 |
+
function onContextMenu(cm, e) {
|
7246 |
+
if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
|
7247 |
+
if (signalDOMEvent(cm, e, "contextmenu")) { return }
|
7248 |
+
cm.display.input.onContextMenu(e)
|
7249 |
+
}
|
7250 |
+
|
7251 |
+
function contextMenuInGutter(cm, e) {
|
7252 |
+
if (!hasHandler(cm, "gutterContextMenu")) { return false }
|
7253 |
+
return gutterEvent(cm, e, "gutterContextMenu", false)
|
7254 |
+
}
|
7255 |
+
|
7256 |
+
function themeChanged(cm) {
|
7257 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
|
7258 |
+
cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-")
|
7259 |
+
clearCaches(cm)
|
7260 |
+
}
|
7261 |
+
|
7262 |
+
var Init = {toString: function(){return "CodeMirror.Init"}}
|
7263 |
+
|
7264 |
+
var defaults = {}
|
7265 |
+
var optionHandlers = {}
|
7266 |
+
|
7267 |
+
function defineOptions(CodeMirror) {
|
7268 |
+
var optionHandlers = CodeMirror.optionHandlers
|
7269 |
+
|
7270 |
+
function option(name, deflt, handle, notOnInit) {
|
7271 |
+
CodeMirror.defaults[name] = deflt
|
7272 |
+
if (handle) { optionHandlers[name] =
|
7273 |
+
notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old) }} : handle }
|
7274 |
+
}
|
7275 |
+
|
7276 |
+
CodeMirror.defineOption = option
|
7277 |
+
|
7278 |
+
// Passed to option handlers when there is no old value.
|
7279 |
+
CodeMirror.Init = Init
|
7280 |
+
|
7281 |
+
// These two are, on init, called from the constructor because they
|
7282 |
+
// have to be initialized before the editor can start at all.
|
7283 |
+
option("value", "", function (cm, val) { return cm.setValue(val); }, true)
|
7284 |
+
option("mode", null, function (cm, val) {
|
7285 |
+
cm.doc.modeOption = val
|
7286 |
+
loadMode(cm)
|
7287 |
+
}, true)
|
7288 |
+
|
7289 |
+
option("indentUnit", 2, loadMode, true)
|
7290 |
+
option("indentWithTabs", false)
|
7291 |
+
option("smartIndent", true)
|
7292 |
+
option("tabSize", 4, function (cm) {
|
7293 |
+
resetModeState(cm)
|
7294 |
+
clearCaches(cm)
|
7295 |
+
regChange(cm)
|
7296 |
+
}, true)
|
7297 |
+
option("lineSeparator", null, function (cm, val) {
|
7298 |
+
cm.doc.lineSep = val
|
7299 |
+
if (!val) { return }
|
7300 |
+
var newBreaks = [], lineNo = cm.doc.first
|
7301 |
+
cm.doc.iter(function (line) {
|
7302 |
+
for (var pos = 0;;) {
|
7303 |
+
var found = line.text.indexOf(val, pos)
|
7304 |
+
if (found == -1) { break }
|
7305 |
+
pos = found + val.length
|
7306 |
+
newBreaks.push(Pos(lineNo, found))
|
7307 |
+
}
|
7308 |
+
lineNo++
|
7309 |
+
})
|
7310 |
+
for (var i = newBreaks.length - 1; i >= 0; i--)
|
7311 |
+
{ replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)) }
|
7312 |
+
})
|
7313 |
+
option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g, function (cm, val, old) {
|
7314 |
+
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g")
|
7315 |
+
if (old != Init) { cm.refresh() }
|
7316 |
+
})
|
7317 |
+
option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true)
|
7318 |
+
option("electricChars", true)
|
7319 |
+
option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
|
7320 |
+
throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
|
7321 |
+
}, true)
|
7322 |
+
option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true)
|
7323 |
+
option("rtlMoveVisually", !windows)
|
7324 |
+
option("wholeLineUpdateBefore", true)
|
7325 |
+
|
7326 |
+
option("theme", "default", function (cm) {
|
7327 |
+
themeChanged(cm)
|
7328 |
+
guttersChanged(cm)
|
7329 |
+
}, true)
|
7330 |
+
option("keyMap", "default", function (cm, val, old) {
|
7331 |
+
var next = getKeyMap(val)
|
7332 |
+
var prev = old != Init && getKeyMap(old)
|
7333 |
+
if (prev && prev.detach) { prev.detach(cm, next) }
|
7334 |
+
if (next.attach) { next.attach(cm, prev || null) }
|
7335 |
+
})
|
7336 |
+
option("extraKeys", null)
|
7337 |
+
|
7338 |
+
option("lineWrapping", false, wrappingChanged, true)
|
7339 |
+
option("gutters", [], function (cm) {
|
7340 |
+
setGuttersForLineNumbers(cm.options)
|
7341 |
+
guttersChanged(cm)
|
7342 |
+
}, true)
|
7343 |
+
option("fixedGutter", true, function (cm, val) {
|
7344 |
+
cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"
|
7345 |
+
cm.refresh()
|
7346 |
+
}, true)
|
7347 |
+
option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true)
|
7348 |
+
option("scrollbarStyle", "native", function (cm) {
|
7349 |
+
initScrollbars(cm)
|
7350 |
+
updateScrollbars(cm)
|
7351 |
+
cm.display.scrollbars.setScrollTop(cm.doc.scrollTop)
|
7352 |
+
cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)
|
7353 |
+
}, true)
|
7354 |
+
option("lineNumbers", false, function (cm) {
|
7355 |
+
setGuttersForLineNumbers(cm.options)
|
7356 |
+
guttersChanged(cm)
|
7357 |
+
}, true)
|
7358 |
+
option("firstLineNumber", 1, guttersChanged, true)
|
7359 |
+
option("lineNumberFormatter", function (integer) { return integer; }, guttersChanged, true)
|
7360 |
+
option("showCursorWhenSelecting", false, updateSelection, true)
|
7361 |
+
|
7362 |
+
option("resetSelectionOnContextMenu", true)
|
7363 |
+
option("lineWiseCopyCut", true)
|
7364 |
+
|
7365 |
+
option("readOnly", false, function (cm, val) {
|
7366 |
+
if (val == "nocursor") {
|
7367 |
+
onBlur(cm)
|
7368 |
+
cm.display.input.blur()
|
7369 |
+
cm.display.disabled = true
|
7370 |
+
} else {
|
7371 |
+
cm.display.disabled = false
|
7372 |
+
}
|
7373 |
+
cm.display.input.readOnlyChanged(val)
|
7374 |
+
})
|
7375 |
+
option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset() }}, true)
|
7376 |
+
option("dragDrop", true, dragDropChanged)
|
7377 |
+
option("allowDropFileTypes", null)
|
7378 |
+
|
7379 |
+
option("cursorBlinkRate", 530)
|
7380 |
+
option("cursorScrollMargin", 0)
|
7381 |
+
option("cursorHeight", 1, updateSelection, true)
|
7382 |
+
option("singleCursorHeightPerLine", true, updateSelection, true)
|
7383 |
+
option("workTime", 100)
|
7384 |
+
option("workDelay", 100)
|
7385 |
+
option("flattenSpans", true, resetModeState, true)
|
7386 |
+
option("addModeClass", false, resetModeState, true)
|
7387 |
+
option("pollInterval", 100)
|
7388 |
+
option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; })
|
7389 |
+
option("historyEventDelay", 1250)
|
7390 |
+
option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true)
|
7391 |
+
option("maxHighlightLength", 10000, resetModeState, true)
|
7392 |
+
option("moveInputWithCursor", true, function (cm, val) {
|
7393 |
+
if (!val) { cm.display.input.resetPosition() }
|
7394 |
+
})
|
7395 |
+
|
7396 |
+
option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; })
|
7397 |
+
option("autofocus", null)
|
7398 |
+
option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true)
|
7399 |
+
}
|
7400 |
+
|
7401 |
+
function guttersChanged(cm) {
|
7402 |
+
updateGutters(cm)
|
7403 |
+
regChange(cm)
|
7404 |
+
alignHorizontally(cm)
|
7405 |
+
}
|
7406 |
+
|
7407 |
+
function dragDropChanged(cm, value, old) {
|
7408 |
+
var wasOn = old && old != Init
|
7409 |
+
if (!value != !wasOn) {
|
7410 |
+
var funcs = cm.display.dragFunctions
|
7411 |
+
var toggle = value ? on : off
|
7412 |
+
toggle(cm.display.scroller, "dragstart", funcs.start)
|
7413 |
+
toggle(cm.display.scroller, "dragenter", funcs.enter)
|
7414 |
+
toggle(cm.display.scroller, "dragover", funcs.over)
|
7415 |
+
toggle(cm.display.scroller, "dragleave", funcs.leave)
|
7416 |
+
toggle(cm.display.scroller, "drop", funcs.drop)
|
7417 |
+
}
|
7418 |
+
}
|
7419 |
+
|
7420 |
+
function wrappingChanged(cm) {
|
7421 |
+
if (cm.options.lineWrapping) {
|
7422 |
+
addClass(cm.display.wrapper, "CodeMirror-wrap")
|
7423 |
+
cm.display.sizer.style.minWidth = ""
|
7424 |
+
cm.display.sizerWidth = null
|
7425 |
+
} else {
|
7426 |
+
rmClass(cm.display.wrapper, "CodeMirror-wrap")
|
7427 |
+
findMaxLine(cm)
|
7428 |
+
}
|
7429 |
+
estimateLineHeights(cm)
|
7430 |
+
regChange(cm)
|
7431 |
+
clearCaches(cm)
|
7432 |
+
setTimeout(function () { return updateScrollbars(cm); }, 100)
|
7433 |
+
}
|
7434 |
+
|
7435 |
+
// A CodeMirror instance represents an editor. This is the object
|
7436 |
+
// that user code is usually dealing with.
|
7437 |
+
|
7438 |
+
function CodeMirror(place, options) {
|
7439 |
+
var this$1 = this;
|
7440 |
+
|
7441 |
+
if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
|
7442 |
+
|
7443 |
+
this.options = options = options ? copyObj(options) : {}
|
7444 |
+
// Determine effective options based on given values and defaults.
|
7445 |
+
copyObj(defaults, options, false)
|
7446 |
+
setGuttersForLineNumbers(options)
|
7447 |
+
|
7448 |
+
var doc = options.value
|
7449 |
+
if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction) }
|
7450 |
+
this.doc = doc
|
7451 |
+
|
7452 |
+
var input = new CodeMirror.inputStyles[options.inputStyle](this)
|
7453 |
+
var display = this.display = new Display(place, doc, input)
|
7454 |
+
display.wrapper.CodeMirror = this
|
7455 |
+
updateGutters(this)
|
7456 |
+
themeChanged(this)
|
7457 |
+
if (options.lineWrapping)
|
7458 |
+
{ this.display.wrapper.className += " CodeMirror-wrap" }
|
7459 |
+
initScrollbars(this)
|
7460 |
+
|
7461 |
+
this.state = {
|
7462 |
+
keyMaps: [], // stores maps added by addKeyMap
|
7463 |
+
overlays: [], // highlighting overlays, as added by addOverlay
|
7464 |
+
modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
|
7465 |
+
overwrite: false,
|
7466 |
+
delayingBlurEvent: false,
|
7467 |
+
focused: false,
|
7468 |
+
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
|
7469 |
+
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
|
7470 |
+
selectingText: false,
|
7471 |
+
draggingText: false,
|
7472 |
+
highlight: new Delayed(), // stores highlight worker timeout
|
7473 |
+
keySeq: null, // Unfinished key sequence
|
7474 |
+
specialChars: null
|
7475 |
+
}
|
7476 |
+
|
7477 |
+
if (options.autofocus && !mobile) { display.input.focus() }
|
7478 |
+
|
7479 |
+
// Override magic textarea content restore that IE sometimes does
|
7480 |
+
// on our hidden textarea on reload
|
7481 |
+
if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20) }
|
7482 |
+
|
7483 |
+
registerEventHandlers(this)
|
7484 |
+
ensureGlobalHandlers()
|
7485 |
+
|
7486 |
+
startOperation(this)
|
7487 |
+
this.curOp.forceUpdate = true
|
7488 |
+
attachDoc(this, doc)
|
7489 |
+
|
7490 |
+
if ((options.autofocus && !mobile) || this.hasFocus())
|
7491 |
+
{ setTimeout(bind(onFocus, this), 20) }
|
7492 |
+
else
|
7493 |
+
{ onBlur(this) }
|
7494 |
+
|
7495 |
+
for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
|
7496 |
+
{ optionHandlers[opt](this$1, options[opt], Init) } }
|
7497 |
+
maybeUpdateLineNumberWidth(this)
|
7498 |
+
if (options.finishInit) { options.finishInit(this) }
|
7499 |
+
for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1) }
|
7500 |
+
endOperation(this)
|
7501 |
+
// Suppress optimizelegibility in Webkit, since it breaks text
|
7502 |
+
// measuring on line wrapping boundaries.
|
7503 |
+
if (webkit && options.lineWrapping &&
|
7504 |
+
getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
|
7505 |
+
{ display.lineDiv.style.textRendering = "auto" }
|
7506 |
+
}
|
7507 |
+
|
7508 |
+
// The default configuration options.
|
7509 |
+
CodeMirror.defaults = defaults
|
7510 |
+
// Functions to run when options are changed.
|
7511 |
+
CodeMirror.optionHandlers = optionHandlers
|
7512 |
+
|
7513 |
+
// Attach the necessary event handlers when initializing the editor
|
7514 |
+
function registerEventHandlers(cm) {
|
7515 |
+
var d = cm.display
|
7516 |
+
on(d.scroller, "mousedown", operation(cm, onMouseDown))
|
7517 |
+
// Older IE's will not fire a second mousedown for a double click
|
7518 |
+
if (ie && ie_version < 11)
|
7519 |
+
{ on(d.scroller, "dblclick", operation(cm, function (e) {
|
7520 |
+
if (signalDOMEvent(cm, e)) { return }
|
7521 |
+
var pos = posFromMouse(cm, e)
|
7522 |
+
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
|
7523 |
+
e_preventDefault(e)
|
7524 |
+
var word = cm.findWordAt(pos)
|
7525 |
+
extendSelection(cm.doc, word.anchor, word.head)
|
7526 |
+
})) }
|
7527 |
+
else
|
7528 |
+
{ on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }) }
|
7529 |
+
// Some browsers fire contextmenu *after* opening the menu, at
|
7530 |
+
// which point we can't mess with it anymore. Context menu is
|
7531 |
+
// handled in onMouseDown for these browsers.
|
7532 |
+
if (!captureRightClick) { on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); }) }
|
7533 |
+
|
7534 |
+
// Used to suppress mouse event handling when a touch happens
|
7535 |
+
var touchFinished, prevTouch = {end: 0}
|
7536 |
+
function finishTouch() {
|
7537 |
+
if (d.activeTouch) {
|
7538 |
+
touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000)
|
7539 |
+
prevTouch = d.activeTouch
|
7540 |
+
prevTouch.end = +new Date
|
7541 |
+
}
|
7542 |
+
}
|
7543 |
+
function isMouseLikeTouchEvent(e) {
|
7544 |
+
if (e.touches.length != 1) { return false }
|
7545 |
+
var touch = e.touches[0]
|
7546 |
+
return touch.radiusX <= 1 && touch.radiusY <= 1
|
7547 |
+
}
|
7548 |
+
function farAway(touch, other) {
|
7549 |
+
if (other.left == null) { return true }
|
7550 |
+
var dx = other.left - touch.left, dy = other.top - touch.top
|
7551 |
+
return dx * dx + dy * dy > 20 * 20
|
7552 |
+
}
|
7553 |
+
on(d.scroller, "touchstart", function (e) {
|
7554 |
+
if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e)) {
|
7555 |
+
d.input.ensurePolled()
|
7556 |
+
clearTimeout(touchFinished)
|
7557 |
+
var now = +new Date
|
7558 |
+
d.activeTouch = {start: now, moved: false,
|
7559 |
+
prev: now - prevTouch.end <= 300 ? prevTouch : null}
|
7560 |
+
if (e.touches.length == 1) {
|
7561 |
+
d.activeTouch.left = e.touches[0].pageX
|
7562 |
+
d.activeTouch.top = e.touches[0].pageY
|
7563 |
+
}
|
7564 |
+
}
|
7565 |
+
})
|
7566 |
+
on(d.scroller, "touchmove", function () {
|
7567 |
+
if (d.activeTouch) { d.activeTouch.moved = true }
|
7568 |
+
})
|
7569 |
+
on(d.scroller, "touchend", function (e) {
|
7570 |
+
var touch = d.activeTouch
|
7571 |
+
if (touch && !eventInWidget(d, e) && touch.left != null &&
|
7572 |
+
!touch.moved && new Date - touch.start < 300) {
|
7573 |
+
var pos = cm.coordsChar(d.activeTouch, "page"), range
|
7574 |
+
if (!touch.prev || farAway(touch, touch.prev)) // Single tap
|
7575 |
+
{ range = new Range(pos, pos) }
|
7576 |
+
else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
|
7577 |
+
{ range = cm.findWordAt(pos) }
|
7578 |
+
else // Triple tap
|
7579 |
+
{ range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
|
7580 |
+
cm.setSelection(range.anchor, range.head)
|
7581 |
+
cm.focus()
|
7582 |
+
e_preventDefault(e)
|
7583 |
+
}
|
7584 |
+
finishTouch()
|
7585 |
+
})
|
7586 |
+
on(d.scroller, "touchcancel", finishTouch)
|
7587 |
+
|
7588 |
+
// Sync scrolling between fake scrollbars and real scrollable
|
7589 |
+
// area, ensure viewport is updated when scrolling.
|
7590 |
+
on(d.scroller, "scroll", function () {
|
7591 |
+
if (d.scroller.clientHeight) {
|
7592 |
+
updateScrollTop(cm, d.scroller.scrollTop)
|
7593 |
+
setScrollLeft(cm, d.scroller.scrollLeft, true)
|
7594 |
+
signal(cm, "scroll", cm)
|
7595 |
+
}
|
7596 |
+
})
|
7597 |
+
|
7598 |
+
// Listen to wheel events in order to try and update the viewport on time.
|
7599 |
+
on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); })
|
7600 |
+
on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); })
|
7601 |
+
|
7602 |
+
// Prevent wrapper from ever scrolling
|
7603 |
+
on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; })
|
7604 |
+
|
7605 |
+
d.dragFunctions = {
|
7606 |
+
enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e) }},
|
7607 |
+
over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }},
|
7608 |
+
start: function (e) { return onDragStart(cm, e); },
|
7609 |
+
drop: operation(cm, onDrop),
|
7610 |
+
leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }}
|
7611 |
+
}
|
7612 |
+
|
7613 |
+
var inp = d.input.getField()
|
7614 |
+
on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); })
|
7615 |
+
on(inp, "keydown", operation(cm, onKeyDown))
|
7616 |
+
on(inp, "keypress", operation(cm, onKeyPress))
|
7617 |
+
on(inp, "focus", function (e) { return onFocus(cm, e); })
|
7618 |
+
on(inp, "blur", function (e) { return onBlur(cm, e); })
|
7619 |
+
}
|
7620 |
+
|
7621 |
+
var initHooks = []
|
7622 |
+
CodeMirror.defineInitHook = function (f) { return initHooks.push(f); }
|
7623 |
+
|
7624 |
+
// Indent the given line. The how parameter can be "smart",
|
7625 |
+
// "add"/null, "subtract", or "prev". When aggressive is false
|
7626 |
+
// (typically set to true for forced single-line indents), empty
|
7627 |
+
// lines are not indented, and places where the mode returns Pass
|
7628 |
+
// are left alone.
|
7629 |
+
function indentLine(cm, n, how, aggressive) {
|
7630 |
+
var doc = cm.doc, state
|
7631 |
+
if (how == null) { how = "add" }
|
7632 |
+
if (how == "smart") {
|
7633 |
+
// Fall back to "prev" when the mode doesn't have an indentation
|
7634 |
+
// method.
|
7635 |
+
if (!doc.mode.indent) { how = "prev" }
|
7636 |
+
else { state = getStateBefore(cm, n) }
|
7637 |
+
}
|
7638 |
+
|
7639 |
+
var tabSize = cm.options.tabSize
|
7640 |
+
var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)
|
7641 |
+
if (line.stateAfter) { line.stateAfter = null }
|
7642 |
+
var curSpaceString = line.text.match(/^\s*/)[0], indentation
|
7643 |
+
if (!aggressive && !/\S/.test(line.text)) {
|
7644 |
+
indentation = 0
|
7645 |
+
how = "not"
|
7646 |
+
} else if (how == "smart") {
|
7647 |
+
indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)
|
7648 |
+
if (indentation == Pass || indentation > 150) {
|
7649 |
+
if (!aggressive) { return }
|
7650 |
+
how = "prev"
|
7651 |
+
}
|
7652 |
+
}
|
7653 |
+
if (how == "prev") {
|
7654 |
+
if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize) }
|
7655 |
+
else { indentation = 0 }
|
7656 |
+
} else if (how == "add") {
|
7657 |
+
indentation = curSpace + cm.options.indentUnit
|
7658 |
+
} else if (how == "subtract") {
|
7659 |
+
indentation = curSpace - cm.options.indentUnit
|
7660 |
+
} else if (typeof how == "number") {
|
7661 |
+
indentation = curSpace + how
|
7662 |
+
}
|
7663 |
+
indentation = Math.max(0, indentation)
|
7664 |
+
|
7665 |
+
var indentString = "", pos = 0
|
7666 |
+
if (cm.options.indentWithTabs)
|
7667 |
+
{ for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"} }
|
7668 |
+
if (pos < indentation) { indentString += spaceStr(indentation - pos) }
|
7669 |
+
|
7670 |
+
if (indentString != curSpaceString) {
|
7671 |
+
replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input")
|
7672 |
+
line.stateAfter = null
|
7673 |
+
return true
|
7674 |
+
} else {
|
7675 |
+
// Ensure that, if the cursor was in the whitespace at the start
|
7676 |
+
// of the line, it is moved to the end of that space.
|
7677 |
+
for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
|
7678 |
+
var range = doc.sel.ranges[i$1]
|
7679 |
+
if (range.head.line == n && range.head.ch < curSpaceString.length) {
|
7680 |
+
var pos$1 = Pos(n, curSpaceString.length)
|
7681 |
+
replaceOneSelection(doc, i$1, new Range(pos$1, pos$1))
|
7682 |
+
break
|
7683 |
+
}
|
7684 |
+
}
|
7685 |
+
}
|
7686 |
+
}
|
7687 |
+
|
7688 |
+
// This will be set to a {lineWise: bool, text: [string]} object, so
|
7689 |
+
// that, when pasting, we know what kind of selections the copied
|
7690 |
+
// text was made out of.
|
7691 |
+
var lastCopied = null
|
7692 |
+
|
7693 |
+
function setLastCopied(newLastCopied) {
|
7694 |
+
lastCopied = newLastCopied
|
7695 |
+
}
|
7696 |
+
|
7697 |
+
function applyTextInput(cm, inserted, deleted, sel, origin) {
|
7698 |
+
var doc = cm.doc
|
7699 |
+
cm.display.shift = false
|
7700 |
+
if (!sel) { sel = doc.sel }
|
7701 |
+
|
7702 |
+
var paste = cm.state.pasteIncoming || origin == "paste"
|
7703 |
+
var textLines = splitLinesAuto(inserted), multiPaste = null
|
7704 |
+
// When pasing N lines into N selections, insert one line per selection
|
7705 |
+
if (paste && sel.ranges.length > 1) {
|
7706 |
+
if (lastCopied && lastCopied.text.join("\n") == inserted) {
|
7707 |
+
if (sel.ranges.length % lastCopied.text.length == 0) {
|
7708 |
+
multiPaste = []
|
7709 |
+
for (var i = 0; i < lastCopied.text.length; i++)
|
7710 |
+
{ multiPaste.push(doc.splitLines(lastCopied.text[i])) }
|
7711 |
+
}
|
7712 |
+
} else if (textLines.length == sel.ranges.length) {
|
7713 |
+
multiPaste = map(textLines, function (l) { return [l]; })
|
7714 |
+
}
|
7715 |
+
}
|
7716 |
+
|
7717 |
+
var updateInput
|
7718 |
+
// Normal behavior is to insert the new text into every selection
|
7719 |
+
for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
|
7720 |
+
var range = sel.ranges[i$1]
|
7721 |
+
var from = range.from(), to = range.to()
|
7722 |
+
if (range.empty()) {
|
7723 |
+
if (deleted && deleted > 0) // Handle deletion
|
7724 |
+
{ from = Pos(from.line, from.ch - deleted) }
|
7725 |
+
else if (cm.state.overwrite && !paste) // Handle overwrite
|
7726 |
+
{ to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) }
|
7727 |
+
else if (lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
|
7728 |
+
{ from = to = Pos(from.line, 0) }
|
7729 |
+
}
|
7730 |
+
updateInput = cm.curOp.updateInput
|
7731 |
+
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
|
7732 |
+
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")}
|
7733 |
+
makeChange(cm.doc, changeEvent)
|
7734 |
+
signalLater(cm, "inputRead", cm, changeEvent)
|
7735 |
+
}
|
7736 |
+
if (inserted && !paste)
|
7737 |
+
{ triggerElectric(cm, inserted) }
|
7738 |
+
|
7739 |
+
ensureCursorVisible(cm)
|
7740 |
+
cm.curOp.updateInput = updateInput
|
7741 |
+
cm.curOp.typing = true
|
7742 |
+
cm.state.pasteIncoming = cm.state.cutIncoming = false
|
7743 |
+
}
|
7744 |
+
|
7745 |
+
function handlePaste(e, cm) {
|
7746 |
+
var pasted = e.clipboardData && e.clipboardData.getData("Text")
|
7747 |
+
if (pasted) {
|
7748 |
+
e.preventDefault()
|
7749 |
+
if (!cm.isReadOnly() && !cm.options.disableInput)
|
7750 |
+
{ runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }) }
|
7751 |
+
return true
|
7752 |
+
}
|
7753 |
+
}
|
7754 |
+
|
7755 |
+
function triggerElectric(cm, inserted) {
|
7756 |
+
// When an 'electric' character is inserted, immediately trigger a reindent
|
7757 |
+
if (!cm.options.electricChars || !cm.options.smartIndent) { return }
|
7758 |
+
var sel = cm.doc.sel
|
7759 |
+
|
7760 |
+
for (var i = sel.ranges.length - 1; i >= 0; i--) {
|
7761 |
+
var range = sel.ranges[i]
|
7762 |
+
if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
|
7763 |
+
var mode = cm.getModeAt(range.head)
|
7764 |
+
var indented = false
|
7765 |
+
if (mode.electricChars) {
|
7766 |
+
for (var j = 0; j < mode.electricChars.length; j++)
|
7767 |
+
{ if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
7768 |
+
indented = indentLine(cm, range.head.line, "smart")
|
7769 |
+
break
|
7770 |
+
} }
|
7771 |
+
} else if (mode.electricInput) {
|
7772 |
+
if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
|
7773 |
+
{ indented = indentLine(cm, range.head.line, "smart") }
|
7774 |
+
}
|
7775 |
+
if (indented) { signalLater(cm, "electricInput", cm, range.head.line) }
|
7776 |
+
}
|
7777 |
+
}
|
7778 |
+
|
7779 |
+
function copyableRanges(cm) {
|
7780 |
+
var text = [], ranges = []
|
7781 |
+
for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
|
7782 |
+
var line = cm.doc.sel.ranges[i].head.line
|
7783 |
+
var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}
|
7784 |
+
ranges.push(lineRange)
|
7785 |
+
text.push(cm.getRange(lineRange.anchor, lineRange.head))
|
7786 |
+
}
|
7787 |
+
return {text: text, ranges: ranges}
|
7788 |
+
}
|
7789 |
+
|
7790 |
+
function disableBrowserMagic(field, spellcheck) {
|
7791 |
+
field.setAttribute("autocorrect", "off")
|
7792 |
+
field.setAttribute("autocapitalize", "off")
|
7793 |
+
field.setAttribute("spellcheck", !!spellcheck)
|
7794 |
+
}
|
7795 |
+
|
7796 |
+
function hiddenTextarea() {
|
7797 |
+
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none")
|
7798 |
+
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;")
|
7799 |
+
// The textarea is kept positioned near the cursor to prevent the
|
7800 |
+
// fact that it'll be scrolled into view on input from scrolling
|
7801 |
+
// our fake cursor out of view. On webkit, when wrap=off, paste is
|
7802 |
+
// very slow. So make the area wide instead.
|
7803 |
+
if (webkit) { te.style.width = "1000px" }
|
7804 |
+
else { te.setAttribute("wrap", "off") }
|
7805 |
+
// If border: 0; -- iOS fails to open keyboard (issue #1287)
|
7806 |
+
if (ios) { te.style.border = "1px solid black" }
|
7807 |
+
disableBrowserMagic(te)
|
7808 |
+
return div
|
7809 |
+
}
|
7810 |
+
|
7811 |
+
// The publicly visible API. Note that methodOp(f) means
|
7812 |
+
// 'wrap f in an operation, performed on its `this` parameter'.
|
7813 |
+
|
7814 |
+
// This is not the complete set of editor methods. Most of the
|
7815 |
+
// methods defined on the Doc type are also injected into
|
7816 |
+
// CodeMirror.prototype, for backwards compatibility and
|
7817 |
+
// convenience.
|
7818 |
+
|
7819 |
+
function addEditorMethods(CodeMirror) {
|
7820 |
+
var optionHandlers = CodeMirror.optionHandlers
|
7821 |
+
|
7822 |
+
var helpers = CodeMirror.helpers = {}
|
7823 |
+
|
7824 |
+
CodeMirror.prototype = {
|
7825 |
+
constructor: CodeMirror,
|
7826 |
+
focus: function(){window.focus(); this.display.input.focus()},
|
7827 |
+
|
7828 |
+
setOption: function(option, value) {
|
7829 |
+
var options = this.options, old = options[option]
|
7830 |
+
if (options[option] == value && option != "mode") { return }
|
7831 |
+
options[option] = value
|
7832 |
+
if (optionHandlers.hasOwnProperty(option))
|
7833 |
+
{ operation(this, optionHandlers[option])(this, value, old) }
|
7834 |
+
signal(this, "optionChange", this, option)
|
7835 |
+
},
|
7836 |
+
|
7837 |
+
getOption: function(option) {return this.options[option]},
|
7838 |
+
getDoc: function() {return this.doc},
|
7839 |
+
|
7840 |
+
addKeyMap: function(map, bottom) {
|
7841 |
+
this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map))
|
7842 |
+
},
|
7843 |
+
removeKeyMap: function(map) {
|
7844 |
+
var maps = this.state.keyMaps
|
7845 |
+
for (var i = 0; i < maps.length; ++i)
|
7846 |
+
{ if (maps[i] == map || maps[i].name == map) {
|
7847 |
+
maps.splice(i, 1)
|
7848 |
+
return true
|
7849 |
+
} }
|
7850 |
+
},
|
7851 |
+
|
7852 |
+
addOverlay: methodOp(function(spec, options) {
|
7853 |
+
var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)
|
7854 |
+
if (mode.startState) { throw new Error("Overlays may not be stateful.") }
|
7855 |
+
insertSorted(this.state.overlays,
|
7856 |
+
{mode: mode, modeSpec: spec, opaque: options && options.opaque,
|
7857 |
+
priority: (options && options.priority) || 0},
|
7858 |
+
function (overlay) { return overlay.priority; })
|
7859 |
+
this.state.modeGen++
|
7860 |
+
regChange(this)
|
7861 |
+
}),
|
7862 |
+
removeOverlay: methodOp(function(spec) {
|
7863 |
+
var this$1 = this;
|
7864 |
+
|
7865 |
+
var overlays = this.state.overlays
|
7866 |
+
for (var i = 0; i < overlays.length; ++i) {
|
7867 |
+
var cur = overlays[i].modeSpec
|
7868 |
+
if (cur == spec || typeof spec == "string" && cur.name == spec) {
|
7869 |
+
overlays.splice(i, 1)
|
7870 |
+
this$1.state.modeGen++
|
7871 |
+
regChange(this$1)
|
7872 |
+
return
|
7873 |
+
}
|
7874 |
+
}
|
7875 |
+
}),
|
7876 |
+
|
7877 |
+
indentLine: methodOp(function(n, dir, aggressive) {
|
7878 |
+
if (typeof dir != "string" && typeof dir != "number") {
|
7879 |
+
if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev" }
|
7880 |
+
else { dir = dir ? "add" : "subtract" }
|
7881 |
+
}
|
7882 |
+
if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive) }
|
7883 |
+
}),
|
7884 |
+
indentSelection: methodOp(function(how) {
|
7885 |
+
var this$1 = this;
|
7886 |
+
|
7887 |
+
var ranges = this.doc.sel.ranges, end = -1
|
7888 |
+
for (var i = 0; i < ranges.length; i++) {
|
7889 |
+
var range = ranges[i]
|
7890 |
+
if (!range.empty()) {
|
7891 |
+
var from = range.from(), to = range.to()
|
7892 |
+
var start = Math.max(end, from.line)
|
7893 |
+
end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1
|
7894 |
+
for (var j = start; j < end; ++j)
|
7895 |
+
{ indentLine(this$1, j, how) }
|
7896 |
+
var newRanges = this$1.doc.sel.ranges
|
7897 |
+
if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
|
7898 |
+
{ replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll) }
|
7899 |
+
} else if (range.head.line > end) {
|
7900 |
+
indentLine(this$1, range.head.line, how, true)
|
7901 |
+
end = range.head.line
|
7902 |
+
if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1) }
|
7903 |
+
}
|
7904 |
+
}
|
7905 |
+
}),
|
7906 |
+
|
7907 |
+
// Fetch the parser token for a given character. Useful for hacks
|
7908 |
+
// that want to inspect the mode state (say, for completion).
|
7909 |
+
getTokenAt: function(pos, precise) {
|
7910 |
+
return takeToken(this, pos, precise)
|
7911 |
+
},
|
7912 |
+
|
7913 |
+
getLineTokens: function(line, precise) {
|
7914 |
+
return takeToken(this, Pos(line), precise, true)
|
7915 |
+
},
|
7916 |
+
|
7917 |
+
getTokenTypeAt: function(pos) {
|
7918 |
+
pos = clipPos(this.doc, pos)
|
7919 |
+
var styles = getLineStyles(this, getLine(this.doc, pos.line))
|
7920 |
+
var before = 0, after = (styles.length - 1) / 2, ch = pos.ch
|
7921 |
+
var type
|
7922 |
+
if (ch == 0) { type = styles[2] }
|
7923 |
+
else { for (;;) {
|
7924 |
+
var mid = (before + after) >> 1
|
7925 |
+
if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid }
|
7926 |
+
else if (styles[mid * 2 + 1] < ch) { before = mid + 1 }
|
7927 |
+
else { type = styles[mid * 2 + 2]; break }
|
7928 |
+
} }
|
7929 |
+
var cut = type ? type.indexOf("overlay ") : -1
|
7930 |
+
return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
|
7931 |
+
},
|
7932 |
+
|
7933 |
+
getModeAt: function(pos) {
|
7934 |
+
var mode = this.doc.mode
|
7935 |
+
if (!mode.innerMode) { return mode }
|
7936 |
+
return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
|
7937 |
+
},
|
7938 |
+
|
7939 |
+
getHelper: function(pos, type) {
|
7940 |
+
return this.getHelpers(pos, type)[0]
|
7941 |
+
},
|
7942 |
+
|
7943 |
+
getHelpers: function(pos, type) {
|
7944 |
+
var this$1 = this;
|
7945 |
+
|
7946 |
+
var found = []
|
7947 |
+
if (!helpers.hasOwnProperty(type)) { return found }
|
7948 |
+
var help = helpers[type], mode = this.getModeAt(pos)
|
7949 |
+
if (typeof mode[type] == "string") {
|
7950 |
+
if (help[mode[type]]) { found.push(help[mode[type]]) }
|
7951 |
+
} else if (mode[type]) {
|
7952 |
+
for (var i = 0; i < mode[type].length; i++) {
|
7953 |
+
var val = help[mode[type][i]]
|
7954 |
+
if (val) { found.push(val) }
|
7955 |
+
}
|
7956 |
+
} else if (mode.helperType && help[mode.helperType]) {
|
7957 |
+
found.push(help[mode.helperType])
|
7958 |
+
} else if (help[mode.name]) {
|
7959 |
+
found.push(help[mode.name])
|
7960 |
+
}
|
7961 |
+
for (var i$1 = 0; i$1 < help._global.length; i$1++) {
|
7962 |
+
var cur = help._global[i$1]
|
7963 |
+
if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)
|
7964 |
+
{ found.push(cur.val) }
|
7965 |
+
}
|
7966 |
+
return found
|
7967 |
+
},
|
7968 |
+
|
7969 |
+
getStateAfter: function(line, precise) {
|
7970 |
+
var doc = this.doc
|
7971 |
+
line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)
|
7972 |
+
return getStateBefore(this, line + 1, precise)
|
7973 |
+
},
|
7974 |
+
|
7975 |
+
cursorCoords: function(start, mode) {
|
7976 |
+
var pos, range = this.doc.sel.primary()
|
7977 |
+
if (start == null) { pos = range.head }
|
7978 |
+
else if (typeof start == "object") { pos = clipPos(this.doc, start) }
|
7979 |
+
else { pos = start ? range.from() : range.to() }
|
7980 |
+
return cursorCoords(this, pos, mode || "page")
|
7981 |
+
},
|
7982 |
+
|
7983 |
+
charCoords: function(pos, mode) {
|
7984 |
+
return charCoords(this, clipPos(this.doc, pos), mode || "page")
|
7985 |
+
},
|
7986 |
+
|
7987 |
+
coordsChar: function(coords, mode) {
|
7988 |
+
coords = fromCoordSystem(this, coords, mode || "page")
|
7989 |
+
return coordsChar(this, coords.left, coords.top)
|
7990 |
+
},
|
7991 |
+
|
7992 |
+
lineAtHeight: function(height, mode) {
|
7993 |
+
height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top
|
7994 |
+
return lineAtHeight(this.doc, height + this.display.viewOffset)
|
7995 |
+
},
|
7996 |
+
heightAtLine: function(line, mode, includeWidgets) {
|
7997 |
+
var end = false, lineObj
|
7998 |
+
if (typeof line == "number") {
|
7999 |
+
var last = this.doc.first + this.doc.size - 1
|
8000 |
+
if (line < this.doc.first) { line = this.doc.first }
|
8001 |
+
else if (line > last) { line = last; end = true }
|
8002 |
+
lineObj = getLine(this.doc, line)
|
8003 |
+
} else {
|
8004 |
+
lineObj = line
|
8005 |
+
}
|
8006 |
+
return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
|
8007 |
+
(end ? this.doc.height - heightAtLine(lineObj) : 0)
|
8008 |
+
},
|
8009 |
+
|
8010 |
+
defaultTextHeight: function() { return textHeight(this.display) },
|
8011 |
+
defaultCharWidth: function() { return charWidth(this.display) },
|
8012 |
+
|
8013 |
+
getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
|
8014 |
+
|
8015 |
+
addWidget: function(pos, node, scroll, vert, horiz) {
|
8016 |
+
var display = this.display
|
8017 |
+
pos = cursorCoords(this, clipPos(this.doc, pos))
|
8018 |
+
var top = pos.bottom, left = pos.left
|
8019 |
+
node.style.position = "absolute"
|
8020 |
+
node.setAttribute("cm-ignore-events", "true")
|
8021 |
+
this.display.input.setUneditable(node)
|
8022 |
+
display.sizer.appendChild(node)
|
8023 |
+
if (vert == "over") {
|
8024 |
+
top = pos.top
|
8025 |
+
} else if (vert == "above" || vert == "near") {
|
8026 |
+
var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
|
8027 |
+
hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)
|
8028 |
+
// Default to positioning above (if specified and possible); otherwise default to positioning below
|
8029 |
+
if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
|
8030 |
+
{ top = pos.top - node.offsetHeight }
|
8031 |
+
else if (pos.bottom + node.offsetHeight <= vspace)
|
8032 |
+
{ top = pos.bottom }
|
8033 |
+
if (left + node.offsetWidth > hspace)
|
8034 |
+
{ left = hspace - node.offsetWidth }
|
8035 |
+
}
|
8036 |
+
node.style.top = top + "px"
|
8037 |
+
node.style.left = node.style.right = ""
|
8038 |
+
if (horiz == "right") {
|
8039 |
+
left = display.sizer.clientWidth - node.offsetWidth
|
8040 |
+
node.style.right = "0px"
|
8041 |
+
} else {
|
8042 |
+
if (horiz == "left") { left = 0 }
|
8043 |
+
else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2 }
|
8044 |
+
node.style.left = left + "px"
|
8045 |
+
}
|
8046 |
+
if (scroll)
|
8047 |
+
{ scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}) }
|
8048 |
+
},
|
8049 |
+
|
8050 |
+
triggerOnKeyDown: methodOp(onKeyDown),
|
8051 |
+
triggerOnKeyPress: methodOp(onKeyPress),
|
8052 |
+
triggerOnKeyUp: onKeyUp,
|
8053 |
+
|
8054 |
+
execCommand: function(cmd) {
|
8055 |
+
if (commands.hasOwnProperty(cmd))
|
8056 |
+
{ return commands[cmd].call(null, this) }
|
8057 |
+
},
|
8058 |
+
|
8059 |
+
triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),
|
8060 |
+
|
8061 |
+
findPosH: function(from, amount, unit, visually) {
|
8062 |
+
var this$1 = this;
|
8063 |
+
|
8064 |
+
var dir = 1
|
8065 |
+
if (amount < 0) { dir = -1; amount = -amount }
|
8066 |
+
var cur = clipPos(this.doc, from)
|
8067 |
+
for (var i = 0; i < amount; ++i) {
|
8068 |
+
cur = findPosH(this$1.doc, cur, dir, unit, visually)
|
8069 |
+
if (cur.hitSide) { break }
|
8070 |
+
}
|
8071 |
+
return cur
|
8072 |
+
},
|
8073 |
+
|
8074 |
+
moveH: methodOp(function(dir, unit) {
|
8075 |
+
var this$1 = this;
|
8076 |
+
|
8077 |
+
this.extendSelectionsBy(function (range) {
|
8078 |
+
if (this$1.display.shift || this$1.doc.extend || range.empty())
|
8079 |
+
{ return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
|
8080 |
+
else
|
8081 |
+
{ return dir < 0 ? range.from() : range.to() }
|
8082 |
+
}, sel_move)
|
8083 |
+
}),
|
8084 |
+
|
8085 |
+
deleteH: methodOp(function(dir, unit) {
|
8086 |
+
var sel = this.doc.sel, doc = this.doc
|
8087 |
+
if (sel.somethingSelected())
|
8088 |
+
{ doc.replaceSelection("", null, "+delete") }
|
8089 |
+
else
|
8090 |
+
{ deleteNearSelection(this, function (range) {
|
8091 |
+
var other = findPosH(doc, range.head, dir, unit, false)
|
8092 |
+
return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
|
8093 |
+
}) }
|
8094 |
+
}),
|
8095 |
+
|
8096 |
+
findPosV: function(from, amount, unit, goalColumn) {
|
8097 |
+
var this$1 = this;
|
8098 |
+
|
8099 |
+
var dir = 1, x = goalColumn
|
8100 |
+
if (amount < 0) { dir = -1; amount = -amount }
|
8101 |
+
var cur = clipPos(this.doc, from)
|
8102 |
+
for (var i = 0; i < amount; ++i) {
|
8103 |
+
var coords = cursorCoords(this$1, cur, "div")
|
8104 |
+
if (x == null) { x = coords.left }
|
8105 |
+
else { coords.left = x }
|
8106 |
+
cur = findPosV(this$1, coords, dir, unit)
|
8107 |
+
if (cur.hitSide) { break }
|
8108 |
+
}
|
8109 |
+
return cur
|
8110 |
+
},
|
8111 |
+
|
8112 |
+
moveV: methodOp(function(dir, unit) {
|
8113 |
+
var this$1 = this;
|
8114 |
+
|
8115 |
+
var doc = this.doc, goals = []
|
8116 |
+
var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()
|
8117 |
+
doc.extendSelectionsBy(function (range) {
|
8118 |
+
if (collapse)
|
8119 |
+
{ return dir < 0 ? range.from() : range.to() }
|
8120 |
+
var headPos = cursorCoords(this$1, range.head, "div")
|
8121 |
+
if (range.goalColumn != null) { headPos.left = range.goalColumn }
|
8122 |
+
goals.push(headPos.left)
|
8123 |
+
var pos = findPosV(this$1, headPos, dir, unit)
|
8124 |
+
if (unit == "page" && range == doc.sel.primary())
|
8125 |
+
{ addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top) }
|
8126 |
+
return pos
|
8127 |
+
}, sel_move)
|
8128 |
+
if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
|
8129 |
+
{ doc.sel.ranges[i].goalColumn = goals[i] } }
|
8130 |
+
}),
|
8131 |
+
|
8132 |
+
// Find the word at the given position (as returned by coordsChar).
|
8133 |
+
findWordAt: function(pos) {
|
8134 |
+
var doc = this.doc, line = getLine(doc, pos.line).text
|
8135 |
+
var start = pos.ch, end = pos.ch
|
8136 |
+
if (line) {
|
8137 |
+
var helper = this.getHelper(pos, "wordChars")
|
8138 |
+
if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end }
|
8139 |
+
var startChar = line.charAt(start)
|
8140 |
+
var check = isWordChar(startChar, helper)
|
8141 |
+
? function (ch) { return isWordChar(ch, helper); }
|
8142 |
+
: /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
|
8143 |
+
: function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); }
|
8144 |
+
while (start > 0 && check(line.charAt(start - 1))) { --start }
|
8145 |
+
while (end < line.length && check(line.charAt(end))) { ++end }
|
8146 |
+
}
|
8147 |
+
return new Range(Pos(pos.line, start), Pos(pos.line, end))
|
8148 |
+
},
|
8149 |
+
|
8150 |
+
toggleOverwrite: function(value) {
|
8151 |
+
if (value != null && value == this.state.overwrite) { return }
|
8152 |
+
if (this.state.overwrite = !this.state.overwrite)
|
8153 |
+
{ addClass(this.display.cursorDiv, "CodeMirror-overwrite") }
|
8154 |
+
else
|
8155 |
+
{ rmClass(this.display.cursorDiv, "CodeMirror-overwrite") }
|
8156 |
+
|
8157 |
+
signal(this, "overwriteToggle", this, this.state.overwrite)
|
8158 |
+
},
|
8159 |
+
hasFocus: function() { return this.display.input.getField() == activeElt() },
|
8160 |
+
isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
|
8161 |
+
|
8162 |
+
scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y) }),
|
8163 |
+
getScrollInfo: function() {
|
8164 |
+
var scroller = this.display.scroller
|
8165 |
+
return {left: scroller.scrollLeft, top: scroller.scrollTop,
|
8166 |
+
height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
|
8167 |
+
width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
|
8168 |
+
clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
|
8169 |
+
},
|
8170 |
+
|
8171 |
+
scrollIntoView: methodOp(function(range, margin) {
|
8172 |
+
if (range == null) {
|
8173 |
+
range = {from: this.doc.sel.primary().head, to: null}
|
8174 |
+
if (margin == null) { margin = this.options.cursorScrollMargin }
|
8175 |
+
} else if (typeof range == "number") {
|
8176 |
+
range = {from: Pos(range, 0), to: null}
|
8177 |
+
} else if (range.from == null) {
|
8178 |
+
range = {from: range, to: null}
|
8179 |
+
}
|
8180 |
+
if (!range.to) { range.to = range.from }
|
8181 |
+
range.margin = margin || 0
|
8182 |
+
|
8183 |
+
if (range.from.line != null) {
|
8184 |
+
scrollToRange(this, range)
|
8185 |
+
} else {
|
8186 |
+
scrollToCoordsRange(this, range.from, range.to, range.margin)
|
8187 |
+
}
|
8188 |
+
}),
|
8189 |
+
|
8190 |
+
setSize: methodOp(function(width, height) {
|
8191 |
+
var this$1 = this;
|
8192 |
+
|
8193 |
+
var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; }
|
8194 |
+
if (width != null) { this.display.wrapper.style.width = interpret(width) }
|
8195 |
+
if (height != null) { this.display.wrapper.style.height = interpret(height) }
|
8196 |
+
if (this.options.lineWrapping) { clearLineMeasurementCache(this) }
|
8197 |
+
var lineNo = this.display.viewFrom
|
8198 |
+
this.doc.iter(lineNo, this.display.viewTo, function (line) {
|
8199 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
|
8200 |
+
{ if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
|
8201 |
+
++lineNo
|
8202 |
+
})
|
8203 |
+
this.curOp.forceUpdate = true
|
8204 |
+
signal(this, "refresh", this)
|
8205 |
+
}),
|
8206 |
+
|
8207 |
+
operation: function(f){return runInOp(this, f)},
|
8208 |
+
|
8209 |
+
refresh: methodOp(function() {
|
8210 |
+
var oldHeight = this.display.cachedTextHeight
|
8211 |
+
regChange(this)
|
8212 |
+
this.curOp.forceUpdate = true
|
8213 |
+
clearCaches(this)
|
8214 |
+
scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop)
|
8215 |
+
updateGutterSpace(this)
|
8216 |
+
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
|
8217 |
+
{ estimateLineHeights(this) }
|
8218 |
+
signal(this, "refresh", this)
|
8219 |
+
}),
|
8220 |
+
|
8221 |
+
swapDoc: methodOp(function(doc) {
|
8222 |
+
var old = this.doc
|
8223 |
+
old.cm = null
|
8224 |
+
attachDoc(this, doc)
|
8225 |
+
clearCaches(this)
|
8226 |
+
this.display.input.reset()
|
8227 |
+
scrollToCoords(this, doc.scrollLeft, doc.scrollTop)
|
8228 |
+
this.curOp.forceScroll = true
|
8229 |
+
signalLater(this, "swapDoc", this, old)
|
8230 |
+
return old
|
8231 |
+
}),
|
8232 |
+
|
8233 |
+
getInputField: function(){return this.display.input.getField()},
|
8234 |
+
getWrapperElement: function(){return this.display.wrapper},
|
8235 |
+
getScrollerElement: function(){return this.display.scroller},
|
8236 |
+
getGutterElement: function(){return this.display.gutters}
|
8237 |
+
}
|
8238 |
+
eventMixin(CodeMirror)
|
8239 |
+
|
8240 |
+
CodeMirror.registerHelper = function(type, name, value) {
|
8241 |
+
if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []} }
|
8242 |
+
helpers[type][name] = value
|
8243 |
+
}
|
8244 |
+
CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
|
8245 |
+
CodeMirror.registerHelper(type, name, value)
|
8246 |
+
helpers[type]._global.push({pred: predicate, val: value})
|
8247 |
+
}
|
8248 |
+
}
|
8249 |
+
|
8250 |
+
// Used for horizontal relative motion. Dir is -1 or 1 (left or
|
8251 |
+
// right), unit can be "char", "column" (like char, but doesn't
|
8252 |
+
// cross line boundaries), "word" (across next word), or "group" (to
|
8253 |
+
// the start of next group of word or non-word-non-whitespace
|
8254 |
+
// chars). The visually param controls whether, in right-to-left
|
8255 |
+
// text, direction 1 means to move towards the next index in the
|
8256 |
+
// string, or towards the character to the right of the current
|
8257 |
+
// position. The resulting position will have a hitSide=true
|
8258 |
+
// property if it reached the end of the document.
|
8259 |
+
function findPosH(doc, pos, dir, unit, visually) {
|
8260 |
+
var oldPos = pos
|
8261 |
+
var origDir = dir
|
8262 |
+
var lineObj = getLine(doc, pos.line)
|
8263 |
+
function findNextLine() {
|
8264 |
+
var l = pos.line + dir
|
8265 |
+
if (l < doc.first || l >= doc.first + doc.size) { return false }
|
8266 |
+
pos = new Pos(l, pos.ch, pos.sticky)
|
8267 |
+
return lineObj = getLine(doc, l)
|
8268 |
+
}
|
8269 |
+
function moveOnce(boundToLine) {
|
8270 |
+
var next
|
8271 |
+
if (visually) {
|
8272 |
+
next = moveVisually(doc.cm, lineObj, pos, dir)
|
8273 |
+
} else {
|
8274 |
+
next = moveLogically(lineObj, pos, dir)
|
8275 |
+
}
|
8276 |
+
if (next == null) {
|
8277 |
+
if (!boundToLine && findNextLine())
|
8278 |
+
{ pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir) }
|
8279 |
+
else
|
8280 |
+
{ return false }
|
8281 |
+
} else {
|
8282 |
+
pos = next
|
8283 |
+
}
|
8284 |
+
return true
|
8285 |
+
}
|
8286 |
+
|
8287 |
+
if (unit == "char") {
|
8288 |
+
moveOnce()
|
8289 |
+
} else if (unit == "column") {
|
8290 |
+
moveOnce(true)
|
8291 |
+
} else if (unit == "word" || unit == "group") {
|
8292 |
+
var sawType = null, group = unit == "group"
|
8293 |
+
var helper = doc.cm && doc.cm.getHelper(pos, "wordChars")
|
8294 |
+
for (var first = true;; first = false) {
|
8295 |
+
if (dir < 0 && !moveOnce(!first)) { break }
|
8296 |
+
var cur = lineObj.text.charAt(pos.ch) || "\n"
|
8297 |
+
var type = isWordChar(cur, helper) ? "w"
|
8298 |
+
: group && cur == "\n" ? "n"
|
8299 |
+
: !group || /\s/.test(cur) ? null
|
8300 |
+
: "p"
|
8301 |
+
if (group && !first && !type) { type = "s" }
|
8302 |
+
if (sawType && sawType != type) {
|
8303 |
+
if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after"}
|
8304 |
+
break
|
8305 |
+
}
|
8306 |
+
|
8307 |
+
if (type) { sawType = type }
|
8308 |
+
if (dir > 0 && !moveOnce(!first)) { break }
|
8309 |
+
}
|
8310 |
+
}
|
8311 |
+
var result = skipAtomic(doc, pos, oldPos, origDir, true)
|
8312 |
+
if (equalCursorPos(oldPos, result)) { result.hitSide = true }
|
8313 |
+
return result
|
8314 |
+
}
|
8315 |
+
|
8316 |
+
// For relative vertical movement. Dir may be -1 or 1. Unit can be
|
8317 |
+
// "page" or "line". The resulting position will have a hitSide=true
|
8318 |
+
// property if it reached the end of the document.
|
8319 |
+
function findPosV(cm, pos, dir, unit) {
|
8320 |
+
var doc = cm.doc, x = pos.left, y
|
8321 |
+
if (unit == "page") {
|
8322 |
+
var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight)
|
8323 |
+
var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3)
|
8324 |
+
y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount
|
8325 |
+
|
8326 |
+
} else if (unit == "line") {
|
8327 |
+
y = dir > 0 ? pos.bottom + 3 : pos.top - 3
|
8328 |
+
}
|
8329 |
+
var target
|
8330 |
+
for (;;) {
|
8331 |
+
target = coordsChar(cm, x, y)
|
8332 |
+
if (!target.outside) { break }
|
8333 |
+
if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
|
8334 |
+
y += dir * 5
|
8335 |
+
}
|
8336 |
+
return target
|
8337 |
+
}
|
8338 |
+
|
8339 |
+
// CONTENTEDITABLE INPUT STYLE
|
8340 |
+
|
8341 |
+
var ContentEditableInput = function(cm) {
|
8342 |
+
this.cm = cm
|
8343 |
+
this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null
|
8344 |
+
this.polling = new Delayed()
|
8345 |
+
this.composing = null
|
8346 |
+
this.gracePeriod = false
|
8347 |
+
this.readDOMTimeout = null
|
8348 |
+
};
|
8349 |
+
|
8350 |
+
ContentEditableInput.prototype.init = function (display) {
|
8351 |
+
var this$1 = this;
|
8352 |
+
|
8353 |
+
var input = this, cm = input.cm
|
8354 |
+
var div = input.div = display.lineDiv
|
8355 |
+
disableBrowserMagic(div, cm.options.spellcheck)
|
8356 |
+
|
8357 |
+
on(div, "paste", function (e) {
|
8358 |
+
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
|
8359 |
+
// IE doesn't fire input events, so we schedule a read for the pasted content in this way
|
8360 |
+
if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20) }
|
8361 |
+
})
|
8362 |
+
|
8363 |
+
on(div, "compositionstart", function (e) {
|
8364 |
+
this$1.composing = {data: e.data, done: false}
|
8365 |
+
})
|
8366 |
+
on(div, "compositionupdate", function (e) {
|
8367 |
+
if (!this$1.composing) { this$1.composing = {data: e.data, done: false} }
|
8368 |
+
})
|
8369 |
+
on(div, "compositionend", function (e) {
|
8370 |
+
if (this$1.composing) {
|
8371 |
+
if (e.data != this$1.composing.data) { this$1.readFromDOMSoon() }
|
8372 |
+
this$1.composing.done = true
|
8373 |
+
}
|
8374 |
+
})
|
8375 |
+
|
8376 |
+
on(div, "touchstart", function () { return input.forceCompositionEnd(); })
|
8377 |
+
|
8378 |
+
on(div, "input", function () {
|
8379 |
+
if (!this$1.composing) { this$1.readFromDOMSoon() }
|
8380 |
+
})
|
8381 |
+
|
8382 |
+
function onCopyCut(e) {
|
8383 |
+
if (signalDOMEvent(cm, e)) { return }
|
8384 |
+
if (cm.somethingSelected()) {
|
8385 |
+
setLastCopied({lineWise: false, text: cm.getSelections()})
|
8386 |
+
if (e.type == "cut") { cm.replaceSelection("", null, "cut") }
|
8387 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
8388 |
+
return
|
8389 |
+
} else {
|
8390 |
+
var ranges = copyableRanges(cm)
|
8391 |
+
setLastCopied({lineWise: true, text: ranges.text})
|
8392 |
+
if (e.type == "cut") {
|
8393 |
+
cm.operation(function () {
|
8394 |
+
cm.setSelections(ranges.ranges, 0, sel_dontScroll)
|
8395 |
+
cm.replaceSelection("", null, "cut")
|
8396 |
+
})
|
8397 |
+
}
|
8398 |
+
}
|
8399 |
+
if (e.clipboardData) {
|
8400 |
+
e.clipboardData.clearData()
|
8401 |
+
var content = lastCopied.text.join("\n")
|
8402 |
+
// iOS exposes the clipboard API, but seems to discard content inserted into it
|
8403 |
+
e.clipboardData.setData("Text", content)
|
8404 |
+
if (e.clipboardData.getData("Text") == content) {
|
8405 |
+
e.preventDefault()
|
8406 |
+
return
|
8407 |
+
}
|
8408 |
+
}
|
8409 |
+
// Old-fashioned briefly-focus-a-textarea hack
|
8410 |
+
var kludge = hiddenTextarea(), te = kludge.firstChild
|
8411 |
+
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
|
8412 |
+
te.value = lastCopied.text.join("\n")
|
8413 |
+
var hadFocus = document.activeElement
|
8414 |
+
selectInput(te)
|
8415 |
+
setTimeout(function () {
|
8416 |
+
cm.display.lineSpace.removeChild(kludge)
|
8417 |
+
hadFocus.focus()
|
8418 |
+
if (hadFocus == div) { input.showPrimarySelection() }
|
8419 |
+
}, 50)
|
8420 |
+
}
|
8421 |
+
on(div, "copy", onCopyCut)
|
8422 |
+
on(div, "cut", onCopyCut)
|
8423 |
+
};
|
8424 |
+
|
8425 |
+
ContentEditableInput.prototype.prepareSelection = function () {
|
8426 |
+
var result = prepareSelection(this.cm, false)
|
8427 |
+
result.focus = this.cm.state.focused
|
8428 |
+
return result
|
8429 |
+
};
|
8430 |
+
|
8431 |
+
ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
|
8432 |
+
if (!info || !this.cm.display.view.length) { return }
|
8433 |
+
if (info.focus || takeFocus) { this.showPrimarySelection() }
|
8434 |
+
this.showMultipleSelections(info)
|
8435 |
+
};
|
8436 |
+
|
8437 |
+
ContentEditableInput.prototype.showPrimarySelection = function () {
|
8438 |
+
var sel = window.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
|
8439 |
+
var from = prim.from(), to = prim.to()
|
8440 |
+
|
8441 |
+
if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
|
8442 |
+
sel.removeAllRanges()
|
8443 |
+
return
|
8444 |
+
}
|
8445 |
+
|
8446 |
+
var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
|
8447 |
+
var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset)
|
8448 |
+
if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
|
8449 |
+
cmp(minPos(curAnchor, curFocus), from) == 0 &&
|
8450 |
+
cmp(maxPos(curAnchor, curFocus), to) == 0)
|
8451 |
+
{ return }
|
8452 |
+
|
8453 |
+
var view = cm.display.view
|
8454 |
+
var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
|
8455 |
+
{node: view[0].measure.map[2], offset: 0}
|
8456 |
+
var end = to.line < cm.display.viewTo && posToDOM(cm, to)
|
8457 |
+
if (!end) {
|
8458 |
+
var measure = view[view.length - 1].measure
|
8459 |
+
var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map
|
8460 |
+
end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}
|
8461 |
+
}
|
8462 |
+
|
8463 |
+
if (!start || !end) {
|
8464 |
+
sel.removeAllRanges()
|
8465 |
+
return
|
8466 |
+
}
|
8467 |
+
|
8468 |
+
var old = sel.rangeCount && sel.getRangeAt(0), rng
|
8469 |
+
try { rng = range(start.node, start.offset, end.offset, end.node) }
|
8470 |
+
catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
|
8471 |
+
if (rng) {
|
8472 |
+
if (!gecko && cm.state.focused) {
|
8473 |
+
sel.collapse(start.node, start.offset)
|
8474 |
+
if (!rng.collapsed) {
|
8475 |
+
sel.removeAllRanges()
|
8476 |
+
sel.addRange(rng)
|
8477 |
+
}
|
8478 |
+
} else {
|
8479 |
+
sel.removeAllRanges()
|
8480 |
+
sel.addRange(rng)
|
8481 |
+
}
|
8482 |
+
if (old && sel.anchorNode == null) { sel.addRange(old) }
|
8483 |
+
else if (gecko) { this.startGracePeriod() }
|
8484 |
+
}
|
8485 |
+
this.rememberSelection()
|
8486 |
+
};
|
8487 |
+
|
8488 |
+
ContentEditableInput.prototype.startGracePeriod = function () {
|
8489 |
+
var this$1 = this;
|
8490 |
+
|
8491 |
+
clearTimeout(this.gracePeriod)
|
8492 |
+
this.gracePeriod = setTimeout(function () {
|
8493 |
+
this$1.gracePeriod = false
|
8494 |
+
if (this$1.selectionChanged())
|
8495 |
+
{ this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }) }
|
8496 |
+
}, 20)
|
8497 |
+
};
|
8498 |
+
|
8499 |
+
ContentEditableInput.prototype.showMultipleSelections = function (info) {
|
8500 |
+
removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors)
|
8501 |
+
removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection)
|
8502 |
+
};
|
8503 |
+
|
8504 |
+
ContentEditableInput.prototype.rememberSelection = function () {
|
8505 |
+
var sel = window.getSelection()
|
8506 |
+
this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset
|
8507 |
+
this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset
|
8508 |
+
};
|
8509 |
+
|
8510 |
+
ContentEditableInput.prototype.selectionInEditor = function () {
|
8511 |
+
var sel = window.getSelection()
|
8512 |
+
if (!sel.rangeCount) { return false }
|
8513 |
+
var node = sel.getRangeAt(0).commonAncestorContainer
|
8514 |
+
return contains(this.div, node)
|
8515 |
+
};
|
8516 |
+
|
8517 |
+
ContentEditableInput.prototype.focus = function () {
|
8518 |
+
if (this.cm.options.readOnly != "nocursor") {
|
8519 |
+
if (!this.selectionInEditor())
|
8520 |
+
{ this.showSelection(this.prepareSelection(), true) }
|
8521 |
+
this.div.focus()
|
8522 |
+
}
|
8523 |
+
};
|
8524 |
+
ContentEditableInput.prototype.blur = function () { this.div.blur() };
|
8525 |
+
ContentEditableInput.prototype.getField = function () { return this.div };
|
8526 |
+
|
8527 |
+
ContentEditableInput.prototype.supportsTouch = function () { return true };
|
8528 |
+
|
8529 |
+
ContentEditableInput.prototype.receivedFocus = function () {
|
8530 |
+
var input = this
|
8531 |
+
if (this.selectionInEditor())
|
8532 |
+
{ this.pollSelection() }
|
8533 |
+
else
|
8534 |
+
{ runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }) }
|
8535 |
+
|
8536 |
+
function poll() {
|
8537 |
+
if (input.cm.state.focused) {
|
8538 |
+
input.pollSelection()
|
8539 |
+
input.polling.set(input.cm.options.pollInterval, poll)
|
8540 |
+
}
|
8541 |
+
}
|
8542 |
+
this.polling.set(this.cm.options.pollInterval, poll)
|
8543 |
+
};
|
8544 |
+
|
8545 |
+
ContentEditableInput.prototype.selectionChanged = function () {
|
8546 |
+
var sel = window.getSelection()
|
8547 |
+
return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
|
8548 |
+
sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
|
8549 |
+
};
|
8550 |
+
|
8551 |
+
ContentEditableInput.prototype.pollSelection = function () {
|
8552 |
+
if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
|
8553 |
+
var sel = window.getSelection(), cm = this.cm
|
8554 |
+
// On Android Chrome (version 56, at least), backspacing into an
|
8555 |
+
// uneditable block element will put the cursor in that element,
|
8556 |
+
// and then, because it's not editable, hide the virtual keyboard.
|
8557 |
+
// Because Android doesn't allow us to actually detect backspace
|
8558 |
+
// presses in a sane way, this code checks for when that happens
|
8559 |
+
// and simulates a backspace press in this case.
|
8560 |
+
if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {
|
8561 |
+
this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs})
|
8562 |
+
this.blur()
|
8563 |
+
this.focus()
|
8564 |
+
return
|
8565 |
+
}
|
8566 |
+
if (this.composing) { return }
|
8567 |
+
this.rememberSelection()
|
8568 |
+
var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
|
8569 |
+
var head = domToPos(cm, sel.focusNode, sel.focusOffset)
|
8570 |
+
if (anchor && head) { runInOp(cm, function () {
|
8571 |
+
setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll)
|
8572 |
+
if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true }
|
8573 |
+
}) }
|
8574 |
+
};
|
8575 |
+
|
8576 |
+
ContentEditableInput.prototype.pollContent = function () {
|
8577 |
+
if (this.readDOMTimeout != null) {
|
8578 |
+
clearTimeout(this.readDOMTimeout)
|
8579 |
+
this.readDOMTimeout = null
|
8580 |
+
}
|
8581 |
+
|
8582 |
+
var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary()
|
8583 |
+
var from = sel.from(), to = sel.to()
|
8584 |
+
if (from.ch == 0 && from.line > cm.firstLine())
|
8585 |
+
{ from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length) }
|
8586 |
+
if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
|
8587 |
+
{ to = Pos(to.line + 1, 0) }
|
8588 |
+
if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
|
8589 |
+
|
8590 |
+
var fromIndex, fromLine, fromNode
|
8591 |
+
if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
|
8592 |
+
fromLine = lineNo(display.view[0].line)
|
8593 |
+
fromNode = display.view[0].node
|
8594 |
+
} else {
|
8595 |
+
fromLine = lineNo(display.view[fromIndex].line)
|
8596 |
+
fromNode = display.view[fromIndex - 1].node.nextSibling
|
8597 |
+
}
|
8598 |
+
var toIndex = findViewIndex(cm, to.line)
|
8599 |
+
var toLine, toNode
|
8600 |
+
if (toIndex == display.view.length - 1) {
|
8601 |
+
toLine = display.viewTo - 1
|
8602 |
+
toNode = display.lineDiv.lastChild
|
8603 |
+
} else {
|
8604 |
+
toLine = lineNo(display.view[toIndex + 1].line) - 1
|
8605 |
+
toNode = display.view[toIndex + 1].node.previousSibling
|
8606 |
+
}
|
8607 |
+
|
8608 |
+
if (!fromNode) { return false }
|
8609 |
+
var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine))
|
8610 |
+
var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length))
|
8611 |
+
while (newText.length > 1 && oldText.length > 1) {
|
8612 |
+
if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine-- }
|
8613 |
+
else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++ }
|
8614 |
+
else { break }
|
8615 |
+
}
|
8616 |
+
|
8617 |
+
var cutFront = 0, cutEnd = 0
|
8618 |
+
var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length)
|
8619 |
+
while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
|
8620 |
+
{ ++cutFront }
|
8621 |
+
var newBot = lst(newText), oldBot = lst(oldText)
|
8622 |
+
var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
|
8623 |
+
oldBot.length - (oldText.length == 1 ? cutFront : 0))
|
8624 |
+
while (cutEnd < maxCutEnd &&
|
8625 |
+
newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
|
8626 |
+
{ ++cutEnd }
|
8627 |
+
// Try to move start of change to start of selection if ambiguous
|
8628 |
+
if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
|
8629 |
+
while (cutFront && cutFront > from.ch &&
|
8630 |
+
newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
|
8631 |
+
cutFront--
|
8632 |
+
cutEnd++
|
8633 |
+
}
|
8634 |
+
}
|
8635 |
+
|
8636 |
+
newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "")
|
8637 |
+
newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "")
|
8638 |
+
|
8639 |
+
var chFrom = Pos(fromLine, cutFront)
|
8640 |
+
var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0)
|
8641 |
+
if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
|
8642 |
+
replaceRange(cm.doc, newText, chFrom, chTo, "+input")
|
8643 |
+
return true
|
8644 |
+
}
|
8645 |
+
};
|
8646 |
+
|
8647 |
+
ContentEditableInput.prototype.ensurePolled = function () {
|
8648 |
+
this.forceCompositionEnd()
|
8649 |
+
};
|
8650 |
+
ContentEditableInput.prototype.reset = function () {
|
8651 |
+
this.forceCompositionEnd()
|
8652 |
+
};
|
8653 |
+
ContentEditableInput.prototype.forceCompositionEnd = function () {
|
8654 |
+
if (!this.composing) { return }
|
8655 |
+
clearTimeout(this.readDOMTimeout)
|
8656 |
+
this.composing = null
|
8657 |
+
this.updateFromDOM()
|
8658 |
+
this.div.blur()
|
8659 |
+
this.div.focus()
|
8660 |
+
};
|
8661 |
+
ContentEditableInput.prototype.readFromDOMSoon = function () {
|
8662 |
+
var this$1 = this;
|
8663 |
+
|
8664 |
+
if (this.readDOMTimeout != null) { return }
|
8665 |
+
this.readDOMTimeout = setTimeout(function () {
|
8666 |
+
this$1.readDOMTimeout = null
|
8667 |
+
if (this$1.composing) {
|
8668 |
+
if (this$1.composing.done) { this$1.composing = null }
|
8669 |
+
else { return }
|
8670 |
+
}
|
8671 |
+
this$1.updateFromDOM()
|
8672 |
+
}, 80)
|
8673 |
+
};
|
8674 |
+
|
8675 |
+
ContentEditableInput.prototype.updateFromDOM = function () {
|
8676 |
+
var this$1 = this;
|
8677 |
+
|
8678 |
+
if (this.cm.isReadOnly() || !this.pollContent())
|
8679 |
+
{ runInOp(this.cm, function () { return regChange(this$1.cm); }) }
|
8680 |
+
};
|
8681 |
+
|
8682 |
+
ContentEditableInput.prototype.setUneditable = function (node) {
|
8683 |
+
node.contentEditable = "false"
|
8684 |
+
};
|
8685 |
+
|
8686 |
+
ContentEditableInput.prototype.onKeyPress = function (e) {
|
8687 |
+
if (e.charCode == 0) { return }
|
8688 |
+
e.preventDefault()
|
8689 |
+
if (!this.cm.isReadOnly())
|
8690 |
+
{ operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0) }
|
8691 |
+
};
|
8692 |
+
|
8693 |
+
ContentEditableInput.prototype.readOnlyChanged = function (val) {
|
8694 |
+
this.div.contentEditable = String(val != "nocursor")
|
8695 |
+
};
|
8696 |
+
|
8697 |
+
ContentEditableInput.prototype.onContextMenu = function () {};
|
8698 |
+
ContentEditableInput.prototype.resetPosition = function () {};
|
8699 |
+
|
8700 |
+
ContentEditableInput.prototype.needsContentAttribute = true
|
8701 |
+
|
8702 |
+
function posToDOM(cm, pos) {
|
8703 |
+
var view = findViewForLine(cm, pos.line)
|
8704 |
+
if (!view || view.hidden) { return null }
|
8705 |
+
var line = getLine(cm.doc, pos.line)
|
8706 |
+
var info = mapFromLineView(view, line, pos.line)
|
8707 |
+
|
8708 |
+
var order = getOrder(line, cm.doc.direction), side = "left"
|
8709 |
+
if (order) {
|
8710 |
+
var partPos = getBidiPartAt(order, pos.ch)
|
8711 |
+
side = partPos % 2 ? "right" : "left"
|
8712 |
+
}
|
8713 |
+
var result = nodeAndOffsetInLineMap(info.map, pos.ch, side)
|
8714 |
+
result.offset = result.collapse == "right" ? result.end : result.start
|
8715 |
+
return result
|
8716 |
+
}
|
8717 |
+
|
8718 |
+
function isInGutter(node) {
|
8719 |
+
for (var scan = node; scan; scan = scan.parentNode)
|
8720 |
+
{ if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
|
8721 |
+
return false
|
8722 |
+
}
|
8723 |
+
|
8724 |
+
function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
|
8725 |
+
|
8726 |
+
function domTextBetween(cm, from, to, fromLine, toLine) {
|
8727 |
+
var text = "", closing = false, lineSep = cm.doc.lineSeparator()
|
8728 |
+
function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
|
8729 |
+
function close() {
|
8730 |
+
if (closing) {
|
8731 |
+
text += lineSep
|
8732 |
+
closing = false
|
8733 |
+
}
|
8734 |
+
}
|
8735 |
+
function addText(str) {
|
8736 |
+
if (str) {
|
8737 |
+
close()
|
8738 |
+
text += str
|
8739 |
+
}
|
8740 |
+
}
|
8741 |
+
function walk(node) {
|
8742 |
+
if (node.nodeType == 1) {
|
8743 |
+
var cmText = node.getAttribute("cm-text")
|
8744 |
+
if (cmText != null) {
|
8745 |
+
addText(cmText || node.textContent.replace(/\u200b/g, ""))
|
8746 |
+
return
|
8747 |
+
}
|
8748 |
+
var markerID = node.getAttribute("cm-marker"), range
|
8749 |
+
if (markerID) {
|
8750 |
+
var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID))
|
8751 |
+
if (found.length && (range = found[0].find()))
|
8752 |
+
{ addText(getBetween(cm.doc, range.from, range.to).join(lineSep)) }
|
8753 |
+
return
|
8754 |
+
}
|
8755 |
+
if (node.getAttribute("contenteditable") == "false") { return }
|
8756 |
+
var isBlock = /^(pre|div|p)$/i.test(node.nodeName)
|
8757 |
+
if (isBlock) { close() }
|
8758 |
+
for (var i = 0; i < node.childNodes.length; i++)
|
8759 |
+
{ walk(node.childNodes[i]) }
|
8760 |
+
if (isBlock) { closing = true }
|
8761 |
+
} else if (node.nodeType == 3) {
|
8762 |
+
addText(node.nodeValue)
|
8763 |
+
}
|
8764 |
+
}
|
8765 |
+
for (;;) {
|
8766 |
+
walk(from)
|
8767 |
+
if (from == to) { break }
|
8768 |
+
from = from.nextSibling
|
8769 |
+
}
|
8770 |
+
return text
|
8771 |
+
}
|
8772 |
+
|
8773 |
+
function domToPos(cm, node, offset) {
|
8774 |
+
var lineNode
|
8775 |
+
if (node == cm.display.lineDiv) {
|
8776 |
+
lineNode = cm.display.lineDiv.childNodes[offset]
|
8777 |
+
if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
|
8778 |
+
node = null; offset = 0
|
8779 |
+
} else {
|
8780 |
+
for (lineNode = node;; lineNode = lineNode.parentNode) {
|
8781 |
+
if (!lineNode || lineNode == cm.display.lineDiv) { return null }
|
8782 |
+
if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
|
8783 |
+
}
|
8784 |
+
}
|
8785 |
+
for (var i = 0; i < cm.display.view.length; i++) {
|
8786 |
+
var lineView = cm.display.view[i]
|
8787 |
+
if (lineView.node == lineNode)
|
8788 |
+
{ return locateNodeInLineView(lineView, node, offset) }
|
8789 |
+
}
|
8790 |
+
}
|
8791 |
+
|
8792 |
+
function locateNodeInLineView(lineView, node, offset) {
|
8793 |
+
var wrapper = lineView.text.firstChild, bad = false
|
8794 |
+
if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
|
8795 |
+
if (node == wrapper) {
|
8796 |
+
bad = true
|
8797 |
+
node = wrapper.childNodes[offset]
|
8798 |
+
offset = 0
|
8799 |
+
if (!node) {
|
8800 |
+
var line = lineView.rest ? lst(lineView.rest) : lineView.line
|
8801 |
+
return badPos(Pos(lineNo(line), line.text.length), bad)
|
8802 |
+
}
|
8803 |
+
}
|
8804 |
+
|
8805 |
+
var textNode = node.nodeType == 3 ? node : null, topNode = node
|
8806 |
+
if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
|
8807 |
+
textNode = node.firstChild
|
8808 |
+
if (offset) { offset = textNode.nodeValue.length }
|
8809 |
+
}
|
8810 |
+
while (topNode.parentNode != wrapper) { topNode = topNode.parentNode }
|
8811 |
+
var measure = lineView.measure, maps = measure.maps
|
8812 |
+
|
8813 |
+
function find(textNode, topNode, offset) {
|
8814 |
+
for (var i = -1; i < (maps ? maps.length : 0); i++) {
|
8815 |
+
var map = i < 0 ? measure.map : maps[i]
|
8816 |
+
for (var j = 0; j < map.length; j += 3) {
|
8817 |
+
var curNode = map[j + 2]
|
8818 |
+
if (curNode == textNode || curNode == topNode) {
|
8819 |
+
var line = lineNo(i < 0 ? lineView.line : lineView.rest[i])
|
8820 |
+
var ch = map[j] + offset
|
8821 |
+
if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)] }
|
8822 |
+
return Pos(line, ch)
|
8823 |
+
}
|
8824 |
+
}
|
8825 |
+
}
|
8826 |
+
}
|
8827 |
+
var found = find(textNode, topNode, offset)
|
8828 |
+
if (found) { return badPos(found, bad) }
|
8829 |
+
|
8830 |
+
// FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
|
8831 |
+
for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
|
8832 |
+
found = find(after, after.firstChild, 0)
|
8833 |
+
if (found)
|
8834 |
+
{ return badPos(Pos(found.line, found.ch - dist), bad) }
|
8835 |
+
else
|
8836 |
+
{ dist += after.textContent.length }
|
8837 |
+
}
|
8838 |
+
for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
|
8839 |
+
found = find(before, before.firstChild, -1)
|
8840 |
+
if (found)
|
8841 |
+
{ return badPos(Pos(found.line, found.ch + dist$1), bad) }
|
8842 |
+
else
|
8843 |
+
{ dist$1 += before.textContent.length }
|
8844 |
+
}
|
8845 |
+
}
|
8846 |
+
|
8847 |
+
// TEXTAREA INPUT STYLE
|
8848 |
+
|
8849 |
+
var TextareaInput = function(cm) {
|
8850 |
+
this.cm = cm
|
8851 |
+
// See input.poll and input.reset
|
8852 |
+
this.prevInput = ""
|
8853 |
+
|
8854 |
+
// Flag that indicates whether we expect input to appear real soon
|
8855 |
+
// now (after some event like 'keypress' or 'input') and are
|
8856 |
+
// polling intensively.
|
8857 |
+
this.pollingFast = false
|
8858 |
+
// Self-resetting timeout for the poller
|
8859 |
+
this.polling = new Delayed()
|
8860 |
+
// Tracks when input.reset has punted to just putting a short
|
8861 |
+
// string into the textarea instead of the full selection.
|
8862 |
+
this.inaccurateSelection = false
|
8863 |
+
// Used to work around IE issue with selection being forgotten when focus moves away from textarea
|
8864 |
+
this.hasSelection = false
|
8865 |
+
this.composing = null
|
8866 |
+
};
|
8867 |
+
|
8868 |
+
TextareaInput.prototype.init = function (display) {
|
8869 |
+
var this$1 = this;
|
8870 |
+
|
8871 |
+
var input = this, cm = this.cm
|
8872 |
+
|
8873 |
+
// Wraps and hides input textarea
|
8874 |
+
var div = this.wrapper = hiddenTextarea()
|
8875 |
+
// The semihidden textarea that is focused when the editor is
|
8876 |
+
// focused, and receives input.
|
8877 |
+
var te = this.textarea = div.firstChild
|
8878 |
+
display.wrapper.insertBefore(div, display.wrapper.firstChild)
|
8879 |
+
|
8880 |
+
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
|
8881 |
+
if (ios) { te.style.width = "0px" }
|
8882 |
+
|
8883 |
+
on(te, "input", function () {
|
8884 |
+
if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null }
|
8885 |
+
input.poll()
|
8886 |
+
})
|
8887 |
+
|
8888 |
+
on(te, "paste", function (e) {
|
8889 |
+
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
|
8890 |
+
|
8891 |
+
cm.state.pasteIncoming = true
|
8892 |
+
input.fastPoll()
|
8893 |
+
})
|
8894 |
+
|
8895 |
+
function prepareCopyCut(e) {
|
8896 |
+
if (signalDOMEvent(cm, e)) { return }
|
8897 |
+
if (cm.somethingSelected()) {
|
8898 |
+
setLastCopied({lineWise: false, text: cm.getSelections()})
|
8899 |
+
if (input.inaccurateSelection) {
|
8900 |
+
input.prevInput = ""
|
8901 |
+
input.inaccurateSelection = false
|
8902 |
+
te.value = lastCopied.text.join("\n")
|
8903 |
+
selectInput(te)
|
8904 |
+
}
|
8905 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
8906 |
+
return
|
8907 |
+
} else {
|
8908 |
+
var ranges = copyableRanges(cm)
|
8909 |
+
setLastCopied({lineWise: true, text: ranges.text})
|
8910 |
+
if (e.type == "cut") {
|
8911 |
+
cm.setSelections(ranges.ranges, null, sel_dontScroll)
|
8912 |
+
} else {
|
8913 |
+
input.prevInput = ""
|
8914 |
+
te.value = ranges.text.join("\n")
|
8915 |
+
selectInput(te)
|
8916 |
+
}
|
8917 |
+
}
|
8918 |
+
if (e.type == "cut") { cm.state.cutIncoming = true }
|
8919 |
+
}
|
8920 |
+
on(te, "cut", prepareCopyCut)
|
8921 |
+
on(te, "copy", prepareCopyCut)
|
8922 |
+
|
8923 |
+
on(display.scroller, "paste", function (e) {
|
8924 |
+
if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
|
8925 |
+
cm.state.pasteIncoming = true
|
8926 |
+
input.focus()
|
8927 |
+
})
|
8928 |
+
|
8929 |
+
// Prevent normal selection in the editor (we handle our own)
|
8930 |
+
on(display.lineSpace, "selectstart", function (e) {
|
8931 |
+
if (!eventInWidget(display, e)) { e_preventDefault(e) }
|
8932 |
+
})
|
8933 |
+
|
8934 |
+
on(te, "compositionstart", function () {
|
8935 |
+
var start = cm.getCursor("from")
|
8936 |
+
if (input.composing) { input.composing.range.clear() }
|
8937 |
+
input.composing = {
|
8938 |
+
start: start,
|
8939 |
+
range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
|
8940 |
+
}
|
8941 |
+
})
|
8942 |
+
on(te, "compositionend", function () {
|
8943 |
+
if (input.composing) {
|
8944 |
+
input.poll()
|
8945 |
+
input.composing.range.clear()
|
8946 |
+
input.composing = null
|
8947 |
+
}
|
8948 |
+
})
|
8949 |
+
};
|
8950 |
+
|
8951 |
+
TextareaInput.prototype.prepareSelection = function () {
|
8952 |
+
// Redraw the selection and/or cursor
|
8953 |
+
var cm = this.cm, display = cm.display, doc = cm.doc
|
8954 |
+
var result = prepareSelection(cm)
|
8955 |
+
|
8956 |
+
// Move the hidden textarea near the cursor to prevent scrolling artifacts
|
8957 |
+
if (cm.options.moveInputWithCursor) {
|
8958 |
+
var headPos = cursorCoords(cm, doc.sel.primary().head, "div")
|
8959 |
+
var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect()
|
8960 |
+
result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
|
8961 |
+
headPos.top + lineOff.top - wrapOff.top))
|
8962 |
+
result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
|
8963 |
+
headPos.left + lineOff.left - wrapOff.left))
|
8964 |
+
}
|
8965 |
+
|
8966 |
+
return result
|
8967 |
+
};
|
8968 |
+
|
8969 |
+
TextareaInput.prototype.showSelection = function (drawn) {
|
8970 |
+
var cm = this.cm, display = cm.display
|
8971 |
+
removeChildrenAndAdd(display.cursorDiv, drawn.cursors)
|
8972 |
+
removeChildrenAndAdd(display.selectionDiv, drawn.selection)
|
8973 |
+
if (drawn.teTop != null) {
|
8974 |
+
this.wrapper.style.top = drawn.teTop + "px"
|
8975 |
+
this.wrapper.style.left = drawn.teLeft + "px"
|
8976 |
+
}
|
8977 |
+
};
|
8978 |
+
|
8979 |
+
// Reset the input to correspond to the selection (or to be empty,
|
8980 |
+
// when not typing and nothing is selected)
|
8981 |
+
TextareaInput.prototype.reset = function (typing) {
|
8982 |
+
if (this.contextMenuPending || this.composing) { return }
|
8983 |
+
var minimal, selected, cm = this.cm, doc = cm.doc
|
8984 |
+
if (cm.somethingSelected()) {
|
8985 |
+
this.prevInput = ""
|
8986 |
+
var range = doc.sel.primary()
|
8987 |
+
minimal = hasCopyEvent &&
|
8988 |
+
(range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000)
|
8989 |
+
var content = minimal ? "-" : selected || cm.getSelection()
|
8990 |
+
this.textarea.value = content
|
8991 |
+
if (cm.state.focused) { selectInput(this.textarea) }
|
8992 |
+
if (ie && ie_version >= 9) { this.hasSelection = content }
|
8993 |
+
} else if (!typing) {
|
8994 |
+
this.prevInput = this.textarea.value = ""
|
8995 |
+
if (ie && ie_version >= 9) { this.hasSelection = null }
|
8996 |
+
}
|
8997 |
+
this.inaccurateSelection = minimal
|
8998 |
+
};
|
8999 |
+
|
9000 |
+
TextareaInput.prototype.getField = function () { return this.textarea };
|
9001 |
+
|
9002 |
+
TextareaInput.prototype.supportsTouch = function () { return false };
|
9003 |
+
|
9004 |
+
TextareaInput.prototype.focus = function () {
|
9005 |
+
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
|
9006 |
+
try { this.textarea.focus() }
|
9007 |
+
catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
|
9008 |
+
}
|
9009 |
+
};
|
9010 |
+
|
9011 |
+
TextareaInput.prototype.blur = function () { this.textarea.blur() };
|
9012 |
+
|
9013 |
+
TextareaInput.prototype.resetPosition = function () {
|
9014 |
+
this.wrapper.style.top = this.wrapper.style.left = 0
|
9015 |
+
};
|
9016 |
+
|
9017 |
+
TextareaInput.prototype.receivedFocus = function () { this.slowPoll() };
|
9018 |
+
|
9019 |
+
// Poll for input changes, using the normal rate of polling. This
|
9020 |
+
// runs as long as the editor is focused.
|
9021 |
+
TextareaInput.prototype.slowPoll = function () {
|
9022 |
+
var this$1 = this;
|
9023 |
+
|
9024 |
+
if (this.pollingFast) { return }
|
9025 |
+
this.polling.set(this.cm.options.pollInterval, function () {
|
9026 |
+
this$1.poll()
|
9027 |
+
if (this$1.cm.state.focused) { this$1.slowPoll() }
|
9028 |
+
})
|
9029 |
+
};
|
9030 |
+
|
9031 |
+
// When an event has just come in that is likely to add or change
|
9032 |
+
// something in the input textarea, we poll faster, to ensure that
|
9033 |
+
// the change appears on the screen quickly.
|
9034 |
+
TextareaInput.prototype.fastPoll = function () {
|
9035 |
+
var missed = false, input = this
|
9036 |
+
input.pollingFast = true
|
9037 |
+
function p() {
|
9038 |
+
var changed = input.poll()
|
9039 |
+
if (!changed && !missed) {missed = true; input.polling.set(60, p)}
|
9040 |
+
else {input.pollingFast = false; input.slowPoll()}
|
9041 |
+
}
|
9042 |
+
input.polling.set(20, p)
|
9043 |
+
};
|
9044 |
+
|
9045 |
+
// Read input from the textarea, and update the document to match.
|
9046 |
+
// When something is selected, it is present in the textarea, and
|
9047 |
+
// selected (unless it is huge, in which case a placeholder is
|
9048 |
+
// used). When nothing is selected, the cursor sits after previously
|
9049 |
+
// seen text (can be empty), which is stored in prevInput (we must
|
9050 |
+
// not reset the textarea when typing, because that breaks IME).
|
9051 |
+
TextareaInput.prototype.poll = function () {
|
9052 |
+
var this$1 = this;
|
9053 |
+
|
9054 |
+
var cm = this.cm, input = this.textarea, prevInput = this.prevInput
|
9055 |
+
// Since this is called a *lot*, try to bail out as cheaply as
|
9056 |
+
// possible when it is clear that nothing happened. hasSelection
|
9057 |
+
// will be the case when there is a lot of text in the textarea,
|
9058 |
+
// in which case reading its value would be expensive.
|
9059 |
+
if (this.contextMenuPending || !cm.state.focused ||
|
9060 |
+
(hasSelection(input) && !prevInput && !this.composing) ||
|
9061 |
+
cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
|
9062 |
+
{ return false }
|
9063 |
+
|
9064 |
+
var text = input.value
|
9065 |
+
// If nothing changed, bail.
|
9066 |
+
if (text == prevInput && !cm.somethingSelected()) { return false }
|
9067 |
+
// Work around nonsensical selection resetting in IE9/10, and
|
9068 |
+
// inexplicable appearance of private area unicode characters on
|
9069 |
+
// some key combos in Mac (#2689).
|
9070 |
+
if (ie && ie_version >= 9 && this.hasSelection === text ||
|
9071 |
+
mac && /[\uf700-\uf7ff]/.test(text)) {
|
9072 |
+
cm.display.input.reset()
|
9073 |
+
return false
|
9074 |
+
}
|
9075 |
+
|
9076 |
+
if (cm.doc.sel == cm.display.selForContextMenu) {
|
9077 |
+
var first = text.charCodeAt(0)
|
9078 |
+
if (first == 0x200b && !prevInput) { prevInput = "\u200b" }
|
9079 |
+
if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
|
9080 |
+
}
|
9081 |
+
// Find the part of the input that is actually new
|
9082 |
+
var same = 0, l = Math.min(prevInput.length, text.length)
|
9083 |
+
while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same }
|
9084 |
+
|
9085 |
+
runInOp(cm, function () {
|
9086 |
+
applyTextInput(cm, text.slice(same), prevInput.length - same,
|
9087 |
+
null, this$1.composing ? "*compose" : null)
|
9088 |
+
|
9089 |
+
// Don't leave long text in the textarea, since it makes further polling slow
|
9090 |
+
if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = "" }
|
9091 |
+
else { this$1.prevInput = text }
|
9092 |
+
|
9093 |
+
if (this$1.composing) {
|
9094 |
+
this$1.composing.range.clear()
|
9095 |
+
this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
|
9096 |
+
{className: "CodeMirror-composing"})
|
9097 |
+
}
|
9098 |
+
})
|
9099 |
+
return true
|
9100 |
+
};
|
9101 |
+
|
9102 |
+
TextareaInput.prototype.ensurePolled = function () {
|
9103 |
+
if (this.pollingFast && this.poll()) { this.pollingFast = false }
|
9104 |
+
};
|
9105 |
+
|
9106 |
+
TextareaInput.prototype.onKeyPress = function () {
|
9107 |
+
if (ie && ie_version >= 9) { this.hasSelection = null }
|
9108 |
+
this.fastPoll()
|
9109 |
+
};
|
9110 |
+
|
9111 |
+
TextareaInput.prototype.onContextMenu = function (e) {
|
9112 |
+
var input = this, cm = input.cm, display = cm.display, te = input.textarea
|
9113 |
+
var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop
|
9114 |
+
if (!pos || presto) { return } // Opera is difficult.
|
9115 |
+
|
9116 |
+
// Reset the current text selection only if the click is done outside of the selection
|
9117 |
+
// and 'resetSelectionOnContextMenu' option is true.
|
9118 |
+
var reset = cm.options.resetSelectionOnContextMenu
|
9119 |
+
if (reset && cm.doc.sel.contains(pos) == -1)
|
9120 |
+
{ operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll) }
|
9121 |
+
|
9122 |
+
var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText
|
9123 |
+
input.wrapper.style.cssText = "position: absolute"
|
9124 |
+
var wrapperBox = input.wrapper.getBoundingClientRect()
|
9125 |
+
te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"
|
9126 |
+
var oldScrollY
|
9127 |
+
if (webkit) { oldScrollY = window.scrollY } // Work around Chrome issue (#2712)
|
9128 |
+
display.input.focus()
|
9129 |
+
if (webkit) { window.scrollTo(null, oldScrollY) }
|
9130 |
+
display.input.reset()
|
9131 |
+
// Adds "Select all" to context menu in FF
|
9132 |
+
if (!cm.somethingSelected()) { te.value = input.prevInput = " " }
|
9133 |
+
input.contextMenuPending = true
|
9134 |
+
display.selForContextMenu = cm.doc.sel
|
9135 |
+
clearTimeout(display.detectingSelectAll)
|
9136 |
+
|
9137 |
+
// Select-all will be greyed out if there's nothing to select, so
|
9138 |
+
// this adds a zero-width space so that we can later check whether
|
9139 |
+
// it got selected.
|
9140 |
+
function prepareSelectAllHack() {
|
9141 |
+
if (te.selectionStart != null) {
|
9142 |
+
var selected = cm.somethingSelected()
|
9143 |
+
var extval = "\u200b" + (selected ? te.value : "")
|
9144 |
+
te.value = "\u21da" // Used to catch context-menu undo
|
9145 |
+
te.value = extval
|
9146 |
+
input.prevInput = selected ? "" : "\u200b"
|
9147 |
+
te.selectionStart = 1; te.selectionEnd = extval.length
|
9148 |
+
// Re-set this, in case some other handler touched the
|
9149 |
+
// selection in the meantime.
|
9150 |
+
display.selForContextMenu = cm.doc.sel
|
9151 |
+
}
|
9152 |
+
}
|
9153 |
+
function rehide() {
|
9154 |
+
input.contextMenuPending = false
|
9155 |
+
input.wrapper.style.cssText = oldWrapperCSS
|
9156 |
+
te.style.cssText = oldCSS
|
9157 |
+
if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos) }
|
9158 |
+
|
9159 |
+
// Try to detect the user choosing select-all
|
9160 |
+
if (te.selectionStart != null) {
|
9161 |
+
if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack() }
|
9162 |
+
var i = 0, poll = function () {
|
9163 |
+
if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
|
9164 |
+
te.selectionEnd > 0 && input.prevInput == "\u200b") {
|
9165 |
+
operation(cm, selectAll)(cm)
|
9166 |
+
} else if (i++ < 10) {
|
9167 |
+
display.detectingSelectAll = setTimeout(poll, 500)
|
9168 |
+
} else {
|
9169 |
+
display.selForContextMenu = null
|
9170 |
+
display.input.reset()
|
9171 |
+
}
|
9172 |
+
}
|
9173 |
+
display.detectingSelectAll = setTimeout(poll, 200)
|
9174 |
+
}
|
9175 |
+
}
|
9176 |
+
|
9177 |
+
if (ie && ie_version >= 9) { prepareSelectAllHack() }
|
9178 |
+
if (captureRightClick) {
|
9179 |
+
e_stop(e)
|
9180 |
+
var mouseup = function () {
|
9181 |
+
off(window, "mouseup", mouseup)
|
9182 |
+
setTimeout(rehide, 20)
|
9183 |
+
}
|
9184 |
+
on(window, "mouseup", mouseup)
|
9185 |
+
} else {
|
9186 |
+
setTimeout(rehide, 50)
|
9187 |
+
}
|
9188 |
+
};
|
9189 |
+
|
9190 |
+
TextareaInput.prototype.readOnlyChanged = function (val) {
|
9191 |
+
if (!val) { this.reset() }
|
9192 |
+
};
|
9193 |
+
|
9194 |
+
TextareaInput.prototype.setUneditable = function () {};
|
9195 |
+
|
9196 |
+
TextareaInput.prototype.needsContentAttribute = false
|
9197 |
+
|
9198 |
+
function fromTextArea(textarea, options) {
|
9199 |
+
options = options ? copyObj(options) : {}
|
9200 |
+
options.value = textarea.value
|
9201 |
+
if (!options.tabindex && textarea.tabIndex)
|
9202 |
+
{ options.tabindex = textarea.tabIndex }
|
9203 |
+
if (!options.placeholder && textarea.placeholder)
|
9204 |
+
{ options.placeholder = textarea.placeholder }
|
9205 |
+
// Set autofocus to true if this textarea is focused, or if it has
|
9206 |
+
// autofocus and no other element is focused.
|
9207 |
+
if (options.autofocus == null) {
|
9208 |
+
var hasFocus = activeElt()
|
9209 |
+
options.autofocus = hasFocus == textarea ||
|
9210 |
+
textarea.getAttribute("autofocus") != null && hasFocus == document.body
|
9211 |
+
}
|
9212 |
+
|
9213 |
+
function save() {textarea.value = cm.getValue()}
|
9214 |
+
|
9215 |
+
var realSubmit
|
9216 |
+
if (textarea.form) {
|
9217 |
+
on(textarea.form, "submit", save)
|
9218 |
+
// Deplorable hack to make the submit method do the right thing.
|
9219 |
+
if (!options.leaveSubmitMethodAlone) {
|
9220 |
+
var form = textarea.form
|
9221 |
+
realSubmit = form.submit
|
9222 |
+
try {
|
9223 |
+
var wrappedSubmit = form.submit = function () {
|
9224 |
+
save()
|
9225 |
+
form.submit = realSubmit
|
9226 |
+
form.submit()
|
9227 |
+
form.submit = wrappedSubmit
|
9228 |
+
}
|
9229 |
+
} catch(e) {}
|
9230 |
+
}
|
9231 |
+
}
|
9232 |
+
|
9233 |
+
options.finishInit = function (cm) {
|
9234 |
+
cm.save = save
|
9235 |
+
cm.getTextArea = function () { return textarea; }
|
9236 |
+
cm.toTextArea = function () {
|
9237 |
+
cm.toTextArea = isNaN // Prevent this from being ran twice
|
9238 |
+
save()
|
9239 |
+
textarea.parentNode.removeChild(cm.getWrapperElement())
|
9240 |
+
textarea.style.display = ""
|
9241 |
+
if (textarea.form) {
|
9242 |
+
off(textarea.form, "submit", save)
|
9243 |
+
if (typeof textarea.form.submit == "function")
|
9244 |
+
{ textarea.form.submit = realSubmit }
|
9245 |
+
}
|
9246 |
+
}
|
9247 |
+
}
|
9248 |
+
|
9249 |
+
textarea.style.display = "none"
|
9250 |
+
var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
|
9251 |
+
options)
|
9252 |
+
return cm
|
9253 |
+
}
|
9254 |
+
|
9255 |
+
function addLegacyProps(CodeMirror) {
|
9256 |
+
CodeMirror.off = off
|
9257 |
+
CodeMirror.on = on
|
9258 |
+
CodeMirror.wheelEventPixels = wheelEventPixels
|
9259 |
+
CodeMirror.Doc = Doc
|
9260 |
+
CodeMirror.splitLines = splitLinesAuto
|
9261 |
+
CodeMirror.countColumn = countColumn
|
9262 |
+
CodeMirror.findColumn = findColumn
|
9263 |
+
CodeMirror.isWordChar = isWordCharBasic
|
9264 |
+
CodeMirror.Pass = Pass
|
9265 |
+
CodeMirror.signal = signal
|
9266 |
+
CodeMirror.Line = Line
|
9267 |
+
CodeMirror.changeEnd = changeEnd
|
9268 |
+
CodeMirror.scrollbarModel = scrollbarModel
|
9269 |
+
CodeMirror.Pos = Pos
|
9270 |
+
CodeMirror.cmpPos = cmp
|
9271 |
+
CodeMirror.modes = modes
|
9272 |
+
CodeMirror.mimeModes = mimeModes
|
9273 |
+
CodeMirror.resolveMode = resolveMode
|
9274 |
+
CodeMirror.getMode = getMode
|
9275 |
+
CodeMirror.modeExtensions = modeExtensions
|
9276 |
+
CodeMirror.extendMode = extendMode
|
9277 |
+
CodeMirror.copyState = copyState
|
9278 |
+
CodeMirror.startState = startState
|
9279 |
+
CodeMirror.innerMode = innerMode
|
9280 |
+
CodeMirror.commands = commands
|
9281 |
+
CodeMirror.keyMap = keyMap
|
9282 |
+
CodeMirror.keyName = keyName
|
9283 |
+
CodeMirror.isModifierKey = isModifierKey
|
9284 |
+
CodeMirror.lookupKey = lookupKey
|
9285 |
+
CodeMirror.normalizeKeyMap = normalizeKeyMap
|
9286 |
+
CodeMirror.StringStream = StringStream
|
9287 |
+
CodeMirror.SharedTextMarker = SharedTextMarker
|
9288 |
+
CodeMirror.TextMarker = TextMarker
|
9289 |
+
CodeMirror.LineWidget = LineWidget
|
9290 |
+
CodeMirror.e_preventDefault = e_preventDefault
|
9291 |
+
CodeMirror.e_stopPropagation = e_stopPropagation
|
9292 |
+
CodeMirror.e_stop = e_stop
|
9293 |
+
CodeMirror.addClass = addClass
|
9294 |
+
CodeMirror.contains = contains
|
9295 |
+
CodeMirror.rmClass = rmClass
|
9296 |
+
CodeMirror.keyNames = keyNames
|
9297 |
+
}
|
9298 |
+
|
9299 |
+
// EDITOR CONSTRUCTOR
|
9300 |
+
|
9301 |
+
defineOptions(CodeMirror)
|
9302 |
+
|
9303 |
+
addEditorMethods(CodeMirror)
|
9304 |
+
|
9305 |
+
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
9306 |
+
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ")
|
9307 |
+
for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
9308 |
+
{ CodeMirror.prototype[prop] = (function(method) {
|
9309 |
+
return function() {return method.apply(this.doc, arguments)}
|
9310 |
+
})(Doc.prototype[prop]) } }
|
9311 |
+
|
9312 |
+
eventMixin(Doc)
|
9313 |
+
|
9314 |
+
// INPUT HANDLING
|
9315 |
+
|
9316 |
+
CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}
|
9317 |
+
|
9318 |
+
// MODE DEFINITION AND QUERYING
|
9319 |
+
|
9320 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
9321 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
9322 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
9323 |
+
CodeMirror.defineMode = function(name/*, mode, …*/) {
|
9324 |
+
if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name }
|
9325 |
+
defineMode.apply(this, arguments)
|
9326 |
+
}
|
9327 |
+
|
9328 |
+
CodeMirror.defineMIME = defineMIME
|
9329 |
+
|
9330 |
+
// Minimal default mode.
|
9331 |
+
CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); })
|
9332 |
+
CodeMirror.defineMIME("text/plain", "null")
|
9333 |
+
|
9334 |
+
// EXTENSIONS
|
9335 |
+
|
9336 |
+
CodeMirror.defineExtension = function (name, func) {
|
9337 |
+
CodeMirror.prototype[name] = func
|
9338 |
+
}
|
9339 |
+
CodeMirror.defineDocExtension = function (name, func) {
|
9340 |
+
Doc.prototype[name] = func
|
9341 |
+
}
|
9342 |
+
|
9343 |
+
CodeMirror.fromTextArea = fromTextArea
|
9344 |
+
|
9345 |
+
addLegacyProps(CodeMirror)
|
9346 |
+
|
9347 |
+
CodeMirror.version = "5.26.0"
|
9348 |
+
|
9349 |
+
return CodeMirror;
|
9350 |
+
|
9351 |
+
})));
|
includes/js/codemirror/css.js
ADDED
@@ -0,0 +1,830 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
(function(mod) {
|
5 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
+
mod(require("../../lib/codemirror"));
|
7 |
+
else if (typeof define == "function" && define.amd) // AMD
|
8 |
+
define(["../../lib/codemirror"], mod);
|
9 |
+
else // Plain browser env
|
10 |
+
mod(CodeMirror);
|
11 |
+
})(function(CodeMirror) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
CodeMirror.defineMode("css", function(config, parserConfig) {
|
15 |
+
var inline = parserConfig.inline
|
16 |
+
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
17 |
+
|
18 |
+
var indentUnit = config.indentUnit,
|
19 |
+
tokenHooks = parserConfig.tokenHooks,
|
20 |
+
documentTypes = parserConfig.documentTypes || {},
|
21 |
+
mediaTypes = parserConfig.mediaTypes || {},
|
22 |
+
mediaFeatures = parserConfig.mediaFeatures || {},
|
23 |
+
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
|
24 |
+
propertyKeywords = parserConfig.propertyKeywords || {},
|
25 |
+
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
26 |
+
fontProperties = parserConfig.fontProperties || {},
|
27 |
+
counterDescriptors = parserConfig.counterDescriptors || {},
|
28 |
+
colorKeywords = parserConfig.colorKeywords || {},
|
29 |
+
valueKeywords = parserConfig.valueKeywords || {},
|
30 |
+
allowNested = parserConfig.allowNested,
|
31 |
+
lineComment = parserConfig.lineComment,
|
32 |
+
supportsAtComponent = parserConfig.supportsAtComponent === true;
|
33 |
+
|
34 |
+
var type, override;
|
35 |
+
function ret(style, tp) { type = tp; return style; }
|
36 |
+
|
37 |
+
// Tokenizers
|
38 |
+
|
39 |
+
function tokenBase(stream, state) {
|
40 |
+
var ch = stream.next();
|
41 |
+
if (tokenHooks[ch]) {
|
42 |
+
var result = tokenHooks[ch](stream, state);
|
43 |
+
if (result !== false) return result;
|
44 |
+
}
|
45 |
+
if (ch == "@") {
|
46 |
+
stream.eatWhile(/[\w\\\-]/);
|
47 |
+
return ret("def", stream.current());
|
48 |
+
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
49 |
+
return ret(null, "compare");
|
50 |
+
} else if (ch == "\"" || ch == "'") {
|
51 |
+
state.tokenize = tokenString(ch);
|
52 |
+
return state.tokenize(stream, state);
|
53 |
+
} else if (ch == "#") {
|
54 |
+
stream.eatWhile(/[\w\\\-]/);
|
55 |
+
return ret("atom", "hash");
|
56 |
+
} else if (ch == "!") {
|
57 |
+
stream.match(/^\s*\w*/);
|
58 |
+
return ret("keyword", "important");
|
59 |
+
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
60 |
+
stream.eatWhile(/[\w.%]/);
|
61 |
+
return ret("number", "unit");
|
62 |
+
} else if (ch === "-") {
|
63 |
+
if (/[\d.]/.test(stream.peek())) {
|
64 |
+
stream.eatWhile(/[\w.%]/);
|
65 |
+
return ret("number", "unit");
|
66 |
+
} else if (stream.match(/^-[\w\\\-]+/)) {
|
67 |
+
stream.eatWhile(/[\w\\\-]/);
|
68 |
+
if (stream.match(/^\s*:/, false))
|
69 |
+
return ret("variable-2", "variable-definition");
|
70 |
+
return ret("variable-2", "variable");
|
71 |
+
} else if (stream.match(/^\w+-/)) {
|
72 |
+
return ret("meta", "meta");
|
73 |
+
}
|
74 |
+
} else if (/[,+>*\/]/.test(ch)) {
|
75 |
+
return ret(null, "select-op");
|
76 |
+
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
77 |
+
return ret("qualifier", "qualifier");
|
78 |
+
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
79 |
+
return ret(null, ch);
|
80 |
+
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
81 |
+
(ch == "d" && stream.match("omain(")) ||
|
82 |
+
(ch == "r" && stream.match("egexp("))) {
|
83 |
+
stream.backUp(1);
|
84 |
+
state.tokenize = tokenParenthesized;
|
85 |
+
return ret("property", "word");
|
86 |
+
} else if (/[\w\\\-]/.test(ch)) {
|
87 |
+
stream.eatWhile(/[\w\\\-]/);
|
88 |
+
return ret("property", "word");
|
89 |
+
} else {
|
90 |
+
return ret(null, null);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
function tokenString(quote) {
|
95 |
+
return function(stream, state) {
|
96 |
+
var escaped = false, ch;
|
97 |
+
while ((ch = stream.next()) != null) {
|
98 |
+
if (ch == quote && !escaped) {
|
99 |
+
if (quote == ")") stream.backUp(1);
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
escaped = !escaped && ch == "\\";
|
103 |
+
}
|
104 |
+
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
105 |
+
return ret("string", "string");
|
106 |
+
};
|
107 |
+
}
|
108 |
+
|
109 |
+
function tokenParenthesized(stream, state) {
|
110 |
+
stream.next(); // Must be '('
|
111 |
+
if (!stream.match(/\s*[\"\')]/, false))
|
112 |
+
state.tokenize = tokenString(")");
|
113 |
+
else
|
114 |
+
state.tokenize = null;
|
115 |
+
return ret(null, "(");
|
116 |
+
}
|
117 |
+
|
118 |
+
// Context management
|
119 |
+
|
120 |
+
function Context(type, indent, prev) {
|
121 |
+
this.type = type;
|
122 |
+
this.indent = indent;
|
123 |
+
this.prev = prev;
|
124 |
+
}
|
125 |
+
|
126 |
+
function pushContext(state, stream, type, indent) {
|
127 |
+
state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
|
128 |
+
return type;
|
129 |
+
}
|
130 |
+
|
131 |
+
function popContext(state) {
|
132 |
+
if (state.context.prev)
|
133 |
+
state.context = state.context.prev;
|
134 |
+
return state.context.type;
|
135 |
+
}
|
136 |
+
|
137 |
+
function pass(type, stream, state) {
|
138 |
+
return states[state.context.type](type, stream, state);
|
139 |
+
}
|
140 |
+
function popAndPass(type, stream, state, n) {
|
141 |
+
for (var i = n || 1; i > 0; i--)
|
142 |
+
state.context = state.context.prev;
|
143 |
+
return pass(type, stream, state);
|
144 |
+
}
|
145 |
+
|
146 |
+
// Parser
|
147 |
+
|
148 |
+
function wordAsValue(stream) {
|
149 |
+
var word = stream.current().toLowerCase();
|
150 |
+
if (valueKeywords.hasOwnProperty(word))
|
151 |
+
override = "atom";
|
152 |
+
else if (colorKeywords.hasOwnProperty(word))
|
153 |
+
override = "keyword";
|
154 |
+
else
|
155 |
+
override = "variable";
|
156 |
+
}
|
157 |
+
|
158 |
+
var states = {};
|
159 |
+
|
160 |
+
states.top = function(type, stream, state) {
|
161 |
+
if (type == "{") {
|
162 |
+
return pushContext(state, stream, "block");
|
163 |
+
} else if (type == "}" && state.context.prev) {
|
164 |
+
return popContext(state);
|
165 |
+
} else if (supportsAtComponent && /@component/.test(type)) {
|
166 |
+
return pushContext(state, stream, "atComponentBlock");
|
167 |
+
} else if (/^@(-moz-)?document$/.test(type)) {
|
168 |
+
return pushContext(state, stream, "documentTypes");
|
169 |
+
} else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
|
170 |
+
return pushContext(state, stream, "atBlock");
|
171 |
+
} else if (/^@(font-face|counter-style)/.test(type)) {
|
172 |
+
state.stateArg = type;
|
173 |
+
return "restricted_atBlock_before";
|
174 |
+
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
175 |
+
return "keyframes";
|
176 |
+
} else if (type && type.charAt(0) == "@") {
|
177 |
+
return pushContext(state, stream, "at");
|
178 |
+
} else if (type == "hash") {
|
179 |
+
override = "builtin";
|
180 |
+
} else if (type == "word") {
|
181 |
+
override = "tag";
|
182 |
+
} else if (type == "variable-definition") {
|
183 |
+
return "maybeprop";
|
184 |
+
} else if (type == "interpolation") {
|
185 |
+
return pushContext(state, stream, "interpolation");
|
186 |
+
} else if (type == ":") {
|
187 |
+
return "pseudo";
|
188 |
+
} else if (allowNested && type == "(") {
|
189 |
+
return pushContext(state, stream, "parens");
|
190 |
+
}
|
191 |
+
return state.context.type;
|
192 |
+
};
|
193 |
+
|
194 |
+
states.block = function(type, stream, state) {
|
195 |
+
if (type == "word") {
|
196 |
+
var word = stream.current().toLowerCase();
|
197 |
+
if (propertyKeywords.hasOwnProperty(word)) {
|
198 |
+
override = "property";
|
199 |
+
return "maybeprop";
|
200 |
+
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
201 |
+
override = "string-2";
|
202 |
+
return "maybeprop";
|
203 |
+
} else if (allowNested) {
|
204 |
+
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
205 |
+
return "block";
|
206 |
+
} else {
|
207 |
+
override += " error";
|
208 |
+
return "maybeprop";
|
209 |
+
}
|
210 |
+
} else if (type == "meta") {
|
211 |
+
return "block";
|
212 |
+
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
213 |
+
override = "error";
|
214 |
+
return "block";
|
215 |
+
} else {
|
216 |
+
return states.top(type, stream, state);
|
217 |
+
}
|
218 |
+
};
|
219 |
+
|
220 |
+
states.maybeprop = function(type, stream, state) {
|
221 |
+
if (type == ":") return pushContext(state, stream, "prop");
|
222 |
+
return pass(type, stream, state);
|
223 |
+
};
|
224 |
+
|
225 |
+
states.prop = function(type, stream, state) {
|
226 |
+
if (type == ";") return popContext(state);
|
227 |
+
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
228 |
+
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
229 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
230 |
+
|
231 |
+
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
|
232 |
+
override += " error";
|
233 |
+
} else if (type == "word") {
|
234 |
+
wordAsValue(stream);
|
235 |
+
} else if (type == "interpolation") {
|
236 |
+
return pushContext(state, stream, "interpolation");
|
237 |
+
}
|
238 |
+
return "prop";
|
239 |
+
};
|
240 |
+
|
241 |
+
states.propBlock = function(type, _stream, state) {
|
242 |
+
if (type == "}") return popContext(state);
|
243 |
+
if (type == "word") { override = "property"; return "maybeprop"; }
|
244 |
+
return state.context.type;
|
245 |
+
};
|
246 |
+
|
247 |
+
states.parens = function(type, stream, state) {
|
248 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
249 |
+
if (type == ")") return popContext(state);
|
250 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
251 |
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
252 |
+
if (type == "word") wordAsValue(stream);
|
253 |
+
return "parens";
|
254 |
+
};
|
255 |
+
|
256 |
+
states.pseudo = function(type, stream, state) {
|
257 |
+
if (type == "meta") return "pseudo";
|
258 |
+
|
259 |
+
if (type == "word") {
|
260 |
+
override = "variable-3";
|
261 |
+
return state.context.type;
|
262 |
+
}
|
263 |
+
return pass(type, stream, state);
|
264 |
+
};
|
265 |
+
|
266 |
+
states.documentTypes = function(type, stream, state) {
|
267 |
+
if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
|
268 |
+
override = "tag";
|
269 |
+
return state.context.type;
|
270 |
+
} else {
|
271 |
+
return states.atBlock(type, stream, state);
|
272 |
+
}
|
273 |
+
};
|
274 |
+
|
275 |
+
states.atBlock = function(type, stream, state) {
|
276 |
+
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
277 |
+
if (type == "}" || type == ";") return popAndPass(type, stream, state);
|
278 |
+
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
279 |
+
|
280 |
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
281 |
+
|
282 |
+
if (type == "word") {
|
283 |
+
var word = stream.current().toLowerCase();
|
284 |
+
if (word == "only" || word == "not" || word == "and" || word == "or")
|
285 |
+
override = "keyword";
|
286 |
+
else if (mediaTypes.hasOwnProperty(word))
|
287 |
+
override = "attribute";
|
288 |
+
else if (mediaFeatures.hasOwnProperty(word))
|
289 |
+
override = "property";
|
290 |
+
else if (mediaValueKeywords.hasOwnProperty(word))
|
291 |
+
override = "keyword";
|
292 |
+
else if (propertyKeywords.hasOwnProperty(word))
|
293 |
+
override = "property";
|
294 |
+
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
295 |
+
override = "string-2";
|
296 |
+
else if (valueKeywords.hasOwnProperty(word))
|
297 |
+
override = "atom";
|
298 |
+
else if (colorKeywords.hasOwnProperty(word))
|
299 |
+
override = "keyword";
|
300 |
+
else
|
301 |
+
override = "error";
|
302 |
+
}
|
303 |
+
return state.context.type;
|
304 |
+
};
|
305 |
+
|
306 |
+
states.atComponentBlock = function(type, stream, state) {
|
307 |
+
if (type == "}")
|
308 |
+
return popAndPass(type, stream, state);
|
309 |
+
if (type == "{")
|
310 |
+
return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
|
311 |
+
if (type == "word")
|
312 |
+
override = "error";
|
313 |
+
return state.context.type;
|
314 |
+
};
|
315 |
+
|
316 |
+
states.atBlock_parens = function(type, stream, state) {
|
317 |
+
if (type == ")") return popContext(state);
|
318 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
319 |
+
return states.atBlock(type, stream, state);
|
320 |
+
};
|
321 |
+
|
322 |
+
states.restricted_atBlock_before = function(type, stream, state) {
|
323 |
+
if (type == "{")
|
324 |
+
return pushContext(state, stream, "restricted_atBlock");
|
325 |
+
if (type == "word" && state.stateArg == "@counter-style") {
|
326 |
+
override = "variable";
|
327 |
+
return "restricted_atBlock_before";
|
328 |
+
}
|
329 |
+
return pass(type, stream, state);
|
330 |
+
};
|
331 |
+
|
332 |
+
states.restricted_atBlock = function(type, stream, state) {
|
333 |
+
if (type == "}") {
|
334 |
+
state.stateArg = null;
|
335 |
+
return popContext(state);
|
336 |
+
}
|
337 |
+
if (type == "word") {
|
338 |
+
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
339 |
+
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
340 |
+
override = "error";
|
341 |
+
else
|
342 |
+
override = "property";
|
343 |
+
return "maybeprop";
|
344 |
+
}
|
345 |
+
return "restricted_atBlock";
|
346 |
+
};
|
347 |
+
|
348 |
+
states.keyframes = function(type, stream, state) {
|
349 |
+
if (type == "word") { override = "variable"; return "keyframes"; }
|
350 |
+
if (type == "{") return pushContext(state, stream, "top");
|
351 |
+
return pass(type, stream, state);
|
352 |
+
};
|
353 |
+
|
354 |
+
states.at = function(type, stream, state) {
|
355 |
+
if (type == ";") return popContext(state);
|
356 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
357 |
+
if (type == "word") override = "tag";
|
358 |
+
else if (type == "hash") override = "builtin";
|
359 |
+
return "at";
|
360 |
+
};
|
361 |
+
|
362 |
+
states.interpolation = function(type, stream, state) {
|
363 |
+
if (type == "}") return popContext(state);
|
364 |
+
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
365 |
+
if (type == "word") override = "variable";
|
366 |
+
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
367 |
+
return "interpolation";
|
368 |
+
};
|
369 |
+
|
370 |
+
return {
|
371 |
+
startState: function(base) {
|
372 |
+
return {tokenize: null,
|
373 |
+
state: inline ? "block" : "top",
|
374 |
+
stateArg: null,
|
375 |
+
context: new Context(inline ? "block" : "top", base || 0, null)};
|
376 |
+
},
|
377 |
+
|
378 |
+
token: function(stream, state) {
|
379 |
+
if (!state.tokenize && stream.eatSpace()) return null;
|
380 |
+
var style = (state.tokenize || tokenBase)(stream, state);
|
381 |
+
if (style && typeof style == "object") {
|
382 |
+
type = style[1];
|
383 |
+
style = style[0];
|
384 |
+
}
|
385 |
+
override = style;
|
386 |
+
state.state = states[state.state](type, stream, state);
|
387 |
+
return override;
|
388 |
+
},
|
389 |
+
|
390 |
+
indent: function(state, textAfter) {
|
391 |
+
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
392 |
+
var indent = cx.indent;
|
393 |
+
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
394 |
+
if (cx.prev) {
|
395 |
+
if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
|
396 |
+
cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
|
397 |
+
// Resume indentation from parent context.
|
398 |
+
cx = cx.prev;
|
399 |
+
indent = cx.indent;
|
400 |
+
} else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
401 |
+
ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
|
402 |
+
// Dedent relative to current context.
|
403 |
+
indent = Math.max(0, cx.indent - indentUnit);
|
404 |
+
}
|
405 |
+
}
|
406 |
+
return indent;
|
407 |
+
},
|
408 |
+
|
409 |
+
electricChars: "}",
|
410 |
+
blockCommentStart: "/*",
|
411 |
+
blockCommentEnd: "*/",
|
412 |
+
lineComment: lineComment,
|
413 |
+
fold: "brace"
|
414 |
+
};
|
415 |
+
});
|
416 |
+
|
417 |
+
function keySet(array) {
|
418 |
+
var keys = {};
|
419 |
+
for (var i = 0; i < array.length; ++i) {
|
420 |
+
keys[array[i].toLowerCase()] = true;
|
421 |
+
}
|
422 |
+
return keys;
|
423 |
+
}
|
424 |
+
|
425 |
+
var documentTypes_ = [
|
426 |
+
"domain", "regexp", "url", "url-prefix"
|
427 |
+
], documentTypes = keySet(documentTypes_);
|
428 |
+
|
429 |
+
var mediaTypes_ = [
|
430 |
+
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
431 |
+
"tty", "tv", "embossed"
|
432 |
+
], mediaTypes = keySet(mediaTypes_);
|
433 |
+
|
434 |
+
var mediaFeatures_ = [
|
435 |
+
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
436 |
+
"device-width", "min-device-width", "max-device-width", "device-height",
|
437 |
+
"min-device-height", "max-device-height", "aspect-ratio",
|
438 |
+
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
439 |
+
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
440 |
+
"max-color", "color-index", "min-color-index", "max-color-index",
|
441 |
+
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
442 |
+
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
443 |
+
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
444 |
+
"pointer", "any-pointer", "hover", "any-hover"
|
445 |
+
], mediaFeatures = keySet(mediaFeatures_);
|
446 |
+
|
447 |
+
var mediaValueKeywords_ = [
|
448 |
+
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
449 |
+
"interlace", "progressive"
|
450 |
+
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
451 |
+
|
452 |
+
var propertyKeywords_ = [
|
453 |
+
"align-content", "align-items", "align-self", "alignment-adjust",
|
454 |
+
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
455 |
+
"animation-direction", "animation-duration", "animation-fill-mode",
|
456 |
+
"animation-iteration-count", "animation-name", "animation-play-state",
|
457 |
+
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
458 |
+
"background", "background-attachment", "background-blend-mode", "background-clip",
|
459 |
+
"background-color", "background-image", "background-origin", "background-position",
|
460 |
+
"background-repeat", "background-size", "baseline-shift", "binding",
|
461 |
+
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
462 |
+
"bookmark-target", "border", "border-bottom", "border-bottom-color",
|
463 |
+
"border-bottom-left-radius", "border-bottom-right-radius",
|
464 |
+
"border-bottom-style", "border-bottom-width", "border-collapse",
|
465 |
+
"border-color", "border-image", "border-image-outset",
|
466 |
+
"border-image-repeat", "border-image-slice", "border-image-source",
|
467 |
+
"border-image-width", "border-left", "border-left-color",
|
468 |
+
"border-left-style", "border-left-width", "border-radius", "border-right",
|
469 |
+
"border-right-color", "border-right-style", "border-right-width",
|
470 |
+
"border-spacing", "border-style", "border-top", "border-top-color",
|
471 |
+
"border-top-left-radius", "border-top-right-radius", "border-top-style",
|
472 |
+
"border-top-width", "border-width", "bottom", "box-decoration-break",
|
473 |
+
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
474 |
+
"caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count",
|
475 |
+
"column-fill", "column-gap", "column-rule", "column-rule-color",
|
476 |
+
"column-rule-style", "column-rule-width", "column-span", "column-width",
|
477 |
+
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
|
478 |
+
"cue-after", "cue-before", "cursor", "direction", "display",
|
479 |
+
"dominant-baseline", "drop-initial-after-adjust",
|
480 |
+
"drop-initial-after-align", "drop-initial-before-adjust",
|
481 |
+
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
482 |
+
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
483 |
+
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
484 |
+
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
485 |
+
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
486 |
+
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
487 |
+
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
488 |
+
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
489 |
+
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
490 |
+
"grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap",
|
491 |
+
"grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
|
492 |
+
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
|
493 |
+
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
494 |
+
"icon", "image-orientation", "image-rendering", "image-resolution",
|
495 |
+
"inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing",
|
496 |
+
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
497 |
+
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
498 |
+
"list-style-image", "list-style-position", "list-style-type", "margin",
|
499 |
+
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
500 |
+
"marks", "marquee-direction", "marquee-loop",
|
501 |
+
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
502 |
+
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
503 |
+
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
504 |
+
"opacity", "order", "orphans", "outline",
|
505 |
+
"outline-color", "outline-offset", "outline-style", "outline-width",
|
506 |
+
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
507 |
+
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
508 |
+
"page", "page-break-after", "page-break-before", "page-break-inside",
|
509 |
+
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
510 |
+
"perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position",
|
511 |
+
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
512 |
+
"region-break-before", "region-break-inside", "region-fragment",
|
513 |
+
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
514 |
+
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
515 |
+
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
516 |
+
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
517 |
+
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
518 |
+
"tab-size", "table-layout", "target", "target-name", "target-new",
|
519 |
+
"target-position", "text-align", "text-align-last", "text-decoration",
|
520 |
+
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
521 |
+
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
522 |
+
"text-emphasis-position", "text-emphasis-style", "text-height",
|
523 |
+
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
524 |
+
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
525 |
+
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
526 |
+
"transition", "transition-delay", "transition-duration",
|
527 |
+
"transition-property", "transition-timing-function", "unicode-bidi",
|
528 |
+
"user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
|
529 |
+
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
530 |
+
"voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
|
531 |
+
"word-spacing", "word-wrap", "z-index",
|
532 |
+
// SVG-specific
|
533 |
+
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
534 |
+
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
535 |
+
"color-interpolation", "color-interpolation-filters",
|
536 |
+
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
537 |
+
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
538 |
+
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
539 |
+
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
540 |
+
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
541 |
+
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
542 |
+
], propertyKeywords = keySet(propertyKeywords_);
|
543 |
+
|
544 |
+
var nonStandardPropertyKeywords_ = [
|
545 |
+
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
546 |
+
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
547 |
+
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
548 |
+
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
549 |
+
"searchfield-results-decoration", "zoom"
|
550 |
+
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
551 |
+
|
552 |
+
var fontProperties_ = [
|
553 |
+
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
554 |
+
"font-stretch", "font-weight", "font-style"
|
555 |
+
], fontProperties = keySet(fontProperties_);
|
556 |
+
|
557 |
+
var counterDescriptors_ = [
|
558 |
+
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
559 |
+
"speak-as", "suffix", "symbols", "system"
|
560 |
+
], counterDescriptors = keySet(counterDescriptors_);
|
561 |
+
|
562 |
+
var colorKeywords_ = [
|
563 |
+
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
|
564 |
+
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
|
565 |
+
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
|
566 |
+
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
|
567 |
+
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
568 |
+
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
569 |
+
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
570 |
+
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
571 |
+
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
572 |
+
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
573 |
+
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
574 |
+
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
575 |
+
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
576 |
+
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
577 |
+
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
|
578 |
+
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
|
579 |
+
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
580 |
+
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
581 |
+
"navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
|
582 |
+
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
583 |
+
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
584 |
+
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
|
585 |
+
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
|
586 |
+
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
|
587 |
+
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
588 |
+
"whitesmoke", "yellow", "yellowgreen"
|
589 |
+
], colorKeywords = keySet(colorKeywords_);
|
590 |
+
|
591 |
+
var valueKeywords_ = [
|
592 |
+
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
593 |
+
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
594 |
+
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
595 |
+
"arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
|
596 |
+
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
597 |
+
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
598 |
+
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
599 |
+
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
600 |
+
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
601 |
+
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
602 |
+
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
603 |
+
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
|
604 |
+
"compact", "condensed", "contain", "content", "contents",
|
605 |
+
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
606 |
+
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
|
607 |
+
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
|
608 |
+
"destination-in", "destination-out", "destination-over", "devanagari", "difference",
|
609 |
+
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
610 |
+
"dot-dash", "dot-dot-dash",
|
611 |
+
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
612 |
+
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
613 |
+
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
614 |
+
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
615 |
+
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
616 |
+
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
617 |
+
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
618 |
+
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
619 |
+
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
|
620 |
+
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
621 |
+
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
|
622 |
+
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
|
623 |
+
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
624 |
+
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
|
625 |
+
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
626 |
+
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
627 |
+
"inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
|
628 |
+
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
629 |
+
"katakana", "katakana-iroha", "keep-all", "khmer",
|
630 |
+
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
631 |
+
"landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
|
632 |
+
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
633 |
+
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
634 |
+
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
635 |
+
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
|
636 |
+
"media-controls-background", "media-current-time-display",
|
637 |
+
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
638 |
+
"media-return-to-realtime-button", "media-rewind-button",
|
639 |
+
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
640 |
+
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
641 |
+
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
642 |
+
"menu", "menulist", "menulist-button", "menulist-text",
|
643 |
+
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
644 |
+
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
|
645 |
+
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
646 |
+
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
647 |
+
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
|
648 |
+
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
649 |
+
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
650 |
+
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
651 |
+
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
652 |
+
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
653 |
+
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
654 |
+
"relative", "repeat", "repeating-linear-gradient",
|
655 |
+
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
656 |
+
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
657 |
+
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
|
658 |
+
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
|
659 |
+
"scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
|
660 |
+
"searchfield-cancel-button", "searchfield-decoration",
|
661 |
+
"searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
|
662 |
+
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
663 |
+
"simp-chinese-formal", "simp-chinese-informal", "single",
|
664 |
+
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
665 |
+
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
666 |
+
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
|
667 |
+
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
|
668 |
+
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
669 |
+
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
|
670 |
+
"table-caption", "table-cell", "table-column", "table-column-group",
|
671 |
+
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
672 |
+
"tamil",
|
673 |
+
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
674 |
+
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
675 |
+
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
676 |
+
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
677 |
+
"trad-chinese-formal", "trad-chinese-informal", "transform",
|
678 |
+
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
679 |
+
"transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
|
680 |
+
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
681 |
+
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
682 |
+
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
683 |
+
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
684 |
+
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
|
685 |
+
"xx-large", "xx-small"
|
686 |
+
], valueKeywords = keySet(valueKeywords_);
|
687 |
+
|
688 |
+
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
|
689 |
+
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
|
690 |
+
.concat(valueKeywords_);
|
691 |
+
CodeMirror.registerHelper("hintWords", "css", allWords);
|
692 |
+
|
693 |
+
function tokenCComment(stream, state) {
|
694 |
+
var maybeEnd = false, ch;
|
695 |
+
while ((ch = stream.next()) != null) {
|
696 |
+
if (maybeEnd && ch == "/") {
|
697 |
+
state.tokenize = null;
|
698 |
+
break;
|
699 |
+
}
|
700 |
+
maybeEnd = (ch == "*");
|
701 |
+
}
|
702 |
+
return ["comment", "comment"];
|
703 |
+
}
|
704 |
+
|
705 |
+
CodeMirror.defineMIME("text/css", {
|
706 |
+
documentTypes: documentTypes,
|
707 |
+
mediaTypes: mediaTypes,
|
708 |
+
mediaFeatures: mediaFeatures,
|
709 |
+
mediaValueKeywords: mediaValueKeywords,
|
710 |
+
propertyKeywords: propertyKeywords,
|
711 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
712 |
+
fontProperties: fontProperties,
|
713 |
+
counterDescriptors: counterDescriptors,
|
714 |
+
colorKeywords: colorKeywords,
|
715 |
+
valueKeywords: valueKeywords,
|
716 |
+
tokenHooks: {
|
717 |
+
"/": function(stream, state) {
|
718 |
+
if (!stream.eat("*")) return false;
|
719 |
+
state.tokenize = tokenCComment;
|
720 |
+
return tokenCComment(stream, state);
|
721 |
+
}
|
722 |
+
},
|
723 |
+
name: "css"
|
724 |
+
});
|
725 |
+
|
726 |
+
CodeMirror.defineMIME("text/x-scss", {
|
727 |
+
mediaTypes: mediaTypes,
|
728 |
+
mediaFeatures: mediaFeatures,
|
729 |
+
mediaValueKeywords: mediaValueKeywords,
|
730 |
+
propertyKeywords: propertyKeywords,
|
731 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
732 |
+
colorKeywords: colorKeywords,
|
733 |
+
valueKeywords: valueKeywords,
|
734 |
+
fontProperties: fontProperties,
|
735 |
+
allowNested: true,
|
736 |
+
lineComment: "//",
|
737 |
+
tokenHooks: {
|
738 |
+
"/": function(stream, state) {
|
739 |
+
if (stream.eat("/")) {
|
740 |
+
stream.skipToEnd();
|
741 |
+
return ["comment", "comment"];
|
742 |
+
} else if (stream.eat("*")) {
|
743 |
+
state.tokenize = tokenCComment;
|
744 |
+
return tokenCComment(stream, state);
|
745 |
+
} else {
|
746 |
+
return ["operator", "operator"];
|
747 |
+
}
|
748 |
+
},
|
749 |
+
":": function(stream) {
|
750 |
+
if (stream.match(/\s*\{/, false))
|
751 |
+
return [null, null]
|
752 |
+
return false;
|
753 |
+
},
|
754 |
+
"$": function(stream) {
|
755 |
+
stream.match(/^[\w-]+/);
|
756 |
+
if (stream.match(/^\s*:/, false))
|
757 |
+
return ["variable-2", "variable-definition"];
|
758 |
+
return ["variable-2", "variable"];
|
759 |
+
},
|
760 |
+
"#": function(stream) {
|
761 |
+
if (!stream.eat("{")) return false;
|
762 |
+
return [null, "interpolation"];
|
763 |
+
}
|
764 |
+
},
|
765 |
+
name: "css",
|
766 |
+
helperType: "scss"
|
767 |
+
});
|
768 |
+
|
769 |
+
CodeMirror.defineMIME("text/x-less", {
|
770 |
+
mediaTypes: mediaTypes,
|
771 |
+
mediaFeatures: mediaFeatures,
|
772 |
+
mediaValueKeywords: mediaValueKeywords,
|
773 |
+
propertyKeywords: propertyKeywords,
|
774 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
775 |
+
colorKeywords: colorKeywords,
|
776 |
+
valueKeywords: valueKeywords,
|
777 |
+
fontProperties: fontProperties,
|
778 |
+
allowNested: true,
|
779 |
+
lineComment: "//",
|
780 |
+
tokenHooks: {
|
781 |
+
"/": function(stream, state) {
|
782 |
+
if (stream.eat("/")) {
|
783 |
+
stream.skipToEnd();
|
784 |
+
return ["comment", "comment"];
|
785 |
+
} else if (stream.eat("*")) {
|
786 |
+
state.tokenize = tokenCComment;
|
787 |
+
return tokenCComment(stream, state);
|
788 |
+
} else {
|
789 |
+
return ["operator", "operator"];
|
790 |
+
}
|
791 |
+
},
|
792 |
+
"@": function(stream) {
|
793 |
+
if (stream.eat("{")) return [null, "interpolation"];
|
794 |
+
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
795 |
+
stream.eatWhile(/[\w\\\-]/);
|
796 |
+
if (stream.match(/^\s*:/, false))
|
797 |
+
return ["variable-2", "variable-definition"];
|
798 |
+
return ["variable-2", "variable"];
|
799 |
+
},
|
800 |
+
"&": function() {
|
801 |
+
return ["atom", "atom"];
|
802 |
+
}
|
803 |
+
},
|
804 |
+
name: "css",
|
805 |
+
helperType: "less"
|
806 |
+
});
|
807 |
+
|
808 |
+
CodeMirror.defineMIME("text/x-gss", {
|
809 |
+
documentTypes: documentTypes,
|
810 |
+
mediaTypes: mediaTypes,
|
811 |
+
mediaFeatures: mediaFeatures,
|
812 |
+
propertyKeywords: propertyKeywords,
|
813 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
814 |
+
fontProperties: fontProperties,
|
815 |
+
counterDescriptors: counterDescriptors,
|
816 |
+
colorKeywords: colorKeywords,
|
817 |
+
valueKeywords: valueKeywords,
|
818 |
+
supportsAtComponent: true,
|
819 |
+
tokenHooks: {
|
820 |
+
"/": function(stream, state) {
|
821 |
+
if (!stream.eat("*")) return false;
|
822 |
+
state.tokenize = tokenCComment;
|
823 |
+
return tokenCComment(stream, state);
|
824 |
+
}
|
825 |
+
},
|
826 |
+
name: "css",
|
827 |
+
helperType: "gss"
|
828 |
+
});
|
829 |
+
|
830 |
+
});
|
includes/js/codemirror/htmlmixed.js
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
(function(mod) {
|
5 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
+
mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css"));
|
7 |
+
else if (typeof define == "function" && define.amd) // AMD
|
8 |
+
define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod);
|
9 |
+
else // Plain browser env
|
10 |
+
mod(CodeMirror);
|
11 |
+
})(function(CodeMirror) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
var defaultTags = {
|
15 |
+
script: [
|
16 |
+
["lang", /(javascript|babel)/i, "javascript"],
|
17 |
+
["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
|
18 |
+
["type", /./, "text/plain"],
|
19 |
+
[null, null, "javascript"]
|
20 |
+
],
|
21 |
+
style: [
|
22 |
+
["lang", /^css$/i, "css"],
|
23 |
+
["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
|
24 |
+
["type", /./, "text/plain"],
|
25 |
+
[null, null, "css"]
|
26 |
+
]
|
27 |
+
};
|
28 |
+
|
29 |
+
function maybeBackup(stream, pat, style) {
|
30 |
+
var cur = stream.current(), close = cur.search(pat);
|
31 |
+
if (close > -1) {
|
32 |
+
stream.backUp(cur.length - close);
|
33 |
+
} else if (cur.match(/<\/?$/)) {
|
34 |
+
stream.backUp(cur.length);
|
35 |
+
if (!stream.match(pat, false)) stream.match(cur);
|
36 |
+
}
|
37 |
+
return style;
|
38 |
+
}
|
39 |
+
|
40 |
+
var attrRegexpCache = {};
|
41 |
+
function getAttrRegexp(attr) {
|
42 |
+
var regexp = attrRegexpCache[attr];
|
43 |
+
if (regexp) return regexp;
|
44 |
+
return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
|
45 |
+
}
|
46 |
+
|
47 |
+
function getAttrValue(text, attr) {
|
48 |
+
var match = text.match(getAttrRegexp(attr))
|
49 |
+
return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : ""
|
50 |
+
}
|
51 |
+
|
52 |
+
function getTagRegexp(tagName, anchored) {
|
53 |
+
return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i");
|
54 |
+
}
|
55 |
+
|
56 |
+
function addTags(from, to) {
|
57 |
+
for (var tag in from) {
|
58 |
+
var dest = to[tag] || (to[tag] = []);
|
59 |
+
var source = from[tag];
|
60 |
+
for (var i = source.length - 1; i >= 0; i--)
|
61 |
+
dest.unshift(source[i])
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function findMatchingMode(tagInfo, tagText) {
|
66 |
+
for (var i = 0; i < tagInfo.length; i++) {
|
67 |
+
var spec = tagInfo[i];
|
68 |
+
if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
CodeMirror.defineMode("htmlmixed", function (config, parserConfig) {
|
73 |
+
var htmlMode = CodeMirror.getMode(config, {
|
74 |
+
name: "xml",
|
75 |
+
htmlMode: true,
|
76 |
+
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
|
77 |
+
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
|
78 |
+
});
|
79 |
+
|
80 |
+
var tags = {};
|
81 |
+
var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
|
82 |
+
addTags(defaultTags, tags);
|
83 |
+
if (configTags) addTags(configTags, tags);
|
84 |
+
if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
|
85 |
+
tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
|
86 |
+
|
87 |
+
function html(stream, state) {
|
88 |
+
var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName
|
89 |
+
if (tag && !/[<>\s\/]/.test(stream.current()) &&
|
90 |
+
(tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&
|
91 |
+
tags.hasOwnProperty(tagName)) {
|
92 |
+
state.inTag = tagName + " "
|
93 |
+
} else if (state.inTag && tag && />$/.test(stream.current())) {
|
94 |
+
var inTag = /^([\S]+) (.*)/.exec(state.inTag)
|
95 |
+
state.inTag = null
|
96 |
+
var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2])
|
97 |
+
var mode = CodeMirror.getMode(config, modeSpec)
|
98 |
+
var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
|
99 |
+
state.token = function (stream, state) {
|
100 |
+
if (stream.match(endTagA, false)) {
|
101 |
+
state.token = html;
|
102 |
+
state.localState = state.localMode = null;
|
103 |
+
return null;
|
104 |
+
}
|
105 |
+
return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));
|
106 |
+
};
|
107 |
+
state.localMode = mode;
|
108 |
+
state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
|
109 |
+
} else if (state.inTag) {
|
110 |
+
state.inTag += stream.current()
|
111 |
+
if (stream.eol()) state.inTag += " "
|
112 |
+
}
|
113 |
+
return style;
|
114 |
+
};
|
115 |
+
|
116 |
+
return {
|
117 |
+
startState: function () {
|
118 |
+
var state = CodeMirror.startState(htmlMode);
|
119 |
+
return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};
|
120 |
+
},
|
121 |
+
|
122 |
+
copyState: function (state) {
|
123 |
+
var local;
|
124 |
+
if (state.localState) {
|
125 |
+
local = CodeMirror.copyState(state.localMode, state.localState);
|
126 |
+
}
|
127 |
+
return {token: state.token, inTag: state.inTag,
|
128 |
+
localMode: state.localMode, localState: local,
|
129 |
+
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
130 |
+
},
|
131 |
+
|
132 |
+
token: function (stream, state) {
|
133 |
+
return state.token(stream, state);
|
134 |
+
},
|
135 |
+
|
136 |
+
indent: function (state, textAfter, line) {
|
137 |
+
if (!state.localMode || /^\s*<\//.test(textAfter))
|
138 |
+
return htmlMode.indent(state.htmlState, textAfter);
|
139 |
+
else if (state.localMode.indent)
|
140 |
+
return state.localMode.indent(state.localState, textAfter, line);
|
141 |
+
else
|
142 |
+
return CodeMirror.Pass;
|
143 |
+
},
|
144 |
+
|
145 |
+
innerMode: function (state) {
|
146 |
+
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
|
147 |
+
}
|
148 |
+
};
|
149 |
+
}, "xml", "javascript", "css");
|
150 |
+
|
151 |
+
CodeMirror.defineMIME("text/html", "htmlmixed");
|
152 |
+
});
|
includes/js/codemirror/javascript.js
ADDED
@@ -0,0 +1,813 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
(function(mod) {
|
5 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
+
mod(require("../../lib/codemirror"));
|
7 |
+
else if (typeof define == "function" && define.amd) // AMD
|
8 |
+
define(["../../lib/codemirror"], mod);
|
9 |
+
else // Plain browser env
|
10 |
+
mod(CodeMirror);
|
11 |
+
})(function(CodeMirror) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
function expressionAllowed(stream, state, backUp) {
|
15 |
+
return /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
|
16 |
+
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
|
17 |
+
}
|
18 |
+
|
19 |
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
20 |
+
var indentUnit = config.indentUnit;
|
21 |
+
var statementIndent = parserConfig.statementIndent;
|
22 |
+
var jsonldMode = parserConfig.jsonld;
|
23 |
+
var jsonMode = parserConfig.json || jsonldMode;
|
24 |
+
var isTS = parserConfig.typescript;
|
25 |
+
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
26 |
+
|
27 |
+
// Tokenizer
|
28 |
+
|
29 |
+
var keywords = function(){
|
30 |
+
function kw(type) {return {type: type, style: "keyword"};}
|
31 |
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
32 |
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
33 |
+
|
34 |
+
var jsKeywords = {
|
35 |
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
36 |
+
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
|
37 |
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
38 |
+
"function": kw("function"), "catch": kw("catch"),
|
39 |
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
40 |
+
"in": operator, "typeof": operator, "instanceof": operator,
|
41 |
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
42 |
+
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
43 |
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
44 |
+
"await": C, "async": kw("async")
|
45 |
+
};
|
46 |
+
|
47 |
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
48 |
+
if (isTS) {
|
49 |
+
var type = {type: "variable", style: "variable-3"};
|
50 |
+
var tsKeywords = {
|
51 |
+
// object-like things
|
52 |
+
"interface": kw("class"),
|
53 |
+
"implements": C,
|
54 |
+
"namespace": C,
|
55 |
+
"module": kw("module"),
|
56 |
+
"enum": kw("module"),
|
57 |
+
|
58 |
+
// scope modifiers
|
59 |
+
"public": kw("modifier"),
|
60 |
+
"private": kw("modifier"),
|
61 |
+
"protected": kw("modifier"),
|
62 |
+
"abstract": kw("modifier"),
|
63 |
+
|
64 |
+
// operators
|
65 |
+
"as": operator,
|
66 |
+
|
67 |
+
// types
|
68 |
+
"string": type, "number": type, "boolean": type, "any": type
|
69 |
+
};
|
70 |
+
|
71 |
+
for (var attr in tsKeywords) {
|
72 |
+
jsKeywords[attr] = tsKeywords[attr];
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
return jsKeywords;
|
77 |
+
}();
|
78 |
+
|
79 |
+
var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
|
80 |
+
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
81 |
+
|
82 |
+
function readRegexp(stream) {
|
83 |
+
var escaped = false, next, inSet = false;
|
84 |
+
while ((next = stream.next()) != null) {
|
85 |
+
if (!escaped) {
|
86 |
+
if (next == "/" && !inSet) return;
|
87 |
+
if (next == "[") inSet = true;
|
88 |
+
else if (inSet && next == "]") inSet = false;
|
89 |
+
}
|
90 |
+
escaped = !escaped && next == "\\";
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
// Used as scratch variables to communicate multiple values without
|
95 |
+
// consing up tons of objects.
|
96 |
+
var type, content;
|
97 |
+
function ret(tp, style, cont) {
|
98 |
+
type = tp; content = cont;
|
99 |
+
return style;
|
100 |
+
}
|
101 |
+
function tokenBase(stream, state) {
|
102 |
+
var ch = stream.next();
|
103 |
+
if (ch == '"' || ch == "'") {
|
104 |
+
state.tokenize = tokenString(ch);
|
105 |
+
return state.tokenize(stream, state);
|
106 |
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
107 |
+
return ret("number", "number");
|
108 |
+
} else if (ch == "." && stream.match("..")) {
|
109 |
+
return ret("spread", "meta");
|
110 |
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
111 |
+
return ret(ch);
|
112 |
+
} else if (ch == "=" && stream.eat(">")) {
|
113 |
+
return ret("=>", "operator");
|
114 |
+
} else if (ch == "0" && stream.eat(/x/i)) {
|
115 |
+
stream.eatWhile(/[\da-f]/i);
|
116 |
+
return ret("number", "number");
|
117 |
+
} else if (ch == "0" && stream.eat(/o/i)) {
|
118 |
+
stream.eatWhile(/[0-7]/i);
|
119 |
+
return ret("number", "number");
|
120 |
+
} else if (ch == "0" && stream.eat(/b/i)) {
|
121 |
+
stream.eatWhile(/[01]/i);
|
122 |
+
return ret("number", "number");
|
123 |
+
} else if (/\d/.test(ch)) {
|
124 |
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
125 |
+
return ret("number", "number");
|
126 |
+
} else if (ch == "/") {
|
127 |
+
if (stream.eat("*")) {
|
128 |
+
state.tokenize = tokenComment;
|
129 |
+
return tokenComment(stream, state);
|
130 |
+
} else if (stream.eat("/")) {
|
131 |
+
stream.skipToEnd();
|
132 |
+
return ret("comment", "comment");
|
133 |
+
} else if (expressionAllowed(stream, state, 1)) {
|
134 |
+
readRegexp(stream);
|
135 |
+
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
136 |
+
return ret("regexp", "string-2");
|
137 |
+
} else {
|
138 |
+
stream.eatWhile(isOperatorChar);
|
139 |
+
return ret("operator", "operator", stream.current());
|
140 |
+
}
|
141 |
+
} else if (ch == "`") {
|
142 |
+
state.tokenize = tokenQuasi;
|
143 |
+
return tokenQuasi(stream, state);
|
144 |
+
} else if (ch == "#") {
|
145 |
+
stream.skipToEnd();
|
146 |
+
return ret("error", "error");
|
147 |
+
} else if (isOperatorChar.test(ch)) {
|
148 |
+
if (ch != ">" || !state.lexical || state.lexical.type != ">")
|
149 |
+
stream.eatWhile(isOperatorChar);
|
150 |
+
return ret("operator", "operator", stream.current());
|
151 |
+
} else if (wordRE.test(ch)) {
|
152 |
+
stream.eatWhile(wordRE);
|
153 |
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
154 |
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
155 |
+
ret("variable", "variable", word);
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
function tokenString(quote) {
|
160 |
+
return function(stream, state) {
|
161 |
+
var escaped = false, next;
|
162 |
+
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
163 |
+
state.tokenize = tokenBase;
|
164 |
+
return ret("jsonld-keyword", "meta");
|
165 |
+
}
|
166 |
+
while ((next = stream.next()) != null) {
|
167 |
+
if (next == quote && !escaped) break;
|
168 |
+
escaped = !escaped && next == "\\";
|
169 |
+
}
|
170 |
+
if (!escaped) state.tokenize = tokenBase;
|
171 |
+
return ret("string", "string");
|
172 |
+
};
|
173 |
+
}
|
174 |
+
|
175 |
+
function tokenComment(stream, state) {
|
176 |
+
var maybeEnd = false, ch;
|
177 |
+
while (ch = stream.next()) {
|
178 |
+
if (ch == "/" && maybeEnd) {
|
179 |
+
state.tokenize = tokenBase;
|
180 |
+
break;
|
181 |
+
}
|
182 |
+
maybeEnd = (ch == "*");
|
183 |
+
}
|
184 |
+
return ret("comment", "comment");
|
185 |
+
}
|
186 |
+
|
187 |
+
function tokenQuasi(stream, state) {
|
188 |
+
var escaped = false, next;
|
189 |
+
while ((next = stream.next()) != null) {
|
190 |
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
191 |
+
state.tokenize = tokenBase;
|
192 |
+
break;
|
193 |
+
}
|
194 |
+
escaped = !escaped && next == "\\";
|
195 |
+
}
|
196 |
+
return ret("quasi", "string-2", stream.current());
|
197 |
+
}
|
198 |
+
|
199 |
+
var brackets = "([{}])";
|
200 |
+
// This is a crude lookahead trick to try and notice that we're
|
201 |
+
// parsing the argument patterns for a fat-arrow function before we
|
202 |
+
// actually hit the arrow token. It only works if the arrow is on
|
203 |
+
// the same line as the arguments and there's no strange noise
|
204 |
+
// (comments) in between. Fallback is to only notice when we hit the
|
205 |
+
// arrow, and not declare the arguments as locals for the arrow
|
206 |
+
// body.
|
207 |
+
function findFatArrow(stream, state) {
|
208 |
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
209 |
+
var arrow = stream.string.indexOf("=>", stream.start);
|
210 |
+
if (arrow < 0) return;
|
211 |
+
|
212 |
+
if (isTS) { // Try to skip TypeScript return type declarations after the arguments
|
213 |
+
var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
|
214 |
+
if (m) arrow = m.index
|
215 |
+
}
|
216 |
+
|
217 |
+
var depth = 0, sawSomething = false;
|
218 |
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
219 |
+
var ch = stream.string.charAt(pos);
|
220 |
+
var bracket = brackets.indexOf(ch);
|
221 |
+
if (bracket >= 0 && bracket < 3) {
|
222 |
+
if (!depth) { ++pos; break; }
|
223 |
+
if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
|
224 |
+
} else if (bracket >= 3 && bracket < 6) {
|
225 |
+
++depth;
|
226 |
+
} else if (wordRE.test(ch)) {
|
227 |
+
sawSomething = true;
|
228 |
+
} else if (/["'\/]/.test(ch)) {
|
229 |
+
return;
|
230 |
+
} else if (sawSomething && !depth) {
|
231 |
+
++pos;
|
232 |
+
break;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
236 |
+
}
|
237 |
+
|
238 |
+
// Parser
|
239 |
+
|
240 |
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
241 |
+
|
242 |
+
function JSLexical(indented, column, type, align, prev, info) {
|
243 |
+
this.indented = indented;
|
244 |
+
this.column = column;
|
245 |
+
this.type = type;
|
246 |
+
this.prev = prev;
|
247 |
+
this.info = info;
|
248 |
+
if (align != null) this.align = align;
|
249 |
+
}
|
250 |
+
|
251 |
+
function inScope(state, varname) {
|
252 |
+
for (var v = state.localVars; v; v = v.next)
|
253 |
+
if (v.name == varname) return true;
|
254 |
+
for (var cx = state.context; cx; cx = cx.prev) {
|
255 |
+
for (var v = cx.vars; v; v = v.next)
|
256 |
+
if (v.name == varname) return true;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
function parseJS(state, style, type, content, stream) {
|
261 |
+
var cc = state.cc;
|
262 |
+
// Communicate our context to the combinators.
|
263 |
+
// (Less wasteful than consing up a hundred closures on every call.)
|
264 |
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
265 |
+
|
266 |
+
if (!state.lexical.hasOwnProperty("align"))
|
267 |
+
state.lexical.align = true;
|
268 |
+
|
269 |
+
while(true) {
|
270 |
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
271 |
+
if (combinator(type, content)) {
|
272 |
+
while(cc.length && cc[cc.length - 1].lex)
|
273 |
+
cc.pop()();
|
274 |
+
if (cx.marked) return cx.marked;
|
275 |
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
276 |
+
return style;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
|
281 |
+
// Combinator utils
|
282 |
+
|
283 |
+
var cx = {state: null, column: null, marked: null, cc: null};
|
284 |
+
function pass() {
|
285 |
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
286 |
+
}
|
287 |
+
function cont() {
|
288 |
+
pass.apply(null, arguments);
|
289 |
+
return true;
|
290 |
+
}
|
291 |
+
function register(varname) {
|
292 |
+
function inList(list) {
|
293 |
+
for (var v = list; v; v = v.next)
|
294 |
+
if (v.name == varname) return true;
|
295 |
+
return false;
|
296 |
+
}
|
297 |
+
var state = cx.state;
|
298 |
+
cx.marked = "def";
|
299 |
+
if (state.context) {
|
300 |
+
if (inList(state.localVars)) return;
|
301 |
+
state.localVars = {name: varname, next: state.localVars};
|
302 |
+
} else {
|
303 |
+
if (inList(state.globalVars)) return;
|
304 |
+
if (parserConfig.globalVars)
|
305 |
+
state.globalVars = {name: varname, next: state.globalVars};
|
306 |
+
}
|
307 |
+
}
|
308 |
+
|
309 |
+
// Combinators
|
310 |
+
|
311 |
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
312 |
+
function pushcontext() {
|
313 |
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
314 |
+
cx.state.localVars = defaultVars;
|
315 |
+
}
|
316 |
+
function popcontext() {
|
317 |
+
cx.state.localVars = cx.state.context.vars;
|
318 |
+
cx.state.context = cx.state.context.prev;
|
319 |
+
}
|
320 |
+
function pushlex(type, info) {
|
321 |
+
var result = function() {
|
322 |
+
var state = cx.state, indent = state.indented;
|
323 |
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
324 |
+
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
325 |
+
indent = outer.indented;
|
326 |
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
327 |
+
};
|
328 |
+
result.lex = true;
|
329 |
+
return result;
|
330 |
+
}
|
331 |
+
function poplex() {
|
332 |
+
var state = cx.state;
|
333 |
+
if (state.lexical.prev) {
|
334 |
+
if (state.lexical.type == ")")
|
335 |
+
state.indented = state.lexical.indented;
|
336 |
+
state.lexical = state.lexical.prev;
|
337 |
+
}
|
338 |
+
}
|
339 |
+
poplex.lex = true;
|
340 |
+
|
341 |
+
function expect(wanted) {
|
342 |
+
function exp(type) {
|
343 |
+
if (type == wanted) return cont();
|
344 |
+
else if (wanted == ";") return pass();
|
345 |
+
else return cont(exp);
|
346 |
+
};
|
347 |
+
return exp;
|
348 |
+
}
|
349 |
+
|
350 |
+
function statement(type, value) {
|
351 |
+
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
352 |
+
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
|
353 |
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
354 |
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
355 |
+
if (type == ";") return cont();
|
356 |
+
if (type == "if") {
|
357 |
+
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
358 |
+
cx.state.cc.pop()();
|
359 |
+
return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
|
360 |
+
}
|
361 |
+
if (type == "function") return cont(functiondef);
|
362 |
+
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
363 |
+
if (type == "variable") {
|
364 |
+
if (isTS && value == "type") {
|
365 |
+
cx.marked = "keyword"
|
366 |
+
return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
367 |
+
} else {
|
368 |
+
return cont(pushlex("stat"), maybelabel);
|
369 |
+
}
|
370 |
+
}
|
371 |
+
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"),
|
372 |
+
block, poplex, poplex);
|
373 |
+
if (type == "case") return cont(expression, expect(":"));
|
374 |
+
if (type == "default") return cont(expect(":"));
|
375 |
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
376 |
+
statement, poplex, popcontext);
|
377 |
+
if (type == "class") return cont(pushlex("form"), className, poplex);
|
378 |
+
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
379 |
+
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
380 |
+
if (type == "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
381 |
+
if (type == "async") return cont(statement)
|
382 |
+
if (value == "@") return cont(expression, statement)
|
383 |
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
384 |
+
}
|
385 |
+
function expression(type) {
|
386 |
+
return expressionInner(type, false);
|
387 |
+
}
|
388 |
+
function expressionNoComma(type) {
|
389 |
+
return expressionInner(type, true);
|
390 |
+
}
|
391 |
+
function parenExpr(type) {
|
392 |
+
if (type != "(") return pass()
|
393 |
+
return cont(pushlex(")"), expression, expect(")"), poplex)
|
394 |
+
}
|
395 |
+
function expressionInner(type, noComma) {
|
396 |
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
397 |
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
398 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
399 |
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
400 |
+
}
|
401 |
+
|
402 |
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
403 |
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
404 |
+
if (type == "function") return cont(functiondef, maybeop);
|
405 |
+
if (type == "class") return cont(pushlex("form"), classExpression, poplex);
|
406 |
+
if (type == "keyword c" || type == "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
407 |
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
408 |
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
409 |
+
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
410 |
+
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
411 |
+
if (type == "quasi") return pass(quasi, maybeop);
|
412 |
+
if (type == "new") return cont(maybeTarget(noComma));
|
413 |
+
return cont();
|
414 |
+
}
|
415 |
+
function maybeexpression(type) {
|
416 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
417 |
+
return pass(expression);
|
418 |
+
}
|
419 |
+
function maybeexpressionNoComma(type) {
|
420 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
421 |
+
return pass(expressionNoComma);
|
422 |
+
}
|
423 |
+
|
424 |
+
function maybeoperatorComma(type, value) {
|
425 |
+
if (type == ",") return cont(expression);
|
426 |
+
return maybeoperatorNoComma(type, value, false);
|
427 |
+
}
|
428 |
+
function maybeoperatorNoComma(type, value, noComma) {
|
429 |
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
430 |
+
var expr = noComma == false ? expression : expressionNoComma;
|
431 |
+
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
432 |
+
if (type == "operator") {
|
433 |
+
if (/\+\+|--/.test(value)) return cont(me);
|
434 |
+
if (value == "?") return cont(expression, expect(":"), expr);
|
435 |
+
return cont(expr);
|
436 |
+
}
|
437 |
+
if (type == "quasi") { return pass(quasi, me); }
|
438 |
+
if (type == ";") return;
|
439 |
+
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
440 |
+
if (type == ".") return cont(property, me);
|
441 |
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
442 |
+
}
|
443 |
+
function quasi(type, value) {
|
444 |
+
if (type != "quasi") return pass();
|
445 |
+
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
446 |
+
return cont(expression, continueQuasi);
|
447 |
+
}
|
448 |
+
function continueQuasi(type) {
|
449 |
+
if (type == "}") {
|
450 |
+
cx.marked = "string-2";
|
451 |
+
cx.state.tokenize = tokenQuasi;
|
452 |
+
return cont(quasi);
|
453 |
+
}
|
454 |
+
}
|
455 |
+
function arrowBody(type) {
|
456 |
+
findFatArrow(cx.stream, cx.state);
|
457 |
+
return pass(type == "{" ? statement : expression);
|
458 |
+
}
|
459 |
+
function arrowBodyNoComma(type) {
|
460 |
+
findFatArrow(cx.stream, cx.state);
|
461 |
+
return pass(type == "{" ? statement : expressionNoComma);
|
462 |
+
}
|
463 |
+
function maybeTarget(noComma) {
|
464 |
+
return function(type) {
|
465 |
+
if (type == ".") return cont(noComma ? targetNoComma : target);
|
466 |
+
else return pass(noComma ? expressionNoComma : expression);
|
467 |
+
};
|
468 |
+
}
|
469 |
+
function target(_, value) {
|
470 |
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
|
471 |
+
}
|
472 |
+
function targetNoComma(_, value) {
|
473 |
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
|
474 |
+
}
|
475 |
+
function maybelabel(type) {
|
476 |
+
if (type == ":") return cont(poplex, statement);
|
477 |
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
478 |
+
}
|
479 |
+
function property(type) {
|
480 |
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
481 |
+
}
|
482 |
+
function objprop(type, value) {
|
483 |
+
if (type == "async") {
|
484 |
+
cx.marked = "property";
|
485 |
+
return cont(objprop);
|
486 |
+
} else if (type == "variable" || cx.style == "keyword") {
|
487 |
+
cx.marked = "property";
|
488 |
+
if (value == "get" || value == "set") return cont(getterSetter);
|
489 |
+
return cont(afterprop);
|
490 |
+
} else if (type == "number" || type == "string") {
|
491 |
+
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
492 |
+
return cont(afterprop);
|
493 |
+
} else if (type == "jsonld-keyword") {
|
494 |
+
return cont(afterprop);
|
495 |
+
} else if (type == "modifier") {
|
496 |
+
return cont(objprop)
|
497 |
+
} else if (type == "[") {
|
498 |
+
return cont(expression, expect("]"), afterprop);
|
499 |
+
} else if (type == "spread") {
|
500 |
+
return cont(expression);
|
501 |
+
} else if (type == ":") {
|
502 |
+
return pass(afterprop)
|
503 |
+
}
|
504 |
+
}
|
505 |
+
function getterSetter(type) {
|
506 |
+
if (type != "variable") return pass(afterprop);
|
507 |
+
cx.marked = "property";
|
508 |
+
return cont(functiondef);
|
509 |
+
}
|
510 |
+
function afterprop(type) {
|
511 |
+
if (type == ":") return cont(expressionNoComma);
|
512 |
+
if (type == "(") return pass(functiondef);
|
513 |
+
}
|
514 |
+
function commasep(what, end, sep) {
|
515 |
+
function proceed(type, value) {
|
516 |
+
if (sep ? sep.indexOf(type) > -1 : type == ",") {
|
517 |
+
var lex = cx.state.lexical;
|
518 |
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
519 |
+
return cont(function(type, value) {
|
520 |
+
if (type == end || value == end) return pass()
|
521 |
+
return pass(what)
|
522 |
+
}, proceed);
|
523 |
+
}
|
524 |
+
if (type == end || value == end) return cont();
|
525 |
+
return cont(expect(end));
|
526 |
+
}
|
527 |
+
return function(type, value) {
|
528 |
+
if (type == end || value == end) return cont();
|
529 |
+
return pass(what, proceed);
|
530 |
+
};
|
531 |
+
}
|
532 |
+
function contCommasep(what, end, info) {
|
533 |
+
for (var i = 3; i < arguments.length; i++)
|
534 |
+
cx.cc.push(arguments[i]);
|
535 |
+
return cont(pushlex(end, info), commasep(what, end), poplex);
|
536 |
+
}
|
537 |
+
function block(type) {
|
538 |
+
if (type == "}") return cont();
|
539 |
+
return pass(statement, block);
|
540 |
+
}
|
541 |
+
function maybetype(type, value) {
|
542 |
+
if (isTS) {
|
543 |
+
if (type == ":") return cont(typeexpr);
|
544 |
+
if (value == "?") return cont(maybetype);
|
545 |
+
}
|
546 |
+
}
|
547 |
+
function typeexpr(type) {
|
548 |
+
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
|
549 |
+
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
|
550 |
+
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
|
551 |
+
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
|
552 |
+
}
|
553 |
+
function maybeReturnType(type) {
|
554 |
+
if (type == "=>") return cont(typeexpr)
|
555 |
+
}
|
556 |
+
function typeprop(type, value) {
|
557 |
+
if (type == "variable" || cx.style == "keyword") {
|
558 |
+
cx.marked = "property"
|
559 |
+
return cont(typeprop)
|
560 |
+
} else if (value == "?") {
|
561 |
+
return cont(typeprop)
|
562 |
+
} else if (type == ":") {
|
563 |
+
return cont(typeexpr)
|
564 |
+
} else if (type == "[") {
|
565 |
+
return cont(expression, maybetype, expect("]"), typeprop)
|
566 |
+
}
|
567 |
+
}
|
568 |
+
function typearg(type) {
|
569 |
+
if (type == "variable") return cont(typearg)
|
570 |
+
else if (type == ":") return cont(typeexpr)
|
571 |
+
}
|
572 |
+
function afterType(type, value) {
|
573 |
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
574 |
+
if (value == "|" || type == ".") return cont(typeexpr)
|
575 |
+
if (type == "[") return cont(expect("]"), afterType)
|
576 |
+
if (value == "extends") return cont(typeexpr)
|
577 |
+
}
|
578 |
+
function vardef() {
|
579 |
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
580 |
+
}
|
581 |
+
function pattern(type, value) {
|
582 |
+
if (type == "modifier") return cont(pattern)
|
583 |
+
if (type == "variable") { register(value); return cont(); }
|
584 |
+
if (type == "spread") return cont(pattern);
|
585 |
+
if (type == "[") return contCommasep(pattern, "]");
|
586 |
+
if (type == "{") return contCommasep(proppattern, "}");
|
587 |
+
}
|
588 |
+
function proppattern(type, value) {
|
589 |
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
590 |
+
register(value);
|
591 |
+
return cont(maybeAssign);
|
592 |
+
}
|
593 |
+
if (type == "variable") cx.marked = "property";
|
594 |
+
if (type == "spread") return cont(pattern);
|
595 |
+
if (type == "}") return pass();
|
596 |
+
return cont(expect(":"), pattern, maybeAssign);
|
597 |
+
}
|
598 |
+
function maybeAssign(_type, value) {
|
599 |
+
if (value == "=") return cont(expressionNoComma);
|
600 |
+
}
|
601 |
+
function vardefCont(type) {
|
602 |
+
if (type == ",") return cont(vardef);
|
603 |
+
}
|
604 |
+
function maybeelse(type, value) {
|
605 |
+
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
606 |
+
}
|
607 |
+
function forspec(type) {
|
608 |
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
609 |
+
}
|
610 |
+
function forspec1(type) {
|
611 |
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
612 |
+
if (type == ";") return cont(forspec2);
|
613 |
+
if (type == "variable") return cont(formaybeinof);
|
614 |
+
return pass(expression, expect(";"), forspec2);
|
615 |
+
}
|
616 |
+
function formaybeinof(_type, value) {
|
617 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
618 |
+
return cont(maybeoperatorComma, forspec2);
|
619 |
+
}
|
620 |
+
function forspec2(type, value) {
|
621 |
+
if (type == ";") return cont(forspec3);
|
622 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
623 |
+
return pass(expression, expect(";"), forspec3);
|
624 |
+
}
|
625 |
+
function forspec3(type) {
|
626 |
+
if (type != ")") cont(expression);
|
627 |
+
}
|
628 |
+
function functiondef(type, value) {
|
629 |
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
630 |
+
if (type == "variable") {register(value); return cont(functiondef);}
|
631 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
632 |
+
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef)
|
633 |
+
}
|
634 |
+
function funarg(type) {
|
635 |
+
if (type == "spread") return cont(funarg);
|
636 |
+
return pass(pattern, maybetype, maybeAssign);
|
637 |
+
}
|
638 |
+
function classExpression(type, value) {
|
639 |
+
// Class expressions may have an optional name.
|
640 |
+
if (type == "variable") return className(type, value);
|
641 |
+
return classNameAfter(type, value);
|
642 |
+
}
|
643 |
+
function className(type, value) {
|
644 |
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
645 |
+
}
|
646 |
+
function classNameAfter(type, value) {
|
647 |
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter)
|
648 |
+
if (value == "extends" || value == "implements" || (isTS && type == ","))
|
649 |
+
return cont(isTS ? typeexpr : expression, classNameAfter);
|
650 |
+
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
651 |
+
}
|
652 |
+
function classBody(type, value) {
|
653 |
+
if (type == "variable" || cx.style == "keyword") {
|
654 |
+
if ((value == "async" || value == "static" || value == "get" || value == "set" ||
|
655 |
+
(isTS && (value == "public" || value == "private" || value == "protected" || value == "readonly" || value == "abstract"))) &&
|
656 |
+
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false)) {
|
657 |
+
cx.marked = "keyword";
|
658 |
+
return cont(classBody);
|
659 |
+
}
|
660 |
+
cx.marked = "property";
|
661 |
+
return cont(isTS ? classfield : functiondef, classBody);
|
662 |
+
}
|
663 |
+
if (type == "[")
|
664 |
+
return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody)
|
665 |
+
if (value == "*") {
|
666 |
+
cx.marked = "keyword";
|
667 |
+
return cont(classBody);
|
668 |
+
}
|
669 |
+
if (type == ";") return cont(classBody);
|
670 |
+
if (type == "}") return cont();
|
671 |
+
if (value == "@") return cont(expression, classBody)
|
672 |
+
}
|
673 |
+
function classfield(type, value) {
|
674 |
+
if (value == "?") return cont(classfield)
|
675 |
+
if (type == ":") return cont(typeexpr, maybeAssign)
|
676 |
+
if (value == "=") return cont(expressionNoComma)
|
677 |
+
return pass(functiondef)
|
678 |
+
}
|
679 |
+
function afterExport(type, value) {
|
680 |
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
681 |
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
682 |
+
if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
|
683 |
+
return pass(statement);
|
684 |
+
}
|
685 |
+
function exportField(type, value) {
|
686 |
+
if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
|
687 |
+
if (type == "variable") return pass(expressionNoComma, exportField);
|
688 |
+
}
|
689 |
+
function afterImport(type) {
|
690 |
+
if (type == "string") return cont();
|
691 |
+
return pass(importSpec, maybeMoreImports, maybeFrom);
|
692 |
+
}
|
693 |
+
function importSpec(type, value) {
|
694 |
+
if (type == "{") return contCommasep(importSpec, "}");
|
695 |
+
if (type == "variable") register(value);
|
696 |
+
if (value == "*") cx.marked = "keyword";
|
697 |
+
return cont(maybeAs);
|
698 |
+
}
|
699 |
+
function maybeMoreImports(type) {
|
700 |
+
if (type == ",") return cont(importSpec, maybeMoreImports)
|
701 |
+
}
|
702 |
+
function maybeAs(_type, value) {
|
703 |
+
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
|
704 |
+
}
|
705 |
+
function maybeFrom(_type, value) {
|
706 |
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
707 |
+
}
|
708 |
+
function arrayLiteral(type) {
|
709 |
+
if (type == "]") return cont();
|
710 |
+
return pass(commasep(expressionNoComma, "]"));
|
711 |
+
}
|
712 |
+
|
713 |
+
function isContinuedStatement(state, textAfter) {
|
714 |
+
return state.lastType == "operator" || state.lastType == "," ||
|
715 |
+
isOperatorChar.test(textAfter.charAt(0)) ||
|
716 |
+
/[,.]/.test(textAfter.charAt(0));
|
717 |
+
}
|
718 |
+
|
719 |
+
// Interface
|
720 |
+
|
721 |
+
return {
|
722 |
+
startState: function(basecolumn) {
|
723 |
+
var state = {
|
724 |
+
tokenize: tokenBase,
|
725 |
+
lastType: "sof",
|
726 |
+
cc: [],
|
727 |
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
728 |
+
localVars: parserConfig.localVars,
|
729 |
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
730 |
+
indented: basecolumn || 0
|
731 |
+
};
|
732 |
+
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
733 |
+
state.globalVars = parserConfig.globalVars;
|
734 |
+
return state;
|
735 |
+
},
|
736 |
+
|
737 |
+
token: function(stream, state) {
|
738 |
+
if (stream.sol()) {
|
739 |
+
if (!state.lexical.hasOwnProperty("align"))
|
740 |
+
state.lexical.align = false;
|
741 |
+
state.indented = stream.indentation();
|
742 |
+
findFatArrow(stream, state);
|
743 |
+
}
|
744 |
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
745 |
+
var style = state.tokenize(stream, state);
|
746 |
+
if (type == "comment") return style;
|
747 |
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
748 |
+
return parseJS(state, style, type, content, stream);
|
749 |
+
},
|
750 |
+
|
751 |
+
indent: function(state, textAfter) {
|
752 |
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
753 |
+
if (state.tokenize != tokenBase) return 0;
|
754 |
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
755 |
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
756 |
+
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
757 |
+
var c = state.cc[i];
|
758 |
+
if (c == poplex) lexical = lexical.prev;
|
759 |
+
else if (c != maybeelse) break;
|
760 |
+
}
|
761 |
+
while ((lexical.type == "stat" || lexical.type == "form") &&
|
762 |
+
(firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
|
763 |
+
(top == maybeoperatorComma || top == maybeoperatorNoComma) &&
|
764 |
+
!/^[,\.=+\-*:?[\(]/.test(textAfter))))
|
765 |
+
lexical = lexical.prev;
|
766 |
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
767 |
+
lexical = lexical.prev;
|
768 |
+
var type = lexical.type, closing = firstChar == type;
|
769 |
+
|
770 |
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
771 |
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
772 |
+
else if (type == "form") return lexical.indented + indentUnit;
|
773 |
+
else if (type == "stat")
|
774 |
+
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
775 |
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
776 |
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
777 |
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
778 |
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
779 |
+
},
|
780 |
+
|
781 |
+
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
782 |
+
blockCommentStart: jsonMode ? null : "/*",
|
783 |
+
blockCommentEnd: jsonMode ? null : "*/",
|
784 |
+
lineComment: jsonMode ? null : "//",
|
785 |
+
fold: "brace",
|
786 |
+
closeBrackets: "()[]{}''\"\"``",
|
787 |
+
|
788 |
+
helperType: jsonMode ? "json" : "javascript",
|
789 |
+
jsonldMode: jsonldMode,
|
790 |
+
jsonMode: jsonMode,
|
791 |
+
|
792 |
+
expressionAllowed: expressionAllowed,
|
793 |
+
skipExpression: function(state) {
|
794 |
+
var top = state.cc[state.cc.length - 1]
|
795 |
+
if (top == expression || top == expressionNoComma) state.cc.pop()
|
796 |
+
}
|
797 |
+
};
|
798 |
+
});
|
799 |
+
|
800 |
+
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
801 |
+
|
802 |
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
803 |
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
804 |
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
805 |
+
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
806 |
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
807 |
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
808 |
+
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
809 |
+
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
810 |
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
811 |
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
812 |
+
|
813 |
+
});
|
includes/js/codemirror/xml.js
ADDED
@@ -0,0 +1,394 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3 |
+
|
4 |
+
(function(mod) {
|
5 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
+
mod(require("../../lib/codemirror"));
|
7 |
+
else if (typeof define == "function" && define.amd) // AMD
|
8 |
+
define(["../../lib/codemirror"], mod);
|
9 |
+
else // Plain browser env
|
10 |
+
mod(CodeMirror);
|
11 |
+
})(function(CodeMirror) {
|
12 |
+
"use strict";
|
13 |
+
|
14 |
+
var htmlConfig = {
|
15 |
+
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
16 |
+
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
17 |
+
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
18 |
+
'track': true, 'wbr': true, 'menuitem': true},
|
19 |
+
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
20 |
+
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
21 |
+
'th': true, 'tr': true},
|
22 |
+
contextGrabbers: {
|
23 |
+
'dd': {'dd': true, 'dt': true},
|
24 |
+
'dt': {'dd': true, 'dt': true},
|
25 |
+
'li': {'li': true},
|
26 |
+
'option': {'option': true, 'optgroup': true},
|
27 |
+
'optgroup': {'optgroup': true},
|
28 |
+
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
29 |
+
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
30 |
+
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
31 |
+
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
32 |
+
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
33 |
+
'rp': {'rp': true, 'rt': true},
|
34 |
+
'rt': {'rp': true, 'rt': true},
|
35 |
+
'tbody': {'tbody': true, 'tfoot': true},
|
36 |
+
'td': {'td': true, 'th': true},
|
37 |
+
'tfoot': {'tbody': true},
|
38 |
+
'th': {'td': true, 'th': true},
|
39 |
+
'thead': {'tbody': true, 'tfoot': true},
|
40 |
+
'tr': {'tr': true}
|
41 |
+
},
|
42 |
+
doNotIndent: {"pre": true},
|
43 |
+
allowUnquoted: true,
|
44 |
+
allowMissing: true,
|
45 |
+
caseFold: true
|
46 |
+
}
|
47 |
+
|
48 |
+
var xmlConfig = {
|
49 |
+
autoSelfClosers: {},
|
50 |
+
implicitlyClosed: {},
|
51 |
+
contextGrabbers: {},
|
52 |
+
doNotIndent: {},
|
53 |
+
allowUnquoted: false,
|
54 |
+
allowMissing: false,
|
55 |
+
caseFold: false
|
56 |
+
}
|
57 |
+
|
58 |
+
CodeMirror.defineMode("xml", function(editorConf, config_) {
|
59 |
+
var indentUnit = editorConf.indentUnit
|
60 |
+
var config = {}
|
61 |
+
var defaults = config_.htmlMode ? htmlConfig : xmlConfig
|
62 |
+
for (var prop in defaults) config[prop] = defaults[prop]
|
63 |
+
for (var prop in config_) config[prop] = config_[prop]
|
64 |
+
|
65 |
+
// Return variables for tokenizers
|
66 |
+
var type, setStyle;
|
67 |
+
|
68 |
+
function inText(stream, state) {
|
69 |
+
function chain(parser) {
|
70 |
+
state.tokenize = parser;
|
71 |
+
return parser(stream, state);
|
72 |
+
}
|
73 |
+
|
74 |
+
var ch = stream.next();
|
75 |
+
if (ch == "<") {
|
76 |
+
if (stream.eat("!")) {
|
77 |
+
if (stream.eat("[")) {
|
78 |
+
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
79 |
+
else return null;
|
80 |
+
} else if (stream.match("--")) {
|
81 |
+
return chain(inBlock("comment", "-->"));
|
82 |
+
} else if (stream.match("DOCTYPE", true, true)) {
|
83 |
+
stream.eatWhile(/[\w\._\-]/);
|
84 |
+
return chain(doctype(1));
|
85 |
+
} else {
|
86 |
+
return null;
|
87 |
+
}
|
88 |
+
} else if (stream.eat("?")) {
|
89 |
+
stream.eatWhile(/[\w\._\-]/);
|
90 |
+
state.tokenize = inBlock("meta", "?>");
|
91 |
+
return "meta";
|
92 |
+
} else {
|
93 |
+
type = stream.eat("/") ? "closeTag" : "openTag";
|
94 |
+
state.tokenize = inTag;
|
95 |
+
return "tag bracket";
|
96 |
+
}
|
97 |
+
} else if (ch == "&") {
|
98 |
+
var ok;
|
99 |
+
if (stream.eat("#")) {
|
100 |
+
if (stream.eat("x")) {
|
101 |
+
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
102 |
+
} else {
|
103 |
+
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
104 |
+
}
|
105 |
+
} else {
|
106 |
+
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
107 |
+
}
|
108 |
+
return ok ? "atom" : "error";
|
109 |
+
} else {
|
110 |
+
stream.eatWhile(/[^&<]/);
|
111 |
+
return null;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
inText.isInText = true;
|
115 |
+
|
116 |
+
function inTag(stream, state) {
|
117 |
+
var ch = stream.next();
|
118 |
+
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
119 |
+
state.tokenize = inText;
|
120 |
+
type = ch == ">" ? "endTag" : "selfcloseTag";
|
121 |
+
return "tag bracket";
|
122 |
+
} else if (ch == "=") {
|
123 |
+
type = "equals";
|
124 |
+
return null;
|
125 |
+
} else if (ch == "<") {
|
126 |
+
state.tokenize = inText;
|
127 |
+
state.state = baseState;
|
128 |
+
state.tagName = state.tagStart = null;
|
129 |
+
var next = state.tokenize(stream, state);
|
130 |
+
return next ? next + " tag error" : "tag error";
|
131 |
+
} else if (/[\'\"]/.test(ch)) {
|
132 |
+
state.tokenize = inAttribute(ch);
|
133 |
+
state.stringStartCol = stream.column();
|
134 |
+
return state.tokenize(stream, state);
|
135 |
+
} else {
|
136 |
+
stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
|
137 |
+
return "word";
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
function inAttribute(quote) {
|
142 |
+
var closure = function(stream, state) {
|
143 |
+
while (!stream.eol()) {
|
144 |
+
if (stream.next() == quote) {
|
145 |
+
state.tokenize = inTag;
|
146 |
+
break;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
return "string";
|
150 |
+
};
|
151 |
+
closure.isInAttribute = true;
|
152 |
+
return closure;
|
153 |
+
}
|
154 |
+
|
155 |
+
function inBlock(style, terminator) {
|
156 |
+
return function(stream, state) {
|
157 |
+
while (!stream.eol()) {
|
158 |
+
if (stream.match(terminator)) {
|
159 |
+
state.tokenize = inText;
|
160 |
+
break;
|
161 |
+
}
|
162 |
+
stream.next();
|
163 |
+
}
|
164 |
+
return style;
|
165 |
+
};
|
166 |
+
}
|
167 |
+
function doctype(depth) {
|
168 |
+
return function(stream, state) {
|
169 |
+
var ch;
|
170 |
+
while ((ch = stream.next()) != null) {
|
171 |
+
if (ch == "<") {
|
172 |
+
state.tokenize = doctype(depth + 1);
|
173 |
+
return state.tokenize(stream, state);
|
174 |
+
} else if (ch == ">") {
|
175 |
+
if (depth == 1) {
|
176 |
+
state.tokenize = inText;
|
177 |
+
break;
|
178 |
+
} else {
|
179 |
+
state.tokenize = doctype(depth - 1);
|
180 |
+
return state.tokenize(stream, state);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
184 |
+
return "meta";
|
185 |
+
};
|
186 |
+
}
|
187 |
+
|
188 |
+
function Context(state, tagName, startOfLine) {
|
189 |
+
this.prev = state.context;
|
190 |
+
this.tagName = tagName;
|
191 |
+
this.indent = state.indented;
|
192 |
+
this.startOfLine = startOfLine;
|
193 |
+
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
194 |
+
this.noIndent = true;
|
195 |
+
}
|
196 |
+
function popContext(state) {
|
197 |
+
if (state.context) state.context = state.context.prev;
|
198 |
+
}
|
199 |
+
function maybePopContext(state, nextTagName) {
|
200 |
+
var parentTagName;
|
201 |
+
while (true) {
|
202 |
+
if (!state.context) {
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
parentTagName = state.context.tagName;
|
206 |
+
if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
|
207 |
+
!config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
popContext(state);
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
function baseState(type, stream, state) {
|
215 |
+
if (type == "openTag") {
|
216 |
+
state.tagStart = stream.column();
|
217 |
+
return tagNameState;
|
218 |
+
} else if (type == "closeTag") {
|
219 |
+
return closeTagNameState;
|
220 |
+
} else {
|
221 |
+
return baseState;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
function tagNameState(type, stream, state) {
|
225 |
+
if (type == "word") {
|
226 |
+
state.tagName = stream.current();
|
227 |
+
setStyle = "tag";
|
228 |
+
return attrState;
|
229 |
+
} else {
|
230 |
+
setStyle = "error";
|
231 |
+
return tagNameState;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
function closeTagNameState(type, stream, state) {
|
235 |
+
if (type == "word") {
|
236 |
+
var tagName = stream.current();
|
237 |
+
if (state.context && state.context.tagName != tagName &&
|
238 |
+
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
239 |
+
popContext(state);
|
240 |
+
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
|
241 |
+
setStyle = "tag";
|
242 |
+
return closeState;
|
243 |
+
} else {
|
244 |
+
setStyle = "tag error";
|
245 |
+
return closeStateErr;
|
246 |
+
}
|
247 |
+
} else {
|
248 |
+
setStyle = "error";
|
249 |
+
return closeStateErr;
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
function closeState(type, _stream, state) {
|
254 |
+
if (type != "endTag") {
|
255 |
+
setStyle = "error";
|
256 |
+
return closeState;
|
257 |
+
}
|
258 |
+
popContext(state);
|
259 |
+
return baseState;
|
260 |
+
}
|
261 |
+
function closeStateErr(type, stream, state) {
|
262 |
+
setStyle = "error";
|
263 |
+
return closeState(type, stream, state);
|
264 |
+
}
|
265 |
+
|
266 |
+
function attrState(type, _stream, state) {
|
267 |
+
if (type == "word") {
|
268 |
+
setStyle = "attribute";
|
269 |
+
return attrEqState;
|
270 |
+
} else if (type == "endTag" || type == "selfcloseTag") {
|
271 |
+
var tagName = state.tagName, tagStart = state.tagStart;
|
272 |
+
state.tagName = state.tagStart = null;
|
273 |
+
if (type == "selfcloseTag" ||
|
274 |
+
config.autoSelfClosers.hasOwnProperty(tagName)) {
|
275 |
+
maybePopContext(state, tagName);
|
276 |
+
} else {
|
277 |
+
maybePopContext(state, tagName);
|
278 |
+
state.context = new Context(state, tagName, tagStart == state.indented);
|
279 |
+
}
|
280 |
+
return baseState;
|
281 |
+
}
|
282 |
+
setStyle = "error";
|
283 |
+
return attrState;
|
284 |
+
}
|
285 |
+
function attrEqState(type, stream, state) {
|
286 |
+
if (type == "equals") return attrValueState;
|
287 |
+
if (!config.allowMissing) setStyle = "error";
|
288 |
+
return attrState(type, stream, state);
|
289 |
+
}
|
290 |
+
function attrValueState(type, stream, state) {
|
291 |
+
if (type == "string") return attrContinuedState;
|
292 |
+
if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
|
293 |
+
setStyle = "error";
|
294 |
+
return attrState(type, stream, state);
|
295 |
+
}
|
296 |
+
function attrContinuedState(type, stream, state) {
|
297 |
+
if (type == "string") return attrContinuedState;
|
298 |
+
return attrState(type, stream, state);
|
299 |
+
}
|
300 |
+
|
301 |
+
return {
|
302 |
+
startState: function(baseIndent) {
|
303 |
+
var state = {tokenize: inText,
|
304 |
+
state: baseState,
|
305 |
+
indented: baseIndent || 0,
|
306 |
+
tagName: null, tagStart: null,
|
307 |
+
context: null}
|
308 |
+
if (baseIndent != null) state.baseIndent = baseIndent
|
309 |
+
return state
|
310 |
+
},
|
311 |
+
|
312 |
+
token: function(stream, state) {
|
313 |
+
if (!state.tagName && stream.sol())
|
314 |
+
state.indented = stream.indentation();
|
315 |
+
|
316 |
+
if (stream.eatSpace()) return null;
|
317 |
+
type = null;
|
318 |
+
var style = state.tokenize(stream, state);
|
319 |
+
if ((style || type) && style != "comment") {
|
320 |
+
setStyle = null;
|
321 |
+
state.state = state.state(type || style, stream, state);
|
322 |
+
if (setStyle)
|
323 |
+
style = setStyle == "error" ? style + " error" : setStyle;
|
324 |
+
}
|
325 |
+
return style;
|
326 |
+
},
|
327 |
+
|
328 |
+
indent: function(state, textAfter, fullLine) {
|
329 |
+
var context = state.context;
|
330 |
+
// Indent multi-line strings (e.g. css).
|
331 |
+
if (state.tokenize.isInAttribute) {
|
332 |
+
if (state.tagStart == state.indented)
|
333 |
+
return state.stringStartCol + 1;
|
334 |
+
else
|
335 |
+
return state.indented + indentUnit;
|
336 |
+
}
|
337 |
+
if (context && context.noIndent) return CodeMirror.Pass;
|
338 |
+
if (state.tokenize != inTag && state.tokenize != inText)
|
339 |
+
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
340 |
+
// Indent the starts of attribute names.
|
341 |
+
if (state.tagName) {
|
342 |
+
if (config.multilineTagIndentPastTag !== false)
|
343 |
+
return state.tagStart + state.tagName.length + 2;
|
344 |
+
else
|
345 |
+
return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
|
346 |
+
}
|
347 |
+
if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
348 |
+
var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
|
349 |
+
if (tagAfter && tagAfter[1]) { // Closing tag spotted
|
350 |
+
while (context) {
|
351 |
+
if (context.tagName == tagAfter[2]) {
|
352 |
+
context = context.prev;
|
353 |
+
break;
|
354 |
+
} else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
|
355 |
+
context = context.prev;
|
356 |
+
} else {
|
357 |
+
break;
|
358 |
+
}
|
359 |
+
}
|
360 |
+
} else if (tagAfter) { // Opening tag spotted
|
361 |
+
while (context) {
|
362 |
+
var grabbers = config.contextGrabbers[context.tagName];
|
363 |
+
if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
|
364 |
+
context = context.prev;
|
365 |
+
else
|
366 |
+
break;
|
367 |
+
}
|
368 |
+
}
|
369 |
+
while (context && context.prev && !context.startOfLine)
|
370 |
+
context = context.prev;
|
371 |
+
if (context) return context.indent + indentUnit;
|
372 |
+
else return state.baseIndent || 0;
|
373 |
+
},
|
374 |
+
|
375 |
+
electricInput: /<\/[\s\w:]+>$/,
|
376 |
+
blockCommentStart: "<!--",
|
377 |
+
blockCommentEnd: "-->",
|
378 |
+
|
379 |
+
configuration: config.htmlMode ? "html" : "xml",
|
380 |
+
helperType: config.htmlMode ? "html" : "xml",
|
381 |
+
|
382 |
+
skipAttribute: function(state) {
|
383 |
+
if (state.state == attrValueState)
|
384 |
+
state.state = attrState
|
385 |
+
}
|
386 |
+
};
|
387 |
+
});
|
388 |
+
|
389 |
+
CodeMirror.defineMIME("text/xml", "xml");
|
390 |
+
CodeMirror.defineMIME("application/xml", "xml");
|
391 |
+
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
392 |
+
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
393 |
+
|
394 |
+
});
|
includes/js/jquery-ui/images/ui-icons_444444_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/images/ui-icons_555555_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/images/ui-icons_777620_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/images/ui-icons_777777_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/images/ui-icons_cc0000_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/images/ui-icons_ffffff_256x240.png
ADDED
Binary file
|
includes/js/jquery-ui/jquery-ui.min.css
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.12.1 - 2016-09-14
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Includes: core.css, accordion.css, autocomplete.css, menu.css, button.css, controlgroup.css, checkboxradio.css, datepicker.css, dialog.css, draggable.css, resizable.css, progressbar.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
4 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?bgShadowXPos=&bgOverlayXPos=&bgErrorXPos=&bgHighlightXPos=&bgContentXPos=&bgHeaderXPos=&bgActiveXPos=&bgHoverXPos=&bgDefaultXPos=&bgShadowYPos=&bgOverlayYPos=&bgErrorYPos=&bgHighlightYPos=&bgContentYPos=&bgHeaderYPos=&bgActiveYPos=&bgHoverYPos=&bgDefaultYPos=&bgShadowRepeat=&bgOverlayRepeat=&bgErrorRepeat=&bgHighlightRepeat=&bgContentRepeat=&bgHeaderRepeat=&bgActiveRepeat=&bgHoverRepeat=&bgDefaultRepeat=&iconsHover=url(%22images%2Fui-icons_555555_256x240.png%22)&iconsHighlight=url(%22images%2Fui-icons_777620_256x240.png%22)&iconsHeader=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsError=url(%22images%2Fui-icons_cc0000_256x240.png%22)&iconsDefault=url(%22images%2Fui-icons_777777_256x240.png%22)&iconsContent=url(%22images%2Fui-icons_444444_256x240.png%22)&iconsActive=url(%22images%2Fui-icons_ffffff_256x240.png%22)&bgImgUrlShadow=&bgImgUrlOverlay=&bgImgUrlHover=&bgImgUrlHighlight=&bgImgUrlHeader=&bgImgUrlError=&bgImgUrlDefault=&bgImgUrlContent=&bgImgUrlActive=&opacityFilterShadow=Alpha(Opacity%3D30)&opacityFilterOverlay=Alpha(Opacity%3D30)&opacityShadowPerc=30&opacityOverlayPerc=30&iconColorHover=%23555555&iconColorHighlight=%23777620&iconColorHeader=%23444444&iconColorError=%23cc0000&iconColorDefault=%23777777&iconColorContent=%23444444&iconColorActive=%23ffffff&bgImgOpacityShadow=0&bgImgOpacityOverlay=0&bgImgOpacityError=95&bgImgOpacityHighlight=55&bgImgOpacityContent=75&bgImgOpacityHeader=75&bgImgOpacityActive=65&bgImgOpacityHover=75&bgImgOpacityDefault=75&bgTextureShadow=flat&bgTextureOverlay=flat&bgTextureError=flat&bgTextureHighlight=flat&bgTextureContent=flat&bgTextureHeader=flat&bgTextureActive=flat&bgTextureHover=flat&bgTextureDefault=flat&cornerRadius=3px&fwDefault=normal&ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&cornerRadiusShadow=8px&thicknessShadow=5px&offsetLeftShadow=0px&offsetTopShadow=0px&opacityShadow=.3&bgColorShadow=%23666666&opacityOverlay=.3&bgColorOverlay=%23aaaaaa&fcError=%235f3f3f&borderColorError=%23f1a899&bgColorError=%23fddfdf&fcHighlight=%23777620&borderColorHighlight=%23dad55e&bgColorHighlight=%23fffa90&fcContent=%23333333&borderColorContent=%23dddddd&bgColorContent=%23ffffff&fcHeader=%23333333&borderColorHeader=%23dddddd&bgColorHeader=%23e9e9e9&fcActive=%23ffffff&borderColorActive=%23003eff&bgColorActive=%23007fff&fcHover=%232b2b2b&borderColorHover=%23cccccc&bgColorHover=%23ededed&fcDefault=%23454545&borderColorDefault=%23c5c5c5&bgColorDefault=%23f6f6f6
|
5 |
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
6 |
+
|
7 |
+
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.003;filter:Alpha(Opacity=.3)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
|
includes/js/jquery-ui/jquery-ui.min.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.12.1 - 2016-09-14
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
|
4 |
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
5 |
+
|
6 |
+
(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(m.inline?m.dpDiv.parent()[0]:m.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}function r(t){return function(){var e=this.element.val();t.apply(this,arguments),this._refresh(),e!==this.element.val()&&this._trigger("change")}}t.ui=t.ui||{},t.ui.version="1.12.1";var h=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},h=e.split(".")[0];e=e.split(".")[1];var l=h+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][l.toLowerCase()]=function(e){return!!t.data(e,l)},t[h]=t[h]||{},n=t[h][e],o=t[h][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:h,widgetName:e,widgetFullName:l}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=h++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):h.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=h.test(i[1])?i[1]:"center",t=l.exec(i[0]),e=l.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,h=t(this),l=h.outerWidth(),c=h.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=l+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),I=e(k.my,h.outerWidth(),h.outerHeight());"right"===n.my[0]?D.left-=l:"center"===n.my[0]&&(D.left-=l/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=I[0],D.top+=I[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:l,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+I[0],u[1]+I[1]],my:n.my,at:n.at,within:b,elem:h})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-l,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:h,left:D.left,top:D.top,width:l,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-h,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}});var c="ui-effects-",u="ui-effects-style",d="ui-effects-animated",p=t;t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,o){var a,r=o.re.exec(i),h=r&&o.parse(r),l=o.space||"rgba";return h?(a=s[l](h),s[c[l].cache]=a[c[l].cache],n=s._rgba=a._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,o.transparent),s):o[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var o,a="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("<p>")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,a,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(a),a=e);var u=this,d=t.type(n),p=this._rgba=[];return a!==e&&(n=[n,a,r,h],d="array"),"string"===d?this.parse(s(n)||o._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var o=s.cache;f(s.props,function(t,e){if(!u[o]&&s.to){if("alpha"===t||null==n[t])return;u[o]=s.to(u._rgba)}u[o][e.idx]=i(n[t],e,!0)}),u[o]&&0>t.inArray(null,u[o].slice(0,3))&&(u[o][3]=1,s.from&&(u._rgba=s.from(u[o])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,o){var a,r=i[o.cache];return r&&(a=n[o.cache]||o.to&&o.to(n._rgba)||[],f(o.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===a[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),o=c[n],a=0===this.alpha()?l("transparent"):this,r=a[o.cache]||o.to(a._rgba),h=r.slice();return s=s[o.cache],f(o.props,function(t,n){var o=n.idx,a=r[o],l=s[o],c=u[n.type]||{};null!==l&&(null===a?h[o]=l:(c.mod&&(l-a>c.mod/2?a+=c.mod:a-l>c.mod/2&&(a-=c.mod)),h[o]=i((l-a)*e+a,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,o=t[2]/255,a=t[3],r=Math.max(s,n,o),h=Math.min(s,n,o),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-o)/l+360:n===r?60*(o-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==a?1:a]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],o=t[3],a=.5>=s?s*(1+i):s+i-s*i,r=2*s-a;return[Math.round(255*n(r,a,e+1/3)),Math.round(255*n(r,a,e)),Math.round(255*n(r,a,e-1/3)),o]},f(c,function(s,n){var o=n.props,a=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[a]&&(this[a]=h(this._rgba)),s===e)return this[a].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[a].slice();return f(o,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[a]=d,n):l(d)},f(o,function(e,i){l.fn[e]||(l.fn[e]=function(n){var o,a=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===a?c:("function"===a&&(n=n.call(this,c),a=t.type(n)),null==n&&i.empty?this:("string"===a&&(o=r.exec(n),o&&(n=c+parseFloat(o[2])*("+"===o[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var o,a,r="";if("transparent"!==n&&("string"!==t.type(n)||(o=s(n)))){if(n=l(o||n),!d.rgba&&1!==n._rgba[3]){for(a="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&a&&a.style;)try{r=t.css(a,"backgroundColor"),a=a.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(a),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},o=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(p),function(){function e(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,o={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(o[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(o[i]=n[i]);return o}function i(e,i){var s,o,a={};for(s in i)o=i[s],e[s]!==o&&(n[s]||(t.fx.step[s]||!isNaN(parseFloat(o)))&&(a[s]=o));return a}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(p.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(n,o,a,r){var h=t.speed(o,a,r);return this.queue(function(){var o,a=t(this),r=a.attr("class")||"",l=h.children?a.find("*").addBack():a;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),o=function(){t.each(s,function(t,e){n[e]&&a[e+"Class"](n[e])})},o(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=i(this.start,this.end),this}),a.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){o(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(a[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,o){return s?t.effects.animateClass.call(this,{add:i},s,n,o):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,o){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,o):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,n,o,a){return"boolean"==typeof s||void 0===s?n?t.effects.animateClass.call(this,s?{add:i}:{remove:i},n,o,a):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,n,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,o){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,o)}})}(),function(){function e(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function i(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}function s(t,e){var i=e.outerWidth(),s=e.outerHeight(),n=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,o=n.exec(t)||["",0,i,s,0];return{top:parseFloat(o[1])||0,right:"auto"===o[2]?i:parseFloat(o[2]),bottom:"auto"===o[3]?s:parseFloat(o[3]),left:parseFloat(o[4])||0}}t.expr&&t.expr.filters&&t.expr.filters.animated&&(t.expr.filters.animated=function(e){return function(i){return!!t(i).data(d)||e(i)}}(t.expr.filters.animated)),t.uiBackCompat!==!1&&t.extend(t.effects,{save:function(t,e){for(var i=0,s=e.length;s>i;i++)null!==e[i]&&t.data(c+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;n>s;s++)null!==e[s]&&(i=t.data(c+e[s]),t.css(e[s],i))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},o=document.activeElement;try{o.id}catch(a){o=document.body}return e.wrap(s),(e[0]===o||t.contains(e[0],o))&&t(o).trigger("focus"),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).trigger("focus")),e}}),t.extend(t.effects,{version:"1.12.1",define:function(e,i,s){return s||(s=i,i="effect"),t.effects.effect[e]=s,t.effects.effect[e].mode=i,s},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,n="vertical"!==i?(e||100)/100:1;return{height:t.height()*n,width:t.width()*s,outerHeight:t.outerHeight()*n,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();e>1&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(u,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(u)||"",t.removeData(u)},mode:function(t,e){var i=t.is(":hidden");return"toggle"===e&&(e=i?"show":"hide"),(i?"hide"===e:"show"===e)&&(e="none"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(e){var i,s=e.css("position"),n=e.position();return e.css({marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()),/^(static|relative)/.test(s)&&(s="absolute",i=t("<"+e[0].nodeName+">").insertAfter(e).css({display:/^(inline|ruby)/.test(e.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:e.css("marginTop"),marginBottom:e.css("marginBottom"),marginLeft:e.css("marginLeft"),marginRight:e.css("marginRight"),"float":e.css("float")}).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).addClass("ui-effects-placeholder"),e.data(c+"placeholder",i)),e.css({position:s,left:n.left,top:n.top}),i},removePlaceholder:function(t){var e=c+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(e){t.effects.restoreStyle(e),t.effects.removePlaceholder(e)},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var o=e.cssUnit(i);o[0]>0&&(n[i]=o[0]*s+o[1])}),n}}),t.fn.extend({effect:function(){function i(e){function i(){r.removeData(d),t.effects.cleanUp(r),"hide"===s.mode&&r.hide(),a()}function a(){t.isFunction(h)&&h.call(r[0]),t.isFunction(e)&&e()}var r=t(this);s.mode=c.shift(),t.uiBackCompat===!1||o?"none"===s.mode?(r[l](),a()):n.call(r[0],s,i):(r.is(":hidden")?"hide"===l:"show"===l)?(r[l](),a()):n.call(r[0],s,a)}var s=e.apply(this,arguments),n=t.effects.effect[s.effect],o=n.mode,a=s.queue,r=a||"fx",h=s.complete,l=s.mode,c=[],u=function(e){var i=t(this),s=t.effects.mode(i,l)||o;i.data(d,!0),c.push(s),o&&("show"===s||s===o&&"hide"===s)&&i.show(),o&&"none"===s||t.effects.saveStyle(i),t.isFunction(e)&&e()};return t.fx.off||!n?l?this[l](s.duration,h):this.each(function(){h&&h.call(this)}):a===!1?this.each(u).each(i):this.queue(r,u).queue(r,i)},show:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="show",this.effect.call(this,n)
|
7 |
+
}}(t.fn.show),hide:function(t){return function(s){if(i(s))return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(t.fn.hide),toggle:function(t){return function(s){if(i(s)||"boolean"==typeof s)return t.apply(this,arguments);var n=e.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):s(this.css("clip"),this)},transfer:function(e,i){var s=t(this),n=t(e.to),o="fixed"===n.css("position"),a=t("body"),r=o?a.scrollTop():0,h=o?a.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("<div class='ui-effects-transfer'></div>").appendTo("body").addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:o?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),t.isFunction(i)&&i()})}}),t.fx.step.clip=function(e){e.clipInit||(e.start=t(e.elem).cssClip(),"string"==typeof e.end&&(e.end=s(e.end,e.elem)),e.clipInit=!0),t(e.elem).cssClip({top:e.pos*(e.end.top-e.start.top)+e.start.top,right:e.pos*(e.end.right-e.start.right)+e.start.right,bottom:e.pos*(e.end.bottom-e.start.bottom)+e.start.bottom,left:e.pos*(e.end.left-e.start.left)+e.start.left})}}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}();var f=t.effects;t.effects.define("blind","hide",function(e,i){var s={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},n=t(this),o=e.direction||"up",a=n.cssClip(),r={clip:t.extend({},a)},h=t.effects.createPlaceholder(n);r.clip[s[o][0]]=r.clip[s[o][1]],"show"===e.mode&&(n.cssClip(r.clip),h&&h.css(t.effects.clipToBox(r)),r.clip=a),h&&h.animate(t.effects.clipToBox(r),e.duration,e.easing),n.animate(r,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("bounce",function(e,i){var s,n,o,a=t(this),r=e.mode,h="hide"===r,l="show"===r,c=e.direction||"up",u=e.distance,d=e.times||5,p=2*d+(l||h?1:0),f=e.duration/p,g=e.easing,m="up"===c||"down"===c?"top":"left",_="up"===c||"left"===c,v=0,b=a.queue().length;for(t.effects.createPlaceholder(a),o=a.css(m),u||(u=a["top"===m?"outerHeight":"outerWidth"]()/3),l&&(n={opacity:1},n[m]=o,a.css("opacity",0).css(m,_?2*-u:2*u).animate(n,f,g)),h&&(u/=Math.pow(2,d-1)),n={},n[m]=o;d>v;v++)s={},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g).animate(n,f,g),u=h?2*u:u/2;h&&(s={opacity:0},s[m]=(_?"-=":"+=")+u,a.animate(s,f,g)),a.queue(i),t.effects.unshift(a,b,p+1)}),t.effects.define("clip","hide",function(e,i){var s,n={},o=t(this),a=e.direction||"vertical",r="both"===a,h=r||"horizontal"===a,l=r||"vertical"===a;s=o.cssClip(),n.clip={top:l?(s.bottom-s.top)/2:s.top,right:h?(s.right-s.left)/2:s.right,bottom:l?(s.bottom-s.top)/2:s.bottom,left:h?(s.right-s.left)/2:s.left},t.effects.createPlaceholder(o),"show"===e.mode&&(o.cssClip(n.clip),n.clip=s),o.animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("drop","hide",function(e,i){var s,n=t(this),o=e.mode,a="show"===o,r=e.direction||"left",h="up"===r||"down"===r?"top":"left",l="up"===r||"left"===r?"-=":"+=",c="+="===l?"-=":"+=",u={opacity:0};t.effects.createPlaceholder(n),s=e.distance||n["top"===h?"outerHeight":"outerWidth"](!0)/2,u[h]=l+s,a&&(n.css(u),u[h]=c+s,u.opacity=1),n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("explode","hide",function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),i()}var o,a,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=e.mode,g="show"===f,m=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/u),b=[];for(o=0;u>o;o++)for(h=m.top+o*v,c=o-(u-1)/2,a=0;d>a;a++)r=m.left+a*_,l=a-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-a*_,top:-o*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(g?l*_:0),top:h+(g?c*v:0),opacity:g?0:1}).animate({left:r+(g?0:l*_),top:h+(g?0:c*v),opacity:g?1:0},e.duration||500,e.easing,s)}),t.effects.define("fade","toggle",function(e,i){var s="show"===e.mode;t(this).css("opacity",s?0:1).animate({opacity:s?1:0},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("fold","hide",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=e.size||15,h=/([0-9]+)%/.exec(r),l=!!e.horizFirst,c=l?["right","bottom"]:["bottom","right"],u=e.duration/2,d=t.effects.createPlaceholder(s),p=s.cssClip(),f={clip:t.extend({},p)},g={clip:t.extend({},p)},m=[p[c[0]],p[c[1]]],_=s.queue().length;h&&(r=parseInt(h[1],10)/100*m[a?0:1]),f.clip[c[0]]=r,g.clip[c[0]]=r,g.clip[c[1]]=0,o&&(s.cssClip(g.clip),d&&d.css(t.effects.clipToBox(g)),g.clip=p),s.queue(function(i){d&&d.animate(t.effects.clipToBox(f),u,e.easing).animate(t.effects.clipToBox(g),u,e.easing),i()}).animate(f,u,e.easing).animate(g,u,e.easing).queue(i),t.effects.unshift(s,_,4)}),t.effects.define("highlight","show",function(e,i){var s=t(this),n={backgroundColor:s.css("backgroundColor")};"hide"===e.mode&&(n.opacity=0),t.effects.saveStyle(s),s.css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(n,{queue:!1,duration:e.duration,easing:e.easing,complete:i})}),t.effects.define("size",function(e,i){var s,n,o,a=t(this),r=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],l=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],c=e.mode,u="effect"!==c,d=e.scale||"both",p=e.origin||["middle","center"],f=a.css("position"),g=a.position(),m=t.effects.scaledDimensions(a),_=e.from||m,v=e.to||t.effects.scaledDimensions(a,0);t.effects.createPlaceholder(a),"show"===c&&(o=_,_=v,v=o),n={from:{y:_.height/m.height,x:_.width/m.width},to:{y:v.height/m.height,x:v.width/m.width}},("box"===d||"both"===d)&&(n.from.y!==n.to.y&&(_=t.effects.setTransition(a,h,n.from.y,_),v=t.effects.setTransition(a,h,n.to.y,v)),n.from.x!==n.to.x&&(_=t.effects.setTransition(a,l,n.from.x,_),v=t.effects.setTransition(a,l,n.to.x,v))),("content"===d||"both"===d)&&n.from.y!==n.to.y&&(_=t.effects.setTransition(a,r,n.from.y,_),v=t.effects.setTransition(a,r,n.to.y,v)),p&&(s=t.effects.getBaseline(p,m),_.top=(m.outerHeight-_.outerHeight)*s.y+g.top,_.left=(m.outerWidth-_.outerWidth)*s.x+g.left,v.top=(m.outerHeight-v.outerHeight)*s.y+g.top,v.left=(m.outerWidth-v.outerWidth)*s.x+g.left),a.css(_),("content"===d||"both"===d)&&(h=h.concat(["marginTop","marginBottom"]).concat(r),l=l.concat(["marginLeft","marginRight"]),a.find("*[width]").each(function(){var i=t(this),s=t.effects.scaledDimensions(i),o={height:s.height*n.from.y,width:s.width*n.from.x,outerHeight:s.outerHeight*n.from.y,outerWidth:s.outerWidth*n.from.x},a={height:s.height*n.to.y,width:s.width*n.to.x,outerHeight:s.height*n.to.y,outerWidth:s.width*n.to.x};n.from.y!==n.to.y&&(o=t.effects.setTransition(i,h,n.from.y,o),a=t.effects.setTransition(i,h,n.to.y,a)),n.from.x!==n.to.x&&(o=t.effects.setTransition(i,l,n.from.x,o),a=t.effects.setTransition(i,l,n.to.x,a)),u&&t.effects.saveStyle(i),i.css(o),i.animate(a,e.duration,e.easing,function(){u&&t.effects.restoreStyle(i)})})),a.animate(v,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){var e=a.offset();0===v.opacity&&a.css("opacity",_.opacity),u||(a.css("position","static"===f?"relative":f).offset(e),t.effects.saveStyle(a)),i()}})}),t.effects.define("scale",function(e,i){var s=t(this),n=e.mode,o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"effect"!==n?0:100),a=t.extend(!0,{from:t.effects.scaledDimensions(s),to:t.effects.scaledDimensions(s,o,e.direction||"both"),origin:e.origin||["middle","center"]},e);e.fade&&(a.from.opacity=1,a.to.opacity=0),t.effects.effect.size.call(this,a,i)}),t.effects.define("puff","hide",function(e,i){var s=t.extend(!0,{},e,{fade:!0,percent:parseInt(e.percent,10)||150});t.effects.effect.scale.call(this,s,i)}),t.effects.define("pulsate","show",function(e,i){var s=t(this),n=e.mode,o="show"===n,a="hide"===n,r=o||a,h=2*(e.times||5)+(r?1:0),l=e.duration/h,c=0,u=1,d=s.queue().length;for((o||!s.is(":visible"))&&(s.css("opacity",0).show(),c=1);h>u;u++)s.animate({opacity:c},l,e.easing),c=1-c;s.animate({opacity:c},l,e.easing),s.queue(i),t.effects.unshift(s,d,h+1)}),t.effects.define("shake",function(e,i){var s=1,n=t(this),o=e.direction||"left",a=e.distance||20,r=e.times||3,h=2*r+1,l=Math.round(e.duration/h),c="up"===o||"down"===o?"top":"left",u="up"===o||"left"===o,d={},p={},f={},g=n.queue().length;for(t.effects.createPlaceholder(n),d[c]=(u?"-=":"+=")+a,p[c]=(u?"+=":"-=")+2*a,f[c]=(u?"-=":"+=")+2*a,n.animate(d,l,e.easing);r>s;s++)n.animate(p,l,e.easing).animate(f,l,e.easing);n.animate(p,l,e.easing).animate(d,l/2,e.easing).queue(i),t.effects.unshift(n,g,h+1)}),t.effects.define("slide","show",function(e,i){var s,n,o=t(this),a={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},r=e.mode,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u=e.distance||o["top"===l?"outerHeight":"outerWidth"](!0),d={};t.effects.createPlaceholder(o),s=o.cssClip(),n=o.position()[l],d[l]=(c?-1:1)*u+n,d.clip=o.cssClip(),d.clip[a[h][1]]=d.clip[a[h][0]],"show"===r&&(o.cssClip(d.clip),o.css(l,d[l]),d.clip=s,d[l]=n),o.animate(d,{queue:!1,duration:e.duration,easing:e.easing,complete:i})});var f;t.uiBackCompat!==!1&&(f=t.effects.define("transfer",function(e,i){t(this).transfer(e,i)})),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,.\/:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t("<span>"),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],h=r&&n.collapsible,l=h?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:h?t():a,newPanel:l};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=h?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,h=t.css("box-sizing"),l=t.length&&(!e.length||t.index()<e.index()),c=this.options.animate||{},u=l&&c.down||c,d=function(){a._toggleComplete(i)};return"number"==typeof u&&(o=u),"string"==typeof u&&(n=u),n=n||u.easing||c.easing,o=o||u.duration||c.duration,e.length?t.length?(s=t.show().outerHeight(),e.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),t.hide().animate(this.showProps,{duration:o,easing:n,complete:d,step:function(t,i){i.now=Math.round(t),"height"!==i.prop?"content-box"===h&&(r+=i.now):"content"!==a.options.heightStyle&&(i.now=Math.round(s-e.outerHeight()-r),r=0)}}),void 0):e.animate(this.hideProps,o,n,d):t.animate(this.showProps,o,n,d)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,h=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=h.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=h.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;
|
8 |
+
this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete;var g=/ui-corner-([a-z]){2,6}/g;t.widget("ui.controlgroup",{version:"1.12.1",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var e=this,i=[];t.each(this.options.items,function(s,n){var o,a={};return n?"controlgroupLabel"===s?(o=e.element.find(n),o.each(function(){var e=t(this);e.children(".ui-controlgroup-label-contents").length||e.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),e._addClass(o,null,"ui-widget ui-widget-content ui-state-default"),i=i.concat(o.get()),void 0):(t.fn[s]&&(a=e["_"+s+"Options"]?e["_"+s+"Options"]("middle"):{classes:{}},e.element.find(n).each(function(){var n=t(this),o=n[s]("instance"),r=t.widget.extend({},a);if("button"!==s||!n.parent(".ui-spinner").length){o||(o=n[s]()[s]("instance")),o&&(r.classes=e._resolveClassesValues(r.classes,o)),n[s](r);var h=n[s]("widget");t.data(h[0],"ui-controlgroup-data",o?o:n[s]("instance")),i.push(h[0])}})),void 0):void 0}),this.childWidgets=t(t.unique(i)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var i=t(this),s=i.data("ui-controlgroup-data");s&&s[e]&&s[e]()})},_updateCornerClass:function(t,e){var i="ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all",s=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,i),this._addClass(t,null,s)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){var e=this._buildSimpleOptions(t,"ui-spinner");return e.classes["ui-spinner-up"]="",e.classes["ui-spinner-down"]="",e},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e?"auto":!1,classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(e,i){var s={};return t.each(e,function(n){var o=i.options.classes[n]||"";o=t.trim(o.replace(g,"")),s[n]=(o+" "+e[n]).replace(/\s+/g," ")}),s},_setOption:function(t,e){return"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"===t?(this._callChildMethod(e?"disable":"enable"),void 0):(this.refresh(),void 0)},refresh:function(){var e,i=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),e=this.childWidgets,this.options.onlyVisible&&(e=e.filter(":visible")),e.length&&(t.each(["first","last"],function(t,s){var n=e[s]().data("ui-controlgroup-data");if(n&&i["_"+n.widgetName+"Options"]){var o=i["_"+n.widgetName+"Options"](1===e.length?"only":s);o.classes=i._resolveClassesValues(o.classes,n),n.element[n.widgetName](o)}else i._updateCornerClass(e[s](),s)}),this._callChildMethod("refresh"))}}),t.widget("ui.checkboxradio",[t.ui.formResetMixin,{version:"1.12.1",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var e,i,s=this,n=this._super()||{};return this._readType(),i=this.element.labels(),this.label=t(i[i.length-1]),this.label.length||t.error("No label found for checkboxradio widget"),this.originalLabel="",this.label.contents().not(this.element[0]).each(function(){s.originalLabel+=3===this.nodeType?t(this).text():this.outerHTML}),this.originalLabel&&(n.label=this.originalLabel),e=this.element[0].disabled,null!=e&&(n.disabled=e),n},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&(this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this.icon&&this._addClass(this.icon,null,"ui-state-hover")),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var e=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===e&&/radio|checkbox/.test(this.type)||t.error("Can't create checkboxradio on element.nodeName="+e+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var e,i=this.element[0].name,s="input[name='"+t.ui.escapeSelector(i)+"']";return i?(e=this.form.length?t(this.form[0].elements).filter(s):t(s).filter(function(){return 0===t(this).form().length}),e.not(this.element)):t([])},_toggleClasses:function(){var e=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",e),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",e)._toggleClass(this.icon,null,"ui-icon-blank",!e),"radio"===this.type&&this._getRadioGroup().each(function(){var e=t(this).checkboxradio("instance");e&&e._removeClass(e.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){return"label"!==t||e?(this._super(t,e),"disabled"===t?(this._toggleClass(this.label,null,"ui-state-disabled",e),this.element[0].disabled=e,void 0):(this.refresh(),void 0)):void 0},_updateIcon:function(e){var i="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=t("<span>"),this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(i+=e?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,e?"ui-icon-blank":"ui-icon-check")):i+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",i),e||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),this.iconSpace&&(t=t.not(this.iconSpace[0])),t.remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]),t.ui.checkboxradio,t.widget("ui.button",{version:"1.12.1",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),t=this.element[0].disabled,null!=t&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(e){e.keyCode===t.ui.keyCode.SPACE&&(e.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(e,i){var s="iconPosition"!==e,n=s?this.options.iconPosition:i,o="top"===n||"bottom"===n;this.icon?s&&this._removeClass(this.icon,null,this.options.icon):(this.icon=t("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),s&&this._addClass(this.icon,null,i),this._attachIcon(n),o?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=t("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(n))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=void 0===t.showLabel?this.options.showLabel:t.showLabel,i=void 0===t.icon?this.options.icon:t.icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),this.element[0].disabled=e,e&&this.element.blur())},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),t.uiBackCompat!==!1&&(t.widget("ui.button",t.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){return"text"===t?(this._super("showLabel",e),void 0):("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments),void 0)}}),t.fn.button=function(e){return function(){return!this.length||this.length&&"INPUT"!==this[0].tagName||this.length&&"INPUT"===this[0].tagName&&"checkbox"!==this.attr("type")&&"radio"!==this.attr("type")?e.apply(this,arguments):(t.ui.checkboxradio||t.error("Checkboxradio widget missing"),0===arguments.length?this.checkboxradio({icon:!1}):this.checkboxradio.apply(this,arguments))}}(t.fn.button),t.fn.buttonset=function(){return t.ui.controlgroup||t.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))}),t.ui.button,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var m;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,h,l,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+c,l/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),m===n&&(m=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,h,l=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):l?"all"===i?t.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),a(l.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,r)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),l),this._autoSize(l),this._setDate(l,o),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,h,l,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),h={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),h=t.datepicker._checkOffset(s,h,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),s.inline||(l=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?s.dpDiv.show(l,t.datepicker._get(s,"showOptions"),c):s.dpDiv[l||"show"](l?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))
|
9 |
+
}},_updateDatepicker:function(e){this.maxRows=4,m=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+o>l&&l>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(h).match(o);if(!a)throw"Missing number at position "+h;return h+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],h+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+h},x=function(){if(i.charAt(h)!==e.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>h&&(a=i.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=h("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":a+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(l[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}l=h.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,h,l,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,I,T,P,M,S,H,z,O,A,N,W,E,F,L,R=new Date,B=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),$=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),Q=this._getMinMaxDate(t,"min"),J=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),J)for(e=this._daylightSavingAdjust(new Date(J.getFullYear(),J.getMonth()-U[0]*U[1]+1,J.getDate())),e=Q&&Q>e?Q:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-$,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+$,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:B,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,h=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",l=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(Y?"":h)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),I=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",I=" ui-corner-"+(Y?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",I=" ui-corner-"+(Y?"left":"right");break;default:T+=" ui-datepicker-group-middle",I=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+I+"'>"+(/all|left/.test(I)&&0===k?Y?o:s:"")+(/all|right/.test(I)&&0===k?Y?s:o:"")+this._generateMonthYearHeader(t,Z,te,Q,J,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",P=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)M=(w+c)%7,P+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[M]+"'>"+p[M]+"</span></th>";for(T+=P+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),H=(this._getFirstDayOfMonth(te,Z)-c+7)%7,z=Math.ceil((H+S)/7),O=X?this.maxRows>z?this.maxRows:z:z,this.maxRows=O,A=this._daylightSavingAdjust(new Date(te,Z,1-H)),N=0;O>N;N++){for(T+="<tr>",W=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(A)+"</td>":"",w=0;7>w;w++)E=m?m.apply(t.input?t.input[0]:null,[A]):[!0,""],F=A.getMonth()!==Z,L=F&&!v||!E[0]||Q&&Q>A||J&&A>J,W+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(A.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===A.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+E[1]+(A.getTime()===G.getTime()?" "+this._currentClass:"")+(A.getTime()===B.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!E[2]?"":" title='"+E[2].replace(/'/g,"'")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+A.getMonth()+"' data-year='"+A.getFullYear()+"'")+">"+(F&&!_?" ":L?"<span class='ui-state-default'>"+A.getDate()+"</span>":"<a class='ui-state-default"+(A.getTime()===B.getTime()?" ui-state-highlight":"")+(A.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+A.getDate()+"</a>")+"</td>",A.setDate(A.getDate()+1),A=this._daylightSavingAdjust(A);T+=W+"</tr>"}Z++,Z>11&&(Z=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=T}y+=x}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var h,l,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!h||c>=s.getMonth())&&(!l||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":" ")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker,t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var _=!1;t(document).on("mouseup",function(){_=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!_){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),_=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,_=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}
|
10 |
+
},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),h=t.pageX,l=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,h=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(h=this.originalPageX),"x"===a.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,h,l,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)h=s.snapElements[d].left-s.margins.left,l=h+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,h-g>_||m>l+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(h-_),r=g>=Math.abs(l-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(h-m),r=g>=Math.abs(l-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("<div>"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),g&&(p-=l),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.dialog",{version:"1.12.1",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(e){var i=t(this).css(e).offset().top;0>i&&t(this).css("top",e.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&t.fn.draggable&&this._makeDraggable(),this.options.resizable&&t.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var e=this.options.appendTo;return e&&(e.jquery||e.nodeType)?t(e):this.document.find(e||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),t=e.parent.children().eq(e.index),t.length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog
|
11 |
+
},disable:t.noop,enable:t.noop,close:function(e){var i=this;this._isOpen&&this._trigger("beforeClose",e)!==!1&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||t.ui.safeBlur(t.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){i._trigger("close",e)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(e,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+t(this).css("z-index")}).get(),o=Math.max.apply(null,n);return o>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",o+1),s=!0),s&&!i&&this._trigger("focus",e),s},open:function(){var e=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=t(t.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){e._focusTabbable(),e._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var t=this._focusedElement;t||(t=this.element.find("[autofocus]")),t.length||(t=this.element.find(":tabbable")),t.length||(t=this.uiDialogButtonPane.find(":tabbable")),t.length||(t=this.uiDialogTitlebarClose.filter(":tabbable")),t.length||(t=this.uiDialog),t.eq(0).trigger("focus")},_keepFocus:function(e){function i(){var e=t.ui.safeActiveElement(this.document[0]),i=this.uiDialog[0]===e||t.contains(this.uiDialog[0],e);i||this._focusTabbable()}e.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=t("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(e){if(this.options.closeOnEscape&&!e.isDefaultPrevented()&&e.keyCode&&e.keyCode===t.ui.keyCode.ESCAPE)return e.preventDefault(),this.close(e),void 0;if(e.keyCode===t.ui.keyCode.TAB&&!e.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");e.target!==n[0]&&e.target!==this.uiDialog[0]||e.shiftKey?e.target!==s[0]&&e.target!==this.uiDialog[0]||!e.shiftKey||(this._delay(function(){n.trigger("focus")}),e.preventDefault()):(this._delay(function(){s.trigger("focus")}),e.preventDefault())}},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var e;this.uiDialogTitlebar=t("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(e){t(e.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=t("<button type='button'></button>").button({label:t("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),e=t("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(e,"ui-dialog-title"),this._title(e),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":e.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=t("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=t("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var e=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),t.isEmptyObject(i)||t.isArray(i)&&!i.length?(this._removeClass(this.uiDialog,"ui-dialog-buttons"),void 0):(t.each(i,function(i,s){var n,o;s=t.isFunction(s)?{click:s,text:i}:s,s=t.extend({type:"button"},s),n=s.click,o={icon:s.icon,iconPosition:s.iconPosition,showLabel:s.showLabel,icons:s.icons,text:s.text},delete s.click,delete s.icon,delete s.iconPosition,delete s.showLabel,delete s.icons,"boolean"==typeof s.text&&delete s.text,t("<button></button>",s).button(o).appendTo(e.uiButtonSet).on("click",function(){n.apply(e.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function e(t){return{position:t.position,offset:t.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){i._addClass(t(this),"ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,e(n))},drag:function(t,s){i._trigger("drag",t,e(s))},stop:function(n,o){var a=o.offset.left-i.document.scrollLeft(),r=o.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(a>=0?"+":"")+a+" "+"top"+(r>=0?"+":"")+r,of:i.window},i._removeClass(t(this),"ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,e(o))}})},_makeResizable:function(){function e(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}var i=this,s=this.options,n=s.resizable,o=this.uiDialog.css("position"),a="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:a,start:function(s,n){i._addClass(t(this),"ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,e(n))},resize:function(t,s){i._trigger("resize",t,e(s))},stop:function(n,o){var a=i.uiDialog.offset(),r=a.left-i.document.scrollLeft(),h=a.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},i._removeClass(t(this),"ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,e(o))}}).css("position",o)},_trackFocus:function(){this._on(this.widget(),{focusin:function(e){this._makeFocusTarget(),this._focusedElement=t(e.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var e=this._trackingInstances(),i=t.inArray(this,e);-1!==i&&e.splice(i,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||(t=[],this.document.data("ui-dialog-instances",t)),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(e){var i=this,s=!1,n={};t.each(e,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,i){var s,n,o=this.uiDialog;"disabled"!==e&&(this._super(e,i),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:t("<a>").text(""+this.options.closeText).html()}),"draggable"===e&&(s=o.is(":data(ui-draggable)"),s&&!i&&o.draggable("destroy"),!s&&i&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(n=o.is(":data(ui-resizable)"),n&&!i&&o.resizable("destroy"),n&&"string"==typeof i&&o.resizable("option","handles",i),n||i===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var e=t(this);return t("<div>").css({position:"absolute",width:e.outerWidth(),height:e.outerHeight()}).appendTo(e.parent()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(e){return t(e.target).closest(".ui-dialog").length?!0:!!t(e.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var e=!0;this._delay(function(){e=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(t){e||this._allowInteraction(t)||(t.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=t("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var t=this.document.data("ui-dialog-overlays")-1;t?this.document.data("ui-dialog-overlays",t):(this._off(this.document,"focusin"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null}}}),t.uiBackCompat!==!1&&t.widget("ui.dialog",t.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}}),t.ui.dialog,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&v(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var v=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,h=a+e.helperProportions.height,l=i.offset.left,c=i.offset.top,u=l+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=l&&u>=r&&a>=c&&d>=h;case"intersect":return o+e.helperProportions.width/2>l&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>h-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,l,i.proportions().width);case"touch":return(a>=c&&d>=a||h>=c&&d>=h||c>a&&h>d)&&(o>=l&&u>=o||r>=l&&u>=r||l>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&v(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=v(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.progressbar",{version:"1.12.1",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=t("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){return void 0===t?this.options.value:(this.options.value=this._constrainedValue(t),this._refreshValue(),void 0)},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=t===!1,"number"!=typeof t&&(t=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var e=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||e>this.min).width(i.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,e===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=t("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":e}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),e===this.options.max&&this._trigger("complete")}}),t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,h=e.pageY;return o>r&&(i=r,r=o,o=i),a>h&&(i=h,h=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:h-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),l=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?l=!(c.left>r||o>c.right||c.top>h||a>c.bottom):"fit"===n.tolerance&&(l=c.left>o&&r>c.right&&c.top>a&&h>c.bottom),l?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.selectmenu",[t.ui.formResetMixin,{version:"1.12.1",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=t()},_drawButton:function(){var e,i=this,s=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.focus(),t.preventDefault()}}),this.element.hide(),this.button=t("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),e=t("<span>").appendTo(this.button),this._addClass(e,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(s).appendTo(this.button),this.options.width!==!1&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){i._rendered||i._refreshMenu()})},_drawMenu:function(){var e=this;this.menu=t("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=t("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,i){t.preventDefault(),e._setSelection(),e._select(i.item.data("ui-selectmenu-item"),t)},focus:function(t,i){var s=i.item.data("ui-selectmenu-item");null!=e.focusIndex&&s.index!==e.focusIndex&&(e._trigger("focus",t,{item:s}),e.isOpen||e._select(s,t)),e.focusIndex=s.index,e.button.attr("aria-activedescendant",e.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t,e=this.element.find("option");this.menu.empty(),this._parseOptions(e),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,e.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(t.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(e){var i=t("<span>");return this._setText(i,e.label),this._addClass(i,"ui-selectmenu-text"),i},_renderMenu:function(e,i){var s=this,n="";t.each(i,function(i,o){var a;o.optgroup!==n&&(a=t("<li>",{text:o.optgroup}),s._addClass(a,"ui-selectmenu-optgroup","ui-menu-divider"+(o.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),a.appendTo(e),n=o.optgroup),s._renderItemData(e,o)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(e,i){var s=t("<li>"),n=t("<div>",{title:i.element.attr("title")});return i.disabled&&this._addClass(s,null,"ui-state-disabled"),this._setText(n,i.label),s.append(n).appendTo(e)},_setText:function(t,e){e?t.text(e):t.html(" ")},_move:function(t,e){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),n+=":not(.ui-state-disabled)"),s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](n).eq(-1):i[t+"All"](n).eq(0),s.length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?(t=window.getSelection(),t.removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(e){this.isOpen&&(t(e.target).closest(".ui-selectmenu-menu, #"+t.ui.escapeSelector(this.ids.button)).length||this.close(e))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection(),t.rangeCount&&(this.range=t.getRangeAt(0))):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(e){var i=!0;switch(e.keyCode){case t.ui.keyCode.TAB:case t.ui.keyCode.ESCAPE:this.close(e),i=!1;break;case t.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(e);break;case t.ui.keyCode.UP:e.altKey?this._toggle(e):this._move("prev",e);break;case t.ui.keyCode.DOWN:e.altKey?this._toggle(e):this._move("next",e);break;case t.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(e):this._toggle(e);break;case t.ui.keyCode.LEFT:this._move("prev",e);break;case t.ui.keyCode.RIGHT:this._move("next",e);break;case t.ui.keyCode.HOME:case t.ui.keyCode.PAGE_UP:this._move("first",e);break;case t.ui.keyCode.END:case t.ui.keyCode.PAGE_DOWN:this._move("last",e);break;default:this.menu.trigger(e),i=!1}i&&e.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){var e=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":e,"aria-activedescendant":e}),this.menu.attr("aria-activedescendant",e)},_setOption:function(t,e){if("icons"===t){var i=this.button.find("span.ui-icon");this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)}this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;return t===!1?(this.button.css("width",""),void 0):(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t),void 0)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(e){var i=this,s=[];e.each(function(e,n){s.push(i._parseOption(t(n),e))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),t.widget("ui.slider",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1
|
12 |
+
},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,s=this.options,n=this.element.find(".ui-slider-handle"),o="<span tabindex='0'></span>",a=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),e=n.length;i>e;e++)a.push(o);this.handles=n.add(t(a.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=t("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),("min"===e.range||"max"===e.range)&&this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,n,o,a,r,h,l,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(s-c.values(e));(n>i||n===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(n=i,o=t(this),a=e)}),r=this._start(e,a),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=a,this._addClass(o,null,"ui-state-active"),o.trigger("focus"),h=o.offset(),l=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:e.pageX-h.left-o.width()/2,top:e.pageY-h.top-o.height()/2-(parseInt(o.css("borderTopWidth"),10)||0)-(parseInt(o.css("borderBottomWidth"),10)||0)+(parseInt(o.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,a,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,s,n,o;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/e,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),o=this._valueMin()+s*n,this._trimAlignValue(o)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n,o=this.value(),a=this.values();this._hasMultipleValues()&&(n=this.values(e?0:1),o=this.values(e),2===this.options.values.length&&this.options.range===!0&&(i=0===e?Math.min(n,i):Math.max(n,i)),a[e]=i),i!==o&&(s=this._trigger("slide",t,this._uiHash(e,i,a)),s!==!1&&(this._hasMultipleValues()?this.values(e,i):this.value(i)))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var s,n,o;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this._hasMultipleValues()?this._values(e):this.value();for(s=this.options.values,n=arguments[0],o=0;s.length>o;o+=1)s[o]=this._trimAlignValue(n[o]),this._change(null,o);this._refreshValue()},_setOption:function(e,i){var s,n=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(n=this.options.values.length),this._super(e,i),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(i),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=n-1;s>=0;s--)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,s;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this._hasMultipleValues()){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,s=t-i;return 2*Math.abs(i)>=e&&(s+=i>0?e:-e),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step,s=Math.round((t-e)/i)*i;t=s+e,t>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,s,n,o,a=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,c={};this._hasMultipleValues()?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),c["horizontal"===h.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[l?"animate":"css"](c,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:r.animate}))),e=i}):(s=this.value(),n=this._valueMin(),o=this._valueMax(),i=o!==n?100*((s-n)/(o-n)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](c,r.animate),"min"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===a&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},r.animate),"min"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===a&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},r.animate))},_handleEvents:{keydown:function(e){var i,s,n,o,a=t(e.target).data("ui-slider-handle-index");switch(e.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(e.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(t(e.target),null,"ui-state-active"),i=this._start(e,a),i===!1))return}switch(o=this.options.step,s=n=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case t.ui.keyCode.HOME:n=this._valueMin();break;case t.ui.keyCode.END:n=this._valueMax();break;case t.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-o)}this._slide(e,a,n)},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),this._removeClass(t(e.target),null,"ui-state-active"))}}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("<style>*{ cursor: "+a.cursor+" !important; }</style>").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<a.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+a.scrollSpeed:e.pageY-this.overflowOffset.top<a.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-a.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<a.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+a.scrollSpeed:e.pageX-this.overflowOffset.left<a.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-a.scrollSpeed)):(e.pageY-this.document.scrollTop()<a.scrollSensitivity?r=this.document.scrollTop(this.document.scrollTop()-a.scrollSpeed):this.window.height()-(e.pageY-this.document.scrollTop())<a.scrollSensitivity&&(r=this.document.scrollTop(this.document.scrollTop()+a.scrollSpeed)),e.pageX-this.document.scrollLeft()<a.scrollSensitivity?r=this.document.scrollLeft(this.document.scrollLeft()-a.scrollSpeed):this.window.width()-(e.pageX-this.document.scrollLeft())<a.scrollSensitivity&&(r=this.document.scrollLeft(this.document.scrollLeft()+a.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],h=[],l=this._connectWith();if(l&&e)for(s=l.length-1;s>=0;s--)for(o=t(l[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&h.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(h.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",a),c.push({item:h,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("<tr>",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t("<td> </td>",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,h,l,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[a],l=!1,e[u]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(e[u]-h)&&(n=Math.abs(e[u]-h),o=this.items[s],this.direction=l?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(o=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(a=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;
|
13 |
+
this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.spinner",{version:"1.12.1",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var e=this._super(),i=this.element;return t.each(["min","max","step"],function(t,s){var n=i.attr(s);null!=n&&n.length&&(e[s]=n)}),e},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t),void 0)},mousewheel:function(t,e){if(e){if(!this.spinning&&!this._start(t))return!1;this._spin((e>0?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(e){function i(){var e=this.element[0]===t.ui.safeActiveElement(this.document[0]);e||(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===t.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),e.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(e)!==!1&&this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(e){return t(e.currentTarget).hasClass("ui-state-active")?this._start(e)===!1?!1:(this._repeat(null,t(e.currentTarget).hasClass("ui-spinner-up")?1:-1,e),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&this.uiSpinner.height()>0&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(e){var i=this.options,s=t.ui.keyCode;switch(e.keyCode){case s.UP:return this._repeat(null,1,e),!0;case s.DOWN:return this._repeat(null,-1,e),!0;case s.PAGE_UP:return this._repeat(null,i.page,e),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,e),!0}return!1},_start:function(t){return this.spinning||this._trigger("start",t)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&this._trigger("spin",e,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(e){var i=this.options.incremental;return i?t.isFunction(i)?i(e):Math.floor(e*e*e/5e4-e*e/500+17*e/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return null!==this.options.min&&(t=Math.max(t,this._precisionOf(this.options.min))),t},_precisionOf:function(t){var e=""+t,i=e.indexOf(".");return-1===i?0:e.length-i-1},_adjustValue:function(t){var e,i,s=this.options;return e=null!==s.min?s.min:0,i=t-e,i=Math.round(i/s.step)*s.step,t=e+i,t=parseFloat(t.toFixed(this._precision())),null!==s.max&&t>s.max?s.max:null!==s.min&&s.min>t?s.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i,s,n;return"culture"===t||"numberFormat"===t?(i=this._parse(this.element.val()),this.options[t]=e,this.element.val(this._format(i)),void 0):(("max"===t||"min"===t||"step"===t)&&"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(s=this.buttons.first().find(".ui-icon"),this._removeClass(s,null,this.options.icons.up),this._addClass(s,null,e.up),n=this.buttons.last().find(".ui-icon"),this._removeClass(n,null,this.options.icons.down),this._addClass(n,null,e.down)),this._super(t,e),void 0)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:r(function(t){this._super(t)}),_parse:function(t){return"string"==typeof t&&""!==t&&(t=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t),""===t||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null===t?!1:t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&(i=this._parse(t),null!==i&&(e||(i=this._adjustValue(i)),t=this._format(i))),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:r(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:r(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:r(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:r(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){return arguments.length?(r(this._value).call(this,t),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),t.uiBackCompat!==!1&&t.widget("ui.spinner",t.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}}),t.ui.spinner,t.widget("ui.tabs",{version:"1.12.1",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var t=/#.*$/;return function(e){var i,s;i=e.href.replace(t,""),s=location.href.replace(t,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return e.hash.length>1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),h=t(s).closest("li"),l=h.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=h.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("<div>").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,h=r?t():this._getPanelForTab(o),l=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:l,newTab:r?t():o,newPanel:h};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),l.length||h.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},h=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),h(n,e)},1)}).fail(function(t,e){setTimeout(function(){h(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs,t.widget("ui.tooltip",{version:"1.12.1",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var e=t(this).attr("title")||"";return t("<a>").text(e).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(e,i){var s=(e.attr("aria-describedby")||"").split(/\s+/);s.push(i),e.data("ui-tooltip-id",i).attr("aria-describedby",t.trim(s.join(" ")))},_removeDescribedBy:function(e){var i=e.data("ui-tooltip-id"),s=(e.attr("aria-describedby")||"").split(/\s+/),n=t.inArray(i,s);-1!==n&&s.splice(n,1),e.removeData("ui-tooltip-id"),s=t.trim(s.join(" ")),s?e.attr("aria-describedby",s):e.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=t("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=t([])},_setOption:function(e,i){var s=this;this._super(e,i),"content"===e&&t.each(this.tooltips,function(t,e){s._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s.element[0],e.close(n,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var e=t(this);return e.is("[title]")?e.data("ui-tooltip-title",e.attr("title")).removeAttr("title"):void 0}))},_enable:function(){this.disabledTitles.each(function(){var e=t(this);e.data("ui-tooltip-title")&&e.attr("title",e.data("ui-tooltip-title"))}),this.disabledTitles=t([])},open:function(e){var i=this,s=t(e?e.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),e&&"mouseover"===e.type&&s.parents().each(function(){var e,s=t(this);s.data("ui-tooltip-open")&&(e=t.Event("blur"),e.target=e.currentTarget=this,i.close(e,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._registerCloseHandlers(e,s),this._updateContent(s,e))},_updateContent:function(t,e){var i,s=this.options.content,n=this,o=e?e.type:null;return"string"==typeof s||s.nodeType||s.jquery?this._open(e,t,s):(i=s.call(t[0],function(i){n._delay(function(){t.data("ui-tooltip-open")&&(e&&(e.type=o),this._open(e,t,i))})}),i&&this._open(e,t,i),void 0)},_open:function(e,i,s){function n(t){l.of=t,a.is(":hidden")||a.position(l)}var o,a,r,h,l=t.extend({},this.options.position);if(s){if(o=this._find(i))return o.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(e&&"mouseover"===e.type?i.attr("title",""):i.removeAttr("title")),o=this._tooltip(i),a=o.tooltip,this._addDescribedBy(i,a.attr("id")),a.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),h=t("<div>").html(a.find(".ui-tooltip-content").html()),h.removeAttr("name").find("[name]").removeAttr("name"),h.removeAttr("id").find("[id]").removeAttr("id"),h.appendTo(this.liveRegion),this.options.track&&e&&/^mouse/.test(e.type)?(this._on(this.document,{mousemove:n}),n(e)):a.position(t.extend({of:i},this.options.position)),a.hide(),this._show(a,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(r=this.delayedShow=setInterval(function(){a.is(":visible")&&(n(l.of),clearInterval(r))},t.fx.interval)),this._trigger("open",e,{tooltip:a})}},_registerCloseHandlers:function(e,i){var s={keyup:function(e){if(e.keyCode===t.ui.keyCode.ESCAPE){var s=t.Event(e);s.currentTarget=i[0],this.close(s,!0)}}};i[0]!==this.element[0]&&(s.remove=function(){this._removeTooltip(this._find(i).tooltip)}),e&&"mouseover"!==e.type||(s.mouseleave="close"),e&&"focusin"!==e.type||(s.focusout="close"),this._on(!0,i,s)},close:function(e){var i,s=this,n=t(e?e.currentTarget:this.element),o=this._find(n);return o?(i=o.tooltip,o.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),o.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(t(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),e&&"mouseleave"===e.type&&t.each(this.parents,function(e,i){t(i.element).attr("title",i.title),delete s.parents[e]}),o.closing=!0,this._trigger("close",e,{tooltip:i}),o.hiding||(o.closing=!1)),void 0):(n.removeData("ui-tooltip-open"),void 0)},_tooltip:function(e){var i=t("<div>").attr("role","tooltip"),s=t("<div>").appendTo(i),n=i.uniqueId().attr("id");return this._addClass(s,"ui-tooltip-content"),this._addClass(i,"ui-tooltip","ui-widget ui-widget-content"),i.appendTo(this._appendTo(e)),this.tooltips[n]={element:e,tooltip:i}},_find:function(t){var e=t.data("ui-tooltip-id");return e?this.tooltips[e]:null},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){var e=t.closest(".ui-front, dialog");return e.length||(e=this.document[0].body),e},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur"),o=s.element;n.target=n.currentTarget=o[0],e.close(n,!0),t("#"+i).remove(),o.data("ui-tooltip-title")&&(o.attr("title")||o.attr("title",o.data("ui-tooltip-title")),o.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),t.uiBackCompat!==!1&&t.widget("ui.tooltip",t.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}}),t.ui.tooltip});
|
includes/js/jquery-ui/jquery-ui.structure.min.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.12.1 - 2016-09-14
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
4 |
+
|
5 |
+
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;font-size:100%}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-button{padding:.4em 1em;display:inline-block;position:relative;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2em;box-sizing:border-box;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-button-icon-only{text-indent:0}.ui-button-icon-only .ui-icon{position:absolute;top:50%;left:50%;margin-top:-8px;margin-left:-8px}.ui-button.ui-icon-notext .ui-icon{padding:0;width:2.1em;height:2.1em;text-indent:-9999px;white-space:nowrap}input.ui-button.ui-icon-notext .ui-icon{width:auto;height:auto;text-indent:0;white-space:normal;padding:.4em 1em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-controlgroup{vertical-align:middle;display:inline-block}.ui-controlgroup > .ui-controlgroup-item{float:left;margin-left:0;margin-right:0}.ui-controlgroup > .ui-controlgroup-item:focus,.ui-controlgroup > .ui-controlgroup-item.ui-visual-focus{z-index:9999}.ui-controlgroup-vertical > .ui-controlgroup-item{display:block;float:none;width:100%;margin-top:0;margin-bottom:0;text-align:left}.ui-controlgroup-vertical .ui-controlgroup-item{box-sizing:border-box}.ui-controlgroup .ui-controlgroup-label{padding:.4em 1em}.ui-controlgroup .ui-controlgroup-label span{font-size:80%}.ui-controlgroup-horizontal .ui-controlgroup-label + .ui-controlgroup-item{border-left:none}.ui-controlgroup-vertical .ui-controlgroup-label + .ui-controlgroup-item{border-top:none}.ui-controlgroup-horizontal .ui-controlgroup-label.ui-widget-content{border-right:none}.ui-controlgroup-vertical .ui-controlgroup-label.ui-widget-content{border-bottom:none}.ui-controlgroup-vertical .ui-spinner-input{width:75%;width:calc( 100% - 2.4em )}.ui-controlgroup-vertical .ui-spinner .ui-spinner-up{border-top-style:solid}.ui-checkboxradio-label .ui-icon-background{box-shadow:inset 1px 1px 1px #ccc;border-radius:.12em;border:none}.ui-checkboxradio-radio-label .ui-icon-background{width:16px;height:16px;border-radius:1em;overflow:visible;border:none}.ui-checkboxradio-radio-label.ui-checkboxradio-checked .ui-icon,.ui-checkboxradio-radio-label.ui-checkboxradio-checked:hover .ui-icon{background-image:none;width:8px;height:8px;border-width:4px;border-style:solid}.ui-checkboxradio-disabled{pointer-events:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker .ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat;left:.5em;top:.3em}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-n{height:2px;top:0}.ui-dialog .ui-resizable-e{width:2px;right:0}.ui-dialog .ui-resizable-s{height:2px;bottom:0}.ui-dialog .ui-resizable-w{width:2px;left:0}.ui-dialog .ui-resizable-se,.ui-dialog .ui-resizable-sw,.ui-dialog .ui-resizable-ne,.ui-dialog .ui-resizable-nw{width:7px;height:7px}.ui-dialog .ui-resizable-se{right:0;bottom:0}.ui-dialog .ui-resizable-sw{left:0;bottom:0}.ui-dialog .ui-resizable-ne{right:0;top:0}.ui-dialog .ui-resizable-nw{left:0;top:0}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-text{display:block;margin-right:20px;overflow:hidden;text-overflow:ellipsis}.ui-selectmenu-button.ui-button{text-align:left;white-space:nowrap;width:14em}.ui-selectmenu-icon.ui-icon{float:right;margin-top:0}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:.222em 0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:2em}.ui-spinner-button{width:1.6em;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top-style:none;border-bottom-style:none;border-right-style:none}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px}body .ui-tooltip{border-width:2px}
|
includes/js/jquery-ui/jquery-ui.theme.min.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery UI - v1.12.1 - 2016-09-14
|
2 |
+
* http://jqueryui.com
|
3 |
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
4 |
+
|
5 |
+
.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget.ui-widget-content{border:1px solid #c5c5c5}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default,.ui-button,html .ui-button.ui-state-disabled:hover,html .ui-button.ui-state-disabled:active{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited,a.ui-button,a:link.ui-button,a:visited.ui-button,.ui-button{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus,.ui-button:hover,.ui-button:focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited,a.ui-button:hover,a.ui-button:focus{color:#2b2b2b;text-decoration:none}.ui-visual-focus{box-shadow:0 0 3px 1px rgb(94,158,214)}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active,a.ui-button:active,.ui-button:active,.ui-button.ui-state-active:hover{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-icon-background,.ui-state-active .ui-icon-background{border:#003eff;background-color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-checked{border:1px solid #dad55e;background:#fffa90}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon,.ui-button:hover .ui-icon,.ui-button:focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon,.ui-button:active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon,.ui-button .ui-state-highlight.ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-button .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-caret-1-n{background-position:0 0}.ui-icon-caret-1-ne{background-position:-16px 0}.ui-icon-caret-1-e{background-position:-32px 0}.ui-icon-caret-1-se{background-position:-48px 0}.ui-icon-caret-1-s{background-position:-65px 0}.ui-icon-caret-1-sw{background-position:-80px 0}.ui-icon-caret-1-w{background-position:-96px 0}.ui-icon-caret-1-nw{background-position:-112px 0}.ui-icon-caret-2-n-s{background-position:-128px 0}.ui-icon-caret-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-65px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-65px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:1px -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.003;filter:Alpha(Opacity=.3)}.ui-widget-shadow{-webkit-box-shadow:0 0 5px #666;box-shadow:0 0 5px #666}
|
includes/js/jquery.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
2 |
+
!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=Array.isArray(d)))?(e?(e=!1,f=c&&Array.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,N,e),g(f,c,O,e)):(f++,j.call(a,g(f,c,N,e),g(f,c,O,e),g(f,c,N,c.notifyWith))):(d!==N&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S),
|
3 |
+
a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},U=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function V(){this.expando=r.expando+V.uid++}V.uid=1,V.prototype={cache:function(a){var b=a[this.expando];return b||(b={},U(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){Array.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(L)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var W=new V,X=new V,Y=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Z=/[A-Z]/g;function $(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:Y.test(a)?JSON.parse(a):a)}function _(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Z,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=$(c)}catch(e){}X.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return X.hasData(a)||W.hasData(a)},data:function(a,b,c){return X.access(a,b,c)},removeData:function(a,b){X.remove(a,b)},_data:function(a,b,c){return W.access(a,b,c)},_removeData:function(a,b){W.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=X.get(f),1===f.nodeType&&!W.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),_(f,d,e[d])));W.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){X.set(this,a)}):T(this,function(b){var c;if(f&&void 0===b){if(c=X.get(f,a),void 0!==c)return c;if(c=_(f,a),void 0!==c)return c}else this.each(function(){X.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=W.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var aa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ba=new RegExp("^(?:([+-])=|)("+aa+")([a-z%]*)$","i"),ca=["Top","Right","Bottom","Left"],da=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ea=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function fa(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&ba.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ga={};function ha(a){var b,c=a.ownerDocument,d=a.nodeName,e=ga[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ga[d]=e,e)}function ia(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=W.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&da(d)&&(e[f]=ha(d))):"none"!==c&&(e[f]="none",W.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ia(this,!0)},hide:function(){return ia(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){da(this)?r(this).show():r(this).hide()})}});var ja=/^(?:checkbox|radio)$/i,ka=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c<d;c++)W.set(a[c],"globalEval",!b||W.get(b[c],"globalEval"))}var pa=/<|&#?\w+;/;function qa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(pa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ka.exec(f)||["",""])[1].toLowerCase(),i=ma[h]||ma._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==xa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===xa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&B(this,"input"))return this.click(),!1},_default:function(a){return B(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?va:wa,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:wa,isPropagationStopped:wa,isImmediatePropagationStopped:wa,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=va,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=va,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=va,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&sa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ta.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return ya(this,a,b,c,d)},one:function(a,b,c,d){return ya(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=wa),this.each(function(){r.event.remove(this,a,c,b)})}});var za=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/<script|<style|<link/i,Ba=/checked\s*(?:[^=]|=\s*.checked.)/i,Ca=/^true\/(.*)/,Da=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}X.hasData(a)&&(h=X.access(a),i=r.extend({},h),X.set(b,i))}}function Ia(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ja.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ja(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,na(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ga),l=0;l<i;l++)j=h[l],la.test(j.type||"")&&!W.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Da,""),k))}return a}function Ka(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(na(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&oa(na(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(za,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d<e;d++)Ia(f[d],g[d]);if(b)if(c)for(f=f||na(a),g=g||na(h),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);else Ha(a,h);return g=na(h,"script"),g.length>0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(na(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ja(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(na(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var La=/^margin/,Ma=new RegExp("^("+aa+")(?!px)[a-z%]+$","i"),Na=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",ra.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,ra.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Oa(a,b,c){var d,e,f,g,h=a.style;return c=c||Na(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ma.test(g)&&La.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Pa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Qa=/^(none|table(?!-c[ea]).+)/,Ra=/^--/,Sa={position:"absolute",visibility:"hidden",display:"block"},Ta={letterSpacing:"0",fontWeight:"400"},Ua=["Webkit","Moz","ms"],Va=d.createElement("div").style;function Wa(a){if(a in Va)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ua.length;while(c--)if(a=Ua[c]+b,a in Va)return a}function Xa(a){var b=r.cssProps[a];return b||(b=r.cssProps[a]=Wa(a)||a),b}function Ya(a,b,c){var d=ba.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Za(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ca[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ca[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ca[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ca[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ca[f]+"Width",!0,e)));return g}function $a(a,b,c){var d,e=Na(a),f=Oa(a,b,e),g="border-box"===r.css(a,"boxSizing",!1,e);return Ma.test(f)?f:(d=g&&(o.boxSizingReliable()||f===a.style[b]),"auto"===f&&(f=a["offset"+b[0].toUpperCase()+b.slice(1)]),f=parseFloat(f)||0,f+Za(a,b,c||(g?"border":"content"),d,e)+"px")}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Oa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=Ra.test(b),j=a.style;return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:j[b]:(f=typeof c,"string"===f&&(e=ba.exec(c))&&e[1]&&(c=fa(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(j[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i?j.setProperty(b,c):j[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b),i=Ra.test(b);return i||(b=Xa(h)),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Oa(a,b,d)),"normal"===e&&b in Ta&&(e=Ta[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Qa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?$a(a,b,d):ea(a,Sa,function(){return $a(a,b,d)})},set:function(a,c,d){var e,f=d&&Na(a),g=d&&Za(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=ba.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ya(a,c,g)}}}),r.cssHooks.marginLeft=Pa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Oa(a,"marginLeft"))||a.getBoundingClientRect().left-ea(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ca[d]+b]=f[d]||f[d-2]||f[0];return e}},La.test(a)||(r.cssHooks[a+b].set=Ya)}),r.fn.extend({css:function(a,b){return T(this,function(a,b,c){var d,e,f={},g=0;if(Array.isArray(b)){for(d=Na(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&da(a),q=W.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],cb.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=W.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ia([a],!0),j=a.style.display||j,k=r.css(a,"display"),ia([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=W.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ia([a],!0),m.done(function(){p||ia([a]),W.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=hb(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],Array.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=kb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=ab||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(i||h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:ab||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);f<g;f++)if(d=kb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,hb,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j}r.Animation=r.extend(kb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return fa(c.elem,a,ba.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(L);for(var c,d=0,e=a.length;d<e;d++)c=a[d],kb.tweeners[c]=kb.tweeners[c]||[],kb.tweeners[c].unshift(b)},prefilters:[ib],prefilter:function(a,b){b?kb.prefilters.unshift(a):kb.prefilters.push(a)}}),r.speed=function(a,b,c){var d=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off?d.duration=0:"number"!=typeof d.duration&&(d.duration in r.fx.speeds?d.duration=r.fx.speeds[d.duration]:d.duration=r.fx.speeds._default),null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){r.isFunction(d.old)&&d.old.call(this),d.queue&&r.dequeue(this,d.queue)},d},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(da).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=kb(this,r.extend({},a),f);(e||W.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=W.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&db.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=W.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),r.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(ab=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),ab=void 0},r.fx.timer=function(a){r.timers.push(a),r.fx.start()},r.fx.interval=13,r.fx.start=function(){bb||(bb=!0,eb())},r.fx.stop=function(){bb=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var lb,mb=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return T(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),
|
4 |
+
null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!B(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Tb=[],Ub=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Tb.pop()||r.expando+"_"+ub++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Ub.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ub.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Ub,"$1"+e):b.jsonp!==!1&&(b.url+=(vb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Tb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=C.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=qa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=pb(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length},r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),b=f.ownerDocument,c=b.documentElement,e=b.defaultView,{top:d.top+e.pageYOffset-c.clientTop,left:d.left+e.pageXOffset-c.clientLeft}):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),B(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||ra})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return T(this,function(a,d,e){var f;return r.isWindow(a)?f=a:9===a.nodeType&&(f=a.defaultView),void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Pa(o.pixelPosition,function(a,c){if(c)return c=Oa(a,b),Ma.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return T(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.holdReady=function(a){a?r.readyWait++:r.ready(!0)},r.isArray=Array.isArray,r.parseJSON=JSON.parse,r.nodeName=B,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Vb=a.jQuery,Wb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Wb),b&&a.jQuery===r&&(a.jQuery=Vb),r},b||(a.jQuery=a.$=r),r});
|
includes/js/main.js
CHANGED
@@ -1,35 +1,37 @@
|
|
|
|
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
var _custom_media = true,
|
3 |
-
|
4 |
|
5 |
jQuery('.cscs_uploadbutton').click(function (e) {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
});
|
22 |
|
23 |
jQuery('.add_media').on('click', function () {
|
24 |
-
|
25 |
});
|
26 |
|
27 |
jQuery('.cs-color-picker').wpColorPicker();
|
28 |
jQuery('.cs-date-picker').datepicker({
|
29 |
-
|
30 |
});
|
31 |
-
|
32 |
-
$('[name="cscs_generpotion_whitelisted_ips"]').attr('placeholder','192.168.1.1\n127.0.0.1');
|
33 |
});
|
34 |
|
35 |
/*
|
@@ -55,26 +57,26 @@ jQuery(document).on('click', '.downbcc', function () {
|
|
55 |
|
56 |
jQuery(document).ready(function () {
|
57 |
jQuery('body.igniteup_page_cscs_options .preview-igniteup').on('click', function () {
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
});
|
79 |
});
|
80 |
|
@@ -86,10 +88,10 @@ jQuery(document).ready(function () {
|
|
86 |
|
87 |
jQuery(document).on('click', 'body.igniteup_page_cscs_options .reset-igniteup', function (e) {
|
88 |
if (!confirm("Are you sure to reset template options to defaults?"))
|
89 |
-
|
90 |
jQuery('.reset-supported').each(function () {
|
91 |
-
|
92 |
-
|
93 |
});
|
94 |
jQuery('#igniteup-template-options').submit();
|
95 |
e.preventDefault();
|
@@ -111,7 +113,7 @@ jQuery(document).on('change', '#cs-selected-provider', function () {
|
|
111 |
|
112 |
function showHideIntegrationSection(load) {
|
113 |
if (load !== true)
|
114 |
-
|
115 |
var selected_val = jQuery('#cs-selected-provider').val();
|
116 |
jQuery('#cs-section-' + selected_val).slideDown();
|
117 |
}
|
@@ -121,7 +123,7 @@ jQuery(document).ready(function () {
|
|
121 |
jQuery.fn.bootstrapSwitch.defaults.onColor = 'success';
|
122 |
|
123 |
jQuery('.igniteup-checkbox-switch').each(function () {
|
124 |
-
|
125 |
});
|
126 |
});
|
127 |
|
@@ -146,22 +148,22 @@ jQuery(document).on('click', '#igniteup_admin_subscribe', function () {
|
|
146 |
jQuery(this).prop('disabled', true);
|
147 |
|
148 |
jQuery.ajax({
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
});
|
166 |
});
|
167 |
|
@@ -174,15 +176,15 @@ jQuery(document).on('click', '#igniteup_admin_subscribe', function () {
|
|
174 |
*/
|
175 |
jQuery(function (IGN) {
|
176 |
IGN('#ign-button-generate-get-to-skip').click(function () {
|
177 |
-
|
178 |
});
|
179 |
IGN('#ign-button-edit-skip-with-get').click(function () {
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
})
|
187 |
});
|
188 |
|
@@ -192,7 +194,7 @@ function generateRandomString(charCount) {
|
|
192 |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
193 |
|
194 |
for (var i = 0; i < charCount; i++)
|
195 |
-
|
196 |
|
197 |
return text;
|
198 |
}
|
@@ -206,15 +208,64 @@ jQuery('input.cs-time-picker').timepicker({
|
|
206 |
jQuery(document).on('keydown', 'input.cs-time-picker', function (e) {
|
207 |
// Allow: delete, backspace, tab, escape, and enter
|
208 |
if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13]) !== -1 ||
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* global CodeMirror */
|
2 |
+
|
3 |
jQuery(document).ready(function ($) {
|
4 |
var _custom_media = true,
|
5 |
+
_orig_send_attachment = wp.media.editor.send.attachment;
|
6 |
|
7 |
jQuery('.cscs_uploadbutton').click(function (e) {
|
8 |
+
var send_attachment_bkp = wp.media.editor.send.attachment;
|
9 |
+
var button = jQuery(this);
|
10 |
+
var id = button.data('input');
|
11 |
+
_custom_media = true;
|
12 |
+
wp.media.editor.send.attachment = function (props, attachment) {
|
13 |
+
if (_custom_media) {
|
14 |
+
$("#" + id).val(attachment.url);
|
15 |
+
} else {
|
16 |
+
return _orig_send_attachment.apply(this, [props, attachment]);
|
17 |
+
}
|
18 |
+
;
|
19 |
+
}
|
20 |
+
|
21 |
+
wp.media.editor.open(button);
|
22 |
+
return false;
|
23 |
});
|
24 |
|
25 |
jQuery('.add_media').on('click', function () {
|
26 |
+
_custom_media = false;
|
27 |
});
|
28 |
|
29 |
jQuery('.cs-color-picker').wpColorPicker();
|
30 |
jQuery('.cs-date-picker').datepicker({
|
31 |
+
dateFormat: 'mm/dd/yy'
|
32 |
});
|
33 |
+
|
34 |
+
$('[name="cscs_generpotion_whitelisted_ips"]').attr('placeholder', '192.168.1.1\n127.0.0.1');
|
35 |
});
|
36 |
|
37 |
/*
|
57 |
|
58 |
jQuery(document).ready(function () {
|
59 |
jQuery('body.igniteup_page_cscs_options .preview-igniteup').on('click', function () {
|
60 |
+
jQuery('body.igniteup_page_cscs_options .preview-igniteup, body.igniteup_page_cscs_options .submit').attr('disabled', 'disabled');
|
61 |
+
jQuery('#saveResult').html("<span id='saveMessage' class='successModal'></span>");
|
62 |
+
jQuery('#saveMessage').append("<span>Saving . . .</span>").show();
|
63 |
+
prwindow = window.open('', 'igniteup');
|
64 |
+
jQuery('#igniteup-template-options').ajaxSubmit({
|
65 |
+
success: function () {
|
66 |
+
jQuery('#saveMessage').html("<span>" + jQuery('#saveResult').data('text') + "</span>").show();
|
67 |
+
jQuery('body.igniteup_page_cscs_options .preview-igniteup, body.igniteup_page_cscs_options .submit').removeAttr('disabled');
|
68 |
+
var theurl = jQuery('body.igniteup_page_cscs_options .preview-igniteup').data('forward');
|
69 |
+
prwindow.location = theurl;
|
70 |
+
setTimeout("jQuery('#saveMessage').hide('slow');", 3000);
|
71 |
+
},
|
72 |
+
timeout: 10000,
|
73 |
+
error: function () {
|
74 |
+
jQuery('#saveMessage').hide('slow');
|
75 |
+
alert('Saving process reached timeout! Please try again.');
|
76 |
+
jQuery('body.igniteup_page_cscs_options .preview-igniteup, body.igniteup_page_cscs_options .submit').removeAttr('disabled');
|
77 |
+
}
|
78 |
+
});
|
79 |
+
return false;
|
80 |
});
|
81 |
});
|
82 |
|
88 |
|
89 |
jQuery(document).on('click', 'body.igniteup_page_cscs_options .reset-igniteup', function (e) {
|
90 |
if (!confirm("Are you sure to reset template options to defaults?"))
|
91 |
+
return false;
|
92 |
jQuery('.reset-supported').each(function () {
|
93 |
+
var defval_ = jQuery(this).data('defval');
|
94 |
+
jQuery(this).val(defval_);
|
95 |
});
|
96 |
jQuery('#igniteup-template-options').submit();
|
97 |
e.preventDefault();
|
113 |
|
114 |
function showHideIntegrationSection(load) {
|
115 |
if (load !== true)
|
116 |
+
jQuery('.cs-hidden-section').slideUp();
|
117 |
var selected_val = jQuery('#cs-selected-provider').val();
|
118 |
jQuery('#cs-section-' + selected_val).slideDown();
|
119 |
}
|
123 |
jQuery.fn.bootstrapSwitch.defaults.onColor = 'success';
|
124 |
|
125 |
jQuery('.igniteup-checkbox-switch').each(function () {
|
126 |
+
jQuery(this).bootstrapSwitch();
|
127 |
});
|
128 |
});
|
129 |
|
148 |
jQuery(this).prop('disabled', true);
|
149 |
|
150 |
jQuery.ajax({
|
151 |
+
url: ajaxurl,
|
152 |
+
dataType: 'json',
|
153 |
+
data: {action: 'igniteup_admin_subscribe', admin_filled_email: email_add},
|
154 |
+
type: 'POST',
|
155 |
+
success: function (data) {
|
156 |
+
if (data.error) {
|
157 |
+
jQuery('#igniteup_admin_subscribe_email').prop('disabled', false);
|
158 |
+
jQuery('#igniteup_admin_subscribe').prop('disabled', false);
|
159 |
+
alert(data.message);
|
160 |
+
} else {
|
161 |
+
jQuery('span#ign-hide-after-success').hide();
|
162 |
+
jQuery('span.thank-you-text').slideDown();
|
163 |
+
jQuery('#igniteup_admin_subscribe').prop('disabled', true);
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
});
|
168 |
});
|
169 |
|
176 |
*/
|
177 |
jQuery(function (IGN) {
|
178 |
IGN('#ign-button-generate-get-to-skip').click(function () {
|
179 |
+
IGN('#ign-input-get-to-skip').val(generateRandomString(15));
|
180 |
});
|
181 |
IGN('#ign-button-edit-skip-with-get').click(function () {
|
182 |
+
IGN(this).hide();
|
183 |
+
IGN('#ign-anchor-skip-with-get-link').replaceWith(function () {
|
184 |
+
return IGN("<span id='ign-anchor-skip-with-get-link'>" + IGN('#ign-anchor-skip-with-get-link').html() + "</span>");
|
185 |
+
});
|
186 |
+
IGN('#ign-anchor-skip-with-get-link-slug').hide();
|
187 |
+
IGN('#ign-input-get-to-skip').parent().show();
|
188 |
})
|
189 |
});
|
190 |
|
194 |
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
195 |
|
196 |
for (var i = 0; i < charCount; i++)
|
197 |
+
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
198 |
|
199 |
return text;
|
200 |
}
|
208 |
jQuery(document).on('keydown', 'input.cs-time-picker', function (e) {
|
209 |
// Allow: delete, backspace, tab, escape, and enter
|
210 |
if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13]) !== -1 ||
|
211 |
+
// Allow: Ctrl+A, Command+A
|
212 |
+
(e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) ||
|
213 |
+
// Allow: home, end, left, right, down, up
|
214 |
+
(e.keyCode >= 35 && e.keyCode <= 40)) {
|
215 |
+
// let it happen, don't do anything
|
216 |
+
return;
|
217 |
+
}
|
218 |
+
// Ensure that it is a number and stop the keypress
|
219 |
+
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
|
220 |
+
e.preventDefault();
|
221 |
+
}
|
222 |
+
});
|
223 |
+
|
224 |
+
/*
|
225 |
+
*
|
226 |
+
* Help page promo image rotation
|
227 |
+
*
|
228 |
+
*/
|
229 |
+
|
230 |
+
jQuery(document).ready(function () {
|
231 |
+
var banner_c = 1;
|
232 |
+
var banner_count = jQuery('.igniteup-promo-temp-wrapper img').length;
|
233 |
+
jQuery('.igniteup-promo-temp-wrapper').height(jQuery('.igniteup-promo-temp-1').height() + 20);
|
234 |
+
setInterval(function () {
|
235 |
+
banner_c++;
|
236 |
+
jQuery('.igniteup-promo-temp').fadeOut();
|
237 |
+
setTimeout(function () {
|
238 |
+
jQuery('.igniteup-promo-temp-' + banner_c).fadeIn();
|
239 |
+
if (banner_c == banner_count)
|
240 |
+
banner_c = 0;
|
241 |
+
}, 500);
|
242 |
+
|
243 |
+
}, 3000);
|
244 |
+
});
|
245 |
+
|
246 |
+
/*
|
247 |
+
*
|
248 |
+
* Syntax editor
|
249 |
+
*
|
250 |
+
*/
|
251 |
+
jQuery(document).ready(function () {
|
252 |
+
var options = {
|
253 |
+
mode: "htmlmixed",
|
254 |
+
lineNumbers: true, fixedGutter: true,
|
255 |
+
lineWrapping: true,
|
256 |
+
theme: "ttcn"
|
257 |
+
};
|
258 |
+
|
259 |
+
CodeMirror.fromTextArea(document.getElementById("igniteup-general-custom-css-textarea"), merge_options(options, {mode: "css"}));
|
260 |
+
});
|
261 |
+
|
262 |
+
function merge_options(obj1, obj2) {
|
263 |
+
var obj3 = {};
|
264 |
+
for (var attrname in obj1) {
|
265 |
+
obj3[attrname] = obj1[attrname];
|
266 |
+
}
|
267 |
+
for (var attrname in obj2) {
|
268 |
+
obj3[attrname] = obj2[attrname];
|
269 |
+
}
|
270 |
+
return obj3;
|
271 |
+
}
|
includes/templates/believe.php
CHANGED
@@ -2,64 +2,64 @@
|
|
2 |
|
3 |
function igniteup_define_template_believe($templates) {
|
4 |
$options = array(
|
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 |
$templates['believe'] = $options;
|
@@ -68,12 +68,14 @@ function igniteup_define_template_believe($templates) {
|
|
68 |
|
69 |
add_filter('igniteup_get_templates', 'igniteup_define_template_believe');
|
70 |
|
71 |
-
function
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
77 |
}
|
78 |
|
79 |
-
add_action('
|
2 |
|
3 |
function igniteup_define_template_believe($templates) {
|
4 |
$options = array(
|
5 |
+
'name' => 'Believe',
|
6 |
+
'folder_name' => 'believe',
|
7 |
+
'options' => array(
|
8 |
+
'logo' => array(
|
9 |
+
'type' => 'image',
|
10 |
+
'label' => __('Logo (Transparent)', CSCS_TEXT_DOMAIN),
|
11 |
+
'def' => plugins_url("believe/images/logo.png", __FILE__),
|
12 |
+
'description' => __('Recommended size: 250px x 90px - (Keep it empty to hide logo)', CSCS_TEXT_DOMAIN),
|
13 |
+
),
|
14 |
+
'bg_color' => array(
|
15 |
+
'type' => 'color-picker',
|
16 |
+
'label' => __('Background Color', CSCS_TEXT_DOMAIN),
|
17 |
+
'def' => '#28BB9B',
|
18 |
+
'placeholder' => '#28BB9B',
|
19 |
+
'description' => __('This will be the background color.', CSCS_TEXT_DOMAIN),
|
20 |
+
),
|
21 |
+
'bg_image' => array(
|
22 |
+
'type' => 'image',
|
23 |
+
'label' => __('Background Image', CSCS_TEXT_DOMAIN),
|
24 |
+
'def' => '',
|
25 |
+
'placeholder' => '',
|
26 |
+
'description' => __('Page background image. (Recommended size: 1920px x 1080px)', CSCS_TEXT_DOMAIN),
|
27 |
+
),
|
28 |
+
'font_color' => array(
|
29 |
+
'type' => 'color-picker',
|
30 |
+
'label' => __('Font Color', CSCS_TEXT_DOMAIN),
|
31 |
+
'def' => '#fff',
|
32 |
+
'placeholder' => '#FFFFFF',
|
33 |
+
'description' => __('This will be the font color', CSCS_TEXT_DOMAIN),
|
34 |
+
),
|
35 |
+
'plane' => array(
|
36 |
+
'type' => 'checkbox',
|
37 |
+
'label' => __('Show Paper Plane', CSCS_TEXT_DOMAIN),
|
38 |
+
'def' => '1',
|
39 |
+
'description' => __('Show/Hide Paper Plane', CSCS_TEXT_DOMAIN),
|
40 |
+
),
|
41 |
+
'title_top' => array(
|
42 |
+
'type' => 'text',
|
43 |
+
'label' => __('Title Top', CSCS_TEXT_DOMAIN),
|
44 |
+
'def' => __('Our Website is', CSCS_TEXT_DOMAIN),
|
45 |
+
'placeholder' => __('Our Website is', CSCS_TEXT_DOMAIN),
|
46 |
+
'description' => __('Text above the main title', CSCS_TEXT_DOMAIN),
|
47 |
+
),
|
48 |
+
'main_title' => array(
|
49 |
+
'type' => 'text',
|
50 |
+
'label' => __('Main title', CSCS_TEXT_DOMAIN),
|
51 |
+
'def' => __('Coming Soon', CSCS_TEXT_DOMAIN),
|
52 |
+
'placeholder' => __('Coming Soon', CSCS_TEXT_DOMAIN),
|
53 |
+
'description' => __('The bold title', CSCS_TEXT_DOMAIN),
|
54 |
+
),
|
55 |
+
'paragraph' => array(
|
56 |
+
'type' => 'textarea',
|
57 |
+
'label' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
58 |
+
'def' => __('Meanwhile feel free to interact with our social networks', CSCS_TEXT_DOMAIN),
|
59 |
+
'placeholder' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
60 |
+
'description' => __('This will be the paragraph text', CSCS_TEXT_DOMAIN),
|
61 |
+
)
|
62 |
+
)
|
63 |
);
|
64 |
|
65 |
$templates['believe'] = $options;
|
68 |
|
69 |
add_filter('igniteup_get_templates', 'igniteup_define_template_believe');
|
70 |
|
71 |
+
function igniteup_believe_styles() {
|
72 |
+
?>
|
73 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/bootstrap.min.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
74 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-awesome.min.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
75 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-montserrat.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
76 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-biryani.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
77 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/templates/believe/css/main.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
78 |
+
<?php
|
79 |
}
|
80 |
|
81 |
+
add_action('igniteup_styles_believe', 'igniteup_believe_styles');
|
includes/templates/believe/believe.php
CHANGED
@@ -6,64 +6,60 @@
|
|
6 |
<meta charset="UTF-8">
|
7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
9 |
-
|
10 |
<style>
|
11 |
a{
|
12 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
13 |
transition: all ease 400ms;
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
-
<?php endif; ?>
|
35 |
-
</style>
|
36 |
-
|
37 |
</head>
|
38 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?> !important;">
|
39 |
<div class="container-fluid main-container">
|
40 |
<div class="row">
|
41 |
<div class="col-sm-8">
|
42 |
<div class='logo'><?php
|
43 |
-
|
44 |
-
|
45 |
<img src="<?php echo $logo; ?>" class="img-responsive"></div>
|
46 |
<div class="">
|
47 |
<p class="title-top">
|
48 |
-
|
49 |
</p>
|
50 |
<p class="title-bottom">
|
51 |
-
|
52 |
</p>
|
53 |
<p class="paragraph"><?php echo $the_cs_template_options['paragraph']; ?>
|
54 |
</p>
|
55 |
</div>
|
56 |
<ul class="social-icon">
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
<li class = "<?php echo empty($twitter) ? 'hidden' : ''; ?>"><a href = "<?php echo $twitter; ?>" target = "_blank"><span class = "fa fa-twitter"></span></a></li>
|
68 |
<li class = "<?php echo empty($facebook) ? 'hidden' : ''; ?>"><a href = "<?php echo $facebook; ?>" target = "_blank"><span class = "fa fa-facebook"></span></a></li>
|
69 |
<li class = "<?php echo empty($gplus) ? 'hidden' : ''; ?>"><a href = "<?php echo $gplus; ?>" target = "_blank"><span class = "fa fa-google-plus"></span></a></li>
|
@@ -80,20 +76,20 @@
|
|
80 |
</div>
|
81 |
<div class="row">
|
82 |
<div class="col-sm-6 col-sm-offset-3">
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
92 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
93 |
</div>
|
94 |
</div>
|
95 |
</div>
|
96 |
</div>
|
97 |
-
|
98 |
</body>
|
99 |
</html>
|
6 |
<meta charset="UTF-8">
|
7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
9 |
+
<?php igniteup_head(); ?>
|
10 |
<style>
|
11 |
a{
|
12 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
13 |
transition: all ease 400ms;
|
14 |
+
}
|
15 |
+
<?php if (!empty($the_cs_template_options['bg_image'])): ?>
|
16 |
+
body::after{
|
17 |
+
content: '';
|
18 |
+
background: url('<?php echo $the_cs_template_options['bg_image']; ?>') !important;
|
19 |
+
opacity: 0.5;
|
20 |
+
top: 0px;
|
21 |
+
left: 0px;
|
22 |
+
bottom: 0px;
|
23 |
+
right: 0px;
|
24 |
+
position: fixed;
|
25 |
+
z-index: -1 !important;
|
26 |
+
background-size:cover;
|
27 |
+
}
|
28 |
+
body{
|
29 |
+
background: #000 !important;
|
30 |
+
}
|
31 |
+
<?php endif; ?>
|
32 |
+
</style>
|
|
|
|
|
|
|
|
|
33 |
</head>
|
34 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?> !important;">
|
35 |
<div class="container-fluid main-container">
|
36 |
<div class="row">
|
37 |
<div class="col-sm-8">
|
38 |
<div class='logo'><?php
|
39 |
+
$logo = $the_cs_template_options['logo'];
|
40 |
+
?>
|
41 |
<img src="<?php echo $logo; ?>" class="img-responsive"></div>
|
42 |
<div class="">
|
43 |
<p class="title-top">
|
44 |
+
<?php echo $the_cs_template_options['title_top']; ?>
|
45 |
</p>
|
46 |
<p class="title-bottom">
|
47 |
+
<?php echo $the_cs_template_options['main_title']; ?>
|
48 |
</p>
|
49 |
<p class="paragraph"><?php echo $the_cs_template_options['paragraph']; ?>
|
50 |
</p>
|
51 |
</div>
|
52 |
<ul class="social-icon">
|
53 |
+
<?php
|
54 |
+
$twitter = $the_cs_template_options['common_social_twitter'];
|
55 |
+
$facebook = $the_cs_template_options['common_social_facebook'];
|
56 |
+
$pinterest = $the_cs_template_options['common_social_pinterest'];
|
57 |
+
$gplus = $the_cs_template_options['common_social_googleplus'];
|
58 |
+
$youtube = $the_cs_template_options['common_social_youtube'];
|
59 |
+
$instagram = $the_cs_template_options['common_social_instagram'];
|
60 |
+
$behance = $the_cs_template_options['common_social_behance'];
|
61 |
+
$linkedin = $the_cs_template_options['common_social_linkedin'];
|
62 |
+
?>
|
63 |
<li class = "<?php echo empty($twitter) ? 'hidden' : ''; ?>"><a href = "<?php echo $twitter; ?>" target = "_blank"><span class = "fa fa-twitter"></span></a></li>
|
64 |
<li class = "<?php echo empty($facebook) ? 'hidden' : ''; ?>"><a href = "<?php echo $facebook; ?>" target = "_blank"><span class = "fa fa-facebook"></span></a></li>
|
65 |
<li class = "<?php echo empty($gplus) ? 'hidden' : ''; ?>"><a href = "<?php echo $gplus; ?>" target = "_blank"><span class = "fa fa-google-plus"></span></a></li>
|
76 |
</div>
|
77 |
<div class="row">
|
78 |
<div class="col-sm-6 col-sm-offset-3">
|
79 |
+
<?php
|
80 |
+
$powered_by = $the_cs_template_options['general_powered_by'];
|
81 |
+
if ($powered_by == 1) {
|
82 |
+
$class = "visible";
|
83 |
+
} else {
|
84 |
+
$class = "hidden";
|
85 |
+
}
|
86 |
+
?>
|
87 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
88 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
89 |
</div>
|
90 |
</div>
|
91 |
</div>
|
92 |
</div>
|
93 |
+
<?php igniteup_footer(); ?>
|
94 |
</body>
|
95 |
</html>
|
includes/templates/believe/css/main.css
CHANGED
@@ -7,7 +7,9 @@ body{
|
|
7 |
}
|
8 |
.logo{
|
9 |
margin-top: 90px;
|
10 |
-
margin-bottom: 30px;
|
|
|
|
|
11 |
max-width: 290px;
|
12 |
}
|
13 |
#plane{
|
@@ -78,6 +80,9 @@ body{
|
|
78 |
}
|
79 |
}
|
80 |
@media(max-width:768px){
|
|
|
|
|
|
|
81 |
.title-top{
|
82 |
font-size: 16pt;
|
83 |
text-align: center;
|
@@ -94,6 +99,10 @@ body{
|
|
94 |
}
|
95 |
.logo{
|
96 |
text-align: center;
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
.social{
|
99 |
text-align: center;
|
7 |
}
|
8 |
.logo{
|
9 |
margin-top: 90px;
|
10 |
+
margin-bottom: 30px;
|
11 |
+
}
|
12 |
+
.logo img{
|
13 |
max-width: 290px;
|
14 |
}
|
15 |
#plane{
|
80 |
}
|
81 |
}
|
82 |
@media(max-width:768px){
|
83 |
+
.main-container{
|
84 |
+
text-align: center;
|
85 |
+
}
|
86 |
.title-top{
|
87 |
font-size: 16pt;
|
88 |
text-align: center;
|
99 |
}
|
100 |
.logo{
|
101 |
text-align: center;
|
102 |
+
width: 100%;
|
103 |
+
}
|
104 |
+
.logo img{
|
105 |
+
margin: 0 auto;
|
106 |
}
|
107 |
.social{
|
108 |
text-align: center;
|
includes/templates/glass.php
CHANGED
@@ -2,77 +2,79 @@
|
|
2 |
|
3 |
function igniteup_define_template_glass($templates) {
|
4 |
$templates['glass'] = array(
|
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 |
return $templates;
|
65 |
}
|
66 |
|
67 |
add_filter('igniteup_get_templates', 'igniteup_define_template_glass');
|
68 |
|
69 |
-
function
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
76 |
}
|
77 |
|
78 |
-
add_action('
|
2 |
|
3 |
function igniteup_define_template_glass($templates) {
|
4 |
$templates['glass'] = array(
|
5 |
+
'name' => 'Glass',
|
6 |
+
'folder_name' => 'glass',
|
7 |
+
'options' => array(
|
8 |
+
'logo' => array(
|
9 |
+
'type' => 'image',
|
10 |
+
'label' => __('Logo (Transparent)', CSCS_TEXT_DOMAIN),
|
11 |
+
'def' => plugins_url("glass/img/logo.png", __FILE__),
|
12 |
+
'description' => __('Recommended size: 250px x 90px - (Keep it empty to hide logo)', CSCS_TEXT_DOMAIN),
|
13 |
+
),
|
14 |
+
'bg_color' => array(
|
15 |
+
'type' => 'color-picker',
|
16 |
+
'label' => __('Background Color', CSCS_TEXT_DOMAIN),
|
17 |
+
'def' => '#303030',
|
18 |
+
'placeholder' => '#28BB9B',
|
19 |
+
'description' => __('This will be the background color.', CSCS_TEXT_DOMAIN),
|
20 |
+
),
|
21 |
+
'bg_image' => array(
|
22 |
+
'type' => 'image',
|
23 |
+
'label' => __('Background Image', CSCS_TEXT_DOMAIN),
|
24 |
+
'def' => plugins_url("glass/img/bg_default.jpg", __FILE__),
|
25 |
+
'placeholder' => '',
|
26 |
+
'description' => __('Page background image. (Recommended size: 1920px x 1080px)', CSCS_TEXT_DOMAIN),
|
27 |
+
),
|
28 |
+
'font_color' => array(
|
29 |
+
'type' => 'color-picker',
|
30 |
+
'label' => __('Font Color', CSCS_TEXT_DOMAIN),
|
31 |
+
'def' => '#fff',
|
32 |
+
'placeholder' => '#FFFFFF',
|
33 |
+
'description' => __('This will be the font color', CSCS_TEXT_DOMAIN),
|
34 |
+
),
|
35 |
+
'link_color' => array(
|
36 |
+
'type' => 'color-picker',
|
37 |
+
'label' => __('Link Color', CSCS_TEXT_DOMAIN),
|
38 |
+
'def' => '#cbcbcb',
|
39 |
+
'placeholder' => '#cbcbcb',
|
40 |
+
'description' => __('This will be the hover color', CSCS_TEXT_DOMAIN),
|
41 |
+
),
|
42 |
+
'title_top' => array(
|
43 |
+
'type' => 'text',
|
44 |
+
'label' => __('Title Top', CSCS_TEXT_DOMAIN),
|
45 |
+
'def' => __('Under Maintenance', CSCS_TEXT_DOMAIN),
|
46 |
+
'placeholder' => __('Header Text', CSCS_TEXT_DOMAIN),
|
47 |
+
'description' => __('This will be the main title', CSCS_TEXT_DOMAIN),
|
48 |
+
),
|
49 |
+
'paragraph' => array(
|
50 |
+
'type' => 'textarea',
|
51 |
+
'label' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
52 |
+
'def' => __('sorry for the inconvenience <br> we will come with a new experience.', CSCS_TEXT_DOMAIN),
|
53 |
+
'placeholder' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
54 |
+
'description' => __('This will be the paragraph text, you can use html tags here.', CSCS_TEXT_DOMAIN),
|
55 |
+
),
|
56 |
+
'subscribe' => array(
|
57 |
+
'type' => 'checkbox',
|
58 |
+
'label' => __('Show Subscribe Form', CSCS_TEXT_DOMAIN),
|
59 |
+
'def' => '1',
|
60 |
+
'description' => __('Show/Hide Email Subscribe Form', CSCS_TEXT_DOMAIN),
|
61 |
+
),
|
62 |
+
)
|
63 |
);
|
64 |
return $templates;
|
65 |
}
|
66 |
|
67 |
add_filter('igniteup_get_templates', 'igniteup_define_template_glass');
|
68 |
|
69 |
+
function glass_template_styles() {
|
70 |
+
?>
|
71 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/bootstrap.min.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
72 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/animate.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
73 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-awesome.min.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
74 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-montserrat.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
75 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-opensans.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
76 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/templates/glass/css/main.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
77 |
+
<?php
|
78 |
}
|
79 |
|
80 |
+
add_action('igniteup_styles_glass', 'glass_template_styles');
|
includes/templates/glass/css/main.css
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
.logo{
|
2 |
margin: 0 auto;
|
3 |
}
|
|
|
|
|
|
|
|
|
|
|
4 |
.glass-wrapper{
|
5 |
background-color: rgba( 0, 0, 0, 0.322 );
|
6 |
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.27);
|
@@ -23,7 +28,7 @@
|
|
23 |
font-size: 14px;
|
24 |
}
|
25 |
.glass-wrapper .social-icon {
|
26 |
-
font-size:
|
27 |
margin: 0 auto;
|
28 |
list-style: none;
|
29 |
display: table;
|
@@ -85,4 +90,8 @@
|
|
85 |
.glass-wrapper h2{
|
86 |
font-size: 30px;
|
87 |
}
|
|
|
|
|
|
|
|
|
88 |
}
|
1 |
.logo{
|
2 |
margin: 0 auto;
|
3 |
}
|
4 |
+
.main-container{
|
5 |
+
max-width: 980px;
|
6 |
+
width: 65%;
|
7 |
+
margin: 0 auto;
|
8 |
+
}
|
9 |
.glass-wrapper{
|
10 |
background-color: rgba( 0, 0, 0, 0.322 );
|
11 |
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.27);
|
28 |
font-size: 14px;
|
29 |
}
|
30 |
.glass-wrapper .social-icon {
|
31 |
+
font-size: 40px;
|
32 |
margin: 0 auto;
|
33 |
list-style: none;
|
34 |
display: table;
|
90 |
.glass-wrapper h2{
|
91 |
font-size: 30px;
|
92 |
}
|
93 |
+
.main-container{
|
94 |
+
max-width: 1200px;
|
95 |
+
width: 90%;
|
96 |
+
}
|
97 |
}
|
includes/templates/glass/glass.php
CHANGED
@@ -2,12 +2,13 @@
|
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
5 |
-
<?php wp_head(); ?>
|
6 |
<meta charset="utf-8">
|
7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
9 |
<title><?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | ' . get_bloginfo('name')); ?></title>
|
10 |
|
|
|
|
|
11 |
<style>
|
12 |
.main-container a{
|
13 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
@@ -16,123 +17,138 @@
|
|
16 |
a:hover, a:focus{
|
17 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
18 |
}
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
</style>
|
|
|
36 |
</head>
|
37 |
<body style=" color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
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 |
-
</div>
|
97 |
<script>
|
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 |
</script>
|
136 |
-
|
137 |
</body>
|
138 |
</html>
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
|
|
5 |
<meta charset="utf-8">
|
6 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
8 |
<title><?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | ' . get_bloginfo('name')); ?></title>
|
9 |
|
10 |
+
<?php igniteup_head(); ?>
|
11 |
+
|
12 |
<style>
|
13 |
.main-container a{
|
14 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
17 |
a:hover, a:focus{
|
18 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
19 |
}
|
20 |
+
<?php if (!empty($the_cs_template_options['bg_image'])): ?>
|
21 |
+
body::after{
|
22 |
+
content: '';
|
23 |
+
background-image: url('<?php echo $the_cs_template_options['bg_image']; ?>');
|
24 |
+
top: 0px;
|
25 |
+
left: 0px;
|
26 |
+
bottom: 0px;
|
27 |
+
right: 0px;
|
28 |
+
position: fixed;
|
29 |
+
z-index: -1;
|
30 |
+
background-size:cover;
|
31 |
+
}
|
32 |
+
body{
|
33 |
+
background: #000 !important;
|
34 |
+
}
|
35 |
+
<?php endif; ?>
|
36 |
</style>
|
37 |
+
|
38 |
</head>
|
39 |
<body style=" color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
40 |
+
<div class="main-container">
|
41 |
+
<div class="glass-wrapper">
|
42 |
+
<?php if (!empty($the_cs_template_options['logo'])): ?>
|
43 |
+
<img class="img-responsive logo" src="<?php echo $the_cs_template_options['logo']; ?>">
|
44 |
+
<?php endif; ?>
|
45 |
+
<h2 class="text-center"> <?php echo $the_cs_template_options['title_top']; ?></h2>
|
46 |
+
<p class="text-center"><?php echo $the_cs_template_options['paragraph']; ?></p>
|
47 |
+
<div class="thankyou hidden" style="margin-bottom: -70px;">
|
48 |
+
<div class="alert alert-success alert-dismissible" role="alert">
|
49 |
+
<div class="text-center"> <?php echo CSAdminOptions::getDefaultStrings('alert_thankyou'); ?></div>
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
<div class="error-msg hidden" style="margin-top: 0px;">
|
53 |
+
<div class="alert alert-danger alert-dismissible" role="alert">
|
54 |
+
<div class="text-center" id='error-msg-text'></div>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
<div class="row subscribe <?php echo (($the_cs_template_options['subscribe']) == 1) ? '' : 'hidden' ?>">
|
58 |
+
<div class="col-sm-8 col-sm-offset-2">
|
59 |
+
<div class="subscribe input-group">
|
60 |
+
<input type="email" id="cs_email" class="form-control" placeholder="<?php _e('Your email address', CSCS_TEXT_DOMAIN); ?>">
|
61 |
+
<span class="input-group-btn">
|
62 |
+
<button class="btn btn-default subscribe-btn" id="subscribe-btn" type="button"><?php echo CSAdminOptions::getDefaultStrings('subscribe_text'); ?></button>
|
63 |
+
</span>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
|
68 |
+
<ul class="social-icon">
|
69 |
+
<?php
|
70 |
+
$twitter = $the_cs_template_options['common_social_twitter'];
|
71 |
+
$facebook = $the_cs_template_options['common_social_facebook'];
|
72 |
+
$pinterest = $the_cs_template_options['common_social_pinterest'];
|
73 |
+
$gplus = $the_cs_template_options['common_social_googleplus'];
|
74 |
+
$youtube = $the_cs_template_options['common_social_youtube'];
|
75 |
+
$instagram = $the_cs_template_options['common_social_instagram'];
|
76 |
+
$behance = $the_cs_template_options['common_social_behance'];
|
77 |
+
$linkedin = $the_cs_template_options['common_social_linkedin'];
|
78 |
+
?>
|
79 |
+
<li class = "<?php echo empty($twitter) ? 'hidden' : ''; ?>"><a href = "<?php echo $twitter; ?>" target = "_blank"><span class = "fa fa-twitter-square"></span></a></li>
|
80 |
+
<li class = "<?php echo empty($facebook) ? 'hidden' : ''; ?>"><a href = "<?php echo $facebook; ?>" target = "_blank"><span class = "fa fa-facebook-square"></span></a></li>
|
81 |
+
<li class = "<?php echo empty($gplus) ? 'hidden' : ''; ?>"><a href = "<?php echo $gplus; ?>" target = "_blank"><span class = "fa fa-google-plus-square"></span></a></li>
|
82 |
+
<li class = "<?php echo empty($pinterest) ? 'hidden' : ''; ?>"><a href = "<?php echo $pinterest; ?>" target = "_blank"><span class = "fa fa-pinterest-square"></span></a></li>
|
83 |
+
<li class = "<?php echo empty($youtube) ? 'hidden' : ''; ?>"><a href = "<?php echo $youtube; ?>" target = "_blank"><span class = "fa fa-youtube-square"></span></a></li>
|
84 |
+
<li class = "<?php echo empty($instagram) ? 'hidden' : ''; ?>"><a href = "<?php echo $instagram; ?>" target = "_blank"><span class = "fa fa-instagram"></span></a></li>
|
85 |
+
<li class = "<?php echo empty($behance) ? 'hidden' : ''; ?>"><a href = "<?php echo $behance; ?>" target = "_blank"><span class = "fa fa-behance-square"></span></a></li>
|
86 |
+
<li class = "<?php echo empty($linkedin) ? 'hidden' : ''; ?>"><a href = "<?php echo $linkedin; ?>" target = "_blank"><span class = "fa fa-linkedin-square"></span></a></li>
|
87 |
+
</ul>
|
88 |
+
<?php
|
89 |
+
$powered_by = $the_cs_template_options['general_powered_by'];
|
90 |
+
($powered_by == 1) ? $class = "visible" : $class = "hidden";
|
91 |
+
?>
|
92 |
+
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
93 |
+
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
<script src='<?php echo plugins_url('includes/js/jquery.min.js', CSCS_FILE) ?>' type="text/javascript"></script>
|
|
|
98 |
<script>
|
99 |
+
jQuery('.subscribe-btn').on('click', function () {
|
100 |
+
subscribe();
|
101 |
+
});
|
102 |
+
jQuery('#cs_email').on('keypress', function (e) {
|
103 |
+
if (e.which == 13) {
|
104 |
+
subscribe();
|
105 |
+
}
|
106 |
+
});
|
107 |
|
108 |
+
jQuery(function ($) {
|
109 |
+
function runPositioning() {
|
110 |
+
var bheight = $(window).height();
|
111 |
+
var cont_height = $('.main-container').height();
|
112 |
+
var space = bheight - cont_height;
|
113 |
+
if (space > 10) {
|
114 |
+
$('.glass-wrapper').css('margin-top', space / 2);
|
115 |
+
$('.glass-wrapper').css('margin-bottom', 0);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
runPositioning();
|
119 |
+
$(window).on('resize', function () {
|
120 |
+
runPositioning();
|
121 |
+
});
|
122 |
+
});
|
123 |
+
|
124 |
+
function subscribe() {
|
125 |
+
jQuery.ajax({
|
126 |
+
url: '<?php echo admin_url('admin-ajax.php'); ?>',
|
127 |
+
data: {action: 'subscribe_email', cs_email: jQuery("#cs_email").val()},
|
128 |
+
dataType: 'json',
|
129 |
+
success: function (data) {
|
130 |
+
if (data['error']) {
|
131 |
+
jQuery('.error-msg #error-msg-text').html(data['message']);
|
132 |
+
jQuery('.error-msg').removeClass('hidden');
|
133 |
+
jQuery('.error-msg').addClass('animated fadeIn');
|
134 |
+
function hideMsg() {
|
135 |
+
jQuery('.error-msg').addClass('fadeOut');
|
136 |
+
}
|
137 |
+
setTimeout(hideMsg, 4000);
|
138 |
+
function showMsg() {
|
139 |
+
jQuery('.error-msg').addClass('hidden');
|
140 |
+
jQuery('.error-msg').removeClass('animated fadeIn fadeOut');
|
141 |
+
}
|
142 |
+
setTimeout(showMsg, 4500);
|
143 |
+
} else {
|
144 |
+
jQuery('.subscribe').addClass('animated fadeOutDown');
|
145 |
+
jQuery('.thankyou').removeClass('hidden');
|
146 |
+
jQuery('.thankyou').addClass('animated fadeIn');
|
147 |
+
}
|
148 |
+
}
|
149 |
+
});
|
150 |
+
}
|
151 |
</script>
|
152 |
+
<?php igniteup_footer(); ?>
|
153 |
</body>
|
154 |
</html>
|
includes/templates/launcher.php
CHANGED
@@ -2,81 +2,80 @@
|
|
2 |
|
3 |
function igniteup_define_template_launcher($templates) {
|
4 |
$templates['launcher'] = array(
|
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 |
return $templates;
|
82 |
}
|
@@ -84,14 +83,14 @@ function igniteup_define_template_launcher($templates) {
|
|
84 |
add_filter('igniteup_get_templates', 'igniteup_define_template_launcher');
|
85 |
|
86 |
function cscs_launcher_theme_scripts() {
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
}
|
96 |
|
97 |
-
add_action('
|
2 |
|
3 |
function igniteup_define_template_launcher($templates) {
|
4 |
$templates['launcher'] = array(
|
5 |
+
'name' => 'Launcher',
|
6 |
+
'folder_name' => 'launcher',
|
7 |
+
'options' => array(
|
8 |
+
'launch_date' => array(
|
9 |
+
'type' => 'date',
|
10 |
+
'label' => __('Launch Date', CSCS_TEXT_DOMAIN),
|
11 |
+
'placeholder' => 'mm/dd/yyyy',
|
12 |
+
'def' => date('m/d/Y', strtotime('Next Monday')),
|
13 |
+
'description' => __('Add the date when you are going to launch the site', CSCS_TEXT_DOMAIN),
|
14 |
+
),
|
15 |
+
'launch_time' => array(
|
16 |
+
'type' => 'text',
|
17 |
+
'label' => __('Launch Time', CSCS_TEXT_DOMAIN),
|
18 |
+
'placeholder' => 'hh:mm:ss',
|
19 |
+
'def' => '12:12:12',
|
20 |
+
'description' => __('Note: Enter time in hh:mm:ss format.', CSCS_TEXT_DOMAIN),
|
21 |
+
),
|
22 |
+
'bg_color' => array(
|
23 |
+
'type' => 'color-picker',
|
24 |
+
'label' => __('Background Color', CSCS_TEXT_DOMAIN),
|
25 |
+
'def' => '#28BB9B',
|
26 |
+
'placeholder' => '#28BB9B',
|
27 |
+
'description' => __('This will be the background color.', CSCS_TEXT_DOMAIN),
|
28 |
+
),
|
29 |
+
'bg_image' => array(
|
30 |
+
'type' => 'image',
|
31 |
+
'label' => __('Background Image', CSCS_TEXT_DOMAIN),
|
32 |
+
'def' => '',
|
33 |
+
'placeholder' => '',
|
34 |
+
'description' => __('Page background image. (Recommended size: 1920px x 1080px)', CSCS_TEXT_DOMAIN),
|
35 |
+
),
|
36 |
+
'font_color' => array(
|
37 |
+
'type' => 'color-picker',
|
38 |
+
'label' => __('Font Color', CSCS_TEXT_DOMAIN),
|
39 |
+
'def' => '#fff',
|
40 |
+
'placeholder' => '#FFFFFF',
|
41 |
+
'description' => __('This will be the font color', CSCS_TEXT_DOMAIN),
|
42 |
+
),
|
43 |
+
'title_top' => array(
|
44 |
+
'type' => 'text',
|
45 |
+
'label' => __('Title Top Text', CSCS_TEXT_DOMAIN),
|
46 |
+
'def' => __('Almost Ready', CSCS_TEXT_DOMAIN),
|
47 |
+
'placeholder' => __('Bold Title', CSCS_TEXT_DOMAIN),
|
48 |
+
'description' => __('This will be the bold title', CSCS_TEXT_DOMAIN),
|
49 |
+
),
|
50 |
+
'title' => array(
|
51 |
+
'type' => 'text',
|
52 |
+
'label' => __('Subtitle Text', CSCS_TEXT_DOMAIN),
|
53 |
+
'def' => __('Website will launch in', CSCS_TEXT_DOMAIN),
|
54 |
+
'placeholder' => __('Subtitle', CSCS_TEXT_DOMAIN),
|
55 |
+
'description' => __('Text below the title', CSCS_TEXT_DOMAIN),
|
56 |
+
),
|
57 |
+
'paragraph' => array(
|
58 |
+
'type' => 'textarea',
|
59 |
+
'label' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
60 |
+
'def' => __('This website is currently unavailable due to maintenance. Please visit again later. If you have any inquiries forward to the site admin. Please subscribe with our Newsletter.', CSCS_TEXT_DOMAIN),
|
61 |
+
'placeholder' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
62 |
+
'description' => __('This will be the paragraph text', CSCS_TEXT_DOMAIN),
|
63 |
+
),
|
64 |
+
'subscribe_text_color' => array(
|
65 |
+
'type' => 'color-picker',
|
66 |
+
'label' => __('Button Font Color', CSCS_TEXT_DOMAIN),
|
67 |
+
'def' => '#fff',
|
68 |
+
'placeholder' => '#FFFFFF',
|
69 |
+
'description' => __('This will be the font color the button', CSCS_TEXT_DOMAIN),
|
70 |
+
),
|
71 |
+
'subscribe_bg_color' => array(
|
72 |
+
'type' => 'color-picker',
|
73 |
+
'label' => __('Button Background Color', CSCS_TEXT_DOMAIN),
|
74 |
+
'def' => '#DB4F4B',
|
75 |
+
'placeholder' => '#FFFFFF',
|
76 |
+
'description' => __('This will be the background color the button', CSCS_TEXT_DOMAIN),
|
77 |
+
),
|
78 |
+
)
|
|
|
79 |
);
|
80 |
return $templates;
|
81 |
}
|
83 |
add_filter('igniteup_get_templates', 'igniteup_define_template_launcher');
|
84 |
|
85 |
function cscs_launcher_theme_scripts() {
|
86 |
+
?>
|
87 |
+
<link rel = 'stylesheet' href = '<?php echo plugins_url('includes/css/bootstrap.min.css', CSCS_FILE) ?>' type = 'text/css' media = 'all' />
|
88 |
+
<link rel = 'stylesheet' href = '<?php echo plugins_url('includes/css/animate.css', CSCS_FILE) ?>' type = 'text/css' media = 'all' />
|
89 |
+
<link rel = 'stylesheet' href = '<?php echo plugins_url('includes/css/font-montserrat.css', CSCS_FILE) ?>' type = 'text/css' media = 'all' />
|
90 |
+
<link rel = 'stylesheet' href = '<?php echo plugins_url('includes/css/icons/styles.css', CSCS_FILE) ?>' type = 'text/css' media = 'all' />
|
91 |
+
<link rel = 'stylesheet' href = '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css' type = 'text/css' media = 'all' />
|
92 |
+
<link rel = 'stylesheet' href = '<?php echo plugins_url('includes/templates/launcher/css/main.css', CSCS_FILE) ?>' type = 'text/css' media = 'all' />
|
93 |
+
<?php
|
94 |
}
|
95 |
|
96 |
+
add_action('igniteup_styles_launcher', 'cscs_launcher_theme_scripts');
|
includes/templates/launcher/launcher.php
CHANGED
@@ -2,13 +2,14 @@
|
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
5 |
-
<?php wp_head(); ?>
|
6 |
<meta charset="utf-8">
|
7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
9 |
<title> <?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | ' . get_bloginfo('name')); ?> </title>
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
.main-container a{
|
13 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
14 |
transition: all ease 400ms;
|
@@ -16,23 +17,24 @@
|
|
16 |
a:hover{
|
17 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
18 |
}
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
</style>
|
37 |
</head>
|
38 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
@@ -43,47 +45,47 @@
|
|
43 |
</div>
|
44 |
<div class="col-sm-9 ">
|
45 |
<h1 class="text-uppercase text-center">
|
46 |
-
|
47 |
</h1>
|
48 |
<div class="text-center text-uppercase sub-text">
|
49 |
-
|
50 |
</div>
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
<p class="text-center description">
|
70 |
-
|
71 |
</p>
|
72 |
<div class="subscribe">
|
73 |
<div class="input-group">
|
74 |
<input type="email" class="form-control text-box" id="cs_email" placeholder="<?php _e('Enter your email...', CSCS_TEXT_DOMAIN); ?>">
|
75 |
<span class="input-group-btn">
|
76 |
<button class="btn btn-default subscribe-btn" type="button" style="color: <?php echo $the_cs_template_options['subscribe_text_color']; ?>; background: <?php echo $the_cs_template_options['subscribe_bg_color']; ?>;">
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
</button>
|
88 |
</span>
|
89 |
</div>
|
@@ -99,16 +101,16 @@
|
|
99 |
</div>
|
100 |
</div>
|
101 |
<div class="social">
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
<ul>
|
113 |
<li class="<?php echo empty($twitter) ? 'hidden' : ''; ?>"><a href="<?php echo $twitter; ?>"><div class="social-icon"><span class="fa fa-twitter"></span></div></a></li>
|
114 |
<li class="<?php echo empty($facebook) ? 'hidden' : ''; ?>"><a href="<?php echo $facebook; ?>"><div class="social-icon"><span class="fa fa-facebook"></span></div></a></li>
|
@@ -122,14 +124,14 @@
|
|
122 |
</div>
|
123 |
<div class="row">
|
124 |
<div class="col-sm-6 col-sm-offset-3">
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
134 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
135 |
</div>
|
@@ -139,138 +141,140 @@
|
|
139 |
</div>
|
140 |
|
141 |
</div>
|
|
|
|
|
142 |
<script type="text/javascript">
|
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 |
<?php if (!empty($the_cs_template_options['launch_date']) || !empty($the_cs_template_options['launch_time'])): ?>
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
<?php endif; ?>
|
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 |
</script>
|
274 |
-
|
275 |
</body>
|
276 |
</html>
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
|
|
5 |
<meta charset="utf-8">
|
6 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
8 |
<title> <?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | ' . get_bloginfo('name')); ?> </title>
|
9 |
+
|
10 |
+
<?php igniteup_head(); ?>
|
11 |
+
|
12 |
+
<style>
|
13 |
.main-container a{
|
14 |
color:<?php echo $the_cs_template_options['font_color']; ?> !important;
|
15 |
transition: all ease 400ms;
|
17 |
a:hover{
|
18 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
19 |
}
|
20 |
+
<?php if (!empty($the_cs_template_options['bg_image'])): ?>
|
21 |
+
body::after{
|
22 |
+
content: '';
|
23 |
+
background: url('<?php echo $the_cs_template_options['bg_image']; ?>') !important;
|
24 |
+
opacity: 0.5;
|
25 |
+
top: 0px;
|
26 |
+
left: 0px;
|
27 |
+
bottom: 0px;
|
28 |
+
right: 0px;
|
29 |
+
position: fixed;
|
30 |
+
z-index: -1;
|
31 |
+
background-size:cover;
|
32 |
+
}
|
33 |
+
body{
|
34 |
+
background: #000 !important;
|
35 |
+
}
|
36 |
+
<?php endif; ?>
|
37 |
+
|
38 |
</style>
|
39 |
</head>
|
40 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
45 |
</div>
|
46 |
<div class="col-sm-9 ">
|
47 |
<h1 class="text-uppercase text-center">
|
48 |
+
<?php echo $the_cs_template_options['title_top']; ?>
|
49 |
</h1>
|
50 |
<div class="text-center text-uppercase sub-text">
|
51 |
+
<?php echo $the_cs_template_options['title']; ?>
|
52 |
</div>
|
53 |
+
<?php if (!empty($the_cs_template_options['launch_date']) || !empty($the_cs_template_options['launch_time'])): ?>
|
54 |
+
<div class="container-fluid" id="countdown">
|
55 |
+
<div class="row text-uppercase">
|
56 |
+
<div class="col-sm-3 col-xs-6 countdown-time">
|
57 |
+
<span id="days" class="time">00</span><span class="time-name">d<span class="hidden-sm">ay<span id="day-s">s</span></span></span>
|
58 |
+
</div>
|
59 |
+
<div class="col-sm-3 col-xs-6 countdown-time">
|
60 |
+
<span id="hrs" class="time">00</span><span class="time-name">h<span class="hidden-sm">our<span id="hrs-s">s</span></span></span>
|
61 |
+
</div>
|
62 |
+
<div class="col-sm-3 col-xs-6 countdown-time">
|
63 |
+
<span id="mins" class="time">00</span><span class="time-name">m<span class="hidden-sm">in<span id="min-s">s</span></span></span>
|
64 |
+
</div>
|
65 |
+
<div class="col-sm-3 col-xs-6 countdown-time">
|
66 |
+
<span id="secs" class="time">00</span><span class="time-name">s<span class="hidden-sm">ec<span id="sec-s">s</span></span></span>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
<?php endif; ?>
|
71 |
<p class="text-center description">
|
72 |
+
<?php echo $the_cs_template_options['paragraph']; ?>
|
73 |
</p>
|
74 |
<div class="subscribe">
|
75 |
<div class="input-group">
|
76 |
<input type="email" class="form-control text-box" id="cs_email" placeholder="<?php _e('Enter your email...', CSCS_TEXT_DOMAIN); ?>">
|
77 |
<span class="input-group-btn">
|
78 |
<button class="btn btn-default subscribe-btn" type="button" style="color: <?php echo $the_cs_template_options['subscribe_text_color']; ?>; background: <?php echo $the_cs_template_options['subscribe_bg_color']; ?>;">
|
79 |
+
<?php
|
80 |
+
$subscribe = CSAdminOptions::getDefaultStrings('subscribe_text');
|
81 |
+
$post = substr($subscribe, 0, 20);
|
82 |
+
if (strlen($post) > 15) {
|
83 |
+
echo $post;
|
84 |
+
echo "...";
|
85 |
+
} else {
|
86 |
+
echo $post;
|
87 |
+
}
|
88 |
+
?>
|
89 |
</button>
|
90 |
</span>
|
91 |
</div>
|
101 |
</div>
|
102 |
</div>
|
103 |
<div class="social">
|
104 |
+
<?php
|
105 |
+
$twitter = $the_cs_template_options['common_social_twitter'];
|
106 |
+
$facebook = $the_cs_template_options['common_social_facebook'];
|
107 |
+
$pinterest = $the_cs_template_options['common_social_pinterest'];
|
108 |
+
$gplus = $the_cs_template_options['common_social_googleplus'];
|
109 |
+
$youtube = $the_cs_template_options['common_social_youtube'];
|
110 |
+
$instagram = $the_cs_template_options['common_social_instagram'];
|
111 |
+
$behance = $the_cs_template_options['common_social_behance'];
|
112 |
+
$linkedin = $the_cs_template_options['common_social_linkedin'];
|
113 |
+
?>
|
114 |
<ul>
|
115 |
<li class="<?php echo empty($twitter) ? 'hidden' : ''; ?>"><a href="<?php echo $twitter; ?>"><div class="social-icon"><span class="fa fa-twitter"></span></div></a></li>
|
116 |
<li class="<?php echo empty($facebook) ? 'hidden' : ''; ?>"><a href="<?php echo $facebook; ?>"><div class="social-icon"><span class="fa fa-facebook"></span></div></a></li>
|
124 |
</div>
|
125 |
<div class="row">
|
126 |
<div class="col-sm-6 col-sm-offset-3">
|
127 |
+
<?php
|
128 |
+
$powered_by = $the_cs_template_options['general_powered_by'];
|
129 |
+
if ($powered_by == 1) {
|
130 |
+
$class = "visible";
|
131 |
+
} else {
|
132 |
+
$class = "hidden";
|
133 |
+
}
|
134 |
+
?>
|
135 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
136 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
137 |
</div>
|
141 |
</div>
|
142 |
|
143 |
</div>
|
144 |
+
<script src='<?php echo plugins_url('includes/js/jquery.min.js', CSCS_FILE) ?>' type="text/javascript"></script>
|
145 |
+
<script src='<?php echo plugins_url('includes/templates/launcher/js/jquery.countdown.js', CSCS_FILE) ?>' type="text/javascript"></script>
|
146 |
<script type="text/javascript">
|
147 |
+
var count_completed = false;
|
148 |
+
$countdown = "<?php
|
149 |
+
echo $the_cs_template_options['launch_date'];
|
150 |
+
echo ' ';
|
151 |
+
echo $the_cs_template_options['launch_time'];
|
152 |
+
?>";
|
153 |
+
jQuery("#secs").countdown($countdown, function (event) {
|
154 |
+
jQuery(this).text(event.strftime('%S'));
|
155 |
+
checkSeconds(jQuery(this).text());
|
156 |
|
157 |
|
158 |
+
});
|
159 |
+
jQuery("#mins")
|
160 |
+
.countdown($countdown, function (event) {
|
161 |
+
jQuery(this).text(
|
162 |
+
event.strftime('%M')
|
163 |
+
);
|
164 |
+
checkMins(jQuery(this).text());
|
165 |
+
});
|
166 |
+
jQuery("#hrs")
|
167 |
+
.countdown($countdown, function (event) {
|
168 |
+
jQuery(this).text(
|
169 |
+
event.strftime('%H')
|
170 |
+
);
|
171 |
+
checkHours(jQuery(this).text());
|
172 |
+
});
|
173 |
+
jQuery("#days")
|
174 |
+
.countdown($countdown, function (event) {
|
175 |
+
jQuery(this).text(
|
176 |
+
event.strftime('%D')
|
177 |
+
);
|
178 |
+
checkDays(jQuery(this).text());
|
179 |
+
});
|
180 |
|
181 |
+
function checkSeconds(sec) {
|
182 |
+
if (sec === '01') {
|
183 |
+
jQuery("#sec-s").addClass('hidden');
|
184 |
+
} else {
|
185 |
+
jQuery("#sec-s").removeClass('hidden');
|
186 |
+
}
|
187 |
+
}
|
188 |
|
189 |
+
function checkMins(min) {
|
190 |
+
if (min === '01') {
|
191 |
+
jQuery("#min-s").addClass('hidden');
|
192 |
+
} else {
|
193 |
+
jQuery("#min-s").removeClass('hidden');
|
194 |
+
}
|
195 |
+
}
|
196 |
+
function checkHours(hrs) {
|
197 |
+
if (hrs === '01') {
|
198 |
+
jQuery("#hrs-s").addClass('hidden');
|
199 |
+
} else {
|
200 |
+
jQuery("#hrs-s").removeClass('hidden');
|
201 |
+
}
|
202 |
+
}
|
203 |
+
function checkDays(days) {
|
204 |
+
if (days === '01') {
|
205 |
+
jQuery("#day-s").addClass('hidden');
|
206 |
+
} else {
|
207 |
+
jQuery("#day-s").removeClass('hidden');
|
208 |
+
}
|
209 |
+
}
|
210 |
+
jQuery(document).ready(function () {
|
211 |
<?php if (!empty($the_cs_template_options['launch_date']) || !empty($the_cs_template_options['launch_time'])): ?>
|
212 |
+
jQuery('#secs').countdown($countdown).on('finish.countdown', function () {
|
213 |
+
jQuery('#countdown').hide();
|
214 |
+
jQuery(".main-container").css('margin-top', '120px');
|
215 |
+
jQuery("#rocket").css('margin-top', '-=120');
|
216 |
+
count_completed = true;
|
217 |
|
218 |
+
jQuery('#rocket').addClass('animated bounceOutUp');
|
219 |
+
setTimeout(function () {
|
220 |
+
jQuery("#rocket").css('margin-top', '-75px');
|
221 |
+
jQuery('#rocket').removeClass('bounceOutUp');
|
222 |
+
jQuery('#rocket').addClass('bounceInUp');
|
223 |
+
}, 3000);
|
224 |
+
});
|
225 |
<?php endif; ?>
|
226 |
+
});
|
227 |
|
228 |
+
jQuery('.subscribe-btn').on('click', function () {
|
229 |
+
subscribe();
|
230 |
+
});
|
231 |
+
jQuery('#cs_email').on('keypress', function (e) {
|
232 |
+
if (e.which == 13) {
|
233 |
+
subscribe();
|
234 |
+
}
|
235 |
+
});
|
236 |
|
237 |
+
function subscribe() {
|
238 |
+
jQuery('.subscribe-btn, #cs_email').attr('disabled', true);
|
239 |
+
jQuery.ajax({
|
240 |
+
url: '<?php echo admin_url('admin-ajax.php'); ?>',
|
241 |
+
data: {action: 'subscribe_email', cs_email: jQuery("#cs_email").val()},
|
242 |
+
dataType: 'json',
|
243 |
+
success: function (data) {
|
244 |
+
if (data['error']) {
|
245 |
+
jQuery('.error-msg #error-msg-text').html(data['message']);
|
246 |
+
jQuery('.error-msg').removeClass('hidden');
|
247 |
+
jQuery('.error-msg').addClass('animated fadeIn');
|
248 |
+
function hideMsg() {
|
249 |
+
jQuery('.error-msg').addClass('fadeOut');
|
250 |
+
}
|
251 |
+
setTimeout(hideMsg, 4000);
|
252 |
+
function showMsg() {
|
253 |
+
jQuery('.error-msg').addClass('hidden');
|
254 |
+
jQuery('.error-msg').removeClass('animated fadeIn fadeOut');
|
255 |
+
}
|
256 |
+
setTimeout(showMsg, 4500);
|
257 |
+
jQuery('.subscribe-btn, #cs_email').attr('disabled', false);
|
258 |
+
} else {
|
259 |
+
jQuery('.subscribe').addClass('animated fadeOutDown');
|
260 |
+
jQuery('.thankyou').removeClass('hidden');
|
261 |
+
jQuery('.thankyou').addClass('animated fadeIn');
|
262 |
+
}
|
263 |
+
}
|
264 |
+
});
|
265 |
+
}
|
266 |
+
jQuery(function ($) {
|
267 |
+
$('#rocket').hover(function () {
|
268 |
+
$(this).animate({'margin-top': "-=50"});
|
269 |
+
}, function () {
|
270 |
+
if (count_completed) {
|
271 |
+
$(this).animate({'margin-top': "30px"});
|
272 |
+
} else {
|
273 |
+
$(this).animate({'margin-top': "150px"});
|
274 |
+
}
|
275 |
+
});
|
276 |
+
});
|
277 |
</script>
|
278 |
+
<?php igniteup_footer(); ?>
|
279 |
</body>
|
280 |
</html>
|
includes/templates/offline.php
CHANGED
@@ -2,83 +2,85 @@
|
|
2 |
|
3 |
function igniteup_define_template_offline($templates) {
|
4 |
$templates['offline'] = array(
|
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 |
return $templates;
|
73 |
}
|
74 |
|
75 |
add_filter('igniteup_get_templates', 'igniteup_define_template_offline');
|
76 |
|
77 |
-
function
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
82 |
}
|
83 |
|
84 |
-
add_action('
|
2 |
|
3 |
function igniteup_define_template_offline($templates) {
|
4 |
$templates['offline'] = array(
|
5 |
+
'name' => 'Offline',
|
6 |
+
'folder_name' => 'offline',
|
7 |
+
'options' => array(
|
8 |
+
'logo' => array(
|
9 |
+
'type' => 'image',
|
10 |
+
'label' => __('Logo (Transparent)', CSCS_TEXT_DOMAIN),
|
11 |
+
'def' => plugins_url("offline/img/rockyton_color.png", __FILE__),
|
12 |
+
'description' => __('Recommended size: 250px x 90px - (Keep it empty to hide logo)', CSCS_TEXT_DOMAIN),
|
13 |
+
),
|
14 |
+
'bg_color' => array(
|
15 |
+
'type' => 'color-picker',
|
16 |
+
'label' => __('Background Color', CSCS_TEXT_DOMAIN),
|
17 |
+
'def' => '#303030',
|
18 |
+
'placeholder' => '#28BB9B',
|
19 |
+
'description' => __('This will be the background color.', CSCS_TEXT_DOMAIN),
|
20 |
+
),
|
21 |
+
'bg_image' => array(
|
22 |
+
'type' => 'image',
|
23 |
+
'label' => __('Background Image', CSCS_TEXT_DOMAIN),
|
24 |
+
'def' => '',
|
25 |
+
'placeholder' => '',
|
26 |
+
'description' => __('Page background image. (Recommended size: 1920px x 1080px)', CSCS_TEXT_DOMAIN),
|
27 |
+
),
|
28 |
+
'font_color' => array(
|
29 |
+
'type' => 'color-picker',
|
30 |
+
'label' => __('Font Color', CSCS_TEXT_DOMAIN),
|
31 |
+
'def' => '#fff',
|
32 |
+
'placeholder' => '#FFFFFF',
|
33 |
+
'description' => __('This will be the font color', CSCS_TEXT_DOMAIN),
|
34 |
+
),
|
35 |
+
'link_color' => array(
|
36 |
+
'type' => 'color-picker',
|
37 |
+
'label' => __('Link Color', CSCS_TEXT_DOMAIN),
|
38 |
+
'def' => '#f1c40f',
|
39 |
+
'placeholder' => '#f1c40f',
|
40 |
+
'description' => __('This will be the hover color', CSCS_TEXT_DOMAIN),
|
41 |
+
),
|
42 |
+
'title_top' => array(
|
43 |
+
'type' => 'text',
|
44 |
+
'label' => __('Title Top', CSCS_TEXT_DOMAIN),
|
45 |
+
'def' => __('Website is offline', CSCS_TEXT_DOMAIN),
|
46 |
+
'placeholder' => __('Website is offline', CSCS_TEXT_DOMAIN),
|
47 |
+
'description' => __('Text above the main title', CSCS_TEXT_DOMAIN),
|
48 |
+
),
|
49 |
+
'paragraph' => array(
|
50 |
+
'type' => 'textarea',
|
51 |
+
'label' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
52 |
+
'def' => __('sorry for the inconvenience <br> we will come with new experience.', CSCS_TEXT_DOMAIN),
|
53 |
+
'placeholder' => __('Paragraph Text', CSCS_TEXT_DOMAIN),
|
54 |
+
'description' => __('This will be the paragraph text, you can use html tags here.', CSCS_TEXT_DOMAIN),
|
55 |
+
),
|
56 |
+
'contact' => array(
|
57 |
+
'type' => 'text',
|
58 |
+
'label' => __('Contact text', CSCS_TEXT_DOMAIN),
|
59 |
+
'def' => __('contact site admin:', CSCS_TEXT_DOMAIN),
|
60 |
+
'placeholder' => __('contact site admin:', CSCS_TEXT_DOMAIN),
|
61 |
+
'description' => __('Contact information label', CSCS_TEXT_DOMAIN),
|
62 |
+
),
|
63 |
+
'email' => array(
|
64 |
+
'type' => 'email',
|
65 |
+
'label' => __('Contact email', CSCS_TEXT_DOMAIN),
|
66 |
+
'def' => 'contact@email.com',
|
67 |
+
'placeholder' => 'contact@email.com',
|
68 |
+
'description' => __('Your email address', CSCS_TEXT_DOMAIN),
|
69 |
+
),
|
70 |
+
)
|
71 |
);
|
72 |
return $templates;
|
73 |
}
|
74 |
|
75 |
add_filter('igniteup_get_templates', 'igniteup_define_template_offline');
|
76 |
|
77 |
+
function igniteup_offline_styles() {
|
78 |
+
?>
|
79 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/bootstrap.min.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
80 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-montserrat.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
81 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/css/font-biryani.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
82 |
+
<link rel='stylesheet' href='<?php echo plugins_url('includes/templates/offline/css/main.css', CSCS_FILE) ?>' type='text/css' media='all' />
|
83 |
+
<?php
|
84 |
}
|
85 |
|
86 |
+
add_action('igniteup_styles_offline', 'igniteup_offline_styles');
|
includes/templates/offline/css/main.css
CHANGED
@@ -13,7 +13,7 @@ body{
|
|
13 |
font-size: 60px;
|
14 |
letter-spacing: -2px;
|
15 |
line-height: 0.98;
|
16 |
-
margin-bottom:
|
17 |
}
|
18 |
.trans{
|
19 |
opacity: 0.75;
|
@@ -25,7 +25,7 @@ body{
|
|
25 |
}
|
26 |
.logo{
|
27 |
margin:0 auto;
|
28 |
-
margin-bottom:
|
29 |
display: block;
|
30 |
}
|
31 |
.contact{
|
13 |
font-size: 60px;
|
14 |
letter-spacing: -2px;
|
15 |
line-height: 0.98;
|
16 |
+
margin-bottom: 25px;
|
17 |
}
|
18 |
.trans{
|
19 |
opacity: 0.75;
|
25 |
}
|
26 |
.logo{
|
27 |
margin:0 auto;
|
28 |
+
margin-bottom: 30px;
|
29 |
display: block;
|
30 |
}
|
31 |
.contact{
|
includes/templates/offline/offline.php
CHANGED
@@ -2,11 +2,10 @@
|
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
5 |
-
<?php wp_head(); ?>
|
6 |
<meta charset="utf-8">
|
7 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
8 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
9 |
-
<title><?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | '. get_bloginfo('name')); ?></title>
|
10 |
|
11 |
<style>
|
12 |
.main-container a{
|
@@ -16,24 +15,26 @@
|
|
16 |
a:hover{
|
17 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
18 |
}
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
36 |
</style>
|
|
|
37 |
</head>
|
38 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
39 |
<div class="container-fluid main-container">
|
@@ -46,36 +47,36 @@
|
|
46 |
<div class="row">
|
47 |
<div class="col-sm-12 ">
|
48 |
<div class="title-top text-center">
|
49 |
-
|
50 |
</div>
|
51 |
</div>
|
52 |
</div>
|
53 |
<div class="row">
|
54 |
<div class="col-lg-6 col-lg-offset-3 col-sm-12">
|
55 |
<div class="text-center sub-text trans">
|
56 |
-
|
57 |
</div>
|
58 |
<p class="text-center contact trans">
|
59 |
-
|
60 |
</p>
|
61 |
</div>
|
62 |
</div>
|
63 |
<div class="row">
|
64 |
<div class="col-sm-6 col-sm-offset-3">
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
74 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
75 |
</div>
|
76 |
</div>
|
77 |
</div>
|
78 |
</div>
|
79 |
-
|
80 |
</body>
|
81 |
</html>
|
2 |
<!DOCTYPE html>
|
3 |
<html lang="en">
|
4 |
<head>
|
|
|
5 |
<meta charset="utf-8">
|
6 |
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
7 |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
8 |
+
<title><?php echo (!empty($the_cs_template_options["general_cs_page_title"]) ? $the_cs_template_options["general_cs_page_title"] : 'Almost Ready to Launch | ' . get_bloginfo('name')); ?></title>
|
9 |
|
10 |
<style>
|
11 |
.main-container a{
|
15 |
a:hover{
|
16 |
color:<?php echo $the_cs_template_options['link_color']; ?> !important;
|
17 |
}
|
18 |
+
<?php if (!empty($the_cs_template_options['bg_image'])): ?>
|
19 |
+
body::after{
|
20 |
+
content: '';
|
21 |
+
background: url('<?php echo $the_cs_template_options['bg_image']; ?>');
|
22 |
+
opacity: 0.5;
|
23 |
+
top: 0px;
|
24 |
+
left: 0px;
|
25 |
+
bottom: 0px;
|
26 |
+
right: 0px;
|
27 |
+
position: fixed;
|
28 |
+
z-index: -1;
|
29 |
+
background-size:cover;
|
30 |
+
}
|
31 |
+
body{
|
32 |
+
background: #000 !important;
|
33 |
+
}
|
34 |
+
<?php endif; ?>
|
35 |
+
|
36 |
</style>
|
37 |
+
<?php igniteup_head(); ?>
|
38 |
</head>
|
39 |
<body style="background: <?php echo $the_cs_template_options['bg_color']; ?>; color:<?php echo $the_cs_template_options['font_color']; ?>;">
|
40 |
<div class="container-fluid main-container">
|
47 |
<div class="row">
|
48 |
<div class="col-sm-12 ">
|
49 |
<div class="title-top text-center">
|
50 |
+
<?php echo $the_cs_template_options['title_top']; ?>
|
51 |
</div>
|
52 |
</div>
|
53 |
</div>
|
54 |
<div class="row">
|
55 |
<div class="col-lg-6 col-lg-offset-3 col-sm-12">
|
56 |
<div class="text-center sub-text trans">
|
57 |
+
<?php echo $the_cs_template_options['paragraph']; ?>
|
58 |
</div>
|
59 |
<p class="text-center contact trans">
|
60 |
+
<?php echo $the_cs_template_options['contact']; ?> <a href="mailto:<?php echo $the_cs_template_options['email']; ?>" > <?php echo $the_cs_template_options['email']; ?> </a>
|
61 |
</p>
|
62 |
</div>
|
63 |
</div>
|
64 |
<div class="row">
|
65 |
<div class="col-sm-6 col-sm-offset-3">
|
66 |
+
<?php
|
67 |
+
$powered_by = $the_cs_template_options['general_powered_by'];
|
68 |
+
if ($powered_by == 1) {
|
69 |
+
$class = "visible";
|
70 |
+
} else {
|
71 |
+
$class = "hidden";
|
72 |
+
}
|
73 |
+
?>
|
74 |
<div class="<?php echo $class; ?> text-center" id="powered-by">
|
75 |
Powered by <a href="https://wordpress.org/plugins/igniteup/" target="_blank">IgniteUp</a>
|
76 |
</div>
|
77 |
</div>
|
78 |
</div>
|
79 |
</div>
|
80 |
+
<?php igniteup_footer(); ?>
|
81 |
</body>
|
82 |
</html>
|
includes/views/temp-general-options.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
wp_enqueue_media();
|
6 |
|
7 |
function check_checkboxes($isTrue) {
|
8 |
-
|
9 |
}
|
10 |
?>
|
11 |
<div class="main-row">
|
@@ -16,7 +16,7 @@
|
|
16 |
<label><?php _e('Enable / Disable', CSCS_TEXT_DOMAIN); ?></label>
|
17 |
</th>
|
18 |
<td>
|
19 |
-
|
20 |
<label><input class="igniteup-checkbox-switch" type="checkbox" data-on-text="Enable" data-off-text="Disable" name="<?php echo $cs_enable_name; ?>" value="1" <?php check_checkboxes(get_option($cs_enable_name) == '1'); ?>> <?php _e('Enable Coming Soon or Site Offline', CSCS_TEXT_DOMAIN); ?></label>
|
21 |
</td>
|
22 |
</tr>
|
@@ -24,15 +24,17 @@
|
|
24 |
<tr>
|
25 |
<th><label><?php _e('Skip Page For', CSCS_TEXT_DOMAIN); ?></label></th>
|
26 |
<td>
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
<input type="hidden" name="<?php echo CSCS_GENEROPTION_PREFIX . 'skipfor'; ?>" id="skip_for_value" value='<?php echo $skipfor; ?>'>
|
37 |
<p class="description"><?php _e('Select user roles to skip maintenance mode page.', CSCS_TEXT_DOMAIN); ?></p>
|
38 |
</td>
|
@@ -41,19 +43,19 @@
|
|
41 |
<tr>
|
42 |
<th><label><?php _e('Skip with Secret URL', CSCS_TEXT_DOMAIN); ?></label></th>
|
43 |
<td>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
<span style="<?php echo $skipWithGetRequest ? 'display:none;' : '' ?>"><input type="text" id="ign-input-get-to-skip" name="<?php echo CSCS_GENEROPTION_PREFIX . 'skip_with_get_request'; ?>" placeholder="<?php echo rand(100000000,9999999999999)?>" value="<?php echo $skipWithGetRequest ?>"><button type="button" id="ign-button-generate-get-to-skip" class="button button-secondary">Generate</button></span>
|
57 |
<p class="description"><?php _e('Send this secret unique URL to anyone if you need them to skip the coming soon page.', CSCS_TEXT_DOMAIN); ?></p>
|
58 |
</td>
|
59 |
</tr>
|
@@ -72,7 +74,7 @@
|
|
72 |
<label><?php _e('Enable 503 Status', CSCS_TEXT_DOMAIN); ?></label>
|
73 |
</th>
|
74 |
<td>
|
75 |
-
|
76 |
<label><input type="checkbox" class="igniteup-checkbox-switch" name="<?php echo $cs_status_name; ?>" value="1" <?php check_checkboxes(get_option($cs_status_name, '1') == '1'); ?>> <?php _e('Enable 503 header response', CSCS_TEXT_DOMAIN); ?></label>
|
77 |
<p class="description"><?php _e('Enable status 503 header response in the page to notify search engines that your site is down for maintenance.', CSCS_TEXT_DOMAIN); ?></p>
|
78 |
</td>
|
@@ -82,7 +84,7 @@
|
|
82 |
<tr>
|
83 |
<th><label><?php _e('Page Title', CSCS_TEXT_DOMAIN); ?></label></th>
|
84 |
<td>
|
85 |
-
|
86 |
<input type="text" class="regular-text" placeholder="<?php _e('Page Title', CSCS_TEXT_DOMAIN); ?>" name='<?php echo $pg_title_name; ?>' value='<?php echo get_option($pg_title_name); ?>'>
|
87 |
<p><?php _e('This will be the title of the coming soon page.', CSCS_TEXT_DOMAIN); ?></p>
|
88 |
</td>
|
@@ -92,7 +94,7 @@
|
|
92 |
<th><label><?php _e('Favicon', CSCS_TEXT_DOMAIN); ?></label></th>
|
93 |
<td>
|
94 |
<div class="uploader">
|
95 |
-
|
96 |
<input id="<?php echo $favicon_option_name; ?>" class="regular-text" name="<?php echo $favicon_option_name; ?>" type="text" value="<?php echo get_option($favicon_option_name, ''); ?>" />
|
97 |
<input id="<?php echo $favicon_option_name; ?>_button" class="button cscs_uploadbutton" data-input="<?php echo $favicon_option_name; ?>" type="submit" value="<?php _e('Upload', CSCS_TEXT_DOMAIN); ?>" />
|
98 |
<p class="description"><?php _e('Recommended size is 16x16 or 32x32. Use only ICO or PNG file.<br>May not be working if your theme or any other plugin is setting a favicon.', CSCS_TEXT_DOMAIN); ?></p>
|
@@ -103,7 +105,7 @@
|
|
103 |
<tr>
|
104 |
<th><label><?php _e('Custom CSS', CSCS_TEXT_DOMAIN); ?></label></th>
|
105 |
<td>
|
106 |
-
<textarea name="<?php echo CSCS_GENEROPTION_PREFIX . 'customcss'; ?>" cols="50" rows="7"><?php echo get_option(CSCS_GENEROPTION_PREFIX . 'customcss', ''); ?></textarea>
|
107 |
<p class="description"><?php _e('Use custom css to customize front end templates.', CSCS_TEXT_DOMAIN); ?></p>
|
108 |
</td>
|
109 |
</tr>
|
@@ -111,7 +113,7 @@
|
|
111 |
<tr>
|
112 |
<th><label><?php _e('Powered by IgniteUp', CSCS_TEXT_DOMAIN); ?></label></th>
|
113 |
<td>
|
114 |
-
|
115 |
<label><input type="checkbox" class="igniteup-checkbox-switch" data-on-text="Show" data-off-text="Hide" name="<?php echo $cs_powered_by; ?>" value="1" <?php check_checkboxes(get_option($cs_powered_by) == '1'); ?>> <?php _e('Show "Powered by IgniteUp" in the page', CSCS_TEXT_DOMAIN); ?></label>
|
116 |
</td>
|
117 |
</tr>
|
@@ -121,18 +123,18 @@
|
|
121 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', CSCS_TEXT_DOMAIN); ?>">
|
122 |
</p>
|
123 |
</div>
|
124 |
-
|
125 |
</div>
|
126 |
</form>
|
127 |
|
128 |
<script>
|
129 |
jQuery(document).on('change', '.skip_checkbox', function () {
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
});
|
138 |
</script>
|
5 |
wp_enqueue_media();
|
6 |
|
7 |
function check_checkboxes($isTrue) {
|
8 |
+
echo $isTrue ? 'checked="checked"' : '';
|
9 |
}
|
10 |
?>
|
11 |
<div class="main-row">
|
16 |
<label><?php _e('Enable / Disable', CSCS_TEXT_DOMAIN); ?></label>
|
17 |
</th>
|
18 |
<td>
|
19 |
+
<?php $cs_enable_name = CSCS_GENEROPTION_PREFIX . 'enable'; ?>
|
20 |
<label><input class="igniteup-checkbox-switch" type="checkbox" data-on-text="Enable" data-off-text="Disable" name="<?php echo $cs_enable_name; ?>" value="1" <?php check_checkboxes(get_option($cs_enable_name) == '1'); ?>> <?php _e('Enable Coming Soon or Site Offline', CSCS_TEXT_DOMAIN); ?></label>
|
21 |
</td>
|
22 |
</tr>
|
24 |
<tr>
|
25 |
<th><label><?php _e('Skip Page For', CSCS_TEXT_DOMAIN); ?></label></th>
|
26 |
<td>
|
27 |
+
<?php
|
28 |
+
$skipfor = get_option(CSCS_GENEROPTION_PREFIX . 'skipfor');
|
29 |
+
$skip_for_array = empty($skipfor) ? array() : json_decode($skipfor, TRUE);
|
30 |
+
$uroles = get_editable_roles();
|
31 |
+
foreach ($uroles as $slug => $role):
|
32 |
+
?>
|
33 |
+
<label><input type="checkbox" class="skip_checkbox skip-switch" value="<?php echo $slug; ?>" <?php check_checkboxes(in_array($slug, $skip_for_array)); ?>><?php _e($role['name'], CSCS_TEXT_DOMAIN); ?></label>
|
34 |
+
<div class="clearfix"></div>
|
35 |
+
<?php
|
36 |
+
endforeach;
|
37 |
+
?>
|
38 |
<input type="hidden" name="<?php echo CSCS_GENEROPTION_PREFIX . 'skipfor'; ?>" id="skip_for_value" value='<?php echo $skipfor; ?>'>
|
39 |
<p class="description"><?php _e('Select user roles to skip maintenance mode page.', CSCS_TEXT_DOMAIN); ?></p>
|
40 |
</td>
|
43 |
<tr>
|
44 |
<th><label><?php _e('Skip with Secret URL', CSCS_TEXT_DOMAIN); ?></label></th>
|
45 |
<td>
|
46 |
+
<?php $skipWithGetRequest = get_option(CSCS_GENEROPTION_PREFIX . 'skip_with_get_request', ''); ?>
|
47 |
+
<?php if ($skipWithGetRequest): ?>
|
48 |
+
<a id="ign-anchor-skip-with-get-link" href="<?php echo get_site_url() . "?ign_skip=$skipWithGetRequest" ?>" target="_blank">
|
49 |
+
<?php endif; ?>
|
50 |
|
51 |
+
<?php echo get_site_url(); ?>/?ign_skip=<span id="ign-anchor-skip-with-get-link-slug"><?php echo $skipWithGetRequest ?></span>
|
52 |
|
53 |
+
<?php if ($skipWithGetRequest): ?>
|
54 |
+
</a>
|
55 |
+
<button type="button" id="ign-button-edit-skip-with-get" class="button button-secondary">Reset</button>
|
56 |
+
<?php endif; ?>
|
57 |
|
58 |
+
<span style="<?php echo $skipWithGetRequest ? 'display:none;' : '' ?>"><input type="text" id="ign-input-get-to-skip" name="<?php echo CSCS_GENEROPTION_PREFIX . 'skip_with_get_request'; ?>" placeholder="<?php echo rand(100000000, 9999999999999) ?>" value="<?php echo $skipWithGetRequest ?>"><button type="button" id="ign-button-generate-get-to-skip" class="button button-secondary">Generate</button></span>
|
59 |
<p class="description"><?php _e('Send this secret unique URL to anyone if you need them to skip the coming soon page.', CSCS_TEXT_DOMAIN); ?></p>
|
60 |
</td>
|
61 |
</tr>
|
74 |
<label><?php _e('Enable 503 Status', CSCS_TEXT_DOMAIN); ?></label>
|
75 |
</th>
|
76 |
<td>
|
77 |
+
<?php $cs_status_name = CSCS_GENEROPTION_PREFIX . 'send_status'; ?>
|
78 |
<label><input type="checkbox" class="igniteup-checkbox-switch" name="<?php echo $cs_status_name; ?>" value="1" <?php check_checkboxes(get_option($cs_status_name, '1') == '1'); ?>> <?php _e('Enable 503 header response', CSCS_TEXT_DOMAIN); ?></label>
|
79 |
<p class="description"><?php _e('Enable status 503 header response in the page to notify search engines that your site is down for maintenance.', CSCS_TEXT_DOMAIN); ?></p>
|
80 |
</td>
|
84 |
<tr>
|
85 |
<th><label><?php _e('Page Title', CSCS_TEXT_DOMAIN); ?></label></th>
|
86 |
<td>
|
87 |
+
<?php $pg_title_name = CSCS_GENEROPTION_PREFIX . 'cs_page_title'; ?>
|
88 |
<input type="text" class="regular-text" placeholder="<?php _e('Page Title', CSCS_TEXT_DOMAIN); ?>" name='<?php echo $pg_title_name; ?>' value='<?php echo get_option($pg_title_name); ?>'>
|
89 |
<p><?php _e('This will be the title of the coming soon page.', CSCS_TEXT_DOMAIN); ?></p>
|
90 |
</td>
|
94 |
<th><label><?php _e('Favicon', CSCS_TEXT_DOMAIN); ?></label></th>
|
95 |
<td>
|
96 |
<div class="uploader">
|
97 |
+
<?php $favicon_option_name = CSCS_GENEROPTION_PREFIX . 'favicon_url'; ?>
|
98 |
<input id="<?php echo $favicon_option_name; ?>" class="regular-text" name="<?php echo $favicon_option_name; ?>" type="text" value="<?php echo get_option($favicon_option_name, ''); ?>" />
|
99 |
<input id="<?php echo $favicon_option_name; ?>_button" class="button cscs_uploadbutton" data-input="<?php echo $favicon_option_name; ?>" type="submit" value="<?php _e('Upload', CSCS_TEXT_DOMAIN); ?>" />
|
100 |
<p class="description"><?php _e('Recommended size is 16x16 or 32x32. Use only ICO or PNG file.<br>May not be working if your theme or any other plugin is setting a favicon.', CSCS_TEXT_DOMAIN); ?></p>
|
105 |
<tr>
|
106 |
<th><label><?php _e('Custom CSS', CSCS_TEXT_DOMAIN); ?></label></th>
|
107 |
<td>
|
108 |
+
<textarea id="igniteup-general-custom-css-textarea" name="<?php echo CSCS_GENEROPTION_PREFIX . 'customcss'; ?>" cols="50" rows="7"><?php echo get_option(CSCS_GENEROPTION_PREFIX . 'customcss', ''); ?></textarea>
|
109 |
<p class="description"><?php _e('Use custom css to customize front end templates.', CSCS_TEXT_DOMAIN); ?></p>
|
110 |
</td>
|
111 |
</tr>
|
113 |
<tr>
|
114 |
<th><label><?php _e('Powered by IgniteUp', CSCS_TEXT_DOMAIN); ?></label></th>
|
115 |
<td>
|
116 |
+
<?php $cs_powered_by = CSCS_GENEROPTION_PREFIX . 'powered_by'; ?>
|
117 |
<label><input type="checkbox" class="igniteup-checkbox-switch" data-on-text="Show" data-off-text="Hide" name="<?php echo $cs_powered_by; ?>" value="1" <?php check_checkboxes(get_option($cs_powered_by) == '1'); ?>> <?php _e('Show "Powered by IgniteUp" in the page', CSCS_TEXT_DOMAIN); ?></label>
|
118 |
</td>
|
119 |
</tr>
|
123 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', CSCS_TEXT_DOMAIN); ?>">
|
124 |
</p>
|
125 |
</div>
|
126 |
+
<?php include 'temp-siderbar-ad.php' ?>
|
127 |
</div>
|
128 |
</form>
|
129 |
|
130 |
<script>
|
131 |
jQuery(document).on('change', '.skip_checkbox', function () {
|
132 |
+
skip_arr = new Array();
|
133 |
+
jQuery('.skip_checkbox').each(function () {
|
134 |
+
if (jQuery(this).is(':checked')) {
|
135 |
+
skip_arr.push(jQuery(this).val());
|
136 |
+
}
|
137 |
+
});
|
138 |
+
jQuery('#skip_for_value').val(JSON.stringify(skip_arr));
|
139 |
});
|
140 |
</script>
|
includes/views/temp-help.php
CHANGED
@@ -6,8 +6,18 @@
|
|
6 |
<div class="changelog help-page-widget">
|
7 |
<h2><?php _e("What's New?", CSCS_TEXT_DOMAIN); ?></h2>
|
8 |
<ul class="changelog-main-list">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
<li class="main-item">
|
10 |
-
3.2 <
|
11 |
<ul class="changelog-sub-list">
|
12 |
|
13 |
<li>Added feature to whitelist IP addresses to skip coming soon page.</li>
|
@@ -38,6 +48,7 @@
|
|
38 |
|
39 |
<?php
|
40 |
$curr_user = get_current_user_id();
|
|
|
41 |
$subscription_u_meta = get_user_meta($curr_user, 'igniteup_admin_subscribed', TRUE);
|
42 |
if ($subscription_u_meta != '1'):
|
43 |
?>
|
@@ -45,7 +56,7 @@
|
|
45 |
<h2><?php _e('Subscribe for Updates', CSCS_TEXT_DOMAIN); ?></h2>
|
46 |
<p></p>
|
47 |
<span id="ign-hide-after-success">
|
48 |
-
<input type="text" placeholder="<?php _e('Enter your email address' ,CSCS_TEXT_DOMAIN); ?>" id="igniteup_admin_subscribe_email">
|
49 |
<div class="clearfix"></div>
|
50 |
<button class="button button-primary" id="igniteup_admin_subscribe"><?php _e('Send me updates', CSCS_TEXT_DOMAIN); ?></button>
|
51 |
</span>
|
@@ -83,8 +94,11 @@
|
|
83 |
<p><?php _e('We have more templates for you with improved features like adding YouTube video background, contact forms and location maps.', CSCS_TEXT_DOMAIN); ?></p>
|
84 |
|
85 |
<a href="http://getigniteup.com/templates/?utm_source=help_page&utm_medium=promo_box&utm_campaign=plugin" target="_blank">
|
86 |
-
<div>
|
87 |
-
<img style="width:100%;margin-bottom: 20px;border: 1px solid #eee;" src="<?php echo plugins_url('includes/images/help-get-templates.jpg', CSCS_FILE); ?>">
|
|
|
|
|
|
|
88 |
</div>
|
89 |
</a>
|
90 |
|
6 |
<div class="changelog help-page-widget">
|
7 |
<h2><?php _e("What's New?", CSCS_TEXT_DOMAIN); ?></h2>
|
8 |
<ul class="changelog-main-list">
|
9 |
+
<li class="main-item">
|
10 |
+
3.3 <span><?php _e('NEW!', CSCS_TEXT_DOMAIN); ?></span><a class="blog_read" target="_blank" href="https://getigniteup.com/blog?p=128&utm_source=help_page&utm_medium=changelog&utm_campaign=plugin"><?php _e('Read more >>', CSCS_TEXT_DOMAIN); ?></a>
|
11 |
+
<ul class="changelog-sub-list">
|
12 |
+
<li>No more style conflicts. Removed the support for wp_head and wp_footer by default in themes. Action was taken due to large complaints about the CSS and JS conflicts from other plugins.</li>
|
13 |
+
<li>Fixed some bugs from template front-ends.</li>
|
14 |
+
<li>Improved the mobile responsiveness in default templates further.</li>
|
15 |
+
<li>Added a code editor to Custom CSS option field.</li>
|
16 |
+
<li>Add all available WordPress user roles as the options for Skipping setting.</li>
|
17 |
+
</ul>
|
18 |
+
</li>
|
19 |
<li class="main-item">
|
20 |
+
3.2 <a class="blog_read" target="_blank" href="https://getigniteup.com/blog?p=91&utm_source=help_page&utm_medium=changelog&utm_campaign=plugin"><?php _e('Read more >>', CSCS_TEXT_DOMAIN); ?></a>
|
21 |
<ul class="changelog-sub-list">
|
22 |
|
23 |
<li>Added feature to whitelist IP addresses to skip coming soon page.</li>
|
48 |
|
49 |
<?php
|
50 |
$curr_user = get_current_user_id();
|
51 |
+
$curr_user_data = get_userdata($curr_user);
|
52 |
$subscription_u_meta = get_user_meta($curr_user, 'igniteup_admin_subscribed', TRUE);
|
53 |
if ($subscription_u_meta != '1'):
|
54 |
?>
|
56 |
<h2><?php _e('Subscribe for Updates', CSCS_TEXT_DOMAIN); ?></h2>
|
57 |
<p></p>
|
58 |
<span id="ign-hide-after-success">
|
59 |
+
<input type="text" placeholder="<?php _e('Enter your email address' ,CSCS_TEXT_DOMAIN); ?>" value="<?php echo $curr_user_data->user_email; ?>" id="igniteup_admin_subscribe_email">
|
60 |
<div class="clearfix"></div>
|
61 |
<button class="button button-primary" id="igniteup_admin_subscribe"><?php _e('Send me updates', CSCS_TEXT_DOMAIN); ?></button>
|
62 |
</span>
|
94 |
<p><?php _e('We have more templates for you with improved features like adding YouTube video background, contact forms and location maps.', CSCS_TEXT_DOMAIN); ?></p>
|
95 |
|
96 |
<a href="http://getigniteup.com/templates/?utm_source=help_page&utm_medium=promo_box&utm_campaign=plugin" target="_blank">
|
97 |
+
<div class="igniteup-promo-temp-wrapper">
|
98 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-1" style="width:100%;margin-bottom: 20px;border: 1px solid #eee;" src="<?php echo plugins_url('includes/images/help-get-templates-1.jpg', CSCS_FILE); ?>">
|
99 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-2" style="width:100%;margin-bottom: 20px;border: 1px solid #eee;display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-2.jpg', CSCS_FILE); ?>">
|
100 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-3" style="width:100%;margin-bottom: 20px;border: 1px solid #eee;display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-3.jpg', CSCS_FILE); ?>">
|
101 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-4" style="width:100%;margin-bottom: 20px;border: 1px solid #eee;display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-4.jpg', CSCS_FILE); ?>">
|
102 |
</div>
|
103 |
</a>
|
104 |
|
includes/views/temp-siderbar-ad.php
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
-
<div class="igniteup-
|
2 |
<a href="http://getigniteup.com/templates/?utm_source=banner&utm_medium=get_templates&utm_campaign=plugin" target="_blank">
|
3 |
<img src="<?php echo plugin_dir_url(CSCS_FILE) . 'includes/images/get-templates-1.jpg'; ?>" style="width:100%;">
|
4 |
</a>
|
5 |
<!--Add another-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
</div>
|
7 |
-
<div class="clearfix"></div>
|
1 |
+
<div class="igniteup-banners align-right">
|
2 |
<a href="http://getigniteup.com/templates/?utm_source=banner&utm_medium=get_templates&utm_campaign=plugin" target="_blank">
|
3 |
<img src="<?php echo plugin_dir_url(CSCS_FILE) . 'includes/images/get-templates-1.jpg'; ?>" style="width:100%;">
|
4 |
</a>
|
5 |
<!--Add another-->
|
6 |
+
|
7 |
+
<a href="http://getigniteup.com/templates/?utm_source=banner&utm_medium=get_templates&utm_campaign=plugin" target="_blank">
|
8 |
+
<div class="igniteup-promo-temp-wrapper">
|
9 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-1" src="<?php echo plugins_url('includes/images/help-get-templates-1.jpg', CSCS_FILE); ?>">
|
10 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-2" style="display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-2.jpg', CSCS_FILE); ?>">
|
11 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-3" style="display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-3.jpg', CSCS_FILE); ?>">
|
12 |
+
<img class="igniteup-promo-temp igniteup-promo-temp-4" style="display: none;" src="<?php echo plugins_url('includes/images/help-get-templates-4.jpg', CSCS_FILE); ?>">
|
13 |
+
</div>
|
14 |
+
</a>
|
15 |
</div>
|
16 |
+
<div class="clearfix"></div>
|
readme.txt
CHANGED
@@ -3,12 +3,12 @@ Contributors: ceylonsystems
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9AFALLGD43AE
|
4 |
Tags: coming soon, coming soon page, construction, landing page, launch, launch page, maintenance, maintenance mode, newsletter, subscribe, offline, unavailable, under construction, wordpress coming soon, wordpress maintenance mode, wordpress under construction, igniter
|
5 |
Requires at least: 3.0.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
Create your Coming Soon, Under Constructions or Maintenance Mode page with a few clicks. More than 9 templates to choose
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -125,6 +125,12 @@ You can post your question / suggestion in the [IgniteUp forums](https://wordpre
|
|
125 |
|
126 |
== Changelog ==
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
= 3.2 =
|
129 |
* New feature to whitelist IP addresses to skip coming soon page
|
130 |
* New feature to set a random and unique URL to skip coming soon page
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9AFALLGD43AE
|
4 |
Tags: coming soon, coming soon page, construction, landing page, launch, launch page, maintenance, maintenance mode, newsletter, subscribe, offline, unavailable, under construction, wordpress coming soon, wordpress maintenance mode, wordpress under construction, igniter
|
5 |
Requires at least: 3.0.1
|
6 |
+
Tested up to: 4.9.4
|
7 |
+
Stable tag: 3.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
Create your Coming Soon, Under Constructions or Maintenance Mode page with a few clicks. More than 9 mobile responsive templates to choose.
|
12 |
|
13 |
== Description ==
|
14 |
|
125 |
|
126 |
== Changelog ==
|
127 |
|
128 |
+
= 3.3 =
|
129 |
+
* No more style conflicts. Removed the support for wp_head and wp_footer by default in themes. Action was taken due to large complaints about the CSS and JS conflicts from other plugins.
|
130 |
+
* Fixed some bugs from template front-ends.
|
131 |
+
* Improved the mobile responsiveness in default templates further.
|
132 |
+
* Add all available WordPress user roles as the options for Skipping setting.
|
133 |
+
|
134 |
= 3.2 =
|
135 |
* New feature to whitelist IP addresses to skip coming soon page
|
136 |
* New feature to set a random and unique URL to skip coming soon page
|