Version Description
- Added: Filter to allow themes to set plugins as "Recommended", the filter is called 'yiht_jetpack_recommended_list'
- Updated: All YITH plugins to latest version
Download this release
Release Info
Developer | yithemes |
Plugin | YITH Essential Kit for WooCommerce #1 |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.9 to 1.1.0
- README.txt +7 -2
- assets/css/list-layout.css +20 -0
- assets/images/badge-recommended.png +0 -0
- init.php +10 -2
- languages/yith-jetpack.mo +0 -0
- languages/yith-jetpack.pot +58 -34
- modules.php +27 -24
- modules/yith-infinite-scrolling/assets/css/frontend.css +27 -0
- modules/yith-infinite-scrolling/assets/js/yith-infs.js +3 -0
- modules/yith-infinite-scrolling/assets/js/yith.infinitescroll.js +16 -11
- modules/yith-infinite-scrolling/init.php +3 -3
- modules/yith-woocommerce-advanced-reviews/assets/images/001.png +0 -0
- modules/yith-woocommerce-advanced-reviews/assets/images/002.png +0 -0
- modules/yith-woocommerce-advanced-reviews/assets/images/003.png +0 -0
- modules/yith-woocommerce-advanced-reviews/assets/images/004.png +0 -0
- modules/yith-woocommerce-advanced-reviews/assets/images/11-bg.png +0 -0
- modules/yith-woocommerce-advanced-reviews/init.php +2 -2
- modules/yith-woocommerce-advanced-reviews/lib/class.yith-advanced-reviews-list-table.php +582 -565
- modules/yith-woocommerce-advanced-reviews/templates/admin/premium.php +113 -82
- modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/lib/codemirror.css +334 -0
- modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/lib/codemirror.js +8822 -0
- modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/mode/css/css.js +772 -0
- modules/yith-woocommerce-ajax-navigation/assets/css/admin.css +13 -1
- modules/yith-woocommerce-ajax-navigation/assets/images/03-bg.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/images/03-icon.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/images/03.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/images/04-bg.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/images/04-icon.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/images/04.png +0 -0
- modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-editor.js +8 -0
- modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-frontend.js +4 -1
- modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-frontend.min.js +6 -5
- modules/yith-woocommerce-ajax-navigation/includes/class.yith-wcan-admin.php +61 -4
- modules/yith-woocommerce-ajax-navigation/includes/class.yith-wcan-frontend.php +10 -6
- modules/yith-woocommerce-ajax-navigation/init.php +2 -2
- modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-it_IT.mo +0 -0
- modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-it_IT.po +139 -159
- modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-tr_TR.mo +0 -0
- modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-tr_TR.po +117 -65
- modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav.pot +119 -67
- modules/yith-woocommerce-ajax-navigation/settings/custom-style-options.php +40 -0
- modules/yith-woocommerce-ajax-navigation/settings/frontend-options.php +61 -0
- modules/yith-woocommerce-ajax-navigation/templates/admin/premium.php +5 -16
- modules/yith-woocommerce-ajax-navigation/widgets/class.yith-wcan-navigation-widget.php +1 -1
- modules/yith-woocommerce-ajax-search/README.txt +306 -0
- modules/yith-woocommerce-ajax-search/class.yith-wcas-admin.php +11 -11
- modules/yith-woocommerce-ajax-search/class.yith-wcas.php +1 -1
- modules/yith-woocommerce-ajax-search/init.php +6 -6
- modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-it_IT.mo +0 -0
- modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-it_IT.po +599 -0
- modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-pt_PT.mo +0 -0
- modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-pt_PT.po +1107 -0
- modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search.pot +233 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/chosen/chosen.css +435 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/codemirror/codemirror.css +260 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/metaboxes.css +609 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_55_c0402a_40x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_55_eeeeee_40x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_100_f8f8f8_1x400.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_35_dddddd_1x400.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_60_eeeeee_1x400.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_inset-hard_75_999999_1x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_inset-soft_50_c9c9c9_1x100.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_3383bb_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_454545_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_70b2e1_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_999999_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_fbc856_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/jquery-ui-1.8.9.custom.css +322 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/yit-plugin-panel.css +653 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/yit-upgrader.css +14 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/chosen/chosen-sprite.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/chosen/chosen-sprite@2x.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/double-sidebar.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/licence-error.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/no-sidebar.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/off.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/on.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/select.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sidebar-left.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sidebar-right.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sleep.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/grey.gif +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/handle.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/orange.gif +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/tooltip.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/spinner.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_222222_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_2e83ff_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_454545_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_888888_256x240.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/x.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/yithemes-icon.png +0 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/ajax-chosen.jquery.js +81 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/ajax-chosen.jquery.min.js +2 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/chosen.jquery.js +1211 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/codemirror/codemirror.js +5799 -0
- modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/codemirror/javascript.js +628 -0
README.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
|
|
4 |
Tags: woocommerce,jetpack,woocommerce jetpack, essential, kit, plugins, plugin, product, e-commerce, ecommerce, commerce, shop, yith, yit, yithemes,yith woocommerce colors and labels variations, colors and labels variations,colors and labels variations jetpack,yith woocommerce zoom magnifier,zoom magnifier,zoom magnifier jetpack,yith woocommerce wishlist,wishlist,wishlist jetpack,yith woocommerce compare,compare,compare jetpack,yith woocommerce ajax product filter,ajax product filter,ajax product filter jetpack,yith woocommerce ajax search,ajax search,ajax search jetpack,yith woocommerce catalog mode,catalog mode,catalog mode jetpack,yith woocommerce order tracking,order tracking,order tracking jetpack, yith woocommerce advanced reviews,advanced reviews,advanced reviews jetpack,yith woocommerce badges management,badges management,badges management jetpack,yith woocommerce cart messages,cart messages,cart messages jetpack,yith woocommerce review reminder,review reminder,review reminder jetpack,yith woocommerce quick view,quick view,quick view jetpack,yith live chat,live chat,live chat jetpack,yith woocommerce eu vat,eu vat,eu vat jetpack,yith woocommerce mailchimp,mailchimp,mailchimp jetpack,yith woocommerce stripe,stripe, stripe jetpack,yith infinite scrolling,infinite scrolling,infinite scrolling jetpack,yith woocommerce request a quote,request a quote,request a quote jetpack,yith woocommerce waiting list,waiting list,waiting list jetpack,yith woocommerce tab manager,tab manager,tab manager jetpack,yith woocommerce multi vendor,multi vendor,multi vendor jetpack,product vendor,products vendor,products vendor jetpack, booster for woocommerce
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 4.2.4
|
7 |
-
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -150,6 +150,11 @@ YITH Essential Kit for WooCommerce #1 will add a new submenu called "YITH Essent
|
|
150 |
|
151 |
== Changelog ==
|
152 |
|
|
|
|
|
|
|
|
|
|
|
153 |
= 1.0.9 =
|
154 |
|
155 |
* Fixed: target attribute on premium link
|
@@ -195,5 +200,5 @@ YITH Essential Kit for WooCommerce #1 will add a new submenu called "YITH Essent
|
|
195 |
|
196 |
== Upgrade Notice ==
|
197 |
|
198 |
-
Last Stable Tag 1.0
|
199 |
|
4 |
Tags: woocommerce,jetpack,woocommerce jetpack, essential, kit, plugins, plugin, product, e-commerce, ecommerce, commerce, shop, yith, yit, yithemes,yith woocommerce colors and labels variations, colors and labels variations,colors and labels variations jetpack,yith woocommerce zoom magnifier,zoom magnifier,zoom magnifier jetpack,yith woocommerce wishlist,wishlist,wishlist jetpack,yith woocommerce compare,compare,compare jetpack,yith woocommerce ajax product filter,ajax product filter,ajax product filter jetpack,yith woocommerce ajax search,ajax search,ajax search jetpack,yith woocommerce catalog mode,catalog mode,catalog mode jetpack,yith woocommerce order tracking,order tracking,order tracking jetpack, yith woocommerce advanced reviews,advanced reviews,advanced reviews jetpack,yith woocommerce badges management,badges management,badges management jetpack,yith woocommerce cart messages,cart messages,cart messages jetpack,yith woocommerce review reminder,review reminder,review reminder jetpack,yith woocommerce quick view,quick view,quick view jetpack,yith live chat,live chat,live chat jetpack,yith woocommerce eu vat,eu vat,eu vat jetpack,yith woocommerce mailchimp,mailchimp,mailchimp jetpack,yith woocommerce stripe,stripe, stripe jetpack,yith infinite scrolling,infinite scrolling,infinite scrolling jetpack,yith woocommerce request a quote,request a quote,request a quote jetpack,yith woocommerce waiting list,waiting list,waiting list jetpack,yith woocommerce tab manager,tab manager,tab manager jetpack,yith woocommerce multi vendor,multi vendor,multi vendor jetpack,product vendor,products vendor,products vendor jetpack, booster for woocommerce
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 4.2.4
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
150 |
|
151 |
== Changelog ==
|
152 |
|
153 |
+
= 1.1.0 =
|
154 |
+
|
155 |
+
* Added: Filter to allow themes to set plugins as "Recommended", the filter is called 'yiht_jetpack_recommended_list'
|
156 |
+
* Updated: All YITH plugins to latest version
|
157 |
+
|
158 |
= 1.0.9 =
|
159 |
|
160 |
* Fixed: target attribute on premium link
|
200 |
|
201 |
== Upgrade Notice ==
|
202 |
|
203 |
+
Last Stable Tag 1.1.0
|
204 |
|
assets/css/list-layout.css
CHANGED
@@ -34,6 +34,14 @@
|
|
34 |
background-color:#971d00;
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.installed,.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.installed:hover {
|
38 |
background-color: green;
|
39 |
cursor: default;
|
@@ -68,6 +76,18 @@
|
|
68 |
z-index: 10;
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
@media screen and (max-width: 1100px) and (min-width: 782px), (max-width: 480px) {
|
72 |
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium {
|
73 |
position: relative;
|
34 |
background-color:#971d00;
|
35 |
}
|
36 |
|
37 |
+
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.toactive {
|
38 |
+
background: #0073aa;
|
39 |
+
}
|
40 |
+
|
41 |
+
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.toactive:hover {
|
42 |
+
background: #005984;
|
43 |
+
}
|
44 |
+
|
45 |
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.installed,.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium.installed:hover {
|
46 |
background-color: green;
|
47 |
cursor: default;
|
76 |
z-index: 10;
|
77 |
}
|
78 |
|
79 |
+
.yith-jetpack a.activate-now.button {
|
80 |
+
background: #0073aa;
|
81 |
+
border-color: #0073aa;
|
82 |
+
color: #ffffff;
|
83 |
+
-webkit-box-shadow: none;
|
84 |
+
box-shadow: none;
|
85 |
+
}
|
86 |
+
|
87 |
+
.yith-jetpack a.activate-now.button:hover {
|
88 |
+
background: #005984;
|
89 |
+
}
|
90 |
+
|
91 |
@media screen and (max-width: 1100px) and (min-width: 782px), (max-width: 480px) {
|
92 |
.yith-jetpack .plugin-card .plugin-action-buttons li > a.btn-premium {
|
93 |
position: relative;
|
assets/images/badge-recommended.png
ADDED
Binary file
|
init.php
CHANGED
@@ -7,7 +7,7 @@ Text Domain: yith-jetpack
|
|
7 |
Domain Path: /languages/
|
8 |
Author: YIThemes
|
9 |
Author URI: http://yithemes.com/
|
10 |
-
Version: 1.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -39,6 +39,14 @@ if ( ! function_exists( 'yith_plugin_registration_hook' ) ) {
|
|
39 |
}
|
40 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
require_once( YJP_DIR. 'yith-jetpack.php' );
|
43 |
|
44 |
-
$
|
|
7 |
Domain Path: /languages/
|
8 |
Author: YIThemes
|
9 |
Author URI: http://yithemes.com/
|
10 |
+
Version: 1.1.0
|
11 |
*/
|
12 |
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
39 |
}
|
40 |
register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
41 |
|
42 |
+
/**
|
43 |
+
* Check if a jetpack module is currently active and try disabling before activating this one
|
44 |
+
*/
|
45 |
+
if ( ! function_exists( 'yith_deactive_jetpack_module' ) ) {
|
46 |
+
require_once 'yith-deactive-module.php';
|
47 |
+
}
|
48 |
+
|
49 |
require_once( YJP_DIR. 'yith-jetpack.php' );
|
50 |
|
51 |
+
global $yith_jetpack_1;
|
52 |
+
$yith_jetpack_1 = new YITH_JetPack( __FILE__ , 'YITH Essential Kit for WooCommerce #1' , 1 ) ;
|
languages/yith-jetpack.mo
ADDED
Binary file
|
languages/yith-jetpack.pot
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YIT Framework\n"
|
4 |
-
"POT-Creation-Date: 2015-09-
|
5 |
-
"PO-Revision-Date: 2015-09-
|
6 |
"Last-Translator: Giustino Borzacchiello <giustinob@gmail.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en\n"
|
@@ -19,49 +19,57 @@ msgstr ""
|
|
19 |
"X-Poedit-SearchPathExcluded-0: plugin-fw\n"
|
20 |
"X-Poedit-SearchPathExcluded-1: modules\n"
|
21 |
|
22 |
-
#: templates/yith-list-plugins.php:
|
|
|
|
|
|
|
|
|
23 |
msgid "Module <strong>activated</strong>."
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: templates/yith-list-plugins.php:
|
27 |
msgid "Module <strong>deactivated</strong>."
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: templates/yith-list-plugins.php:
|
31 |
msgid "Modules <strong>activated</strong>."
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: templates/yith-list-plugins.php:
|
35 |
msgid "Modules <strong>deactivated</strong>."
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: templates/yith-list-plugins.php:
|
39 |
msgid ""
|
40 |
"Here you can activate or deactive some of our plugins to enhance your e-"
|
41 |
"commerce site."
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: templates/yith-list-plugins.php:
|
45 |
#, fuzzy
|
46 |
msgid "Activate all"
|
47 |
msgstr "TUTTI PARI PARI"
|
48 |
|
49 |
-
#: templates/yith-list-plugins.php:
|
50 |
msgid "Deactivate all"
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: templates/yith-list-plugins.php:
|
54 |
msgid "All"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: templates/yith-list-plugins.php:
|
58 |
msgid "Active"
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: templates/yith-list-plugins.php:
|
62 |
msgid "Inactive"
|
63 |
msgstr ""
|
64 |
|
|
|
|
|
|
|
|
|
65 |
#: templates/yith-single-plugin.php:54
|
66 |
#, fuzzy, php-format
|
67 |
msgid "By %s"
|
@@ -78,98 +86,114 @@ msgstr ""
|
|
78 |
msgid "Deactivate"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: templates/yith-single-plugin.php:
|
82 |
#, php-format
|
83 |
msgid "activate %s now"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: templates/yith-single-plugin.php:
|
87 |
#, fuzzy
|
88 |
msgid "Activate"
|
89 |
msgstr "TUTTI PARI PARI"
|
90 |
|
91 |
-
#: templates/yith-single-plugin.php:
|
92 |
#, php-format
|
93 |
msgid "More information about %s"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: templates/yith-single-plugin.php:
|
97 |
msgid "More Details"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: templates/yith-single-plugin.php:
|
101 |
msgid "Premium Installed"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: templates/yith-single-plugin.php:
|
|
|
|
|
|
|
|
|
|
|
105 |
msgid "Premium Version"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: templates/yith-single-plugin.php:
|
109 |
#, php-format
|
110 |
msgid "Premium Version of %s"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: templates/yith-single-plugin.php:
|
114 |
msgid "M j, Y @ H:i"
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: templates/yith-single-plugin.php:
|
118 |
msgid "Last Updated:"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: templates/yith-single-plugin.php:
|
122 |
#, php-format
|
123 |
msgid "%s ago"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: templates/yith-single-plugin.php:
|
127 |
msgctxt "Active plugin installs"
|
128 |
msgid "1+ Million"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: templates/yith-single-plugin.php:
|
132 |
msgctxt "Downloaded"
|
133 |
msgid "1+ Million"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: templates/yith-single-plugin.php:
|
137 |
#, php-format
|
138 |
msgid "%s Download, %s Active Installs"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: yith-jetpack.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
msgid "Plugins List"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: yith-jetpack.php:
|
146 |
msgid "YIT Plugins"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: yith-jetpack.php:
|
150 |
#, php-format
|
151 |
msgid ""
|
152 |
"There are new plugins available on <b>%s</b>, <a href=\"%s\">take a look at "
|
153 |
"them</a> !"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: yith-jetpack.php:
|
157 |
msgid "The module is not valid."
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: yith-jetpack.php:
|
161 |
-
#: yith-jetpack.php:
|
162 |
msgid "Back to modules"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: yith-jetpack.php:
|
166 |
msgid "The module is already activated."
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: yith-jetpack.php:
|
170 |
msgid "Activation of the module is not possible."
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: yith-jetpack.php:
|
174 |
msgid "The module is already deactivated."
|
175 |
msgstr ""
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YIT Framework\n"
|
4 |
+
"POT-Creation-Date: 2015-09-23 17:13+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-09-23 17:13+0100\n"
|
6 |
"Last-Translator: Giustino Borzacchiello <giustinob@gmail.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en\n"
|
19 |
"X-Poedit-SearchPathExcluded-0: plugin-fw\n"
|
20 |
"X-Poedit-SearchPathExcluded-1: modules\n"
|
21 |
|
22 |
+
#: templates/yith-list-plugins.php:18
|
23 |
+
msgid "Sorry, you don't have sufficient permission to access to this page."
|
24 |
+
msgstr ""
|
25 |
+
|
26 |
+
#: templates/yith-list-plugins.php:42
|
27 |
msgid "Module <strong>activated</strong>."
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: templates/yith-list-plugins.php:45
|
31 |
msgid "Module <strong>deactivated</strong>."
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: templates/yith-list-plugins.php:49
|
35 |
msgid "Modules <strong>activated</strong>."
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: templates/yith-list-plugins.php:53
|
39 |
msgid "Modules <strong>deactivated</strong>."
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: templates/yith-list-plugins.php:59
|
43 |
msgid ""
|
44 |
"Here you can activate or deactive some of our plugins to enhance your e-"
|
45 |
"commerce site."
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: templates/yith-list-plugins.php:64
|
49 |
#, fuzzy
|
50 |
msgid "Activate all"
|
51 |
msgstr "TUTTI PARI PARI"
|
52 |
|
53 |
+
#: templates/yith-list-plugins.php:65
|
54 |
msgid "Deactivate all"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: templates/yith-list-plugins.php:75
|
58 |
msgid "All"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: templates/yith-list-plugins.php:76
|
62 |
msgid "Active"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: templates/yith-list-plugins.php:77
|
66 |
msgid "Inactive"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: templates/yith-list-plugins.php:79
|
70 |
+
msgid "Recommended"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
#: templates/yith-single-plugin.php:54
|
74 |
#, fuzzy, php-format
|
75 |
msgid "By %s"
|
86 |
msgid "Deactivate"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: templates/yith-single-plugin.php:72
|
90 |
#, php-format
|
91 |
msgid "activate %s now"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: templates/yith-single-plugin.php:72
|
95 |
#, fuzzy
|
96 |
msgid "Activate"
|
97 |
msgstr "TUTTI PARI PARI"
|
98 |
|
99 |
+
#: templates/yith-single-plugin.php:79
|
100 |
#, php-format
|
101 |
msgid "More information about %s"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: templates/yith-single-plugin.php:79
|
105 |
msgid "More Details"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: templates/yith-single-plugin.php:85
|
109 |
msgid "Premium Installed"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: templates/yith-single-plugin.php:90
|
113 |
+
#, fuzzy
|
114 |
+
msgid "Activate Premium"
|
115 |
+
msgstr "TUTTI PARI PARI"
|
116 |
+
|
117 |
+
#: templates/yith-single-plugin.php:95
|
118 |
msgid "Premium Version"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: templates/yith-single-plugin.php:99
|
122 |
#, php-format
|
123 |
msgid "Premium Version of %s"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: templates/yith-single-plugin.php:102
|
127 |
msgid "M j, Y @ H:i"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: templates/yith-single-plugin.php:141
|
131 |
msgid "Last Updated:"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: templates/yith-single-plugin.php:142
|
135 |
#, php-format
|
136 |
msgid "%s ago"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: templates/yith-single-plugin.php:153
|
140 |
msgctxt "Active plugin installs"
|
141 |
msgid "1+ Million"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: templates/yith-single-plugin.php:160
|
145 |
msgctxt "Downloaded"
|
146 |
msgid "1+ Million"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: templates/yith-single-plugin.php:165
|
150 |
#, php-format
|
151 |
msgid "%s Download, %s Active Installs"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: yith-jetpack.php:144
|
155 |
+
#, php-format
|
156 |
+
msgid ""
|
157 |
+
"Some plugins as %s, %s , etc.. have been removed from this plugins list. You "
|
158 |
+
"can activate or deactive it from <a href=\"%s\">%s</a> panel."
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: yith-jetpack.php:147
|
162 |
+
msgid "Dismiss this notice"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: yith-jetpack.php:217
|
166 |
msgid "Plugins List"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: yith-jetpack.php:542
|
170 |
msgid "YIT Plugins"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: yith-jetpack.php:580
|
174 |
#, php-format
|
175 |
msgid ""
|
176 |
"There are new plugins available on <b>%s</b>, <a href=\"%s\">take a look at "
|
177 |
"them</a> !"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: yith-jetpack.php:630 yith-jetpack.php:662
|
181 |
msgid "The module is not valid."
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: yith-jetpack.php:630 yith-jetpack.php:635 yith-jetpack.php:639
|
185 |
+
#: yith-jetpack.php:662 yith-jetpack.php:667 yith-jetpack.php:671
|
186 |
msgid "Back to modules"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: yith-jetpack.php:635
|
190 |
msgid "The module is already activated."
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: yith-jetpack.php:639 yith-jetpack.php:671
|
194 |
msgid "Activation of the module is not possible."
|
195 |
msgstr ""
|
196 |
|
197 |
+
#: yith-jetpack.php:667
|
198 |
msgid "The module is already deactivated."
|
199 |
msgstr ""
|
modules.php
CHANGED
@@ -3,147 +3,150 @@
|
|
3 |
return apply_filters( 'yith_jetpack_modules1',
|
4 |
array(
|
5 |
|
6 |
-
'yith-woocommerce-wishlist'
|
7 |
'name' => 'YITH WooCommerce Wishlist',
|
8 |
'slug' => 'yith-woocommerce-wishlist',
|
9 |
'premium_constat' => 'YITH_WCWL_PREMIUM'
|
10 |
),
|
11 |
|
12 |
-
'yith-woocommerce-ajax-search'
|
13 |
'name' => 'YITH WooCommerce Ajax Search',
|
14 |
'slug' => 'yith-woocommerce-ajax-search',
|
15 |
'premium_constat' => 'YITH_WCAS_PREMIUM'
|
16 |
),
|
17 |
|
18 |
-
'yith-woocommerce-cart-messages'
|
19 |
'name' => 'YITH WooCommerce Cart Message',
|
20 |
'slug' => 'yith-woocommerce-cart-messages',
|
21 |
'file' => 'yith-cart-messages.php',
|
22 |
'premium_constat' => 'YITH_YWCM_PREMIUM'
|
23 |
),
|
24 |
|
25 |
-
'yith-woocommerce-ajax-navigation'
|
26 |
'name' => 'YITH WooCommerce Ajax Navigation',
|
27 |
'slug' => 'yith-woocommerce-ajax-navigation',
|
28 |
'premium_constat' => 'YITH_WCAN_PREMIUM',
|
29 |
'premium-url' => 'yith-woocommerce-ajax-product-filter',
|
|
|
30 |
),
|
31 |
|
32 |
-
'yith-woocommerce-zoom-magnifier'
|
33 |
'name' => 'YITH WooCommerce Zoom Magnifier',
|
34 |
'slug' => 'yith-woocommerce-zoom-magnifier',
|
35 |
'premium_constat' => 'YITH_YWZM_PREMIUM'
|
36 |
),
|
37 |
|
38 |
-
'yith-woocommerce-request-a-quote'
|
39 |
'name' => 'YITH WooCommerce Request a Quote',
|
40 |
'slug' => 'yith-woocommerce-request-a-quote',
|
41 |
'file' => 'yith-woocommerce-request-a-quote.php',
|
42 |
'premium_constat' => 'YITH_YWRAQ_PREMIUM'
|
43 |
),
|
44 |
|
45 |
-
'yith-woocommerce-advanced-reviews'
|
46 |
'name' => 'YITH Woocommerce Advanced Reviews',
|
47 |
'slug' => 'yith-woocommerce-advanced-reviews',
|
48 |
'premium_constat' => 'YITH_YWAR_PREMIUM'
|
49 |
),
|
50 |
|
51 |
-
'yith-woocommerce-compare'
|
52 |
'name' => 'YITH WooCommerce Compare',
|
53 |
'slug' => 'yith-woocommerce-compare',
|
54 |
'premium_constat' => 'YITH_WOOCOMPARE_PREMIUM'
|
55 |
),
|
56 |
|
57 |
-
'yith-woocommerce-catalog-mode'
|
58 |
'name' => 'YITH WooCommerce Catalog Mode',
|
59 |
'slug' => 'yith-woocommerce-catalog-mode',
|
60 |
'premium_constat' => 'YWCTM_PREMIUM'
|
61 |
),
|
62 |
|
63 |
-
'yith-woocommerce-order-tracking'
|
64 |
'name' => 'YITH WooCommerce Order Tracking',
|
65 |
'slug' => 'yith-woocommerce-order-tracking',
|
66 |
'premium_constat' => 'YITH_YWOT_PREMIUM'
|
67 |
),
|
68 |
|
69 |
-
'yith-woocommerce-badges-management'
|
70 |
'name' => 'YITH WooCommerce Badge Management',
|
71 |
'slug' => 'yith-woocommerce-badges-management',
|
72 |
-
'premium_constat' => 'YITH_WCBM_PREMIUM'
|
|
|
73 |
),
|
74 |
|
75 |
-
'yith-woocommerce-review-reminder'
|
76 |
'name' => 'YITH WooCommerce Review Reminder',
|
77 |
'slug' => 'yith-woocommerce-review-reminder',
|
78 |
'premium_constat' => 'YWRR_PREMIUM'
|
79 |
),
|
80 |
|
81 |
-
'yith-woocommerce-quick-view'
|
82 |
'name' => 'YITH Woocommerce Quick View',
|
83 |
'slug' => 'yith-woocommerce-quick-view',
|
84 |
'premium_constat' => 'YITH_WCQV_PREMIUM'
|
85 |
),
|
86 |
|
87 |
-
'yith-live-chat'
|
88 |
'name' => 'YITH Live Chat',
|
89 |
'slug' => 'yith-live-chat',
|
90 |
'premium_constat' => 'YLC_PREMIUM'
|
91 |
),
|
92 |
|
93 |
-
'yith-woocommerce-eu-vat'
|
94 |
'name' => 'YITH WooCommerce EU VAT',
|
95 |
'slug' => 'yith-woocommerce-eu-vat',
|
96 |
'premium_constat' => 'YITH_YWEV_PREMIUM'
|
97 |
),
|
98 |
|
99 |
-
'yith-woocommerce-mailchimp'
|
100 |
'name' => 'YITH WooCommerce Mailchimp',
|
101 |
'slug' => 'yith-woocommerce-mailchimp',
|
102 |
'premium_constat' => 'YITH_WCMC_PREMIUM_INIT'
|
103 |
),
|
104 |
|
105 |
-
'yith-woocommerce-stripe'
|
106 |
'name' => 'YITH WooCommerce Stripe',
|
107 |
'slug' => 'yith-woocommerce-stripe',
|
108 |
'premium_constat' => 'YITH_WCSTRIPE_PREMIUM'
|
109 |
),
|
110 |
|
111 |
-
'yith-woocommerce-authorizenet-payment-gateway'
|
112 |
'name' => 'YITH WooCommerce Authorize.net Payment Gateway',
|
113 |
'slug' => 'yith-woocommerce-authorizenet-payment-gateway',
|
114 |
'premium-url' => 'yith-woocommerce-authorize-net-payment-gateway',
|
115 |
'premium_constat' => 'YITH_WCAUTHNET_PREMIUM'
|
116 |
),
|
117 |
|
118 |
-
'yith-infinite-scrolling'
|
119 |
'name' => 'YITH Infinite Scrolling',
|
120 |
'slug' => 'yith-infinite-scrolling',
|
121 |
'premium_constat' => 'YITH_INFS_PREMIUM'
|
122 |
),
|
123 |
|
124 |
-
'yith-woocommerce-waiting-list'
|
125 |
'name' => 'YITH WooCommerce Waiting List',
|
126 |
'slug' => 'yith-woocommerce-waiting-list',
|
127 |
'premium_constat' => 'YITH_WCWTL_PREMIUM'
|
128 |
),
|
129 |
|
130 |
-
'yith-woocommerce-tab-manager'
|
131 |
'name' => 'YITH WooCommerce Tab Manager',
|
132 |
'slug' => 'yith-woocommerce-tab-manager',
|
133 |
'premium_constat' => 'YWTM_PREMIUM'
|
134 |
),
|
135 |
|
136 |
-
'yith-woocommerce-product-vendors'
|
137 |
'name' => 'YITH WooCommerce Multi Vendor',
|
138 |
'slug' => 'yith-woocommerce-product-vendors',
|
139 |
'premium_constat' => 'YITH_WPV_PREMIUM'
|
140 |
),
|
141 |
|
142 |
-
'yith-woocommerce-colors-labels-variations'
|
143 |
'name' => 'YITH WooCommerce Color and Label Variations',
|
144 |
'slug' => 'yith-woocommerce-colors-labels-variations',
|
145 |
'premium_constat' => 'YITH_WCCL_PREMIUM',
|
146 |
'premium-url' => 'yith-woocommerce-color-and-label-variations',
|
|
|
147 |
'short_description' => 'The best way to offer a complete overview on all options available for your products: with one plugin only you can add unlimited variations.',
|
148 |
'version' => '1.1.6',
|
149 |
'last_updated' => '2015-08-12',
|
3 |
return apply_filters( 'yith_jetpack_modules1',
|
4 |
array(
|
5 |
|
6 |
+
'yith-woocommerce-wishlist' => array(
|
7 |
'name' => 'YITH WooCommerce Wishlist',
|
8 |
'slug' => 'yith-woocommerce-wishlist',
|
9 |
'premium_constat' => 'YITH_WCWL_PREMIUM'
|
10 |
),
|
11 |
|
12 |
+
'yith-woocommerce-ajax-search' => array(
|
13 |
'name' => 'YITH WooCommerce Ajax Search',
|
14 |
'slug' => 'yith-woocommerce-ajax-search',
|
15 |
'premium_constat' => 'YITH_WCAS_PREMIUM'
|
16 |
),
|
17 |
|
18 |
+
'yith-woocommerce-cart-messages' => array(
|
19 |
'name' => 'YITH WooCommerce Cart Message',
|
20 |
'slug' => 'yith-woocommerce-cart-messages',
|
21 |
'file' => 'yith-cart-messages.php',
|
22 |
'premium_constat' => 'YITH_YWCM_PREMIUM'
|
23 |
),
|
24 |
|
25 |
+
'yith-woocommerce-ajax-navigation' => array(
|
26 |
'name' => 'YITH WooCommerce Ajax Navigation',
|
27 |
'slug' => 'yith-woocommerce-ajax-navigation',
|
28 |
'premium_constat' => 'YITH_WCAN_PREMIUM',
|
29 |
'premium-url' => 'yith-woocommerce-ajax-product-filter',
|
30 |
+
'premium-dir' => 'yith-woocommerce-ajax-product-filter',
|
31 |
),
|
32 |
|
33 |
+
'yith-woocommerce-zoom-magnifier' => array(
|
34 |
'name' => 'YITH WooCommerce Zoom Magnifier',
|
35 |
'slug' => 'yith-woocommerce-zoom-magnifier',
|
36 |
'premium_constat' => 'YITH_YWZM_PREMIUM'
|
37 |
),
|
38 |
|
39 |
+
'yith-woocommerce-request-a-quote' => array(
|
40 |
'name' => 'YITH WooCommerce Request a Quote',
|
41 |
'slug' => 'yith-woocommerce-request-a-quote',
|
42 |
'file' => 'yith-woocommerce-request-a-quote.php',
|
43 |
'premium_constat' => 'YITH_YWRAQ_PREMIUM'
|
44 |
),
|
45 |
|
46 |
+
'yith-woocommerce-advanced-reviews' => array(
|
47 |
'name' => 'YITH Woocommerce Advanced Reviews',
|
48 |
'slug' => 'yith-woocommerce-advanced-reviews',
|
49 |
'premium_constat' => 'YITH_YWAR_PREMIUM'
|
50 |
),
|
51 |
|
52 |
+
'yith-woocommerce-compare' => array(
|
53 |
'name' => 'YITH WooCommerce Compare',
|
54 |
'slug' => 'yith-woocommerce-compare',
|
55 |
'premium_constat' => 'YITH_WOOCOMPARE_PREMIUM'
|
56 |
),
|
57 |
|
58 |
+
'yith-woocommerce-catalog-mode' => array(
|
59 |
'name' => 'YITH WooCommerce Catalog Mode',
|
60 |
'slug' => 'yith-woocommerce-catalog-mode',
|
61 |
'premium_constat' => 'YWCTM_PREMIUM'
|
62 |
),
|
63 |
|
64 |
+
'yith-woocommerce-order-tracking' => array(
|
65 |
'name' => 'YITH WooCommerce Order Tracking',
|
66 |
'slug' => 'yith-woocommerce-order-tracking',
|
67 |
'premium_constat' => 'YITH_YWOT_PREMIUM'
|
68 |
),
|
69 |
|
70 |
+
'yith-woocommerce-badges-management' => array(
|
71 |
'name' => 'YITH WooCommerce Badge Management',
|
72 |
'slug' => 'yith-woocommerce-badges-management',
|
73 |
+
'premium_constat' => 'YITH_WCBM_PREMIUM',
|
74 |
+
'premium-dir' => 'yith-woocommerce-badge-management',
|
75 |
),
|
76 |
|
77 |
+
'yith-woocommerce-review-reminder' => array(
|
78 |
'name' => 'YITH WooCommerce Review Reminder',
|
79 |
'slug' => 'yith-woocommerce-review-reminder',
|
80 |
'premium_constat' => 'YWRR_PREMIUM'
|
81 |
),
|
82 |
|
83 |
+
'yith-woocommerce-quick-view' => array(
|
84 |
'name' => 'YITH Woocommerce Quick View',
|
85 |
'slug' => 'yith-woocommerce-quick-view',
|
86 |
'premium_constat' => 'YITH_WCQV_PREMIUM'
|
87 |
),
|
88 |
|
89 |
+
'yith-live-chat' => array(
|
90 |
'name' => 'YITH Live Chat',
|
91 |
'slug' => 'yith-live-chat',
|
92 |
'premium_constat' => 'YLC_PREMIUM'
|
93 |
),
|
94 |
|
95 |
+
'yith-woocommerce-eu-vat' => array(
|
96 |
'name' => 'YITH WooCommerce EU VAT',
|
97 |
'slug' => 'yith-woocommerce-eu-vat',
|
98 |
'premium_constat' => 'YITH_YWEV_PREMIUM'
|
99 |
),
|
100 |
|
101 |
+
'yith-woocommerce-mailchimp' => array(
|
102 |
'name' => 'YITH WooCommerce Mailchimp',
|
103 |
'slug' => 'yith-woocommerce-mailchimp',
|
104 |
'premium_constat' => 'YITH_WCMC_PREMIUM_INIT'
|
105 |
),
|
106 |
|
107 |
+
'yith-woocommerce-stripe' => array(
|
108 |
'name' => 'YITH WooCommerce Stripe',
|
109 |
'slug' => 'yith-woocommerce-stripe',
|
110 |
'premium_constat' => 'YITH_WCSTRIPE_PREMIUM'
|
111 |
),
|
112 |
|
113 |
+
'yith-woocommerce-authorizenet-payment-gateway' => array(
|
114 |
'name' => 'YITH WooCommerce Authorize.net Payment Gateway',
|
115 |
'slug' => 'yith-woocommerce-authorizenet-payment-gateway',
|
116 |
'premium-url' => 'yith-woocommerce-authorize-net-payment-gateway',
|
117 |
'premium_constat' => 'YITH_WCAUTHNET_PREMIUM'
|
118 |
),
|
119 |
|
120 |
+
'yith-infinite-scrolling' => array(
|
121 |
'name' => 'YITH Infinite Scrolling',
|
122 |
'slug' => 'yith-infinite-scrolling',
|
123 |
'premium_constat' => 'YITH_INFS_PREMIUM'
|
124 |
),
|
125 |
|
126 |
+
'yith-woocommerce-waiting-list' => array(
|
127 |
'name' => 'YITH WooCommerce Waiting List',
|
128 |
'slug' => 'yith-woocommerce-waiting-list',
|
129 |
'premium_constat' => 'YITH_WCWTL_PREMIUM'
|
130 |
),
|
131 |
|
132 |
+
'yith-woocommerce-tab-manager' => array(
|
133 |
'name' => 'YITH WooCommerce Tab Manager',
|
134 |
'slug' => 'yith-woocommerce-tab-manager',
|
135 |
'premium_constat' => 'YWTM_PREMIUM'
|
136 |
),
|
137 |
|
138 |
+
'yith-woocommerce-product-vendors' => array(
|
139 |
'name' => 'YITH WooCommerce Multi Vendor',
|
140 |
'slug' => 'yith-woocommerce-product-vendors',
|
141 |
'premium_constat' => 'YITH_WPV_PREMIUM'
|
142 |
),
|
143 |
|
144 |
+
'yith-woocommerce-colors-labels-variations' => array(
|
145 |
'name' => 'YITH WooCommerce Color and Label Variations',
|
146 |
'slug' => 'yith-woocommerce-colors-labels-variations',
|
147 |
'premium_constat' => 'YITH_WCCL_PREMIUM',
|
148 |
'premium-url' => 'yith-woocommerce-color-and-label-variations',
|
149 |
+
'premium-dir' => 'yith-woocommerce-color-label-variations',
|
150 |
'short_description' => 'The best way to offer a complete overview on all options available for your products: with one plugin only you can add unlimited variations.',
|
151 |
'version' => '1.1.6',
|
152 |
'last_updated' => '2015-08-12',
|
modules/yith-infinite-scrolling/assets/css/frontend.css
CHANGED
@@ -5,4 +5,31 @@
|
|
5 |
.yith-infs-loader img {
|
6 |
max-width: 100%;
|
7 |
display: inline-block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
5 |
.yith-infs-loader img {
|
6 |
max-width: 100%;
|
7 |
display: inline-block;
|
8 |
+
}
|
9 |
+
|
10 |
+
/* Fade In */
|
11 |
+
|
12 |
+
@-webkit-keyframes fadeIn {
|
13 |
+
0% {
|
14 |
+
opacity: 0;
|
15 |
+
}
|
16 |
+
100% {
|
17 |
+
opacity: 1;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
@keyframes fadeIn {
|
21 |
+
0% {
|
22 |
+
opacity: 0;
|
23 |
+
}
|
24 |
+
100% {
|
25 |
+
opacity: 1;
|
26 |
+
}
|
27 |
+
}
|
28 |
+
.yith-infs-animated {
|
29 |
+
-webkit-animation-duration: 1s;
|
30 |
+
animation-duration: 1s;
|
31 |
+
-webkit-animation-fill-mode: both;
|
32 |
+
animation-fill-mode: both;
|
33 |
+
-webkit-animation-name: fadeIn;
|
34 |
+
animation-name: fadeIn;
|
35 |
}
|
modules/yith-infinite-scrolling/assets/js/yith-infs.js
CHANGED
@@ -21,4 +21,7 @@ jQuery(document).ready( function($) {
|
|
21 |
|
22 |
$( yith_infs.contentSelector ).yit_infinitescroll( infinite_scroll );
|
23 |
|
|
|
|
|
|
|
24 |
});
|
21 |
|
22 |
$( yith_infs.contentSelector ).yit_infinitescroll( infinite_scroll );
|
23 |
|
24 |
+
$(document).on( 'yith-wcan-ajax-filtered', function(){
|
25 |
+
$( yith_infs.contentSelector ).yit_infinitescroll( infinite_scroll );
|
26 |
+
});
|
27 |
});
|
modules/yith-infinite-scrolling/assets/js/yith.infinitescroll.js
CHANGED
@@ -3,6 +3,9 @@
|
|
3 |
|
4 |
$.fn.yit_infinitescroll = function (options) {
|
5 |
|
|
|
|
|
|
|
6 |
var opts = $.extend({
|
7 |
|
8 |
nextSelector : false,
|
@@ -62,21 +65,19 @@
|
|
62 |
position_elem( last_elem, columns, elem );
|
63 |
}
|
64 |
|
65 |
-
elem.css({
|
66 |
-
'opacity':'0'
|
67 |
-
});
|
68 |
-
|
69 |
last_elem.after( elem );
|
70 |
|
71 |
$( '.yith-infs-loader' ).remove();
|
72 |
|
73 |
$(document).trigger( 'yith_infs_adding_elem' );
|
74 |
|
75 |
-
elem.
|
76 |
-
|
77 |
-
|
78 |
loading = false;
|
79 |
-
|
|
|
|
|
80 |
|
81 |
}
|
82 |
});
|
@@ -108,13 +109,17 @@
|
|
108 |
|
109 |
// scroll event
|
110 |
$( window ).on( 'scroll touchstart', function (){
|
111 |
-
|
|
|
|
|
|
|
|
|
112 |
offset = $( opts.itemSelector ).last().offset();
|
113 |
|
114 |
-
if ( ! loading && ! finished &&
|
115 |
main_ajax();
|
116 |
}
|
117 |
-
})
|
118 |
}
|
119 |
|
120 |
})( jQuery, window, document );
|
3 |
|
4 |
$.fn.yit_infinitescroll = function (options) {
|
5 |
|
6 |
+
// reset
|
7 |
+
$( window ).unbind( 'yith_infs_start' );
|
8 |
+
|
9 |
var opts = $.extend({
|
10 |
|
11 |
nextSelector : false,
|
65 |
position_elem( last_elem, columns, elem );
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
68 |
last_elem.after( elem );
|
69 |
|
70 |
$( '.yith-infs-loader' ).remove();
|
71 |
|
72 |
$(document).trigger( 'yith_infs_adding_elem' );
|
73 |
|
74 |
+
elem.addClass( 'yith-infs-animated' );
|
75 |
+
|
76 |
+
setTimeout( function(){
|
77 |
loading = false;
|
78 |
+
elem.removeClass( 'yith-infs-animated' );
|
79 |
+
$(document).trigger( 'yith_infs_added_elem' );
|
80 |
+
}, 1000 );
|
81 |
|
82 |
}
|
83 |
});
|
109 |
|
110 |
// scroll event
|
111 |
$( window ).on( 'scroll touchstart', function (){
|
112 |
+
$(this).trigger('yith_infs_start');
|
113 |
+
});
|
114 |
+
|
115 |
+
$( window ).on( 'yith_infs_start', function(){
|
116 |
+
var w = $(this),
|
117 |
offset = $( opts.itemSelector ).last().offset();
|
118 |
|
119 |
+
if ( ! loading && ! finished && w.scrollTop() >= Math.abs( offset.top - ( w.height() - 150 ) ) ) {
|
120 |
main_ajax();
|
121 |
}
|
122 |
+
})
|
123 |
}
|
124 |
|
125 |
})( jQuery, window, document );
|
modules/yith-infinite-scrolling/init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH Infinite Scrolling
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH Infinite Scrolling add infinite scroll to your page.
|
6 |
-
* Version: 1.0.
|
7 |
* Author: Yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith-infs
|
@@ -11,7 +11,7 @@
|
|
11 |
*
|
12 |
* @author Yithemes
|
13 |
* @package YITH Infinite Scrolling
|
14 |
-
* @version 1.0.
|
15 |
*/
|
16 |
/* Copyright 2015 Your Inspiration Themes ( email: plugins@yithemes.com )
|
17 |
|
@@ -50,7 +50,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
|
50 |
|
51 |
|
52 |
if ( ! defined( 'YITH_INFS_VERSION' ) ){
|
53 |
-
define( 'YITH_INFS_VERSION', '1.0.
|
54 |
}
|
55 |
|
56 |
if ( ! defined( 'YITH_INFS_FREE_INIT' ) ) {
|
3 |
* Plugin Name: YITH Infinite Scrolling
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH Infinite Scrolling add infinite scroll to your page.
|
6 |
+
* Version: 1.0.4
|
7 |
* Author: Yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith-infs
|
11 |
*
|
12 |
* @author Yithemes
|
13 |
* @package YITH Infinite Scrolling
|
14 |
+
* @version 1.0.4
|
15 |
*/
|
16 |
/* Copyright 2015 Your Inspiration Themes ( email: plugins@yithemes.com )
|
17 |
|
50 |
|
51 |
|
52 |
if ( ! defined( 'YITH_INFS_VERSION' ) ){
|
53 |
+
define( 'YITH_INFS_VERSION', '1.0.4' );
|
54 |
}
|
55 |
|
56 |
if ( ! defined( 'YITH_INFS_FREE_INIT' ) ) {
|
modules/yith-woocommerce-advanced-reviews/assets/images/001.png
ADDED
Binary file
|
modules/yith-woocommerce-advanced-reviews/assets/images/002.png
ADDED
Binary file
|
modules/yith-woocommerce-advanced-reviews/assets/images/003.png
ADDED
Binary file
|
modules/yith-woocommerce-advanced-reviews/assets/images/004.png
ADDED
Binary file
|
modules/yith-woocommerce-advanced-reviews/assets/images/11-bg.png
ADDED
Binary file
|
modules/yith-woocommerce-advanced-reviews/init.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://yithemes.com/themes/plugins/yith-woocommerce-advanced-reviews
|
|
5 |
Description: Extends the basic functionality of woocommerce reviews and add a histogram table to the reviews of your products, as well as you see in most trendy e-commerce sites.
|
6 |
Author: Yithemes
|
7 |
Text Domain: ywar
|
8 |
-
Version: 1.1.
|
9 |
Author URI: http://yithemes.com/
|
10 |
*/
|
11 |
|
@@ -57,7 +57,7 @@ if ( ! defined( 'YITH_YWAR_FREE_INIT' ) ) {
|
|
57 |
}
|
58 |
|
59 |
if ( ! defined( 'YITH_YWAR_VERSION' ) ) {
|
60 |
-
define( 'YITH_YWAR_VERSION', '1.1.
|
61 |
}
|
62 |
|
63 |
if ( ! defined( 'YITH_YWAR_FILE' ) ) {
|
5 |
Description: Extends the basic functionality of woocommerce reviews and add a histogram table to the reviews of your products, as well as you see in most trendy e-commerce sites.
|
6 |
Author: Yithemes
|
7 |
Text Domain: ywar
|
8 |
+
Version: 1.1.6
|
9 |
Author URI: http://yithemes.com/
|
10 |
*/
|
11 |
|
57 |
}
|
58 |
|
59 |
if ( ! defined( 'YITH_YWAR_VERSION' ) ) {
|
60 |
+
define( 'YITH_YWAR_VERSION', '1.1.6' );
|
61 |
}
|
62 |
|
63 |
if ( ! defined( 'YITH_YWAR_FILE' ) ) {
|
modules/yith-woocommerce-advanced-reviews/lib/class.yith-advanced-reviews-list-table.php
CHANGED
@@ -1,603 +1,620 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
* This file belongs to the YIT Framework.
|
4 |
*
|
5 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
6 |
* that is bundled with this package in the file LICENSE.txt.
|
7 |
* It is also available through the world-wide-web at this URL:
|
8 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
9 |
*/
|
10 |
-
if (
|
11 |
-
|
12 |
}
|
13 |
|
14 |
global $YWAR_AdvancedReview;
|
15 |
|
16 |
-
if (
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
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 |
-
unset( $views['processing'] );
|
386 |
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
|
390 |
-
|
391 |
-
'review_status' => $id
|
392 |
-
) );
|
393 |
|
394 |
-
|
395 |
-
$total_items = count( get_posts( $args ) );
|
396 |
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
}
|
402 |
|
403 |
-
|
404 |
-
|
405 |
|
406 |
-
|
407 |
-
* Print the columns information
|
408 |
-
*
|
409 |
-
* @param $review
|
410 |
-
* @param $column_name
|
411 |
-
*
|
412 |
-
* @return string
|
413 |
-
*/
|
414 |
-
public function column_default( $review, $column_name ) {
|
415 |
|
416 |
-
|
|
|
|
|
417 |
|
418 |
-
|
419 |
|
420 |
-
|
421 |
-
|
422 |
-
return;
|
423 |
-
}
|
424 |
|
425 |
-
|
426 |
-
echo '<a class="row-title" href="' . $edit_link . '">';
|
427 |
|
428 |
-
|
429 |
-
echo '<span class="review-title">' . $post->post_title . '</span>';
|
430 |
-
echo "<br>";
|
431 |
-
}
|
432 |
|
433 |
-
|
434 |
-
|
435 |
-
|
|
|
|
|
|
|
|
|
|
|
436 |
|
437 |
-
|
438 |
|
439 |
-
|
440 |
|
441 |
-
if ( 'trash' == $post->post_status ) {
|
442 |
-
$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the bin' ) . "' href='" . $this->ywar->untrash_review_url( $post ) . "'>" . __( 'Restore' ) . "</a>";
|
443 |
-
} elseif ( EMPTY_TRASH_DAYS ) {
|
444 |
-
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the bin' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Bin' ) . "</a>";
|
445 |
-
}
|
446 |
-
if ( 'trash' == $post->post_status || ! EMPTY_TRASH_DAYS ) {
|
447 |
-
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete permanently' ) . "</a>";
|
448 |
-
}
|
449 |
|
450 |
-
|
451 |
|
452 |
-
|
|
|
|
|
453 |
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
case $this->ywar->custom_column_rating:
|
458 |
-
if ( 0 == $review->post_parent ) {
|
459 |
-
$rating = get_post_meta( $review->ID, $this->ywar->meta_key_rating, true );
|
460 |
-
|
461 |
-
echo '<div class="woocommerce">
|
462 |
-
<div class="star-rating" title="' . sprintf( __( "Rated %d out of 5", "ywar" ), $rating ) . '">
|
463 |
-
<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong>' . $rating . '</strong>' . __( "out of 5", "ywar" ) . ' </span>
|
464 |
</div>
|
465 |
</div>';
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
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 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
|
|
|
|
|
|
|
|
|
|
602 |
}
|
603 |
|
1 |
<?php
|
2 |
/*
|
|
|
3 |
*
|
4 |
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
5 |
* that is bundled with this package in the file LICENSE.txt.
|
6 |
* It is also available through the world-wide-web at this URL:
|
7 |
* http://www.gnu.org/licenses/gpl-3.0.txt
|
8 |
*/
|
9 |
+
if (!defined('ABSPATH')) {
|
10 |
+
exit('Direct access forbidden.');
|
11 |
}
|
12 |
|
13 |
global $YWAR_AdvancedReview;
|
14 |
|
15 |
+
if (!class_exists('YITH_Advanced_Reviews_List_Table')) {
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
*
|
19 |
+
* @class class.yith-advanced-reviews-list-table.php
|
20 |
+
* @package Yithemes
|
21 |
+
* @since Version 1.0.0
|
22 |
+
* @author Your Inspiration Themes
|
23 |
+
*
|
24 |
+
*/
|
25 |
+
class YITH_Advanced_Reviews_List_Table extends WP_List_Table
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var object store the Advanced reviews class object, used as shortcut to full singleton name
|
29 |
+
*/
|
30 |
+
private $ywar;
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Construct
|
35 |
+
*/
|
36 |
+
public function __construct()
|
37 |
+
{
|
38 |
+
global $YWAR_AdvancedReview;
|
39 |
+
|
40 |
+
$this->ywar = $YWAR_AdvancedReview;
|
41 |
+
//Set parent defaults
|
42 |
+
parent::__construct(array(
|
43 |
+
'singular' => 'review', //singular name of the listed records
|
44 |
+
'plural' => 'reviews', //plural name of the listed records
|
45 |
+
'ajax' => false //does this table support ajax?
|
46 |
+
)
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Returns columns available in table
|
52 |
+
*
|
53 |
+
* @return array Array of columns of the table
|
54 |
+
* @since 1.0.0
|
55 |
+
*/
|
56 |
+
public function get_columns()
|
57 |
+
{
|
58 |
+
$columns = array(
|
59 |
+
'cb' => '<input type="checkbox" />',
|
60 |
+
$this->ywar->custom_column_review => __('Review', 'ywar'),
|
61 |
+
$this->ywar->custom_column_author => __('Author', 'ywar'),
|
62 |
+
$this->ywar->custom_column_date => __('Date', 'ywar'),
|
63 |
+
$this->ywar->custom_column_rating => __('Rate', 'ywar'),
|
64 |
+
$this->ywar->custom_column_product => __('Product', 'ywar')
|
65 |
+
);
|
66 |
+
|
67 |
+
return apply_filters('yith_advanced_reviews_custom_column', $columns);
|
68 |
+
}
|
69 |
+
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Generate row actions div
|
73 |
+
*
|
74 |
+
* @since 3.1.0
|
75 |
+
* @access protected
|
76 |
+
*
|
77 |
+
* @param array $actions The list of actions
|
78 |
+
* @param bool $always_visible Whether the actions should be always visible
|
79 |
+
*
|
80 |
+
* @return string
|
81 |
+
*/
|
82 |
+
protected function row_actions($actions, $always_visible = false)
|
83 |
+
{
|
84 |
+
$action_count = count($actions);
|
85 |
+
$i = 0;
|
86 |
+
|
87 |
+
if (!$action_count) {
|
88 |
+
return '';
|
89 |
+
}
|
90 |
+
|
91 |
+
$out = '<div class="' . ($always_visible ? 'row-actions visible' : 'row-actions') . '">';
|
92 |
+
foreach ($actions as $action => $link) {
|
93 |
+
++$i;
|
94 |
+
($i == $action_count) ? $sep = '' : $sep = ' | ';
|
95 |
+
$out .= "<span class='$action'>$link$sep</span>";
|
96 |
+
}
|
97 |
+
$out .= '</div>';
|
98 |
+
|
99 |
+
return $out;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Get a parameter array to be passed to get_posts
|
104 |
+
*
|
105 |
+
* @param $args parameters for filtering the review list
|
106 |
+
* 'page' => 0 = show all, any positive value ask for paginated results
|
107 |
+
* 'post_status' => 'all', //value are all, publish,future...
|
108 |
+
* 'post_parent' => -1, //-1 stands for all post parent, any non negative value is intended as a specifici parent
|
109 |
+
* 'review_status' => 'all',
|
110 |
+
* 'items_for_page => 0 = show all on 1 page, any positive value is the number of items to show
|
111 |
+
*/
|
112 |
+
private function get_params_for_current_view($args)
|
113 |
+
{
|
114 |
+
// Start the filters array, selecting the review post type
|
115 |
+
$params = array(
|
116 |
+
'post_type' => 'ywar_reviews',
|
117 |
+
'suppress_filters' => false
|
118 |
+
);
|
119 |
+
|
120 |
+
// Show a single page or all items
|
121 |
+
$params['numberposts'] = -1;
|
122 |
+
if (isset($args['page']) && ($args['page'] > 0) && isset($args['items_for_page']) && ($args['items_for_page'] > 0)) {
|
123 |
+
|
124 |
+
// set number of posts and offset
|
125 |
+
$current_page = $args['page'];
|
126 |
+
$items_for_page = $args['items_for_page'];
|
127 |
+
$offset = ($current_page * $items_for_page) - $items_for_page;
|
128 |
+
$params['offset'] = $offset;
|
129 |
+
$params['numberposts'] = $items_for_page;
|
130 |
+
|
131 |
+
|
132 |
+
} else {
|
133 |
+
$params['offset'] = 0;
|
134 |
+
}
|
135 |
+
|
136 |
+
// Choose post status
|
137 |
+
if (isset($args['post_status']) && ("all" != $args['post_status'])) {
|
138 |
+
$params['post_status'] = $args['post_status'];
|
139 |
+
}
|
140 |
+
|
141 |
+
if (isset($args['post_parent']) && ($args['post_parent'] >= 0)) {
|
142 |
+
$params['post_parent'] = $args['post_parent'];
|
143 |
+
}
|
144 |
+
|
145 |
+
$order = isset($args['order']) ? $args['order'] : 'DESC';
|
146 |
+
$params['order'] = $order;
|
147 |
+
|
148 |
+
if (isset($args['orderby'])) {
|
149 |
+
switch ($order_by = $args['orderby']) {
|
150 |
+
case $this->ywar->custom_column_rating :
|
151 |
+
$params['meta_key'] = $this->ywar->meta_key_rating;
|
152 |
+
$params['orderby'] = 'meta_value_num';
|
153 |
+
break;
|
154 |
+
|
155 |
+
case $this->ywar->custom_column_date :
|
156 |
+
$params['orderby'] = 'post_date';
|
157 |
+
break;
|
158 |
+
|
159 |
+
default :
|
160 |
+
$params = apply_filters("yith_advanced_reviews_column_sort", $params, $order_by);
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
if (isset($args['review_status'])) {
|
165 |
+
|
166 |
+
switch ($args['review_status']) {
|
167 |
+
case 'all' :
|
168 |
+
break;
|
169 |
+
|
170 |
+
case 'trash' :
|
171 |
+
$params['post_status'] = 'trash';
|
172 |
+
|
173 |
+
break;
|
174 |
+
|
175 |
+
case 'not_approved' :
|
176 |
+
$params['meta_query'][] = array(
|
177 |
+
'key' => $this->ywar->meta_key_approved,
|
178 |
+
'value' => 1,
|
179 |
+
'compare' => '!=',
|
180 |
+
'type' => 'numeric'
|
181 |
+
);
|
182 |
+
break;
|
183 |
+
|
184 |
+
default :
|
185 |
+
$params = apply_filters('yith_advanced_reviews_filter_view', $params, $args['review_status']);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
return $params;
|
190 |
+
}
|
191 |
+
|
192 |
+
public function filter_reviews_by_search_term($where)
|
193 |
+
{
|
194 |
+
$filter_content = isset($_GET["s"]) ? $_GET["s"] : '';
|
195 |
+
$terms = explode("+", $filter_content);
|
196 |
+
global $wpdb;
|
197 |
+
$where_clause = '';
|
198 |
+
foreach ($terms as $term) {
|
199 |
+
if (!empty($where_clause)) {
|
200 |
+
$where_clause .= " OR ";
|
201 |
+
}
|
202 |
+
$where_clause .= "( {$wpdb->prefix}posts.post_content LIKE '%$term%' ) or ({$wpdb->prefix}posts.post_title like '%$term%') ";
|
203 |
+
}
|
204 |
+
|
205 |
+
$where = "$where AND ($where_clause)";
|
206 |
+
|
207 |
+
return $where;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Perform custom bulk actions, if there are some
|
212 |
+
*/
|
213 |
+
public function process_bulk_action()
|
214 |
+
{
|
215 |
+
switch ($this->current_action()) {
|
216 |
+
|
217 |
+
case 'untrash' :
|
218 |
+
foreach ($_GET['reviews'] as $review_id) {
|
219 |
+
$my_post = array(
|
220 |
+
'ID' => $review_id,
|
221 |
+
'post_status' => 'publish'
|
222 |
+
);
|
223 |
+
|
224 |
+
// Update the post into the database
|
225 |
+
wp_update_post($my_post);
|
226 |
+
}
|
227 |
+
|
228 |
+
break;
|
229 |
+
|
230 |
+
case 'trash' :
|
231 |
+
foreach ($_GET['reviews'] as $review_id) {
|
232 |
+
$my_post = array(
|
233 |
+
'ID' => $review_id,
|
234 |
+
'post_status' => 'trash'
|
235 |
+
);
|
236 |
+
|
237 |
+
// Update the post into the database
|
238 |
+
wp_update_post($my_post);
|
239 |
+
}
|
240 |
+
|
241 |
+
break;
|
242 |
+
|
243 |
+
case 'delete' :
|
244 |
+
foreach ($_GET['reviews'] as $review_id) {
|
245 |
+
wp_delete_post($review_id);
|
246 |
+
}
|
247 |
+
|
248 |
+
break;
|
249 |
+
|
250 |
+
case 'approve' :
|
251 |
+
foreach ($_GET['reviews'] as $review_id) {
|
252 |
+
update_post_meta($review_id, $this->ywar->meta_key_approved, 1);
|
253 |
+
}
|
254 |
+
|
255 |
+
break;
|
256 |
+
|
257 |
+
case 'unapprove' :
|
258 |
+
foreach ($_GET['reviews'] as $review_id) {
|
259 |
+
update_post_meta($review_id, $this->ywar->meta_key_approved, 0);
|
260 |
+
}
|
261 |
+
|
262 |
+
break;
|
263 |
+
|
264 |
+
default :
|
265 |
+
if (isset($_GET['reviews'])) {
|
266 |
+
do_action('yith_advanced_reviews_process_bulk_actions', $this->current_action(), $_GET['reviews']);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Prepare items for table
|
273 |
+
*
|
274 |
+
* @return void
|
275 |
+
* @since 1.0.0
|
276 |
+
*/
|
277 |
+
public function prepare_items()
|
278 |
+
{
|
279 |
+
$this->process_bulk_action();
|
280 |
+
|
281 |
+
// sets pagination arguments
|
282 |
+
$current_page = absint($this->get_pagenum());
|
283 |
+
|
284 |
+
// sets columns headers
|
285 |
+
$columns = $this->get_columns();
|
286 |
+
$hidden = array();
|
287 |
+
$sortable = $this->get_sortable_columns();
|
288 |
+
$this->_column_headers = array($columns, $hidden, $sortable);
|
289 |
+
|
290 |
+
$review_status = isset($_GET["status"]) ? $_GET["status"] : 'all';
|
291 |
+
$orderby = isset($_GET["orderby"]) ? $_GET["orderby"] : '';
|
292 |
+
$order = isset($_GET["order"]) ? $_GET["order"] : 'desc';
|
293 |
+
|
294 |
+
// Start the filters array, selecting the review post type
|
295 |
+
$params = array(
|
296 |
+
'post_type' => 'ywar_reviews',
|
297 |
+
'items_for_page' => $this->ywar->items_for_page,
|
298 |
+
'review_status' => $review_status,
|
299 |
+
'orderby' => $orderby,
|
300 |
+
'order' => $order
|
301 |
+
);
|
302 |
+
|
303 |
+
// retrieve the number of items for the current filters
|
304 |
+
$args = $this->get_params_for_current_view($params);
|
305 |
+
$args['fields'] = 'ids';
|
306 |
+
$total_items = count(get_posts($args));
|
307 |
+
|
308 |
+
// retrieve only a page for the current filter
|
309 |
+
$params['page'] = $current_page;
|
310 |
+
$args = $this->get_params_for_current_view($params);
|
311 |
+
|
312 |
+
$filter_content = isset($_GET["s"]) ? $_GET["s"] : '';
|
313 |
+
if (!empty($filter_content)) {
|
314 |
+
// Add a filter to alter WHERE clause on following get_posts call
|
315 |
+
add_filter('posts_where', array($this, 'filter_reviews_by_search_term'));
|
316 |
+
}
|
317 |
+
|
318 |
+
$this->items = get_posts($args);
|
319 |
+
|
320 |
+
//remove the previous filter, not needed anymore
|
321 |
+
remove_filter('posts_where', array($this, 'filter_reviews_by_search_term'));
|
322 |
+
|
323 |
+
$total_pages = ceil($total_items / $this->ywar->items_for_page);
|
324 |
+
|
325 |
+
// Set the pagination
|
326 |
+
$this->set_pagination_args(array(
|
327 |
+
'total_items' => $total_items,
|
328 |
+
'per_page' => $this->ywar->items_for_page,
|
329 |
+
'total_pages' => $total_pages
|
330 |
+
));
|
331 |
+
}
|
332 |
+
|
333 |
+
|
334 |
+
/**
|
335 |
+
* Decide which columns to activate the sorting functionality on
|
336 |
+
* @return array $sortable, the array of columns that can be sorted by the user
|
337 |
+
*/
|
338 |
+
public function get_sortable_columns()
|
339 |
+
{
|
340 |
+
|
341 |
+
$columns = array(
|
342 |
+
|
343 |
+
$this->ywar->custom_column_rating => array($this->ywar->custom_column_rating, false),
|
344 |
+
$this->ywar->custom_column_date => array($this->ywar->custom_column_date, false),
|
345 |
+
);
|
346 |
+
|
347 |
+
return apply_filters('yith_advanced_reviews_sortable_custom_columns', $columns);
|
348 |
+
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Sets bulk actions for table
|
352 |
+
*
|
353 |
+
* @return array Array of available actions
|
354 |
+
* @since 1.0.0
|
355 |
+
*/
|
356 |
+
public function get_bulk_actions()
|
357 |
+
{
|
358 |
+
$actions = array();
|
359 |
+
|
360 |
+
$actions['untrash'] = __('Restore', 'ywar');
|
361 |
+
$actions['trash'] = __('Move to bin', 'ywar');
|
362 |
+
|
363 |
+
$actions['delete'] = __('Delete permanently', 'ywar');
|
364 |
+
$actions['approve'] = __('Approve reviews', 'ywar');
|
365 |
+
$actions['unapprove'] = __('Unapprove reviews', 'ywar');
|
366 |
+
|
367 |
+
return apply_filters('yith_advanced_reviews_bulk_actions', $actions);
|
368 |
+
}
|
369 |
+
|
370 |
+
/**
|
371 |
+
* Extra controls to be displayed between bulk actions and pagination
|
372 |
+
*
|
373 |
+
* @since 3.1.0
|
374 |
+
* @access protected
|
375 |
+
*/
|
376 |
+
protected function get_views()
|
377 |
+
{
|
378 |
+
$views = array(
|
379 |
+
'all' => __('All', 'ywar'),
|
380 |
+
'trash' => __('Bin', 'ywar'),
|
381 |
+
'not_approved' => __('Not approved', 'ywar')
|
382 |
+
);
|
383 |
+
|
384 |
+
$views = apply_filters('yith_advanced_reviews_table_views', $views);
|
385 |
+
|
386 |
+
$current_view = $this->get_current_view();
|
387 |
+
$args = array('status' => 0);
|
388 |
+
|
389 |
+
$args['user_id'] = get_current_user_id();
|
390 |
+
|
391 |
+
// merge Unpaid with Processing
|
392 |
+
//$views['unpaid'] .= '/' . $views['processing'];
|
393 |
+
unset($views['processing']);
|
394 |
+
|
395 |
+
foreach ($views as $id => $view) {
|
396 |
+
// number of items for the view
|
397 |
|
398 |
+
$args = $this->get_params_for_current_view(array(
|
399 |
+
'review_status' => $id
|
400 |
+
));
|
401 |
+
$args['fields'] = 'ids';
|
402 |
|
403 |
+
// retrieve the number of items for the current filters
|
404 |
+
$total_items = count(get_posts($args));
|
405 |
|
406 |
+
$href = esc_url(add_query_arg('status', $id));
|
407 |
+
$class = $id == $current_view ? 'current' : '';
|
408 |
+
$args['status'] = 'unpaid' == $id ? array($id, 'processing') : $id;
|
409 |
+
$views[$id] = sprintf("<a href='%s' class='%s'>%s <span class='count'>(%d)</span></a>", $href, $class, $view, $total_items);
|
410 |
+
}
|
411 |
|
412 |
+
return $views;
|
413 |
+
}
|
|
|
414 |
|
415 |
+
/**
|
416 |
+
* Print the columns information
|
417 |
+
*
|
418 |
+
* @param $review
|
419 |
+
* @param $column_name
|
420 |
+
*
|
421 |
+
* @return string
|
422 |
+
*/
|
423 |
+
public function column_default($review, $column_name)
|
424 |
+
{
|
425 |
|
426 |
+
switch ($column_name) {
|
|
|
|
|
427 |
|
428 |
+
case $this->ywar->custom_column_review:
|
|
|
429 |
|
430 |
+
$post = get_post($review->ID);
|
431 |
+
if (empty($post->post_title) && empty($post->post_content)) {
|
432 |
+
return;
|
433 |
+
}
|
|
|
434 |
|
435 |
+
$edit_link = get_edit_post_link($review->ID);
|
436 |
+
echo '<a class="row-title" href="' . $edit_link . '">';
|
437 |
|
438 |
+
if (!empty($post->post_title)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
|
440 |
+
echo '<span class="review-title">' . wc_trim_string($post->post_title, 80) . '</span>';
|
441 |
+
echo "<br>";
|
442 |
+
}
|
443 |
|
444 |
+
if (!empty($post->post_content)) {
|
445 |
|
446 |
+
echo '<span class="review-content">' . wc_trim_string($post->post_content, 80) . '</span>';
|
447 |
+
}
|
|
|
|
|
448 |
|
449 |
+
echo '</a>';
|
|
|
450 |
|
451 |
+
$post_type_object = get_post_type_object($this->ywar->post_type_name);
|
|
|
|
|
|
|
452 |
|
453 |
+
if ('trash' == $post->post_status) {
|
454 |
+
$actions['untrash'] = "<a title='" . esc_attr__('Restore this item from the bin') . "' href='" . $this->ywar->untrash_review_url($post) . "'>" . __('Restore') . "</a>";
|
455 |
+
} elseif (EMPTY_TRASH_DAYS) {
|
456 |
+
$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__('Move this item to the bin') . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Bin') . "</a>";
|
457 |
+
}
|
458 |
+
if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
|
459 |
+
$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__('Delete this item permanently') . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete permanently') . "</a>";
|
460 |
+
}
|
461 |
|
462 |
+
$actions = apply_filters('yith_advanced_reviews_row_actions', $actions, $post);
|
463 |
|
464 |
+
echo $this->row_actions($actions);
|
465 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
+
break;
|
468 |
|
469 |
+
case $this->ywar->custom_column_rating:
|
470 |
+
if (0 == $review->post_parent) {
|
471 |
+
$rating = get_post_meta($review->ID, $this->ywar->meta_key_rating, true);
|
472 |
|
473 |
+
echo '<div class="woocommerce">
|
474 |
+
<div class="star-rating" title="' . sprintf(__("Rated %d out of 5", "ywar"), $rating) . '">
|
475 |
+
<span style="width:' . (($rating / 5) * 100) . '%"><strong>' . $rating . '</strong>' . __("out of 5", "ywar") . ' </span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
476 |
</div>
|
477 |
</div>';
|
478 |
+
}
|
479 |
+
|
480 |
+
break;
|
481 |
+
|
482 |
+
case $this->ywar->custom_column_product:
|
483 |
+
|
484 |
+
$product_id = get_post_meta($review->ID, $this->ywar->meta_key_product_id, true);
|
485 |
+
|
486 |
+
echo get_the_title($product_id) . "<br>";
|
487 |
+
|
488 |
+
if (current_user_can('edit_post', $product_id)) {
|
489 |
+
echo "<a class='edit-product-review' href='" . get_edit_post_link($product_id) . "'>" . __("Edit", "ywar") . '</a>';
|
490 |
+
}
|
491 |
+
|
492 |
+
echo "<a class='view-product-review' href='" . get_permalink($product_id) . "' target='_blank'>" . __("View", "ywar") . '</a>';
|
493 |
+
|
494 |
+
break;
|
495 |
+
|
496 |
+
case $this->ywar->custom_column_author:
|
497 |
+
$user = get_userdata($review->post_author);
|
498 |
+
$author_name = $user ? $user->display_name : __('Anonymous', 'ywar');
|
499 |
+
echo $author_name;
|
500 |
+
|
501 |
+
break;
|
502 |
+
|
503 |
+
case $this->ywar->custom_column_date:
|
504 |
+
$t_time = get_the_time(__('Y/m/d g:i:s a'));
|
505 |
+
$m_time = $review->post_date;
|
506 |
+
$time = get_post_time('G', true, $review);
|
507 |
+
|
508 |
+
$time_diff = time() - $time;
|
509 |
+
|
510 |
+
if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
|
511 |
+
$h_time = sprintf(__('%s ago'), human_time_diff($time));
|
512 |
+
} else {
|
513 |
+
$h_time = mysql2date(__('Y/m/d'), $m_time);
|
514 |
+
}
|
515 |
+
|
516 |
+
echo '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
|
517 |
+
break;
|
518 |
+
|
519 |
+
default :
|
520 |
+
do_action('yith_advanced_reviews_show_advanced_reviews_columns', $column_name, $review->ID);
|
521 |
+
}
|
522 |
+
|
523 |
+
return null;
|
524 |
+
}
|
525 |
+
|
526 |
+
/**
|
527 |
+
* Prints column cb
|
528 |
+
*
|
529 |
+
* @param $rec Object Item to use to print CB record
|
530 |
+
*
|
531 |
+
* @return string
|
532 |
+
* @since 1.0.0
|
533 |
+
*/
|
534 |
+
public function column_cb($rec)
|
535 |
+
{
|
536 |
+
|
537 |
+
return sprintf(
|
538 |
+
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
539 |
+
$this->_args['plural'], //Let's simply repurpose the table's plural label
|
540 |
+
$rec->ID //The value of the checkbox should be the record's id
|
541 |
+
);
|
542 |
+
}
|
543 |
+
|
544 |
+
/**
|
545 |
+
* Message to be displayed when there are no items
|
546 |
+
*
|
547 |
+
* @since 3.1.0
|
548 |
+
* @access public
|
549 |
+
*/
|
550 |
+
public function no_items()
|
551 |
+
{
|
552 |
+
_e('No reviews found.', 'ywar');
|
553 |
+
}
|
554 |
+
|
555 |
+
|
556 |
+
/**
|
557 |
+
* Extra controls to be displayed between bulk actions and pagination
|
558 |
+
*
|
559 |
+
* @since 1.0.0
|
560 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
561 |
+
*
|
562 |
+
* @return string The view name
|
563 |
+
*/
|
564 |
+
public function get_current_view()
|
565 |
+
{
|
566 |
+
return empty($_GET['status']) ? 'all' : $_GET['status'];
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Generate the table navigation above or below the table
|
571 |
+
*
|
572 |
+
* @since 3.1.0
|
573 |
+
* @access protected
|
574 |
+
*
|
575 |
+
* @param string $which
|
576 |
+
*/
|
577 |
+
protected function display_tablenav($which)
|
578 |
+
{
|
579 |
+
if ('top' == $which) {
|
580 |
+
wp_nonce_field('bulk-' . $this->_args['plural']);
|
581 |
+
}
|
582 |
+
?>
|
583 |
+
<div class="tablenav <?php echo esc_attr($which); ?>">
|
584 |
+
|
585 |
+
<div class="alignleft actions bulkactions">
|
586 |
+
<?php $this->bulk_actions($which); ?>
|
587 |
+
</div>
|
588 |
+
<?php
|
589 |
+
$this->extra_tablenav($which);
|
590 |
+
$this->pagination($which);
|
591 |
+
?>
|
592 |
+
|
593 |
+
<br class="clear"/>
|
594 |
+
</div>
|
595 |
+
<?php
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Generates content for a single row of the table
|
600 |
+
*
|
601 |
+
* @since 3.1.0
|
602 |
+
* @access public
|
603 |
+
*
|
604 |
+
* @param object $item The current item
|
605 |
+
*/
|
606 |
+
public function single_row($item)
|
607 |
+
{
|
608 |
+
$approved = 1 == get_post_meta($item->ID, $this->ywar->meta_key_approved, true);
|
609 |
+
if (!$approved) {
|
610 |
+
echo '<tr class="review-unapproved">';
|
611 |
+
} else {
|
612 |
+
echo '<tr>';
|
613 |
+
}
|
614 |
+
|
615 |
+
$this->single_row_columns($item);
|
616 |
+
echo '</tr>';
|
617 |
+
}
|
618 |
+
}
|
619 |
}
|
620 |
|
modules/yith-woocommerce-advanced-reviews/templates/admin/premium.php
CHANGED
@@ -185,28 +185,26 @@ global $YWAR_AdvancedReview;
|
|
185 |
<div class="landing-container">
|
186 |
<div class="premium-cta">
|
187 |
<p>
|
188 |
-
Upgrade to the <span class="highlight">
|
189 |
-
of <span class="highlight">YITH WooCommerce Advanced Reviews</span> to benefit from all features!
|
190 |
</p>
|
191 |
<a href="<?php echo $YWAR_AdvancedReview->get_premium_landing_uri(); ?>" target="_blank" class="premium-cta-button button btn">
|
192 |
-
<span class="highlight">
|
193 |
-
<span>to the premium version</span>
|
194 |
</a>
|
195 |
</div>
|
196 |
</div>
|
197 |
</div>
|
198 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background1.png) no-repeat #fff; background-position: 85% 75%">
|
199 |
-
<h1
|
200 |
<div class="landing-container">
|
201 |
<div class="col-1">
|
202 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>
|
203 |
</div>
|
204 |
<div class="col-2">
|
205 |
<div class="section-title">
|
206 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon1.png" alt="
|
207 |
-
<h2
|
208 |
</div>
|
209 |
-
<p
|
210 |
</div>
|
211 |
</div>
|
212 |
</div>
|
@@ -214,27 +212,83 @@ global $YWAR_AdvancedReview;
|
|
214 |
<div class="landing-container">
|
215 |
<div class="col-2">
|
216 |
<div class="section-title">
|
217 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon2.png" alt="
|
218 |
-
<h2
|
219 |
</div>
|
220 |
-
<p
|
221 |
</div>
|
222 |
<div class="col-1">
|
223 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
</div>
|
225 |
</div>
|
226 |
</div>
|
227 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background3.png) no-repeat #fff; background-position: 85% 100%">
|
228 |
<div class="landing-container">
|
229 |
<div class="col-1">
|
230 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>03.png" alt="
|
231 |
</div>
|
232 |
<div class="col-2">
|
233 |
<div class="section-title">
|
234 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon3.png" alt="
|
235 |
-
<h2
|
236 |
</div>
|
237 |
-
<p
|
238 |
</div>
|
239 |
</div>
|
240 |
</div>
|
@@ -242,28 +296,27 @@ global $YWAR_AdvancedReview;
|
|
242 |
<div class="landing-container">
|
243 |
<div class="col-2">
|
244 |
<div class="section-title">
|
245 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon4.png" alt="
|
246 |
-
<h2
|
247 |
</div>
|
248 |
-
<p
|
249 |
</div>
|
250 |
<div class="col-1">
|
251 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>04.png" alt="
|
252 |
</div>
|
253 |
</div>
|
254 |
</div>
|
255 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background5.png) no-repeat #fff; background-position: 85% 100%">
|
256 |
<div class="landing-container">
|
257 |
<div class="col-1">
|
258 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>05.png" alt="
|
259 |
</div>
|
260 |
<div class="col-2">
|
261 |
<div class="section-title">
|
262 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>icon5.png" alt="
|
263 |
-
<h2
|
264 |
</div>
|
265 |
-
<p
|
266 |
-
<p>Do not worry, it is possible to filter reviews according to the vote users have given to the product. Thanks to this feature, you will be able to filter and analyse results simply and quickly, without having to scroll the entire list to find what you need.</p>
|
267 |
</div>
|
268 |
</div>
|
269 |
</div>
|
@@ -271,29 +324,27 @@ global $YWAR_AdvancedReview;
|
|
271 |
<div class="landing-container">
|
272 |
<div class="col-2">
|
273 |
<div class="section-title">
|
274 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>icon6.png" alt="
|
275 |
-
<h2
|
276 |
</div>
|
277 |
-
<p
|
278 |
</div>
|
279 |
<div class="col-1">
|
280 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>06.png" alt="
|
281 |
</div>
|
282 |
</div>
|
283 |
</div>
|
284 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>07-bg.png) no-repeat #fff; background-position: 85% 100%">
|
285 |
<div class="landing-container">
|
286 |
<div class="col-1">
|
287 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>07.png" alt="
|
288 |
</div>
|
289 |
<div class="col-2">
|
290 |
<div class="section-title">
|
291 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>07-icon.png" alt="
|
292 |
-
<h2
|
293 |
</div>
|
294 |
-
<p
|
295 |
-
This option allows you to filter all reviews, and it will be always up to you to approve them before
|
296 |
-
they can be shown to everyone.</p>
|
297 |
</div>
|
298 |
</div>
|
299 |
</div>
|
@@ -301,32 +352,27 @@ global $YWAR_AdvancedReview;
|
|
301 |
<div class="landing-container">
|
302 |
<div class="col-2">
|
303 |
<div class="section-title">
|
304 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>08-icon.png" alt="
|
305 |
-
<h2
|
306 |
</div>
|
307 |
-
<p
|
308 |
</div>
|
309 |
<div class="col-1">
|
310 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>08.png" alt="ENABLE VOTE FOR ALL" />
|
311 |
</div>
|
312 |
</div>
|
313 |
</div>
|
314 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>09-bg.png) no-repeat #fff; background-position: 85% 100%">
|
315 |
<div class="landing-container">
|
316 |
<div class="col-1">
|
317 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>09.png" alt="INAPPROPRIATE REVIEWS" />
|
318 |
</div>
|
319 |
<div class="col-2">
|
320 |
<div class="section-title">
|
321 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>09-icon.png" alt="
|
322 |
-
<h2
|
323 |
</div>
|
324 |
-
<p>
|
325 |
-
Among the different reviews your products receive, some of them might be way out of line, or contain
|
326 |
-
gross words. <b>Give your users the freedom to report them as "inappropriate":</b> in this way, after a
|
327 |
-
certain number of markings (that you can choose), the review will be automatically removed from the
|
328 |
-
system. Clear your shop from impolite users.
|
329 |
-
</p>
|
330 |
</div>
|
331 |
</div>
|
332 |
</div>
|
@@ -334,34 +380,27 @@ global $YWAR_AdvancedReview;
|
|
334 |
<div class="landing-container">
|
335 |
<div class="col-2">
|
336 |
<div class="section-title">
|
337 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>10-icon.png" alt="
|
338 |
-
<h2
|
339 |
</div>
|
340 |
-
<p>
|
341 |
-
<b>Did you like a review so much and you want to highlight it? That's easy to do!</b> Go in the review list
|
342 |
-
and click on the icon of that specific review: this will appear ahead of the other reviews of the
|
343 |
-
product with a slightly different style. Your users will read it for sure!
|
344 |
-
</p>
|
345 |
</div>
|
346 |
<div class="col-1">
|
347 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>10.png" alt="
|
348 |
</div>
|
349 |
</div>
|
350 |
</div>
|
351 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11-bg.png) no-repeat #fff; background-position: 85% 100%">
|
352 |
<div class="landing-container">
|
353 |
<div class="col-1">
|
354 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11.png" alt="MORE DETAILS" />
|
355 |
</div>
|
356 |
<div class="col-2">
|
357 |
<div class="section-title">
|
358 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>11-icon.png" alt="
|
359 |
-
<h2
|
360 |
</div>
|
361 |
-
<p>
|
362 |
-
The Reviews custom post type gets <b>richer</b> and <b>grants</b> you many new details about the reviews in a single screen.<br>
|
363 |
-
At a glance, you could see how many people consider the review useful, if this has been reported as inappropriate, if a review is featured, or if the replies are blocked.
|
364 |
-
</p>
|
365 |
</div>
|
366 |
</div>
|
367 |
</div>
|
@@ -369,33 +408,27 @@ global $YWAR_AdvancedReview;
|
|
369 |
<div class="landing-container">
|
370 |
<div class="col-2">
|
371 |
<div class="section-title">
|
372 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>12-icon.png" alt="
|
373 |
-
<h2
|
374 |
</div>
|
375 |
-
<p>
|
376 |
-
A detailed report that lets you control the <b>information</b> of the reviews for each product. You can
|
377 |
-
easily discover which are the most reviewed products, and which are the best and worst voted.
|
378 |
-
</p>
|
379 |
</div>
|
380 |
<div class="col-1">
|
381 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>12.png" alt="REPORT" />
|
382 |
</div>
|
383 |
</div>
|
384 |
</div>
|
385 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>13-bg.png) no-repeat #fff; background-position: 85% 100%">
|
386 |
<div class="landing-container">
|
387 |
<div class="col-1">
|
388 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>13.png" alt="STOP REPLY" />
|
389 |
</div>
|
390 |
<div class="col-2">
|
391 |
<div class="section-title">
|
392 |
-
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>13-icon.png" alt="
|
393 |
-
<h2
|
394 |
</div>
|
395 |
-
<p>
|
396 |
-
If you want to prevent the replies for specific reviews, you don't have to block the entire reply
|
397 |
-
system. Go to the Review custom post type and <b>block the replies only for the reviews you want</b>.
|
398 |
-
</p>
|
399 |
</div>
|
400 |
</div>
|
401 |
</div>
|
@@ -403,12 +436,10 @@ global $YWAR_AdvancedReview;
|
|
403 |
<div class="landing-container">
|
404 |
<div class="premium-cta">
|
405 |
<p>
|
406 |
-
Upgrade to the <span class="highlight">
|
407 |
-
of <span class="highlight">YITH WooCommerce Advanced Reviews</span> to benefit from all features!
|
408 |
</p>
|
409 |
<a href="<?php echo $YWAR_AdvancedReview->get_premium_landing_uri(); ?>" target="_blank" class="premium-cta-button button btn">
|
410 |
-
<span class="highlight">
|
411 |
-
<span>to the premium version</span>
|
412 |
</a>
|
413 |
</div>
|
414 |
</div>
|
185 |
<div class="landing-container">
|
186 |
<div class="premium-cta">
|
187 |
<p>
|
188 |
+
<?php echo sprintf (__('Upgrade to the %1$spremium version%2$s of %1$sYITH WooCommerce Advanced Reviews%2$s to benefit from all features!','ywar'),'<span class="highlight">','</span>');?>
|
|
|
189 |
</p>
|
190 |
<a href="<?php echo $YWAR_AdvancedReview->get_premium_landing_uri(); ?>" target="_blank" class="premium-cta-button button btn">
|
191 |
+
<?php echo sprintf (__('%1$sUPGRADE%2$s %3$sto the premium version%2$s','ywar'),'<span class="highlight">','</span>','<span>');?>
|
|
|
192 |
</a>
|
193 |
</div>
|
194 |
</div>
|
195 |
</div>
|
196 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background1.png) no-repeat #fff; background-position: 85% 75%">
|
197 |
+
<h1><?php _e('Premium Features');?></h1>
|
198 |
<div class="landing-container">
|
199 |
<div class="col-1">
|
200 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>001.png" alt="<?php _e('SUMMARIZE');?>" />
|
201 |
</div>
|
202 |
<div class="col-2">
|
203 |
<div class="section-title">
|
204 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon1.png" alt="icon1" />
|
205 |
+
<h2><?php _e('Review title');?></h2>
|
206 |
</div>
|
207 |
+
<p><?php echo sprintf (__('Giving a title to a review is a smart way to make a %1$ssummary of the content%2$s in few words. With it, it will be easier to find a particular review, for a better visual effect.','ywar'),'<b>','</b>');?></p>
|
208 |
</div>
|
209 |
</div>
|
210 |
</div>
|
212 |
<div class="landing-container">
|
213 |
<div class="col-2">
|
214 |
<div class="section-title">
|
215 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon2.png" alt="icon2"/>
|
216 |
+
<h2><?php _e('REVIEW ATTACHMENT');?></h2>
|
217 |
</div>
|
218 |
+
<p><?php echo sprintf (__('Attach one or more files to reviews is today a need for many users that surf web shops. Be always up-to-date and purchase the premium version of the plugin to offer your users the freedom to %1$sattach files%2$s for a complete service.','ywar'),'<b>','</b>');?></p>
|
219 |
</div>
|
220 |
<div class="col-1">
|
221 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>002.png" alt="<?php _e('ADD AN ATTACHMENT');?>" />
|
222 |
+
</div>
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
+
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11-g.png) no-repeat #fff; background-position: 85% 75%">
|
226 |
+
<div class="landing-container">
|
227 |
+
<div class="col-1">
|
228 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>003.png" alt="<?php _e('CUSTOMIZE COLOURS');?>" />
|
229 |
+
</div>
|
230 |
+
<div class="col-2">
|
231 |
+
<div class="section-title">
|
232 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11-icon.png" alt="icon11" />
|
233 |
+
<h2><?php _e('COLOR CUSTOMIZATION');?></h2>
|
234 |
+
</div>
|
235 |
+
<p><?php echo sprintf (__('Appearance is important, and this is why it will be simple for you to customize some of the %1$Scolors%2$S of the plugin to blend it with the %1$Sstyle%2$S of your theme. Nice and easy.','ywar'),'<b>','</b>');?></p>
|
236 |
+
</div>
|
237 |
+
</div>
|
238 |
+
</div>
|
239 |
+
<div class="section section-odd clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>12-bg.png) no-repeat #f1f1f1; background-position: 15% 100%">
|
240 |
+
<div class="landing-container">
|
241 |
+
<div class="col-2">
|
242 |
+
<div class="section-title">
|
243 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>12-icon.png" alt="icon12"/>
|
244 |
+
<h2><?php _e('VOTER PERCENTAGE BY RATING');?></h2>
|
245 |
+
</div>
|
246 |
+
<p><?php echo sprintf (__('Each product of your shop will display a box with %1$sreviews%2$s and %1$svotes%2$s, in addition to percentages that represent each star rate. ','ywar'),'<b>','</b>');?></p>
|
247 |
+
</div>
|
248 |
+
<div class="col-1">
|
249 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>004.png" alt="<?php _e('REPRESENT GRAPHICALLY');?>" />
|
250 |
+
</div>
|
251 |
+
</div>
|
252 |
+
</div>
|
253 |
+
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background1.png) no-repeat #fff; background-position: 85% 75%">
|
254 |
+
<div class="landing-container">
|
255 |
+
<div class="col-1">
|
256 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>02.png" alt="<?php _e('MODAL WINDOW');?>" />
|
257 |
+
</div>
|
258 |
+
<div class="col-2">
|
259 |
+
<div class="section-title">
|
260 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon1.png" alt="icon1" />
|
261 |
+
<h2><?php _e('MODAL WINDOW');?></h2>
|
262 |
+
</div>
|
263 |
+
<p><?php echo sprintf (__('Enabling this option, the result of the review filter will be slightly different: %1$sthe filtered review will be showed%2$s in a modal window.','ywar'),'<b>','</b>');?></p>
|
264 |
+
</div>
|
265 |
+
</div>
|
266 |
+
</div>
|
267 |
+
<div class="section section-odd clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background2.png) no-repeat #f1f1f1; background-position: 15% 100%">
|
268 |
+
<div class="landing-container">
|
269 |
+
<div class="col-2">
|
270 |
+
<div class="section-title">
|
271 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon2.png" alt="icon2"/>
|
272 |
+
<h2><?php _e('LOAD MORE');?></h2>
|
273 |
+
</div>
|
274 |
+
<p><?php echo sprintf (__('%1$sDo you want to hide some of your reviews?%2$s Set how many to show with the relative option, and if you want to let users read the rest of them, choose the load more option.','ywar'),'<b>','</b>');?></p>
|
275 |
+
</div>
|
276 |
+
<div class="col-1">
|
277 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>01.png" alt="<?php _e('LOAD MORE');?>" />
|
278 |
</div>
|
279 |
</div>
|
280 |
</div>
|
281 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background3.png) no-repeat #fff; background-position: 85% 100%">
|
282 |
<div class="landing-container">
|
283 |
<div class="col-1">
|
284 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>03.png" alt="<?php _e('VOTE THE REVIEW');?>" />
|
285 |
</div>
|
286 |
<div class="col-2">
|
287 |
<div class="section-title">
|
288 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon3.png" alt="icon3" />
|
289 |
+
<h2><?php _e('VOTE THE REVIEW');?></h2>
|
290 |
</div>
|
291 |
+
<p><?php echo sprintf (__('Have you found a review that was particularly good and explicative and that helped you a lot choose a product? Give prominence to it and express your satisfaction or disappointment through the dedicated %1$supvote%2$s or %1$sdownvote%2$s buttons.','ywar'),'<b>','</b>');?></p>
|
292 |
</div>
|
293 |
</div>
|
294 |
</div>
|
296 |
<div class="landing-container">
|
297 |
<div class="col-2">
|
298 |
<div class="section-title">
|
299 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>icon4.png" alt="icon4" />
|
300 |
+
<h2><?php _e('NUMBER');?></h2>
|
301 |
</div>
|
302 |
+
<p><?php echo sprintf (__('This feature allows you to provide users with another piece of information concerning each individual review: it displays %1$sthe number of users%2$s that have appreciated it by expressing their preference for it.','ywar'),'<b>','</b>');?></p>
|
303 |
</div>
|
304 |
<div class="col-1">
|
305 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>04.png" alt="<?php _e('NUMBER');?>" />
|
306 |
</div>
|
307 |
</div>
|
308 |
</div>
|
309 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>background5.png) no-repeat #fff; background-position: 85% 100%">
|
310 |
<div class="landing-container">
|
311 |
<div class="col-1">
|
312 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>05.png" alt="<?php _e('FILTER BY RATING');?>" />
|
313 |
</div>
|
314 |
<div class="col-2">
|
315 |
<div class="section-title">
|
316 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>icon5.png" alt="icon5" />
|
317 |
+
<h2><?php _e('FILTER BY RATING');?></h2>
|
318 |
</div>
|
319 |
+
<p><?php echo sprintf (__('%1$sThe product you are watching has too many reviews?%2$sDo not worry, it is possible to filter reviews according to the vote users have given to the product. Thanks to this feature, you will be able to filter and analyse results simply and quickly, without having to scroll the entire list to find what you need.','ywar'),'<b>','</b>');?></p>
|
|
|
320 |
</div>
|
321 |
</div>
|
322 |
</div>
|
324 |
<div class="landing-container">
|
325 |
<div class="col-2">
|
326 |
<div class="section-title">
|
327 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>icon6.png" alt="icon6" />
|
328 |
+
<h2><?php _e('REPLY TO REVIEW');?></h2>
|
329 |
</div>
|
330 |
+
<p><?php echo sprintf (__('You can control the answers of the reviews with the options %1$sreply to all%2$s, %1$snone%2$s or %1$sonly to the administrator of the site%2$s.','ywar'),'<b>','</b>');?></p>
|
331 |
</div>
|
332 |
<div class="col-1">
|
333 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>06.png" alt="<?php _e('REPLY TO REVIEW');?>" />
|
334 |
</div>
|
335 |
</div>
|
336 |
</div>
|
337 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>07-bg.png) no-repeat #fff; background-position: 85% 100%">
|
338 |
<div class="landing-container">
|
339 |
<div class="col-1">
|
340 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>07.png" alt="<?php _e('MANUAL REVIEW APPROVAL');?>" />
|
341 |
</div>
|
342 |
<div class="col-2">
|
343 |
<div class="section-title">
|
344 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>07-icon.png" alt="icon7" />
|
345 |
+
<h2><?php _e('MANUAL REVIEW APPROVAL');?></h2>
|
346 |
</div>
|
347 |
+
<p><?php echo sprintf (__('Sometimes you might feel the need to approve manually reviews that your users write for your products. This option allows you to filter all reviews, and it will be always up to you to approve them %1$sbefore they can be shown%2$s to everyone.','ywar'),'<b>','</b>');?></p>
|
|
|
|
|
348 |
</div>
|
349 |
</div>
|
350 |
</div>
|
352 |
<div class="landing-container">
|
353 |
<div class="col-2">
|
354 |
<div class="section-title">
|
355 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>08-icon.png" alt="icon-08" />
|
356 |
+
<h2><?php _e('ENABLE VOTE FOR ALL');?></h2>
|
357 |
</div>
|
358 |
+
<p><?php echo sprintf (__('Do you want to prevent users to %1$svote reviews?%2$s Set the options following your needs, choosing whether only registered users can vote or anyone can.','ywar'),'<b>','</b>');?></p>
|
359 |
</div>
|
360 |
<div class="col-1">
|
361 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>08.png" alt="<?php _e('ENABLE VOTE FOR ALL');?>" />
|
362 |
</div>
|
363 |
</div>
|
364 |
</div>
|
365 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>09-bg.png) no-repeat #fff; background-position: 85% 100%">
|
366 |
<div class="landing-container">
|
367 |
<div class="col-1">
|
368 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>09.png" alt="<?php _e('INAPPROPRIATE REVIEWS');?>" />
|
369 |
</div>
|
370 |
<div class="col-2">
|
371 |
<div class="section-title">
|
372 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>09-icon.png" alt="icon-09" />
|
373 |
+
<h2><?php _e('INAPPROPRIATE REVIEWS');?></h2>
|
374 |
</div>
|
375 |
+
<p><?php echo sprintf (__('Among the different reviews your products receive, some of them might be way out of line, or contain gross words. %1$sGive your users the freedom to report them as "inappropriate":%2$s in this way, after a certain number of markings (that you can choose), the review will be automatically removed from the system. Clear your shop from impolite users.','ywar'),'<b>','</b>');?></p>
|
|
|
|
|
|
|
|
|
|
|
376 |
</div>
|
377 |
</div>
|
378 |
</div>
|
380 |
<div class="landing-container">
|
381 |
<div class="col-2">
|
382 |
<div class="section-title">
|
383 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>10-icon.png" alt="icon-10" />
|
384 |
+
<h2><?php _e('FEATURED REVIEWS');?></h2>
|
385 |
</div>
|
386 |
+
<p><?php echo sprintf (__('%1$sDid you like a review so much and you want to highlight it? That\'s easy to do!%2$s Go in the review list and click on the icon of that specific review: this will appear ahead of the other reviews of the product with a slightly different style. Your users will read it for sure!','ywar'),'<b>','</b>');?></p>
|
|
|
|
|
|
|
|
|
387 |
</div>
|
388 |
<div class="col-1">
|
389 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>10.png" alt="<?php _e('FEATURED REVIEWS');?>" />
|
390 |
</div>
|
391 |
</div>
|
392 |
</div>
|
393 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11-bg.png) no-repeat #fff; background-position: 85% 100%">
|
394 |
<div class="landing-container">
|
395 |
<div class="col-1">
|
396 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>11.png" alt="<?php _e('MORE DETAILS');?>" />
|
397 |
</div>
|
398 |
<div class="col-2">
|
399 |
<div class="section-title">
|
400 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>11-icon.png" alt="icon-11" />
|
401 |
+
<h2><?php _e('MORE DETAILS');?></h2>
|
402 |
</div>
|
403 |
+
<p><?php echo sprintf (__('The Reviews custom post type gets %1$sricher%2$s and %1$sgrants%2$s you many new details about the reviews in a single screen.%3$sAt a glance, you could see how many people consider the review useful, if this has been reported as inappropriate, if a review is featured, or if the replies are blocked.','ywar'),'<b>','</b>','<br/>');?></p>
|
|
|
|
|
|
|
404 |
</div>
|
405 |
</div>
|
406 |
</div>
|
408 |
<div class="landing-container">
|
409 |
<div class="col-2">
|
410 |
<div class="section-title">
|
411 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>12-icon.png" alt="icon-12" />
|
412 |
+
<h2><?php _e('REPORT');?></h2>
|
413 |
</div>
|
414 |
+
<p><?php echo sprintf (__('A detailed report that lets you control the %1$sinformation%2$s of the reviews for each product. You can easily discover which are the most reviewed products, and which are the best and worst voted.','ywar'),'<b>','</b>');?></p>
|
|
|
|
|
|
|
415 |
</div>
|
416 |
<div class="col-1">
|
417 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>12.png" alt="<?php _e('REPORT');?>" />
|
418 |
</div>
|
419 |
</div>
|
420 |
</div>
|
421 |
<div class="section section-even clear" style="background: url(<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>13-bg.png) no-repeat #fff; background-position: 85% 100%">
|
422 |
<div class="landing-container">
|
423 |
<div class="col-1">
|
424 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL ?>13.png" alt="<?php _e('STOP REPLY');?>" />
|
425 |
</div>
|
426 |
<div class="col-2">
|
427 |
<div class="section-title">
|
428 |
+
<img src="<?php echo YITH_YWAR_ASSETS_IMAGES_URL?>13-icon.png" alt="icon-13" />
|
429 |
+
<h2><?php _e('STOP REPLY');?></h2>
|
430 |
</div>
|
431 |
+
<p><?php echo sprintf (__('If you want to prevent the replies for specific reviews, you don\'t have to block the entire reply system. Go to the Review custom post type and %1$sblock the replies only for the reviews you want%2$s.','ywar'),'<b>','</b>');?></p>
|
|
|
|
|
|
|
432 |
</div>
|
433 |
</div>
|
434 |
</div>
|
436 |
<div class="landing-container">
|
437 |
<div class="premium-cta">
|
438 |
<p>
|
439 |
+
<?php echo sprintf (__('Upgrade to the %1$spremium version%2$s of %1$sYITH WooCommerce Advanced Reviews%2$s to benefit from all features!','ywar'),'<span class="highlight">','</span>');?>
|
|
|
440 |
</p>
|
441 |
<a href="<?php echo $YWAR_AdvancedReview->get_premium_landing_uri(); ?>" target="_blank" class="premium-cta-button button btn">
|
442 |
+
<?php echo sprintf (__('%1$sUPGRADE%2$s %3$sto the premium version%2$s','ywar'),'<span class="highlight">','</span>','<span>');?>
|
|
|
443 |
</a>
|
444 |
</div>
|
445 |
</div>
|
modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/lib/codemirror.css
ADDED
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
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-ruler {
|
92 |
+
border-left: 1px solid #ccc;
|
93 |
+
position: absolute;
|
94 |
+
}
|
95 |
+
|
96 |
+
/* DEFAULT THEME */
|
97 |
+
|
98 |
+
.cm-s-default .cm-header {color: blue;}
|
99 |
+
.cm-s-default .cm-quote {color: #090;}
|
100 |
+
.cm-negative {color: #d44;}
|
101 |
+
.cm-positive {color: #292;}
|
102 |
+
.cm-header, .cm-strong {font-weight: bold;}
|
103 |
+
.cm-em {font-style: italic;}
|
104 |
+
.cm-link {text-decoration: underline;}
|
105 |
+
.cm-strikethrough {text-decoration: line-through;}
|
106 |
+
|
107 |
+
.cm-s-default .cm-keyword {color: #708;}
|
108 |
+
.cm-s-default .cm-atom {color: #219;}
|
109 |
+
.cm-s-default .cm-number {color: #164;}
|
110 |
+
.cm-s-default .cm-def {color: #00f;}
|
111 |
+
.cm-s-default .cm-variable,
|
112 |
+
.cm-s-default .cm-punctuation,
|
113 |
+
.cm-s-default .cm-property,
|
114 |
+
.cm-s-default .cm-operator {}
|
115 |
+
.cm-s-default .cm-variable-2 {color: #05a;}
|
116 |
+
.cm-s-default .cm-variable-3 {color: #085;}
|
117 |
+
.cm-s-default .cm-comment {color: #a50;}
|
118 |
+
.cm-s-default .cm-string {color: #a11;}
|
119 |
+
.cm-s-default .cm-string-2 {color: #f50;}
|
120 |
+
.cm-s-default .cm-meta {color: #555;}
|
121 |
+
.cm-s-default .cm-qualifier {color: #555;}
|
122 |
+
.cm-s-default .cm-builtin {color: #30a;}
|
123 |
+
.cm-s-default .cm-bracket {color: #997;}
|
124 |
+
.cm-s-default .cm-tag {color: #170;}
|
125 |
+
.cm-s-default .cm-attribute {color: #00c;}
|
126 |
+
.cm-s-default .cm-hr {color: #999;}
|
127 |
+
.cm-s-default .cm-link {color: #00c;}
|
128 |
+
|
129 |
+
.cm-s-default .cm-error {color: #f00;}
|
130 |
+
.cm-invalidchar {color: #f00;}
|
131 |
+
|
132 |
+
.CodeMirror-composing { border-bottom: 2px solid; }
|
133 |
+
|
134 |
+
/* Default styles for common addons */
|
135 |
+
|
136 |
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
137 |
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
138 |
+
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
|
139 |
+
.CodeMirror-activeline-background {background: #e8f2ff;}
|
140 |
+
|
141 |
+
/* STOP */
|
142 |
+
|
143 |
+
/* The rest of this file contains styles related to the mechanics of
|
144 |
+
the editor. You probably shouldn't touch them. */
|
145 |
+
|
146 |
+
.CodeMirror {
|
147 |
+
position: relative;
|
148 |
+
overflow: hidden;
|
149 |
+
background: white;
|
150 |
+
}
|
151 |
+
|
152 |
+
.CodeMirror-scroll {
|
153 |
+
overflow: scroll !important; /* Things will break if this is overridden */
|
154 |
+
/* 30px is the magic margin used to hide the element's real scrollbars */
|
155 |
+
/* See overflow: hidden in .CodeMirror */
|
156 |
+
margin-bottom: -30px; margin-right: -30px;
|
157 |
+
padding-bottom: 30px;
|
158 |
+
height: 100%;
|
159 |
+
outline: none; /* Prevent dragging from highlighting the element */
|
160 |
+
position: relative;
|
161 |
+
}
|
162 |
+
.CodeMirror-sizer {
|
163 |
+
position: relative;
|
164 |
+
border-right: 30px solid transparent;
|
165 |
+
}
|
166 |
+
|
167 |
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
168 |
+
before actuall scrolling happens, thus preventing shaking and
|
169 |
+
flickering artifacts. */
|
170 |
+
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
171 |
+
position: absolute;
|
172 |
+
z-index: 6;
|
173 |
+
display: none;
|
174 |
+
}
|
175 |
+
.CodeMirror-vscrollbar {
|
176 |
+
right: 0; top: 0;
|
177 |
+
overflow-x: hidden;
|
178 |
+
overflow-y: scroll;
|
179 |
+
}
|
180 |
+
.CodeMirror-hscrollbar {
|
181 |
+
bottom: 0; left: 0;
|
182 |
+
overflow-y: hidden;
|
183 |
+
overflow-x: scroll;
|
184 |
+
}
|
185 |
+
.CodeMirror-scrollbar-filler {
|
186 |
+
right: 0; bottom: 0;
|
187 |
+
}
|
188 |
+
.CodeMirror-gutter-filler {
|
189 |
+
left: 0; bottom: 0;
|
190 |
+
}
|
191 |
+
|
192 |
+
.CodeMirror-gutters {
|
193 |
+
position: absolute; left: 0; top: 0;
|
194 |
+
z-index: 3;
|
195 |
+
}
|
196 |
+
.CodeMirror-gutter {
|
197 |
+
white-space: normal;
|
198 |
+
height: 100%;
|
199 |
+
display: inline-block;
|
200 |
+
margin-bottom: -30px;
|
201 |
+
/* Hack to make IE7 behave */
|
202 |
+
*zoom:1;
|
203 |
+
*display:inline;
|
204 |
+
}
|
205 |
+
.CodeMirror-gutter-wrapper {
|
206 |
+
position: absolute;
|
207 |
+
z-index: 4;
|
208 |
+
background: none !important;
|
209 |
+
border: none !important;
|
210 |
+
}
|
211 |
+
.CodeMirror-gutter-background {
|
212 |
+
position: absolute;
|
213 |
+
top: 0; bottom: 0;
|
214 |
+
z-index: 4;
|
215 |
+
}
|
216 |
+
.CodeMirror-gutter-elt {
|
217 |
+
position: absolute;
|
218 |
+
cursor: default;
|
219 |
+
z-index: 4;
|
220 |
+
}
|
221 |
+
.CodeMirror-gutter-wrapper {
|
222 |
+
-webkit-user-select: none;
|
223 |
+
-moz-user-select: none;
|
224 |
+
user-select: none;
|
225 |
+
}
|
226 |
+
|
227 |
+
.CodeMirror-lines {
|
228 |
+
cursor: text;
|
229 |
+
min-height: 1px; /* prevents collapsing before first draw */
|
230 |
+
}
|
231 |
+
.CodeMirror pre {
|
232 |
+
/* Reset some styles that the rest of the page might have set */
|
233 |
+
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
234 |
+
border-width: 0;
|
235 |
+
background: transparent;
|
236 |
+
font-family: inherit;
|
237 |
+
font-size: inherit;
|
238 |
+
margin: 0;
|
239 |
+
white-space: pre;
|
240 |
+
word-wrap: normal;
|
241 |
+
line-height: inherit;
|
242 |
+
color: inherit;
|
243 |
+
z-index: 2;
|
244 |
+
position: relative;
|
245 |
+
overflow: visible;
|
246 |
+
-webkit-tap-highlight-color: transparent;
|
247 |
+
}
|
248 |
+
.CodeMirror-wrap pre {
|
249 |
+
word-wrap: break-word;
|
250 |
+
white-space: pre-wrap;
|
251 |
+
word-break: normal;
|
252 |
+
}
|
253 |
+
|
254 |
+
.CodeMirror-linebackground {
|
255 |
+
position: absolute;
|
256 |
+
left: 0; right: 0; top: 0; bottom: 0;
|
257 |
+
z-index: 0;
|
258 |
+
}
|
259 |
+
|
260 |
+
.CodeMirror-linewidget {
|
261 |
+
position: relative;
|
262 |
+
z-index: 2;
|
263 |
+
overflow: auto;
|
264 |
+
}
|
265 |
+
|
266 |
+
.CodeMirror-widget {}
|
267 |
+
|
268 |
+
.CodeMirror-code {
|
269 |
+
outline: none;
|
270 |
+
}
|
271 |
+
|
272 |
+
/* Force content-box sizing for the elements where we expect it */
|
273 |
+
.CodeMirror-scroll,
|
274 |
+
.CodeMirror-sizer,
|
275 |
+
.CodeMirror-gutter,
|
276 |
+
.CodeMirror-gutters,
|
277 |
+
.CodeMirror-linenumber {
|
278 |
+
-moz-box-sizing: content-box;
|
279 |
+
box-sizing: content-box;
|
280 |
+
}
|
281 |
+
|
282 |
+
.CodeMirror-measure {
|
283 |
+
position: absolute;
|
284 |
+
width: 100%;
|
285 |
+
height: 0;
|
286 |
+
overflow: hidden;
|
287 |
+
visibility: hidden;
|
288 |
+
}
|
289 |
+
|
290 |
+
.CodeMirror-cursor { position: absolute; }
|
291 |
+
.CodeMirror-measure pre { position: static; }
|
292 |
+
|
293 |
+
div.CodeMirror-cursors {
|
294 |
+
visibility: hidden;
|
295 |
+
position: relative;
|
296 |
+
z-index: 3;
|
297 |
+
}
|
298 |
+
div.CodeMirror-dragcursors {
|
299 |
+
visibility: visible;
|
300 |
+
}
|
301 |
+
|
302 |
+
.CodeMirror-focused div.CodeMirror-cursors {
|
303 |
+
visibility: visible;
|
304 |
+
}
|
305 |
+
|
306 |
+
.CodeMirror-selected { background: #d9d9d9; }
|
307 |
+
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
308 |
+
.CodeMirror-crosshair { cursor: crosshair; }
|
309 |
+
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
|
310 |
+
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
|
311 |
+
|
312 |
+
.cm-searching {
|
313 |
+
background: #ffa;
|
314 |
+
background: rgba(255, 255, 0, .4);
|
315 |
+
}
|
316 |
+
|
317 |
+
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
318 |
+
.CodeMirror span { *vertical-align: text-bottom; }
|
319 |
+
|
320 |
+
/* Used to force a border model for a node */
|
321 |
+
.cm-force-border { padding-right: .1px; }
|
322 |
+
|
323 |
+
@media print {
|
324 |
+
/* Hide the cursor when printing */
|
325 |
+
.CodeMirror div.CodeMirror-cursors {
|
326 |
+
visibility: hidden;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
/* See issue #2901 */
|
331 |
+
.cm-tab-wrap-hack:after { content: ''; }
|
332 |
+
|
333 |
+
/* Help users use markselection to safely style text background */
|
334 |
+
span.CodeMirror-selectedtext { background: none; }
|
modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/lib/codemirror.js
ADDED
@@ -0,0 +1,8822 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(mod) {
|
11 |
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
12 |
+
module.exports = mod();
|
13 |
+
else if (typeof define == "function" && define.amd) // AMD
|
14 |
+
return define([], mod);
|
15 |
+
else // Plain browser env
|
16 |
+
this.CodeMirror = mod();
|
17 |
+
})(function() {
|
18 |
+
"use strict";
|
19 |
+
|
20 |
+
// BROWSER SNIFFING
|
21 |
+
|
22 |
+
// Kludges for bugs and behavior differences that can't be feature
|
23 |
+
// detected are enabled based on userAgent etc sniffing.
|
24 |
+
|
25 |
+
var gecko = /gecko\/\d/i.test(navigator.userAgent);
|
26 |
+
var ie_upto10 = /MSIE \d/.test(navigator.userAgent);
|
27 |
+
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
28 |
+
var ie = ie_upto10 || ie_11up;
|
29 |
+
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);
|
30 |
+
var webkit = /WebKit\//.test(navigator.userAgent);
|
31 |
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
|
32 |
+
var chrome = /Chrome\//.test(navigator.userAgent);
|
33 |
+
var presto = /Opera\//.test(navigator.userAgent);
|
34 |
+
var safari = /Apple Computer/.test(navigator.vendor);
|
35 |
+
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
|
36 |
+
var phantom = /PhantomJS/.test(navigator.userAgent);
|
37 |
+
|
38 |
+
var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
39 |
+
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
40 |
+
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
|
41 |
+
var mac = ios || /Mac/.test(navigator.platform);
|
42 |
+
var windows = /win/i.test(navigator.platform);
|
43 |
+
|
44 |
+
var presto_version = presto && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
|
45 |
+
if (presto_version) presto_version = Number(presto_version[1]);
|
46 |
+
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
|
47 |
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
48 |
+
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
|
49 |
+
var captureRightClick = gecko || (ie && ie_version >= 9);
|
50 |
+
|
51 |
+
// Optimize some code when these features are not used.
|
52 |
+
var sawReadOnlySpans = false, sawCollapsedSpans = false;
|
53 |
+
|
54 |
+
// EDITOR CONSTRUCTOR
|
55 |
+
|
56 |
+
// A CodeMirror instance represents an editor. This is the object
|
57 |
+
// that user code is usually dealing with.
|
58 |
+
|
59 |
+
function CodeMirror(place, options) {
|
60 |
+
if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
|
61 |
+
|
62 |
+
this.options = options = options ? copyObj(options) : {};
|
63 |
+
// Determine effective options based on given values and defaults.
|
64 |
+
copyObj(defaults, options, false);
|
65 |
+
setGuttersForLineNumbers(options);
|
66 |
+
|
67 |
+
var doc = options.value;
|
68 |
+
if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator);
|
69 |
+
this.doc = doc;
|
70 |
+
|
71 |
+
var input = new CodeMirror.inputStyles[options.inputStyle](this);
|
72 |
+
var display = this.display = new Display(place, doc, input);
|
73 |
+
display.wrapper.CodeMirror = this;
|
74 |
+
updateGutters(this);
|
75 |
+
themeChanged(this);
|
76 |
+
if (options.lineWrapping)
|
77 |
+
this.display.wrapper.className += " CodeMirror-wrap";
|
78 |
+
if (options.autofocus && !mobile) display.input.focus();
|
79 |
+
initScrollbars(this);
|
80 |
+
|
81 |
+
this.state = {
|
82 |
+
keyMaps: [], // stores maps added by addKeyMap
|
83 |
+
overlays: [], // highlighting overlays, as added by addOverlay
|
84 |
+
modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
|
85 |
+
overwrite: false,
|
86 |
+
delayingBlurEvent: false,
|
87 |
+
focused: false,
|
88 |
+
suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
|
89 |
+
pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll
|
90 |
+
selectingText: false,
|
91 |
+
draggingText: false,
|
92 |
+
highlight: new Delayed(), // stores highlight worker timeout
|
93 |
+
keySeq: null, // Unfinished key sequence
|
94 |
+
specialChars: null
|
95 |
+
};
|
96 |
+
|
97 |
+
var cm = this;
|
98 |
+
|
99 |
+
// Override magic textarea content restore that IE sometimes does
|
100 |
+
// on our hidden textarea on reload
|
101 |
+
if (ie && ie_version < 11) setTimeout(function() { cm.display.input.reset(true); }, 20);
|
102 |
+
|
103 |
+
registerEventHandlers(this);
|
104 |
+
ensureGlobalHandlers();
|
105 |
+
|
106 |
+
startOperation(this);
|
107 |
+
this.curOp.forceUpdate = true;
|
108 |
+
attachDoc(this, doc);
|
109 |
+
|
110 |
+
if ((options.autofocus && !mobile) || cm.hasFocus())
|
111 |
+
setTimeout(bind(onFocus, this), 20);
|
112 |
+
else
|
113 |
+
onBlur(this);
|
114 |
+
|
115 |
+
for (var opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
|
116 |
+
optionHandlers[opt](this, options[opt], Init);
|
117 |
+
maybeUpdateLineNumberWidth(this);
|
118 |
+
if (options.finishInit) options.finishInit(this);
|
119 |
+
for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
|
120 |
+
endOperation(this);
|
121 |
+
// Suppress optimizelegibility in Webkit, since it breaks text
|
122 |
+
// measuring on line wrapping boundaries.
|
123 |
+
if (webkit && options.lineWrapping &&
|
124 |
+
getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
|
125 |
+
display.lineDiv.style.textRendering = "auto";
|
126 |
+
}
|
127 |
+
|
128 |
+
// DISPLAY CONSTRUCTOR
|
129 |
+
|
130 |
+
// The display handles the DOM integration, both for input reading
|
131 |
+
// and content drawing. It holds references to DOM nodes and
|
132 |
+
// display-related state.
|
133 |
+
|
134 |
+
function Display(place, doc, input) {
|
135 |
+
var d = this;
|
136 |
+
this.input = input;
|
137 |
+
|
138 |
+
// Covers bottom-right square when both scrollbars are present.
|
139 |
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
|
140 |
+
d.scrollbarFiller.setAttribute("cm-not-content", "true");
|
141 |
+
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
142 |
+
// and h scrollbar is present.
|
143 |
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
|
144 |
+
d.gutterFiller.setAttribute("cm-not-content", "true");
|
145 |
+
// Will contain the actual code, positioned to cover the viewport.
|
146 |
+
d.lineDiv = elt("div", null, "CodeMirror-code");
|
147 |
+
// Elements are added to these to represent selection and cursors.
|
148 |
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
|
149 |
+
d.cursorDiv = elt("div", null, "CodeMirror-cursors");
|
150 |
+
// A visibility: hidden element used to find the size of things.
|
151 |
+
d.measure = elt("div", null, "CodeMirror-measure");
|
152 |
+
// When lines outside of the viewport are measured, they are drawn in this.
|
153 |
+
d.lineMeasure = elt("div", null, "CodeMirror-measure");
|
154 |
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
155 |
+
d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
156 |
+
null, "position: relative; outline: none");
|
157 |
+
// Moved around its parent to cover visible view.
|
158 |
+
d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
|
159 |
+
// Set to the height of the document, allowing scrolling.
|
160 |
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
|
161 |
+
d.sizerWidth = null;
|
162 |
+
// Behavior of elts with overflow: auto and padding is
|
163 |
+
// inconsistent across browsers. This is used to ensure the
|
164 |
+
// scrollable area is big enough.
|
165 |
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
|
166 |
+
// Will contain the gutters, if any.
|
167 |
+
d.gutters = elt("div", null, "CodeMirror-gutters");
|
168 |
+
d.lineGutter = null;
|
169 |
+
// Actual scrollable element.
|
170 |
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
|
171 |
+
d.scroller.setAttribute("tabIndex", "-1");
|
172 |
+
// The element in which the editor lives.
|
173 |
+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
|
174 |
+
|
175 |
+
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
176 |
+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
|
177 |
+
if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;
|
178 |
+
|
179 |
+
if (place) {
|
180 |
+
if (place.appendChild) place.appendChild(d.wrapper);
|
181 |
+
else place(d.wrapper);
|
182 |
+
}
|
183 |
+
|
184 |
+
// Current rendered range (may be bigger than the view window).
|
185 |
+
d.viewFrom = d.viewTo = doc.first;
|
186 |
+
d.reportedViewFrom = d.reportedViewTo = doc.first;
|
187 |
+
// Information about the rendered lines.
|
188 |
+
d.view = [];
|
189 |
+
d.renderedView = null;
|
190 |
+
// Holds info about a single rendered line when it was rendered
|
191 |
+
// for measurement, while not in view.
|
192 |
+
d.externalMeasured = null;
|
193 |
+
// Empty space (in pixels) above the view
|
194 |
+
d.viewOffset = 0;
|
195 |
+
d.lastWrapHeight = d.lastWrapWidth = 0;
|
196 |
+
d.updateLineNumbers = null;
|
197 |
+
|
198 |
+
d.nativeBarWidth = d.barHeight = d.barWidth = 0;
|
199 |
+
d.scrollbarsClipped = false;
|
200 |
+
|
201 |
+
// Used to only resize the line number gutter when necessary (when
|
202 |
+
// the amount of lines crosses a boundary that makes its width change)
|
203 |
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
|
204 |
+
// Set to true when a non-horizontal-scrolling line widget is
|
205 |
+
// added. As an optimization, line widget aligning is skipped when
|
206 |
+
// this is false.
|
207 |
+
d.alignWidgets = false;
|
208 |
+
|
209 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
210 |
+
|
211 |
+
// Tracks the maximum line length so that the horizontal scrollbar
|
212 |
+
// can be kept static when scrolling.
|
213 |
+
d.maxLine = null;
|
214 |
+
d.maxLineLength = 0;
|
215 |
+
d.maxLineChanged = false;
|
216 |
+
|
217 |
+
// Used for measuring wheel scrolling granularity
|
218 |
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
|
219 |
+
|
220 |
+
// True when shift is held down.
|
221 |
+
d.shift = false;
|
222 |
+
|
223 |
+
// Used to track whether anything happened since the context menu
|
224 |
+
// was opened.
|
225 |
+
d.selForContextMenu = null;
|
226 |
+
|
227 |
+
d.activeTouch = null;
|
228 |
+
|
229 |
+
input.init(d);
|
230 |
+
}
|
231 |
+
|
232 |
+
// STATE UPDATES
|
233 |
+
|
234 |
+
// Used to get the editor into a consistent state again when options change.
|
235 |
+
|
236 |
+
function loadMode(cm) {
|
237 |
+
cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
|
238 |
+
resetModeState(cm);
|
239 |
+
}
|
240 |
+
|
241 |
+
function resetModeState(cm) {
|
242 |
+
cm.doc.iter(function(line) {
|
243 |
+
if (line.stateAfter) line.stateAfter = null;
|
244 |
+
if (line.styles) line.styles = null;
|
245 |
+
});
|
246 |
+
cm.doc.frontier = cm.doc.first;
|
247 |
+
startWorker(cm, 100);
|
248 |
+
cm.state.modeGen++;
|
249 |
+
if (cm.curOp) regChange(cm);
|
250 |
+
}
|
251 |
+
|
252 |
+
function wrappingChanged(cm) {
|
253 |
+
if (cm.options.lineWrapping) {
|
254 |
+
addClass(cm.display.wrapper, "CodeMirror-wrap");
|
255 |
+
cm.display.sizer.style.minWidth = "";
|
256 |
+
cm.display.sizerWidth = null;
|
257 |
+
} else {
|
258 |
+
rmClass(cm.display.wrapper, "CodeMirror-wrap");
|
259 |
+
findMaxLine(cm);
|
260 |
+
}
|
261 |
+
estimateLineHeights(cm);
|
262 |
+
regChange(cm);
|
263 |
+
clearCaches(cm);
|
264 |
+
setTimeout(function(){updateScrollbars(cm);}, 100);
|
265 |
+
}
|
266 |
+
|
267 |
+
// Returns a function that estimates the height of a line, to use as
|
268 |
+
// first approximation until the line becomes visible (and is thus
|
269 |
+
// properly measurable).
|
270 |
+
function estimateHeight(cm) {
|
271 |
+
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
|
272 |
+
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
|
273 |
+
return function(line) {
|
274 |
+
if (lineIsHidden(cm.doc, line)) return 0;
|
275 |
+
|
276 |
+
var widgetsHeight = 0;
|
277 |
+
if (line.widgets) for (var i = 0; i < line.widgets.length; i++) {
|
278 |
+
if (line.widgets[i].height) widgetsHeight += line.widgets[i].height;
|
279 |
+
}
|
280 |
+
|
281 |
+
if (wrapping)
|
282 |
+
return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;
|
283 |
+
else
|
284 |
+
return widgetsHeight + th;
|
285 |
+
};
|
286 |
+
}
|
287 |
+
|
288 |
+
function estimateLineHeights(cm) {
|
289 |
+
var doc = cm.doc, est = estimateHeight(cm);
|
290 |
+
doc.iter(function(line) {
|
291 |
+
var estHeight = est(line);
|
292 |
+
if (estHeight != line.height) updateLineHeight(line, estHeight);
|
293 |
+
});
|
294 |
+
}
|
295 |
+
|
296 |
+
function themeChanged(cm) {
|
297 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
|
298 |
+
cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
|
299 |
+
clearCaches(cm);
|
300 |
+
}
|
301 |
+
|
302 |
+
function guttersChanged(cm) {
|
303 |
+
updateGutters(cm);
|
304 |
+
regChange(cm);
|
305 |
+
setTimeout(function(){alignHorizontally(cm);}, 20);
|
306 |
+
}
|
307 |
+
|
308 |
+
// Rebuild the gutter elements, ensure the margin to the left of the
|
309 |
+
// code matches their width.
|
310 |
+
function updateGutters(cm) {
|
311 |
+
var gutters = cm.display.gutters, specs = cm.options.gutters;
|
312 |
+
removeChildren(gutters);
|
313 |
+
for (var i = 0; i < specs.length; ++i) {
|
314 |
+
var gutterClass = specs[i];
|
315 |
+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
|
316 |
+
if (gutterClass == "CodeMirror-linenumbers") {
|
317 |
+
cm.display.lineGutter = gElt;
|
318 |
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
|
319 |
+
}
|
320 |
+
}
|
321 |
+
gutters.style.display = i ? "" : "none";
|
322 |
+
updateGutterSpace(cm);
|
323 |
+
}
|
324 |
+
|
325 |
+
function updateGutterSpace(cm) {
|
326 |
+
var width = cm.display.gutters.offsetWidth;
|
327 |
+
cm.display.sizer.style.marginLeft = width + "px";
|
328 |
+
}
|
329 |
+
|
330 |
+
// Compute the character length of a line, taking into account
|
331 |
+
// collapsed ranges (see markText) that might hide parts, and join
|
332 |
+
// other lines onto it.
|
333 |
+
function lineLength(line) {
|
334 |
+
if (line.height == 0) return 0;
|
335 |
+
var len = line.text.length, merged, cur = line;
|
336 |
+
while (merged = collapsedSpanAtStart(cur)) {
|
337 |
+
var found = merged.find(0, true);
|
338 |
+
cur = found.from.line;
|
339 |
+
len += found.from.ch - found.to.ch;
|
340 |
+
}
|
341 |
+
cur = line;
|
342 |
+
while (merged = collapsedSpanAtEnd(cur)) {
|
343 |
+
var found = merged.find(0, true);
|
344 |
+
len -= cur.text.length - found.from.ch;
|
345 |
+
cur = found.to.line;
|
346 |
+
len += cur.text.length - found.to.ch;
|
347 |
+
}
|
348 |
+
return len;
|
349 |
+
}
|
350 |
+
|
351 |
+
// Find the longest line in the document.
|
352 |
+
function findMaxLine(cm) {
|
353 |
+
var d = cm.display, doc = cm.doc;
|
354 |
+
d.maxLine = getLine(doc, doc.first);
|
355 |
+
d.maxLineLength = lineLength(d.maxLine);
|
356 |
+
d.maxLineChanged = true;
|
357 |
+
doc.iter(function(line) {
|
358 |
+
var len = lineLength(line);
|
359 |
+
if (len > d.maxLineLength) {
|
360 |
+
d.maxLineLength = len;
|
361 |
+
d.maxLine = line;
|
362 |
+
}
|
363 |
+
});
|
364 |
+
}
|
365 |
+
|
366 |
+
// Make sure the gutters options contains the element
|
367 |
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
368 |
+
function setGuttersForLineNumbers(options) {
|
369 |
+
var found = indexOf(options.gutters, "CodeMirror-linenumbers");
|
370 |
+
if (found == -1 && options.lineNumbers) {
|
371 |
+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
|
372 |
+
} else if (found > -1 && !options.lineNumbers) {
|
373 |
+
options.gutters = options.gutters.slice(0);
|
374 |
+
options.gutters.splice(found, 1);
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
// SCROLLBARS
|
379 |
+
|
380 |
+
// Prepare DOM reads needed to update the scrollbars. Done in one
|
381 |
+
// shot to minimize update/measure roundtrips.
|
382 |
+
function measureForScrollbars(cm) {
|
383 |
+
var d = cm.display, gutterW = d.gutters.offsetWidth;
|
384 |
+
var docH = Math.round(cm.doc.height + paddingVert(cm.display));
|
385 |
+
return {
|
386 |
+
clientHeight: d.scroller.clientHeight,
|
387 |
+
viewHeight: d.wrapper.clientHeight,
|
388 |
+
scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
|
389 |
+
viewWidth: d.wrapper.clientWidth,
|
390 |
+
barLeft: cm.options.fixedGutter ? gutterW : 0,
|
391 |
+
docHeight: docH,
|
392 |
+
scrollHeight: docH + scrollGap(cm) + d.barHeight,
|
393 |
+
nativeBarWidth: d.nativeBarWidth,
|
394 |
+
gutterWidth: gutterW
|
395 |
+
};
|
396 |
+
}
|
397 |
+
|
398 |
+
function NativeScrollbars(place, scroll, cm) {
|
399 |
+
this.cm = cm;
|
400 |
+
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
|
401 |
+
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
|
402 |
+
place(vert); place(horiz);
|
403 |
+
|
404 |
+
on(vert, "scroll", function() {
|
405 |
+
if (vert.clientHeight) scroll(vert.scrollTop, "vertical");
|
406 |
+
});
|
407 |
+
on(horiz, "scroll", function() {
|
408 |
+
if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
|
409 |
+
});
|
410 |
+
|
411 |
+
this.checkedOverlay = false;
|
412 |
+
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
413 |
+
if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
|
414 |
+
}
|
415 |
+
|
416 |
+
NativeScrollbars.prototype = copyObj({
|
417 |
+
update: function(measure) {
|
418 |
+
var needsH = measure.scrollWidth > measure.clientWidth + 1;
|
419 |
+
var needsV = measure.scrollHeight > measure.clientHeight + 1;
|
420 |
+
var sWidth = measure.nativeBarWidth;
|
421 |
+
|
422 |
+
if (needsV) {
|
423 |
+
this.vert.style.display = "block";
|
424 |
+
this.vert.style.bottom = needsH ? sWidth + "px" : "0";
|
425 |
+
var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
|
426 |
+
// A bug in IE8 can cause this value to be negative, so guard it.
|
427 |
+
this.vert.firstChild.style.height =
|
428 |
+
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
|
429 |
+
} else {
|
430 |
+
this.vert.style.display = "";
|
431 |
+
this.vert.firstChild.style.height = "0";
|
432 |
+
}
|
433 |
+
|
434 |
+
if (needsH) {
|
435 |
+
this.horiz.style.display = "block";
|
436 |
+
this.horiz.style.right = needsV ? sWidth + "px" : "0";
|
437 |
+
this.horiz.style.left = measure.barLeft + "px";
|
438 |
+
var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
|
439 |
+
this.horiz.firstChild.style.width =
|
440 |
+
(measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
|
441 |
+
} else {
|
442 |
+
this.horiz.style.display = "";
|
443 |
+
this.horiz.firstChild.style.width = "0";
|
444 |
+
}
|
445 |
+
|
446 |
+
if (!this.checkedOverlay && measure.clientHeight > 0) {
|
447 |
+
if (sWidth == 0) this.overlayHack();
|
448 |
+
this.checkedOverlay = true;
|
449 |
+
}
|
450 |
+
|
451 |
+
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
|
452 |
+
},
|
453 |
+
setScrollLeft: function(pos) {
|
454 |
+
if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
|
455 |
+
},
|
456 |
+
setScrollTop: function(pos) {
|
457 |
+
if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
|
458 |
+
},
|
459 |
+
overlayHack: function() {
|
460 |
+
var w = mac && !mac_geMountainLion ? "12px" : "18px";
|
461 |
+
this.horiz.style.minHeight = this.vert.style.minWidth = w;
|
462 |
+
var self = this;
|
463 |
+
var barMouseDown = function(e) {
|
464 |
+
if (e_target(e) != self.vert && e_target(e) != self.horiz)
|
465 |
+
operation(self.cm, onMouseDown)(e);
|
466 |
+
};
|
467 |
+
on(this.vert, "mousedown", barMouseDown);
|
468 |
+
on(this.horiz, "mousedown", barMouseDown);
|
469 |
+
},
|
470 |
+
clear: function() {
|
471 |
+
var parent = this.horiz.parentNode;
|
472 |
+
parent.removeChild(this.horiz);
|
473 |
+
parent.removeChild(this.vert);
|
474 |
+
}
|
475 |
+
}, NativeScrollbars.prototype);
|
476 |
+
|
477 |
+
function NullScrollbars() {}
|
478 |
+
|
479 |
+
NullScrollbars.prototype = copyObj({
|
480 |
+
update: function() { return {bottom: 0, right: 0}; },
|
481 |
+
setScrollLeft: function() {},
|
482 |
+
setScrollTop: function() {},
|
483 |
+
clear: function() {}
|
484 |
+
}, NullScrollbars.prototype);
|
485 |
+
|
486 |
+
CodeMirror.scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
|
487 |
+
|
488 |
+
function initScrollbars(cm) {
|
489 |
+
if (cm.display.scrollbars) {
|
490 |
+
cm.display.scrollbars.clear();
|
491 |
+
if (cm.display.scrollbars.addClass)
|
492 |
+
rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);
|
493 |
+
}
|
494 |
+
|
495 |
+
cm.display.scrollbars = new CodeMirror.scrollbarModel[cm.options.scrollbarStyle](function(node) {
|
496 |
+
cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
|
497 |
+
// Prevent clicks in the scrollbars from killing focus
|
498 |
+
on(node, "mousedown", function() {
|
499 |
+
if (cm.state.focused) setTimeout(function() { cm.display.input.focus(); }, 0);
|
500 |
+
});
|
501 |
+
node.setAttribute("cm-not-content", "true");
|
502 |
+
}, function(pos, axis) {
|
503 |
+
if (axis == "horizontal") setScrollLeft(cm, pos);
|
504 |
+
else setScrollTop(cm, pos);
|
505 |
+
}, cm);
|
506 |
+
if (cm.display.scrollbars.addClass)
|
507 |
+
addClass(cm.display.wrapper, cm.display.scrollbars.addClass);
|
508 |
+
}
|
509 |
+
|
510 |
+
function updateScrollbars(cm, measure) {
|
511 |
+
if (!measure) measure = measureForScrollbars(cm);
|
512 |
+
var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
|
513 |
+
updateScrollbarsInner(cm, measure);
|
514 |
+
for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
|
515 |
+
if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
|
516 |
+
updateHeightsInViewport(cm);
|
517 |
+
updateScrollbarsInner(cm, measureForScrollbars(cm));
|
518 |
+
startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
// Re-synchronize the fake scrollbars with the actual size of the
|
523 |
+
// content.
|
524 |
+
function updateScrollbarsInner(cm, measure) {
|
525 |
+
var d = cm.display;
|
526 |
+
var sizes = d.scrollbars.update(measure);
|
527 |
+
|
528 |
+
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
|
529 |
+
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
|
530 |
+
|
531 |
+
if (sizes.right && sizes.bottom) {
|
532 |
+
d.scrollbarFiller.style.display = "block";
|
533 |
+
d.scrollbarFiller.style.height = sizes.bottom + "px";
|
534 |
+
d.scrollbarFiller.style.width = sizes.right + "px";
|
535 |
+
} else d.scrollbarFiller.style.display = "";
|
536 |
+
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
537 |
+
d.gutterFiller.style.display = "block";
|
538 |
+
d.gutterFiller.style.height = sizes.bottom + "px";
|
539 |
+
d.gutterFiller.style.width = measure.gutterWidth + "px";
|
540 |
+
} else d.gutterFiller.style.display = "";
|
541 |
+
}
|
542 |
+
|
543 |
+
// Compute the lines that are visible in a given viewport (defaults
|
544 |
+
// the the current scroll position). viewport may contain top,
|
545 |
+
// height, and ensure (see op.scrollToPos) properties.
|
546 |
+
function visibleLines(display, doc, viewport) {
|
547 |
+
var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
|
548 |
+
top = Math.floor(top - paddingTop(display));
|
549 |
+
var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
|
550 |
+
|
551 |
+
var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
|
552 |
+
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
553 |
+
// forces those lines into the viewport (if possible).
|
554 |
+
if (viewport && viewport.ensure) {
|
555 |
+
var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
|
556 |
+
if (ensureFrom < from) {
|
557 |
+
from = ensureFrom;
|
558 |
+
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
|
559 |
+
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
560 |
+
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
|
561 |
+
to = ensureTo;
|
562 |
+
}
|
563 |
+
}
|
564 |
+
return {from: from, to: Math.max(to, from + 1)};
|
565 |
+
}
|
566 |
+
|
567 |
+
// LINE NUMBERS
|
568 |
+
|
569 |
+
// Re-align line numbers and gutter marks to compensate for
|
570 |
+
// horizontal scrolling.
|
571 |
+
function alignHorizontally(cm) {
|
572 |
+
var display = cm.display, view = display.view;
|
573 |
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
|
574 |
+
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
|
575 |
+
var gutterW = display.gutters.offsetWidth, left = comp + "px";
|
576 |
+
for (var i = 0; i < view.length; i++) if (!view[i].hidden) {
|
577 |
+
if (cm.options.fixedGutter && view[i].gutter)
|
578 |
+
view[i].gutter.style.left = left;
|
579 |
+
var align = view[i].alignable;
|
580 |
+
if (align) for (var j = 0; j < align.length; j++)
|
581 |
+
align[j].style.left = left;
|
582 |
+
}
|
583 |
+
if (cm.options.fixedGutter)
|
584 |
+
display.gutters.style.left = (comp + gutterW) + "px";
|
585 |
+
}
|
586 |
+
|
587 |
+
// Used to ensure that the line number gutter is still the right
|
588 |
+
// size for the current document size. Returns true when an update
|
589 |
+
// is needed.
|
590 |
+
function maybeUpdateLineNumberWidth(cm) {
|
591 |
+
if (!cm.options.lineNumbers) return false;
|
592 |
+
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
|
593 |
+
if (last.length != display.lineNumChars) {
|
594 |
+
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
595 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt"));
|
596 |
+
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
|
597 |
+
display.lineGutter.style.width = "";
|
598 |
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
|
599 |
+
display.lineNumWidth = display.lineNumInnerWidth + padding;
|
600 |
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
|
601 |
+
display.lineGutter.style.width = display.lineNumWidth + "px";
|
602 |
+
updateGutterSpace(cm);
|
603 |
+
return true;
|
604 |
+
}
|
605 |
+
return false;
|
606 |
+
}
|
607 |
+
|
608 |
+
function lineNumberFor(options, i) {
|
609 |
+
return String(options.lineNumberFormatter(i + options.firstLineNumber));
|
610 |
+
}
|
611 |
+
|
612 |
+
// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
|
613 |
+
// but using getBoundingClientRect to get a sub-pixel-accurate
|
614 |
+
// result.
|
615 |
+
function compensateForHScroll(display) {
|
616 |
+
return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
|
617 |
+
}
|
618 |
+
|
619 |
+
// DISPLAY DRAWING
|
620 |
+
|
621 |
+
function DisplayUpdate(cm, viewport, force) {
|
622 |
+
var display = cm.display;
|
623 |
+
|
624 |
+
this.viewport = viewport;
|
625 |
+
// Store some values that we'll need later (but don't want to force a relayout for)
|
626 |
+
this.visible = visibleLines(display, cm.doc, viewport);
|
627 |
+
this.editorIsHidden = !display.wrapper.offsetWidth;
|
628 |
+
this.wrapperHeight = display.wrapper.clientHeight;
|
629 |
+
this.wrapperWidth = display.wrapper.clientWidth;
|
630 |
+
this.oldDisplayWidth = displayWidth(cm);
|
631 |
+
this.force = force;
|
632 |
+
this.dims = getDimensions(cm);
|
633 |
+
this.events = [];
|
634 |
+
}
|
635 |
+
|
636 |
+
DisplayUpdate.prototype.signal = function(emitter, type) {
|
637 |
+
if (hasHandler(emitter, type))
|
638 |
+
this.events.push(arguments);
|
639 |
+
};
|
640 |
+
DisplayUpdate.prototype.finish = function() {
|
641 |
+
for (var i = 0; i < this.events.length; i++)
|
642 |
+
signal.apply(null, this.events[i]);
|
643 |
+
};
|
644 |
+
|
645 |
+
function maybeClipScrollbars(cm) {
|
646 |
+
var display = cm.display;
|
647 |
+
if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
|
648 |
+
display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
|
649 |
+
display.heightForcer.style.height = scrollGap(cm) + "px";
|
650 |
+
display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
|
651 |
+
display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
|
652 |
+
display.scrollbarsClipped = true;
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
+
// Does the actual updating of the line display. Bails out
|
657 |
+
// (returning false) when there is nothing to be done and forced is
|
658 |
+
// false.
|
659 |
+
function updateDisplayIfNeeded(cm, update) {
|
660 |
+
var display = cm.display, doc = cm.doc;
|
661 |
+
|
662 |
+
if (update.editorIsHidden) {
|
663 |
+
resetView(cm);
|
664 |
+
return false;
|
665 |
+
}
|
666 |
+
|
667 |
+
// Bail out if the visible area is already rendered and nothing changed.
|
668 |
+
if (!update.force &&
|
669 |
+
update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
|
670 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
|
671 |
+
display.renderedView == display.view && countDirtyView(cm) == 0)
|
672 |
+
return false;
|
673 |
+
|
674 |
+
if (maybeUpdateLineNumberWidth(cm)) {
|
675 |
+
resetView(cm);
|
676 |
+
update.dims = getDimensions(cm);
|
677 |
+
}
|
678 |
+
|
679 |
+
// Compute a suitable new viewport (from & to)
|
680 |
+
var end = doc.first + doc.size;
|
681 |
+
var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
|
682 |
+
var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
|
683 |
+
if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom);
|
684 |
+
if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo);
|
685 |
+
if (sawCollapsedSpans) {
|
686 |
+
from = visualLineNo(cm.doc, from);
|
687 |
+
to = visualLineEndNo(cm.doc, to);
|
688 |
+
}
|
689 |
+
|
690 |
+
var different = from != display.viewFrom || to != display.viewTo ||
|
691 |
+
display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
|
692 |
+
adjustView(cm, from, to);
|
693 |
+
|
694 |
+
display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
|
695 |
+
// Position the mover div to align with the current scroll position
|
696 |
+
cm.display.mover.style.top = display.viewOffset + "px";
|
697 |
+
|
698 |
+
var toUpdate = countDirtyView(cm);
|
699 |
+
if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
|
700 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
|
701 |
+
return false;
|
702 |
+
|
703 |
+
// For big changes, we hide the enclosing element during the
|
704 |
+
// update, since that speeds up the operations on most browsers.
|
705 |
+
var focused = activeElt();
|
706 |
+
if (toUpdate > 4) display.lineDiv.style.display = "none";
|
707 |
+
patchDisplay(cm, display.updateLineNumbers, update.dims);
|
708 |
+
if (toUpdate > 4) display.lineDiv.style.display = "";
|
709 |
+
display.renderedView = display.view;
|
710 |
+
// There might have been a widget with a focused element that got
|
711 |
+
// hidden or updated, if so re-focus it.
|
712 |
+
if (focused && activeElt() != focused && focused.offsetHeight) focused.focus();
|
713 |
+
|
714 |
+
// Prevent selection and cursors from interfering with the scroll
|
715 |
+
// width and height.
|
716 |
+
removeChildren(display.cursorDiv);
|
717 |
+
removeChildren(display.selectionDiv);
|
718 |
+
display.gutters.style.height = display.sizer.style.minHeight = 0;
|
719 |
+
|
720 |
+
if (different) {
|
721 |
+
display.lastWrapHeight = update.wrapperHeight;
|
722 |
+
display.lastWrapWidth = update.wrapperWidth;
|
723 |
+
startWorker(cm, 400);
|
724 |
+
}
|
725 |
+
|
726 |
+
display.updateLineNumbers = null;
|
727 |
+
|
728 |
+
return true;
|
729 |
+
}
|
730 |
+
|
731 |
+
function postUpdateDisplay(cm, update) {
|
732 |
+
var viewport = update.viewport;
|
733 |
+
for (var first = true;; first = false) {
|
734 |
+
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
735 |
+
// Clip forced viewport to actual scrollable area.
|
736 |
+
if (viewport && viewport.top != null)
|
737 |
+
viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};
|
738 |
+
// Updated line heights might result in the drawn area not
|
739 |
+
// actually covering the viewport. Keep looping until it does.
|
740 |
+
update.visible = visibleLines(cm.display, cm.doc, viewport);
|
741 |
+
if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
|
742 |
+
break;
|
743 |
+
}
|
744 |
+
if (!updateDisplayIfNeeded(cm, update)) break;
|
745 |
+
updateHeightsInViewport(cm);
|
746 |
+
var barMeasure = measureForScrollbars(cm);
|
747 |
+
updateSelection(cm);
|
748 |
+
setDocumentHeight(cm, barMeasure);
|
749 |
+
updateScrollbars(cm, barMeasure);
|
750 |
+
}
|
751 |
+
|
752 |
+
update.signal(cm, "update", cm);
|
753 |
+
if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
|
754 |
+
update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
|
755 |
+
cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
|
756 |
+
}
|
757 |
+
}
|
758 |
+
|
759 |
+
function updateDisplaySimple(cm, viewport) {
|
760 |
+
var update = new DisplayUpdate(cm, viewport);
|
761 |
+
if (updateDisplayIfNeeded(cm, update)) {
|
762 |
+
updateHeightsInViewport(cm);
|
763 |
+
postUpdateDisplay(cm, update);
|
764 |
+
var barMeasure = measureForScrollbars(cm);
|
765 |
+
updateSelection(cm);
|
766 |
+
setDocumentHeight(cm, barMeasure);
|
767 |
+
updateScrollbars(cm, barMeasure);
|
768 |
+
update.finish();
|
769 |
+
}
|
770 |
+
}
|
771 |
+
|
772 |
+
function setDocumentHeight(cm, measure) {
|
773 |
+
cm.display.sizer.style.minHeight = measure.docHeight + "px";
|
774 |
+
var total = measure.docHeight + cm.display.barHeight;
|
775 |
+
cm.display.heightForcer.style.top = total + "px";
|
776 |
+
cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px";
|
777 |
+
}
|
778 |
+
|
779 |
+
// Read the actual heights of the rendered lines, and update their
|
780 |
+
// stored heights to match.
|
781 |
+
function updateHeightsInViewport(cm) {
|
782 |
+
var display = cm.display;
|
783 |
+
var prevBottom = display.lineDiv.offsetTop;
|
784 |
+
for (var i = 0; i < display.view.length; i++) {
|
785 |
+
var cur = display.view[i], height;
|
786 |
+
if (cur.hidden) continue;
|
787 |
+
if (ie && ie_version < 8) {
|
788 |
+
var bot = cur.node.offsetTop + cur.node.offsetHeight;
|
789 |
+
height = bot - prevBottom;
|
790 |
+
prevBottom = bot;
|
791 |
+
} else {
|
792 |
+
var box = cur.node.getBoundingClientRect();
|
793 |
+
height = box.bottom - box.top;
|
794 |
+
}
|
795 |
+
var diff = cur.line.height - height;
|
796 |
+
if (height < 2) height = textHeight(display);
|
797 |
+
if (diff > .001 || diff < -.001) {
|
798 |
+
updateLineHeight(cur.line, height);
|
799 |
+
updateWidgetHeight(cur.line);
|
800 |
+
if (cur.rest) for (var j = 0; j < cur.rest.length; j++)
|
801 |
+
updateWidgetHeight(cur.rest[j]);
|
802 |
+
}
|
803 |
+
}
|
804 |
+
}
|
805 |
+
|
806 |
+
// Read and store the height of line widgets associated with the
|
807 |
+
// given line.
|
808 |
+
function updateWidgetHeight(line) {
|
809 |
+
if (line.widgets) for (var i = 0; i < line.widgets.length; ++i)
|
810 |
+
line.widgets[i].height = line.widgets[i].node.offsetHeight;
|
811 |
+
}
|
812 |
+
|
813 |
+
// Do a bulk-read of the DOM positions and sizes needed to draw the
|
814 |
+
// view, so that we don't interleave reading and writing to the DOM.
|
815 |
+
function getDimensions(cm) {
|
816 |
+
var d = cm.display, left = {}, width = {};
|
817 |
+
var gutterLeft = d.gutters.clientLeft;
|
818 |
+
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
819 |
+
left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
|
820 |
+
width[cm.options.gutters[i]] = n.clientWidth;
|
821 |
+
}
|
822 |
+
return {fixedPos: compensateForHScroll(d),
|
823 |
+
gutterTotalWidth: d.gutters.offsetWidth,
|
824 |
+
gutterLeft: left,
|
825 |
+
gutterWidth: width,
|
826 |
+
wrapperWidth: d.wrapper.clientWidth};
|
827 |
+
}
|
828 |
+
|
829 |
+
// Sync the actual display DOM structure with display.view, removing
|
830 |
+
// nodes for lines that are no longer in view, and creating the ones
|
831 |
+
// that are not there yet, and updating the ones that are out of
|
832 |
+
// date.
|
833 |
+
function patchDisplay(cm, updateNumbersFrom, dims) {
|
834 |
+
var display = cm.display, lineNumbers = cm.options.lineNumbers;
|
835 |
+
var container = display.lineDiv, cur = container.firstChild;
|
836 |
+
|
837 |
+
function rm(node) {
|
838 |
+
var next = node.nextSibling;
|
839 |
+
// Works around a throw-scroll bug in OS X Webkit
|
840 |
+
if (webkit && mac && cm.display.currentWheelTarget == node)
|
841 |
+
node.style.display = "none";
|
842 |
+
else
|
843 |
+
node.parentNode.removeChild(node);
|
844 |
+
return next;
|
845 |
+
}
|
846 |
+
|
847 |
+
var view = display.view, lineN = display.viewFrom;
|
848 |
+
// Loop over the elements in the view, syncing cur (the DOM nodes
|
849 |
+
// in display.lineDiv) with the view as we go.
|
850 |
+
for (var i = 0; i < view.length; i++) {
|
851 |
+
var lineView = view[i];
|
852 |
+
if (lineView.hidden) {
|
853 |
+
} else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
|
854 |
+
var node = buildLineElement(cm, lineView, lineN, dims);
|
855 |
+
container.insertBefore(node, cur);
|
856 |
+
} else { // Already drawn
|
857 |
+
while (cur != lineView.node) cur = rm(cur);
|
858 |
+
var updateNumber = lineNumbers && updateNumbersFrom != null &&
|
859 |
+
updateNumbersFrom <= lineN && lineView.lineNumber;
|
860 |
+
if (lineView.changes) {
|
861 |
+
if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false;
|
862 |
+
updateLineForChanges(cm, lineView, lineN, dims);
|
863 |
+
}
|
864 |
+
if (updateNumber) {
|
865 |
+
removeChildren(lineView.lineNumber);
|
866 |
+
lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
|
867 |
+
}
|
868 |
+
cur = lineView.node.nextSibling;
|
869 |
+
}
|
870 |
+
lineN += lineView.size;
|
871 |
+
}
|
872 |
+
while (cur) cur = rm(cur);
|
873 |
+
}
|
874 |
+
|
875 |
+
// When an aspect of a line changes, a string is added to
|
876 |
+
// lineView.changes. This updates the relevant part of the line's
|
877 |
+
// DOM structure.
|
878 |
+
function updateLineForChanges(cm, lineView, lineN, dims) {
|
879 |
+
for (var j = 0; j < lineView.changes.length; j++) {
|
880 |
+
var type = lineView.changes[j];
|
881 |
+
if (type == "text") updateLineText(cm, lineView);
|
882 |
+
else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims);
|
883 |
+
else if (type == "class") updateLineClasses(lineView);
|
884 |
+
else if (type == "widget") updateLineWidgets(cm, lineView, dims);
|
885 |
+
}
|
886 |
+
lineView.changes = null;
|
887 |
+
}
|
888 |
+
|
889 |
+
// Lines with gutter elements, widgets or a background class need to
|
890 |
+
// be wrapped, and have the extra elements added to the wrapper div
|
891 |
+
function ensureLineWrapped(lineView) {
|
892 |
+
if (lineView.node == lineView.text) {
|
893 |
+
lineView.node = elt("div", null, null, "position: relative");
|
894 |
+
if (lineView.text.parentNode)
|
895 |
+
lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
|
896 |
+
lineView.node.appendChild(lineView.text);
|
897 |
+
if (ie && ie_version < 8) lineView.node.style.zIndex = 2;
|
898 |
+
}
|
899 |
+
return lineView.node;
|
900 |
+
}
|
901 |
+
|
902 |
+
function updateLineBackground(lineView) {
|
903 |
+
var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
|
904 |
+
if (cls) cls += " CodeMirror-linebackground";
|
905 |
+
if (lineView.background) {
|
906 |
+
if (cls) lineView.background.className = cls;
|
907 |
+
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
|
908 |
+
} else if (cls) {
|
909 |
+
var wrap = ensureLineWrapped(lineView);
|
910 |
+
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
|
911 |
+
}
|
912 |
+
}
|
913 |
+
|
914 |
+
// Wrapper around buildLineContent which will reuse the structure
|
915 |
+
// in display.externalMeasured when possible.
|
916 |
+
function getLineContent(cm, lineView) {
|
917 |
+
var ext = cm.display.externalMeasured;
|
918 |
+
if (ext && ext.line == lineView.line) {
|
919 |
+
cm.display.externalMeasured = null;
|
920 |
+
lineView.measure = ext.measure;
|
921 |
+
return ext.built;
|
922 |
+
}
|
923 |
+
return buildLineContent(cm, lineView);
|
924 |
+
}
|
925 |
+
|
926 |
+
// Redraw the line's text. Interacts with the background and text
|
927 |
+
// classes because the mode may output tokens that influence these
|
928 |
+
// classes.
|
929 |
+
function updateLineText(cm, lineView) {
|
930 |
+
var cls = lineView.text.className;
|
931 |
+
var built = getLineContent(cm, lineView);
|
932 |
+
if (lineView.text == lineView.node) lineView.node = built.pre;
|
933 |
+
lineView.text.parentNode.replaceChild(built.pre, lineView.text);
|
934 |
+
lineView.text = built.pre;
|
935 |
+
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
936 |
+
lineView.bgClass = built.bgClass;
|
937 |
+
lineView.textClass = built.textClass;
|
938 |
+
updateLineClasses(lineView);
|
939 |
+
} else if (cls) {
|
940 |
+
lineView.text.className = cls;
|
941 |
+
}
|
942 |
+
}
|
943 |
+
|
944 |
+
function updateLineClasses(lineView) {
|
945 |
+
updateLineBackground(lineView);
|
946 |
+
if (lineView.line.wrapClass)
|
947 |
+
ensureLineWrapped(lineView).className = lineView.line.wrapClass;
|
948 |
+
else if (lineView.node != lineView.text)
|
949 |
+
lineView.node.className = "";
|
950 |
+
var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
|
951 |
+
lineView.text.className = textClass || "";
|
952 |
+
}
|
953 |
+
|
954 |
+
function updateLineGutter(cm, lineView, lineN, dims) {
|
955 |
+
if (lineView.gutter) {
|
956 |
+
lineView.node.removeChild(lineView.gutter);
|
957 |
+
lineView.gutter = null;
|
958 |
+
}
|
959 |
+
if (lineView.gutterBackground) {
|
960 |
+
lineView.node.removeChild(lineView.gutterBackground);
|
961 |
+
lineView.gutterBackground = null;
|
962 |
+
}
|
963 |
+
if (lineView.line.gutterClass) {
|
964 |
+
var wrap = ensureLineWrapped(lineView);
|
965 |
+
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
966 |
+
"left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) +
|
967 |
+
"px; width: " + dims.gutterTotalWidth + "px");
|
968 |
+
wrap.insertBefore(lineView.gutterBackground, lineView.text);
|
969 |
+
}
|
970 |
+
var markers = lineView.line.gutterMarkers;
|
971 |
+
if (cm.options.lineNumbers || markers) {
|
972 |
+
var wrap = ensureLineWrapped(lineView);
|
973 |
+
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", "left: " +
|
974 |
+
(cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px");
|
975 |
+
cm.display.input.setUneditable(gutterWrap);
|
976 |
+
wrap.insertBefore(gutterWrap, lineView.text);
|
977 |
+
if (lineView.line.gutterClass)
|
978 |
+
gutterWrap.className += " " + lineView.line.gutterClass;
|
979 |
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
980 |
+
lineView.lineNumber = gutterWrap.appendChild(
|
981 |
+
elt("div", lineNumberFor(cm.options, lineN),
|
982 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
983 |
+
"left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
|
984 |
+
+ cm.display.lineNumInnerWidth + "px"));
|
985 |
+
if (markers) for (var k = 0; k < cm.options.gutters.length; ++k) {
|
986 |
+
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
|
987 |
+
if (found)
|
988 |
+
gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
|
989 |
+
dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
|
990 |
+
}
|
991 |
+
}
|
992 |
+
}
|
993 |
+
|
994 |
+
function updateLineWidgets(cm, lineView, dims) {
|
995 |
+
if (lineView.alignable) lineView.alignable = null;
|
996 |
+
for (var node = lineView.node.firstChild, next; node; node = next) {
|
997 |
+
var next = node.nextSibling;
|
998 |
+
if (node.className == "CodeMirror-linewidget")
|
999 |
+
lineView.node.removeChild(node);
|
1000 |
+
}
|
1001 |
+
insertLineWidgets(cm, lineView, dims);
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
// Build a line's DOM representation from scratch
|
1005 |
+
function buildLineElement(cm, lineView, lineN, dims) {
|
1006 |
+
var built = getLineContent(cm, lineView);
|
1007 |
+
lineView.text = lineView.node = built.pre;
|
1008 |
+
if (built.bgClass) lineView.bgClass = built.bgClass;
|
1009 |
+
if (built.textClass) lineView.textClass = built.textClass;
|
1010 |
+
|
1011 |
+
updateLineClasses(lineView);
|
1012 |
+
updateLineGutter(cm, lineView, lineN, dims);
|
1013 |
+
insertLineWidgets(cm, lineView, dims);
|
1014 |
+
return lineView.node;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
// A lineView may contain multiple logical lines (when merged by
|
1018 |
+
// collapsed spans). The widgets for all of them need to be drawn.
|
1019 |
+
function insertLineWidgets(cm, lineView, dims) {
|
1020 |
+
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
|
1021 |
+
if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
|
1022 |
+
insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
1026 |
+
if (!line.widgets) return;
|
1027 |
+
var wrap = ensureLineWrapped(lineView);
|
1028 |
+
for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
1029 |
+
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
|
1030 |
+
if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true");
|
1031 |
+
positionLineWidget(widget, node, lineView, dims);
|
1032 |
+
cm.display.input.setUneditable(node);
|
1033 |
+
if (allowAbove && widget.above)
|
1034 |
+
wrap.insertBefore(node, lineView.gutter || lineView.text);
|
1035 |
+
else
|
1036 |
+
wrap.appendChild(node);
|
1037 |
+
signalLater(widget, "redraw");
|
1038 |
+
}
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
function positionLineWidget(widget, node, lineView, dims) {
|
1042 |
+
if (widget.noHScroll) {
|
1043 |
+
(lineView.alignable || (lineView.alignable = [])).push(node);
|
1044 |
+
var width = dims.wrapperWidth;
|
1045 |
+
node.style.left = dims.fixedPos + "px";
|
1046 |
+
if (!widget.coverGutter) {
|
1047 |
+
width -= dims.gutterTotalWidth;
|
1048 |
+
node.style.paddingLeft = dims.gutterTotalWidth + "px";
|
1049 |
+
}
|
1050 |
+
node.style.width = width + "px";
|
1051 |
+
}
|
1052 |
+
if (widget.coverGutter) {
|
1053 |
+
node.style.zIndex = 5;
|
1054 |
+
node.style.position = "relative";
|
1055 |
+
if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
|
1056 |
+
}
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
// POSITION OBJECT
|
1060 |
+
|
1061 |
+
// A Pos instance represents a position within the text.
|
1062 |
+
var Pos = CodeMirror.Pos = function(line, ch) {
|
1063 |
+
if (!(this instanceof Pos)) return new Pos(line, ch);
|
1064 |
+
this.line = line; this.ch = ch;
|
1065 |
+
};
|
1066 |
+
|
1067 |
+
// Compare two positions, return 0 if they are the same, a negative
|
1068 |
+
// number when a is less, and a positive number otherwise.
|
1069 |
+
var cmp = CodeMirror.cmpPos = function(a, b) { return a.line - b.line || a.ch - b.ch; };
|
1070 |
+
|
1071 |
+
function copyPos(x) {return Pos(x.line, x.ch);}
|
1072 |
+
function maxPos(a, b) { return cmp(a, b) < 0 ? b : a; }
|
1073 |
+
function minPos(a, b) { return cmp(a, b) < 0 ? a : b; }
|
1074 |
+
|
1075 |
+
// INPUT HANDLING
|
1076 |
+
|
1077 |
+
function ensureFocus(cm) {
|
1078 |
+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
function isReadOnly(cm) {
|
1082 |
+
return cm.options.readOnly || cm.doc.cantEdit;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
// This will be set to an array of strings when copying, so that,
|
1086 |
+
// when pasting, we know what kind of selections the copied text
|
1087 |
+
// was made out of.
|
1088 |
+
var lastCopied = null;
|
1089 |
+
|
1090 |
+
function applyTextInput(cm, inserted, deleted, sel, origin) {
|
1091 |
+
var doc = cm.doc;
|
1092 |
+
cm.display.shift = false;
|
1093 |
+
if (!sel) sel = doc.sel;
|
1094 |
+
|
1095 |
+
var paste = cm.state.pasteIncoming || origin == "paste";
|
1096 |
+
var textLines = doc.splitLines(inserted), multiPaste = null;
|
1097 |
+
// When pasing N lines into N selections, insert one line per selection
|
1098 |
+
if (paste && sel.ranges.length > 1) {
|
1099 |
+
if (lastCopied && lastCopied.join("\n") == inserted) {
|
1100 |
+
if (sel.ranges.length % lastCopied.length == 0) {
|
1101 |
+
multiPaste = [];
|
1102 |
+
for (var i = 0; i < lastCopied.length; i++)
|
1103 |
+
multiPaste.push(doc.splitLines(lastCopied[i]));
|
1104 |
+
}
|
1105 |
+
} else if (textLines.length == sel.ranges.length) {
|
1106 |
+
multiPaste = map(textLines, function(l) { return [l]; });
|
1107 |
+
}
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
// Normal behavior is to insert the new text into every selection
|
1111 |
+
for (var i = sel.ranges.length - 1; i >= 0; i--) {
|
1112 |
+
var range = sel.ranges[i];
|
1113 |
+
var from = range.from(), to = range.to();
|
1114 |
+
if (range.empty()) {
|
1115 |
+
if (deleted && deleted > 0) // Handle deletion
|
1116 |
+
from = Pos(from.line, from.ch - deleted);
|
1117 |
+
else if (cm.state.overwrite && !paste) // Handle overwrite
|
1118 |
+
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
|
1119 |
+
}
|
1120 |
+
var updateInput = cm.curOp.updateInput;
|
1121 |
+
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
|
1122 |
+
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
1123 |
+
makeChange(cm.doc, changeEvent);
|
1124 |
+
signalLater(cm, "inputRead", cm, changeEvent);
|
1125 |
+
}
|
1126 |
+
if (inserted && !paste)
|
1127 |
+
triggerElectric(cm, inserted);
|
1128 |
+
|
1129 |
+
ensureCursorVisible(cm);
|
1130 |
+
cm.curOp.updateInput = updateInput;
|
1131 |
+
cm.curOp.typing = true;
|
1132 |
+
cm.state.pasteIncoming = cm.state.cutIncoming = false;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
function handlePaste(e, cm) {
|
1136 |
+
var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
|
1137 |
+
if (pasted) {
|
1138 |
+
e.preventDefault();
|
1139 |
+
if (!isReadOnly(cm) && !cm.options.disableInput)
|
1140 |
+
runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
|
1141 |
+
return true;
|
1142 |
+
}
|
1143 |
+
}
|
1144 |
+
|
1145 |
+
function triggerElectric(cm, inserted) {
|
1146 |
+
// When an 'electric' character is inserted, immediately trigger a reindent
|
1147 |
+
if (!cm.options.electricChars || !cm.options.smartIndent) return;
|
1148 |
+
var sel = cm.doc.sel;
|
1149 |
+
|
1150 |
+
for (var i = sel.ranges.length - 1; i >= 0; i--) {
|
1151 |
+
var range = sel.ranges[i];
|
1152 |
+
if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;
|
1153 |
+
var mode = cm.getModeAt(range.head);
|
1154 |
+
var indented = false;
|
1155 |
+
if (mode.electricChars) {
|
1156 |
+
for (var j = 0; j < mode.electricChars.length; j++)
|
1157 |
+
if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
1158 |
+
indented = indentLine(cm, range.head.line, "smart");
|
1159 |
+
break;
|
1160 |
+
}
|
1161 |
+
} else if (mode.electricInput) {
|
1162 |
+
if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
|
1163 |
+
indented = indentLine(cm, range.head.line, "smart");
|
1164 |
+
}
|
1165 |
+
if (indented) signalLater(cm, "electricInput", cm, range.head.line);
|
1166 |
+
}
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
function copyableRanges(cm) {
|
1170 |
+
var text = [], ranges = [];
|
1171 |
+
for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
|
1172 |
+
var line = cm.doc.sel.ranges[i].head.line;
|
1173 |
+
var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
|
1174 |
+
ranges.push(lineRange);
|
1175 |
+
text.push(cm.getRange(lineRange.anchor, lineRange.head));
|
1176 |
+
}
|
1177 |
+
return {text: text, ranges: ranges};
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
function disableBrowserMagic(field) {
|
1181 |
+
field.setAttribute("autocorrect", "off");
|
1182 |
+
field.setAttribute("autocapitalize", "off");
|
1183 |
+
field.setAttribute("spellcheck", "false");
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
// TEXTAREA INPUT STYLE
|
1187 |
+
|
1188 |
+
function TextareaInput(cm) {
|
1189 |
+
this.cm = cm;
|
1190 |
+
// See input.poll and input.reset
|
1191 |
+
this.prevInput = "";
|
1192 |
+
|
1193 |
+
// Flag that indicates whether we expect input to appear real soon
|
1194 |
+
// now (after some event like 'keypress' or 'input') and are
|
1195 |
+
// polling intensively.
|
1196 |
+
this.pollingFast = false;
|
1197 |
+
// Self-resetting timeout for the poller
|
1198 |
+
this.polling = new Delayed();
|
1199 |
+
// Tracks when input.reset has punted to just putting a short
|
1200 |
+
// string into the textarea instead of the full selection.
|
1201 |
+
this.inaccurateSelection = false;
|
1202 |
+
// Used to work around IE issue with selection being forgotten when focus moves away from textarea
|
1203 |
+
this.hasSelection = false;
|
1204 |
+
this.composing = null;
|
1205 |
+
};
|
1206 |
+
|
1207 |
+
function hiddenTextarea() {
|
1208 |
+
var te = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none");
|
1209 |
+
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
|
1210 |
+
// The textarea is kept positioned near the cursor to prevent the
|
1211 |
+
// fact that it'll be scrolled into view on input from scrolling
|
1212 |
+
// our fake cursor out of view. On webkit, when wrap=off, paste is
|
1213 |
+
// very slow. So make the area wide instead.
|
1214 |
+
if (webkit) te.style.width = "1000px";
|
1215 |
+
else te.setAttribute("wrap", "off");
|
1216 |
+
// If border: 0; -- iOS fails to open keyboard (issue #1287)
|
1217 |
+
if (ios) te.style.border = "1px solid black";
|
1218 |
+
disableBrowserMagic(te);
|
1219 |
+
return div;
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
TextareaInput.prototype = copyObj({
|
1223 |
+
init: function(display) {
|
1224 |
+
var input = this, cm = this.cm;
|
1225 |
+
|
1226 |
+
// Wraps and hides input textarea
|
1227 |
+
var div = this.wrapper = hiddenTextarea();
|
1228 |
+
// The semihidden textarea that is focused when the editor is
|
1229 |
+
// focused, and receives input.
|
1230 |
+
var te = this.textarea = div.firstChild;
|
1231 |
+
display.wrapper.insertBefore(div, display.wrapper.firstChild);
|
1232 |
+
|
1233 |
+
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
|
1234 |
+
if (ios) te.style.width = "0px";
|
1235 |
+
|
1236 |
+
on(te, "input", function() {
|
1237 |
+
if (ie && ie_version >= 9 && input.hasSelection) input.hasSelection = null;
|
1238 |
+
input.poll();
|
1239 |
+
});
|
1240 |
+
|
1241 |
+
on(te, "paste", function(e) {
|
1242 |
+
if (handlePaste(e, cm)) return true;
|
1243 |
+
|
1244 |
+
cm.state.pasteIncoming = true;
|
1245 |
+
input.fastPoll();
|
1246 |
+
});
|
1247 |
+
|
1248 |
+
function prepareCopyCut(e) {
|
1249 |
+
if (cm.somethingSelected()) {
|
1250 |
+
lastCopied = cm.getSelections();
|
1251 |
+
if (input.inaccurateSelection) {
|
1252 |
+
input.prevInput = "";
|
1253 |
+
input.inaccurateSelection = false;
|
1254 |
+
te.value = lastCopied.join("\n");
|
1255 |
+
selectInput(te);
|
1256 |
+
}
|
1257 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
1258 |
+
return;
|
1259 |
+
} else {
|
1260 |
+
var ranges = copyableRanges(cm);
|
1261 |
+
lastCopied = ranges.text;
|
1262 |
+
if (e.type == "cut") {
|
1263 |
+
cm.setSelections(ranges.ranges, null, sel_dontScroll);
|
1264 |
+
} else {
|
1265 |
+
input.prevInput = "";
|
1266 |
+
te.value = ranges.text.join("\n");
|
1267 |
+
selectInput(te);
|
1268 |
+
}
|
1269 |
+
}
|
1270 |
+
if (e.type == "cut") cm.state.cutIncoming = true;
|
1271 |
+
}
|
1272 |
+
on(te, "cut", prepareCopyCut);
|
1273 |
+
on(te, "copy", prepareCopyCut);
|
1274 |
+
|
1275 |
+
on(display.scroller, "paste", function(e) {
|
1276 |
+
if (eventInWidget(display, e)) return;
|
1277 |
+
cm.state.pasteIncoming = true;
|
1278 |
+
input.focus();
|
1279 |
+
});
|
1280 |
+
|
1281 |
+
// Prevent normal selection in the editor (we handle our own)
|
1282 |
+
on(display.lineSpace, "selectstart", function(e) {
|
1283 |
+
if (!eventInWidget(display, e)) e_preventDefault(e);
|
1284 |
+
});
|
1285 |
+
|
1286 |
+
on(te, "compositionstart", function() {
|
1287 |
+
var start = cm.getCursor("from");
|
1288 |
+
input.composing = {
|
1289 |
+
start: start,
|
1290 |
+
range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
|
1291 |
+
};
|
1292 |
+
});
|
1293 |
+
on(te, "compositionend", function() {
|
1294 |
+
if (input.composing) {
|
1295 |
+
input.poll();
|
1296 |
+
input.composing.range.clear();
|
1297 |
+
input.composing = null;
|
1298 |
+
}
|
1299 |
+
});
|
1300 |
+
},
|
1301 |
+
|
1302 |
+
prepareSelection: function() {
|
1303 |
+
// Redraw the selection and/or cursor
|
1304 |
+
var cm = this.cm, display = cm.display, doc = cm.doc;
|
1305 |
+
var result = prepareSelection(cm);
|
1306 |
+
|
1307 |
+
// Move the hidden textarea near the cursor to prevent scrolling artifacts
|
1308 |
+
if (cm.options.moveInputWithCursor) {
|
1309 |
+
var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
|
1310 |
+
var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
|
1311 |
+
result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
|
1312 |
+
headPos.top + lineOff.top - wrapOff.top));
|
1313 |
+
result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
|
1314 |
+
headPos.left + lineOff.left - wrapOff.left));
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
return result;
|
1318 |
+
},
|
1319 |
+
|
1320 |
+
showSelection: function(drawn) {
|
1321 |
+
var cm = this.cm, display = cm.display;
|
1322 |
+
removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
|
1323 |
+
removeChildrenAndAdd(display.selectionDiv, drawn.selection);
|
1324 |
+
if (drawn.teTop != null) {
|
1325 |
+
this.wrapper.style.top = drawn.teTop + "px";
|
1326 |
+
this.wrapper.style.left = drawn.teLeft + "px";
|
1327 |
+
}
|
1328 |
+
},
|
1329 |
+
|
1330 |
+
// Reset the input to correspond to the selection (or to be empty,
|
1331 |
+
// when not typing and nothing is selected)
|
1332 |
+
reset: function(typing) {
|
1333 |
+
if (this.contextMenuPending) return;
|
1334 |
+
var minimal, selected, cm = this.cm, doc = cm.doc;
|
1335 |
+
if (cm.somethingSelected()) {
|
1336 |
+
this.prevInput = "";
|
1337 |
+
var range = doc.sel.primary();
|
1338 |
+
minimal = hasCopyEvent &&
|
1339 |
+
(range.to().line - range.from().line > 100 || (selected = cm.getSelection()).length > 1000);
|
1340 |
+
var content = minimal ? "-" : selected || cm.getSelection();
|
1341 |
+
this.textarea.value = content;
|
1342 |
+
if (cm.state.focused) selectInput(this.textarea);
|
1343 |
+
if (ie && ie_version >= 9) this.hasSelection = content;
|
1344 |
+
} else if (!typing) {
|
1345 |
+
this.prevInput = this.textarea.value = "";
|
1346 |
+
if (ie && ie_version >= 9) this.hasSelection = null;
|
1347 |
+
}
|
1348 |
+
this.inaccurateSelection = minimal;
|
1349 |
+
},
|
1350 |
+
|
1351 |
+
getField: function() { return this.textarea; },
|
1352 |
+
|
1353 |
+
supportsTouch: function() { return false; },
|
1354 |
+
|
1355 |
+
focus: function() {
|
1356 |
+
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
|
1357 |
+
try { this.textarea.focus(); }
|
1358 |
+
catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
|
1359 |
+
}
|
1360 |
+
},
|
1361 |
+
|
1362 |
+
blur: function() { this.textarea.blur(); },
|
1363 |
+
|
1364 |
+
resetPosition: function() {
|
1365 |
+
this.wrapper.style.top = this.wrapper.style.left = 0;
|
1366 |
+
},
|
1367 |
+
|
1368 |
+
receivedFocus: function() { this.slowPoll(); },
|
1369 |
+
|
1370 |
+
// Poll for input changes, using the normal rate of polling. This
|
1371 |
+
// runs as long as the editor is focused.
|
1372 |
+
slowPoll: function() {
|
1373 |
+
var input = this;
|
1374 |
+
if (input.pollingFast) return;
|
1375 |
+
input.polling.set(this.cm.options.pollInterval, function() {
|
1376 |
+
input.poll();
|
1377 |
+
if (input.cm.state.focused) input.slowPoll();
|
1378 |
+
});
|
1379 |
+
},
|
1380 |
+
|
1381 |
+
// When an event has just come in that is likely to add or change
|
1382 |
+
// something in the input textarea, we poll faster, to ensure that
|
1383 |
+
// the change appears on the screen quickly.
|
1384 |
+
fastPoll: function() {
|
1385 |
+
var missed = false, input = this;
|
1386 |
+
input.pollingFast = true;
|
1387 |
+
function p() {
|
1388 |
+
var changed = input.poll();
|
1389 |
+
if (!changed && !missed) {missed = true; input.polling.set(60, p);}
|
1390 |
+
else {input.pollingFast = false; input.slowPoll();}
|
1391 |
+
}
|
1392 |
+
input.polling.set(20, p);
|
1393 |
+
},
|
1394 |
+
|
1395 |
+
// Read input from the textarea, and update the document to match.
|
1396 |
+
// When something is selected, it is present in the textarea, and
|
1397 |
+
// selected (unless it is huge, in which case a placeholder is
|
1398 |
+
// used). When nothing is selected, the cursor sits after previously
|
1399 |
+
// seen text (can be empty), which is stored in prevInput (we must
|
1400 |
+
// not reset the textarea when typing, because that breaks IME).
|
1401 |
+
poll: function() {
|
1402 |
+
var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
|
1403 |
+
// Since this is called a *lot*, try to bail out as cheaply as
|
1404 |
+
// possible when it is clear that nothing happened. hasSelection
|
1405 |
+
// will be the case when there is a lot of text in the textarea,
|
1406 |
+
// in which case reading its value would be expensive.
|
1407 |
+
if (this.contextMenuPending || !cm.state.focused ||
|
1408 |
+
(hasSelection(input) && !prevInput && !this.composing) ||
|
1409 |
+
isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
|
1410 |
+
return false;
|
1411 |
+
|
1412 |
+
var text = input.value;
|
1413 |
+
// If nothing changed, bail.
|
1414 |
+
if (text == prevInput && !cm.somethingSelected()) return false;
|
1415 |
+
// Work around nonsensical selection resetting in IE9/10, and
|
1416 |
+
// inexplicable appearance of private area unicode characters on
|
1417 |
+
// some key combos in Mac (#2689).
|
1418 |
+
if (ie && ie_version >= 9 && this.hasSelection === text ||
|
1419 |
+
mac && /[\uf700-\uf7ff]/.test(text)) {
|
1420 |
+
cm.display.input.reset();
|
1421 |
+
return false;
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
if (cm.doc.sel == cm.display.selForContextMenu) {
|
1425 |
+
var first = text.charCodeAt(0);
|
1426 |
+
if (first == 0x200b && !prevInput) prevInput = "\u200b";
|
1427 |
+
if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo"); }
|
1428 |
+
}
|
1429 |
+
// Find the part of the input that is actually new
|
1430 |
+
var same = 0, l = Math.min(prevInput.length, text.length);
|
1431 |
+
while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
|
1432 |
+
|
1433 |
+
var self = this;
|
1434 |
+
runInOp(cm, function() {
|
1435 |
+
applyTextInput(cm, text.slice(same), prevInput.length - same,
|
1436 |
+
null, self.composing ? "*compose" : null);
|
1437 |
+
|
1438 |
+
// Don't leave long text in the textarea, since it makes further polling slow
|
1439 |
+
if (text.length > 1000 || text.indexOf("\n") > -1) input.value = self.prevInput = "";
|
1440 |
+
else self.prevInput = text;
|
1441 |
+
|
1442 |
+
if (self.composing) {
|
1443 |
+
self.composing.range.clear();
|
1444 |
+
self.composing.range = cm.markText(self.composing.start, cm.getCursor("to"),
|
1445 |
+
{className: "CodeMirror-composing"});
|
1446 |
+
}
|
1447 |
+
});
|
1448 |
+
return true;
|
1449 |
+
},
|
1450 |
+
|
1451 |
+
ensurePolled: function() {
|
1452 |
+
if (this.pollingFast && this.poll()) this.pollingFast = false;
|
1453 |
+
},
|
1454 |
+
|
1455 |
+
onKeyPress: function() {
|
1456 |
+
if (ie && ie_version >= 9) this.hasSelection = null;
|
1457 |
+
this.fastPoll();
|
1458 |
+
},
|
1459 |
+
|
1460 |
+
onContextMenu: function(e) {
|
1461 |
+
var input = this, cm = input.cm, display = cm.display, te = input.textarea;
|
1462 |
+
var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
|
1463 |
+
if (!pos || presto) return; // Opera is difficult.
|
1464 |
+
|
1465 |
+
// Reset the current text selection only if the click is done outside of the selection
|
1466 |
+
// and 'resetSelectionOnContextMenu' option is true.
|
1467 |
+
var reset = cm.options.resetSelectionOnContextMenu;
|
1468 |
+
if (reset && cm.doc.sel.contains(pos) == -1)
|
1469 |
+
operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
|
1470 |
+
|
1471 |
+
var oldCSS = te.style.cssText;
|
1472 |
+
input.wrapper.style.position = "absolute";
|
1473 |
+
te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
|
1474 |
+
"px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " +
|
1475 |
+
(ie ? "rgba(255, 255, 255, .05)" : "transparent") +
|
1476 |
+
"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
|
1477 |
+
if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
|
1478 |
+
display.input.focus();
|
1479 |
+
if (webkit) window.scrollTo(null, oldScrollY);
|
1480 |
+
display.input.reset();
|
1481 |
+
// Adds "Select all" to context menu in FF
|
1482 |
+
if (!cm.somethingSelected()) te.value = input.prevInput = " ";
|
1483 |
+
input.contextMenuPending = true;
|
1484 |
+
display.selForContextMenu = cm.doc.sel;
|
1485 |
+
clearTimeout(display.detectingSelectAll);
|
1486 |
+
|
1487 |
+
// Select-all will be greyed out if there's nothing to select, so
|
1488 |
+
// this adds a zero-width space so that we can later check whether
|
1489 |
+
// it got selected.
|
1490 |
+
function prepareSelectAllHack() {
|
1491 |
+
if (te.selectionStart != null) {
|
1492 |
+
var selected = cm.somethingSelected();
|
1493 |
+
var extval = "\u200b" + (selected ? te.value : "");
|
1494 |
+
te.value = "\u21da"; // Used to catch context-menu undo
|
1495 |
+
te.value = extval;
|
1496 |
+
input.prevInput = selected ? "" : "\u200b";
|
1497 |
+
te.selectionStart = 1; te.selectionEnd = extval.length;
|
1498 |
+
// Re-set this, in case some other handler touched the
|
1499 |
+
// selection in the meantime.
|
1500 |
+
display.selForContextMenu = cm.doc.sel;
|
1501 |
+
}
|
1502 |
+
}
|
1503 |
+
function rehide() {
|
1504 |
+
input.contextMenuPending = false;
|
1505 |
+
input.wrapper.style.position = "relative";
|
1506 |
+
te.style.cssText = oldCSS;
|
1507 |
+
if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
|
1508 |
+
|
1509 |
+
// Try to detect the user choosing select-all
|
1510 |
+
if (te.selectionStart != null) {
|
1511 |
+
if (!ie || (ie && ie_version < 9)) prepareSelectAllHack();
|
1512 |
+
var i = 0, poll = function() {
|
1513 |
+
if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
|
1514 |
+
te.selectionEnd > 0 && input.prevInput == "\u200b")
|
1515 |
+
operation(cm, commands.selectAll)(cm);
|
1516 |
+
else if (i++ < 10) display.detectingSelectAll = setTimeout(poll, 500);
|
1517 |
+
else display.input.reset();
|
1518 |
+
};
|
1519 |
+
display.detectingSelectAll = setTimeout(poll, 200);
|
1520 |
+
}
|
1521 |
+
}
|
1522 |
+
|
1523 |
+
if (ie && ie_version >= 9) prepareSelectAllHack();
|
1524 |
+
if (captureRightClick) {
|
1525 |
+
e_stop(e);
|
1526 |
+
var mouseup = function() {
|
1527 |
+
off(window, "mouseup", mouseup);
|
1528 |
+
setTimeout(rehide, 20);
|
1529 |
+
};
|
1530 |
+
on(window, "mouseup", mouseup);
|
1531 |
+
} else {
|
1532 |
+
setTimeout(rehide, 50);
|
1533 |
+
}
|
1534 |
+
},
|
1535 |
+
|
1536 |
+
setUneditable: nothing,
|
1537 |
+
|
1538 |
+
needsContentAttribute: false
|
1539 |
+
}, TextareaInput.prototype);
|
1540 |
+
|
1541 |
+
// CONTENTEDITABLE INPUT STYLE
|
1542 |
+
|
1543 |
+
function ContentEditableInput(cm) {
|
1544 |
+
this.cm = cm;
|
1545 |
+
this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
|
1546 |
+
this.polling = new Delayed();
|
1547 |
+
this.gracePeriod = false;
|
1548 |
+
}
|
1549 |
+
|
1550 |
+
ContentEditableInput.prototype = copyObj({
|
1551 |
+
init: function(display) {
|
1552 |
+
var input = this, cm = input.cm;
|
1553 |
+
var div = input.div = display.lineDiv;
|
1554 |
+
div.contentEditable = "true";
|
1555 |
+
disableBrowserMagic(div);
|
1556 |
+
|
1557 |
+
on(div, "paste", function(e) { handlePaste(e, cm); })
|
1558 |
+
|
1559 |
+
on(div, "compositionstart", function(e) {
|
1560 |
+
var data = e.data;
|
1561 |
+
input.composing = {sel: cm.doc.sel, data: data, startData: data};
|
1562 |
+
if (!data) return;
|
1563 |
+
var prim = cm.doc.sel.primary();
|
1564 |
+
var line = cm.getLine(prim.head.line);
|
1565 |
+
var found = line.indexOf(data, Math.max(0, prim.head.ch - data.length));
|
1566 |
+
if (found > -1 && found <= prim.head.ch)
|
1567 |
+
input.composing.sel = simpleSelection(Pos(prim.head.line, found),
|
1568 |
+
Pos(prim.head.line, found + data.length));
|
1569 |
+
});
|
1570 |
+
on(div, "compositionupdate", function(e) {
|
1571 |
+
input.composing.data = e.data;
|
1572 |
+
});
|
1573 |
+
on(div, "compositionend", function(e) {
|
1574 |
+
var ours = input.composing;
|
1575 |
+
if (!ours) return;
|
1576 |
+
if (e.data != ours.startData && !/\u200b/.test(e.data))
|
1577 |
+
ours.data = e.data;
|
1578 |
+
// Need a small delay to prevent other code (input event,
|
1579 |
+
// selection polling) from doing damage when fired right after
|
1580 |
+
// compositionend.
|
1581 |
+
setTimeout(function() {
|
1582 |
+
if (!ours.handled)
|
1583 |
+
input.applyComposition(ours);
|
1584 |
+
if (input.composing == ours)
|
1585 |
+
input.composing = null;
|
1586 |
+
}, 50);
|
1587 |
+
});
|
1588 |
+
|
1589 |
+
on(div, "touchstart", function() {
|
1590 |
+
input.forceCompositionEnd();
|
1591 |
+
});
|
1592 |
+
|
1593 |
+
on(div, "input", function() {
|
1594 |
+
if (input.composing) return;
|
1595 |
+
if (!input.pollContent())
|
1596 |
+
runInOp(input.cm, function() {regChange(cm);});
|
1597 |
+
});
|
1598 |
+
|
1599 |
+
function onCopyCut(e) {
|
1600 |
+
if (cm.somethingSelected()) {
|
1601 |
+
lastCopied = cm.getSelections();
|
1602 |
+
if (e.type == "cut") cm.replaceSelection("", null, "cut");
|
1603 |
+
} else if (!cm.options.lineWiseCopyCut) {
|
1604 |
+
return;
|
1605 |
+
} else {
|
1606 |
+
var ranges = copyableRanges(cm);
|
1607 |
+
lastCopied = ranges.text;
|
1608 |
+
if (e.type == "cut") {
|
1609 |
+
cm.operation(function() {
|
1610 |
+
cm.setSelections(ranges.ranges, 0, sel_dontScroll);
|
1611 |
+
cm.replaceSelection("", null, "cut");
|
1612 |
+
});
|
1613 |
+
}
|
1614 |
+
}
|
1615 |
+
// iOS exposes the clipboard API, but seems to discard content inserted into it
|
1616 |
+
if (e.clipboardData && !ios) {
|
1617 |
+
e.preventDefault();
|
1618 |
+
e.clipboardData.clearData();
|
1619 |
+
e.clipboardData.setData("text/plain", lastCopied.join("\n"));
|
1620 |
+
} else {
|
1621 |
+
// Old-fashioned briefly-focus-a-textarea hack
|
1622 |
+
var kludge = hiddenTextarea(), te = kludge.firstChild;
|
1623 |
+
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
|
1624 |
+
te.value = lastCopied.join("\n");
|
1625 |
+
var hadFocus = document.activeElement;
|
1626 |
+
selectInput(te);
|
1627 |
+
setTimeout(function() {
|
1628 |
+
cm.display.lineSpace.removeChild(kludge);
|
1629 |
+
hadFocus.focus();
|
1630 |
+
}, 50);
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
on(div, "copy", onCopyCut);
|
1634 |
+
on(div, "cut", onCopyCut);
|
1635 |
+
},
|
1636 |
+
|
1637 |
+
prepareSelection: function() {
|
1638 |
+
var result = prepareSelection(this.cm, false);
|
1639 |
+
result.focus = this.cm.state.focused;
|
1640 |
+
return result;
|
1641 |
+
},
|
1642 |
+
|
1643 |
+
showSelection: function(info) {
|
1644 |
+
if (!info || !this.cm.display.view.length) return;
|
1645 |
+
if (info.focus) this.showPrimarySelection();
|
1646 |
+
this.showMultipleSelections(info);
|
1647 |
+
},
|
1648 |
+
|
1649 |
+
showPrimarySelection: function() {
|
1650 |
+
var sel = window.getSelection(), prim = this.cm.doc.sel.primary();
|
1651 |
+
var curAnchor = domToPos(this.cm, sel.anchorNode, sel.anchorOffset);
|
1652 |
+
var curFocus = domToPos(this.cm, sel.focusNode, sel.focusOffset);
|
1653 |
+
if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
|
1654 |
+
cmp(minPos(curAnchor, curFocus), prim.from()) == 0 &&
|
1655 |
+
cmp(maxPos(curAnchor, curFocus), prim.to()) == 0)
|
1656 |
+
return;
|
1657 |
+
|
1658 |
+
var start = posToDOM(this.cm, prim.from());
|
1659 |
+
var end = posToDOM(this.cm, prim.to());
|
1660 |
+
if (!start && !end) return;
|
1661 |
+
|
1662 |
+
var view = this.cm.display.view;
|
1663 |
+
var old = sel.rangeCount && sel.getRangeAt(0);
|
1664 |
+
if (!start) {
|
1665 |
+
start = {node: view[0].measure.map[2], offset: 0};
|
1666 |
+
} else if (!end) { // FIXME dangerously hacky
|
1667 |
+
var measure = view[view.length - 1].measure;
|
1668 |
+
var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
|
1669 |
+
end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
try { var rng = range(start.node, start.offset, end.offset, end.node); }
|
1673 |
+
catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
|
1674 |
+
if (rng) {
|
1675 |
+
sel.removeAllRanges();
|
1676 |
+
sel.addRange(rng);
|
1677 |
+
if (old && sel.anchorNode == null) sel.addRange(old);
|
1678 |
+
else if (gecko) this.startGracePeriod();
|
1679 |
+
}
|
1680 |
+
this.rememberSelection();
|
1681 |
+
},
|
1682 |
+
|
1683 |
+
startGracePeriod: function() {
|
1684 |
+
var input = this;
|
1685 |
+
clearTimeout(this.gracePeriod);
|
1686 |
+
this.gracePeriod = setTimeout(function() {
|
1687 |
+
input.gracePeriod = false;
|
1688 |
+
if (input.selectionChanged())
|
1689 |
+
input.cm.operation(function() { input.cm.curOp.selectionChanged = true; });
|
1690 |
+
}, 20);
|
1691 |
+
},
|
1692 |
+
|
1693 |
+
showMultipleSelections: function(info) {
|
1694 |
+
removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
|
1695 |
+
removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
|
1696 |
+
},
|
1697 |
+
|
1698 |
+
rememberSelection: function() {
|
1699 |
+
var sel = window.getSelection();
|
1700 |
+
this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
|
1701 |
+
this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
|
1702 |
+
},
|
1703 |
+
|
1704 |
+
selectionInEditor: function() {
|
1705 |
+
var sel = window.getSelection();
|
1706 |
+
if (!sel.rangeCount) return false;
|
1707 |
+
var node = sel.getRangeAt(0).commonAncestorContainer;
|
1708 |
+
return contains(this.div, node);
|
1709 |
+
},
|
1710 |
+
|
1711 |
+
focus: function() {
|
1712 |
+
if (this.cm.options.readOnly != "nocursor") this.div.focus();
|
1713 |
+
},
|
1714 |
+
blur: function() { this.div.blur(); },
|
1715 |
+
getField: function() { return this.div; },
|
1716 |
+
|
1717 |
+
supportsTouch: function() { return true; },
|
1718 |
+
|
1719 |
+
receivedFocus: function() {
|
1720 |
+
var input = this;
|
1721 |
+
if (this.selectionInEditor())
|
1722 |
+
this.pollSelection();
|
1723 |
+
else
|
1724 |
+
runInOp(this.cm, function() { input.cm.curOp.selectionChanged = true; });
|
1725 |
+
|
1726 |
+
function poll() {
|
1727 |
+
if (input.cm.state.focused) {
|
1728 |
+
input.pollSelection();
|
1729 |
+
input.polling.set(input.cm.options.pollInterval, poll);
|
1730 |
+
}
|
1731 |
+
}
|
1732 |
+
this.polling.set(this.cm.options.pollInterval, poll);
|
1733 |
+
},
|
1734 |
+
|
1735 |
+
selectionChanged: function() {
|
1736 |
+
var sel = window.getSelection();
|
1737 |
+
return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
|
1738 |
+
sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset;
|
1739 |
+
},
|
1740 |
+
|
1741 |
+
pollSelection: function() {
|
1742 |
+
if (!this.composing && !this.gracePeriod && this.selectionChanged()) {
|
1743 |
+
var sel = window.getSelection(), cm = this.cm;
|
1744 |
+
this.rememberSelection();
|
1745 |
+
var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
|
1746 |
+
var head = domToPos(cm, sel.focusNode, sel.focusOffset);
|
1747 |
+
if (anchor && head) runInOp(cm, function() {
|
1748 |
+
setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
|
1749 |
+
if (anchor.bad || head.bad) cm.curOp.selectionChanged = true;
|
1750 |
+
});
|
1751 |
+
}
|
1752 |
+
},
|
1753 |
+
|
1754 |
+
pollContent: function() {
|
1755 |
+
var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
|
1756 |
+
var from = sel.from(), to = sel.to();
|
1757 |
+
if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false;
|
1758 |
+
|
1759 |
+
var fromIndex;
|
1760 |
+
if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
|
1761 |
+
var fromLine = lineNo(display.view[0].line);
|
1762 |
+
var fromNode = display.view[0].node;
|
1763 |
+
} else {
|
1764 |
+
var fromLine = lineNo(display.view[fromIndex].line);
|
1765 |
+
var fromNode = display.view[fromIndex - 1].node.nextSibling;
|
1766 |
+
}
|
1767 |
+
var toIndex = findViewIndex(cm, to.line);
|
1768 |
+
if (toIndex == display.view.length - 1) {
|
1769 |
+
var toLine = display.viewTo - 1;
|
1770 |
+
var toNode = display.lineDiv.lastChild;
|
1771 |
+
} else {
|
1772 |
+
var toLine = lineNo(display.view[toIndex + 1].line) - 1;
|
1773 |
+
var toNode = display.view[toIndex + 1].node.previousSibling;
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
|
1777 |
+
var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
|
1778 |
+
while (newText.length > 1 && oldText.length > 1) {
|
1779 |
+
if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
|
1780 |
+
else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
|
1781 |
+
else break;
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
var cutFront = 0, cutEnd = 0;
|
1785 |
+
var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
|
1786 |
+
while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
|
1787 |
+
++cutFront;
|
1788 |
+
var newBot = lst(newText), oldBot = lst(oldText);
|
1789 |
+
var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
|
1790 |
+
oldBot.length - (oldText.length == 1 ? cutFront : 0));
|
1791 |
+
while (cutEnd < maxCutEnd &&
|
1792 |
+
newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
|
1793 |
+
++cutEnd;
|
1794 |
+
|
1795 |
+
newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd);
|
1796 |
+
newText[0] = newText[0].slice(cutFront);
|
1797 |
+
|
1798 |
+
var chFrom = Pos(fromLine, cutFront);
|
1799 |
+
var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
|
1800 |
+
if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
|
1801 |
+
replaceRange(cm.doc, newText, chFrom, chTo, "+input");
|
1802 |
+
return true;
|
1803 |
+
}
|
1804 |
+
},
|
1805 |
+
|
1806 |
+
ensurePolled: function() {
|
1807 |
+
this.forceCompositionEnd();
|
1808 |
+
},
|
1809 |
+
reset: function() {
|
1810 |
+
this.forceCompositionEnd();
|
1811 |
+
},
|
1812 |
+
forceCompositionEnd: function() {
|
1813 |
+
if (!this.composing || this.composing.handled) return;
|
1814 |
+
this.applyComposition(this.composing);
|
1815 |
+
this.composing.handled = true;
|
1816 |
+
this.div.blur();
|
1817 |
+
this.div.focus();
|
1818 |
+
},
|
1819 |
+
applyComposition: function(composing) {
|
1820 |
+
if (composing.data && composing.data != composing.startData)
|
1821 |
+
operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
|
1822 |
+
},
|
1823 |
+
|
1824 |
+
setUneditable: function(node) {
|
1825 |
+
node.setAttribute("contenteditable", "false");
|
1826 |
+
},
|
1827 |
+
|
1828 |
+
onKeyPress: function(e) {
|
1829 |
+
e.preventDefault();
|
1830 |
+
operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
|
1831 |
+
},
|
1832 |
+
|
1833 |
+
onContextMenu: nothing,
|
1834 |
+
resetPosition: nothing,
|
1835 |
+
|
1836 |
+
needsContentAttribute: true
|
1837 |
+
}, ContentEditableInput.prototype);
|
1838 |
+
|
1839 |
+
function posToDOM(cm, pos) {
|
1840 |
+
var view = findViewForLine(cm, pos.line);
|
1841 |
+
if (!view || view.hidden) return null;
|
1842 |
+
var line = getLine(cm.doc, pos.line);
|
1843 |
+
var info = mapFromLineView(view, line, pos.line);
|
1844 |
+
|
1845 |
+
var order = getOrder(line), side = "left";
|
1846 |
+
if (order) {
|
1847 |
+
var partPos = getBidiPartAt(order, pos.ch);
|
1848 |
+
side = partPos % 2 ? "right" : "left";
|
1849 |
+
}
|
1850 |
+
var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
|
1851 |
+
result.offset = result.collapse == "right" ? result.end : result.start;
|
1852 |
+
return result;
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
function badPos(pos, bad) { if (bad) pos.bad = true; return pos; }
|
1856 |
+
|
1857 |
+
function domToPos(cm, node, offset) {
|
1858 |
+
var lineNode;
|
1859 |
+
if (node == cm.display.lineDiv) {
|
1860 |
+
lineNode = cm.display.lineDiv.childNodes[offset];
|
1861 |
+
if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true);
|
1862 |
+
node = null; offset = 0;
|
1863 |
+
} else {
|
1864 |
+
for (lineNode = node;; lineNode = lineNode.parentNode) {
|
1865 |
+
if (!lineNode || lineNode == cm.display.lineDiv) return null;
|
1866 |
+
if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break;
|
1867 |
+
}
|
1868 |
+
}
|
1869 |
+
for (var i = 0; i < cm.display.view.length; i++) {
|
1870 |
+
var lineView = cm.display.view[i];
|
1871 |
+
if (lineView.node == lineNode)
|
1872 |
+
return locateNodeInLineView(lineView, node, offset);
|
1873 |
+
}
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
function locateNodeInLineView(lineView, node, offset) {
|
1877 |
+
var wrapper = lineView.text.firstChild, bad = false;
|
1878 |
+
if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true);
|
1879 |
+
if (node == wrapper) {
|
1880 |
+
bad = true;
|
1881 |
+
node = wrapper.childNodes[offset];
|
1882 |
+
offset = 0;
|
1883 |
+
if (!node) {
|
1884 |
+
var line = lineView.rest ? lst(lineView.rest) : lineView.line;
|
1885 |
+
return badPos(Pos(lineNo(line), line.text.length), bad);
|
1886 |
+
}
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
var textNode = node.nodeType == 3 ? node : null, topNode = node;
|
1890 |
+
if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
|
1891 |
+
textNode = node.firstChild;
|
1892 |
+
if (offset) offset = textNode.nodeValue.length;
|
1893 |
+
}
|
1894 |
+
while (topNode.parentNode != wrapper) topNode = topNode.parentNode;
|
1895 |
+
var measure = lineView.measure, maps = measure.maps;
|
1896 |
+
|
1897 |
+
function find(textNode, topNode, offset) {
|
1898 |
+
for (var i = -1; i < (maps ? maps.length : 0); i++) {
|
1899 |
+
var map = i < 0 ? measure.map : maps[i];
|
1900 |
+
for (var j = 0; j < map.length; j += 3) {
|
1901 |
+
var curNode = map[j + 2];
|
1902 |
+
if (curNode == textNode || curNode == topNode) {
|
1903 |
+
var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
|
1904 |
+
var ch = map[j] + offset;
|
1905 |
+
if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)];
|
1906 |
+
return Pos(line, ch);
|
1907 |
+
}
|
1908 |
+
}
|
1909 |
+
}
|
1910 |
+
}
|
1911 |
+
var found = find(textNode, topNode, offset);
|
1912 |
+
if (found) return badPos(found, bad);
|
1913 |
+
|
1914 |
+
// FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
|
1915 |
+
for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
|
1916 |
+
found = find(after, after.firstChild, 0);
|
1917 |
+
if (found)
|
1918 |
+
return badPos(Pos(found.line, found.ch - dist), bad);
|
1919 |
+
else
|
1920 |
+
dist += after.textContent.length;
|
1921 |
+
}
|
1922 |
+
for (var before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {
|
1923 |
+
found = find(before, before.firstChild, -1);
|
1924 |
+
if (found)
|
1925 |
+
return badPos(Pos(found.line, found.ch + dist), bad);
|
1926 |
+
else
|
1927 |
+
dist += after.textContent.length;
|
1928 |
+
}
|
1929 |
+
}
|
1930 |
+
|
1931 |
+
function domTextBetween(cm, from, to, fromLine, toLine) {
|
1932 |
+
var text = "", closing = false, lineSep = cm.doc.lineSeparator();
|
1933 |
+
function recognizeMarker(id) { return function(marker) { return marker.id == id; }; }
|
1934 |
+
function walk(node) {
|
1935 |
+
if (node.nodeType == 1) {
|
1936 |
+
var cmText = node.getAttribute("cm-text");
|
1937 |
+
if (cmText != null) {
|
1938 |
+
if (cmText == "") cmText = node.textContent.replace(/\u200b/g, "");
|
1939 |
+
text += cmText;
|
1940 |
+
return;
|
1941 |
+
}
|
1942 |
+
var markerID = node.getAttribute("cm-marker"), range;
|
1943 |
+
if (markerID) {
|
1944 |
+
var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
|
1945 |
+
if (found.length && (range = found[0].find()))
|
1946 |
+
text += getBetween(cm.doc, range.from, range.to).join(lineSep);
|
1947 |
+
return;
|
1948 |
+
}
|
1949 |
+
if (node.getAttribute("contenteditable") == "false") return;
|
1950 |
+
for (var i = 0; i < node.childNodes.length; i++)
|
1951 |
+
walk(node.childNodes[i]);
|
1952 |
+
if (/^(pre|div|p)$/i.test(node.nodeName))
|
1953 |
+
closing = true;
|
1954 |
+
} else if (node.nodeType == 3) {
|
1955 |
+
var val = node.nodeValue;
|
1956 |
+
if (!val) return;
|
1957 |
+
if (closing) {
|
1958 |
+
text += lineSep;
|
1959 |
+
closing = false;
|
1960 |
+
}
|
1961 |
+
text += val;
|
1962 |
+
}
|
1963 |
+
}
|
1964 |
+
for (;;) {
|
1965 |
+
walk(from);
|
1966 |
+
if (from == to) break;
|
1967 |
+
from = from.nextSibling;
|
1968 |
+
}
|
1969 |
+
return text;
|
1970 |
+
}
|
1971 |
+
|
1972 |
+
CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
|
1973 |
+
|
1974 |
+
// SELECTION / CURSOR
|
1975 |
+
|
1976 |
+
// Selection objects are immutable. A new one is created every time
|
1977 |
+
// the selection changes. A selection is one or more non-overlapping
|
1978 |
+
// (and non-touching) ranges, sorted, and an integer that indicates
|
1979 |
+
// which one is the primary selection (the one that's scrolled into
|
1980 |
+
// view, that getCursor returns, etc).
|
1981 |
+
function Selection(ranges, primIndex) {
|
1982 |
+
this.ranges = ranges;
|
1983 |
+
this.primIndex = primIndex;
|
1984 |
+
}
|
1985 |
+
|
1986 |
+
Selection.prototype = {
|
1987 |
+
primary: function() { return this.ranges[this.primIndex]; },
|
1988 |
+
equals: function(other) {
|
1989 |
+
if (other == this) return true;
|
1990 |
+
if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false;
|
1991 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
1992 |
+
var here = this.ranges[i], there = other.ranges[i];
|
1993 |
+
if (cmp(here.anchor, there.anchor) != 0 || cmp(here.head, there.head) != 0) return false;
|
1994 |
+
}
|
1995 |
+
return true;
|
1996 |
+
},
|
1997 |
+
deepCopy: function() {
|
1998 |
+
for (var out = [], i = 0; i < this.ranges.length; i++)
|
1999 |
+
out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));
|
2000 |
+
return new Selection(out, this.primIndex);
|
2001 |
+
},
|
2002 |
+
somethingSelected: function() {
|
2003 |
+
for (var i = 0; i < this.ranges.length; i++)
|
2004 |
+
if (!this.ranges[i].empty()) return true;
|
2005 |
+
return false;
|
2006 |
+
},
|
2007 |
+
contains: function(pos, end) {
|
2008 |
+
if (!end) end = pos;
|
2009 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
2010 |
+
var range = this.ranges[i];
|
2011 |
+
if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
|
2012 |
+
return i;
|
2013 |
+
}
|
2014 |
+
return -1;
|
2015 |
+
}
|
2016 |
+
};
|
2017 |
+
|
2018 |
+
function Range(anchor, head) {
|
2019 |
+
this.anchor = anchor; this.head = head;
|
2020 |
+
}
|
2021 |
+
|
2022 |
+
Range.prototype = {
|
2023 |
+
from: function() { return minPos(this.anchor, this.head); },
|
2024 |
+
to: function() { return maxPos(this.anchor, this.head); },
|
2025 |
+
empty: function() {
|
2026 |
+
return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch;
|
2027 |
+
}
|
2028 |
+
};
|
2029 |
+
|
2030 |
+
// Take an unsorted, potentially overlapping set of ranges, and
|
2031 |
+
// build a selection out of it. 'Consumes' ranges array (modifying
|
2032 |
+
// it).
|
2033 |
+
function normalizeSelection(ranges, primIndex) {
|
2034 |
+
var prim = ranges[primIndex];
|
2035 |
+
ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });
|
2036 |
+
primIndex = indexOf(ranges, prim);
|
2037 |
+
for (var i = 1; i < ranges.length; i++) {
|
2038 |
+
var cur = ranges[i], prev = ranges[i - 1];
|
2039 |
+
if (cmp(prev.to(), cur.from()) >= 0) {
|
2040 |
+
var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
|
2041 |
+
var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
|
2042 |
+
if (i <= primIndex) --primIndex;
|
2043 |
+
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
|
2044 |
+
}
|
2045 |
+
}
|
2046 |
+
return new Selection(ranges, primIndex);
|
2047 |
+
}
|
2048 |
+
|
2049 |
+
function simpleSelection(anchor, head) {
|
2050 |
+
return new Selection([new Range(anchor, head || anchor)], 0);
|
2051 |
+
}
|
2052 |
+
|
2053 |
+
// Most of the external API clips given positions to make sure they
|
2054 |
+
// actually exist within the document.
|
2055 |
+
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
|
2056 |
+
function clipPos(doc, pos) {
|
2057 |
+
if (pos.line < doc.first) return Pos(doc.first, 0);
|
2058 |
+
var last = doc.first + doc.size - 1;
|
2059 |
+
if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
|
2060 |
+
return clipToLen(pos, getLine(doc, pos.line).text.length);
|
2061 |
+
}
|
2062 |
+
function clipToLen(pos, linelen) {
|
2063 |
+
var ch = pos.ch;
|
2064 |
+
if (ch == null || ch > linelen) return Pos(pos.line, linelen);
|
2065 |
+
else if (ch < 0) return Pos(pos.line, 0);
|
2066 |
+
else return pos;
|
2067 |
+
}
|
2068 |
+
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
|
2069 |
+
function clipPosArray(doc, array) {
|
2070 |
+
for (var out = [], i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i]);
|
2071 |
+
return out;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
// SELECTION UPDATES
|
2075 |
+
|
2076 |
+
// The 'scroll' parameter given to many of these indicated whether
|
2077 |
+
// the new cursor position should be scrolled into view after
|
2078 |
+
// modifying the selection.
|
2079 |
+
|
2080 |
+
// If shift is held or the extend flag is set, extends a range to
|
2081 |
+
// include a given position (and optionally a second position).
|
2082 |
+
// Otherwise, simply returns the range between the given positions.
|
2083 |
+
// Used for cursor motion and such.
|
2084 |
+
function extendRange(doc, range, head, other) {
|
2085 |
+
if (doc.cm && doc.cm.display.shift || doc.extend) {
|
2086 |
+
var anchor = range.anchor;
|
2087 |
+
if (other) {
|
2088 |
+
var posBefore = cmp(head, anchor) < 0;
|
2089 |
+
if (posBefore != (cmp(other, anchor) < 0)) {
|
2090 |
+
anchor = head;
|
2091 |
+
head = other;
|
2092 |
+
} else if (posBefore != (cmp(head, other) < 0)) {
|
2093 |
+
head = other;
|
2094 |
+
}
|
2095 |
+
}
|
2096 |
+
return new Range(anchor, head);
|
2097 |
+
} else {
|
2098 |
+
return new Range(other || head, head);
|
2099 |
+
}
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
// Extend the primary selection range, discard the rest.
|
2103 |
+
function extendSelection(doc, head, other, options) {
|
2104 |
+
setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options);
|
2105 |
+
}
|
2106 |
+
|
2107 |
+
// Extend all selections (pos is an array of selections with length
|
2108 |
+
// equal the number of selections)
|
2109 |
+
function extendSelections(doc, heads, options) {
|
2110 |
+
for (var out = [], i = 0; i < doc.sel.ranges.length; i++)
|
2111 |
+
out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null);
|
2112 |
+
var newSel = normalizeSelection(out, doc.sel.primIndex);
|
2113 |
+
setSelection(doc, newSel, options);
|
2114 |
+
}
|
2115 |
+
|
2116 |
+
// Updates a single range in the selection.
|
2117 |
+
function replaceOneSelection(doc, i, range, options) {
|
2118 |
+
var ranges = doc.sel.ranges.slice(0);
|
2119 |
+
ranges[i] = range;
|
2120 |
+
setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
// Reset the selection to a single range.
|
2124 |
+
function setSimpleSelection(doc, anchor, head, options) {
|
2125 |
+
setSelection(doc, simpleSelection(anchor, head), options);
|
2126 |
+
}
|
2127 |
+
|
2128 |
+
// Give beforeSelectionChange handlers a change to influence a
|
2129 |
+
// selection update.
|
2130 |
+
function filterSelectionChange(doc, sel) {
|
2131 |
+
var obj = {
|
2132 |
+
ranges: sel.ranges,
|
2133 |
+
update: function(ranges) {
|
2134 |
+
this.ranges = [];
|
2135 |
+
for (var i = 0; i < ranges.length; i++)
|
2136 |
+
this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
|
2137 |
+
clipPos(doc, ranges[i].head));
|
2138 |
+
}
|
2139 |
+
};
|
2140 |
+
signal(doc, "beforeSelectionChange", doc, obj);
|
2141 |
+
if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
|
2142 |
+
if (obj.ranges != sel.ranges) return normalizeSelection(obj.ranges, obj.ranges.length - 1);
|
2143 |
+
else return sel;
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
function setSelectionReplaceHistory(doc, sel, options) {
|
2147 |
+
var done = doc.history.done, last = lst(done);
|
2148 |
+
if (last && last.ranges) {
|
2149 |
+
done[done.length - 1] = sel;
|
2150 |
+
setSelectionNoUndo(doc, sel, options);
|
2151 |
+
} else {
|
2152 |
+
setSelection(doc, sel, options);
|
2153 |
+
}
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
// Set a new selection.
|
2157 |
+
function setSelection(doc, sel, options) {
|
2158 |
+
setSelectionNoUndo(doc, sel, options);
|
2159 |
+
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
|
2160 |
+
}
|
2161 |
+
|
2162 |
+
function setSelectionNoUndo(doc, sel, options) {
|
2163 |
+
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
2164 |
+
sel = filterSelectionChange(doc, sel);
|
2165 |
+
|
2166 |
+
var bias = options && options.bias ||
|
2167 |
+
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
|
2168 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
|
2169 |
+
|
2170 |
+
if (!(options && options.scroll === false) && doc.cm)
|
2171 |
+
ensureCursorVisible(doc.cm);
|
2172 |
+
}
|
2173 |
+
|
2174 |
+
function setSelectionInner(doc, sel) {
|
2175 |
+
if (sel.equals(doc.sel)) return;
|
2176 |
+
|
2177 |
+
doc.sel = sel;
|
2178 |
+
|
2179 |
+
if (doc.cm) {
|
2180 |
+
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;
|
2181 |
+
signalCursorActivity(doc.cm);
|
2182 |
+
}
|
2183 |
+
signalLater(doc, "cursorActivity", doc);
|
2184 |
+
}
|
2185 |
+
|
2186 |
+
// Verify that the selection does not partially select any atomic
|
2187 |
+
// marked ranges.
|
2188 |
+
function reCheckSelection(doc) {
|
2189 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll);
|
2190 |
+
}
|
2191 |
+
|
2192 |
+
// Return a selection that does not partially select any atomic
|
2193 |
+
// ranges.
|
2194 |
+
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
2195 |
+
var out;
|
2196 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
2197 |
+
var range = sel.ranges[i];
|
2198 |
+
var newAnchor = skipAtomic(doc, range.anchor, bias, mayClear);
|
2199 |
+
var newHead = skipAtomic(doc, range.head, bias, mayClear);
|
2200 |
+
if (out || newAnchor != range.anchor || newHead != range.head) {
|
2201 |
+
if (!out) out = sel.ranges.slice(0, i);
|
2202 |
+
out[i] = new Range(newAnchor, newHead);
|
2203 |
+
}
|
2204 |
+
}
|
2205 |
+
return out ? normalizeSelection(out, sel.primIndex) : sel;
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
// Ensure a given position is not inside an atomic range.
|
2209 |
+
function skipAtomic(doc, pos, bias, mayClear) {
|
2210 |
+
var flipped = false, curPos = pos;
|
2211 |
+
var dir = bias || 1;
|
2212 |
+
doc.cantEdit = false;
|
2213 |
+
search: for (;;) {
|
2214 |
+
var line = getLine(doc, curPos.line);
|
2215 |
+
if (line.markedSpans) {
|
2216 |
+
for (var i = 0; i < line.markedSpans.length; ++i) {
|
2217 |
+
var sp = line.markedSpans[i], m = sp.marker;
|
2218 |
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
|
2219 |
+
(sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
|
2220 |
+
if (mayClear) {
|
2221 |
+
signal(m, "beforeCursorEnter");
|
2222 |
+
if (m.explicitlyCleared) {
|
2223 |
+
if (!line.markedSpans) break;
|
2224 |
+
else {--i; continue;}
|
2225 |
+
}
|
2226 |
+
}
|
2227 |
+
if (!m.atomic) continue;
|
2228 |
+
var newPos = m.find(dir < 0 ? -1 : 1);
|
2229 |
+
if (cmp(newPos, curPos) == 0) {
|
2230 |
+
newPos.ch += dir;
|
2231 |
+
if (newPos.ch < 0) {
|
2232 |
+
if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
|
2233 |
+
else newPos = null;
|
2234 |
+
} else if (newPos.ch > line.text.length) {
|
2235 |
+
if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
|
2236 |
+
else newPos = null;
|
2237 |
+
}
|
2238 |
+
if (!newPos) {
|
2239 |
+
if (flipped) {
|
2240 |
+
// Driven in a corner -- no valid cursor position found at all
|
2241 |
+
// -- try again *with* clearing, if we didn't already
|
2242 |
+
if (!mayClear) return skipAtomic(doc, pos, bias, true);
|
2243 |
+
// Otherwise, turn off editing until further notice, and return the start of the doc
|
2244 |
+
doc.cantEdit = true;
|
2245 |
+
return Pos(doc.first, 0);
|
2246 |
+
}
|
2247 |
+
flipped = true; newPos = pos; dir = -dir;
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
curPos = newPos;
|
2251 |
+
continue search;
|
2252 |
+
}
|
2253 |
+
}
|
2254 |
+
}
|
2255 |
+
return curPos;
|
2256 |
+
}
|
2257 |
+
}
|
2258 |
+
|
2259 |
+
// SELECTION DRAWING
|
2260 |
+
|
2261 |
+
function updateSelection(cm) {
|
2262 |
+
cm.display.input.showSelection(cm.display.input.prepareSelection());
|
2263 |
+
}
|
2264 |
+
|
2265 |
+
function prepareSelection(cm, primary) {
|
2266 |
+
var doc = cm.doc, result = {};
|
2267 |
+
var curFragment = result.cursors = document.createDocumentFragment();
|
2268 |
+
var selFragment = result.selection = document.createDocumentFragment();
|
2269 |
+
|
2270 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
2271 |
+
if (primary === false && i == doc.sel.primIndex) continue;
|
2272 |
+
var range = doc.sel.ranges[i];
|
2273 |
+
var collapsed = range.empty();
|
2274 |
+
if (collapsed || cm.options.showCursorWhenSelecting)
|
2275 |
+
drawSelectionCursor(cm, range.head, curFragment);
|
2276 |
+
if (!collapsed)
|
2277 |
+
drawSelectionRange(cm, range, selFragment);
|
2278 |
+
}
|
2279 |
+
return result;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
// Draws a cursor for the given range
|
2283 |
+
function drawSelectionCursor(cm, head, output) {
|
2284 |
+
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
|
2285 |
+
|
2286 |
+
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
|
2287 |
+
cursor.style.left = pos.left + "px";
|
2288 |
+
cursor.style.top = pos.top + "px";
|
2289 |
+
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
|
2290 |
+
|
2291 |
+
if (pos.other) {
|
2292 |
+
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
2293 |
+
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
|
2294 |
+
otherCursor.style.display = "";
|
2295 |
+
otherCursor.style.left = pos.other.left + "px";
|
2296 |
+
otherCursor.style.top = pos.other.top + "px";
|
2297 |
+
otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
|
2298 |
+
}
|
2299 |
+
}
|
2300 |
+
|
2301 |
+
// Draws the given range as a highlighted selection
|
2302 |
+
function drawSelectionRange(cm, range, output) {
|
2303 |
+
var display = cm.display, doc = cm.doc;
|
2304 |
+
var fragment = document.createDocumentFragment();
|
2305 |
+
var padding = paddingH(cm.display), leftSide = padding.left;
|
2306 |
+
var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
|
2307 |
+
|
2308 |
+
function add(left, top, width, bottom) {
|
2309 |
+
if (top < 0) top = 0;
|
2310 |
+
top = Math.round(top);
|
2311 |
+
bottom = Math.round(bottom);
|
2312 |
+
fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
|
2313 |
+
"px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) +
|
2314 |
+
"px; height: " + (bottom - top) + "px"));
|
2315 |
+
}
|
2316 |
+
|
2317 |
+
function drawForLine(line, fromArg, toArg) {
|
2318 |
+
var lineObj = getLine(doc, line);
|
2319 |
+
var lineLen = lineObj.text.length;
|
2320 |
+
var start, end;
|
2321 |
+
function coords(ch, bias) {
|
2322 |
+
return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
|
2323 |
+
}
|
2324 |
+
|
2325 |
+
iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
|
2326 |
+
var leftPos = coords(from, "left"), rightPos, left, right;
|
2327 |
+
if (from == to) {
|
2328 |
+
rightPos = leftPos;
|
2329 |
+
left = right = leftPos.left;
|
2330 |
+
} else {
|
2331 |
+
rightPos = coords(to - 1, "right");
|
2332 |
+
if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
|
2333 |
+
left = leftPos.left;
|
2334 |
+
right = rightPos.right;
|
2335 |
+
}
|
2336 |
+
if (fromArg == null && from == 0) left = leftSide;
|
2337 |
+
if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
|
2338 |
+
add(left, leftPos.top, null, leftPos.bottom);
|
2339 |
+
left = leftSide;
|
2340 |
+
if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
|
2341 |
+
}
|
2342 |
+
if (toArg == null && to == lineLen) right = rightSide;
|
2343 |
+
if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
|
2344 |
+
start = leftPos;
|
2345 |
+
if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
|
2346 |
+
end = rightPos;
|
2347 |
+
if (left < leftSide + 1) left = leftSide;
|
2348 |
+
add(left, rightPos.top, right - left, rightPos.bottom);
|
2349 |
+
});
|
2350 |
+
return {start: start, end: end};
|
2351 |
+
}
|
2352 |
+
|
2353 |
+
var sFrom = range.from(), sTo = range.to();
|
2354 |
+
if (sFrom.line == sTo.line) {
|
2355 |
+
drawForLine(sFrom.line, sFrom.ch, sTo.ch);
|
2356 |
+
} else {
|
2357 |
+
var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
|
2358 |
+
var singleVLine = visualLine(fromLine) == visualLine(toLine);
|
2359 |
+
var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
|
2360 |
+
var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
|
2361 |
+
if (singleVLine) {
|
2362 |
+
if (leftEnd.top < rightStart.top - 2) {
|
2363 |
+
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
|
2364 |
+
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
|
2365 |
+
} else {
|
2366 |
+
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
|
2367 |
+
}
|
2368 |
+
}
|
2369 |
+
if (leftEnd.bottom < rightStart.top)
|
2370 |
+
add(leftSide, leftEnd.bottom, null, rightStart.top);
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
output.appendChild(fragment);
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
// Cursor-blinking
|
2377 |
+
function restartBlink(cm) {
|
2378 |
+
if (!cm.state.focused) return;
|
2379 |
+
var display = cm.display;
|
2380 |
+
clearInterval(display.blinker);
|
2381 |
+
var on = true;
|
2382 |
+
display.cursorDiv.style.visibility = "";
|
2383 |
+
if (cm.options.cursorBlinkRate > 0)
|
2384 |
+
display.blinker = setInterval(function() {
|
2385 |
+
display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
|
2386 |
+
}, cm.options.cursorBlinkRate);
|
2387 |
+
else if (cm.options.cursorBlinkRate < 0)
|
2388 |
+
display.cursorDiv.style.visibility = "hidden";
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
// HIGHLIGHT WORKER
|
2392 |
+
|
2393 |
+
function startWorker(cm, time) {
|
2394 |
+
if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
|
2395 |
+
cm.state.highlight.set(time, bind(highlightWorker, cm));
|
2396 |
+
}
|
2397 |
+
|
2398 |
+
function highlightWorker(cm) {
|
2399 |
+
var doc = cm.doc;
|
2400 |
+
if (doc.frontier < doc.first) doc.frontier = doc.first;
|
2401 |
+
if (doc.frontier >= cm.display.viewTo) return;
|
2402 |
+
var end = +new Date + cm.options.workTime;
|
2403 |
+
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
|
2404 |
+
var changedLines = [];
|
2405 |
+
|
2406 |
+
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {
|
2407 |
+
if (doc.frontier >= cm.display.viewFrom) { // Visible
|
2408 |
+
var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
|
2409 |
+
var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
|
2410 |
+
line.styles = highlighted.styles;
|
2411 |
+
var oldCls = line.styleClasses, newCls = highlighted.classes;
|
2412 |
+
if (newCls) line.styleClasses = newCls;
|
2413 |
+
else if (oldCls) line.styleClasses = null;
|
2414 |
+
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
2415 |
+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
|
2416 |
+
for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
|
2417 |
+
if (ischange) changedLines.push(doc.frontier);
|
2418 |
+
line.stateAfter = tooLong ? state : copyState(doc.mode, state);
|
2419 |
+
} else {
|
2420 |
+
if (line.text.length <= cm.options.maxHighlightLength)
|
2421 |
+
processLine(cm, line.text, state);
|
2422 |
+
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
|
2423 |
+
}
|
2424 |
+
++doc.frontier;
|
2425 |
+
if (+new Date > end) {
|
2426 |
+
startWorker(cm, cm.options.workDelay);
|
2427 |
+
return true;
|
2428 |
+
}
|
2429 |
+
});
|
2430 |
+
if (changedLines.length) runInOp(cm, function() {
|
2431 |
+
for (var i = 0; i < changedLines.length; i++)
|
2432 |
+
regLineChange(cm, changedLines[i], "text");
|
2433 |
+
});
|
2434 |
+
}
|
2435 |
+
|
2436 |
+
// Finds the line to start with when starting a parse. Tries to
|
2437 |
+
// find a line with a stateAfter, so that it can start with a
|
2438 |
+
// valid state. If that fails, it returns the line with the
|
2439 |
+
// smallest indentation, which tends to need the least context to
|
2440 |
+
// parse correctly.
|
2441 |
+
function findStartLine(cm, n, precise) {
|
2442 |
+
var minindent, minline, doc = cm.doc;
|
2443 |
+
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
|
2444 |
+
for (var search = n; search > lim; --search) {
|
2445 |
+
if (search <= doc.first) return doc.first;
|
2446 |
+
var line = getLine(doc, search - 1);
|
2447 |
+
if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
|
2448 |
+
var indented = countColumn(line.text, null, cm.options.tabSize);
|
2449 |
+
if (minline == null || minindent > indented) {
|
2450 |
+
minline = search - 1;
|
2451 |
+
minindent = indented;
|
2452 |
+
}
|
2453 |
+
}
|
2454 |
+
return minline;
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
function getStateBefore(cm, n, precise) {
|
2458 |
+
var doc = cm.doc, display = cm.display;
|
2459 |
+
if (!doc.mode.startState) return true;
|
2460 |
+
var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
|
2461 |
+
if (!state) state = startState(doc.mode);
|
2462 |
+
else state = copyState(doc.mode, state);
|
2463 |
+
doc.iter(pos, n, function(line) {
|
2464 |
+
processLine(cm, line.text, state);
|
2465 |
+
var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo;
|
2466 |
+
line.stateAfter = save ? copyState(doc.mode, state) : null;
|
2467 |
+
++pos;
|
2468 |
+
});
|
2469 |
+
if (precise) doc.frontier = pos;
|
2470 |
+
return state;
|
2471 |
+
}
|
2472 |
+
|
2473 |
+
// POSITION MEASUREMENT
|
2474 |
+
|
2475 |
+
function paddingTop(display) {return display.lineSpace.offsetTop;}
|
2476 |
+
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
|
2477 |
+
function paddingH(display) {
|
2478 |
+
if (display.cachedPaddingH) return display.cachedPaddingH;
|
2479 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
|
2480 |
+
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
2481 |
+
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
|
2482 |
+
if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data;
|
2483 |
+
return data;
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth; }
|
2487 |
+
function displayWidth(cm) {
|
2488 |
+
return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth;
|
2489 |
+
}
|
2490 |
+
function displayHeight(cm) {
|
2491 |
+
return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight;
|
2492 |
+
}
|
2493 |
+
|
2494 |
+
// Ensure the lineView.wrapping.heights array is populated. This is
|
2495 |
+
// an array of bottom offsets for the lines that make up a drawn
|
2496 |
+
// line. When lineWrapping is on, there might be more than one
|
2497 |
+
// height.
|
2498 |
+
function ensureLineHeights(cm, lineView, rect) {
|
2499 |
+
var wrapping = cm.options.lineWrapping;
|
2500 |
+
var curWidth = wrapping && displayWidth(cm);
|
2501 |
+
if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
|
2502 |
+
var heights = lineView.measure.heights = [];
|
2503 |
+
if (wrapping) {
|
2504 |
+
lineView.measure.width = curWidth;
|
2505 |
+
var rects = lineView.text.firstChild.getClientRects();
|
2506 |
+
for (var i = 0; i < rects.length - 1; i++) {
|
2507 |
+
var cur = rects[i], next = rects[i + 1];
|
2508 |
+
if (Math.abs(cur.bottom - next.bottom) > 2)
|
2509 |
+
heights.push((cur.bottom + next.top) / 2 - rect.top);
|
2510 |
+
}
|
2511 |
+
}
|
2512 |
+
heights.push(rect.bottom - rect.top);
|
2513 |
+
}
|
2514 |
+
}
|
2515 |
+
|
2516 |
+
// Find a line map (mapping character offsets to text nodes) and a
|
2517 |
+
// measurement cache for the given line number. (A line view might
|
2518 |
+
// contain multiple lines when collapsed ranges are present.)
|
2519 |
+
function mapFromLineView(lineView, line, lineN) {
|
2520 |
+
if (lineView.line == line)
|
2521 |
+
return {map: lineView.measure.map, cache: lineView.measure.cache};
|
2522 |
+
for (var i = 0; i < lineView.rest.length; i++)
|
2523 |
+
if (lineView.rest[i] == line)
|
2524 |
+
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]};
|
2525 |
+
for (var i = 0; i < lineView.rest.length; i++)
|
2526 |
+
if (lineNo(lineView.rest[i]) > lineN)
|
2527 |
+
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true};
|
2528 |
+
}
|
2529 |
+
|
2530 |
+
// Render a line into the hidden node display.externalMeasured. Used
|
2531 |
+
// when measurement is needed for a line that's not in the viewport.
|
2532 |
+
function updateExternalMeasurement(cm, line) {
|
2533 |
+
line = visualLine(line);
|
2534 |
+
var lineN = lineNo(line);
|
2535 |
+
var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
|
2536 |
+
view.lineN = lineN;
|
2537 |
+
var built = view.built = buildLineContent(cm, view);
|
2538 |
+
view.text = built.pre;
|
2539 |
+
removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
|
2540 |
+
return view;
|
2541 |
+
}
|
2542 |
+
|
2543 |
+
// Get a {top, bottom, left, right} box (in line-local coordinates)
|
2544 |
+
// for a given character.
|
2545 |
+
function measureChar(cm, line, ch, bias) {
|
2546 |
+
return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias);
|
2547 |
+
}
|
2548 |
+
|
2549 |
+
// Find a line view that corresponds to the given line number.
|
2550 |
+
function findViewForLine(cm, lineN) {
|
2551 |
+
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
|
2552 |
+
return cm.display.view[findViewIndex(cm, lineN)];
|
2553 |
+
var ext = cm.display.externalMeasured;
|
2554 |
+
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
|
2555 |
+
return ext;
|
2556 |
+
}
|
2557 |
+
|
2558 |
+
// Measurement can be split in two steps, the set-up work that
|
2559 |
+
// applies to the whole line, and the measurement of the actual
|
2560 |
+
// character. Functions like coordsChar, that need to do a lot of
|
2561 |
+
// measurements in a row, can thus ensure that the set-up work is
|
2562 |
+
// only done once.
|
2563 |
+
function prepareMeasureForLine(cm, line) {
|
2564 |
+
var lineN = lineNo(line);
|
2565 |
+
var view = findViewForLine(cm, lineN);
|
2566 |
+
if (view && !view.text) {
|
2567 |
+
view = null;
|
2568 |
+
} else if (view && view.changes) {
|
2569 |
+
updateLineForChanges(cm, view, lineN, getDimensions(cm));
|
2570 |
+
cm.curOp.forceUpdate = true;
|
2571 |
+
}
|
2572 |
+
if (!view)
|
2573 |
+
view = updateExternalMeasurement(cm, line);
|
2574 |
+
|
2575 |
+
var info = mapFromLineView(view, line, lineN);
|
2576 |
+
return {
|
2577 |
+
line: line, view: view, rect: null,
|
2578 |
+
map: info.map, cache: info.cache, before: info.before,
|
2579 |
+
hasHeights: false
|
2580 |
+
};
|
2581 |
+
}
|
2582 |
+
|
2583 |
+
// Given a prepared measurement object, measures the position of an
|
2584 |
+
// actual character (or fetches it from the cache).
|
2585 |
+
function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
|
2586 |
+
if (prepared.before) ch = -1;
|
2587 |
+
var key = ch + (bias || ""), found;
|
2588 |
+
if (prepared.cache.hasOwnProperty(key)) {
|
2589 |
+
found = prepared.cache[key];
|
2590 |
+
} else {
|
2591 |
+
if (!prepared.rect)
|
2592 |
+
prepared.rect = prepared.view.text.getBoundingClientRect();
|
2593 |
+
if (!prepared.hasHeights) {
|
2594 |
+
ensureLineHeights(cm, prepared.view, prepared.rect);
|
2595 |
+
prepared.hasHeights = true;
|
2596 |
+
}
|
2597 |
+
found = measureCharInner(cm, prepared, ch, bias);
|
2598 |
+
if (!found.bogus) prepared.cache[key] = found;
|
2599 |
+
}
|
2600 |
+
return {left: found.left, right: found.right,
|
2601 |
+
top: varHeight ? found.rtop : found.top,
|
2602 |
+
bottom: varHeight ? found.rbottom : found.bottom};
|
2603 |
+
}
|
2604 |
+
|
2605 |
+
var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
|
2606 |
+
|
2607 |
+
function nodeAndOffsetInLineMap(map, ch, bias) {
|
2608 |
+
var node, start, end, collapse;
|
2609 |
+
// First, search the line map for the text node corresponding to,
|
2610 |
+
// or closest to, the target character.
|
2611 |
+
for (var i = 0; i < map.length; i += 3) {
|
2612 |
+
var mStart = map[i], mEnd = map[i + 1];
|
2613 |
+
if (ch < mStart) {
|
2614 |
+
start = 0; end = 1;
|
2615 |
+
collapse = "left";
|
2616 |
+
} else if (ch < mEnd) {
|
2617 |
+
start = ch - mStart;
|
2618 |
+
end = start + 1;
|
2619 |
+
} else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
|
2620 |
+
end = mEnd - mStart;
|
2621 |
+
start = end - 1;
|
2622 |
+
if (ch >= mEnd) collapse = "right";
|
2623 |
+
}
|
2624 |
+
if (start != null) {
|
2625 |
+
node = map[i + 2];
|
2626 |
+
if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
|
2627 |
+
collapse = bias;
|
2628 |
+
if (bias == "left" && start == 0)
|
2629 |
+
while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
|
2630 |
+
node = map[(i -= 3) + 2];
|
2631 |
+
collapse = "left";
|
2632 |
+
}
|
2633 |
+
if (bias == "right" && start == mEnd - mStart)
|
2634 |
+
while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
|
2635 |
+
node = map[(i += 3) + 2];
|
2636 |
+
collapse = "right";
|
2637 |
+
}
|
2638 |
+
break;
|
2639 |
+
}
|
2640 |
+
}
|
2641 |
+
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};
|
2642 |
+
}
|
2643 |
+
|
2644 |
+
function measureCharInner(cm, prepared, ch, bias) {
|
2645 |
+
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
|
2646 |
+
var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
|
2647 |
+
|
2648 |
+
var rect;
|
2649 |
+
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
2650 |
+
for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
2651 |
+
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;
|
2652 |
+
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;
|
2653 |
+
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {
|
2654 |
+
rect = node.parentNode.getBoundingClientRect();
|
2655 |
+
} else if (ie && cm.options.lineWrapping) {
|
2656 |
+
var rects = range(node, start, end).getClientRects();
|
2657 |
+
if (rects.length)
|
2658 |
+
rect = rects[bias == "right" ? rects.length - 1 : 0];
|
2659 |
+
else
|
2660 |
+
rect = nullRect;
|
2661 |
+
} else {
|
2662 |
+
rect = range(node, start, end).getBoundingClientRect() || nullRect;
|
2663 |
+
}
|
2664 |
+
if (rect.left || rect.right || start == 0) break;
|
2665 |
+
end = start;
|
2666 |
+
start = start - 1;
|
2667 |
+
collapse = "right";
|
2668 |
+
}
|
2669 |
+
if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);
|
2670 |
+
} else { // If it is a widget, simply get the box for the whole widget.
|
2671 |
+
if (start > 0) collapse = bias = "right";
|
2672 |
+
var rects;
|
2673 |
+
if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
|
2674 |
+
rect = rects[bias == "right" ? rects.length - 1 : 0];
|
2675 |
+
else
|
2676 |
+
rect = node.getBoundingClientRect();
|
2677 |
+
}
|
2678 |
+
if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
|
2679 |
+
var rSpan = node.parentNode.getClientRects()[0];
|
2680 |
+
if (rSpan)
|
2681 |
+
rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};
|
2682 |
+
else
|
2683 |
+
rect = nullRect;
|
2684 |
+
}
|
2685 |
+
|
2686 |
+
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
|
2687 |
+
var mid = (rtop + rbot) / 2;
|
2688 |
+
var heights = prepared.view.measure.heights;
|
2689 |
+
for (var i = 0; i < heights.length - 1; i++)
|
2690 |
+
if (mid < heights[i]) break;
|
2691 |
+
var top = i ? heights[i - 1] : 0, bot = heights[i];
|
2692 |
+
var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
|
2693 |
+
right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
|
2694 |
+
top: top, bottom: bot};
|
2695 |
+
if (!rect.left && !rect.right) result.bogus = true;
|
2696 |
+
if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
|
2697 |
+
|
2698 |
+
return result;
|
2699 |
+
}
|
2700 |
+
|
2701 |
+
// Work around problem with bounding client rects on ranges being
|
2702 |
+
// returned incorrectly when zoomed on IE10 and below.
|
2703 |
+
function maybeUpdateRectForZooming(measure, rect) {
|
2704 |
+
if (!window.screen || screen.logicalXDPI == null ||
|
2705 |
+
screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
|
2706 |
+
return rect;
|
2707 |
+
var scaleX = screen.logicalXDPI / screen.deviceXDPI;
|
2708 |
+
var scaleY = screen.logicalYDPI / screen.deviceYDPI;
|
2709 |
+
return {left: rect.left * scaleX, right: rect.right * scaleX,
|
2710 |
+
top: rect.top * scaleY, bottom: rect.bottom * scaleY};
|
2711 |
+
}
|
2712 |
+
|
2713 |
+
function clearLineMeasurementCacheFor(lineView) {
|
2714 |
+
if (lineView.measure) {
|
2715 |
+
lineView.measure.cache = {};
|
2716 |
+
lineView.measure.heights = null;
|
2717 |
+
if (lineView.rest) for (var i = 0; i < lineView.rest.length; i++)
|
2718 |
+
lineView.measure.caches[i] = {};
|
2719 |
+
}
|
2720 |
+
}
|
2721 |
+
|
2722 |
+
function clearLineMeasurementCache(cm) {
|
2723 |
+
cm.display.externalMeasure = null;
|
2724 |
+
removeChildren(cm.display.lineMeasure);
|
2725 |
+
for (var i = 0; i < cm.display.view.length; i++)
|
2726 |
+
clearLineMeasurementCacheFor(cm.display.view[i]);
|
2727 |
+
}
|
2728 |
+
|
2729 |
+
function clearCaches(cm) {
|
2730 |
+
clearLineMeasurementCache(cm);
|
2731 |
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
|
2732 |
+
if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
|
2733 |
+
cm.display.lineNumChars = null;
|
2734 |
+
}
|
2735 |
+
|
2736 |
+
function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }
|
2737 |
+
function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }
|
2738 |
+
|
2739 |
+
// Converts a {top, bottom, left, right} box from line-local
|
2740 |
+
// coordinates into another coordinate system. Context may be one of
|
2741 |
+
// "line", "div" (display.lineDiv), "local"/null (editor), "window",
|
2742 |
+
// or "page".
|
2743 |
+
function intoCoordSystem(cm, lineObj, rect, context) {
|
2744 |
+
if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
|
2745 |
+
var size = widgetHeight(lineObj.widgets[i]);
|
2746 |
+
rect.top += size; rect.bottom += size;
|
2747 |
+
}
|
2748 |
+
if (context == "line") return rect;
|
2749 |
+
if (!context) context = "local";
|
2750 |
+
var yOff = heightAtLine(lineObj);
|
2751 |
+
if (context == "local") yOff += paddingTop(cm.display);
|
2752 |
+
else yOff -= cm.display.viewOffset;
|
2753 |
+
if (context == "page" || context == "window") {
|
2754 |
+
var lOff = cm.display.lineSpace.getBoundingClientRect();
|
2755 |
+
yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
|
2756 |
+
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
|
2757 |
+
rect.left += xOff; rect.right += xOff;
|
2758 |
+
}
|
2759 |
+
rect.top += yOff; rect.bottom += yOff;
|
2760 |
+
return rect;
|
2761 |
+
}
|
2762 |
+
|
2763 |
+
// Coverts a box from "div" coords to another coordinate system.
|
2764 |
+
// Context may be "window", "page", "div", or "local"/null.
|
2765 |
+
function fromCoordSystem(cm, coords, context) {
|
2766 |
+
if (context == "div") return coords;
|
2767 |
+
var left = coords.left, top = coords.top;
|
2768 |
+
// First move into "page" coordinate system
|
2769 |
+
if (context == "page") {
|
2770 |
+
left -= pageScrollX();
|
2771 |
+
top -= pageScrollY();
|
2772 |
+
} else if (context == "local" || !context) {
|
2773 |
+
var localBox = cm.display.sizer.getBoundingClientRect();
|
2774 |
+
left += localBox.left;
|
2775 |
+
top += localBox.top;
|
2776 |
+
}
|
2777 |
+
|
2778 |
+
var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
|
2779 |
+
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
|
2780 |
+
}
|
2781 |
+
|
2782 |
+
function charCoords(cm, pos, context, lineObj, bias) {
|
2783 |
+
if (!lineObj) lineObj = getLine(cm.doc, pos.line);
|
2784 |
+
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context);
|
2785 |
+
}
|
2786 |
+
|
2787 |
+
// Returns a box for a given cursor position, which may have an
|
2788 |
+
// 'other' property containing the position of the secondary cursor
|
2789 |
+
// on a bidi boundary.
|
2790 |
+
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
|
2791 |
+
lineObj = lineObj || getLine(cm.doc, pos.line);
|
2792 |
+
if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);
|
2793 |
+
function get(ch, right) {
|
2794 |
+
var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
|
2795 |
+
if (right) m.left = m.right; else m.right = m.left;
|
2796 |
+
return intoCoordSystem(cm, lineObj, m, context);
|
2797 |
+
}
|
2798 |
+
function getBidi(ch, partPos) {
|
2799 |
+
var part = order[partPos], right = part.level % 2;
|
2800 |
+
if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
|
2801 |
+
part = order[--partPos];
|
2802 |
+
ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
|
2803 |
+
right = true;
|
2804 |
+
} else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
|
2805 |
+
part = order[++partPos];
|
2806 |
+
ch = bidiLeft(part) - part.level % 2;
|
2807 |
+
right = false;
|
2808 |
+
}
|
2809 |
+
if (right && ch == part.to && ch > part.from) return get(ch - 1);
|
2810 |
+
return get(ch, right);
|
2811 |
+
}
|
2812 |
+
var order = getOrder(lineObj), ch = pos.ch;
|
2813 |
+
if (!order) return get(ch);
|
2814 |
+
var partPos = getBidiPartAt(order, ch);
|
2815 |
+
var val = getBidi(ch, partPos);
|
2816 |
+
if (bidiOther != null) val.other = getBidi(ch, bidiOther);
|
2817 |
+
return val;
|
2818 |
+
}
|
2819 |
+
|
2820 |
+
// Used to cheaply estimate the coordinates for a position. Used for
|
2821 |
+
// intermediate scroll updates.
|
2822 |
+
function estimateCoords(cm, pos) {
|
2823 |
+
var left = 0, pos = clipPos(cm.doc, pos);
|
2824 |
+
if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch;
|
2825 |
+
var lineObj = getLine(cm.doc, pos.line);
|
2826 |
+
var top = heightAtLine(lineObj) + paddingTop(cm.display);
|
2827 |
+
return {left: left, right: left, top: top, bottom: top + lineObj.height};
|
2828 |
+
}
|
2829 |
+
|
2830 |
+
// Positions returned by coordsChar contain some extra information.
|
2831 |
+
// xRel is the relative x position of the input coordinates compared
|
2832 |
+
// to the found position (so xRel > 0 means the coordinates are to
|
2833 |
+
// the right of the character position, for example). When outside
|
2834 |
+
// is true, that means the coordinates lie outside the line's
|
2835 |
+
// vertical range.
|
2836 |
+
function PosWithInfo(line, ch, outside, xRel) {
|
2837 |
+
var pos = Pos(line, ch);
|
2838 |
+
pos.xRel = xRel;
|
2839 |
+
if (outside) pos.outside = true;
|
2840 |
+
return pos;
|
2841 |
+
}
|
2842 |
+
|
2843 |
+
// Compute the character position closest to the given coordinates.
|
2844 |
+
// Input must be lineSpace-local ("div" coordinate system).
|
2845 |
+
function coordsChar(cm, x, y) {
|
2846 |
+
var doc = cm.doc;
|
2847 |
+
y += cm.display.viewOffset;
|
2848 |
+
if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
|
2849 |
+
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
2850 |
+
if (lineN > last)
|
2851 |
+
return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
|
2852 |
+
if (x < 0) x = 0;
|
2853 |
+
|
2854 |
+
var lineObj = getLine(doc, lineN);
|
2855 |
+
for (;;) {
|
2856 |
+
var found = coordsCharInner(cm, lineObj, lineN, x, y);
|
2857 |
+
var merged = collapsedSpanAtEnd(lineObj);
|
2858 |
+
var mergedPos = merged && merged.find(0, true);
|
2859 |
+
if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
|
2860 |
+
lineN = lineNo(lineObj = mergedPos.to.line);
|
2861 |
+
else
|
2862 |
+
return found;
|
2863 |
+
}
|
2864 |
+
}
|
2865 |
+
|
2866 |
+
function coordsCharInner(cm, lineObj, lineNo, x, y) {
|
2867 |
+
var innerOff = y - heightAtLine(lineObj);
|
2868 |
+
var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
|
2869 |
+
var preparedMeasure = prepareMeasureForLine(cm, lineObj);
|
2870 |
+
|
2871 |
+
function getX(ch) {
|
2872 |
+
var sp = cursorCoords(cm, Pos(lineNo, ch), "line", lineObj, preparedMeasure);
|
2873 |
+
wrongLine = true;
|
2874 |
+
if (innerOff > sp.bottom) return sp.left - adjust;
|
2875 |
+
else if (innerOff < sp.top) return sp.left + adjust;
|
2876 |
+
else wrongLine = false;
|
2877 |
+
return sp.left;
|
2878 |
+
}
|
2879 |
+
|
2880 |
+
var bidi = getOrder(lineObj), dist = lineObj.text.length;
|
2881 |
+
var from = lineLeft(lineObj), to = lineRight(lineObj);
|
2882 |
+
var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
|
2883 |
+
|
2884 |
+
if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);
|
2885 |
+
// Do a binary search between these bounds.
|
2886 |
+
for (;;) {
|
2887 |
+
if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
|
2888 |
+
var ch = x < fromX || x - fromX <= toX - x ? from : to;
|
2889 |
+
var xDiff = x - (ch == from ? fromX : toX);
|
2890 |
+
while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;
|
2891 |
+
var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
|
2892 |
+
xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);
|
2893 |
+
return pos;
|
2894 |
+
}
|
2895 |
+
var step = Math.ceil(dist / 2), middle = from + step;
|
2896 |
+
if (bidi) {
|
2897 |
+
middle = from;
|
2898 |
+
for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
|
2899 |
+
}
|
2900 |
+
var middleX = getX(middle);
|
2901 |
+
if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}
|
2902 |
+
else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}
|
2903 |
+
}
|
2904 |
+
}
|
2905 |
+
|
2906 |
+
var measureText;
|
2907 |
+
// Compute the default text height.
|
2908 |
+
function textHeight(display) {
|
2909 |
+
if (display.cachedTextHeight != null) return display.cachedTextHeight;
|
2910 |
+
if (measureText == null) {
|
2911 |
+
measureText = elt("pre");
|
2912 |
+
// Measure a bunch of lines, for browsers that compute
|
2913 |
+
// fractional heights.
|
2914 |
+
for (var i = 0; i < 49; ++i) {
|
2915 |
+
measureText.appendChild(document.createTextNode("x"));
|
2916 |
+
measureText.appendChild(elt("br"));
|
2917 |
+
}
|
2918 |
+
measureText.appendChild(document.createTextNode("x"));
|
2919 |
+
}
|
2920 |
+
removeChildrenAndAdd(display.measure, measureText);
|
2921 |
+
var height = measureText.offsetHeight / 50;
|
2922 |
+
if (height > 3) display.cachedTextHeight = height;
|
2923 |
+
removeChildren(display.measure);
|
2924 |
+
return height || 1;
|
2925 |
+
}
|
2926 |
+
|
2927 |
+
// Compute the default character width.
|
2928 |
+
function charWidth(display) {
|
2929 |
+
if (display.cachedCharWidth != null) return display.cachedCharWidth;
|
2930 |
+
var anchor = elt("span", "xxxxxxxxxx");
|
2931 |
+
var pre = elt("pre", [anchor]);
|
2932 |
+
removeChildrenAndAdd(display.measure, pre);
|
2933 |
+
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
|
2934 |
+
if (width > 2) display.cachedCharWidth = width;
|
2935 |
+
return width || 10;
|
2936 |
+
}
|
2937 |
+
|
2938 |
+
// OPERATIONS
|
2939 |
+
|
2940 |
+
// Operations are used to wrap a series of changes to the editor
|
2941 |
+
// state in such a way that each change won't have to update the
|
2942 |
+
// cursor and display (which would be awkward, slow, and
|
2943 |
+
// error-prone). Instead, display updates are batched and then all
|
2944 |
+
// combined and executed at once.
|
2945 |
+
|
2946 |
+
var operationGroup = null;
|
2947 |
+
|
2948 |
+
var nextOpId = 0;
|
2949 |
+
// Start a new operation.
|
2950 |
+
function startOperation(cm) {
|
2951 |
+
cm.curOp = {
|
2952 |
+
cm: cm,
|
2953 |
+
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
2954 |
+
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
2955 |
+
forceUpdate: false, // Used to force a redraw
|
2956 |
+
updateInput: null, // Whether to reset the input textarea
|
2957 |
+
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
2958 |
+
changeObjs: null, // Accumulated changes, for firing change events
|
2959 |
+
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
2960 |
+
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
2961 |
+
selectionChanged: false, // Whether the selection needs to be redrawn
|
2962 |
+
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
2963 |
+
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
2964 |
+
scrollToPos: null, // Used to scroll to a specific position
|
2965 |
+
focus: false,
|
2966 |
+
id: ++nextOpId // Unique ID
|
2967 |
+
};
|
2968 |
+
if (operationGroup) {
|
2969 |
+
operationGroup.ops.push(cm.curOp);
|
2970 |
+
} else {
|
2971 |
+
cm.curOp.ownsGroup = operationGroup = {
|
2972 |
+
ops: [cm.curOp],
|
2973 |
+
delayedCallbacks: []
|
2974 |
+
};
|
2975 |
+
}
|
2976 |
+
}
|
2977 |
+
|
2978 |
+
function fireCallbacksForOps(group) {
|
2979 |
+
// Calls delayed callbacks and cursorActivity handlers until no
|
2980 |
+
// new ones appear
|
2981 |
+
var callbacks = group.delayedCallbacks, i = 0;
|
2982 |
+
do {
|
2983 |
+
for (; i < callbacks.length; i++)
|
2984 |
+
callbacks[i].call(null);
|
2985 |
+
for (var j = 0; j < group.ops.length; j++) {
|
2986 |
+
var op = group.ops[j];
|
2987 |
+
if (op.cursorActivityHandlers)
|
2988 |
+
while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
|
2989 |
+
op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);
|
2990 |
+
}
|
2991 |
+
} while (i < callbacks.length);
|
2992 |
+
}
|
2993 |
+
|
2994 |
+
// Finish an operation, updating the display and signalling delayed events
|
2995 |
+
function endOperation(cm) {
|
2996 |
+
var op = cm.curOp, group = op.ownsGroup;
|
2997 |
+
if (!group) return;
|
2998 |
+
|
2999 |
+
try { fireCallbacksForOps(group); }
|
3000 |
+
finally {
|
3001 |
+
operationGroup = null;
|
3002 |
+
for (var i = 0; i < group.ops.length; i++)
|
3003 |
+
group.ops[i].cm.curOp = null;
|
3004 |
+
endOperations(group);
|
3005 |
+
}
|
3006 |
+
}
|
3007 |
+
|
3008 |
+
// The DOM updates done when an operation finishes are batched so
|
3009 |
+
// that the minimum number of relayouts are required.
|
3010 |
+
function endOperations(group) {
|
3011 |
+
var ops = group.ops;
|
3012 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3013 |
+
endOperation_R1(ops[i]);
|
3014 |
+
for (var i = 0; i < ops.length; i++) // Write DOM (maybe)
|
3015 |
+
endOperation_W1(ops[i]);
|
3016 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3017 |
+
endOperation_R2(ops[i]);
|
3018 |
+
for (var i = 0; i < ops.length; i++) // Write DOM (maybe)
|
3019 |
+
endOperation_W2(ops[i]);
|
3020 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3021 |
+
endOperation_finish(ops[i]);
|
3022 |
+
}
|
3023 |
+
|
3024 |
+
function endOperation_R1(op) {
|
3025 |
+
var cm = op.cm, display = cm.display;
|
3026 |
+
maybeClipScrollbars(cm);
|
3027 |
+
if (op.updateMaxLine) findMaxLine(cm);
|
3028 |
+
|
3029 |
+
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
3030 |
+
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
3031 |
+
op.scrollToPos.to.line >= display.viewTo) ||
|
3032 |
+
display.maxLineChanged && cm.options.lineWrapping;
|
3033 |
+
op.update = op.mustUpdate &&
|
3034 |
+
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
function endOperation_W1(op) {
|
3038 |
+
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
function endOperation_R2(op) {
|
3042 |
+
var cm = op.cm, display = cm.display;
|
3043 |
+
if (op.updatedDisplay) updateHeightsInViewport(cm);
|
3044 |
+
|
3045 |
+
op.barMeasure = measureForScrollbars(cm);
|
3046 |
+
|
3047 |
+
// If the max line changed since it was last measured, measure it,
|
3048 |
+
// and ensure the document's width matches it.
|
3049 |
+
// updateDisplay_W2 will use these properties to do the actual resizing
|
3050 |
+
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
3051 |
+
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
|
3052 |
+
cm.display.sizerWidth = op.adjustWidthTo;
|
3053 |
+
op.barMeasure.scrollWidth =
|
3054 |
+
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
|
3055 |
+
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
|
3056 |
+
}
|
3057 |
+
|
3058 |
+
if (op.updatedDisplay || op.selectionChanged)
|
3059 |
+
op.preparedSelection = display.input.prepareSelection();
|
3060 |
+
}
|
3061 |
+
|
3062 |
+
function endOperation_W2(op) {
|
3063 |
+
var cm = op.cm;
|
3064 |
+
|
3065 |
+
if (op.adjustWidthTo != null) {
|
3066 |
+
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
|
3067 |
+
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
3068 |
+
setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);
|
3069 |
+
cm.display.maxLineChanged = false;
|
3070 |
+
}
|
3071 |
+
|
3072 |
+
if (op.preparedSelection)
|
3073 |
+
cm.display.input.showSelection(op.preparedSelection);
|
3074 |
+
if (op.updatedDisplay)
|
3075 |
+
setDocumentHeight(cm, op.barMeasure);
|
3076 |
+
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
3077 |
+
updateScrollbars(cm, op.barMeasure);
|
3078 |
+
|
3079 |
+
if (op.selectionChanged) restartBlink(cm);
|
3080 |
+
|
3081 |
+
if (cm.state.focused && op.updateInput)
|
3082 |
+
cm.display.input.reset(op.typing);
|
3083 |
+
if (op.focus && op.focus == activeElt()) ensureFocus(op.cm);
|
3084 |
+
}
|
3085 |
+
|
3086 |
+
function endOperation_finish(op) {
|
3087 |
+
var cm = op.cm, display = cm.display, doc = cm.doc;
|
3088 |
+
|
3089 |
+
if (op.updatedDisplay) postUpdateDisplay(cm, op.update);
|
3090 |
+
|
3091 |
+
// Abort mouse wheel delta measurement, when scrolling explicitly
|
3092 |
+
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
3093 |
+
display.wheelStartX = display.wheelStartY = null;
|
3094 |
+
|
3095 |
+
// Propagate the scroll position to the actual DOM scroller
|
3096 |
+
if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
|
3097 |
+
doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
|
3098 |
+
display.scrollbars.setScrollTop(doc.scrollTop);
|
3099 |
+
display.scroller.scrollTop = doc.scrollTop;
|
3100 |
+
}
|
3101 |
+
if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
|
3102 |
+
doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft));
|
3103 |
+
display.scrollbars.setScrollLeft(doc.scrollLeft);
|
3104 |
+
display.scroller.scrollLeft = doc.scrollLeft;
|
3105 |
+
alignHorizontally(cm);
|
3106 |
+
}
|
3107 |
+
// If we need to scroll a specific position into view, do so.
|
3108 |
+
if (op.scrollToPos) {
|
3109 |
+
var coords = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
3110 |
+
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
|
3111 |
+
if (op.scrollToPos.isCursor && cm.state.focused) maybeScrollWindow(cm, coords);
|
3112 |
+
}
|
3113 |
+
|
3114 |
+
// Fire events for markers that are hidden/unidden by editing or
|
3115 |
+
// undoing
|
3116 |
+
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
|
3117 |
+
if (hidden) for (var i = 0; i < hidden.length; ++i)
|
3118 |
+
if (!hidden[i].lines.length) signal(hidden[i], "hide");
|
3119 |
+
if (unhidden) for (var i = 0; i < unhidden.length; ++i)
|
3120 |
+
if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
|
3121 |
+
|
3122 |
+
if (display.wrapper.offsetHeight)
|
3123 |
+
doc.scrollTop = cm.display.scroller.scrollTop;
|
3124 |
+
|
3125 |
+
// Fire change events, and delayed event handlers
|
3126 |
+
if (op.changeObjs)
|
3127 |
+
signal(cm, "changes", cm, op.changeObjs);
|
3128 |
+
if (op.update)
|
3129 |
+
op.update.finish();
|
3130 |
+
}
|
3131 |
+
|
3132 |
+
// Run the given function in an operation
|
3133 |
+
function runInOp(cm, f) {
|
3134 |
+
if (cm.curOp) return f();
|
3135 |
+
startOperation(cm);
|
3136 |
+
try { return f(); }
|
3137 |
+
finally { endOperation(cm); }
|
3138 |
+
}
|
3139 |
+
// Wraps a function in an operation. Returns the wrapped function.
|
3140 |
+
function operation(cm, f) {
|
3141 |
+
return function() {
|
3142 |
+
if (cm.curOp) return f.apply(cm, arguments);
|
3143 |
+
startOperation(cm);
|
3144 |
+
try { return f.apply(cm, arguments); }
|
3145 |
+
finally { endOperation(cm); }
|
3146 |
+
};
|
3147 |
+
}
|
3148 |
+
// Used to add methods to editor and doc instances, wrapping them in
|
3149 |
+
// operations.
|
3150 |
+
function methodOp(f) {
|
3151 |
+
return function() {
|
3152 |
+
if (this.curOp) return f.apply(this, arguments);
|
3153 |
+
startOperation(this);
|
3154 |
+
try { return f.apply(this, arguments); }
|
3155 |
+
finally { endOperation(this); }
|
3156 |
+
};
|
3157 |
+
}
|
3158 |
+
function docMethodOp(f) {
|
3159 |
+
return function() {
|
3160 |
+
var cm = this.cm;
|
3161 |
+
if (!cm || cm.curOp) return f.apply(this, arguments);
|
3162 |
+
startOperation(cm);
|
3163 |
+
try { return f.apply(this, arguments); }
|
3164 |
+
finally { endOperation(cm); }
|
3165 |
+
};
|
3166 |
+
}
|
3167 |
+
|
3168 |
+
// VIEW TRACKING
|
3169 |
+
|
3170 |
+
// These objects are used to represent the visible (currently drawn)
|
3171 |
+
// part of the document. A LineView may correspond to multiple
|
3172 |
+
// logical lines, if those are connected by collapsed ranges.
|
3173 |
+
function LineView(doc, line, lineN) {
|
3174 |
+
// The starting line
|
3175 |
+
this.line = line;
|
3176 |
+
// Continuing lines, if any
|
3177 |
+
this.rest = visualLineContinued(line);
|
3178 |
+
// Number of logical lines in this visual line
|
3179 |
+
this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
|
3180 |
+
this.node = this.text = null;
|
3181 |
+
this.hidden = lineIsHidden(doc, line);
|
3182 |
+
}
|
3183 |
+
|
3184 |
+
// Create a range of LineView objects for the given lines.
|
3185 |
+
function buildViewArray(cm, from, to) {
|
3186 |
+
var array = [], nextPos;
|
3187 |
+
for (var pos = from; pos < to; pos = nextPos) {
|
3188 |
+
var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
|
3189 |
+
nextPos = pos + view.size;
|
3190 |
+
array.push(view);
|
3191 |
+
}
|
3192 |
+
return array;
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
// Updates the display.view data structure for a given change to the
|
3196 |
+
// document. From and to are in pre-change coordinates. Lendiff is
|
3197 |
+
// the amount of lines added or subtracted by the change. This is
|
3198 |
+
// used for changes that span multiple lines, or change the way
|
3199 |
+
// lines are divided into visual lines. regLineChange (below)
|
3200 |
+
// registers single-line changes.
|
3201 |
+
function regChange(cm, from, to, lendiff) {
|
3202 |
+
if (from == null) from = cm.doc.first;
|
3203 |
+
if (to == null) to = cm.doc.first + cm.doc.size;
|
3204 |
+
if (!lendiff) lendiff = 0;
|
3205 |
+
|
3206 |
+
var display = cm.display;
|
3207 |
+
if (lendiff && to < display.viewTo &&
|
3208 |
+
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
3209 |
+
display.updateLineNumbers = from;
|
3210 |
+
|
3211 |
+
cm.curOp.viewChanged = true;
|
3212 |
+
|
3213 |
+
if (from >= display.viewTo) { // Change after
|
3214 |
+
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
3215 |
+
resetView(cm);
|
3216 |
+
} else if (to <= display.viewFrom) { // Change before
|
3217 |
+
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
3218 |
+
resetView(cm);
|
3219 |
+
} else {
|
3220 |
+
display.viewFrom += lendiff;
|
3221 |
+
display.viewTo += lendiff;
|
3222 |
+
}
|
3223 |
+
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
3224 |
+
resetView(cm);
|
3225 |
+
} else if (from <= display.viewFrom) { // Top overlap
|
3226 |
+
var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3227 |
+
if (cut) {
|
3228 |
+
display.view = display.view.slice(cut.index);
|
3229 |
+
display.viewFrom = cut.lineN;
|
3230 |
+
display.viewTo += lendiff;
|
3231 |
+
} else {
|
3232 |
+
resetView(cm);
|
3233 |
+
}
|
3234 |
+
} else if (to >= display.viewTo) { // Bottom overlap
|
3235 |
+
var cut = viewCuttingPoint(cm, from, from, -1);
|
3236 |
+
if (cut) {
|
3237 |
+
display.view = display.view.slice(0, cut.index);
|
3238 |
+
display.viewTo = cut.lineN;
|
3239 |
+
} else {
|
3240 |
+
resetView(cm);
|
3241 |
+
}
|
3242 |
+
} else { // Gap in the middle
|
3243 |
+
var cutTop = viewCuttingPoint(cm, from, from, -1);
|
3244 |
+
var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3245 |
+
if (cutTop && cutBot) {
|
3246 |
+
display.view = display.view.slice(0, cutTop.index)
|
3247 |
+
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
3248 |
+
.concat(display.view.slice(cutBot.index));
|
3249 |
+
display.viewTo += lendiff;
|
3250 |
+
} else {
|
3251 |
+
resetView(cm);
|
3252 |
+
}
|
3253 |
+
}
|
3254 |
+
|
3255 |
+
var ext = display.externalMeasured;
|
3256 |
+
if (ext) {
|
3257 |
+
if (to < ext.lineN)
|
3258 |
+
ext.lineN += lendiff;
|
3259 |
+
else if (from < ext.lineN + ext.size)
|
3260 |
+
display.externalMeasured = null;
|
3261 |
+
}
|
3262 |
+
}
|
3263 |
+
|
3264 |
+
// Register a change to a single line. Type must be one of "text",
|
3265 |
+
// "gutter", "class", "widget"
|
3266 |
+
function regLineChange(cm, line, type) {
|
3267 |
+
cm.curOp.viewChanged = true;
|
3268 |
+
var display = cm.display, ext = cm.display.externalMeasured;
|
3269 |
+
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
3270 |
+
display.externalMeasured = null;
|
3271 |
+
|
3272 |
+
if (line < display.viewFrom || line >= display.viewTo) return;
|
3273 |
+
var lineView = display.view[findViewIndex(cm, line)];
|
3274 |
+
if (lineView.node == null) return;
|
3275 |
+
var arr = lineView.changes || (lineView.changes = []);
|
3276 |
+
if (indexOf(arr, type) == -1) arr.push(type);
|
3277 |
+
}
|
3278 |
+
|
3279 |
+
// Clear the view.
|
3280 |
+
function resetView(cm) {
|
3281 |
+
cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
|
3282 |
+
cm.display.view = [];
|
3283 |
+
cm.display.viewOffset = 0;
|
3284 |
+
}
|
3285 |
+
|
3286 |
+
// Find the view element corresponding to a given line. Return null
|
3287 |
+
// when the line isn't visible.
|
3288 |
+
function findViewIndex(cm, n) {
|
3289 |
+
if (n >= cm.display.viewTo) return null;
|
3290 |
+
n -= cm.display.viewFrom;
|
3291 |
+
if (n < 0) return null;
|
3292 |
+
var view = cm.display.view;
|
3293 |
+
for (var i = 0; i < view.length; i++) {
|
3294 |
+
n -= view[i].size;
|
3295 |
+
if (n < 0) return i;
|
3296 |
+
}
|
3297 |
+
}
|
3298 |
+
|
3299 |
+
function viewCuttingPoint(cm, oldN, newN, dir) {
|
3300 |
+
var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
|
3301 |
+
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
3302 |
+
return {index: index, lineN: newN};
|
3303 |
+
for (var i = 0, n = cm.display.viewFrom; i < index; i++)
|
3304 |
+
n += view[i].size;
|
3305 |
+
if (n != oldN) {
|
3306 |
+
if (dir > 0) {
|
3307 |
+
if (index == view.length - 1) return null;
|
3308 |
+
diff = (n + view[index].size) - oldN;
|
3309 |
+
index++;
|
3310 |
+
} else {
|
3311 |
+
diff = n - oldN;
|
3312 |
+
}
|
3313 |
+
oldN += diff; newN += diff;
|
3314 |
+
}
|
3315 |
+
while (visualLineNo(cm.doc, newN) != newN) {
|
3316 |
+
if (index == (dir < 0 ? 0 : view.length - 1)) return null;
|
3317 |
+
newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
|
3318 |
+
index += dir;
|
3319 |
+
}
|
3320 |
+
return {index: index, lineN: newN};
|
3321 |
+
}
|
3322 |
+
|
3323 |
+
// Force the view to cover a given range, adding empty view element
|
3324 |
+
// or clipping off existing ones as needed.
|
3325 |
+
function adjustView(cm, from, to) {
|
3326 |
+
var display = cm.display, view = display.view;
|
3327 |
+
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
3328 |
+
display.view = buildViewArray(cm, from, to);
|
3329 |
+
display.viewFrom = from;
|
3330 |
+
} else {
|
3331 |
+
if (display.viewFrom > from)
|
3332 |
+
display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);
|
3333 |
+
else if (display.viewFrom < from)
|
3334 |
+
display.view = display.view.slice(findViewIndex(cm, from));
|
3335 |
+
display.viewFrom = from;
|
3336 |
+
if (display.viewTo < to)
|
3337 |
+
display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));
|
3338 |
+
else if (display.viewTo > to)
|
3339 |
+
display.view = display.view.slice(0, findViewIndex(cm, to));
|
3340 |
+
}
|
3341 |
+
display.viewTo = to;
|
3342 |
+
}
|
3343 |
+
|
3344 |
+
// Count the number of lines in the view whose DOM representation is
|
3345 |
+
// out of date (or nonexistent).
|
3346 |
+
function countDirtyView(cm) {
|
3347 |
+
var view = cm.display.view, dirty = 0;
|
3348 |
+
for (var i = 0; i < view.length; i++) {
|
3349 |
+
var lineView = view[i];
|
3350 |
+
if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty;
|
3351 |
+
}
|
3352 |
+
return dirty;
|
3353 |
+
}
|
3354 |
+
|
3355 |
+
// EVENT HANDLERS
|
3356 |
+
|
3357 |
+
// Attach the necessary event handlers when initializing the editor
|
3358 |
+
function registerEventHandlers(cm) {
|
3359 |
+
var d = cm.display;
|
3360 |
+
on(d.scroller, "mousedown", operation(cm, onMouseDown));
|
3361 |
+
// Older IE's will not fire a second mousedown for a double click
|
3362 |
+
if (ie && ie_version < 11)
|
3363 |
+
on(d.scroller, "dblclick", operation(cm, function(e) {
|
3364 |
+
if (signalDOMEvent(cm, e)) return;
|
3365 |
+
var pos = posFromMouse(cm, e);
|
3366 |
+
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
|
3367 |
+
e_preventDefault(e);
|
3368 |
+
var word = cm.findWordAt(pos);
|
3369 |
+
extendSelection(cm.doc, word.anchor, word.head);
|
3370 |
+
}));
|
3371 |
+
else
|
3372 |
+
on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
|
3373 |
+
// Some browsers fire contextmenu *after* opening the menu, at
|
3374 |
+
// which point we can't mess with it anymore. Context menu is
|
3375 |
+
// handled in onMouseDown for these browsers.
|
3376 |
+
if (!captureRightClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
|
3377 |
+
|
3378 |
+
// Used to suppress mouse event handling when a touch happens
|
3379 |
+
var touchFinished, prevTouch = {end: 0};
|
3380 |
+
function finishTouch() {
|
3381 |
+
if (d.activeTouch) {
|
3382 |
+
touchFinished = setTimeout(function() {d.activeTouch = null;}, 1000);
|
3383 |
+
prevTouch = d.activeTouch;
|
3384 |
+
prevTouch.end = +new Date;
|
3385 |
+
}
|
3386 |
+
};
|
3387 |
+
function isMouseLikeTouchEvent(e) {
|
3388 |
+
if (e.touches.length != 1) return false;
|
3389 |
+
var touch = e.touches[0];
|
3390 |
+
return touch.radiusX <= 1 && touch.radiusY <= 1;
|
3391 |
+
}
|
3392 |
+
function farAway(touch, other) {
|
3393 |
+
if (other.left == null) return true;
|
3394 |
+
var dx = other.left - touch.left, dy = other.top - touch.top;
|
3395 |
+
return dx * dx + dy * dy > 20 * 20;
|
3396 |
+
}
|
3397 |
+
on(d.scroller, "touchstart", function(e) {
|
3398 |
+
if (!isMouseLikeTouchEvent(e)) {
|
3399 |
+
clearTimeout(touchFinished);
|
3400 |
+
var now = +new Date;
|
3401 |
+
d.activeTouch = {start: now, moved: false,
|
3402 |
+
prev: now - prevTouch.end <= 300 ? prevTouch : null};
|
3403 |
+
if (e.touches.length == 1) {
|
3404 |
+
d.activeTouch.left = e.touches[0].pageX;
|
3405 |
+
d.activeTouch.top = e.touches[0].pageY;
|
3406 |
+
}
|
3407 |
+
}
|
3408 |
+
});
|
3409 |
+
on(d.scroller, "touchmove", function() {
|
3410 |
+
if (d.activeTouch) d.activeTouch.moved = true;
|
3411 |
+
});
|
3412 |
+
on(d.scroller, "touchend", function(e) {
|
3413 |
+
var touch = d.activeTouch;
|
3414 |
+
if (touch && !eventInWidget(d, e) && touch.left != null &&
|
3415 |
+
!touch.moved && new Date - touch.start < 300) {
|
3416 |
+
var pos = cm.coordsChar(d.activeTouch, "page"), range;
|
3417 |
+
if (!touch.prev || farAway(touch, touch.prev)) // Single tap
|
3418 |
+
range = new Range(pos, pos);
|
3419 |
+
else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
|
3420 |
+
range = cm.findWordAt(pos);
|
3421 |
+
else // Triple tap
|
3422 |
+
range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));
|
3423 |
+
cm.setSelection(range.anchor, range.head);
|
3424 |
+
cm.focus();
|
3425 |
+
e_preventDefault(e);
|
3426 |
+
}
|
3427 |
+
finishTouch();
|
3428 |
+
});
|
3429 |
+
on(d.scroller, "touchcancel", finishTouch);
|
3430 |
+
|
3431 |
+
// Sync scrolling between fake scrollbars and real scrollable
|
3432 |
+
// area, ensure viewport is updated when scrolling.
|
3433 |
+
on(d.scroller, "scroll", function() {
|
3434 |
+
if (d.scroller.clientHeight) {
|
3435 |
+
setScrollTop(cm, d.scroller.scrollTop);
|
3436 |
+
setScrollLeft(cm, d.scroller.scrollLeft, true);
|
3437 |
+
signal(cm, "scroll", cm);
|
3438 |
+
}
|
3439 |
+
});
|
3440 |
+
|
3441 |
+
// Listen to wheel events in order to try and update the viewport on time.
|
3442 |
+
on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
|
3443 |
+
on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
|
3444 |
+
|
3445 |
+
// Prevent wrapper from ever scrolling
|
3446 |
+
on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
|
3447 |
+
|
3448 |
+
d.dragFunctions = {
|
3449 |
+
enter: function(e) {if (!signalDOMEvent(cm, e)) e_stop(e);},
|
3450 |
+
over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
|
3451 |
+
start: function(e){onDragStart(cm, e);},
|
3452 |
+
drop: operation(cm, onDrop),
|
3453 |
+
leave: function() {clearDragCursor(cm);}
|
3454 |
+
};
|
3455 |
+
|
3456 |
+
var inp = d.input.getField();
|
3457 |
+
on(inp, "keyup", function(e) { onKeyUp.call(cm, e); });
|
3458 |
+
on(inp, "keydown", operation(cm, onKeyDown));
|
3459 |
+
on(inp, "keypress", operation(cm, onKeyPress));
|
3460 |
+
on(inp, "focus", bind(onFocus, cm));
|
3461 |
+
on(inp, "blur", bind(onBlur, cm));
|
3462 |
+
}
|
3463 |
+
|
3464 |
+
function dragDropChanged(cm, value, old) {
|
3465 |
+
var wasOn = old && old != CodeMirror.Init;
|
3466 |
+
if (!value != !wasOn) {
|
3467 |
+
var funcs = cm.display.dragFunctions;
|
3468 |
+
var toggle = value ? on : off;
|
3469 |
+
toggle(cm.display.scroller, "dragstart", funcs.start);
|
3470 |
+
toggle(cm.display.scroller, "dragenter", funcs.enter);
|
3471 |
+
toggle(cm.display.scroller, "dragover", funcs.over);
|
3472 |
+
toggle(cm.display.scroller, "dragleave", funcs.leave);
|
3473 |
+
toggle(cm.display.scroller, "drop", funcs.drop);
|
3474 |
+
}
|
3475 |
+
}
|
3476 |
+
|
3477 |
+
// Called when the window resizes
|
3478 |
+
function onResize(cm) {
|
3479 |
+
var d = cm.display;
|
3480 |
+
if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)
|
3481 |
+
return;
|
3482 |
+
// Might be a text scaling operation, clear size caches.
|
3483 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
3484 |
+
d.scrollbarsClipped = false;
|
3485 |
+
cm.setSize();
|
3486 |
+
}
|
3487 |
+
|
3488 |
+
// MOUSE EVENTS
|
3489 |
+
|
3490 |
+
// Return true when the given mouse event happened in a widget
|
3491 |
+
function eventInWidget(display, e) {
|
3492 |
+
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
3493 |
+
if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
|
3494 |
+
(n.parentNode == display.sizer && n != display.mover))
|
3495 |
+
return true;
|
3496 |
+
}
|
3497 |
+
}
|
3498 |
+
|
3499 |
+
// Given a mouse event, find the corresponding position. If liberal
|
3500 |
+
// is false, it checks whether a gutter or scrollbar was clicked,
|
3501 |
+
// and returns null if it was. forRect is used by rectangular
|
3502 |
+
// selections, and tries to estimate a character position even for
|
3503 |
+
// coordinates beyond the right of the text.
|
3504 |
+
function posFromMouse(cm, e, liberal, forRect) {
|
3505 |
+
var display = cm.display;
|
3506 |
+
if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") return null;
|
3507 |
+
|
3508 |
+
var x, y, space = display.lineSpace.getBoundingClientRect();
|
3509 |
+
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
3510 |
+
try { x = e.clientX - space.left; y = e.clientY - space.top; }
|
3511 |
+
catch (e) { return null; }
|
3512 |
+
var coords = coordsChar(cm, x, y), line;
|
3513 |
+
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
|
3514 |
+
var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
|
3515 |
+
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
|
3516 |
+
}
|
3517 |
+
return coords;
|
3518 |
+
}
|
3519 |
+
|
3520 |
+
// A mouse down can be a single click, double click, triple click,
|
3521 |
+
// start of selection drag, start of text drag, new cursor
|
3522 |
+
// (ctrl-click), rectangle drag (alt-drag), or xwin
|
3523 |
+
// middle-click-paste. Or it might be a click on something we should
|
3524 |
+
// not interfere with, such as a scrollbar or widget.
|
3525 |
+
function onMouseDown(e) {
|
3526 |
+
var cm = this, display = cm.display;
|
3527 |
+
if (display.activeTouch && display.input.supportsTouch() || signalDOMEvent(cm, e)) return;
|
3528 |
+
display.shift = e.shiftKey;
|
3529 |
+
|
3530 |
+
if (eventInWidget(display, e)) {
|
3531 |
+
if (!webkit) {
|
3532 |
+
// Briefly turn off draggability, to allow widgets to do
|
3533 |
+
// normal dragging things.
|
3534 |
+
display.scroller.draggable = false;
|
3535 |
+
setTimeout(function(){display.scroller.draggable = true;}, 100);
|
3536 |
+
}
|
3537 |
+
return;
|
3538 |
+
}
|
3539 |
+
if (clickInGutter(cm, e)) return;
|
3540 |
+
var start = posFromMouse(cm, e);
|
3541 |
+
window.focus();
|
3542 |
+
|
3543 |
+
switch (e_button(e)) {
|
3544 |
+
case 1:
|
3545 |
+
// #3261: make sure, that we're not starting a second selection
|
3546 |
+
if (cm.state.selectingText)
|
3547 |
+
cm.state.selectingText(e);
|
3548 |
+
else if (start)
|
3549 |
+
leftButtonDown(cm, e, start);
|
3550 |
+
else if (e_target(e) == display.scroller)
|
3551 |
+
e_preventDefault(e);
|
3552 |
+
break;
|
3553 |
+
case 2:
|
3554 |
+
if (webkit) cm.state.lastMiddleDown = +new Date;
|
3555 |
+
if (start) extendSelection(cm.doc, start);
|
3556 |
+
setTimeout(function() {display.input.focus();}, 20);
|
3557 |
+
e_preventDefault(e);
|
3558 |
+
break;
|
3559 |
+
case 3:
|
3560 |
+
if (captureRightClick) onContextMenu(cm, e);
|
3561 |
+
else delayBlurEvent(cm);
|
3562 |
+
break;
|
3563 |
+
}
|
3564 |
+
}
|
3565 |
+
|
3566 |
+
var lastClick, lastDoubleClick;
|
3567 |
+
function leftButtonDown(cm, e, start) {
|
3568 |
+
if (ie) setTimeout(bind(ensureFocus, cm), 0);
|
3569 |
+
else cm.curOp.focus = activeElt();
|
3570 |
+
|
3571 |
+
var now = +new Date, type;
|
3572 |
+
if (lastDoubleClick && lastDoubleClick.time > now - 400 && cmp(lastDoubleClick.pos, start) == 0) {
|
3573 |
+
type = "triple";
|
3574 |
+
} else if (lastClick && lastClick.time > now - 400 && cmp(lastClick.pos, start) == 0) {
|
3575 |
+
type = "double";
|
3576 |
+
lastDoubleClick = {time: now, pos: start};
|
3577 |
+
} else {
|
3578 |
+
type = "single";
|
3579 |
+
lastClick = {time: now, pos: start};
|
3580 |
+
}
|
3581 |
+
|
3582 |
+
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
|
3583 |
+
if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
|
3584 |
+
type == "single" && (contained = sel.contains(start)) > -1 &&
|
3585 |
+
(cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
|
3586 |
+
(cmp(contained.to(), start) > 0 || start.xRel < 0))
|
3587 |
+
leftButtonStartDrag(cm, e, start, modifier);
|
3588 |
+
else
|
3589 |
+
leftButtonSelect(cm, e, start, type, modifier);
|
3590 |
+
}
|
3591 |
+
|
3592 |
+
// Start a text drag. When it ends, see if any dragging actually
|
3593 |
+
// happen, and treat as a click if it didn't.
|
3594 |
+
function leftButtonStartDrag(cm, e, start, modifier) {
|
3595 |
+
var display = cm.display, startTime = +new Date;
|
3596 |
+
var dragEnd = operation(cm, function(e2) {
|
3597 |
+
if (webkit) display.scroller.draggable = false;
|
3598 |
+
cm.state.draggingText = false;
|
3599 |
+
off(document, "mouseup", dragEnd);
|
3600 |
+
off(display.scroller, "drop", dragEnd);
|
3601 |
+
if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
|
3602 |
+
e_preventDefault(e2);
|
3603 |
+
if (!modifier && +new Date - 200 < startTime)
|
3604 |
+
extendSelection(cm.doc, start);
|
3605 |
+
// Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
|
3606 |
+
if (webkit || ie && ie_version == 9)
|
3607 |
+
setTimeout(function() {document.body.focus(); display.input.focus();}, 20);
|
3608 |
+
else
|
3609 |
+
display.input.focus();
|
3610 |
+
}
|
3611 |
+
});
|
3612 |
+
// Let the drag handler handle this.
|
3613 |
+
if (webkit) display.scroller.draggable = true;
|
3614 |
+
cm.state.draggingText = dragEnd;
|
3615 |
+
// IE's approach to draggable
|
3616 |
+
if (display.scroller.dragDrop) display.scroller.dragDrop();
|
3617 |
+
on(document, "mouseup", dragEnd);
|
3618 |
+
on(display.scroller, "drop", dragEnd);
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
// Normal selection, as opposed to text dragging.
|
3622 |
+
function leftButtonSelect(cm, e, start, type, addNew) {
|
3623 |
+
var display = cm.display, doc = cm.doc;
|
3624 |
+
e_preventDefault(e);
|
3625 |
+
|
3626 |
+
var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
|
3627 |
+
if (addNew && !e.shiftKey) {
|
3628 |
+
ourIndex = doc.sel.contains(start);
|
3629 |
+
if (ourIndex > -1)
|
3630 |
+
ourRange = ranges[ourIndex];
|
3631 |
+
else
|
3632 |
+
ourRange = new Range(start, start);
|
3633 |
+
} else {
|
3634 |
+
ourRange = doc.sel.primary();
|
3635 |
+
ourIndex = doc.sel.primIndex;
|
3636 |
+
}
|
3637 |
+
|
3638 |
+
if (e.altKey) {
|
3639 |
+
type = "rect";
|
3640 |
+
if (!addNew) ourRange = new Range(start, start);
|
3641 |
+
start = posFromMouse(cm, e, true, true);
|
3642 |
+
ourIndex = -1;
|
3643 |
+
} else if (type == "double") {
|
3644 |
+
var word = cm.findWordAt(start);
|
3645 |
+
if (cm.display.shift || doc.extend)
|
3646 |
+
ourRange = extendRange(doc, ourRange, word.anchor, word.head);
|
3647 |
+
else
|
3648 |
+
ourRange = word;
|
3649 |
+
} else if (type == "triple") {
|
3650 |
+
var line = new Range(Pos(start.line, 0), clipPos(doc, Pos(start.line + 1, 0)));
|
3651 |
+
if (cm.display.shift || doc.extend)
|
3652 |
+
ourRange = extendRange(doc, ourRange, line.anchor, line.head);
|
3653 |
+
else
|
3654 |
+
ourRange = line;
|
3655 |
+
} else {
|
3656 |
+
ourRange = extendRange(doc, ourRange, start);
|
3657 |
+
}
|
3658 |
+
|
3659 |
+
if (!addNew) {
|
3660 |
+
ourIndex = 0;
|
3661 |
+
setSelection(doc, new Selection([ourRange], 0), sel_mouse);
|
3662 |
+
startSel = doc.sel;
|
3663 |
+
} else if (ourIndex == -1) {
|
3664 |
+
ourIndex = ranges.length;
|
3665 |
+
setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),
|
3666 |
+
{scroll: false, origin: "*mouse"});
|
3667 |
+
} else if (ranges.length > 1 && ranges[ourIndex].empty() && type == "single" && !e.shiftKey) {
|
3668 |
+
setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
|
3669 |
+
{scroll: false, origin: "*mouse"});
|
3670 |
+
startSel = doc.sel;
|
3671 |
+
} else {
|
3672 |
+
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
|
3673 |
+
}
|
3674 |
+
|
3675 |
+
var lastPos = start;
|
3676 |
+
function extendTo(pos) {
|
3677 |
+
if (cmp(lastPos, pos) == 0) return;
|
3678 |
+
lastPos = pos;
|
3679 |
+
|
3680 |
+
if (type == "rect") {
|
3681 |
+
var ranges = [], tabSize = cm.options.tabSize;
|
3682 |
+
var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
|
3683 |
+
var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
|
3684 |
+
var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
|
3685 |
+
for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
|
3686 |
+
line <= end; line++) {
|
3687 |
+
var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
|
3688 |
+
if (left == right)
|
3689 |
+
ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));
|
3690 |
+
else if (text.length > leftPos)
|
3691 |
+
ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));
|
3692 |
+
}
|
3693 |
+
if (!ranges.length) ranges.push(new Range(start, start));
|
3694 |
+
setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
|
3695 |
+
{origin: "*mouse", scroll: false});
|
3696 |
+
cm.scrollIntoView(pos);
|
3697 |
+
} else {
|
3698 |
+
var oldRange = ourRange;
|
3699 |
+
var anchor = oldRange.anchor, head = pos;
|
3700 |
+
if (type != "single") {
|
3701 |
+
if (type == "double")
|
3702 |
+
var range = cm.findWordAt(pos);
|
3703 |
+
else
|
3704 |
+
var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));
|
3705 |
+
if (cmp(range.anchor, anchor) > 0) {
|
3706 |
+
head = range.head;
|
3707 |
+
anchor = minPos(oldRange.from(), range.anchor);
|
3708 |
+
} else {
|
3709 |
+
head = range.anchor;
|
3710 |
+
anchor = maxPos(oldRange.to(), range.head);
|
3711 |
+
}
|
3712 |
+
}
|
3713 |
+
var ranges = startSel.ranges.slice(0);
|
3714 |
+
ranges[ourIndex] = new Range(clipPos(doc, anchor), head);
|
3715 |
+
setSelection(doc, normalizeSelection(ranges, ourIndex), sel_mouse);
|
3716 |
+
}
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
var editorSize = display.wrapper.getBoundingClientRect();
|
3720 |
+
// Used to ensure timeout re-tries don't fire when another extend
|
3721 |
+
// happened in the meantime (clearTimeout isn't reliable -- at
|
3722 |
+
// least on Chrome, the timeouts still happen even when cleared,
|
3723 |
+
// if the clear happens after their scheduled firing time).
|
3724 |
+
var counter = 0;
|
3725 |
+
|
3726 |
+
function extend(e) {
|
3727 |
+
var curCount = ++counter;
|
3728 |
+
var cur = posFromMouse(cm, e, true, type == "rect");
|
3729 |
+
if (!cur) return;
|
3730 |
+
if (cmp(cur, lastPos) != 0) {
|
3731 |
+
cm.curOp.focus = activeElt();
|
3732 |
+
extendTo(cur);
|
3733 |
+
var visible = visibleLines(display, doc);
|
3734 |
+
if (cur.line >= visible.to || cur.line < visible.from)
|
3735 |
+
setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
|
3736 |
+
} else {
|
3737 |
+
var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
|
3738 |
+
if (outside) setTimeout(operation(cm, function() {
|
3739 |
+
if (counter != curCount) return;
|
3740 |
+
display.scroller.scrollTop += outside;
|
3741 |
+
extend(e);
|
3742 |
+
}), 50);
|
3743 |
+
}
|
3744 |
+
}
|
3745 |
+
|
3746 |
+
function done(e) {
|
3747 |
+
cm.state.selectingText = false;
|
3748 |
+
counter = Infinity;
|
3749 |
+
e_preventDefault(e);
|
3750 |
+
display.input.focus();
|
3751 |
+
off(document, "mousemove", move);
|
3752 |
+
off(document, "mouseup", up);
|
3753 |
+
doc.history.lastSelOrigin = null;
|
3754 |
+
}
|
3755 |
+
|
3756 |
+
var move = operation(cm, function(e) {
|
3757 |
+
if (!e_button(e)) done(e);
|
3758 |
+
else extend(e);
|
3759 |
+
});
|
3760 |
+
var up = operation(cm, done);
|
3761 |
+
cm.state.selectingText = up;
|
3762 |
+
on(document, "mousemove", move);
|
3763 |
+
on(document, "mouseup", up);
|
3764 |
+
}
|
3765 |
+
|
3766 |
+
// Determines whether an event happened in the gutter, and fires the
|
3767 |
+
// handlers for the corresponding event.
|
3768 |
+
function gutterEvent(cm, e, type, prevent, signalfn) {
|
3769 |
+
try { var mX = e.clientX, mY = e.clientY; }
|
3770 |
+
catch(e) { return false; }
|
3771 |
+
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
|
3772 |
+
if (prevent) e_preventDefault(e);
|
3773 |
+
|
3774 |
+
var display = cm.display;
|
3775 |
+
var lineBox = display.lineDiv.getBoundingClientRect();
|
3776 |
+
|
3777 |
+
if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
|
3778 |
+
mY -= lineBox.top - display.viewOffset;
|
3779 |
+
|
3780 |
+
for (var i = 0; i < cm.options.gutters.length; ++i) {
|
3781 |
+
var g = display.gutters.childNodes[i];
|
3782 |
+
if (g && g.getBoundingClientRect().right >= mX) {
|
3783 |
+
var line = lineAtHeight(cm.doc, mY);
|
3784 |
+
var gutter = cm.options.gutters[i];
|
3785 |
+
signalfn(cm, type, cm, line, gutter, e);
|
3786 |
+
return e_defaultPrevented(e);
|
3787 |
+
}
|
3788 |
+
}
|
3789 |
+
}
|
3790 |
+
|
3791 |
+
function clickInGutter(cm, e) {
|
3792 |
+
return gutterEvent(cm, e, "gutterClick", true, signalLater);
|
3793 |
+
}
|
3794 |
+
|
3795 |
+
// Kludge to work around strange IE behavior where it'll sometimes
|
3796 |
+
// re-fire a series of drag-related events right after the drop (#1551)
|
3797 |
+
var lastDrop = 0;
|
3798 |
+
|
3799 |
+
function onDrop(e) {
|
3800 |
+
var cm = this;
|
3801 |
+
clearDragCursor(cm);
|
3802 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
|
3803 |
+
return;
|
3804 |
+
e_preventDefault(e);
|
3805 |
+
if (ie) lastDrop = +new Date;
|
3806 |
+
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
|
3807 |
+
if (!pos || isReadOnly(cm)) return;
|
3808 |
+
// Might be a file drop, in which case we simply extract the text
|
3809 |
+
// and insert it.
|
3810 |
+
if (files && files.length && window.FileReader && window.File) {
|
3811 |
+
var n = files.length, text = Array(n), read = 0;
|
3812 |
+
var loadFile = function(file, i) {
|
3813 |
+
var reader = new FileReader;
|
3814 |
+
reader.onload = operation(cm, function() {
|
3815 |
+
text[i] = reader.result;
|
3816 |
+
if (++read == n) {
|
3817 |
+
pos = clipPos(cm.doc, pos);
|
3818 |
+
var change = {from: pos, to: pos,
|
3819 |
+
text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
|
3820 |
+
origin: "paste"};
|
3821 |
+
makeChange(cm.doc, change);
|
3822 |
+
setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
|
3823 |
+
}
|
3824 |
+
});
|
3825 |
+
reader.readAsText(file);
|
3826 |
+
};
|
3827 |
+
for (var i = 0; i < n; ++i) loadFile(files[i], i);
|
3828 |
+
} else { // Normal drop
|
3829 |
+
// Don't do a replace if the drop happened inside of the selected text.
|
3830 |
+
if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
|
3831 |
+
cm.state.draggingText(e);
|
3832 |
+
// Ensure the editor is re-focused
|
3833 |
+
setTimeout(function() {cm.display.input.focus();}, 20);
|
3834 |
+
return;
|
3835 |
+
}
|
3836 |
+
try {
|
3837 |
+
var text = e.dataTransfer.getData("Text");
|
3838 |
+
if (text) {
|
3839 |
+
if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
|
3840 |
+
var selected = cm.listSelections();
|
3841 |
+
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
|
3842 |
+
if (selected) for (var i = 0; i < selected.length; ++i)
|
3843 |
+
replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag");
|
3844 |
+
cm.replaceSelection(text, "around", "paste");
|
3845 |
+
cm.display.input.focus();
|
3846 |
+
}
|
3847 |
+
}
|
3848 |
+
catch(e){}
|
3849 |
+
}
|
3850 |
+
}
|
3851 |
+
|
3852 |
+
function onDragStart(cm, e) {
|
3853 |
+
if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
|
3854 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
|
3855 |
+
|
3856 |
+
e.dataTransfer.setData("Text", cm.getSelection());
|
3857 |
+
|
3858 |
+
// Use dummy image instead of default browsers image.
|
3859 |
+
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
|
3860 |
+
if (e.dataTransfer.setDragImage && !safari) {
|
3861 |
+
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
|
3862 |
+
img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
3863 |
+
if (presto) {
|
3864 |
+
img.width = img.height = 1;
|
3865 |
+
cm.display.wrapper.appendChild(img);
|
3866 |
+
// Force a relayout, or Opera won't use our image for some obscure reason
|
3867 |
+
img._top = img.offsetTop;
|
3868 |
+
}
|
3869 |
+
e.dataTransfer.setDragImage(img, 0, 0);
|
3870 |
+
if (presto) img.parentNode.removeChild(img);
|
3871 |
+
}
|
3872 |
+
}
|
3873 |
+
|
3874 |
+
function onDragOver(cm, e) {
|
3875 |
+
var pos = posFromMouse(cm, e);
|
3876 |
+
if (!pos) return;
|
3877 |
+
var frag = document.createDocumentFragment();
|
3878 |
+
drawSelectionCursor(cm, pos, frag);
|
3879 |
+
if (!cm.display.dragCursor) {
|
3880 |
+
cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
|
3881 |
+
cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
|
3882 |
+
}
|
3883 |
+
removeChildrenAndAdd(cm.display.dragCursor, frag);
|
3884 |
+
}
|
3885 |
+
|
3886 |
+
function clearDragCursor(cm) {
|
3887 |
+
if (cm.display.dragCursor) {
|
3888 |
+
cm.display.lineSpace.removeChild(cm.display.dragCursor);
|
3889 |
+
cm.display.dragCursor = null;
|
3890 |
+
}
|
3891 |
+
}
|
3892 |
+
|
3893 |
+
// SCROLL EVENTS
|
3894 |
+
|
3895 |
+
// Sync the scrollable area and scrollbars, ensure the viewport
|
3896 |
+
// covers the visible area.
|
3897 |
+
function setScrollTop(cm, val) {
|
3898 |
+
if (Math.abs(cm.doc.scrollTop - val) < 2) return;
|
3899 |
+
cm.doc.scrollTop = val;
|
3900 |
+
if (!gecko) updateDisplaySimple(cm, {top: val});
|
3901 |
+
if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
|
3902 |
+
cm.display.scrollbars.setScrollTop(val);
|
3903 |
+
if (gecko) updateDisplaySimple(cm);
|
3904 |
+
startWorker(cm, 100);
|
3905 |
+
}
|
3906 |
+
// Sync scroller and scrollbar, ensure the gutter elements are
|
3907 |
+
// aligned.
|
3908 |
+
function setScrollLeft(cm, val, isScroller) {
|
3909 |
+
if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
|
3910 |
+
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
|
3911 |
+
cm.doc.scrollLeft = val;
|
3912 |
+
alignHorizontally(cm);
|
3913 |
+
if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
|
3914 |
+
cm.display.scrollbars.setScrollLeft(val);
|
3915 |
+
}
|
3916 |
+
|
3917 |
+
// Since the delta values reported on mouse wheel events are
|
3918 |
+
// unstandardized between browsers and even browser versions, and
|
3919 |
+
// generally horribly unpredictable, this code starts by measuring
|
3920 |
+
// the scroll effect that the first few mouse wheel events have,
|
3921 |
+
// and, from that, detects the way it can convert deltas to pixel
|
3922 |
+
// offsets afterwards.
|
3923 |
+
//
|
3924 |
+
// The reason we want to know the amount a wheel event will scroll
|
3925 |
+
// is that it gives us a chance to update the display before the
|
3926 |
+
// actual scrolling happens, reducing flickering.
|
3927 |
+
|
3928 |
+
var wheelSamples = 0, wheelPixelsPerUnit = null;
|
3929 |
+
// Fill in a browser-detected starting value on browsers where we
|
3930 |
+
// know one. These don't have to be accurate -- the result of them
|
3931 |
+
// being wrong would just be a slight flicker on the first wheel
|
3932 |
+
// scroll (if it is large enough).
|
3933 |
+
if (ie) wheelPixelsPerUnit = -.53;
|
3934 |
+
else if (gecko) wheelPixelsPerUnit = 15;
|
3935 |
+
else if (chrome) wheelPixelsPerUnit = -.7;
|
3936 |
+
else if (safari) wheelPixelsPerUnit = -1/3;
|
3937 |
+
|
3938 |
+
var wheelEventDelta = function(e) {
|
3939 |
+
var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
|
3940 |
+
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
|
3941 |
+
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
|
3942 |
+
else if (dy == null) dy = e.wheelDelta;
|
3943 |
+
return {x: dx, y: dy};
|
3944 |
+
};
|
3945 |
+
CodeMirror.wheelEventPixels = function(e) {
|
3946 |
+
var delta = wheelEventDelta(e);
|
3947 |
+
delta.x *= wheelPixelsPerUnit;
|
3948 |
+
delta.y *= wheelPixelsPerUnit;
|
3949 |
+
return delta;
|
3950 |
+
};
|
3951 |
+
|
3952 |
+
function onScrollWheel(cm, e) {
|
3953 |
+
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
|
3954 |
+
|
3955 |
+
var display = cm.display, scroll = display.scroller;
|
3956 |
+
// Quit if there's nothing to scroll here
|
3957 |
+
if (!(dx && scroll.scrollWidth > scroll.clientWidth ||
|
3958 |
+
dy && scroll.scrollHeight > scroll.clientHeight)) return;
|
3959 |
+
|
3960 |
+
// Webkit browsers on OS X abort momentum scrolls when the target
|
3961 |
+
// of the scroll event is removed from the scrollable element.
|
3962 |
+
// This hack (see related code in patchDisplay) makes sure the
|
3963 |
+
// element is kept around.
|
3964 |
+
if (dy && mac && webkit) {
|
3965 |
+
outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
|
3966 |
+
for (var i = 0; i < view.length; i++) {
|
3967 |
+
if (view[i].node == cur) {
|
3968 |
+
cm.display.currentWheelTarget = cur;
|
3969 |
+
break outer;
|
3970 |
+
}
|
3971 |
+
}
|
3972 |
+
}
|
3973 |
+
}
|
3974 |
+
|
3975 |
+
// On some browsers, horizontal scrolling will cause redraws to
|
3976 |
+
// happen before the gutter has been realigned, causing it to
|
3977 |
+
// wriggle around in a most unseemly way. When we have an
|
3978 |
+
// estimated pixels/delta value, we just handle horizontal
|
3979 |
+
// scrolling entirely here. It'll be slightly off from native, but
|
3980 |
+
// better than glitching out.
|
3981 |
+
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
|
3982 |
+
if (dy)
|
3983 |
+
setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
|
3984 |
+
setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
|
3985 |
+
e_preventDefault(e);
|
3986 |
+
display.wheelStartX = null; // Abort measurement, if in progress
|
3987 |
+
return;
|
3988 |
+
}
|
3989 |
+
|
3990 |
+
// 'Project' the visible viewport to cover the area that is being
|
3991 |
+
// scrolled into view (if we know enough to estimate it).
|
3992 |
+
if (dy && wheelPixelsPerUnit != null) {
|
3993 |
+
var pixels = dy * wheelPixelsPerUnit;
|
3994 |
+
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
|
3995 |
+
if (pixels < 0) top = Math.max(0, top + pixels - 50);
|
3996 |
+
else bot = Math.min(cm.doc.height, bot + pixels + 50);
|
3997 |
+
updateDisplaySimple(cm, {top: top, bottom: bot});
|
3998 |
+
}
|
3999 |
+
|
4000 |
+
if (wheelSamples < 20) {
|
4001 |
+
if (display.wheelStartX == null) {
|
4002 |
+
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
|
4003 |
+
display.wheelDX = dx; display.wheelDY = dy;
|
4004 |
+
setTimeout(function() {
|
4005 |
+
if (display.wheelStartX == null) return;
|
4006 |
+
var movedX = scroll.scrollLeft - display.wheelStartX;
|
4007 |
+
var movedY = scroll.scrollTop - display.wheelStartY;
|
4008 |
+
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
4009 |
+
(movedX && display.wheelDX && movedX / display.wheelDX);
|
4010 |
+
display.wheelStartX = display.wheelStartY = null;
|
4011 |
+
if (!sample) return;
|
4012 |
+
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
|
4013 |
+
++wheelSamples;
|
4014 |
+
}, 200);
|
4015 |
+
} else {
|
4016 |
+
display.wheelDX += dx; display.wheelDY += dy;
|
4017 |
+
}
|
4018 |
+
}
|
4019 |
+
}
|
4020 |
+
|
4021 |
+
// KEY EVENTS
|
4022 |
+
|
4023 |
+
// Run a handler that was bound to a key.
|
4024 |
+
function doHandleBinding(cm, bound, dropShift) {
|
4025 |
+
if (typeof bound == "string") {
|
4026 |
+
bound = commands[bound];
|
4027 |
+
if (!bound) return false;
|
4028 |
+
}
|
4029 |
+
// Ensure previous input has been read, so that the handler sees a
|
4030 |
+
// consistent view of the document
|
4031 |
+
cm.display.input.ensurePolled();
|
4032 |
+
var prevShift = cm.display.shift, done = false;
|
4033 |
+
try {
|
4034 |
+
if (isReadOnly(cm)) cm.state.suppressEdits = true;
|
4035 |
+
if (dropShift) cm.display.shift = false;
|
4036 |
+
done = bound(cm) != Pass;
|
4037 |
+
} finally {
|
4038 |
+
cm.display.shift = prevShift;
|
4039 |
+
cm.state.suppressEdits = false;
|
4040 |
+
}
|
4041 |
+
return done;
|
4042 |
+
}
|
4043 |
+
|
4044 |
+
function lookupKeyForEditor(cm, name, handle) {
|
4045 |
+
for (var i = 0; i < cm.state.keyMaps.length; i++) {
|
4046 |
+
var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
|
4047 |
+
if (result) return result;
|
4048 |
+
}
|
4049 |
+
return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
|
4050 |
+
|| lookupKey(name, cm.options.keyMap, handle, cm);
|
4051 |
+
}
|
4052 |
+
|
4053 |
+
var stopSeq = new Delayed;
|
4054 |
+
function dispatchKey(cm, name, e, handle) {
|
4055 |
+
var seq = cm.state.keySeq;
|
4056 |
+
if (seq) {
|
4057 |
+
if (isModifierKey(name)) return "handled";
|
4058 |
+
stopSeq.set(50, function() {
|
4059 |
+
if (cm.state.keySeq == seq) {
|
4060 |
+
cm.state.keySeq = null;
|
4061 |
+
cm.display.input.reset();
|
4062 |
+
}
|
4063 |
+
});
|
4064 |
+
name = seq + " " + name;
|
4065 |
+
}
|
4066 |
+
var result = lookupKeyForEditor(cm, name, handle);
|
4067 |
+
|
4068 |
+
if (result == "multi")
|
4069 |
+
cm.state.keySeq = name;
|
4070 |
+
if (result == "handled")
|
4071 |
+
signalLater(cm, "keyHandled", cm, name, e);
|
4072 |
+
|
4073 |
+
if (result == "handled" || result == "multi") {
|
4074 |
+
e_preventDefault(e);
|
4075 |
+
restartBlink(cm);
|
4076 |
+
}
|
4077 |
+
|
4078 |
+
if (seq && !result && /\'$/.test(name)) {
|
4079 |
+
e_preventDefault(e);
|
4080 |
+
return true;
|
4081 |
+
}
|
4082 |
+
return !!result;
|
4083 |
+
}
|
4084 |
+
|
4085 |
+
// Handle a key from the keydown event.
|
4086 |
+
function handleKeyBinding(cm, e) {
|
4087 |
+
var name = keyName(e, true);
|
4088 |
+
if (!name) return false;
|
4089 |
+
|
4090 |
+
if (e.shiftKey && !cm.state.keySeq) {
|
4091 |
+
// First try to resolve full name (including 'Shift-'). Failing
|
4092 |
+
// that, see if there is a cursor-motion command (starting with
|
4093 |
+
// 'go') bound to the keyname without 'Shift-'.
|
4094 |
+
return dispatchKey(cm, "Shift-" + name, e, function(b) {return doHandleBinding(cm, b, true);})
|
4095 |
+
|| dispatchKey(cm, name, e, function(b) {
|
4096 |
+
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
|
4097 |
+
return doHandleBinding(cm, b);
|
4098 |
+
});
|
4099 |
+
} else {
|
4100 |
+
return dispatchKey(cm, name, e, function(b) { return doHandleBinding(cm, b); });
|
4101 |
+
}
|
4102 |
+
}
|
4103 |
+
|
4104 |
+
// Handle a key from the keypress event
|
4105 |
+
function handleCharBinding(cm, e, ch) {
|
4106 |
+
return dispatchKey(cm, "'" + ch + "'", e,
|
4107 |
+
function(b) { return doHandleBinding(cm, b, true); });
|
4108 |
+
}
|
4109 |
+
|
4110 |
+
var lastStoppedKey = null;
|
4111 |
+
function onKeyDown(e) {
|
4112 |
+
var cm = this;
|
4113 |
+
cm.curOp.focus = activeElt();
|
4114 |
+
if (signalDOMEvent(cm, e)) return;
|
4115 |
+
// IE does strange things with escape.
|
4116 |
+
if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false;
|
4117 |
+
var code = e.keyCode;
|
4118 |
+
cm.display.shift = code == 16 || e.shiftKey;
|
4119 |
+
var handled = handleKeyBinding(cm, e);
|
4120 |
+
if (presto) {
|
4121 |
+
lastStoppedKey = handled ? code : null;
|
4122 |
+
// Opera has no cut event... we try to at least catch the key combo
|
4123 |
+
if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
|
4124 |
+
cm.replaceSelection("", null, "cut");
|
4125 |
+
}
|
4126 |
+
|
4127 |
+
// Turn mouse into crosshair when Alt is held on Mac.
|
4128 |
+
if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
|
4129 |
+
showCrossHair(cm);
|
4130 |
+
}
|
4131 |
+
|
4132 |
+
function showCrossHair(cm) {
|
4133 |
+
var lineDiv = cm.display.lineDiv;
|
4134 |
+
addClass(lineDiv, "CodeMirror-crosshair");
|
4135 |
+
|
4136 |
+
function up(e) {
|
4137 |
+
if (e.keyCode == 18 || !e.altKey) {
|
4138 |
+
rmClass(lineDiv, "CodeMirror-crosshair");
|
4139 |
+
off(document, "keyup", up);
|
4140 |
+
off(document, "mouseover", up);
|
4141 |
+
}
|
4142 |
+
}
|
4143 |
+
on(document, "keyup", up);
|
4144 |
+
on(document, "mouseover", up);
|
4145 |
+
}
|
4146 |
+
|
4147 |
+
function onKeyUp(e) {
|
4148 |
+
if (e.keyCode == 16) this.doc.sel.shift = false;
|
4149 |
+
signalDOMEvent(this, e);
|
4150 |
+
}
|
4151 |
+
|
4152 |
+
function onKeyPress(e) {
|
4153 |
+
var cm = this;
|
4154 |
+
if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return;
|
4155 |
+
var keyCode = e.keyCode, charCode = e.charCode;
|
4156 |
+
if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
|
4157 |
+
if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return;
|
4158 |
+
var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
|
4159 |
+
if (handleCharBinding(cm, e, ch)) return;
|
4160 |
+
cm.display.input.onKeyPress(e);
|
4161 |
+
}
|
4162 |
+
|
4163 |
+
// FOCUS/BLUR EVENTS
|
4164 |
+
|
4165 |
+
function delayBlurEvent(cm) {
|
4166 |
+
cm.state.delayingBlurEvent = true;
|
4167 |
+
setTimeout(function() {
|
4168 |
+
if (cm.state.delayingBlurEvent) {
|
4169 |
+
cm.state.delayingBlurEvent = false;
|
4170 |
+
onBlur(cm);
|
4171 |
+
}
|
4172 |
+
}, 100);
|
4173 |
+
}
|
4174 |
+
|
4175 |
+
function onFocus(cm) {
|
4176 |
+
if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;
|
4177 |
+
|
4178 |
+
if (cm.options.readOnly == "nocursor") return;
|
4179 |
+
if (!cm.state.focused) {
|
4180 |
+
signal(cm, "focus", cm);
|
4181 |
+
cm.state.focused = true;
|
4182 |
+
addClass(cm.display.wrapper, "CodeMirror-focused");
|
4183 |
+
// This test prevents this from firing when a context
|
4184 |
+
// menu is closed (since the input reset would kill the
|
4185 |
+
// select-all detection hack)
|
4186 |
+
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
4187 |
+
cm.display.input.reset();
|
4188 |
+
if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730
|
4189 |
+
}
|
4190 |
+
cm.display.input.receivedFocus();
|
4191 |
+
}
|
4192 |
+
restartBlink(cm);
|
4193 |
+
}
|
4194 |
+
function onBlur(cm) {
|
4195 |
+
if (cm.state.delayingBlurEvent) return;
|
4196 |
+
|
4197 |
+
if (cm.state.focused) {
|
4198 |
+
signal(cm, "blur", cm);
|
4199 |
+
cm.state.focused = false;
|
4200 |
+
rmClass(cm.display.wrapper, "CodeMirror-focused");
|
4201 |
+
}
|
4202 |
+
clearInterval(cm.display.blinker);
|
4203 |
+
setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);
|
4204 |
+
}
|
4205 |
+
|
4206 |
+
// CONTEXT MENU HANDLING
|
4207 |
+
|
4208 |
+
// To make the context menu work, we need to briefly unhide the
|
4209 |
+
// textarea (making it as unobtrusive as possible) to let the
|
4210 |
+
// right-click take effect on it.
|
4211 |
+
function onContextMenu(cm, e) {
|
4212 |
+
if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return;
|
4213 |
+
cm.display.input.onContextMenu(e);
|
4214 |
+
}
|
4215 |
+
|
4216 |
+
function contextMenuInGutter(cm, e) {
|
4217 |
+
if (!hasHandler(cm, "gutterContextMenu")) return false;
|
4218 |
+
return gutterEvent(cm, e, "gutterContextMenu", false, signal);
|
4219 |
+
}
|
4220 |
+
|
4221 |
+
// UPDATING
|
4222 |
+
|
4223 |
+
// Compute the position of the end of a change (its 'to' property
|
4224 |
+
// refers to the pre-change end).
|
4225 |
+
var changeEnd = CodeMirror.changeEnd = function(change) {
|
4226 |
+
if (!change.text) return change.to;
|
4227 |
+
return Pos(change.from.line + change.text.length - 1,
|
4228 |
+
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
|
4229 |
+
};
|
4230 |
+
|
4231 |
+
// Adjust a position to refer to the post-change position of the
|
4232 |
+
// same text, or the end of the change if the change covers it.
|
4233 |
+
function adjustForChange(pos, change) {
|
4234 |
+
if (cmp(pos, change.from) < 0) return pos;
|
4235 |
+
if (cmp(pos, change.to) <= 0) return changeEnd(change);
|
4236 |
+
|
4237 |
+
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
|
4238 |
+
if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch;
|
4239 |
+
return Pos(line, ch);
|
4240 |
+
}
|
4241 |
+
|
4242 |
+
function computeSelAfterChange(doc, change) {
|
4243 |
+
var out = [];
|
4244 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4245 |
+
var range = doc.sel.ranges[i];
|
4246 |
+
out.push(new Range(adjustForChange(range.anchor, change),
|
4247 |
+
adjustForChange(range.head, change)));
|
4248 |
+
}
|
4249 |
+
return normalizeSelection(out, doc.sel.primIndex);
|
4250 |
+
}
|
4251 |
+
|
4252 |
+
function offsetPos(pos, old, nw) {
|
4253 |
+
if (pos.line == old.line)
|
4254 |
+
return Pos(nw.line, pos.ch - old.ch + nw.ch);
|
4255 |
+
else
|
4256 |
+
return Pos(nw.line + (pos.line - old.line), pos.ch);
|
4257 |
+
}
|
4258 |
+
|
4259 |
+
// Used by replaceSelections to allow moving the selection to the
|
4260 |
+
// start or around the replaced test. Hint may be "start" or "around".
|
4261 |
+
function computeReplacedSel(doc, changes, hint) {
|
4262 |
+
var out = [];
|
4263 |
+
var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
|
4264 |
+
for (var i = 0; i < changes.length; i++) {
|
4265 |
+
var change = changes[i];
|
4266 |
+
var from = offsetPos(change.from, oldPrev, newPrev);
|
4267 |
+
var to = offsetPos(changeEnd(change), oldPrev, newPrev);
|
4268 |
+
oldPrev = change.to;
|
4269 |
+
newPrev = to;
|
4270 |
+
if (hint == "around") {
|
4271 |
+
var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
|
4272 |
+
out[i] = new Range(inv ? to : from, inv ? from : to);
|
4273 |
+
} else {
|
4274 |
+
out[i] = new Range(from, from);
|
4275 |
+
}
|
4276 |
+
}
|
4277 |
+
return new Selection(out, doc.sel.primIndex);
|
4278 |
+
}
|
4279 |
+
|
4280 |
+
// Allow "beforeChange" event handlers to influence a change
|
4281 |
+
function filterChange(doc, change, update) {
|
4282 |
+
var obj = {
|
4283 |
+
canceled: false,
|
4284 |
+
from: change.from,
|
4285 |
+
to: change.to,
|
4286 |
+
text: change.text,
|
4287 |
+
origin: change.origin,
|
4288 |
+
cancel: function() { this.canceled = true; }
|
4289 |
+
};
|
4290 |
+
if (update) obj.update = function(from, to, text, origin) {
|
4291 |
+
if (from) this.from = clipPos(doc, from);
|
4292 |
+
if (to) this.to = clipPos(doc, to);
|
4293 |
+
if (text) this.text = text;
|
4294 |
+
if (origin !== undefined) this.origin = origin;
|
4295 |
+
};
|
4296 |
+
signal(doc, "beforeChange", doc, obj);
|
4297 |
+
if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
|
4298 |
+
|
4299 |
+
if (obj.canceled) return null;
|
4300 |
+
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
|
4301 |
+
}
|
4302 |
+
|
4303 |
+
// Apply a change to a document, and add it to the document's
|
4304 |
+
// history, and propagating it to all linked documents.
|
4305 |
+
function makeChange(doc, change, ignoreReadOnly) {
|
4306 |
+
if (doc.cm) {
|
4307 |
+
if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly);
|
4308 |
+
if (doc.cm.state.suppressEdits) return;
|
4309 |
+
}
|
4310 |
+
|
4311 |
+
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
4312 |
+
change = filterChange(doc, change, true);
|
4313 |
+
if (!change) return;
|
4314 |
+
}
|
4315 |
+
|
4316 |
+
// Possibly split or suppress the update based on the presence
|
4317 |
+
// of read-only spans in its range.
|
4318 |
+
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
|
4319 |
+
if (split) {
|
4320 |
+
for (var i = split.length - 1; i >= 0; --i)
|
4321 |
+
makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
|
4322 |
+
} else {
|
4323 |
+
makeChangeInner(doc, change);
|
4324 |
+
}
|
4325 |
+
}
|
4326 |
+
|
4327 |
+
function makeChangeInner(doc, change) {
|
4328 |
+
if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;
|
4329 |
+
var selAfter = computeSelAfterChange(doc, change);
|
4330 |
+
addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
|
4331 |
+
|
4332 |
+
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
|
4333 |
+
var rebased = [];
|
4334 |
+
|
4335 |
+
linkedDocs(doc, function(doc, sharedHist) {
|
4336 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
4337 |
+
rebaseHist(doc.history, change);
|
4338 |
+
rebased.push(doc.history);
|
4339 |
+
}
|
4340 |
+
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
|
4341 |
+
});
|
4342 |
+
}
|
4343 |
+
|
4344 |
+
// Revert a change stored in a document's history.
|
4345 |
+
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
|
4346 |
+
if (doc.cm && doc.cm.state.suppressEdits) return;
|
4347 |
+
|
4348 |
+
var hist = doc.history, event, selAfter = doc.sel;
|
4349 |
+
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
|
4350 |
+
|
4351 |
+
// Verify that there is a useable event (so that ctrl-z won't
|
4352 |
+
// needlessly clear selection events)
|
4353 |
+
for (var i = 0; i < source.length; i++) {
|
4354 |
+
event = source[i];
|
4355 |
+
if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
|
4356 |
+
break;
|
4357 |
+
}
|
4358 |
+
if (i == source.length) return;
|
4359 |
+
hist.lastOrigin = hist.lastSelOrigin = null;
|
4360 |
+
|
4361 |
+
for (;;) {
|
4362 |
+
event = source.pop();
|
4363 |
+
if (event.ranges) {
|
4364 |
+
pushSelectionToHistory(event, dest);
|
4365 |
+
if (allowSelectionOnly && !event.equals(doc.sel)) {
|
4366 |
+
setSelection(doc, event, {clearRedo: false});
|
4367 |
+
return;
|
4368 |
+
}
|
4369 |
+
selAfter = event;
|
4370 |
+
}
|
4371 |
+
else break;
|
4372 |
+
}
|
4373 |
+
|
4374 |
+
// Build up a reverse change object to add to the opposite history
|
4375 |
+
// stack (redo when undoing, and vice versa).
|
4376 |
+
var antiChanges = [];
|
4377 |
+
pushSelectionToHistory(selAfter, dest);
|
4378 |
+
dest.push({changes: antiChanges, generation: hist.generation});
|
4379 |
+
hist.generation = event.generation || ++hist.maxGeneration;
|
4380 |
+
|
4381 |
+
var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
|
4382 |
+
|
4383 |
+
for (var i = event.changes.length - 1; i >= 0; --i) {
|
4384 |
+
var change = event.changes[i];
|
4385 |
+
change.origin = type;
|
4386 |
+
if (filter && !filterChange(doc, change, false)) {
|
4387 |
+
source.length = 0;
|
4388 |
+
return;
|
4389 |
+
}
|
4390 |
+
|
4391 |
+
antiChanges.push(historyChangeFromChange(doc, change));
|
4392 |
+
|
4393 |
+
var after = i ? computeSelAfterChange(doc, change) : lst(source);
|
4394 |
+
makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
|
4395 |
+
if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});
|
4396 |
+
var rebased = [];
|
4397 |
+
|
4398 |
+
// Propagate to the linked documents
|
4399 |
+
linkedDocs(doc, function(doc, sharedHist) {
|
4400 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
4401 |
+
rebaseHist(doc.history, change);
|
4402 |
+
rebased.push(doc.history);
|
4403 |
+
}
|
4404 |
+
makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
|
4405 |
+
});
|
4406 |
+
}
|
4407 |
+
}
|
4408 |
+
|
4409 |
+
// Sub-views need their line numbers shifted when text is added
|
4410 |
+
// above or below them in the parent document.
|
4411 |
+
function shiftDoc(doc, distance) {
|
4412 |
+
if (distance == 0) return;
|
4413 |
+
doc.first += distance;
|
4414 |
+
doc.sel = new Selection(map(doc.sel.ranges, function(range) {
|
4415 |
+
return new Range(Pos(range.anchor.line + distance, range.anchor.ch),
|
4416 |
+
Pos(range.head.line + distance, range.head.ch));
|
4417 |
+
}), doc.sel.primIndex);
|
4418 |
+
if (doc.cm) {
|
4419 |
+
regChange(doc.cm, doc.first, doc.first - distance, distance);
|
4420 |
+
for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
|
4421 |
+
regLineChange(doc.cm, l, "gutter");
|
4422 |
+
}
|
4423 |
+
}
|
4424 |
+
|
4425 |
+
// More lower-level change function, handling only a single document
|
4426 |
+
// (not linked ones).
|
4427 |
+
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
4428 |
+
if (doc.cm && !doc.cm.curOp)
|
4429 |
+
return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
|
4430 |
+
|
4431 |
+
if (change.to.line < doc.first) {
|
4432 |
+
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
|
4433 |
+
return;
|
4434 |
+
}
|
4435 |
+
if (change.from.line > doc.lastLine()) return;
|
4436 |
+
|
4437 |
+
// Clip the change to the size of this doc
|
4438 |
+
if (change.from.line < doc.first) {
|
4439 |
+
var shift = change.text.length - 1 - (doc.first - change.from.line);
|
4440 |
+
shiftDoc(doc, shift);
|
4441 |
+
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
4442 |
+
text: [lst(change.text)], origin: change.origin};
|
4443 |
+
}
|
4444 |
+
var last = doc.lastLine();
|
4445 |
+
if (change.to.line > last) {
|
4446 |
+
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
4447 |
+
text: [change.text[0]], origin: change.origin};
|
4448 |
+
}
|
4449 |
+
|
4450 |
+
change.removed = getBetween(doc, change.from, change.to);
|
4451 |
+
|
4452 |
+
if (!selAfter) selAfter = computeSelAfterChange(doc, change);
|
4453 |
+
if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans);
|
4454 |
+
else updateDoc(doc, change, spans);
|
4455 |
+
setSelectionNoUndo(doc, selAfter, sel_dontScroll);
|
4456 |
+
}
|
4457 |
+
|
4458 |
+
// Handle the interaction of a change to a document with the editor
|
4459 |
+
// that this document is part of.
|
4460 |
+
function makeChangeSingleDocInEditor(cm, change, spans) {
|
4461 |
+
var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
|
4462 |
+
|
4463 |
+
var recomputeMaxLength = false, checkWidthStart = from.line;
|
4464 |
+
if (!cm.options.lineWrapping) {
|
4465 |
+
checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
|
4466 |
+
doc.iter(checkWidthStart, to.line + 1, function(line) {
|
4467 |
+
if (line == display.maxLine) {
|
4468 |
+
recomputeMaxLength = true;
|
4469 |
+
return true;
|
4470 |
+
}
|
4471 |
+
});
|
4472 |
+
}
|
4473 |
+
|
4474 |
+
if (doc.sel.contains(change.from, change.to) > -1)
|
4475 |
+
signalCursorActivity(cm);
|
4476 |
+
|
4477 |
+
updateDoc(doc, change, spans, estimateHeight(cm));
|
4478 |
+
|
4479 |
+
if (!cm.options.lineWrapping) {
|
4480 |
+
doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
|
4481 |
+
var len = lineLength(line);
|
4482 |
+
if (len > display.maxLineLength) {
|
4483 |
+
display.maxLine = line;
|
4484 |
+
display.maxLineLength = len;
|
4485 |
+
display.maxLineChanged = true;
|
4486 |
+
recomputeMaxLength = false;
|
4487 |
+
}
|
4488 |
+
});
|
4489 |
+
if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
|
4490 |
+
}
|
4491 |
+
|
4492 |
+
// Adjust frontier, schedule worker
|
4493 |
+
doc.frontier = Math.min(doc.frontier, from.line);
|
4494 |
+
startWorker(cm, 400);
|
4495 |
+
|
4496 |
+
var lendiff = change.text.length - (to.line - from.line) - 1;
|
4497 |
+
// Remember that these lines changed, for updating the display
|
4498 |
+
if (change.full)
|
4499 |
+
regChange(cm);
|
4500 |
+
else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
|
4501 |
+
regLineChange(cm, from.line, "text");
|
4502 |
+
else
|
4503 |
+
regChange(cm, from.line, to.line + 1, lendiff);
|
4504 |
+
|
4505 |
+
var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
|
4506 |
+
if (changeHandler || changesHandler) {
|
4507 |
+
var obj = {
|
4508 |
+
from: from, to: to,
|
4509 |
+
text: change.text,
|
4510 |
+
removed: change.removed,
|
4511 |
+
origin: change.origin
|
4512 |
+
};
|
4513 |
+
if (changeHandler) signalLater(cm, "change", cm, obj);
|
4514 |
+
if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);
|
4515 |
+
}
|
4516 |
+
cm.display.selForContextMenu = null;
|
4517 |
+
}
|
4518 |
+
|
4519 |
+
function replaceRange(doc, code, from, to, origin) {
|
4520 |
+
if (!to) to = from;
|
4521 |
+
if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp; }
|
4522 |
+
if (typeof code == "string") code = doc.splitLines(code);
|
4523 |
+
makeChange(doc, {from: from, to: to, text: code, origin: origin});
|
4524 |
+
}
|
4525 |
+
|
4526 |
+
// SCROLLING THINGS INTO VIEW
|
4527 |
+
|
4528 |
+
// If an editor sits on the top or bottom of the window, partially
|
4529 |
+
// scrolled out of view, this ensures that the cursor is visible.
|
4530 |
+
function maybeScrollWindow(cm, coords) {
|
4531 |
+
if (signalDOMEvent(cm, "scrollCursorIntoView")) return;
|
4532 |
+
|
4533 |
+
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
|
4534 |
+
if (coords.top + box.top < 0) doScroll = true;
|
4535 |
+
else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
|
4536 |
+
if (doScroll != null && !phantom) {
|
4537 |
+
var scrollNode = elt("div", "\u200b", null, "position: absolute; top: " +
|
4538 |
+
(coords.top - display.viewOffset - paddingTop(cm.display)) + "px; height: " +
|
4539 |
+
(coords.bottom - coords.top + scrollGap(cm) + display.barHeight) + "px; left: " +
|
4540 |
+
coords.left + "px; width: 2px;");
|
4541 |
+
cm.display.lineSpace.appendChild(scrollNode);
|
4542 |
+
scrollNode.scrollIntoView(doScroll);
|
4543 |
+
cm.display.lineSpace.removeChild(scrollNode);
|
4544 |
+
}
|
4545 |
+
}
|
4546 |
+
|
4547 |
+
// Scroll a given position into view (immediately), verifying that
|
4548 |
+
// it actually became visible (as line heights are accurately
|
4549 |
+
// measured, the position of something may 'drift' during drawing).
|
4550 |
+
function scrollPosIntoView(cm, pos, end, margin) {
|
4551 |
+
if (margin == null) margin = 0;
|
4552 |
+
for (var limit = 0; limit < 5; limit++) {
|
4553 |
+
var changed = false, coords = cursorCoords(cm, pos);
|
4554 |
+
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
|
4555 |
+
var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),
|
4556 |
+
Math.min(coords.top, endCoords.top) - margin,
|
4557 |
+
Math.max(coords.left, endCoords.left),
|
4558 |
+
Math.max(coords.bottom, endCoords.bottom) + margin);
|
4559 |
+
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
|
4560 |
+
if (scrollPos.scrollTop != null) {
|
4561 |
+
setScrollTop(cm, scrollPos.scrollTop);
|
4562 |
+
if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
|
4563 |
+
}
|
4564 |
+
if (scrollPos.scrollLeft != null) {
|
4565 |
+
setScrollLeft(cm, scrollPos.scrollLeft);
|
4566 |
+
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;
|
4567 |
+
}
|
4568 |
+
if (!changed) break;
|
4569 |
+
}
|
4570 |
+
return coords;
|
4571 |
+
}
|
4572 |
+
|
4573 |
+
// Scroll a given set of coordinates into view (immediately).
|
4574 |
+
function scrollIntoView(cm, x1, y1, x2, y2) {
|
4575 |
+
var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
|
4576 |
+
if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
|
4577 |
+
if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
|
4578 |
+
}
|
4579 |
+
|
4580 |
+
// Calculate a new scroll position needed to scroll the given
|
4581 |
+
// rectangle into view. Returns an object with scrollTop and
|
4582 |
+
// scrollLeft properties. When these are undefined, the
|
4583 |
+
// vertical/horizontal position does not need to be adjusted.
|
4584 |
+
function calculateScrollPos(cm, x1, y1, x2, y2) {
|
4585 |
+
var display = cm.display, snapMargin = textHeight(cm.display);
|
4586 |
+
if (y1 < 0) y1 = 0;
|
4587 |
+
var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
|
4588 |
+
var screen = displayHeight(cm), result = {};
|
4589 |
+
if (y2 - y1 > screen) y2 = y1 + screen;
|
4590 |
+
var docBottom = cm.doc.height + paddingVert(display);
|
4591 |
+
var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;
|
4592 |
+
if (y1 < screentop) {
|
4593 |
+
result.scrollTop = atTop ? 0 : y1;
|
4594 |
+
} else if (y2 > screentop + screen) {
|
4595 |
+
var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);
|
4596 |
+
if (newTop != screentop) result.scrollTop = newTop;
|
4597 |
+
}
|
4598 |
+
|
4599 |
+
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
|
4600 |
+
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
|
4601 |
+
var tooWide = x2 - x1 > screenw;
|
4602 |
+
if (tooWide) x2 = x1 + screenw;
|
4603 |
+
if (x1 < 10)
|
4604 |
+
result.scrollLeft = 0;
|
4605 |
+
else if (x1 < screenleft)
|
4606 |
+
result.scrollLeft = Math.max(0, x1 - (tooWide ? 0 : 10));
|
4607 |
+
else if (x2 > screenw + screenleft - 3)
|
4608 |
+
result.scrollLeft = x2 + (tooWide ? 0 : 10) - screenw;
|
4609 |
+
return result;
|
4610 |
+
}
|
4611 |
+
|
4612 |
+
// Store a relative adjustment to the scroll position in the current
|
4613 |
+
// operation (to be applied when the operation finishes).
|
4614 |
+
function addToScrollPos(cm, left, top) {
|
4615 |
+
if (left != null || top != null) resolveScrollToPos(cm);
|
4616 |
+
if (left != null)
|
4617 |
+
cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left;
|
4618 |
+
if (top != null)
|
4619 |
+
cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
|
4620 |
+
}
|
4621 |
+
|
4622 |
+
// Make sure that at the end of the operation the current cursor is
|
4623 |
+
// shown.
|
4624 |
+
function ensureCursorVisible(cm) {
|
4625 |
+
resolveScrollToPos(cm);
|
4626 |
+
var cur = cm.getCursor(), from = cur, to = cur;
|
4627 |
+
if (!cm.options.lineWrapping) {
|
4628 |
+
from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur;
|
4629 |
+
to = Pos(cur.line, cur.ch + 1);
|
4630 |
+
}
|
4631 |
+
cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin, isCursor: true};
|
4632 |
+
}
|
4633 |
+
|
4634 |
+
// When an operation has its scrollToPos property set, and another
|
4635 |
+
// scroll action is applied before the end of the operation, this
|
4636 |
+
// 'simulates' scrolling that position into view in a cheap way, so
|
4637 |
+
// that the effect of intermediate scroll commands is not ignored.
|
4638 |
+
function resolveScrollToPos(cm) {
|
4639 |
+
var range = cm.curOp.scrollToPos;
|
4640 |
+
if (range) {
|
4641 |
+
cm.curOp.scrollToPos = null;
|
4642 |
+
var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
|
4643 |
+
var sPos = calculateScrollPos(cm, Math.min(from.left, to.left),
|
4644 |
+
Math.min(from.top, to.top) - range.margin,
|
4645 |
+
Math.max(from.right, to.right),
|
4646 |
+
Math.max(from.bottom, to.bottom) + range.margin);
|
4647 |
+
cm.scrollTo(sPos.scrollLeft, sPos.scrollTop);
|
4648 |
+
}
|
4649 |
+
}
|
4650 |
+
|
4651 |
+
// API UTILITIES
|
4652 |
+
|
4653 |
+
// Indent the given line. The how parameter can be "smart",
|
4654 |
+
// "add"/null, "subtract", or "prev". When aggressive is false
|
4655 |
+
// (typically set to true for forced single-line indents), empty
|
4656 |
+
// lines are not indented, and places where the mode returns Pass
|
4657 |
+
// are left alone.
|
4658 |
+
function indentLine(cm, n, how, aggressive) {
|
4659 |
+
var doc = cm.doc, state;
|
4660 |
+
if (how == null) how = "add";
|
4661 |
+
if (how == "smart") {
|
4662 |
+
// Fall back to "prev" when the mode doesn't have an indentation
|
4663 |
+
// method.
|
4664 |
+
if (!doc.mode.indent) how = "prev";
|
4665 |
+
else state = getStateBefore(cm, n);
|
4666 |
+
}
|
4667 |
+
|
4668 |
+
var tabSize = cm.options.tabSize;
|
4669 |
+
var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
|
4670 |
+
if (line.stateAfter) line.stateAfter = null;
|
4671 |
+
var curSpaceString = line.text.match(/^\s*/)[0], indentation;
|
4672 |
+
if (!aggressive && !/\S/.test(line.text)) {
|
4673 |
+
indentation = 0;
|
4674 |
+
how = "not";
|
4675 |
+
} else if (how == "smart") {
|
4676 |
+
indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
|
4677 |
+
if (indentation == Pass || indentation > 150) {
|
4678 |
+
if (!aggressive) return;
|
4679 |
+
how = "prev";
|
4680 |
+
}
|
4681 |
+
}
|
4682 |
+
if (how == "prev") {
|
4683 |
+
if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
|
4684 |
+
else indentation = 0;
|
4685 |
+
} else if (how == "add") {
|
4686 |
+
indentation = curSpace + cm.options.indentUnit;
|
4687 |
+
} else if (how == "subtract") {
|
4688 |
+
indentation = curSpace - cm.options.indentUnit;
|
4689 |
+
} else if (typeof how == "number") {
|
4690 |
+
indentation = curSpace + how;
|
4691 |
+
}
|
4692 |
+
indentation = Math.max(0, indentation);
|
4693 |
+
|
4694 |
+
var indentString = "", pos = 0;
|
4695 |
+
if (cm.options.indentWithTabs)
|
4696 |
+
for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
|
4697 |
+
if (pos < indentation) indentString += spaceStr(indentation - pos);
|
4698 |
+
|
4699 |
+
if (indentString != curSpaceString) {
|
4700 |
+
replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
|
4701 |
+
line.stateAfter = null;
|
4702 |
+
return true;
|
4703 |
+
} else {
|
4704 |
+
// Ensure that, if the cursor was in the whitespace at the start
|
4705 |
+
// of the line, it is moved to the end of that space.
|
4706 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4707 |
+
var range = doc.sel.ranges[i];
|
4708 |
+
if (range.head.line == n && range.head.ch < curSpaceString.length) {
|
4709 |
+
var pos = Pos(n, curSpaceString.length);
|
4710 |
+
replaceOneSelection(doc, i, new Range(pos, pos));
|
4711 |
+
break;
|
4712 |
+
}
|
4713 |
+
}
|
4714 |
+
}
|
4715 |
+
}
|
4716 |
+
|
4717 |
+
// Utility for applying a change to a line by handle or number,
|
4718 |
+
// returning the number and optionally registering the line as
|
4719 |
+
// changed.
|
4720 |
+
function changeLine(doc, handle, changeType, op) {
|
4721 |
+
var no = handle, line = handle;
|
4722 |
+
if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
|
4723 |
+
else no = lineNo(handle);
|
4724 |
+
if (no == null) return null;
|
4725 |
+
if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType);
|
4726 |
+
return line;
|
4727 |
+
}
|
4728 |
+
|
4729 |
+
// Helper for deleting text near the selection(s), used to implement
|
4730 |
+
// backspace, delete, and similar functionality.
|
4731 |
+
function deleteNearSelection(cm, compute) {
|
4732 |
+
var ranges = cm.doc.sel.ranges, kill = [];
|
4733 |
+
// Build up a set of ranges to kill first, merging overlapping
|
4734 |
+
// ranges.
|
4735 |
+
for (var i = 0; i < ranges.length; i++) {
|
4736 |
+
var toKill = compute(ranges[i]);
|
4737 |
+
while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
|
4738 |
+
var replaced = kill.pop();
|
4739 |
+
if (cmp(replaced.from, toKill.from) < 0) {
|
4740 |
+
toKill.from = replaced.from;
|
4741 |
+
break;
|
4742 |
+
}
|
4743 |
+
}
|
4744 |
+
kill.push(toKill);
|
4745 |
+
}
|
4746 |
+
// Next, remove those actual ranges.
|
4747 |
+
runInOp(cm, function() {
|
4748 |
+
for (var i = kill.length - 1; i >= 0; i--)
|
4749 |
+
replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete");
|
4750 |
+
ensureCursorVisible(cm);
|
4751 |
+
});
|
4752 |
+
}
|
4753 |
+
|
4754 |
+
// Used for horizontal relative motion. Dir is -1 or 1 (left or
|
4755 |
+
// right), unit can be "char", "column" (like char, but doesn't
|
4756 |
+
// cross line boundaries), "word" (across next word), or "group" (to
|
4757 |
+
// the start of next group of word or non-word-non-whitespace
|
4758 |
+
// chars). The visually param controls whether, in right-to-left
|
4759 |
+
// text, direction 1 means to move towards the next index in the
|
4760 |
+
// string, or towards the character to the right of the current
|
4761 |
+
// position. The resulting position will have a hitSide=true
|
4762 |
+
// property if it reached the end of the document.
|
4763 |
+
function findPosH(doc, pos, dir, unit, visually) {
|
4764 |
+
var line = pos.line, ch = pos.ch, origDir = dir;
|
4765 |
+
var lineObj = getLine(doc, line);
|
4766 |
+
var possible = true;
|
4767 |
+
function findNextLine() {
|
4768 |
+
var l = line + dir;
|
4769 |
+
if (l < doc.first || l >= doc.first + doc.size) return (possible = false);
|
4770 |
+
line = l;
|
4771 |
+
return lineObj = getLine(doc, l);
|
4772 |
+
}
|
4773 |
+
function moveOnce(boundToLine) {
|
4774 |
+
var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
|
4775 |
+
if (next == null) {
|
4776 |
+
if (!boundToLine && findNextLine()) {
|
4777 |
+
if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
|
4778 |
+
else ch = dir < 0 ? lineObj.text.length : 0;
|
4779 |
+
} else return (possible = false);
|
4780 |
+
} else ch = next;
|
4781 |
+
return true;
|
4782 |
+
}
|
4783 |
+
|
4784 |
+
if (unit == "char") moveOnce();
|
4785 |
+
else if (unit == "column") moveOnce(true);
|
4786 |
+
else if (unit == "word" || unit == "group") {
|
4787 |
+
var sawType = null, group = unit == "group";
|
4788 |
+
var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
|
4789 |
+
for (var first = true;; first = false) {
|
4790 |
+
if (dir < 0 && !moveOnce(!first)) break;
|
4791 |
+
var cur = lineObj.text.charAt(ch) || "\n";
|
4792 |
+
var type = isWordChar(cur, helper) ? "w"
|
4793 |
+
: group && cur == "\n" ? "n"
|
4794 |
+
: !group || /\s/.test(cur) ? null
|
4795 |
+
: "p";
|
4796 |
+
if (group && !first && !type) type = "s";
|
4797 |
+
if (sawType && sawType != type) {
|
4798 |
+
if (dir < 0) {dir = 1; moveOnce();}
|
4799 |
+
break;
|
4800 |
+
}
|
4801 |
+
|
4802 |
+
if (type) sawType = type;
|
4803 |
+
if (dir > 0 && !moveOnce(!first)) break;
|
4804 |
+
}
|
4805 |
+
}
|
4806 |
+
var result = skipAtomic(doc, Pos(line, ch), origDir, true);
|
4807 |
+
if (!possible) result.hitSide = true;
|
4808 |
+
return result;
|
4809 |
+
}
|
4810 |
+
|
4811 |
+
// For relative vertical movement. Dir may be -1 or 1. Unit can be
|
4812 |
+
// "page" or "line". The resulting position will have a hitSide=true
|
4813 |
+
// property if it reached the end of the document.
|
4814 |
+
function findPosV(cm, pos, dir, unit) {
|
4815 |
+
var doc = cm.doc, x = pos.left, y;
|
4816 |
+
if (unit == "page") {
|
4817 |
+
var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
|
4818 |
+
y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
|
4819 |
+
} else if (unit == "line") {
|
4820 |
+
y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
|
4821 |
+
}
|
4822 |
+
for (;;) {
|
4823 |
+
var target = coordsChar(cm, x, y);
|
4824 |
+
if (!target.outside) break;
|
4825 |
+
if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
|
4826 |
+
y += dir * 5;
|
4827 |
+
}
|
4828 |
+
return target;
|
4829 |
+
}
|
4830 |
+
|
4831 |
+
// EDITOR METHODS
|
4832 |
+
|
4833 |
+
// The publicly visible API. Note that methodOp(f) means
|
4834 |
+
// 'wrap f in an operation, performed on its `this` parameter'.
|
4835 |
+
|
4836 |
+
// This is not the complete set of editor methods. Most of the
|
4837 |
+
// methods defined on the Doc type are also injected into
|
4838 |
+
// CodeMirror.prototype, for backwards compatibility and
|
4839 |
+
// convenience.
|
4840 |
+
|
4841 |
+
CodeMirror.prototype = {
|
4842 |
+
constructor: CodeMirror,
|
4843 |
+
focus: function(){window.focus(); this.display.input.focus();},
|
4844 |
+
|
4845 |
+
setOption: function(option, value) {
|
4846 |
+
var options = this.options, old = options[option];
|
4847 |
+
if (options[option] == value && option != "mode") return;
|
4848 |
+
options[option] = value;
|
4849 |
+
if (optionHandlers.hasOwnProperty(option))
|
4850 |
+
operation(this, optionHandlers[option])(this, value, old);
|
4851 |
+
},
|
4852 |
+
|
4853 |
+
getOption: function(option) {return this.options[option];},
|
4854 |
+
getDoc: function() {return this.doc;},
|
4855 |
+
|
4856 |
+
addKeyMap: function(map, bottom) {
|
4857 |
+
this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
|
4858 |
+
},
|
4859 |
+
removeKeyMap: function(map) {
|
4860 |
+
var maps = this.state.keyMaps;
|
4861 |
+
for (var i = 0; i < maps.length; ++i)
|
4862 |
+
if (maps[i] == map || maps[i].name == map) {
|
4863 |
+
maps.splice(i, 1);
|
4864 |
+
return true;
|
4865 |
+
}
|
4866 |
+
},
|
4867 |
+
|
4868 |
+
addOverlay: methodOp(function(spec, options) {
|
4869 |
+
var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
|
4870 |
+
if (mode.startState) throw new Error("Overlays may not be stateful.");
|
4871 |
+
this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
|
4872 |
+
this.state.modeGen++;
|
4873 |
+
regChange(this);
|
4874 |
+
}),
|
4875 |
+
removeOverlay: methodOp(function(spec) {
|
4876 |
+
var overlays = this.state.overlays;
|
4877 |
+
for (var i = 0; i < overlays.length; ++i) {
|
4878 |
+
var cur = overlays[i].modeSpec;
|
4879 |
+
if (cur == spec || typeof spec == "string" && cur.name == spec) {
|
4880 |
+
overlays.splice(i, 1);
|
4881 |
+
this.state.modeGen++;
|
4882 |
+
regChange(this);
|
4883 |
+
return;
|
4884 |
+
}
|
4885 |
+
}
|
4886 |
+
}),
|
4887 |
+
|
4888 |
+
indentLine: methodOp(function(n, dir, aggressive) {
|
4889 |
+
if (typeof dir != "string" && typeof dir != "number") {
|
4890 |
+
if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
|
4891 |
+
else dir = dir ? "add" : "subtract";
|
4892 |
+
}
|
4893 |
+
if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);
|
4894 |
+
}),
|
4895 |
+
indentSelection: methodOp(function(how) {
|
4896 |
+
var ranges = this.doc.sel.ranges, end = -1;
|
4897 |
+
for (var i = 0; i < ranges.length; i++) {
|
4898 |
+
var range = ranges[i];
|
4899 |
+
if (!range.empty()) {
|
4900 |
+
var from = range.from(), to = range.to();
|
4901 |
+
var start = Math.max(end, from.line);
|
4902 |
+
end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
|
4903 |
+
for (var j = start; j < end; ++j)
|
4904 |
+
indentLine(this, j, how);
|
4905 |
+
var newRanges = this.doc.sel.ranges;
|
4906 |
+
if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
|
4907 |
+
replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);
|
4908 |
+
} else if (range.head.line > end) {
|
4909 |
+
indentLine(this, range.head.line, how, true);
|
4910 |
+
end = range.head.line;
|
4911 |
+
if (i == this.doc.sel.primIndex) ensureCursorVisible(this);
|
4912 |
+
}
|
4913 |
+
}
|
4914 |
+
}),
|
4915 |
+
|
4916 |
+
// Fetch the parser token for a given character. Useful for hacks
|
4917 |
+
// that want to inspect the mode state (say, for completion).
|
4918 |
+
getTokenAt: function(pos, precise) {
|
4919 |
+
return takeToken(this, pos, precise);
|
4920 |
+
},
|
4921 |
+
|
4922 |
+
getLineTokens: function(line, precise) {
|
4923 |
+
return takeToken(this, Pos(line), precise, true);
|
4924 |
+
},
|
4925 |
+
|
4926 |
+
getTokenTypeAt: function(pos) {
|
4927 |
+
pos = clipPos(this.doc, pos);
|
4928 |
+
var styles = getLineStyles(this, getLine(this.doc, pos.line));
|
4929 |
+
var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
|
4930 |
+
var type;
|
4931 |
+
if (ch == 0) type = styles[2];
|
4932 |
+
else for (;;) {
|
4933 |
+
var mid = (before + after) >> 1;
|
4934 |
+
if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;
|
4935 |
+
else if (styles[mid * 2 + 1] < ch) before = mid + 1;
|
4936 |
+
else { type = styles[mid * 2 + 2]; break; }
|
4937 |
+
}
|
4938 |
+
var cut = type ? type.indexOf("cm-overlay ") : -1;
|
4939 |
+
return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1);
|
4940 |
+
},
|
4941 |
+
|
4942 |
+
getModeAt: function(pos) {
|
4943 |
+
var mode = this.doc.mode;
|
4944 |
+
if (!mode.innerMode) return mode;
|
4945 |
+
return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;
|
4946 |
+
},
|
4947 |
+
|
4948 |
+
getHelper: function(pos, type) {
|
4949 |
+
return this.getHelpers(pos, type)[0];
|
4950 |
+
},
|
4951 |
+
|
4952 |
+
getHelpers: function(pos, type) {
|
4953 |
+
var found = [];
|
4954 |
+
if (!helpers.hasOwnProperty(type)) return found;
|
4955 |
+
var help = helpers[type], mode = this.getModeAt(pos);
|
4956 |
+
if (typeof mode[type] == "string") {
|
4957 |
+
if (help[mode[type]]) found.push(help[mode[type]]);
|
4958 |
+
} else if (mode[type]) {
|
4959 |
+
for (var i = 0; i < mode[type].length; i++) {
|
4960 |
+
var val = help[mode[type][i]];
|
4961 |
+
if (val) found.push(val);
|
4962 |
+
}
|
4963 |
+
} else if (mode.helperType && help[mode.helperType]) {
|
4964 |
+
found.push(help[mode.helperType]);
|
4965 |
+
} else if (help[mode.name]) {
|
4966 |
+
found.push(help[mode.name]);
|
4967 |
+
}
|
4968 |
+
for (var i = 0; i < help._global.length; i++) {
|
4969 |
+
var cur = help._global[i];
|
4970 |
+
if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
|
4971 |
+
found.push(cur.val);
|
4972 |
+
}
|
4973 |
+
return found;
|
4974 |
+
},
|
4975 |
+
|
4976 |
+
getStateAfter: function(line, precise) {
|
4977 |
+
var doc = this.doc;
|
4978 |
+
line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
|
4979 |
+
return getStateBefore(this, line + 1, precise);
|
4980 |
+
},
|
4981 |
+
|
4982 |
+
cursorCoords: function(start, mode) {
|
4983 |
+
var pos, range = this.doc.sel.primary();
|
4984 |
+
if (start == null) pos = range.head;
|
4985 |
+
else if (typeof start == "object") pos = clipPos(this.doc, start);
|
4986 |
+
else pos = start ? range.from() : range.to();
|
4987 |
+
return cursorCoords(this, pos, mode || "page");
|
4988 |
+
},
|
4989 |
+
|
4990 |
+
charCoords: function(pos, mode) {
|
4991 |
+
return charCoords(this, clipPos(this.doc, pos), mode || "page");
|
4992 |
+
},
|
4993 |
+
|
4994 |
+
coordsChar: function(coords, mode) {
|
4995 |
+
coords = fromCoordSystem(this, coords, mode || "page");
|
4996 |
+
return coordsChar(this, coords.left, coords.top);
|
4997 |
+
},
|
4998 |
+
|
4999 |
+
lineAtHeight: function(height, mode) {
|
5000 |
+
height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
|
5001 |
+
return lineAtHeight(this.doc, height + this.display.viewOffset);
|
5002 |
+
},
|
5003 |
+
heightAtLine: function(line, mode) {
|
5004 |
+
var end = false, lineObj;
|
5005 |
+
if (typeof line == "number") {
|
5006 |
+
var last = this.doc.first + this.doc.size - 1;
|
5007 |
+
if (line < this.doc.first) line = this.doc.first;
|
5008 |
+
else if (line > last) { line = last; end = true; }
|
5009 |
+
lineObj = getLine(this.doc, line);
|
5010 |
+
} else {
|
5011 |
+
lineObj = line;
|
5012 |
+
}
|
5013 |
+
return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page").top +
|
5014 |
+
(end ? this.doc.height - heightAtLine(lineObj) : 0);
|
5015 |
+
},
|
5016 |
+
|
5017 |
+
defaultTextHeight: function() { return textHeight(this.display); },
|
5018 |
+
defaultCharWidth: function() { return charWidth(this.display); },
|
5019 |
+
|
5020 |
+
setGutterMarker: methodOp(function(line, gutterID, value) {
|
5021 |
+
return changeLine(this.doc, line, "gutter", function(line) {
|
5022 |
+
var markers = line.gutterMarkers || (line.gutterMarkers = {});
|
5023 |
+
markers[gutterID] = value;
|
5024 |
+
if (!value && isEmpty(markers)) line.gutterMarkers = null;
|
5025 |
+
return true;
|
5026 |
+
});
|
5027 |
+
}),
|
5028 |
+
|
5029 |
+
clearGutter: methodOp(function(gutterID) {
|
5030 |
+
var cm = this, doc = cm.doc, i = doc.first;
|
5031 |
+
doc.iter(function(line) {
|
5032 |
+
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
|
5033 |
+
line.gutterMarkers[gutterID] = null;
|
5034 |
+
regLineChange(cm, i, "gutter");
|
5035 |
+
if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
|
5036 |
+
}
|
5037 |
+
++i;
|
5038 |
+
});
|
5039 |
+
}),
|
5040 |
+
|
5041 |
+
lineInfo: function(line) {
|
5042 |
+
if (typeof line == "number") {
|
5043 |
+
if (!isLine(this.doc, line)) return null;
|
5044 |
+
var n = line;
|
5045 |
+
line = getLine(this.doc, line);
|
5046 |
+
if (!line) return null;
|
5047 |
+
} else {
|
5048 |
+
var n = lineNo(line);
|
5049 |
+
if (n == null) return null;
|
5050 |
+
}
|
5051 |
+
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
|
5052 |
+
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
|
5053 |
+
widgets: line.widgets};
|
5054 |
+
},
|
5055 |
+
|
5056 |
+
getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo};},
|
5057 |
+
|
5058 |
+
addWidget: function(pos, node, scroll, vert, horiz) {
|
5059 |
+
var display = this.display;
|
5060 |
+
pos = cursorCoords(this, clipPos(this.doc, pos));
|
5061 |
+
var top = pos.bottom, left = pos.left;
|
5062 |
+
node.style.position = "absolute";
|
5063 |
+
node.setAttribute("cm-ignore-events", "true");
|
5064 |
+
this.display.input.setUneditable(node);
|
5065 |
+
display.sizer.appendChild(node);
|
5066 |
+
if (vert == "over") {
|
5067 |
+
top = pos.top;
|
5068 |
+
} else if (vert == "above" || vert == "near") {
|
5069 |
+
var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
|
5070 |
+
hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
|
5071 |
+
// Default to positioning above (if specified and possible); otherwise default to positioning below
|
5072 |
+
if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
|
5073 |
+
top = pos.top - node.offsetHeight;
|
5074 |
+
else if (pos.bottom + node.offsetHeight <= vspace)
|
5075 |
+
top = pos.bottom;
|
5076 |
+
if (left + node.offsetWidth > hspace)
|
5077 |
+
left = hspace - node.offsetWidth;
|
5078 |
+
}
|
5079 |
+
node.style.top = top + "px";
|
5080 |
+
node.style.left = node.style.right = "";
|
5081 |
+
if (horiz == "right") {
|
5082 |
+
left = display.sizer.clientWidth - node.offsetWidth;
|
5083 |
+
node.style.right = "0px";
|
5084 |
+
} else {
|
5085 |
+
if (horiz == "left") left = 0;
|
5086 |
+
else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
|
5087 |
+
node.style.left = left + "px";
|
5088 |
+
}
|
5089 |
+
if (scroll)
|
5090 |
+
scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
|
5091 |
+
},
|
5092 |
+
|
5093 |
+
triggerOnKeyDown: methodOp(onKeyDown),
|
5094 |
+
triggerOnKeyPress: methodOp(onKeyPress),
|
5095 |
+
triggerOnKeyUp: onKeyUp,
|
5096 |
+
|
5097 |
+
execCommand: function(cmd) {
|
5098 |
+
if (commands.hasOwnProperty(cmd))
|
5099 |
+
return commands[cmd].call(null, this);
|
5100 |
+
},
|
5101 |
+
|
5102 |
+
triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
|
5103 |
+
|
5104 |
+
findPosH: function(from, amount, unit, visually) {
|
5105 |
+
var dir = 1;
|
5106 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
5107 |
+
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
|
5108 |
+
cur = findPosH(this.doc, cur, dir, unit, visually);
|
5109 |
+
if (cur.hitSide) break;
|
5110 |
+
}
|
5111 |
+
return cur;
|
5112 |
+
},
|
5113 |
+
|
5114 |
+
moveH: methodOp(function(dir, unit) {
|
5115 |
+
var cm = this;
|
5116 |
+
cm.extendSelectionsBy(function(range) {
|
5117 |
+
if (cm.display.shift || cm.doc.extend || range.empty())
|
5118 |
+
return findPosH(cm.doc, range.head, dir, unit, cm.options.rtlMoveVisually);
|
5119 |
+
else
|
5120 |
+
return dir < 0 ? range.from() : range.to();
|
5121 |
+
}, sel_move);
|
5122 |
+
}),
|
5123 |
+
|
5124 |
+
deleteH: methodOp(function(dir, unit) {
|
5125 |
+
var sel = this.doc.sel, doc = this.doc;
|
5126 |
+
if (sel.somethingSelected())
|
5127 |
+
doc.replaceSelection("", null, "+delete");
|
5128 |
+
else
|
5129 |
+
deleteNearSelection(this, function(range) {
|
5130 |
+
var other = findPosH(doc, range.head, dir, unit, false);
|
5131 |
+
return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other};
|
5132 |
+
});
|
5133 |
+
}),
|
5134 |
+
|
5135 |
+
findPosV: function(from, amount, unit, goalColumn) {
|
5136 |
+
var dir = 1, x = goalColumn;
|
5137 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
5138 |
+
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
|
5139 |
+
var coords = cursorCoords(this, cur, "div");
|
5140 |
+
if (x == null) x = coords.left;
|
5141 |
+
else coords.left = x;
|
5142 |
+
cur = findPosV(this, coords, dir, unit);
|
5143 |
+
if (cur.hitSide) break;
|
5144 |
+
}
|
5145 |
+
return cur;
|
5146 |
+
},
|
5147 |
+
|
5148 |
+
moveV: methodOp(function(dir, unit) {
|
5149 |
+
var cm = this, doc = this.doc, goals = [];
|
5150 |
+
var collapse = !cm.display.shift && !doc.extend && doc.sel.somethingSelected();
|
5151 |
+
doc.extendSelectionsBy(function(range) {
|
5152 |
+
if (collapse)
|
5153 |
+
return dir < 0 ? range.from() : range.to();
|
5154 |
+
var headPos = cursorCoords(cm, range.head, "div");
|
5155 |
+
if (range.goalColumn != null) headPos.left = range.goalColumn;
|
5156 |
+
goals.push(headPos.left);
|
5157 |
+
var pos = findPosV(cm, headPos, dir, unit);
|
5158 |
+
if (unit == "page" && range == doc.sel.primary())
|
5159 |
+
addToScrollPos(cm, null, charCoords(cm, pos, "div").top - headPos.top);
|
5160 |
+
return pos;
|
5161 |
+
}, sel_move);
|
5162 |
+
if (goals.length) for (var i = 0; i < doc.sel.ranges.length; i++)
|
5163 |
+
doc.sel.ranges[i].goalColumn = goals[i];
|
5164 |
+
}),
|
5165 |
+
|
5166 |
+
// Find the word at the given position (as returned by coordsChar).
|
5167 |
+
findWordAt: function(pos) {
|
5168 |
+
var doc = this.doc, line = getLine(doc, pos.line).text;
|
5169 |
+
var start = pos.ch, end = pos.ch;
|
5170 |
+
if (line) {
|
5171 |
+
var helper = this.getHelper(pos, "wordChars");
|
5172 |
+
if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
|
5173 |
+
var startChar = line.charAt(start);
|
5174 |
+
var check = isWordChar(startChar, helper)
|
5175 |
+
? function(ch) { return isWordChar(ch, helper); }
|
5176 |
+
: /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
|
5177 |
+
: function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
|
5178 |
+
while (start > 0 && check(line.charAt(start - 1))) --start;
|
5179 |
+
while (end < line.length && check(line.charAt(end))) ++end;
|
5180 |
+
}
|
5181 |
+
return new Range(Pos(pos.line, start), Pos(pos.line, end));
|
5182 |
+
},
|
5183 |
+
|
5184 |
+
toggleOverwrite: function(value) {
|
5185 |
+
if (value != null && value == this.state.overwrite) return;
|
5186 |
+
if (this.state.overwrite = !this.state.overwrite)
|
5187 |
+
addClass(this.display.cursorDiv, "CodeMirror-overwrite");
|
5188 |
+
else
|
5189 |
+
rmClass(this.display.cursorDiv, "CodeMirror-overwrite");
|
5190 |
+
|
5191 |
+
signal(this, "overwriteToggle", this, this.state.overwrite);
|
5192 |
+
},
|
5193 |
+
hasFocus: function() { return this.display.input.getField() == activeElt(); },
|
5194 |
+
|
5195 |
+
scrollTo: methodOp(function(x, y) {
|
5196 |
+
if (x != null || y != null) resolveScrollToPos(this);
|
5197 |
+
if (x != null) this.curOp.scrollLeft = x;
|
5198 |
+
if (y != null) this.curOp.scrollTop = y;
|
5199 |
+
}),
|
5200 |
+
getScrollInfo: function() {
|
5201 |
+
var scroller = this.display.scroller;
|
5202 |
+
return {left: scroller.scrollLeft, top: scroller.scrollTop,
|
5203 |
+
height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
|
5204 |
+
width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
|
5205 |
+
clientHeight: displayHeight(this), clientWidth: displayWidth(this)};
|
5206 |
+
},
|
5207 |
+
|
5208 |
+
scrollIntoView: methodOp(function(range, margin) {
|
5209 |
+
if (range == null) {
|
5210 |
+
range = {from: this.doc.sel.primary().head, to: null};
|
5211 |
+
if (margin == null) margin = this.options.cursorScrollMargin;
|
5212 |
+
} else if (typeof range == "number") {
|
5213 |
+
range = {from: Pos(range, 0), to: null};
|
5214 |
+
} else if (range.from == null) {
|
5215 |
+
range = {from: range, to: null};
|
5216 |
+
}
|
5217 |
+
if (!range.to) range.to = range.from;
|
5218 |
+
range.margin = margin || 0;
|
5219 |
+
|
5220 |
+
if (range.from.line != null) {
|
5221 |
+
resolveScrollToPos(this);
|
5222 |
+
this.curOp.scrollToPos = range;
|
5223 |
+
} else {
|
5224 |
+
var sPos = calculateScrollPos(this, Math.min(range.from.left, range.to.left),
|
5225 |
+
Math.min(range.from.top, range.to.top) - range.margin,
|
5226 |
+
Math.max(range.from.right, range.to.right),
|
5227 |
+
Math.max(range.from.bottom, range.to.bottom) + range.margin);
|
5228 |
+
this.scrollTo(sPos.scrollLeft, sPos.scrollTop);
|
5229 |
+
}
|
5230 |
+
}),
|
5231 |
+
|
5232 |
+
setSize: methodOp(function(width, height) {
|
5233 |
+
var cm = this;
|
5234 |
+
function interpret(val) {
|
5235 |
+
return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
|
5236 |
+
}
|
5237 |
+
if (width != null) cm.display.wrapper.style.width = interpret(width);
|
5238 |
+
if (height != null) cm.display.wrapper.style.height = interpret(height);
|
5239 |
+
if (cm.options.lineWrapping) clearLineMeasurementCache(this);
|
5240 |
+
var lineNo = cm.display.viewFrom;
|
5241 |
+
cm.doc.iter(lineNo, cm.display.viewTo, function(line) {
|
5242 |
+
if (line.widgets) for (var i = 0; i < line.widgets.length; i++)
|
5243 |
+
if (line.widgets[i].noHScroll) { regLineChange(cm, lineNo, "widget"); break; }
|
5244 |
+
++lineNo;
|
5245 |
+
});
|
5246 |
+
cm.curOp.forceUpdate = true;
|
5247 |
+
signal(cm, "refresh", this);
|
5248 |
+
}),
|
5249 |
+
|
5250 |
+
operation: function(f){return runInOp(this, f);},
|
5251 |
+
|
5252 |
+
refresh: methodOp(function() {
|
5253 |
+
var oldHeight = this.display.cachedTextHeight;
|
5254 |
+
regChange(this);
|
5255 |
+
this.curOp.forceUpdate = true;
|
5256 |
+
clearCaches(this);
|
5257 |
+
this.scrollTo(this.doc.scrollLeft, this.doc.scrollTop);
|
5258 |
+
updateGutterSpace(this);
|
5259 |
+
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
|
5260 |
+
estimateLineHeights(this);
|
5261 |
+
signal(this, "refresh", this);
|
5262 |
+
}),
|
5263 |
+
|
5264 |
+
swapDoc: methodOp(function(doc) {
|
5265 |
+
var old = this.doc;
|
5266 |
+
old.cm = null;
|
5267 |
+
attachDoc(this, doc);
|
5268 |
+
clearCaches(this);
|
5269 |
+
this.display.input.reset();
|
5270 |
+
this.scrollTo(doc.scrollLeft, doc.scrollTop);
|
5271 |
+
this.curOp.forceScroll = true;
|
5272 |
+
signalLater(this, "swapDoc", this, old);
|
5273 |
+
return old;
|
5274 |
+
}),
|
5275 |
+
|
5276 |
+
getInputField: function(){return this.display.input.getField();},
|
5277 |
+
getWrapperElement: function(){return this.display.wrapper;},
|
5278 |
+
getScrollerElement: function(){return this.display.scroller;},
|
5279 |
+
getGutterElement: function(){return this.display.gutters;}
|
5280 |
+
};
|
5281 |
+
eventMixin(CodeMirror);
|
5282 |
+
|
5283 |
+
// OPTION DEFAULTS
|
5284 |
+
|
5285 |
+
// The default configuration options.
|
5286 |
+
var defaults = CodeMirror.defaults = {};
|
5287 |
+
// Functions to run when options are changed.
|
5288 |
+
var optionHandlers = CodeMirror.optionHandlers = {};
|
5289 |
+
|
5290 |
+
function option(name, deflt, handle, notOnInit) {
|
5291 |
+
CodeMirror.defaults[name] = deflt;
|
5292 |
+
if (handle) optionHandlers[name] =
|
5293 |
+
notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
|
5294 |
+
}
|
5295 |
+
|
5296 |
+
// Passed to option handlers when there is no old value.
|
5297 |
+
var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
|
5298 |
+
|
5299 |
+
// These two are, on init, called from the constructor because they
|
5300 |
+
// have to be initialized before the editor can start at all.
|
5301 |
+
option("value", "", function(cm, val) {
|
5302 |
+
cm.setValue(val);
|
5303 |
+
}, true);
|
5304 |
+
option("mode", null, function(cm, val) {
|
5305 |
+
cm.doc.modeOption = val;
|
5306 |
+
loadMode(cm);
|
5307 |
+
}, true);
|
5308 |
+
|
5309 |
+
option("indentUnit", 2, loadMode, true);
|
5310 |
+
option("indentWithTabs", false);
|
5311 |
+
option("smartIndent", true);
|
5312 |
+
option("tabSize", 4, function(cm) {
|
5313 |
+
resetModeState(cm);
|
5314 |
+
clearCaches(cm);
|
5315 |
+
regChange(cm);
|
5316 |
+
}, true);
|
5317 |
+
option("lineSeparator", null, function(cm, val) {
|
5318 |
+
cm.doc.lineSep = val;
|
5319 |
+
if (!val) return;
|
5320 |
+
var newBreaks = [], lineNo = cm.doc.first;
|
5321 |
+
cm.doc.iter(function(line) {
|
5322 |
+
for (var pos = 0;;) {
|
5323 |
+
var found = line.text.indexOf(val, pos);
|
5324 |
+
if (found == -1) break;
|
5325 |
+
pos = found + val.length;
|
5326 |
+
newBreaks.push(Pos(lineNo, found));
|
5327 |
+
}
|
5328 |
+
lineNo++;
|
5329 |
+
});
|
5330 |
+
for (var i = newBreaks.length - 1; i >= 0; i--)
|
5331 |
+
replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))
|
5332 |
+
});
|
5333 |
+
option("specialChars", /[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g, function(cm, val, old) {
|
5334 |
+
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
|
5335 |
+
if (old != CodeMirror.Init) cm.refresh();
|
5336 |
+
});
|
5337 |
+
option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function(cm) {cm.refresh();}, true);
|
5338 |
+
option("electricChars", true);
|
5339 |
+
option("inputStyle", mobile ? "contenteditable" : "textarea", function() {
|
5340 |
+
throw new Error("inputStyle can not (yet) be changed in a running editor"); // FIXME
|
5341 |
+
}, true);
|
5342 |
+
option("rtlMoveVisually", !windows);
|
5343 |
+
option("wholeLineUpdateBefore", true);
|
5344 |
+
|
5345 |
+
option("theme", "default", function(cm) {
|
5346 |
+
themeChanged(cm);
|
5347 |
+
guttersChanged(cm);
|
5348 |
+
}, true);
|
5349 |
+
option("keyMap", "default", function(cm, val, old) {
|
5350 |
+
var next = getKeyMap(val);
|
5351 |
+
var prev = old != CodeMirror.Init && getKeyMap(old);
|
5352 |
+
if (prev && prev.detach) prev.detach(cm, next);
|
5353 |
+
if (next.attach) next.attach(cm, prev || null);
|
5354 |
+
});
|
5355 |
+
option("extraKeys", null);
|
5356 |
+
|
5357 |
+
option("lineWrapping", false, wrappingChanged, true);
|
5358 |
+
option("gutters", [], function(cm) {
|
5359 |
+
setGuttersForLineNumbers(cm.options);
|
5360 |
+
guttersChanged(cm);
|
5361 |
+
}, true);
|
5362 |
+
option("fixedGutter", true, function(cm, val) {
|
5363 |
+
cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
|
5364 |
+
cm.refresh();
|
5365 |
+
}, true);
|
5366 |
+
option("coverGutterNextToScrollbar", false, function(cm) {updateScrollbars(cm);}, true);
|
5367 |
+
option("scrollbarStyle", "native", function(cm) {
|
5368 |
+
initScrollbars(cm);
|
5369 |
+
updateScrollbars(cm);
|
5370 |
+
cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
|
5371 |
+
cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
|
5372 |
+
}, true);
|
5373 |
+
option("lineNumbers", false, function(cm) {
|
5374 |
+
setGuttersForLineNumbers(cm.options);
|
5375 |
+
guttersChanged(cm);
|
5376 |
+
}, true);
|
5377 |
+
option("firstLineNumber", 1, guttersChanged, true);
|
5378 |
+
option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
|
5379 |
+
option("showCursorWhenSelecting", false, updateSelection, true);
|
5380 |
+
|
5381 |
+
option("resetSelectionOnContextMenu", true);
|
5382 |
+
option("lineWiseCopyCut", true);
|
5383 |
+
|
5384 |
+
option("readOnly", false, function(cm, val) {
|
5385 |
+
if (val == "nocursor") {
|
5386 |
+
onBlur(cm);
|
5387 |
+
cm.display.input.blur();
|
5388 |
+
cm.display.disabled = true;
|
5389 |
+
} else {
|
5390 |
+
cm.display.disabled = false;
|
5391 |
+
if (!val) cm.display.input.reset();
|
5392 |
+
}
|
5393 |
+
});
|
5394 |
+
option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);
|
5395 |
+
option("dragDrop", true, dragDropChanged);
|
5396 |
+
|
5397 |
+
option("cursorBlinkRate", 530);
|
5398 |
+
option("cursorScrollMargin", 0);
|
5399 |
+
option("cursorHeight", 1, updateSelection, true);
|
5400 |
+
option("singleCursorHeightPerLine", true, updateSelection, true);
|
5401 |
+
option("workTime", 100);
|
5402 |
+
option("workDelay", 100);
|
5403 |
+
option("flattenSpans", true, resetModeState, true);
|
5404 |
+
option("addModeClass", false, resetModeState, true);
|
5405 |
+
option("pollInterval", 100);
|
5406 |
+
option("undoDepth", 200, function(cm, val){cm.doc.history.undoDepth = val;});
|
5407 |
+
option("historyEventDelay", 1250);
|
5408 |
+
option("viewportMargin", 10, function(cm){cm.refresh();}, true);
|
5409 |
+
option("maxHighlightLength", 10000, resetModeState, true);
|
5410 |
+
option("moveInputWithCursor", true, function(cm, val) {
|
5411 |
+
if (!val) cm.display.input.resetPosition();
|
5412 |
+
});
|
5413 |
+
|
5414 |
+
option("tabindex", null, function(cm, val) {
|
5415 |
+
cm.display.input.getField().tabIndex = val || "";
|
5416 |
+
});
|
5417 |
+
option("autofocus", null);
|
5418 |
+
|
5419 |
+
// MODE DEFINITION AND QUERYING
|
5420 |
+
|
5421 |
+
// Known modes, by name and by MIME
|
5422 |
+
var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
|
5423 |
+
|
5424 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
5425 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
5426 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
5427 |
+
CodeMirror.defineMode = function(name, mode) {
|
5428 |
+
if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
|
5429 |
+
if (arguments.length > 2)
|
5430 |
+
mode.dependencies = Array.prototype.slice.call(arguments, 2);
|
5431 |
+
modes[name] = mode;
|
5432 |
+
};
|
5433 |
+
|
5434 |
+
CodeMirror.defineMIME = function(mime, spec) {
|
5435 |
+
mimeModes[mime] = spec;
|
5436 |
+
};
|
5437 |
+
|
5438 |
+
// Given a MIME type, a {name, ...options} config object, or a name
|
5439 |
+
// string, return a mode config object.
|
5440 |
+
CodeMirror.resolveMode = function(spec) {
|
5441 |
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
5442 |
+
spec = mimeModes[spec];
|
5443 |
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
5444 |
+
var found = mimeModes[spec.name];
|
5445 |
+
if (typeof found == "string") found = {name: found};
|
5446 |
+
spec = createObj(found, spec);
|
5447 |
+
spec.name = found.name;
|
5448 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
5449 |
+
return CodeMirror.resolveMode("application/xml");
|
5450 |
+
}
|
5451 |
+
if (typeof spec == "string") return {name: spec};
|
5452 |
+
else return spec || {name: "null"};
|
5453 |
+
};
|
5454 |
+
|
5455 |
+
// Given a mode spec (anything that resolveMode accepts), find and
|
5456 |
+
// initialize an actual mode object.
|
5457 |
+
CodeMirror.getMode = function(options, spec) {
|
5458 |
+
var spec = CodeMirror.resolveMode(spec);
|
5459 |
+
var mfactory = modes[spec.name];
|
5460 |
+
if (!mfactory) return CodeMirror.getMode(options, "text/plain");
|
5461 |
+
var modeObj = mfactory(options, spec);
|
5462 |
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
5463 |
+
var exts = modeExtensions[spec.name];
|
5464 |
+
for (var prop in exts) {
|
5465 |
+
if (!exts.hasOwnProperty(prop)) continue;
|
5466 |
+
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
|
5467 |
+
modeObj[prop] = exts[prop];
|
5468 |
+
}
|
5469 |
+
}
|
5470 |
+
modeObj.name = spec.name;
|
5471 |
+
if (spec.helperType) modeObj.helperType = spec.helperType;
|
5472 |
+
if (spec.modeProps) for (var prop in spec.modeProps)
|
5473 |
+
modeObj[prop] = spec.modeProps[prop];
|
5474 |
+
|
5475 |
+
return modeObj;
|
5476 |
+
};
|
5477 |
+
|
5478 |
+
// Minimal default mode.
|
5479 |
+
CodeMirror.defineMode("null", function() {
|
5480 |
+
return {token: function(stream) {stream.skipToEnd();}};
|
5481 |
+
});
|
5482 |
+
CodeMirror.defineMIME("text/plain", "null");
|
5483 |
+
|
5484 |
+
// This can be used to attach properties to mode objects from
|
5485 |
+
// outside the actual mode definition.
|
5486 |
+
var modeExtensions = CodeMirror.modeExtensions = {};
|
5487 |
+
CodeMirror.extendMode = function(mode, properties) {
|
5488 |
+
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
5489 |
+
copyObj(properties, exts);
|
5490 |
+
};
|
5491 |
+
|
5492 |
+
// EXTENSIONS
|
5493 |
+
|
5494 |
+
CodeMirror.defineExtension = function(name, func) {
|
5495 |
+
CodeMirror.prototype[name] = func;
|
5496 |
+
};
|
5497 |
+
CodeMirror.defineDocExtension = function(name, func) {
|
5498 |
+
Doc.prototype[name] = func;
|
5499 |
+
};
|
5500 |
+
CodeMirror.defineOption = option;
|
5501 |
+
|
5502 |
+
var initHooks = [];
|
5503 |
+
CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
|
5504 |
+
|
5505 |
+
var helpers = CodeMirror.helpers = {};
|
5506 |
+
CodeMirror.registerHelper = function(type, name, value) {
|
5507 |
+
if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []};
|
5508 |
+
helpers[type][name] = value;
|
5509 |
+
};
|
5510 |
+
CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
|
5511 |
+
CodeMirror.registerHelper(type, name, value);
|
5512 |
+
helpers[type]._global.push({pred: predicate, val: value});
|
5513 |
+
};
|
5514 |
+
|
5515 |
+
// MODE STATE HANDLING
|
5516 |
+
|
5517 |
+
// Utility functions for working with state. Exported because nested
|
5518 |
+
// modes need to do this for their inner modes.
|
5519 |
+
|
5520 |
+
var copyState = CodeMirror.copyState = function(mode, state) {
|
5521 |
+
if (state === true) return state;
|
5522 |
+
if (mode.copyState) return mode.copyState(state);
|
5523 |
+
var nstate = {};
|
5524 |
+
for (var n in state) {
|
5525 |
+
var val = state[n];
|
5526 |
+
if (val instanceof Array) val = val.concat([]);
|
5527 |
+
nstate[n] = val;
|
5528 |
+
}
|
5529 |
+
return nstate;
|
5530 |
+
};
|
5531 |
+
|
5532 |
+
var startState = CodeMirror.startState = function(mode, a1, a2) {
|
5533 |
+
return mode.startState ? mode.startState(a1, a2) : true;
|
5534 |
+
};
|
5535 |
+
|
5536 |
+
// Given a mode and a state (for that mode), find the inner mode and
|
5537 |
+
// state at the position that the state refers to.
|
5538 |
+
CodeMirror.innerMode = function(mode, state) {
|
5539 |
+
while (mode.innerMode) {
|
5540 |
+
var info = mode.innerMode(state);
|
5541 |
+
if (!info || info.mode == mode) break;
|
5542 |
+
state = info.state;
|
5543 |
+
mode = info.mode;
|
5544 |
+
}
|
5545 |
+
return info || {mode: mode, state: state};
|
5546 |
+
};
|
5547 |
+
|
5548 |
+
// STANDARD COMMANDS
|
5549 |
+
|
5550 |
+
// Commands are parameter-less actions that can be performed on an
|
5551 |
+
// editor, mostly used for keybindings.
|
5552 |
+
var commands = CodeMirror.commands = {
|
5553 |
+
selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);},
|
5554 |
+
singleSelection: function(cm) {
|
5555 |
+
cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll);
|
5556 |
+
},
|
5557 |
+
killLine: function(cm) {
|
5558 |
+
deleteNearSelection(cm, function(range) {
|
5559 |
+
if (range.empty()) {
|
5560 |
+
var len = getLine(cm.doc, range.head.line).text.length;
|
5561 |
+
if (range.head.ch == len && range.head.line < cm.lastLine())
|
5562 |
+
return {from: range.head, to: Pos(range.head.line + 1, 0)};
|
5563 |
+
else
|
5564 |
+
return {from: range.head, to: Pos(range.head.line, len)};
|
5565 |
+
} else {
|
5566 |
+
return {from: range.from(), to: range.to()};
|
5567 |
+
}
|
5568 |
+
});
|
5569 |
+
},
|
5570 |
+
deleteLine: function(cm) {
|
5571 |
+
deleteNearSelection(cm, function(range) {
|
5572 |
+
return {from: Pos(range.from().line, 0),
|
5573 |
+
to: clipPos(cm.doc, Pos(range.to().line + 1, 0))};
|
5574 |
+
});
|
5575 |
+
},
|
5576 |
+
delLineLeft: function(cm) {
|
5577 |
+
deleteNearSelection(cm, function(range) {
|
5578 |
+
return {from: Pos(range.from().line, 0), to: range.from()};
|
5579 |
+
});
|
5580 |
+
},
|
5581 |
+
delWrappedLineLeft: function(cm) {
|
5582 |
+
deleteNearSelection(cm, function(range) {
|
5583 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
5584 |
+
var leftPos = cm.coordsChar({left: 0, top: top}, "div");
|
5585 |
+
return {from: leftPos, to: range.from()};
|
5586 |
+
});
|
5587 |
+
},
|
5588 |
+
delWrappedLineRight: function(cm) {
|
5589 |
+
deleteNearSelection(cm, function(range) {
|
5590 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
5591 |
+
var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
|
5592 |
+
return {from: range.from(), to: rightPos };
|
5593 |
+
});
|
5594 |
+
},
|
5595 |
+
undo: function(cm) {cm.undo();},
|
5596 |
+
redo: function(cm) {cm.redo();},
|
5597 |
+
undoSelection: function(cm) {cm.undoSelection();},
|
5598 |
+
redoSelection: function(cm) {cm.redoSelection();},
|
5599 |
+
goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},
|
5600 |
+
goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},
|
5601 |
+
goLineStart: function(cm) {
|
5602 |
+
cm.extendSelectionsBy(function(range) { return lineStart(cm, range.head.line); },
|
5603 |
+
{origin: "+move", bias: 1});
|
5604 |
+
},
|
5605 |
+
goLineStartSmart: function(cm) {
|
5606 |
+
cm.extendSelectionsBy(function(range) {
|
5607 |
+
return lineStartSmart(cm, range.head);
|
5608 |
+
}, {origin: "+move", bias: 1});
|
5609 |
+
},
|
5610 |
+
goLineEnd: function(cm) {
|
5611 |
+
cm.extendSelectionsBy(function(range) { return lineEnd(cm, range.head.line); },
|
5612 |
+
{origin: "+move", bias: -1});
|
5613 |
+
},
|
5614 |
+
goLineRight: function(cm) {
|
5615 |
+
cm.extendSelectionsBy(function(range) {
|
5616 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
5617 |
+
return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
|
5618 |
+
}, sel_move);
|
5619 |
+
},
|
5620 |
+
goLineLeft: function(cm) {
|
5621 |
+
cm.extendSelectionsBy(function(range) {
|
5622 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
5623 |
+
return cm.coordsChar({left: 0, top: top}, "div");
|
5624 |
+
}, sel_move);
|
5625 |
+
},
|
5626 |
+
goLineLeftSmart: function(cm) {
|
5627 |
+
cm.extendSelectionsBy(function(range) {
|
5628 |
+
var top = cm.charCoords(range.head, "div").top + 5;
|
5629 |
+
var pos = cm.coordsChar({left: 0, top: top}, "div");
|
5630 |
+
if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head);
|
5631 |
+
return pos;
|
5632 |
+
}, sel_move);
|
5633 |
+
},
|
5634 |
+
goLineUp: function(cm) {cm.moveV(-1, "line");},
|
5635 |
+
goLineDown: function(cm) {cm.moveV(1, "line");},
|
5636 |
+
goPageUp: function(cm) {cm.moveV(-1, "page");},
|
5637 |
+
goPageDown: function(cm) {cm.moveV(1, "page");},
|
5638 |
+
goCharLeft: function(cm) {cm.moveH(-1, "char");},
|
5639 |
+
goCharRight: function(cm) {cm.moveH(1, "char");},
|
5640 |
+
goColumnLeft: function(cm) {cm.moveH(-1, "column");},
|
5641 |
+
goColumnRight: function(cm) {cm.moveH(1, "column");},
|
5642 |
+
goWordLeft: function(cm) {cm.moveH(-1, "word");},
|
5643 |
+
goGroupRight: function(cm) {cm.moveH(1, "group");},
|
5644 |
+
goGroupLeft: function(cm) {cm.moveH(-1, "group");},
|
5645 |
+
goWordRight: function(cm) {cm.moveH(1, "word");},
|
5646 |
+
delCharBefore: function(cm) {cm.deleteH(-1, "char");},
|
5647 |
+
delCharAfter: function(cm) {cm.deleteH(1, "char");},
|
5648 |
+
delWordBefore: function(cm) {cm.deleteH(-1, "word");},
|
5649 |
+
delWordAfter: function(cm) {cm.deleteH(1, "word");},
|
5650 |
+
delGroupBefore: function(cm) {cm.deleteH(-1, "group");},
|
5651 |
+
delGroupAfter: function(cm) {cm.deleteH(1, "group");},
|
5652 |
+
indentAuto: function(cm) {cm.indentSelection("smart");},
|
5653 |
+
indentMore: function(cm) {cm.indentSelection("add");},
|
5654 |
+
indentLess: function(cm) {cm.indentSelection("subtract");},
|
5655 |
+
insertTab: function(cm) {cm.replaceSelection("\t");},
|
5656 |
+
insertSoftTab: function(cm) {
|
5657 |
+
var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
|
5658 |
+
for (var i = 0; i < ranges.length; i++) {
|
5659 |
+
var pos = ranges[i].from();
|
5660 |
+
var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
|
5661 |
+
spaces.push(new Array(tabSize - col % tabSize + 1).join(" "));
|
5662 |
+
}
|
5663 |
+
cm.replaceSelections(spaces);
|
5664 |
+
},
|
5665 |
+
defaultTab: function(cm) {
|
5666 |
+
if (cm.somethingSelected()) cm.indentSelection("add");
|
5667 |
+
else cm.execCommand("insertTab");
|
5668 |
+
},
|
5669 |
+
transposeChars: function(cm) {
|
5670 |
+
runInOp(cm, function() {
|
5671 |
+
var ranges = cm.listSelections(), newSel = [];
|
5672 |
+
for (var i = 0; i < ranges.length; i++) {
|
5673 |
+
var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
|
5674 |
+
if (line) {
|
5675 |
+
if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1);
|
5676 |
+
if (cur.ch > 0) {
|
5677 |
+
cur = new Pos(cur.line, cur.ch + 1);
|
5678 |
+
cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
|
5679 |
+
Pos(cur.line, cur.ch - 2), cur, "+transpose");
|
5680 |
+
} else if (cur.line > cm.doc.first) {
|
5681 |
+
var prev = getLine(cm.doc, cur.line - 1).text;
|
5682 |
+
if (prev)
|
5683 |
+
cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
|
5684 |
+
prev.charAt(prev.length - 1),
|
5685 |
+
Pos(cur.line - 1, prev.length - 1), Pos(cur.line, 1), "+transpose");
|
5686 |
+
}
|
5687 |
+
}
|
5688 |
+
newSel.push(new Range(cur, cur));
|
5689 |
+
}
|
5690 |
+
cm.setSelections(newSel);
|
5691 |
+
});
|
5692 |
+
},
|
5693 |
+
newlineAndIndent: function(cm) {
|
5694 |
+
runInOp(cm, function() {
|
5695 |
+
var len = cm.listSelections().length;
|
5696 |
+
for (var i = 0; i < len; i++) {
|
5697 |
+
var range = cm.listSelections()[i];
|
5698 |
+
cm.replaceRange(cm.doc.lineSeparator(), range.anchor, range.head, "+input");
|
5699 |
+
cm.indentLine(range.from().line + 1, null, true);
|
5700 |
+
ensureCursorVisible(cm);
|
5701 |
+
}
|
5702 |
+
});
|
5703 |
+
},
|
5704 |
+
toggleOverwrite: function(cm) {cm.toggleOverwrite();}
|
5705 |
+
};
|
5706 |
+
|
5707 |
+
|
5708 |
+
// STANDARD KEYMAPS
|
5709 |
+
|
5710 |
+
var keyMap = CodeMirror.keyMap = {};
|
5711 |
+
|
5712 |
+
keyMap.basic = {
|
5713 |
+
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
5714 |
+
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
5715 |
+
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
|
5716 |
+
"Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
5717 |
+
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
|
5718 |
+
"Esc": "singleSelection"
|
5719 |
+
};
|
5720 |
+
// Note that the save and find-related commands aren't defined by
|
5721 |
+
// default. User code or addons can define them. Unknown commands
|
5722 |
+
// are simply ignored.
|
5723 |
+
keyMap.pcDefault = {
|
5724 |
+
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
5725 |
+
"Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
|
5726 |
+
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
5727 |
+
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
5728 |
+
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
5729 |
+
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
5730 |
+
"Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
|
5731 |
+
fallthrough: "basic"
|
5732 |
+
};
|
5733 |
+
// Very basic readline/emacs-style bindings, which are standard on Mac.
|
5734 |
+
keyMap.emacsy = {
|
5735 |
+
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
5736 |
+
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
5737 |
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
|
5738 |
+
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
|
5739 |
+
};
|
5740 |
+
keyMap.macDefault = {
|
5741 |
+
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
|
5742 |
+
"Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
|
5743 |
+
"Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
|
5744 |
+
"Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
|
5745 |
+
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
5746 |
+
"Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
|
5747 |
+
"Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
|
5748 |
+
fallthrough: ["basic", "emacsy"]
|
5749 |
+
};
|
5750 |
+
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
|
5751 |
+
|
5752 |
+
// KEYMAP DISPATCH
|
5753 |
+
|
5754 |
+
function normalizeKeyName(name) {
|
5755 |
+
var parts = name.split(/-(?!$)/), name = parts[parts.length - 1];
|
5756 |
+
var alt, ctrl, shift, cmd;
|
5757 |
+
for (var i = 0; i < parts.length - 1; i++) {
|
5758 |
+
var mod = parts[i];
|
5759 |
+
if (/^(cmd|meta|m)$/i.test(mod)) cmd = true;
|
5760 |
+
else if (/^a(lt)?$/i.test(mod)) alt = true;
|
5761 |
+
else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;
|
5762 |
+
else if (/^s(hift)$/i.test(mod)) shift = true;
|
5763 |
+
else throw new Error("Unrecognized modifier name: " + mod);
|
5764 |
+
}
|
5765 |
+
if (alt) name = "Alt-" + name;
|
5766 |
+
if (ctrl) name = "Ctrl-" + name;
|
5767 |
+
if (cmd) name = "Cmd-" + name;
|
5768 |
+
if (shift) name = "Shift-" + name;
|
5769 |
+
return name;
|
5770 |
+
}
|
5771 |
+
|
5772 |
+
// This is a kludge to keep keymaps mostly working as raw objects
|
5773 |
+
// (backwards compatibility) while at the same time support features
|
5774 |
+
// like normalization and multi-stroke key bindings. It compiles a
|
5775 |
+
// new normalized keymap, and then updates the old object to reflect
|
5776 |
+
// this.
|
5777 |
+
CodeMirror.normalizeKeyMap = function(keymap) {
|
5778 |
+
var copy = {};
|
5779 |
+
for (var keyname in keymap) if (keymap.hasOwnProperty(keyname)) {
|
5780 |
+
var value = keymap[keyname];
|
5781 |
+
if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue;
|
5782 |
+
if (value == "...") { delete keymap[keyname]; continue; }
|
5783 |
+
|
5784 |
+
var keys = map(keyname.split(" "), normalizeKeyName);
|
5785 |
+
for (var i = 0; i < keys.length; i++) {
|
5786 |
+
var val, name;
|
5787 |
+
if (i == keys.length - 1) {
|
5788 |
+
name = keys.join(" ");
|
5789 |
+
val = value;
|
5790 |
+
} else {
|
5791 |
+
name = keys.slice(0, i + 1).join(" ");
|
5792 |
+
val = "...";
|
5793 |
+
}
|
5794 |
+
var prev = copy[name];
|
5795 |
+
if (!prev) copy[name] = val;
|
5796 |
+
else if (prev != val) throw new Error("Inconsistent bindings for " + name);
|
5797 |
+
}
|
5798 |
+
delete keymap[keyname];
|
5799 |
+
}
|
5800 |
+
for (var prop in copy) keymap[prop] = copy[prop];
|
5801 |
+
return keymap;
|
5802 |
+
};
|
5803 |
+
|
5804 |
+
var lookupKey = CodeMirror.lookupKey = function(key, map, handle, context) {
|
5805 |
+
map = getKeyMap(map);
|
5806 |
+
var found = map.call ? map.call(key, context) : map[key];
|
5807 |
+
if (found === false) return "nothing";
|
5808 |
+
if (found === "...") return "multi";
|
5809 |
+
if (found != null && handle(found)) return "handled";
|
5810 |
+
|
5811 |
+
if (map.fallthrough) {
|
5812 |
+
if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
|
5813 |
+
return lookupKey(key, map.fallthrough, handle, context);
|
5814 |
+
for (var i = 0; i < map.fallthrough.length; i++) {
|
5815 |
+
var result = lookupKey(key, map.fallthrough[i], handle, context);
|
5816 |
+
if (result) return result;
|
5817 |
+
}
|
5818 |
+
}
|
5819 |
+
};
|
5820 |
+
|
5821 |
+
// Modifier key presses don't count as 'real' key presses for the
|
5822 |
+
// purpose of keymap fallthrough.
|
5823 |
+
var isModifierKey = CodeMirror.isModifierKey = function(value) {
|
5824 |
+
var name = typeof value == "string" ? value : keyNames[value.keyCode];
|
5825 |
+
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
|
5826 |
+
};
|
5827 |
+
|
5828 |
+
// Look up the name of a key as indicated by an event object.
|
5829 |
+
var keyName = CodeMirror.keyName = function(event, noShift) {
|
5830 |
+
if (presto && event.keyCode == 34 && event["char"]) return false;
|
5831 |
+
var base = keyNames[event.keyCode], name = base;
|
5832 |
+
if (name == null || event.altGraphKey) return false;
|
5833 |
+
if (event.altKey && base != "Alt") name = "Alt-" + name;
|
5834 |
+
if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") name = "Ctrl-" + name;
|
5835 |
+
if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") name = "Cmd-" + name;
|
5836 |
+
if (!noShift && event.shiftKey && base != "Shift") name = "Shift-" + name;
|
5837 |
+
return name;
|
5838 |
+
};
|
5839 |
+
|
5840 |
+
function getKeyMap(val) {
|
5841 |
+
return typeof val == "string" ? keyMap[val] : val;
|
5842 |
+
}
|
5843 |
+
|
5844 |
+
// FROMTEXTAREA
|
5845 |
+
|
5846 |
+
CodeMirror.fromTextArea = function(textarea, options) {
|
5847 |
+
options = options ? copyObj(options) : {};
|
5848 |
+
options.value = textarea.value;
|
5849 |
+
if (!options.tabindex && textarea.tabIndex)
|
5850 |
+
options.tabindex = textarea.tabIndex;
|
5851 |
+
if (!options.placeholder && textarea.placeholder)
|
5852 |
+
options.placeholder = textarea.placeholder;
|
5853 |
+
// Set autofocus to true if this textarea is focused, or if it has
|
5854 |
+
// autofocus and no other element is focused.
|
5855 |
+
if (options.autofocus == null) {
|
5856 |
+
var hasFocus = activeElt();
|
5857 |
+
options.autofocus = hasFocus == textarea ||
|
5858 |
+
textarea.getAttribute("autofocus") != null && hasFocus == document.body;
|
5859 |
+
}
|
5860 |
+
|
5861 |
+
function save() {textarea.value = cm.getValue();}
|
5862 |
+
if (textarea.form) {
|
5863 |
+
on(textarea.form, "submit", save);
|
5864 |
+
// Deplorable hack to make the submit method do the right thing.
|
5865 |
+
if (!options.leaveSubmitMethodAlone) {
|
5866 |
+
var form = textarea.form, realSubmit = form.submit;
|
5867 |
+
try {
|
5868 |
+
var wrappedSubmit = form.submit = function() {
|
5869 |
+
save();
|
5870 |
+
form.submit = realSubmit;
|
5871 |
+
form.submit();
|
5872 |
+
form.submit = wrappedSubmit;
|
5873 |
+
};
|
5874 |
+
} catch(e) {}
|
5875 |
+
}
|
5876 |
+
}
|
5877 |
+
|
5878 |
+
options.finishInit = function(cm) {
|
5879 |
+
cm.save = save;
|
5880 |
+
cm.getTextArea = function() { return textarea; };
|
5881 |
+
cm.toTextArea = function() {
|
5882 |
+
cm.toTextArea = isNaN; // Prevent this from being ran twice
|
5883 |
+
save();
|
5884 |
+
textarea.parentNode.removeChild(cm.getWrapperElement());
|
5885 |
+
textarea.style.display = "";
|
5886 |
+
if (textarea.form) {
|
5887 |
+
off(textarea.form, "submit", save);
|
5888 |
+
if (typeof textarea.form.submit == "function")
|
5889 |
+
textarea.form.submit = realSubmit;
|
5890 |
+
}
|
5891 |
+
};
|
5892 |
+
};
|
5893 |
+
|
5894 |
+
textarea.style.display = "none";
|
5895 |
+
var cm = CodeMirror(function(node) {
|
5896 |
+
textarea.parentNode.insertBefore(node, textarea.nextSibling);
|
5897 |
+
}, options);
|
5898 |
+
return cm;
|
5899 |
+
};
|
5900 |
+
|
5901 |
+
// STRING STREAM
|
5902 |
+
|
5903 |
+
// Fed to the mode parsers, provides helper functions to make
|
5904 |
+
// parsers more succinct.
|
5905 |
+
|
5906 |
+
var StringStream = CodeMirror.StringStream = function(string, tabSize) {
|
5907 |
+
this.pos = this.start = 0;
|
5908 |
+
this.string = string;
|
5909 |
+
this.tabSize = tabSize || 8;
|
5910 |
+
this.lastColumnPos = this.lastColumnValue = 0;
|
5911 |
+
this.lineStart = 0;
|
5912 |
+
};
|
5913 |
+
|
5914 |
+
StringStream.prototype = {
|
5915 |
+
eol: function() {return this.pos >= this.string.length;},
|
5916 |
+
sol: function() {return this.pos == this.lineStart;},
|
5917 |
+
peek: function() {return this.string.charAt(this.pos) || undefined;},
|
5918 |
+
next: function() {
|
5919 |
+
if (this.pos < this.string.length)
|
5920 |
+
return this.string.charAt(this.pos++);
|
5921 |
+
},
|
5922 |
+
eat: function(match) {
|
5923 |
+
var ch = this.string.charAt(this.pos);
|
5924 |
+
if (typeof match == "string") var ok = ch == match;
|
5925 |
+
else var ok = ch && (match.test ? match.test(ch) : match(ch));
|
5926 |
+
if (ok) {++this.pos; return ch;}
|
5927 |
+
},
|
5928 |
+
eatWhile: function(match) {
|
5929 |
+
var start = this.pos;
|
5930 |
+
while (this.eat(match)){}
|
5931 |
+
return this.pos > start;
|
5932 |
+
},
|
5933 |
+
eatSpace: function() {
|
5934 |
+
var start = this.pos;
|
5935 |
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
|
5936 |
+
return this.pos > start;
|
5937 |
+
},
|
5938 |
+
skipToEnd: function() {this.pos = this.string.length;},
|
5939 |
+
skipTo: function(ch) {
|
5940 |
+
var found = this.string.indexOf(ch, this.pos);
|
5941 |
+
if (found > -1) {this.pos = found; return true;}
|
5942 |
+
},
|
5943 |
+
backUp: function(n) {this.pos -= n;},
|
5944 |
+
column: function() {
|
5945 |
+
if (this.lastColumnPos < this.start) {
|
5946 |
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
5947 |
+
this.lastColumnPos = this.start;
|
5948 |
+
}
|
5949 |
+
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
5950 |
+
},
|
5951 |
+
indentation: function() {
|
5952 |
+
return countColumn(this.string, null, this.tabSize) -
|
5953 |
+
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
5954 |
+
},
|
5955 |
+
match: function(pattern, consume, caseInsensitive) {
|
5956 |
+
if (typeof pattern == "string") {
|
5957 |
+
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
|
5958 |
+
var substr = this.string.substr(this.pos, pattern.length);
|
5959 |
+
if (cased(substr) == cased(pattern)) {
|
5960 |
+
if (consume !== false) this.pos += pattern.length;
|
5961 |
+
return true;
|
5962 |
+
}
|
5963 |
+
} else {
|
5964 |
+
var match = this.string.slice(this.pos).match(pattern);
|
5965 |
+
if (match && match.index > 0) return null;
|
5966 |
+
if (match && consume !== false) this.pos += match[0].length;
|
5967 |
+
return match;
|
5968 |
+
}
|
5969 |
+
},
|
5970 |
+
current: function(){return this.string.slice(this.start, this.pos);},
|
5971 |
+
hideFirstChars: function(n, inner) {
|
5972 |
+
this.lineStart += n;
|
5973 |
+
try { return inner(); }
|
5974 |
+
finally { this.lineStart -= n; }
|
5975 |
+
}
|
5976 |
+
};
|
5977 |
+
|
5978 |
+
// TEXTMARKERS
|
5979 |
+
|
5980 |
+
// Created with markText and setBookmark methods. A TextMarker is a
|
5981 |
+
// handle that can be used to clear or find a marked position in the
|
5982 |
+
// document. Line objects hold arrays (markedSpans) containing
|
5983 |
+
// {from, to, marker} object pointing to such marker objects, and
|
5984 |
+
// indicating that such a marker is present on that line. Multiple
|
5985 |
+
// lines may point to the same marker when it spans across lines.
|
5986 |
+
// The spans will have null for their from/to properties when the
|
5987 |
+
// marker continues beyond the start/end of the line. Markers have
|
5988 |
+
// links back to the lines they currently touch.
|
5989 |
+
|
5990 |
+
var nextMarkerId = 0;
|
5991 |
+
|
5992 |
+
var TextMarker = CodeMirror.TextMarker = function(doc, type) {
|
5993 |
+
this.lines = [];
|
5994 |
+
this.type = type;
|
5995 |
+
this.doc = doc;
|
5996 |
+
this.id = ++nextMarkerId;
|
5997 |
+
};
|
5998 |
+
eventMixin(TextMarker);
|
5999 |
+
|
6000 |
+
// Clear the marker.
|
6001 |
+
TextMarker.prototype.clear = function() {
|
6002 |
+
if (this.explicitlyCleared) return;
|
6003 |
+
var cm = this.doc.cm, withOp = cm && !cm.curOp;
|
6004 |
+
if (withOp) startOperation(cm);
|
6005 |
+
if (hasHandler(this, "clear")) {
|
6006 |
+
var found = this.find();
|
6007 |
+
if (found) signalLater(this, "clear", found.from, found.to);
|
6008 |
+
}
|
6009 |
+
var min = null, max = null;
|
6010 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
6011 |
+
var line = this.lines[i];
|
6012 |
+
var span = getMarkedSpanFor(line.markedSpans, this);
|
6013 |
+
if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text");
|
6014 |
+
else if (cm) {
|
6015 |
+
if (span.to != null) max = lineNo(line);
|
6016 |
+
if (span.from != null) min = lineNo(line);
|
6017 |
+
}
|
6018 |
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span);
|
6019 |
+
if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
|
6020 |
+
updateLineHeight(line, textHeight(cm.display));
|
6021 |
+
}
|
6022 |
+
if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {
|
6023 |
+
var visual = visualLine(this.lines[i]), len = lineLength(visual);
|
6024 |
+
if (len > cm.display.maxLineLength) {
|
6025 |
+
cm.display.maxLine = visual;
|
6026 |
+
cm.display.maxLineLength = len;
|
6027 |
+
cm.display.maxLineChanged = true;
|
6028 |
+
}
|
6029 |
+
}
|
6030 |
+
|
6031 |
+
if (min != null && cm && this.collapsed) regChange(cm, min, max + 1);
|
6032 |
+
this.lines.length = 0;
|
6033 |
+
this.explicitlyCleared = true;
|
6034 |
+
if (this.atomic && this.doc.cantEdit) {
|
6035 |
+
this.doc.cantEdit = false;
|
6036 |
+
if (cm) reCheckSelection(cm.doc);
|
6037 |
+
}
|
6038 |
+
if (cm) signalLater(cm, "markerCleared", cm, this);
|
6039 |
+
if (withOp) endOperation(cm);
|
6040 |
+
if (this.parent) this.parent.clear();
|
6041 |
+
};
|
6042 |
+
|
6043 |
+
// Find the position of the marker in the document. Returns a {from,
|
6044 |
+
// to} object by default. Side can be passed to get a specific side
|
6045 |
+
// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
|
6046 |
+
// Pos objects returned contain a line object, rather than a line
|
6047 |
+
// number (used to prevent looking up the same line twice).
|
6048 |
+
TextMarker.prototype.find = function(side, lineObj) {
|
6049 |
+
if (side == null && this.type == "bookmark") side = 1;
|
6050 |
+
var from, to;
|
6051 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
6052 |
+
var line = this.lines[i];
|
6053 |
+
var span = getMarkedSpanFor(line.markedSpans, this);
|
6054 |
+
if (span.from != null) {
|
6055 |
+
from = Pos(lineObj ? line : lineNo(line), span.from);
|
6056 |
+
if (side == -1) return from;
|
6057 |
+
}
|
6058 |
+
if (span.to != null) {
|
6059 |
+
to = Pos(lineObj ? line : lineNo(line), span.to);
|
6060 |
+
if (side == 1) return to;
|
6061 |
+
}
|
6062 |
+
}
|
6063 |
+
return from && {from: from, to: to};
|
6064 |
+
};
|
6065 |
+
|
6066 |
+
// Signals that the marker's widget changed, and surrounding layout
|
6067 |
+
// should be recomputed.
|
6068 |
+
TextMarker.prototype.changed = function() {
|
6069 |
+
var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
|
6070 |
+
if (!pos || !cm) return;
|
6071 |
+
runInOp(cm, function() {
|
6072 |
+
var line = pos.line, lineN = lineNo(pos.line);
|
6073 |
+
var view = findViewForLine(cm, lineN);
|
6074 |
+
if (view) {
|
6075 |
+
clearLineMeasurementCacheFor(view);
|
6076 |
+
cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
|
6077 |
+
}
|
6078 |
+
cm.curOp.updateMaxLine = true;
|
6079 |
+
if (!lineIsHidden(widget.doc, line) && widget.height != null) {
|
6080 |
+
var oldHeight = widget.height;
|
6081 |
+
widget.height = null;
|
6082 |
+
var dHeight = widgetHeight(widget) - oldHeight;
|
6083 |
+
if (dHeight)
|
6084 |
+
updateLineHeight(line, line.height + dHeight);
|
6085 |
+
}
|
6086 |
+
});
|
6087 |
+
};
|
6088 |
+
|
6089 |
+
TextMarker.prototype.attachLine = function(line) {
|
6090 |
+
if (!this.lines.length && this.doc.cm) {
|
6091 |
+
var op = this.doc.cm.curOp;
|
6092 |
+
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
6093 |
+
(op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);
|
6094 |
+
}
|
6095 |
+
this.lines.push(line);
|
6096 |
+
};
|
6097 |
+
TextMarker.prototype.detachLine = function(line) {
|
6098 |
+
this.lines.splice(indexOf(this.lines, line), 1);
|
6099 |
+
if (!this.lines.length && this.doc.cm) {
|
6100 |
+
var op = this.doc.cm.curOp;
|
6101 |
+
(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
|
6102 |
+
}
|
6103 |
+
};
|
6104 |
+
|
6105 |
+
// Collapsed markers have unique ids, in order to be able to order
|
6106 |
+
// them, which is needed for uniquely determining an outer marker
|
6107 |
+
// when they overlap (they may nest, but not partially overlap).
|
6108 |
+
var nextMarkerId = 0;
|
6109 |
+
|
6110 |
+
// Create a marker, wire it up to the right lines, and
|
6111 |
+
function markText(doc, from, to, options, type) {
|
6112 |
+
// Shared markers (across linked documents) are handled separately
|
6113 |
+
// (markTextShared will call out to this again, once per
|
6114 |
+
// document).
|
6115 |
+
if (options && options.shared) return markTextShared(doc, from, to, options, type);
|
6116 |
+
// Ensure we are in an operation.
|
6117 |
+
if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);
|
6118 |
+
|
6119 |
+
var marker = new TextMarker(doc, type), diff = cmp(from, to);
|
6120 |
+
if (options) copyObj(options, marker, false);
|
6121 |
+
// Don't connect empty markers unless clearWhenEmpty is false
|
6122 |
+
if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
|
6123 |
+
return marker;
|
6124 |
+
if (marker.replacedWith) {
|
6125 |
+
// Showing up as a widget implies collapsed (widget replaces text)
|
6126 |
+
marker.collapsed = true;
|
6127 |
+
marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget");
|
6128 |
+
if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true");
|
6129 |
+
if (options.insertLeft) marker.widgetNode.insertLeft = true;
|
6130 |
+
}
|
6131 |
+
if (marker.collapsed) {
|
6132 |
+
if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
|
6133 |
+
from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
|
6134 |
+
throw new Error("Inserting collapsed marker partially overlapping an existing one");
|
6135 |
+
sawCollapsedSpans = true;
|
6136 |
+
}
|
6137 |
+
|
6138 |
+
if (marker.addToHistory)
|
6139 |
+
addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN);
|
6140 |
+
|
6141 |
+
var curLine = from.line, cm = doc.cm, updateMaxLine;
|
6142 |
+
doc.iter(curLine, to.line + 1, function(line) {
|
6143 |
+
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
|
6144 |
+
updateMaxLine = true;
|
6145 |
+
if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);
|
6146 |
+
addMarkedSpan(line, new MarkedSpan(marker,
|
6147 |
+
curLine == from.line ? from.ch : null,
|
6148 |
+
curLine == to.line ? to.ch : null));
|
6149 |
+
++curLine;
|
6150 |
+
});
|
6151 |
+
// lineIsHidden depends on the presence of the spans, so needs a second pass
|
6152 |
+
if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {
|
6153 |
+
if (lineIsHidden(doc, line)) updateLineHeight(line, 0);
|
6154 |
+
});
|
6155 |
+
|
6156 |
+
if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); });
|
6157 |
+
|
6158 |
+
if (marker.readOnly) {
|
6159 |
+
sawReadOnlySpans = true;
|
6160 |
+
if (doc.history.done.length || doc.history.undone.length)
|
6161 |
+
doc.clearHistory();
|
6162 |
+
}
|
6163 |
+
if (marker.collapsed) {
|
6164 |
+
marker.id = ++nextMarkerId;
|
6165 |
+
marker.atomic = true;
|
6166 |
+
}
|
6167 |
+
if (cm) {
|
6168 |
+
// Sync editor state
|
6169 |
+
if (updateMaxLine) cm.curOp.updateMaxLine = true;
|
6170 |
+
if (marker.collapsed)
|
6171 |
+
regChange(cm, from.line, to.line + 1);
|
6172 |
+
else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
|
6173 |
+
for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text");
|
6174 |
+
if (marker.atomic) reCheckSelection(cm.doc);
|
6175 |
+
signalLater(cm, "markerAdded", cm, marker);
|
6176 |
+
}
|
6177 |
+
return marker;
|
6178 |
+
}
|
6179 |
+
|
6180 |
+
// SHARED TEXTMARKERS
|
6181 |
+
|
6182 |
+
// A shared marker spans multiple linked documents. It is
|
6183 |
+
// implemented as a meta-marker-object controlling multiple normal
|
6184 |
+
// markers.
|
6185 |
+
var SharedTextMarker = CodeMirror.SharedTextMarker = function(markers, primary) {
|
6186 |
+
this.markers = markers;
|
6187 |
+
this.primary = primary;
|
6188 |
+
for (var i = 0; i < markers.length; ++i)
|
6189 |
+
markers[i].parent = this;
|
6190 |
+
};
|
6191 |
+
eventMixin(SharedTextMarker);
|
6192 |
+
|
6193 |
+
SharedTextMarker.prototype.clear = function() {
|
6194 |
+
if (this.explicitlyCleared) return;
|
6195 |
+
this.explicitlyCleared = true;
|
6196 |
+
for (var i = 0; i < this.markers.length; ++i)
|
6197 |
+
this.markers[i].clear();
|
6198 |
+
signalLater(this, "clear");
|
6199 |
+
};
|
6200 |
+
SharedTextMarker.prototype.find = function(side, lineObj) {
|
6201 |
+
return this.primary.find(side, lineObj);
|
6202 |
+
};
|
6203 |
+
|
6204 |
+
function markTextShared(doc, from, to, options, type) {
|
6205 |
+
options = copyObj(options);
|
6206 |
+
options.shared = false;
|
6207 |
+
var markers = [markText(doc, from, to, options, type)], primary = markers[0];
|
6208 |
+
var widget = options.widgetNode;
|
6209 |
+
linkedDocs(doc, function(doc) {
|
6210 |
+
if (widget) options.widgetNode = widget.cloneNode(true);
|
6211 |
+
markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
|
6212 |
+
for (var i = 0; i < doc.linked.length; ++i)
|
6213 |
+
if (doc.linked[i].isParent) return;
|
6214 |
+
primary = lst(markers);
|
6215 |
+
});
|
6216 |
+
return new SharedTextMarker(markers, primary);
|
6217 |
+
}
|
6218 |
+
|
6219 |
+
function findSharedMarkers(doc) {
|
6220 |
+
return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())),
|
6221 |
+
function(m) { return m.parent; });
|
6222 |
+
}
|
6223 |
+
|
6224 |
+
function copySharedMarkers(doc, markers) {
|
6225 |
+
for (var i = 0; i < markers.length; i++) {
|
6226 |
+
var marker = markers[i], pos = marker.find();
|
6227 |
+
var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
|
6228 |
+
if (cmp(mFrom, mTo)) {
|
6229 |
+
var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
|
6230 |
+
marker.markers.push(subMark);
|
6231 |
+
subMark.parent = marker;
|
6232 |
+
}
|
6233 |
+
}
|
6234 |
+
}
|
6235 |
+
|
6236 |
+
function detachSharedMarkers(markers) {
|
6237 |
+
for (var i = 0; i < markers.length; i++) {
|
6238 |
+
var marker = markers[i], linked = [marker.primary.doc];;
|
6239 |
+
linkedDocs(marker.primary.doc, function(d) { linked.push(d); });
|
6240 |
+
for (var j = 0; j < marker.markers.length; j++) {
|
6241 |
+
var subMarker = marker.markers[j];
|
6242 |
+
if (indexOf(linked, subMarker.doc) == -1) {
|
6243 |
+
subMarker.parent = null;
|
6244 |
+
marker.markers.splice(j--, 1);
|
6245 |
+
}
|
6246 |
+
}
|
6247 |
+
}
|
6248 |
+
}
|
6249 |
+
|
6250 |
+
// TEXTMARKER SPANS
|
6251 |
+
|
6252 |
+
function MarkedSpan(marker, from, to) {
|
6253 |
+
this.marker = marker;
|
6254 |
+
this.from = from; this.to = to;
|
6255 |
+
}
|
6256 |
+
|
6257 |
+
// Search an array of spans for a span matching the given marker.
|
6258 |
+
function getMarkedSpanFor(spans, marker) {
|
6259 |
+
if (spans) for (var i = 0; i < spans.length; ++i) {
|
6260 |
+
var span = spans[i];
|
6261 |
+
if (span.marker == marker) return span;
|
6262 |
+
}
|
6263 |
+
}
|
6264 |
+
// Remove a span from an array, returning undefined if no spans are
|
6265 |
+
// left (we don't store arrays for lines without spans).
|
6266 |
+
function removeMarkedSpan(spans, span) {
|
6267 |
+
for (var r, i = 0; i < spans.length; ++i)
|
6268 |
+
if (spans[i] != span) (r || (r = [])).push(spans[i]);
|
6269 |
+
return r;
|
6270 |
+
}
|
6271 |
+
// Add a span to a line.
|
6272 |
+
function addMarkedSpan(line, span) {
|
6273 |
+
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
|
6274 |
+
span.marker.attachLine(line);
|
6275 |
+
}
|
6276 |
+
|
6277 |
+
// Used for the algorithm that adjusts markers for a change in the
|
6278 |
+
// document. These functions cut an array of spans at a given
|
6279 |
+
// character position, returning an array of remaining chunks (or
|
6280 |
+
// undefined if nothing remains).
|
6281 |
+
function markedSpansBefore(old, startCh, isInsert) {
|
6282 |
+
if (old) for (var i = 0, nw; i < old.length; ++i) {
|
6283 |
+
var span = old[i], marker = span.marker;
|
6284 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
|
6285 |
+
if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
|
6286 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
|
6287 |
+
(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
|
6288 |
+
}
|
6289 |
+
}
|
6290 |
+
return nw;
|
6291 |
+
}
|
6292 |
+
function markedSpansAfter(old, endCh, isInsert) {
|
6293 |
+
if (old) for (var i = 0, nw; i < old.length; ++i) {
|
6294 |
+
var span = old[i], marker = span.marker;
|
6295 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
|
6296 |
+
if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
|
6297 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
|
6298 |
+
(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
|
6299 |
+
span.to == null ? null : span.to - endCh));
|
6300 |
+
}
|
6301 |
+
}
|
6302 |
+
return nw;
|
6303 |
+
}
|
6304 |
+
|
6305 |
+
// Given a change object, compute the new set of marker spans that
|
6306 |
+
// cover the line in which the change took place. Removes spans
|
6307 |
+
// entirely within the change, reconnects spans belonging to the
|
6308 |
+
// same marker that appear on both sides of the change, and cuts off
|
6309 |
+
// spans partially within the change. Returns an array of span
|
6310 |
+
// arrays with one element for each line in (after) the change.
|
6311 |
+
function stretchSpansOverChange(doc, change) {
|
6312 |
+
if (change.full) return null;
|
6313 |
+
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
|
6314 |
+
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
|
6315 |
+
if (!oldFirst && !oldLast) return null;
|
6316 |
+
|
6317 |
+
var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
|
6318 |
+
// Get the spans that 'stick out' on both sides
|
6319 |
+
var first = markedSpansBefore(oldFirst, startCh, isInsert);
|
6320 |
+
var last = markedSpansAfter(oldLast, endCh, isInsert);
|
6321 |
+
|
6322 |
+
// Next, merge those two ends
|
6323 |
+
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
|
6324 |
+
if (first) {
|
6325 |
+
// Fix up .to properties of first
|
6326 |
+
for (var i = 0; i < first.length; ++i) {
|
6327 |
+
var span = first[i];
|
6328 |
+
if (span.to == null) {
|
6329 |
+
var found = getMarkedSpanFor(last, span.marker);
|
6330 |
+
if (!found) span.to = startCh;
|
6331 |
+
else if (sameLine) span.to = found.to == null ? null : found.to + offset;
|
6332 |
+
}
|
6333 |
+
}
|
6334 |
+
}
|
6335 |
+
if (last) {
|
6336 |
+
// Fix up .from in last (or move them into first in case of sameLine)
|
6337 |
+
for (var i = 0; i < last.length; ++i) {
|
6338 |
+
var span = last[i];
|
6339 |
+
if (span.to != null) span.to += offset;
|
6340 |
+
if (span.from == null) {
|
6341 |
+
var found = getMarkedSpanFor(first, span.marker);
|
6342 |
+
if (!found) {
|
6343 |
+
span.from = offset;
|
6344 |
+
if (sameLine) (first || (first = [])).push(span);
|
6345 |
+
}
|
6346 |
+
} else {
|
6347 |
+
span.from += offset;
|
6348 |
+
if (sameLine) (first || (first = [])).push(span);
|
6349 |
+
}
|
6350 |
+
}
|
6351 |
+
}
|
6352 |
+
// Make sure we didn't create any zero-length spans
|
6353 |
+
if (first) first = clearEmptySpans(first);
|
6354 |
+
if (last && last != first) last = clearEmptySpans(last);
|
6355 |
+
|
6356 |
+
var newMarkers = [first];
|
6357 |
+
if (!sameLine) {
|
6358 |
+
// Fill gap with whole-line-spans
|
6359 |
+
var gap = change.text.length - 2, gapMarkers;
|
6360 |
+
if (gap > 0 && first)
|
6361 |
+
for (var i = 0; i < first.length; ++i)
|
6362 |
+
if (first[i].to == null)
|
6363 |
+
(gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null));
|
6364 |
+
for (var i = 0; i < gap; ++i)
|
6365 |
+
newMarkers.push(gapMarkers);
|
6366 |
+
newMarkers.push(last);
|
6367 |
+
}
|
6368 |
+
return newMarkers;
|
6369 |
+
}
|
6370 |
+
|
6371 |
+
// Remove spans that are empty and don't have a clearWhenEmpty
|
6372 |
+
// option of false.
|
6373 |
+
function clearEmptySpans(spans) {
|
6374 |
+
for (var i = 0; i < spans.length; ++i) {
|
6375 |
+
var span = spans[i];
|
6376 |
+
if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
|
6377 |
+
spans.splice(i--, 1);
|
6378 |
+
}
|
6379 |
+
if (!spans.length) return null;
|
6380 |
+
return spans;
|
6381 |
+
}
|
6382 |
+
|
6383 |
+
// Used for un/re-doing changes from the history. Combines the
|
6384 |
+
// result of computing the existing spans with the set of spans that
|
6385 |
+
// existed in the history (so that deleting around a span and then
|
6386 |
+
// undoing brings back the span).
|
6387 |
+
function mergeOldSpans(doc, change) {
|
6388 |
+
var old = getOldSpans(doc, change);
|
6389 |
+
var stretched = stretchSpansOverChange(doc, change);
|
6390 |
+
if (!old) return stretched;
|
6391 |
+
if (!stretched) return old;
|
6392 |
+
|
6393 |
+
for (var i = 0; i < old.length; ++i) {
|
6394 |
+
var oldCur = old[i], stretchCur = stretched[i];
|
6395 |
+
if (oldCur && stretchCur) {
|
6396 |
+
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
6397 |
+
var span = stretchCur[j];
|
6398 |
+
for (var k = 0; k < oldCur.length; ++k)
|
6399 |
+
if (oldCur[k].marker == span.marker) continue spans;
|
6400 |
+
oldCur.push(span);
|
6401 |
+
}
|
6402 |
+
} else if (stretchCur) {
|
6403 |
+
old[i] = stretchCur;
|
6404 |
+
}
|
6405 |
+
}
|
6406 |
+
return old;
|
6407 |
+
}
|
6408 |
+
|
6409 |
+
// Used to 'clip' out readOnly ranges when making a change.
|
6410 |
+
function removeReadOnlyRanges(doc, from, to) {
|
6411 |
+
var markers = null;
|
6412 |
+
doc.iter(from.line, to.line + 1, function(line) {
|
6413 |
+
if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
|
6414 |
+
var mark = line.markedSpans[i].marker;
|
6415 |
+
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
6416 |
+
(markers || (markers = [])).push(mark);
|
6417 |
+
}
|
6418 |
+
});
|
6419 |
+
if (!markers) return null;
|
6420 |
+
var parts = [{from: from, to: to}];
|
6421 |
+
for (var i = 0; i < markers.length; ++i) {
|
6422 |
+
var mk = markers[i], m = mk.find(0);
|
6423 |
+
for (var j = 0; j < parts.length; ++j) {
|
6424 |
+
var p = parts[j];
|
6425 |
+
if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue;
|
6426 |
+
var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
|
6427 |
+
if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
|
6428 |
+
newParts.push({from: p.from, to: m.from});
|
6429 |
+
if (dto > 0 || !mk.inclusiveRight && !dto)
|
6430 |
+
newParts.push({from: m.to, to: p.to});
|
6431 |
+
parts.splice.apply(parts, newParts);
|
6432 |
+
j += newParts.length - 1;
|
6433 |
+
}
|
6434 |
+
}
|
6435 |
+
return parts;
|
6436 |
+
}
|
6437 |
+
|
6438 |
+
// Connect or disconnect spans from a line.
|
6439 |
+
function detachMarkedSpans(line) {
|
6440 |
+
var spans = line.markedSpans;
|
6441 |
+
if (!spans) return;
|
6442 |
+
for (var i = 0; i < spans.length; ++i)
|
6443 |
+
spans[i].marker.detachLine(line);
|
6444 |
+
line.markedSpans = null;
|
6445 |
+
}
|
6446 |
+
function attachMarkedSpans(line, spans) {
|
6447 |
+
if (!spans) return;
|
6448 |
+
for (var i = 0; i < spans.length; ++i)
|
6449 |
+
spans[i].marker.attachLine(line);
|
6450 |
+
line.markedSpans = spans;
|
6451 |
+
}
|
6452 |
+
|
6453 |
+
// Helpers used when computing which overlapping collapsed span
|
6454 |
+
// counts as the larger one.
|
6455 |
+
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0; }
|
6456 |
+
function extraRight(marker) { return marker.inclusiveRight ? 1 : 0; }
|
6457 |
+
|
6458 |
+
// Returns a number indicating which of two overlapping collapsed
|
6459 |
+
// spans is larger (and thus includes the other). Falls back to
|
6460 |
+
// comparing ids when the spans cover exactly the same range.
|
6461 |
+
function compareCollapsedMarkers(a, b) {
|
6462 |
+
var lenDiff = a.lines.length - b.lines.length;
|
6463 |
+
if (lenDiff != 0) return lenDiff;
|
6464 |
+
var aPos = a.find(), bPos = b.find();
|
6465 |
+
var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
|
6466 |
+
if (fromCmp) return -fromCmp;
|
6467 |
+
var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
|
6468 |
+
if (toCmp) return toCmp;
|
6469 |
+
return b.id - a.id;
|
6470 |
+
}
|
6471 |
+
|
6472 |
+
// Find out whether a line ends or starts in a collapsed span. If
|
6473 |
+
// so, return the marker for that span.
|
6474 |
+
function collapsedSpanAtSide(line, start) {
|
6475 |
+
var sps = sawCollapsedSpans && line.markedSpans, found;
|
6476 |
+
if (sps) for (var sp, i = 0; i < sps.length; ++i) {
|
6477 |
+
sp = sps[i];
|
6478 |
+
if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
|
6479 |
+
(!found || compareCollapsedMarkers(found, sp.marker) < 0))
|
6480 |
+
found = sp.marker;
|
6481 |
+
}
|
6482 |
+
return found;
|
6483 |
+
}
|
6484 |
+
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true); }
|
6485 |
+
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false); }
|
6486 |
+
|
6487 |
+
// Test whether there exists a collapsed span that partially
|
6488 |
+
// overlaps (covers the start or end, but not both) of a new span.
|
6489 |
+
// Such overlap is not allowed.
|
6490 |
+
function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
|
6491 |
+
var line = getLine(doc, lineNo);
|
6492 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
6493 |
+
if (sps) for (var i = 0; i < sps.length; ++i) {
|
6494 |
+
var sp = sps[i];
|
6495 |
+
if (!sp.marker.collapsed) continue;
|
6496 |
+
var found = sp.marker.find(0);
|
6497 |
+
var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
|
6498 |
+
var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
|
6499 |
+
if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue;
|
6500 |
+
if (fromCmp <= 0 && (cmp(found.to, from) > 0 || (sp.marker.inclusiveRight && marker.inclusiveLeft)) ||
|
6501 |
+
fromCmp >= 0 && (cmp(found.from, to) < 0 || (sp.marker.inclusiveLeft && marker.inclusiveRight)))
|
6502 |
+
return true;
|
6503 |
+
}
|
6504 |
+
}
|
6505 |
+
|
6506 |
+
// A visual line is a line as drawn on the screen. Folding, for
|
6507 |
+
// example, can cause multiple logical lines to appear on the same
|
6508 |
+
// visual line. This finds the start of the visual line that the
|
6509 |
+
// given line is part of (usually that is the line itself).
|
6510 |
+
function visualLine(line) {
|
6511 |
+
var merged;
|
6512 |
+
while (merged = collapsedSpanAtStart(line))
|
6513 |
+
line = merged.find(-1, true).line;
|
6514 |
+
return line;
|
6515 |
+
}
|
6516 |
+
|
6517 |
+
// Returns an array of logical lines that continue the visual line
|
6518 |
+
// started by the argument, or undefined if there are no such lines.
|
6519 |
+
function visualLineContinued(line) {
|
6520 |
+
var merged, lines;
|
6521 |
+
while (merged = collapsedSpanAtEnd(line)) {
|
6522 |
+
line = merged.find(1, true).line;
|
6523 |
+
(lines || (lines = [])).push(line);
|
6524 |
+
}
|
6525 |
+
return lines;
|
6526 |
+
}
|
6527 |
+
|
6528 |
+
// Get the line number of the start of the visual line that the
|
6529 |
+
// given line number is part of.
|
6530 |
+
function visualLineNo(doc, lineN) {
|
6531 |
+
var line = getLine(doc, lineN), vis = visualLine(line);
|
6532 |
+
if (line == vis) return lineN;
|
6533 |
+
return lineNo(vis);
|
6534 |
+
}
|
6535 |
+
// Get the line number of the start of the next visual line after
|
6536 |
+
// the given line.
|
6537 |
+
function visualLineEndNo(doc, lineN) {
|
6538 |
+
if (lineN > doc.lastLine()) return lineN;
|
6539 |
+
var line = getLine(doc, lineN), merged;
|
6540 |
+
if (!lineIsHidden(doc, line)) return lineN;
|
6541 |
+
while (merged = collapsedSpanAtEnd(line))
|
6542 |
+
line = merged.find(1, true).line;
|
6543 |
+
return lineNo(line) + 1;
|
6544 |
+
}
|
6545 |
+
|
6546 |
+
// Compute whether a line is hidden. Lines count as hidden when they
|
6547 |
+
// are part of a visual line that starts with another line, or when
|
6548 |
+
// they are entirely covered by collapsed, non-widget span.
|
6549 |
+
function lineIsHidden(doc, line) {
|
6550 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
6551 |
+
if (sps) for (var sp, i = 0; i < sps.length; ++i) {
|
6552 |
+
sp = sps[i];
|
6553 |
+
if (!sp.marker.collapsed) continue;
|
6554 |
+
if (sp.from == null) return true;
|
6555 |
+
if (sp.marker.widgetNode) continue;
|
6556 |
+
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
6557 |
+
return true;
|
6558 |
+
}
|
6559 |
+
}
|
6560 |
+
function lineIsHiddenInner(doc, line, span) {
|
6561 |
+
if (span.to == null) {
|
6562 |
+
var end = span.marker.find(1, true);
|
6563 |
+
return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker));
|
6564 |
+
}
|
6565 |
+
if (span.marker.inclusiveRight && span.to == line.text.length)
|
6566 |
+
return true;
|
6567 |
+
for (var sp, i = 0; i < line.markedSpans.length; ++i) {
|
6568 |
+
sp = line.markedSpans[i];
|
6569 |
+
if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
|
6570 |
+
(sp.to == null || sp.to != span.from) &&
|
6571 |
+
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
6572 |
+
lineIsHiddenInner(doc, line, sp)) return true;
|
6573 |
+
}
|
6574 |
+
}
|
6575 |
+
|
6576 |
+
// LINE WIDGETS
|
6577 |
+
|
6578 |
+
// Line widgets are block elements displayed above or below a line.
|
6579 |
+
|
6580 |
+
var LineWidget = CodeMirror.LineWidget = function(doc, node, options) {
|
6581 |
+
if (options) for (var opt in options) if (options.hasOwnProperty(opt))
|
6582 |
+
this[opt] = options[opt];
|
6583 |
+
this.doc = doc;
|
6584 |
+
this.node = node;
|
6585 |
+
};
|
6586 |
+
eventMixin(LineWidget);
|
6587 |
+
|
6588 |
+
function adjustScrollWhenAboveVisible(cm, line, diff) {
|
6589 |
+
if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
|
6590 |
+
addToScrollPos(cm, null, diff);
|
6591 |
+
}
|
6592 |
+
|
6593 |
+
LineWidget.prototype.clear = function() {
|
6594 |
+
var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
|
6595 |
+
if (no == null || !ws) return;
|
6596 |
+
for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);
|
6597 |
+
if (!ws.length) line.widgets = null;
|
6598 |
+
var height = widgetHeight(this);
|
6599 |
+
updateLineHeight(line, Math.max(0, line.height - height));
|
6600 |
+
if (cm) runInOp(cm, function() {
|
6601 |
+
adjustScrollWhenAboveVisible(cm, line, -height);
|
6602 |
+
regLineChange(cm, no, "widget");
|
6603 |
+
});
|
6604 |
+
};
|
6605 |
+
LineWidget.prototype.changed = function() {
|
6606 |
+
var oldH = this.height, cm = this.doc.cm, line = this.line;
|
6607 |
+
this.height = null;
|
6608 |
+
var diff = widgetHeight(this) - oldH;
|
6609 |
+
if (!diff) return;
|
6610 |
+
updateLineHeight(line, line.height + diff);
|
6611 |
+
if (cm) runInOp(cm, function() {
|
6612 |
+
cm.curOp.forceUpdate = true;
|
6613 |
+
adjustScrollWhenAboveVisible(cm, line, diff);
|
6614 |
+
});
|
6615 |
+
};
|
6616 |
+
|
6617 |
+
function widgetHeight(widget) {
|
6618 |
+
if (widget.height != null) return widget.height;
|
6619 |
+
var cm = widget.doc.cm;
|
6620 |
+
if (!cm) return 0;
|
6621 |
+
if (!contains(document.body, widget.node)) {
|
6622 |
+
var parentStyle = "position: relative;";
|
6623 |
+
if (widget.coverGutter)
|
6624 |
+
parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;";
|
6625 |
+
if (widget.noHScroll)
|
6626 |
+
parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;";
|
6627 |
+
removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
|
6628 |
+
}
|
6629 |
+
return widget.height = widget.node.offsetHeight;
|
6630 |
+
}
|
6631 |
+
|
6632 |
+
function addLineWidget(doc, handle, node, options) {
|
6633 |
+
var widget = new LineWidget(doc, node, options);
|
6634 |
+
var cm = doc.cm;
|
6635 |
+
if (cm && widget.noHScroll) cm.display.alignWidgets = true;
|
6636 |
+
changeLine(doc, handle, "widget", function(line) {
|
6637 |
+
var widgets = line.widgets || (line.widgets = []);
|
6638 |
+
if (widget.insertAt == null) widgets.push(widget);
|
6639 |
+
else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);
|
6640 |
+
widget.line = line;
|
6641 |
+
if (cm && !lineIsHidden(doc, line)) {
|
6642 |
+
var aboveVisible = heightAtLine(line) < doc.scrollTop;
|
6643 |
+
updateLineHeight(line, line.height + widgetHeight(widget));
|
6644 |
+
if (aboveVisible) addToScrollPos(cm, null, widget.height);
|
6645 |
+
cm.curOp.forceUpdate = true;
|
6646 |
+
}
|
6647 |
+
return true;
|
6648 |
+
});
|
6649 |
+
return widget;
|
6650 |
+
}
|
6651 |
+
|
6652 |
+
// LINE DATA STRUCTURE
|
6653 |
+
|
6654 |
+
// Line objects. These hold state related to a line, including
|
6655 |
+
// highlighting info (the styles array).
|
6656 |
+
var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {
|
6657 |
+
this.text = text;
|
6658 |
+
attachMarkedSpans(this, markedSpans);
|
6659 |
+
this.height = estimateHeight ? estimateHeight(this) : 1;
|
6660 |
+
};
|
6661 |
+
eventMixin(Line);
|
6662 |
+
Line.prototype.lineNo = function() { return lineNo(this); };
|
6663 |
+
|
6664 |
+
// Change the content (text, markers) of a line. Automatically
|
6665 |
+
// invalidates cached information and tries to re-estimate the
|
6666 |
+
// line's height.
|
6667 |
+
function updateLine(line, text, markedSpans, estimateHeight) {
|
6668 |
+
line.text = text;
|
6669 |
+
if (line.stateAfter) line.stateAfter = null;
|
6670 |
+
if (line.styles) line.styles = null;
|
6671 |
+
if (line.order != null) line.order = null;
|
6672 |
+
detachMarkedSpans(line);
|
6673 |
+
attachMarkedSpans(line, markedSpans);
|
6674 |
+
var estHeight = estimateHeight ? estimateHeight(line) : 1;
|
6675 |
+
if (estHeight != line.height) updateLineHeight(line, estHeight);
|
6676 |
+
}
|
6677 |
+
|
6678 |
+
// Detach a line from the document tree and its markers.
|
6679 |
+
function cleanUpLine(line) {
|
6680 |
+
line.parent = null;
|
6681 |
+
detachMarkedSpans(line);
|
6682 |
+
}
|
6683 |
+
|
6684 |
+
function extractLineClasses(type, output) {
|
6685 |
+
if (type) for (;;) {
|
6686 |
+
var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
|
6687 |
+
if (!lineClass) break;
|
6688 |
+
type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
|
6689 |
+
var prop = lineClass[1] ? "bgClass" : "textClass";
|
6690 |
+
if (output[prop] == null)
|
6691 |
+
output[prop] = lineClass[2];
|
6692 |
+
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
|
6693 |
+
output[prop] += " " + lineClass[2];
|
6694 |
+
}
|
6695 |
+
return type;
|
6696 |
+
}
|
6697 |
+
|
6698 |
+
function callBlankLine(mode, state) {
|
6699 |
+
if (mode.blankLine) return mode.blankLine(state);
|
6700 |
+
if (!mode.innerMode) return;
|
6701 |
+
var inner = CodeMirror.innerMode(mode, state);
|
6702 |
+
if (inner.mode.blankLine) return inner.mode.blankLine(inner.state);
|
6703 |
+
}
|
6704 |
+
|
6705 |
+
function readToken(mode, stream, state, inner) {
|
6706 |
+
for (var i = 0; i < 10; i++) {
|
6707 |
+
if (inner) inner[0] = CodeMirror.innerMode(mode, state).mode;
|
6708 |
+
var style = mode.token(stream, state);
|
6709 |
+
if (stream.pos > stream.start) return style;
|
6710 |
+
}
|
6711 |
+
throw new Error("Mode " + mode.name + " failed to advance stream.");
|
6712 |
+
}
|
6713 |
+
|
6714 |
+
// Utility for getTokenAt and getLineTokens
|
6715 |
+
function takeToken(cm, pos, precise, asArray) {
|
6716 |
+
function getObj(copy) {
|
6717 |
+
return {start: stream.start, end: stream.pos,
|
6718 |
+
string: stream.current(),
|
6719 |
+
type: style || null,
|
6720 |
+
state: copy ? copyState(doc.mode, state) : state};
|
6721 |
+
}
|
6722 |
+
|
6723 |
+
var doc = cm.doc, mode = doc.mode, style;
|
6724 |
+
pos = clipPos(doc, pos);
|
6725 |
+
var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise);
|
6726 |
+
var stream = new StringStream(line.text, cm.options.tabSize), tokens;
|
6727 |
+
if (asArray) tokens = [];
|
6728 |
+
while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
|
6729 |
+
stream.start = stream.pos;
|
6730 |
+
style = readToken(mode, stream, state);
|
6731 |
+
if (asArray) tokens.push(getObj(true));
|
6732 |
+
}
|
6733 |
+
return asArray ? tokens : getObj();
|
6734 |
+
}
|
6735 |
+
|
6736 |
+
// Run the given mode's parser over a line, calling f for each token.
|
6737 |
+
function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
|
6738 |
+
var flattenSpans = mode.flattenSpans;
|
6739 |
+
if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
|
6740 |
+
var curStart = 0, curStyle = null;
|
6741 |
+
var stream = new StringStream(text, cm.options.tabSize), style;
|
6742 |
+
var inner = cm.options.addModeClass && [null];
|
6743 |
+
if (text == "") extractLineClasses(callBlankLine(mode, state), lineClasses);
|
6744 |
+
while (!stream.eol()) {
|
6745 |
+
if (stream.pos > cm.options.maxHighlightLength) {
|
6746 |
+
flattenSpans = false;
|
6747 |
+
if (forceToEnd) processLine(cm, text, state, stream.pos);
|
6748 |
+
stream.pos = text.length;
|
6749 |
+
style = null;
|
6750 |
+
} else {
|
6751 |
+
style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses);
|
6752 |
+
}
|
6753 |
+
if (inner) {
|
6754 |
+
var mName = inner[0].name;
|
6755 |
+
if (mName) style = "m-" + (style ? mName + " " + style : mName);
|
6756 |
+
}
|
6757 |
+
if (!flattenSpans || curStyle != style) {
|
6758 |
+
while (curStart < stream.start) {
|
6759 |
+
curStart = Math.min(stream.start, curStart + 50000);
|
6760 |
+
f(curStart, curStyle);
|
6761 |
+
}
|
6762 |
+
curStyle = style;
|
6763 |
+
}
|
6764 |
+
stream.start = stream.pos;
|
6765 |
+
}
|
6766 |
+
while (curStart < stream.pos) {
|
6767 |
+
// Webkit seems to refuse to render text nodes longer than 57444 characters
|
6768 |
+
var pos = Math.min(stream.pos, curStart + 50000);
|
6769 |
+
f(pos, curStyle);
|
6770 |
+
curStart = pos;
|
6771 |
+
}
|
6772 |
+
}
|
6773 |
+
|
6774 |
+
// Compute a style array (an array starting with a mode generation
|
6775 |
+
// -- for invalidation -- followed by pairs of end positions and
|
6776 |
+
// style strings), which is used to highlight the tokens on the
|
6777 |
+
// line.
|
6778 |
+
function highlightLine(cm, line, state, forceToEnd) {
|
6779 |
+
// A styles array always starts with a number identifying the
|
6780 |
+
// mode/overlays that it is based on (for easy invalidation).
|
6781 |
+
var st = [cm.state.modeGen], lineClasses = {};
|
6782 |
+
// Compute the base array of styles
|
6783 |
+
runMode(cm, line.text, cm.doc.mode, state, function(end, style) {
|
6784 |
+
st.push(end, style);
|
6785 |
+
}, lineClasses, forceToEnd);
|
6786 |
+
|
6787 |
+
// Run overlays, adjust style array.
|
6788 |
+
for (var o = 0; o < cm.state.overlays.length; ++o) {
|
6789 |
+
var overlay = cm.state.overlays[o], i = 1, at = 0;
|
6790 |
+
runMode(cm, line.text, overlay.mode, true, function(end, style) {
|
6791 |
+
var start = i;
|
6792 |
+
// Ensure there's a token end at the current position, and that i points at it
|
6793 |
+
while (at < end) {
|
6794 |
+
var i_end = st[i];
|
6795 |
+
if (i_end > end)
|
6796 |
+
st.splice(i, 1, end, st[i+1], i_end);
|
6797 |
+
i += 2;
|
6798 |
+
at = Math.min(end, i_end);
|
6799 |
+
}
|
6800 |
+
if (!style) return;
|
6801 |
+
if (overlay.opaque) {
|
6802 |
+
st.splice(start, i - start, end, "cm-overlay " + style);
|
6803 |
+
i = start + 2;
|
6804 |
+
} else {
|
6805 |
+
for (; start < i; start += 2) {
|
6806 |
+
var cur = st[start+1];
|
6807 |
+
st[start+1] = (cur ? cur + " " : "") + "cm-overlay " + style;
|
6808 |
+
}
|
6809 |
+
}
|
6810 |
+
}, lineClasses);
|
6811 |
+
}
|
6812 |
+
|
6813 |
+
return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null};
|
6814 |
+
}
|
6815 |
+
|
6816 |
+
function getLineStyles(cm, line, updateFrontier) {
|
6817 |
+
if (!line.styles || line.styles[0] != cm.state.modeGen) {
|
6818 |
+
var state = getStateBefore(cm, lineNo(line));
|
6819 |
+
var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state);
|
6820 |
+
line.stateAfter = state;
|
6821 |
+
line.styles = result.styles;
|
6822 |
+
if (result.classes) line.styleClasses = result.classes;
|
6823 |
+
else if (line.styleClasses) line.styleClasses = null;
|
6824 |
+
if (updateFrontier === cm.doc.frontier) cm.doc.frontier++;
|
6825 |
+
}
|
6826 |
+
return line.styles;
|
6827 |
+
}
|
6828 |
+
|
6829 |
+
// Lightweight form of highlight -- proceed over this line and
|
6830 |
+
// update state, but don't save a style array. Used for lines that
|
6831 |
+
// aren't currently visible.
|
6832 |
+
function processLine(cm, text, state, startAt) {
|
6833 |
+
var mode = cm.doc.mode;
|
6834 |
+
var stream = new StringStream(text, cm.options.tabSize);
|
6835 |
+
stream.start = stream.pos = startAt || 0;
|
6836 |
+
if (text == "") callBlankLine(mode, state);
|
6837 |
+
while (!stream.eol()) {
|
6838 |
+
readToken(mode, stream, state);
|
6839 |
+
stream.start = stream.pos;
|
6840 |
+
}
|
6841 |
+
}
|
6842 |
+
|
6843 |
+
// Convert a style as returned by a mode (either null, or a string
|
6844 |
+
// containing one or more styles) to a CSS style. This is cached,
|
6845 |
+
// and also looks for line-wide styles.
|
6846 |
+
var styleToClassCache = {}, styleToClassCacheWithMode = {};
|
6847 |
+
function interpretTokenStyle(style, options) {
|
6848 |
+
if (!style || /^\s*$/.test(style)) return null;
|
6849 |
+
var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
|
6850 |
+
return cache[style] ||
|
6851 |
+
(cache[style] = style.replace(/\S+/g, "cm-$&"));
|
6852 |
+
}
|
6853 |
+
|
6854 |
+
// Render the DOM representation of the text of a line. Also builds
|
6855 |
+
// up a 'line map', which points at the DOM nodes that represent
|
6856 |
+
// specific stretches of text, and is used by the measuring code.
|
6857 |
+
// The returned object contains the DOM node, this map, and
|
6858 |
+
// information about line-wide styles that were set by the mode.
|
6859 |
+
function buildLineContent(cm, lineView) {
|
6860 |
+
// The padding-right forces the element to have a 'border', which
|
6861 |
+
// is needed on Webkit to be able to get line-level bounding
|
6862 |
+
// rectangles for it (in measureChar).
|
6863 |
+
var content = elt("span", null, null, webkit ? "padding-right: .1px" : null);
|
6864 |
+
var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content,
|
6865 |
+
col: 0, pos: 0, cm: cm,
|
6866 |
+
splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
|
6867 |
+
lineView.measure = {};
|
6868 |
+
|
6869 |
+
// Iterate over the logical lines that make up this visual line.
|
6870 |
+
for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
|
6871 |
+
var line = i ? lineView.rest[i - 1] : lineView.line, order;
|
6872 |
+
builder.pos = 0;
|
6873 |
+
builder.addToken = buildToken;
|
6874 |
+
// Optionally wire in some hacks into the token-rendering
|
6875 |
+
// algorithm, to deal with browser quirks.
|
6876 |
+
if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line)))
|
6877 |
+
builder.addToken = buildTokenBadBidi(builder.addToken, order);
|
6878 |
+
builder.map = [];
|
6879 |
+
var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
|
6880 |
+
insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
|
6881 |
+
if (line.styleClasses) {
|
6882 |
+
if (line.styleClasses.bgClass)
|
6883 |
+
builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "");
|
6884 |
+
if (line.styleClasses.textClass)
|
6885 |
+
builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "");
|
6886 |
+
}
|
6887 |
+
|
6888 |
+
// Ensure at least a single node is present, for measuring.
|
6889 |
+
if (builder.map.length == 0)
|
6890 |
+
builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));
|
6891 |
+
|
6892 |
+
// Store the map and a cache object for the current logical line
|
6893 |
+
if (i == 0) {
|
6894 |
+
lineView.measure.map = builder.map;
|
6895 |
+
lineView.measure.cache = {};
|
6896 |
+
} else {
|
6897 |
+
(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map);
|
6898 |
+
(lineView.measure.caches || (lineView.measure.caches = [])).push({});
|
6899 |
+
}
|
6900 |
+
}
|
6901 |
+
|
6902 |
+
// See issue #2901
|
6903 |
+
if (webkit && /\bcm-tab\b/.test(builder.content.lastChild.className))
|
6904 |
+
builder.content.className = "cm-tab-wrap-hack";
|
6905 |
+
|
6906 |
+
signal(cm, "renderLine", cm, lineView.line, builder.pre);
|
6907 |
+
if (builder.pre.className)
|
6908 |
+
builder.textClass = joinClasses(builder.pre.className, builder.textClass || "");
|
6909 |
+
|
6910 |
+
return builder;
|
6911 |
+
}
|
6912 |
+
|
6913 |
+
function defaultSpecialCharPlaceholder(ch) {
|
6914 |
+
var token = elt("span", "\u2022", "cm-invalidchar");
|
6915 |
+
token.title = "\\u" + ch.charCodeAt(0).toString(16);
|
6916 |
+
token.setAttribute("aria-label", token.title);
|
6917 |
+
return token;
|
6918 |
+
}
|
6919 |
+
|
6920 |
+
// Build up the DOM representation for a single token, and add it to
|
6921 |
+
// the line map. Takes care to render special characters separately.
|
6922 |
+
function buildToken(builder, text, style, startStyle, endStyle, title, css) {
|
6923 |
+
if (!text) return;
|
6924 |
+
var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;
|
6925 |
+
var special = builder.cm.state.specialChars, mustWrap = false;
|
6926 |
+
if (!special.test(text)) {
|
6927 |
+
builder.col += text.length;
|
6928 |
+
var content = document.createTextNode(displayText);
|
6929 |
+
builder.map.push(builder.pos, builder.pos + text.length, content);
|
6930 |
+
if (ie && ie_version < 9) mustWrap = true;
|
6931 |
+
builder.pos += text.length;
|
6932 |
+
} else {
|
6933 |
+
var content = document.createDocumentFragment(), pos = 0;
|
6934 |
+
while (true) {
|
6935 |
+
special.lastIndex = pos;
|
6936 |
+
var m = special.exec(text);
|
6937 |
+
var skipped = m ? m.index - pos : text.length - pos;
|
6938 |
+
if (skipped) {
|
6939 |
+
var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
|
6940 |
+
if (ie && ie_version < 9) content.appendChild(elt("span", [txt]));
|
6941 |
+
else content.appendChild(txt);
|
6942 |
+
builder.map.push(builder.pos, builder.pos + skipped, txt);
|
6943 |
+
builder.col += skipped;
|
6944 |
+
builder.pos += skipped;
|
6945 |
+
}
|
6946 |
+
if (!m) break;
|
6947 |
+
pos += skipped + 1;
|
6948 |
+
if (m[0] == "\t") {
|
6949 |
+
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
|
6950 |
+
var txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
|
6951 |
+
txt.setAttribute("role", "presentation");
|
6952 |
+
txt.setAttribute("cm-text", "\t");
|
6953 |
+
builder.col += tabWidth;
|
6954 |
+
} else if (m[0] == "\r" || m[0] == "\n") {
|
6955 |
+
var txt = content.appendChild(elt("span", m[0] == "\r" ? "␍" : "", "cm-invalidchar"));
|
6956 |
+
txt.setAttribute("cm-text", m[0]);
|
6957 |
+
builder.col += 1;
|
6958 |
+
} else {
|
6959 |
+
var txt = builder.cm.options.specialCharPlaceholder(m[0]);
|
6960 |
+
txt.setAttribute("cm-text", m[0]);
|
6961 |
+
if (ie && ie_version < 9) content.appendChild(elt("span", [txt]));
|
6962 |
+
else content.appendChild(txt);
|
6963 |
+
builder.col += 1;
|
6964 |
+
}
|
6965 |
+
builder.map.push(builder.pos, builder.pos + 1, txt);
|
6966 |
+
builder.pos++;
|
6967 |
+
}
|
6968 |
+
}
|
6969 |
+
if (style || startStyle || endStyle || mustWrap || css) {
|
6970 |
+
var fullStyle = style || "";
|
6971 |
+
if (startStyle) fullStyle += startStyle;
|
6972 |
+
if (endStyle) fullStyle += endStyle;
|
6973 |
+
var token = elt("span", [content], fullStyle, css);
|
6974 |
+
if (title) token.title = title;
|
6975 |
+
return builder.content.appendChild(token);
|
6976 |
+
}
|
6977 |
+
builder.content.appendChild(content);
|
6978 |
+
}
|
6979 |
+
|
6980 |
+
function splitSpaces(old) {
|
6981 |
+
var out = " ";
|
6982 |
+
for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0";
|
6983 |
+
out += " ";
|
6984 |
+
return out;
|
6985 |
+
}
|
6986 |
+
|
6987 |
+
// Work around nonsense dimensions being reported for stretches of
|
6988 |
+
// right-to-left text.
|
6989 |
+
function buildTokenBadBidi(inner, order) {
|
6990 |
+
return function(builder, text, style, startStyle, endStyle, title, css) {
|
6991 |
+
style = style ? style + " cm-force-border" : "cm-force-border";
|
6992 |
+
var start = builder.pos, end = start + text.length;
|
6993 |
+
for (;;) {
|
6994 |
+
// Find the part that overlaps with the start of this text
|
6995 |
+
for (var i = 0; i < order.length; i++) {
|
6996 |
+
var part = order[i];
|
6997 |
+
if (part.to > start && part.from <= start) break;
|
6998 |
+
}
|
6999 |
+
if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title, css);
|
7000 |
+
inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);
|
7001 |
+
startStyle = null;
|
7002 |
+
text = text.slice(part.to - start);
|
7003 |
+
start = part.to;
|
7004 |
+
}
|
7005 |
+
};
|
7006 |
+
}
|
7007 |
+
|
7008 |
+
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
7009 |
+
var widget = !ignoreWidget && marker.widgetNode;
|
7010 |
+
if (widget) builder.map.push(builder.pos, builder.pos + size, widget);
|
7011 |
+
if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
|
7012 |
+
if (!widget)
|
7013 |
+
widget = builder.content.appendChild(document.createElement("span"));
|
7014 |
+
widget.setAttribute("cm-marker", marker.id);
|
7015 |
+
}
|
7016 |
+
if (widget) {
|
7017 |
+
builder.cm.display.input.setUneditable(widget);
|
7018 |
+
builder.content.appendChild(widget);
|
7019 |
+
}
|
7020 |
+
builder.pos += size;
|
7021 |
+
}
|
7022 |
+
|
7023 |
+
// Outputs a number of spans to make up a line, taking highlighting
|
7024 |
+
// and marked text into account.
|
7025 |
+
function insertLineContent(line, builder, styles) {
|
7026 |
+
var spans = line.markedSpans, allText = line.text, at = 0;
|
7027 |
+
if (!spans) {
|
7028 |
+
for (var i = 1; i < styles.length; i+=2)
|
7029 |
+
builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options));
|
7030 |
+
return;
|
7031 |
+
}
|
7032 |
+
|
7033 |
+
var len = allText.length, pos = 0, i = 1, text = "", style, css;
|
7034 |
+
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
|
7035 |
+
for (;;) {
|
7036 |
+
if (nextChange == pos) { // Update current marker set
|
7037 |
+
spanStyle = spanEndStyle = spanStartStyle = title = css = "";
|
7038 |
+
collapsed = null; nextChange = Infinity;
|
7039 |
+
var foundBookmarks = [];
|
7040 |
+
for (var j = 0; j < spans.length; ++j) {
|
7041 |
+
var sp = spans[j], m = sp.marker;
|
7042 |
+
if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
|
7043 |
+
foundBookmarks.push(m);
|
7044 |
+
} else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
|
7045 |
+
if (sp.to != null && sp.to != pos && nextChange > sp.to) {
|
7046 |
+
nextChange = sp.to;
|
7047 |
+
spanEndStyle = "";
|
7048 |
+
}
|
7049 |
+
if (m.className) spanStyle += " " + m.className;
|
7050 |
+
if (m.css) css = m.css;
|
7051 |
+
if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
|
7052 |
+
if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
|
7053 |
+
if (m.title && !title) title = m.title;
|
7054 |
+
if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
|
7055 |
+
collapsed = sp;
|
7056 |
+
} else if (sp.from > pos && nextChange > sp.from) {
|
7057 |
+
nextChange = sp.from;
|
7058 |
+
}
|
7059 |
+
}
|
7060 |
+
if (collapsed && (collapsed.from || 0) == pos) {
|
7061 |
+
buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
|
7062 |
+
collapsed.marker, collapsed.from == null);
|
7063 |
+
if (collapsed.to == null) return;
|
7064 |
+
if (collapsed.to == pos) collapsed = false;
|
7065 |
+
}
|
7066 |
+
if (!collapsed && foundBookmarks.length) for (var j = 0; j < foundBookmarks.length; ++j)
|
7067 |
+
buildCollapsedSpan(builder, 0, foundBookmarks[j]);
|
7068 |
+
}
|
7069 |
+
if (pos >= len) break;
|
7070 |
+
|
7071 |
+
var upto = Math.min(len, nextChange);
|
7072 |
+
while (true) {
|
7073 |
+
if (text) {
|
7074 |
+
var end = pos + text.length;
|
7075 |
+
if (!collapsed) {
|
7076 |
+
var tokenText = end > upto ? text.slice(0, upto - pos) : text;
|
7077 |
+
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
7078 |
+
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css);
|
7079 |
+
}
|
7080 |
+
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
|
7081 |
+
pos = end;
|
7082 |
+
spanStartStyle = "";
|
7083 |
+
}
|
7084 |
+
text = allText.slice(at, at = styles[i++]);
|
7085 |
+
style = interpretTokenStyle(styles[i++], builder.cm.options);
|
7086 |
+
}
|
7087 |
+
}
|
7088 |
+
}
|
7089 |
+
|
7090 |
+
// DOCUMENT DATA STRUCTURE
|
7091 |
+
|
7092 |
+
// By default, updates that start and end at the beginning of a line
|
7093 |
+
// are treated specially, in order to make the association of line
|
7094 |
+
// widgets and marker elements with the text behave more intuitive.
|
7095 |
+
function isWholeLineUpdate(doc, change) {
|
7096 |
+
return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
|
7097 |
+
(!doc.cm || doc.cm.options.wholeLineUpdateBefore);
|
7098 |
+
}
|
7099 |
+
|
7100 |
+
// Perform a change on the document data structure.
|
7101 |
+
function updateDoc(doc, change, markedSpans, estimateHeight) {
|
7102 |
+
function spansFor(n) {return markedSpans ? markedSpans[n] : null;}
|
7103 |
+
function update(line, text, spans) {
|
7104 |
+
updateLine(line, text, spans, estimateHeight);
|
7105 |
+
signalLater(line, "change", line, change);
|
7106 |
+
}
|
7107 |
+
function linesFor(start, end) {
|
7108 |
+
for (var i = start, result = []; i < end; ++i)
|
7109 |
+
result.push(new Line(text[i], spansFor(i), estimateHeight));
|
7110 |
+
return result;
|
7111 |
+
}
|
7112 |
+
|
7113 |
+
var from = change.from, to = change.to, text = change.text;
|
7114 |
+
var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
|
7115 |
+
var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
|
7116 |
+
|
7117 |
+
// Adjust the line structure
|
7118 |
+
if (change.full) {
|
7119 |
+
doc.insert(0, linesFor(0, text.length));
|
7120 |
+
doc.remove(text.length, doc.size - text.length);
|
7121 |
+
} else if (isWholeLineUpdate(doc, change)) {
|
7122 |
+
// This is a whole-line replace. Treated specially to make
|
7123 |
+
// sure line objects move the way they are supposed to.
|
7124 |
+
var added = linesFor(0, text.length - 1);
|
7125 |
+
update(lastLine, lastLine.text, lastSpans);
|
7126 |
+
if (nlines) doc.remove(from.line, nlines);
|
7127 |
+
if (added.length) doc.insert(from.line, added);
|
7128 |
+
} else if (firstLine == lastLine) {
|
7129 |
+
if (text.length == 1) {
|
7130 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
|
7131 |
+
} else {
|
7132 |
+
var added = linesFor(1, text.length - 1);
|
7133 |
+
added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
|
7134 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
7135 |
+
doc.insert(from.line + 1, added);
|
7136 |
+
}
|
7137 |
+
} else if (text.length == 1) {
|
7138 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
|
7139 |
+
doc.remove(from.line + 1, nlines);
|
7140 |
+
} else {
|
7141 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
7142 |
+
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
|
7143 |
+
var added = linesFor(1, text.length - 1);
|
7144 |
+
if (nlines > 1) doc.remove(from.line + 1, nlines - 1);
|
7145 |
+
doc.insert(from.line + 1, added);
|
7146 |
+
}
|
7147 |
+
|
7148 |
+
signalLater(doc, "change", doc, change);
|
7149 |
+
}
|
7150 |
+
|
7151 |
+
// The document is represented as a BTree consisting of leaves, with
|
7152 |
+
// chunk of lines in them, and branches, with up to ten leaves or
|
7153 |
+
// other branch nodes below them. The top node is always a branch
|
7154 |
+
// node, and is the document object itself (meaning it has
|
7155 |
+
// additional methods and properties).
|
7156 |
+
//
|
7157 |
+
// All nodes have parent links. The tree is used both to go from
|
7158 |
+
// line numbers to line objects, and to go from objects to numbers.
|
7159 |
+
// It also indexes by height, and is used to convert between height
|
7160 |
+
// and line object, and to find the total height of the document.
|
7161 |
+
//
|
7162 |
+
// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
|
7163 |
+
|
7164 |
+
function LeafChunk(lines) {
|
7165 |
+
this.lines = lines;
|
7166 |
+
this.parent = null;
|
7167 |
+
for (var i = 0, height = 0; i < lines.length; ++i) {
|
7168 |
+
lines[i].parent = this;
|
7169 |
+
height += lines[i].height;
|
7170 |
+
}
|
7171 |
+
this.height = height;
|
7172 |
+
}
|
7173 |
+
|
7174 |
+
LeafChunk.prototype = {
|
7175 |
+
chunkSize: function() { return this.lines.length; },
|
7176 |
+
// Remove the n lines at offset 'at'.
|
7177 |
+
removeInner: function(at, n) {
|
7178 |
+
for (var i = at, e = at + n; i < e; ++i) {
|
7179 |
+
var line = this.lines[i];
|
7180 |
+
this.height -= line.height;
|
7181 |
+
cleanUpLine(line);
|
7182 |
+
signalLater(line, "delete");
|
7183 |
+
}
|
7184 |
+
this.lines.splice(at, n);
|
7185 |
+
},
|
7186 |
+
// Helper used to collapse a small branch into a single leaf.
|
7187 |
+
collapse: function(lines) {
|
7188 |
+
lines.push.apply(lines, this.lines);
|
7189 |
+
},
|
7190 |
+
// Insert the given array of lines at offset 'at', count them as
|
7191 |
+
// having the given height.
|
7192 |
+
insertInner: function(at, lines, height) {
|
7193 |
+
this.height += height;
|
7194 |
+
this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
|
7195 |
+
for (var i = 0; i < lines.length; ++i) lines[i].parent = this;
|
7196 |
+
},
|
7197 |
+
// Used to iterate over a part of the tree.
|
7198 |
+
iterN: function(at, n, op) {
|
7199 |
+
for (var e = at + n; at < e; ++at)
|
7200 |
+
if (op(this.lines[at])) return true;
|
7201 |
+
}
|
7202 |
+
};
|
7203 |
+
|
7204 |
+
function BranchChunk(children) {
|
7205 |
+
this.children = children;
|
7206 |
+
var size = 0, height = 0;
|
7207 |
+
for (var i = 0; i < children.length; ++i) {
|
7208 |
+
var ch = children[i];
|
7209 |
+
size += ch.chunkSize(); height += ch.height;
|
7210 |
+
ch.parent = this;
|
7211 |
+
}
|
7212 |
+
this.size = size;
|
7213 |
+
this.height = height;
|
7214 |
+
this.parent = null;
|
7215 |
+
}
|
7216 |
+
|
7217 |
+
BranchChunk.prototype = {
|
7218 |
+
chunkSize: function() { return this.size; },
|
7219 |
+
removeInner: function(at, n) {
|
7220 |
+
this.size -= n;
|
7221 |
+
for (var i = 0; i < this.children.length; ++i) {
|
7222 |
+
var child = this.children[i], sz = child.chunkSize();
|
7223 |
+
if (at < sz) {
|
7224 |
+
var rm = Math.min(n, sz - at), oldHeight = child.height;
|
7225 |
+
child.removeInner(at, rm);
|
7226 |
+
this.height -= oldHeight - child.height;
|
7227 |
+
if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
|
7228 |
+
if ((n -= rm) == 0) break;
|
7229 |
+
at = 0;
|
7230 |
+
} else at -= sz;
|
7231 |
+
}
|
7232 |
+
// If the result is smaller than 25 lines, ensure that it is a
|
7233 |
+
// single leaf node.
|
7234 |
+
if (this.size - n < 25 &&
|
7235 |
+
(this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
|
7236 |
+
var lines = [];
|
7237 |
+
this.collapse(lines);
|
7238 |
+
this.children = [new LeafChunk(lines)];
|
7239 |
+
this.children[0].parent = this;
|
7240 |
+
}
|
7241 |
+
},
|
7242 |
+
collapse: function(lines) {
|
7243 |
+
for (var i = 0; i < this.children.length; ++i) this.children[i].collapse(lines);
|
7244 |
+
},
|
7245 |
+
insertInner: function(at, lines, height) {
|
7246 |
+
this.size += lines.length;
|
7247 |
+
this.height += height;
|
7248 |
+
for (var i = 0; i < this.children.length; ++i) {
|
7249 |
+
var child = this.children[i], sz = child.chunkSize();
|
7250 |
+
if (at <= sz) {
|
7251 |
+
child.insertInner(at, lines, height);
|
7252 |
+
if (child.lines && child.lines.length > 50) {
|
7253 |
+
while (child.lines.length > 50) {
|
7254 |
+
var spilled = child.lines.splice(child.lines.length - 25, 25);
|
7255 |
+
var newleaf = new LeafChunk(spilled);
|
7256 |
+
child.height -= newleaf.height;
|
7257 |
+
this.children.splice(i + 1, 0, newleaf);
|
7258 |
+
newleaf.parent = this;
|
7259 |
+
}
|
7260 |
+
this.maybeSpill();
|
7261 |
+
}
|
7262 |
+
break;
|
7263 |
+
}
|
7264 |
+
at -= sz;
|
7265 |
+
}
|
7266 |
+
},
|
7267 |
+
// When a node has grown, check whether it should be split.
|
7268 |
+
maybeSpill: function() {
|
7269 |
+
if (this.children.length <= 10) return;
|
7270 |
+
var me = this;
|
7271 |
+
do {
|
7272 |
+
var spilled = me.children.splice(me.children.length - 5, 5);
|
7273 |
+
var sibling = new BranchChunk(spilled);
|
7274 |
+
if (!me.parent) { // Become the parent node
|
7275 |
+
var copy = new BranchChunk(me.children);
|
7276 |
+
copy.parent = me;
|
7277 |
+
me.children = [copy, sibling];
|
7278 |
+
me = copy;
|
7279 |
+
} else {
|
7280 |
+
me.size -= sibling.size;
|
7281 |
+
me.height -= sibling.height;
|
7282 |
+
var myIndex = indexOf(me.parent.children, me);
|
7283 |
+
me.parent.children.splice(myIndex + 1, 0, sibling);
|
7284 |
+
}
|
7285 |
+
sibling.parent = me.parent;
|
7286 |
+
} while (me.children.length > 10);
|
7287 |
+
me.parent.maybeSpill();
|
7288 |
+
},
|
7289 |
+
iterN: function(at, n, op) {
|
7290 |
+
for (var i = 0; i < this.children.length; ++i) {
|
7291 |
+
var child = this.children[i], sz = child.chunkSize();
|
7292 |
+
if (at < sz) {
|
7293 |
+
var used = Math.min(n, sz - at);
|
7294 |
+
if (child.iterN(at, used, op)) return true;
|
7295 |
+
if ((n -= used) == 0) break;
|
7296 |
+
at = 0;
|
7297 |
+
} else at -= sz;
|
7298 |
+
}
|
7299 |
+
}
|
7300 |
+
};
|
7301 |
+
|
7302 |
+
var nextDocId = 0;
|
7303 |
+
var Doc = CodeMirror.Doc = function(text, mode, firstLine, lineSep) {
|
7304 |
+
if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep);
|
7305 |
+
if (firstLine == null) firstLine = 0;
|
7306 |
+
|
7307 |
+
BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
|
7308 |
+
this.first = firstLine;
|
7309 |
+
this.scrollTop = this.scrollLeft = 0;
|
7310 |
+
this.cantEdit = false;
|
7311 |
+
this.cleanGeneration = 1;
|
7312 |
+
this.frontier = firstLine;
|
7313 |
+
var start = Pos(firstLine, 0);
|
7314 |
+
this.sel = simpleSelection(start);
|
7315 |
+
this.history = new History(null);
|
7316 |
+
this.id = ++nextDocId;
|
7317 |
+
this.modeOption = mode;
|
7318 |
+
this.lineSep = lineSep;
|
7319 |
+
|
7320 |
+
if (typeof text == "string") text = this.splitLines(text);
|
7321 |
+
updateDoc(this, {from: start, to: start, text: text});
|
7322 |
+
setSelection(this, simpleSelection(start), sel_dontScroll);
|
7323 |
+
};
|
7324 |
+
|
7325 |
+
Doc.prototype = createObj(BranchChunk.prototype, {
|
7326 |
+
constructor: Doc,
|
7327 |
+
// Iterate over the document. Supports two forms -- with only one
|
7328 |
+
// argument, it calls that for each line in the document. With
|
7329 |
+
// three, it iterates over the range given by the first two (with
|
7330 |
+
// the second being non-inclusive).
|
7331 |
+
iter: function(from, to, op) {
|
7332 |
+
if (op) this.iterN(from - this.first, to - from, op);
|
7333 |
+
else this.iterN(this.first, this.first + this.size, from);
|
7334 |
+
},
|
7335 |
+
|
7336 |
+
// Non-public interface for adding and removing lines.
|
7337 |
+
insert: function(at, lines) {
|
7338 |
+
var height = 0;
|
7339 |
+
for (var i = 0; i < lines.length; ++i) height += lines[i].height;
|
7340 |
+
this.insertInner(at - this.first, lines, height);
|
7341 |
+
},
|
7342 |
+
remove: function(at, n) { this.removeInner(at - this.first, n); },
|
7343 |
+
|
7344 |
+
// From here, the methods are part of the public interface. Most
|
7345 |
+
// are also available from CodeMirror (editor) instances.
|
7346 |
+
|
7347 |
+
getValue: function(lineSep) {
|
7348 |
+
var lines = getLines(this, this.first, this.first + this.size);
|
7349 |
+
if (lineSep === false) return lines;
|
7350 |
+
return lines.join(lineSep || this.lineSeparator());
|
7351 |
+
},
|
7352 |
+
setValue: docMethodOp(function(code) {
|
7353 |
+
var top = Pos(this.first, 0), last = this.first + this.size - 1;
|
7354 |
+
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
7355 |
+
text: this.splitLines(code), origin: "setValue", full: true}, true);
|
7356 |
+
setSelection(this, simpleSelection(top));
|
7357 |
+
}),
|
7358 |
+
replaceRange: function(code, from, to, origin) {
|
7359 |
+
from = clipPos(this, from);
|
7360 |
+
to = to ? clipPos(this, to) : from;
|
7361 |
+
replaceRange(this, code, from, to, origin);
|
7362 |
+
},
|
7363 |
+
getRange: function(from, to, lineSep) {
|
7364 |
+
var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
|
7365 |
+
if (lineSep === false) return lines;
|
7366 |
+
return lines.join(lineSep || this.lineSeparator());
|
7367 |
+
},
|
7368 |
+
|
7369 |
+
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
|
7370 |
+
|
7371 |
+
getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},
|
7372 |
+
getLineNumber: function(line) {return lineNo(line);},
|
7373 |
+
|
7374 |
+
getLineHandleVisualStart: function(line) {
|
7375 |
+
if (typeof line == "number") line = getLine(this, line);
|
7376 |
+
return visualLine(line);
|
7377 |
+
},
|
7378 |
+
|
7379 |
+
lineCount: function() {return this.size;},
|
7380 |
+
firstLine: function() {return this.first;},
|
7381 |
+
lastLine: function() {return this.first + this.size - 1;},
|
7382 |
+
|
7383 |
+
clipPos: function(pos) {return clipPos(this, pos);},
|
7384 |
+
|
7385 |
+
getCursor: function(start) {
|
7386 |
+
var range = this.sel.primary(), pos;
|
7387 |
+
if (start == null || start == "head") pos = range.head;
|
7388 |
+
else if (start == "anchor") pos = range.anchor;
|
7389 |
+
else if (start == "end" || start == "to" || start === false) pos = range.to();
|
7390 |
+
else pos = range.from();
|
7391 |
+
return pos;
|
7392 |
+
},
|
7393 |
+
listSelections: function() { return this.sel.ranges; },
|
7394 |
+
somethingSelected: function() {return this.sel.somethingSelected();},
|
7395 |
+
|
7396 |
+
setCursor: docMethodOp(function(line, ch, options) {
|
7397 |
+
setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
|
7398 |
+
}),
|
7399 |
+
setSelection: docMethodOp(function(anchor, head, options) {
|
7400 |
+
setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
|
7401 |
+
}),
|
7402 |
+
extendSelection: docMethodOp(function(head, other, options) {
|
7403 |
+
extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
|
7404 |
+
}),
|
7405 |
+
extendSelections: docMethodOp(function(heads, options) {
|
7406 |
+
extendSelections(this, clipPosArray(this, heads, options));
|
7407 |
+
}),
|
7408 |
+
extendSelectionsBy: docMethodOp(function(f, options) {
|
7409 |
+
extendSelections(this, map(this.sel.ranges, f), options);
|
7410 |
+
}),
|
7411 |
+
setSelections: docMethodOp(function(ranges, primary, options) {
|
7412 |
+
if (!ranges.length) return;
|
7413 |
+
for (var i = 0, out = []; i < ranges.length; i++)
|
7414 |
+
out[i] = new Range(clipPos(this, ranges[i].anchor),
|
7415 |
+
clipPos(this, ranges[i].head));
|
7416 |
+
if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex);
|
7417 |
+
setSelection(this, normalizeSelection(out, primary), options);
|
7418 |
+
}),
|
7419 |
+
addSelection: docMethodOp(function(anchor, head, options) {
|
7420 |
+
var ranges = this.sel.ranges.slice(0);
|
7421 |
+
ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
|
7422 |
+
setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);
|
7423 |
+
}),
|
7424 |
+
|
7425 |
+
getSelection: function(lineSep) {
|
7426 |
+
var ranges = this.sel.ranges, lines;
|
7427 |
+
for (var i = 0; i < ranges.length; i++) {
|
7428 |
+
var sel = getBetween(this, ranges[i].from(), ranges[i].to());
|
7429 |
+
lines = lines ? lines.concat(sel) : sel;
|
7430 |
+
}
|
7431 |
+
if (lineSep === false) return lines;
|
7432 |
+
else return lines.join(lineSep || this.lineSeparator());
|
7433 |
+
},
|
7434 |
+
getSelections: function(lineSep) {
|
7435 |
+
var parts = [], ranges = this.sel.ranges;
|
7436 |
+
for (var i = 0; i < ranges.length; i++) {
|
7437 |
+
var sel = getBetween(this, ranges[i].from(), ranges[i].to());
|
7438 |
+
if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator());
|
7439 |
+
parts[i] = sel;
|
7440 |
+
}
|
7441 |
+
return parts;
|
7442 |
+
},
|
7443 |
+
replaceSelection: function(code, collapse, origin) {
|
7444 |
+
var dup = [];
|
7445 |
+
for (var i = 0; i < this.sel.ranges.length; i++)
|
7446 |
+
dup[i] = code;
|
7447 |
+
this.replaceSelections(dup, collapse, origin || "+input");
|
7448 |
+
},
|
7449 |
+
replaceSelections: docMethodOp(function(code, collapse, origin) {
|
7450 |
+
var changes = [], sel = this.sel;
|
7451 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
7452 |
+
var range = sel.ranges[i];
|
7453 |
+
changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
|
7454 |
+
}
|
7455 |
+
var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
|
7456 |
+
for (var i = changes.length - 1; i >= 0; i--)
|
7457 |
+
makeChange(this, changes[i]);
|
7458 |
+
if (newSel) setSelectionReplaceHistory(this, newSel);
|
7459 |
+
else if (this.cm) ensureCursorVisible(this.cm);
|
7460 |
+
}),
|
7461 |
+
undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
|
7462 |
+
redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
|
7463 |
+
undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
|
7464 |
+
redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
|
7465 |
+
|
7466 |
+
setExtending: function(val) {this.extend = val;},
|
7467 |
+
getExtending: function() {return this.extend;},
|
7468 |
+
|
7469 |
+
historySize: function() {
|
7470 |
+
var hist = this.history, done = 0, undone = 0;
|
7471 |
+
for (var i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done;
|
7472 |
+
for (var i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone;
|
7473 |
+
return {undo: done, redo: undone};
|
7474 |
+
},
|
7475 |
+
clearHistory: function() {this.history = new History(this.history.maxGeneration);},
|
7476 |
+
|
7477 |
+
markClean: function() {
|
7478 |
+
this.cleanGeneration = this.changeGeneration(true);
|
7479 |
+
},
|
7480 |
+
changeGeneration: function(forceSplit) {
|
7481 |
+
if (forceSplit)
|
7482 |
+
this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;
|
7483 |
+
return this.history.generation;
|
7484 |
+
},
|
7485 |
+
isClean: function (gen) {
|
7486 |
+
return this.history.generation == (gen || this.cleanGeneration);
|
7487 |
+
},
|
7488 |
+
|
7489 |
+
getHistory: function() {
|
7490 |
+
return {done: copyHistoryArray(this.history.done),
|
7491 |
+
undone: copyHistoryArray(this.history.undone)};
|
7492 |
+
},
|
7493 |
+
setHistory: function(histData) {
|
7494 |
+
var hist = this.history = new History(this.history.maxGeneration);
|
7495 |
+
hist.done = copyHistoryArray(histData.done.slice(0), null, true);
|
7496 |
+
hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
|
7497 |
+
},
|
7498 |
+
|
7499 |
+
addLineClass: docMethodOp(function(handle, where, cls) {
|
7500 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) {
|
7501 |
+
var prop = where == "text" ? "textClass"
|
7502 |
+
: where == "background" ? "bgClass"
|
7503 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
7504 |
+
if (!line[prop]) line[prop] = cls;
|
7505 |
+
else if (classTest(cls).test(line[prop])) return false;
|
7506 |
+
else line[prop] += " " + cls;
|
7507 |
+
return true;
|
7508 |
+
});
|
7509 |
+
}),
|
7510 |
+
removeLineClass: docMethodOp(function(handle, where, cls) {
|
7511 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function(line) {
|
7512 |
+
var prop = where == "text" ? "textClass"
|
7513 |
+
: where == "background" ? "bgClass"
|
7514 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
7515 |
+
var cur = line[prop];
|
7516 |
+
if (!cur) return false;
|
7517 |
+
else if (cls == null) line[prop] = null;
|
7518 |
+
else {
|
7519 |
+
var found = cur.match(classTest(cls));
|
7520 |
+
if (!found) return false;
|
7521 |
+
var end = found.index + found[0].length;
|
7522 |
+
line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
|
7523 |
+
}
|
7524 |
+
return true;
|
7525 |
+
});
|
7526 |
+
}),
|
7527 |
+
|
7528 |
+
addLineWidget: docMethodOp(function(handle, node, options) {
|
7529 |
+
return addLineWidget(this, handle, node, options);
|
7530 |
+
}),
|
7531 |
+
removeLineWidget: function(widget) { widget.clear(); },
|
7532 |
+
|
7533 |
+
markText: function(from, to, options) {
|
7534 |
+
return markText(this, clipPos(this, from), clipPos(this, to), options, "range");
|
7535 |
+
},
|
7536 |
+
setBookmark: function(pos, options) {
|
7537 |
+
var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
|
7538 |
+
insertLeft: options && options.insertLeft,
|
7539 |
+
clearWhenEmpty: false, shared: options && options.shared,
|
7540 |
+
handleMouseEvents: options && options.handleMouseEvents};
|
7541 |
+
pos = clipPos(this, pos);
|
7542 |
+
return markText(this, pos, pos, realOpts, "bookmark");
|
7543 |
+
},
|
7544 |
+
findMarksAt: function(pos) {
|
7545 |
+
pos = clipPos(this, pos);
|
7546 |
+
var markers = [], spans = getLine(this, pos.line).markedSpans;
|
7547 |
+
if (spans) for (var i = 0; i < spans.length; ++i) {
|
7548 |
+
var span = spans[i];
|
7549 |
+
if ((span.from == null || span.from <= pos.ch) &&
|
7550 |
+
(span.to == null || span.to >= pos.ch))
|
7551 |
+
markers.push(span.marker.parent || span.marker);
|
7552 |
+
}
|
7553 |
+
return markers;
|
7554 |
+
},
|
7555 |
+
findMarks: function(from, to, filter) {
|
7556 |
+
from = clipPos(this, from); to = clipPos(this, to);
|
7557 |
+
var found = [], lineNo = from.line;
|
7558 |
+
this.iter(from.line, to.line + 1, function(line) {
|
7559 |
+
var spans = line.markedSpans;
|
7560 |
+
if (spans) for (var i = 0; i < spans.length; i++) {
|
7561 |
+
var span = spans[i];
|
7562 |
+
if (!(lineNo == from.line && from.ch > span.to ||
|
7563 |
+
span.from == null && lineNo != from.line||
|
7564 |
+
lineNo == to.line && span.from > to.ch) &&
|
7565 |
+
(!filter || filter(span.marker)))
|
7566 |
+
found.push(span.marker.parent || span.marker);
|
7567 |
+
}
|
7568 |
+
++lineNo;
|
7569 |
+
});
|
7570 |
+
return found;
|
7571 |
+
},
|
7572 |
+
getAllMarks: function() {
|
7573 |
+
var markers = [];
|
7574 |
+
this.iter(function(line) {
|
7575 |
+
var sps = line.markedSpans;
|
7576 |
+
if (sps) for (var i = 0; i < sps.length; ++i)
|
7577 |
+
if (sps[i].from != null) markers.push(sps[i].marker);
|
7578 |
+
});
|
7579 |
+
return markers;
|
7580 |
+
},
|
7581 |
+
|
7582 |
+
posFromIndex: function(off) {
|
7583 |
+
var ch, lineNo = this.first;
|
7584 |
+
this.iter(function(line) {
|
7585 |
+
var sz = line.text.length + 1;
|
7586 |
+
if (sz > off) { ch = off; return true; }
|
7587 |
+
off -= sz;
|
7588 |
+
++lineNo;
|
7589 |
+
});
|
7590 |
+
return clipPos(this, Pos(lineNo, ch));
|
7591 |
+
},
|
7592 |
+
indexFromPos: function (coords) {
|
7593 |
+
coords = clipPos(this, coords);
|
7594 |
+
var index = coords.ch;
|
7595 |
+
if (coords.line < this.first || coords.ch < 0) return 0;
|
7596 |
+
this.iter(this.first, coords.line, function (line) {
|
7597 |
+
index += line.text.length + 1;
|
7598 |
+
});
|
7599 |
+
return index;
|
7600 |
+
},
|
7601 |
+
|
7602 |
+
copy: function(copyHistory) {
|
7603 |
+
var doc = new Doc(getLines(this, this.first, this.first + this.size),
|
7604 |
+
this.modeOption, this.first, this.lineSep);
|
7605 |
+
doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
|
7606 |
+
doc.sel = this.sel;
|
7607 |
+
doc.extend = false;
|
7608 |
+
if (copyHistory) {
|
7609 |
+
doc.history.undoDepth = this.history.undoDepth;
|
7610 |
+
doc.setHistory(this.getHistory());
|
7611 |
+
}
|
7612 |
+
return doc;
|
7613 |
+
},
|
7614 |
+
|
7615 |
+
linkedDoc: function(options) {
|
7616 |
+
if (!options) options = {};
|
7617 |
+
var from = this.first, to = this.first + this.size;
|
7618 |
+
if (options.from != null && options.from > from) from = options.from;
|
7619 |
+
if (options.to != null && options.to < to) to = options.to;
|
7620 |
+
var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep);
|
7621 |
+
if (options.sharedHist) copy.history = this.history;
|
7622 |
+
(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
|
7623 |
+
copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
|
7624 |
+
copySharedMarkers(copy, findSharedMarkers(this));
|
7625 |
+
return copy;
|
7626 |
+
},
|
7627 |
+
unlinkDoc: function(other) {
|
7628 |
+
if (other instanceof CodeMirror) other = other.doc;
|
7629 |
+
if (this.linked) for (var i = 0; i < this.linked.length; ++i) {
|
7630 |
+
var link = this.linked[i];
|
7631 |
+
if (link.doc != other) continue;
|
7632 |
+
this.linked.splice(i, 1);
|
7633 |
+
other.unlinkDoc(this);
|
7634 |
+
detachSharedMarkers(findSharedMarkers(this));
|
7635 |
+
break;
|
7636 |
+
}
|
7637 |
+
// If the histories were shared, split them again
|
7638 |
+
if (other.history == this.history) {
|
7639 |
+
var splitIds = [other.id];
|
7640 |
+
linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);
|
7641 |
+
other.history = new History(null);
|
7642 |
+
other.history.done = copyHistoryArray(this.history.done, splitIds);
|
7643 |
+
other.history.undone = copyHistoryArray(this.history.undone, splitIds);
|
7644 |
+
}
|
7645 |
+
},
|
7646 |
+
iterLinkedDocs: function(f) {linkedDocs(this, f);},
|
7647 |
+
|
7648 |
+
getMode: function() {return this.mode;},
|
7649 |
+
getEditor: function() {return this.cm;},
|
7650 |
+
|
7651 |
+
splitLines: function(str) {
|
7652 |
+
if (this.lineSep) return str.split(this.lineSep);
|
7653 |
+
return splitLinesAuto(str);
|
7654 |
+
},
|
7655 |
+
lineSeparator: function() { return this.lineSep || "\n"; }
|
7656 |
+
});
|
7657 |
+
|
7658 |
+
// Public alias.
|
7659 |
+
Doc.prototype.eachLine = Doc.prototype.iter;
|
7660 |
+
|
7661 |
+
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
7662 |
+
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
|
7663 |
+
for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
7664 |
+
CodeMirror.prototype[prop] = (function(method) {
|
7665 |
+
return function() {return method.apply(this.doc, arguments);};
|
7666 |
+
})(Doc.prototype[prop]);
|
7667 |
+
|
7668 |
+
eventMixin(Doc);
|
7669 |
+
|
7670 |
+
// Call f for all linked documents.
|
7671 |
+
function linkedDocs(doc, f, sharedHistOnly) {
|
7672 |
+
function propagate(doc, skip, sharedHist) {
|
7673 |
+
if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {
|
7674 |
+
var rel = doc.linked[i];
|
7675 |
+
if (rel.doc == skip) continue;
|
7676 |
+
var shared = sharedHist && rel.sharedHist;
|
7677 |
+
if (sharedHistOnly && !shared) continue;
|
7678 |
+
f(rel.doc, shared);
|
7679 |
+
propagate(rel.doc, doc, shared);
|
7680 |
+
}
|
7681 |
+
}
|
7682 |
+
propagate(doc, null, true);
|
7683 |
+
}
|
7684 |
+
|
7685 |
+
// Attach a document to an editor.
|
7686 |
+
function attachDoc(cm, doc) {
|
7687 |
+
if (doc.cm) throw new Error("This document is already in use.");
|
7688 |
+
cm.doc = doc;
|
7689 |
+
doc.cm = cm;
|
7690 |
+
estimateLineHeights(cm);
|
7691 |
+
loadMode(cm);
|
7692 |
+
if (!cm.options.lineWrapping) findMaxLine(cm);
|
7693 |
+
cm.options.mode = doc.modeOption;
|
7694 |
+
regChange(cm);
|
7695 |
+
}
|
7696 |
+
|
7697 |
+
// LINE UTILITIES
|
7698 |
+
|
7699 |
+
// Find the line object corresponding to the given line number.
|
7700 |
+
function getLine(doc, n) {
|
7701 |
+
n -= doc.first;
|
7702 |
+
if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.");
|
7703 |
+
for (var chunk = doc; !chunk.lines;) {
|
7704 |
+
for (var i = 0;; ++i) {
|
7705 |
+
var child = chunk.children[i], sz = child.chunkSize();
|
7706 |
+
if (n < sz) { chunk = child; break; }
|
7707 |
+
n -= sz;
|
7708 |
+
}
|
7709 |
+
}
|
7710 |
+
return chunk.lines[n];
|
7711 |
+
}
|
7712 |
+
|
7713 |
+
// Get the part of a document between two positions, as an array of
|
7714 |
+
// strings.
|
7715 |
+
function getBetween(doc, start, end) {
|
7716 |
+
var out = [], n = start.line;
|
7717 |
+
doc.iter(start.line, end.line + 1, function(line) {
|
7718 |
+
var text = line.text;
|
7719 |
+
if (n == end.line) text = text.slice(0, end.ch);
|
7720 |
+
if (n == start.line) text = text.slice(start.ch);
|
7721 |
+
out.push(text);
|
7722 |
+
++n;
|
7723 |
+
});
|
7724 |
+
return out;
|
7725 |
+
}
|
7726 |
+
// Get the lines between from and to, as array of strings.
|
7727 |
+
function getLines(doc, from, to) {
|
7728 |
+
var out = [];
|
7729 |
+
doc.iter(from, to, function(line) { out.push(line.text); });
|
7730 |
+
return out;
|
7731 |
+
}
|
7732 |
+
|
7733 |
+
// Update the height of a line, propagating the height change
|
7734 |
+
// upwards to parent nodes.
|
7735 |
+
function updateLineHeight(line, height) {
|
7736 |
+
var diff = height - line.height;
|
7737 |
+
if (diff) for (var n = line; n; n = n.parent) n.height += diff;
|
7738 |
+
}
|
7739 |
+
|
7740 |
+
// Given a line object, find its line number by walking up through
|
7741 |
+
// its parent links.
|
7742 |
+
function lineNo(line) {
|
7743 |
+
if (line.parent == null) return null;
|
7744 |
+
var cur = line.parent, no = indexOf(cur.lines, line);
|
7745 |
+
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
7746 |
+
for (var i = 0;; ++i) {
|
7747 |
+
if (chunk.children[i] == cur) break;
|
7748 |
+
no += chunk.children[i].chunkSize();
|
7749 |
+
}
|
7750 |
+
}
|
7751 |
+
return no + cur.first;
|
7752 |
+
}
|
7753 |
+
|
7754 |
+
// Find the line at the given vertical position, using the height
|
7755 |
+
// information in the document tree.
|
7756 |
+
function lineAtHeight(chunk, h) {
|
7757 |
+
var n = chunk.first;
|
7758 |
+
outer: do {
|
7759 |
+
for (var i = 0; i < chunk.children.length; ++i) {
|
7760 |
+
var child = chunk.children[i], ch = child.height;
|
7761 |
+
if (h < ch) { chunk = child; continue outer; }
|
7762 |
+
h -= ch;
|
7763 |
+
n += child.chunkSize();
|
7764 |
+
}
|
7765 |
+
return n;
|
7766 |
+
} while (!chunk.lines);
|
7767 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
7768 |
+
var line = chunk.lines[i], lh = line.height;
|
7769 |
+
if (h < lh) break;
|
7770 |
+
h -= lh;
|
7771 |
+
}
|
7772 |
+
return n + i;
|
7773 |
+
}
|
7774 |
+
|
7775 |
+
|
7776 |
+
// Find the height above the given line.
|
7777 |
+
function heightAtLine(lineObj) {
|
7778 |
+
lineObj = visualLine(lineObj);
|
7779 |
+
|
7780 |
+
var h = 0, chunk = lineObj.parent;
|
7781 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
7782 |
+
var line = chunk.lines[i];
|
7783 |
+
if (line == lineObj) break;
|
7784 |
+
else h += line.height;
|
7785 |
+
}
|
7786 |
+
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
7787 |
+
for (var i = 0; i < p.children.length; ++i) {
|
7788 |
+
var cur = p.children[i];
|
7789 |
+
if (cur == chunk) break;
|
7790 |
+
else h += cur.height;
|
7791 |
+
}
|
7792 |
+
}
|
7793 |
+
return h;
|
7794 |
+
}
|
7795 |
+
|
7796 |
+
// Get the bidi ordering for the given line (and cache it). Returns
|
7797 |
+
// false for lines that are fully left-to-right, and an array of
|
7798 |
+
// BidiSpan objects otherwise.
|
7799 |
+
function getOrder(line) {
|
7800 |
+
var order = line.order;
|
7801 |
+
if (order == null) order = line.order = bidiOrdering(line.text);
|
7802 |
+
return order;
|
7803 |
+
}
|
7804 |
+
|
7805 |
+
// HISTORY
|
7806 |
+
|
7807 |
+
function History(startGen) {
|
7808 |
+
// Arrays of change events and selections. Doing something adds an
|
7809 |
+
// event to done and clears undo. Undoing moves events from done
|
7810 |
+
// to undone, redoing moves them in the other direction.
|
7811 |
+
this.done = []; this.undone = [];
|
7812 |
+
this.undoDepth = Infinity;
|
7813 |
+
// Used to track when changes can be merged into a single undo
|
7814 |
+
// event
|
7815 |
+
this.lastModTime = this.lastSelTime = 0;
|
7816 |
+
this.lastOp = this.lastSelOp = null;
|
7817 |
+
this.lastOrigin = this.lastSelOrigin = null;
|
7818 |
+
// Used by the isClean() method
|
7819 |
+
this.generation = this.maxGeneration = startGen || 1;
|
7820 |
+
}
|
7821 |
+
|
7822 |
+
// Create a history change event from an updateDoc-style change
|
7823 |
+
// object.
|
7824 |
+
function historyChangeFromChange(doc, change) {
|
7825 |
+
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
|
7826 |
+
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
|
7827 |
+
linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);
|
7828 |
+
return histChange;
|
7829 |
+
}
|
7830 |
+
|
7831 |
+
// Pop all selection events off the end of a history array. Stop at
|
7832 |
+
// a change event.
|
7833 |
+
function clearSelectionEvents(array) {
|
7834 |
+
while (array.length) {
|
7835 |
+
var last = lst(array);
|
7836 |
+
if (last.ranges) array.pop();
|
7837 |
+
else break;
|
7838 |
+
}
|
7839 |
+
}
|
7840 |
+
|
7841 |
+
// Find the top change event in the history. Pop off selection
|
7842 |
+
// events that are in the way.
|
7843 |
+
function lastChangeEvent(hist, force) {
|
7844 |
+
if (force) {
|
7845 |
+
clearSelectionEvents(hist.done);
|
7846 |
+
return lst(hist.done);
|
7847 |
+
} else if (hist.done.length && !lst(hist.done).ranges) {
|
7848 |
+
return lst(hist.done);
|
7849 |
+
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
|
7850 |
+
hist.done.pop();
|
7851 |
+
return lst(hist.done);
|
7852 |
+
}
|
7853 |
+
}
|
7854 |
+
|
7855 |
+
// Register a change in the history. Merges changes that are within
|
7856 |
+
// a single operation, ore are close together with an origin that
|
7857 |
+
// allows merging (starting with "+") into a single event.
|
7858 |
+
function addChangeToHistory(doc, change, selAfter, opId) {
|
7859 |
+
var hist = doc.history;
|
7860 |
+
hist.undone.length = 0;
|
7861 |
+
var time = +new Date, cur;
|
7862 |
+
|
7863 |
+
if ((hist.lastOp == opId ||
|
7864 |
+
hist.lastOrigin == change.origin && change.origin &&
|
7865 |
+
((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
|
7866 |
+
change.origin.charAt(0) == "*")) &&
|
7867 |
+
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
|
7868 |
+
// Merge this change into the last event
|
7869 |
+
var last = lst(cur.changes);
|
7870 |
+
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
|
7871 |
+
// Optimized case for simple insertion -- don't want to add
|
7872 |
+
// new changesets for every character typed
|
7873 |
+
last.to = changeEnd(change);
|
7874 |
+
} else {
|
7875 |
+
// Add new sub-event
|
7876 |
+
cur.changes.push(historyChangeFromChange(doc, change));
|
7877 |
+
}
|
7878 |
+
} else {
|
7879 |
+
// Can not be merged, start a new event.
|
7880 |
+
var before = lst(hist.done);
|
7881 |
+
if (!before || !before.ranges)
|
7882 |
+
pushSelectionToHistory(doc.sel, hist.done);
|
7883 |
+
cur = {changes: [historyChangeFromChange(doc, change)],
|
7884 |
+
generation: hist.generation};
|
7885 |
+
hist.done.push(cur);
|
7886 |
+
while (hist.done.length > hist.undoDepth) {
|
7887 |
+
hist.done.shift();
|
7888 |
+
if (!hist.done[0].ranges) hist.done.shift();
|
7889 |
+
}
|
7890 |
+
}
|
7891 |
+
hist.done.push(selAfter);
|
7892 |
+
hist.generation = ++hist.maxGeneration;
|
7893 |
+
hist.lastModTime = hist.lastSelTime = time;
|
7894 |
+
hist.lastOp = hist.lastSelOp = opId;
|
7895 |
+
hist.lastOrigin = hist.lastSelOrigin = change.origin;
|
7896 |
+
|
7897 |
+
if (!last) signal(doc, "historyAdded");
|
7898 |
+
}
|
7899 |
+
|
7900 |
+
function selectionEventCanBeMerged(doc, origin, prev, sel) {
|
7901 |
+
var ch = origin.charAt(0);
|
7902 |
+
return ch == "*" ||
|
7903 |
+
ch == "+" &&
|
7904 |
+
prev.ranges.length == sel.ranges.length &&
|
7905 |
+
prev.somethingSelected() == sel.somethingSelected() &&
|
7906 |
+
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);
|
7907 |
+
}
|
7908 |
+
|
7909 |
+
// Called whenever the selection changes, sets the new selection as
|
7910 |
+
// the pending selection in the history, and pushes the old pending
|
7911 |
+
// selection into the 'done' array when it was significantly
|
7912 |
+
// different (in number of selected ranges, emptiness, or time).
|
7913 |
+
function addSelectionToHistory(doc, sel, opId, options) {
|
7914 |
+
var hist = doc.history, origin = options && options.origin;
|
7915 |
+
|
7916 |
+
// A new event is started when the previous origin does not match
|
7917 |
+
// the current, or the origins don't allow matching. Origins
|
7918 |
+
// starting with * are always merged, those starting with + are
|
7919 |
+
// merged when similar and close together in time.
|
7920 |
+
if (opId == hist.lastSelOp ||
|
7921 |
+
(origin && hist.lastSelOrigin == origin &&
|
7922 |
+
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
|
7923 |
+
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
|
7924 |
+
hist.done[hist.done.length - 1] = sel;
|
7925 |
+
else
|
7926 |
+
pushSelectionToHistory(sel, hist.done);
|
7927 |
+
|
7928 |
+
hist.lastSelTime = +new Date;
|
7929 |
+
hist.lastSelOrigin = origin;
|
7930 |
+
hist.lastSelOp = opId;
|
7931 |
+
if (options && options.clearRedo !== false)
|
7932 |
+
clearSelectionEvents(hist.undone);
|
7933 |
+
}
|
7934 |
+
|
7935 |
+
function pushSelectionToHistory(sel, dest) {
|
7936 |
+
var top = lst(dest);
|
7937 |
+
if (!(top && top.ranges && top.equals(sel)))
|
7938 |
+
dest.push(sel);
|
7939 |
+
}
|
7940 |
+
|
7941 |
+
// Used to store marked span information in the history.
|
7942 |
+
function attachLocalSpans(doc, change, from, to) {
|
7943 |
+
var existing = change["spans_" + doc.id], n = 0;
|
7944 |
+
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
|
7945 |
+
if (line.markedSpans)
|
7946 |
+
(existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
|
7947 |
+
++n;
|
7948 |
+
});
|
7949 |
+
}
|
7950 |
+
|
7951 |
+
// When un/re-doing restores text containing marked spans, those
|
7952 |
+
// that have been explicitly cleared should not be restored.
|
7953 |
+
function removeClearedSpans(spans) {
|
7954 |
+
if (!spans) return null;
|
7955 |
+
for (var i = 0, out; i < spans.length; ++i) {
|
7956 |
+
if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
|
7957 |
+
else if (out) out.push(spans[i]);
|
7958 |
+
}
|
7959 |
+
return !out ? spans : out.length ? out : null;
|
7960 |
+
}
|
7961 |
+
|
7962 |
+
// Retrieve and filter the old marked spans stored in a change event.
|
7963 |
+
function getOldSpans(doc, change) {
|
7964 |
+
var found = change["spans_" + doc.id];
|
7965 |
+
if (!found) return null;
|
7966 |
+
for (var i = 0, nw = []; i < change.text.length; ++i)
|
7967 |
+
nw.push(removeClearedSpans(found[i]));
|
7968 |
+
return nw;
|
7969 |
+
}
|
7970 |
+
|
7971 |
+
// Used both to provide a JSON-safe object in .getHistory, and, when
|
7972 |
+
// detaching a document, to split the history in two
|
7973 |
+
function copyHistoryArray(events, newGroup, instantiateSel) {
|
7974 |
+
for (var i = 0, copy = []; i < events.length; ++i) {
|
7975 |
+
var event = events[i];
|
7976 |
+
if (event.ranges) {
|
7977 |
+
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
|
7978 |
+
continue;
|
7979 |
+
}
|
7980 |
+
var changes = event.changes, newChanges = [];
|
7981 |
+
copy.push({changes: newChanges});
|
7982 |
+
for (var j = 0; j < changes.length; ++j) {
|
7983 |
+
var change = changes[j], m;
|
7984 |
+
newChanges.push({from: change.from, to: change.to, text: change.text});
|
7985 |
+
if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
|
7986 |
+
if (indexOf(newGroup, Number(m[1])) > -1) {
|
7987 |
+
lst(newChanges)[prop] = change[prop];
|
7988 |
+
delete change[prop];
|
7989 |
+
}
|
7990 |
+
}
|
7991 |
+
}
|
7992 |
+
}
|
7993 |
+
return copy;
|
7994 |
+
}
|
7995 |
+
|
7996 |
+
// Rebasing/resetting history to deal with externally-sourced changes
|
7997 |
+
|
7998 |
+
function rebaseHistSelSingle(pos, from, to, diff) {
|
7999 |
+
if (to < pos.line) {
|
8000 |
+
pos.line += diff;
|
8001 |
+
} else if (from < pos.line) {
|
8002 |
+
pos.line = from;
|
8003 |
+
pos.ch = 0;
|
8004 |
+
}
|
8005 |
+
}
|
8006 |
+
|
8007 |
+
// Tries to rebase an array of history events given a change in the
|
8008 |
+
// document. If the change touches the same lines as the event, the
|
8009 |
+
// event, and everything 'behind' it, is discarded. If the change is
|
8010 |
+
// before the event, the event's positions are updated. Uses a
|
8011 |
+
// copy-on-write scheme for the positions, to avoid having to
|
8012 |
+
// reallocate them all on every rebase, but also avoid problems with
|
8013 |
+
// shared position objects being unsafely updated.
|
8014 |
+
function rebaseHistArray(array, from, to, diff) {
|
8015 |
+
for (var i = 0; i < array.length; ++i) {
|
8016 |
+
var sub = array[i], ok = true;
|
8017 |
+
if (sub.ranges) {
|
8018 |
+
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
|
8019 |
+
for (var j = 0; j < sub.ranges.length; j++) {
|
8020 |
+
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
|
8021 |
+
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
|
8022 |
+
}
|
8023 |
+
continue;
|
8024 |
+
}
|
8025 |
+
for (var j = 0; j < sub.changes.length; ++j) {
|
8026 |
+
var cur = sub.changes[j];
|
8027 |
+
if (to < cur.from.line) {
|
8028 |
+
cur.from = Pos(cur.from.line + diff, cur.from.ch);
|
8029 |
+
cur.to = Pos(cur.to.line + diff, cur.to.ch);
|
8030 |
+
} else if (from <= cur.to.line) {
|
8031 |
+
ok = false;
|
8032 |
+
break;
|
8033 |
+
}
|
8034 |
+
}
|
8035 |
+
if (!ok) {
|
8036 |
+
array.splice(0, i + 1);
|
8037 |
+
i = 0;
|
8038 |
+
}
|
8039 |
+
}
|
8040 |
+
}
|
8041 |
+
|
8042 |
+
function rebaseHist(hist, change) {
|
8043 |
+
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
|
8044 |
+
rebaseHistArray(hist.done, from, to, diff);
|
8045 |
+
rebaseHistArray(hist.undone, from, to, diff);
|
8046 |
+
}
|
8047 |
+
|
8048 |
+
// EVENT UTILITIES
|
8049 |
+
|
8050 |
+
// Due to the fact that we still support jurassic IE versions, some
|
8051 |
+
// compatibility wrappers are needed.
|
8052 |
+
|
8053 |
+
var e_preventDefault = CodeMirror.e_preventDefault = function(e) {
|
8054 |
+
if (e.preventDefault) e.preventDefault();
|
8055 |
+
else e.returnValue = false;
|
8056 |
+
};
|
8057 |
+
var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {
|
8058 |
+
if (e.stopPropagation) e.stopPropagation();
|
8059 |
+
else e.cancelBubble = true;
|
8060 |
+
};
|
8061 |
+
function e_defaultPrevented(e) {
|
8062 |
+
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;
|
8063 |
+
}
|
8064 |
+
var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};
|
8065 |
+
|
8066 |
+
function e_target(e) {return e.target || e.srcElement;}
|
8067 |
+
function e_button(e) {
|
8068 |
+
var b = e.which;
|
8069 |
+
if (b == null) {
|
8070 |
+
if (e.button & 1) b = 1;
|
8071 |
+
else if (e.button & 2) b = 3;
|
8072 |
+
else if (e.button & 4) b = 2;
|
8073 |
+
}
|
8074 |
+
if (mac && e.ctrlKey && b == 1) b = 3;
|
8075 |
+
return b;
|
8076 |
+
}
|
8077 |
+
|
8078 |
+
// EVENT HANDLING
|
8079 |
+
|
8080 |
+
// Lightweight event framework. on/off also work on DOM nodes,
|
8081 |
+
// registering native DOM handlers.
|
8082 |
+
|
8083 |
+
var on = CodeMirror.on = function(emitter, type, f) {
|
8084 |
+
if (emitter.addEventListener)
|
8085 |
+
emitter.addEventListener(type, f, false);
|
8086 |
+
else if (emitter.attachEvent)
|
8087 |
+
emitter.attachEvent("on" + type, f);
|
8088 |
+
else {
|
8089 |
+
var map = emitter._handlers || (emitter._handlers = {});
|
8090 |
+
var arr = map[type] || (map[type] = []);
|
8091 |
+
arr.push(f);
|
8092 |
+
}
|
8093 |
+
};
|
8094 |
+
|
8095 |
+
var off = CodeMirror.off = function(emitter, type, f) {
|
8096 |
+
if (emitter.removeEventListener)
|
8097 |
+
emitter.removeEventListener(type, f, false);
|
8098 |
+
else if (emitter.detachEvent)
|
8099 |
+
emitter.detachEvent("on" + type, f);
|
8100 |
+
else {
|
8101 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
8102 |
+
if (!arr) return;
|
8103 |
+
for (var i = 0; i < arr.length; ++i)
|
8104 |
+
if (arr[i] == f) { arr.splice(i, 1); break; }
|
8105 |
+
}
|
8106 |
+
};
|
8107 |
+
|
8108 |
+
var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {
|
8109 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
8110 |
+
if (!arr) return;
|
8111 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
8112 |
+
for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
|
8113 |
+
};
|
8114 |
+
|
8115 |
+
var orphanDelayedCallbacks = null;
|
8116 |
+
|
8117 |
+
// Often, we want to signal events at a point where we are in the
|
8118 |
+
// middle of some work, but don't want the handler to start calling
|
8119 |
+
// other methods on the editor, which might be in an inconsistent
|
8120 |
+
// state or simply not expect any other events to happen.
|
8121 |
+
// signalLater looks whether there are any handlers, and schedules
|
8122 |
+
// them to be executed when the last operation ends, or, if no
|
8123 |
+
// operation is active, when a timeout fires.
|
8124 |
+
function signalLater(emitter, type /*, values...*/) {
|
8125 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
8126 |
+
if (!arr) return;
|
8127 |
+
var args = Array.prototype.slice.call(arguments, 2), list;
|
8128 |
+
if (operationGroup) {
|
8129 |
+
list = operationGroup.delayedCallbacks;
|
8130 |
+
} else if (orphanDelayedCallbacks) {
|
8131 |
+
list = orphanDelayedCallbacks;
|
8132 |
+
} else {
|
8133 |
+
list = orphanDelayedCallbacks = [];
|
8134 |
+
setTimeout(fireOrphanDelayed, 0);
|
8135 |
+
}
|
8136 |
+
function bnd(f) {return function(){f.apply(null, args);};};
|
8137 |
+
for (var i = 0; i < arr.length; ++i)
|
8138 |
+
list.push(bnd(arr[i]));
|
8139 |
+
}
|
8140 |
+
|
8141 |
+
function fireOrphanDelayed() {
|
8142 |
+
var delayed = orphanDelayedCallbacks;
|
8143 |
+
orphanDelayedCallbacks = null;
|
8144 |
+
for (var i = 0; i < delayed.length; ++i) delayed[i]();
|
8145 |
+
}
|
8146 |
+
|
8147 |
+
// The DOM events that CodeMirror handles can be overridden by
|
8148 |
+
// registering a (non-DOM) handler on the editor for the event name,
|
8149 |
+
// and preventDefault-ing the event in that handler.
|
8150 |
+
function signalDOMEvent(cm, e, override) {
|
8151 |
+
if (typeof e == "string")
|
8152 |
+
e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};
|
8153 |
+
signal(cm, override || e.type, cm, e);
|
8154 |
+
return e_defaultPrevented(e) || e.codemirrorIgnore;
|
8155 |
+
}
|
8156 |
+
|
8157 |
+
function signalCursorActivity(cm) {
|
8158 |
+
var arr = cm._handlers && cm._handlers.cursorActivity;
|
8159 |
+
if (!arr) return;
|
8160 |
+
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
|
8161 |
+
for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)
|
8162 |
+
set.push(arr[i]);
|
8163 |
+
}
|
8164 |
+
|
8165 |
+
function hasHandler(emitter, type) {
|
8166 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
8167 |
+
return arr && arr.length > 0;
|
8168 |
+
}
|
8169 |
+
|
8170 |
+
// Add on and off methods to a constructor's prototype, to make
|
8171 |
+
// registering events on such objects more convenient.
|
8172 |
+
function eventMixin(ctor) {
|
8173 |
+
ctor.prototype.on = function(type, f) {on(this, type, f);};
|
8174 |
+
ctor.prototype.off = function(type, f) {off(this, type, f);};
|
8175 |
+
}
|
8176 |
+
|
8177 |
+
// MISC UTILITIES
|
8178 |
+
|
8179 |
+
// Number of pixels added to scroller and sizer to hide scrollbar
|
8180 |
+
var scrollerGap = 30;
|
8181 |
+
|
8182 |
+
// Returned or thrown by various protocols to signal 'I'm not
|
8183 |
+
// handling this'.
|
8184 |
+
var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
|
8185 |
+
|
8186 |
+
// Reused option objects for setSelection & friends
|
8187 |
+
var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
|
8188 |
+
|
8189 |
+
function Delayed() {this.id = null;}
|
8190 |
+
Delayed.prototype.set = function(ms, f) {
|
8191 |
+
clearTimeout(this.id);
|
8192 |
+
this.id = setTimeout(f, ms);
|
8193 |
+
};
|
8194 |
+
|
8195 |
+
// Counts the column offset in a string, taking tabs into account.
|
8196 |
+
// Used mostly to find indentation.
|
8197 |
+
var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {
|
8198 |
+
if (end == null) {
|
8199 |
+
end = string.search(/[^\s\u00a0]/);
|
8200 |
+
if (end == -1) end = string.length;
|
8201 |
+
}
|
8202 |
+
for (var i = startIndex || 0, n = startValue || 0;;) {
|
8203 |
+
var nextTab = string.indexOf("\t", i);
|
8204 |
+
if (nextTab < 0 || nextTab >= end)
|
8205 |
+
return n + (end - i);
|
8206 |
+
n += nextTab - i;
|
8207 |
+
n += tabSize - (n % tabSize);
|
8208 |
+
i = nextTab + 1;
|
8209 |
+
}
|
8210 |
+
};
|
8211 |
+
|
8212 |
+
// The inverse of countColumn -- find the offset that corresponds to
|
8213 |
+
// a particular column.
|
8214 |
+
function findColumn(string, goal, tabSize) {
|
8215 |
+
for (var pos = 0, col = 0;;) {
|
8216 |
+
var nextTab = string.indexOf("\t", pos);
|
8217 |
+
if (nextTab == -1) nextTab = string.length;
|
8218 |
+
var skipped = nextTab - pos;
|
8219 |
+
if (nextTab == string.length || col + skipped >= goal)
|
8220 |
+
return pos + Math.min(skipped, goal - col);
|
8221 |
+
col += nextTab - pos;
|
8222 |
+
col += tabSize - (col % tabSize);
|
8223 |
+
pos = nextTab + 1;
|
8224 |
+
if (col >= goal) return pos;
|
8225 |
+
}
|
8226 |
+
}
|
8227 |
+
|
8228 |
+
var spaceStrs = [""];
|
8229 |
+
function spaceStr(n) {
|
8230 |
+
while (spaceStrs.length <= n)
|
8231 |
+
spaceStrs.push(lst(spaceStrs) + " ");
|
8232 |
+
return spaceStrs[n];
|
8233 |
+
}
|
8234 |
+
|
8235 |
+
function lst(arr) { return arr[arr.length-1]; }
|
8236 |
+
|
8237 |
+
var selectInput = function(node) { node.select(); };
|
8238 |
+
if (ios) // Mobile Safari apparently has a bug where select() is broken.
|
8239 |
+
selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };
|
8240 |
+
else if (ie) // Suppress mysterious IE10 errors
|
8241 |
+
selectInput = function(node) { try { node.select(); } catch(_e) {} };
|
8242 |
+
|
8243 |
+
function indexOf(array, elt) {
|
8244 |
+
for (var i = 0; i < array.length; ++i)
|
8245 |
+
if (array[i] == elt) return i;
|
8246 |
+
return -1;
|
8247 |
+
}
|
8248 |
+
function map(array, f) {
|
8249 |
+
var out = [];
|
8250 |
+
for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);
|
8251 |
+
return out;
|
8252 |
+
}
|
8253 |
+
|
8254 |
+
function nothing() {}
|
8255 |
+
|
8256 |
+
function createObj(base, props) {
|
8257 |
+
var inst;
|
8258 |
+
if (Object.create) {
|
8259 |
+
inst = Object.create(base);
|
8260 |
+
} else {
|
8261 |
+
nothing.prototype = base;
|
8262 |
+
inst = new nothing();
|
8263 |
+
}
|
8264 |
+
if (props) copyObj(props, inst);
|
8265 |
+
return inst;
|
8266 |
+
};
|
8267 |
+
|
8268 |
+
function copyObj(obj, target, overwrite) {
|
8269 |
+
if (!target) target = {};
|
8270 |
+
for (var prop in obj)
|
8271 |
+
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
8272 |
+
target[prop] = obj[prop];
|
8273 |
+
return target;
|
8274 |
+
}
|
8275 |
+
|
8276 |
+
function bind(f) {
|
8277 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
8278 |
+
return function(){return f.apply(null, args);};
|
8279 |
+
}
|
8280 |
+
|
8281 |
+
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
8282 |
+
var isWordCharBasic = CodeMirror.isWordChar = function(ch) {
|
8283 |
+
return /\w/.test(ch) || ch > "\x80" &&
|
8284 |
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
|
8285 |
+
};
|
8286 |
+
function isWordChar(ch, helper) {
|
8287 |
+
if (!helper) return isWordCharBasic(ch);
|
8288 |
+
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true;
|
8289 |
+
return helper.test(ch);
|
8290 |
+
}
|
8291 |
+
|
8292 |
+
function isEmpty(obj) {
|
8293 |
+
for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
|
8294 |
+
return true;
|
8295 |
+
}
|
8296 |
+
|
8297 |
+
// Extending unicode characters. A series of a non-extending char +
|
8298 |
+
// any number of extending chars is treated as a single unit as far
|
8299 |
+
// as editing and measuring is concerned. This is not fully correct,
|
8300 |
+
// since some scripts/fonts/browsers also treat other configurations
|
8301 |
+
// of code points as a group.
|
8302 |
+
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]/;
|
8303 |
+
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }
|
8304 |
+
|
8305 |
+
// DOM UTILITIES
|
8306 |
+
|
8307 |
+
function elt(tag, content, className, style) {
|
8308 |
+
var e = document.createElement(tag);
|
8309 |
+
if (className) e.className = className;
|
8310 |
+
if (style) e.style.cssText = style;
|
8311 |
+
if (typeof content == "string") e.appendChild(document.createTextNode(content));
|
8312 |
+
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
|
8313 |
+
return e;
|
8314 |
+
}
|
8315 |
+
|
8316 |
+
var range;
|
8317 |
+
if (document.createRange) range = function(node, start, end, endNode) {
|
8318 |
+
var r = document.createRange();
|
8319 |
+
r.setEnd(endNode || node, end);
|
8320 |
+
r.setStart(node, start);
|
8321 |
+
return r;
|
8322 |
+
};
|
8323 |
+
else range = function(node, start, end) {
|
8324 |
+
var r = document.body.createTextRange();
|
8325 |
+
try { r.moveToElementText(node.parentNode); }
|
8326 |
+
catch(e) { return r; }
|
8327 |
+
r.collapse(true);
|
8328 |
+
r.moveEnd("character", end);
|
8329 |
+
r.moveStart("character", start);
|
8330 |
+
return r;
|
8331 |
+
};
|
8332 |
+
|
8333 |
+
function removeChildren(e) {
|
8334 |
+
for (var count = e.childNodes.length; count > 0; --count)
|
8335 |
+
e.removeChild(e.firstChild);
|
8336 |
+
return e;
|
8337 |
+
}
|
8338 |
+
|
8339 |
+
function removeChildrenAndAdd(parent, e) {
|
8340 |
+
return removeChildren(parent).appendChild(e);
|
8341 |
+
}
|
8342 |
+
|
8343 |
+
var contains = CodeMirror.contains = function(parent, child) {
|
8344 |
+
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
|
8345 |
+
child = child.parentNode;
|
8346 |
+
if (parent.contains)
|
8347 |
+
return parent.contains(child);
|
8348 |
+
do {
|
8349 |
+
if (child.nodeType == 11) child = child.host;
|
8350 |
+
if (child == parent) return true;
|
8351 |
+
} while (child = child.parentNode);
|
8352 |
+
};
|
8353 |
+
|
8354 |
+
function activeElt() {
|
8355 |
+
var activeElement = document.activeElement;
|
8356 |
+
while (activeElement && activeElement.root && activeElement.root.activeElement)
|
8357 |
+
activeElement = activeElement.root.activeElement;
|
8358 |
+
return activeElement;
|
8359 |
+
}
|
8360 |
+
// Older versions of IE throws unspecified error when touching
|
8361 |
+
// document.activeElement in some cases (during loading, in iframe)
|
8362 |
+
if (ie && ie_version < 11) activeElt = function() {
|
8363 |
+
try { return document.activeElement; }
|
8364 |
+
catch(e) { return document.body; }
|
8365 |
+
};
|
8366 |
+
|
8367 |
+
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); }
|
8368 |
+
var rmClass = CodeMirror.rmClass = function(node, cls) {
|
8369 |
+
var current = node.className;
|
8370 |
+
var match = classTest(cls).exec(current);
|
8371 |
+
if (match) {
|
8372 |
+
var after = current.slice(match.index + match[0].length);
|
8373 |
+
node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
|
8374 |
+
}
|
8375 |
+
};
|
8376 |
+
var addClass = CodeMirror.addClass = function(node, cls) {
|
8377 |
+
var current = node.className;
|
8378 |
+
if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls;
|
8379 |
+
};
|
8380 |
+
function joinClasses(a, b) {
|
8381 |
+
var as = a.split(" ");
|
8382 |
+
for (var i = 0; i < as.length; i++)
|
8383 |
+
if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i];
|
8384 |
+
return b;
|
8385 |
+
}
|
8386 |
+
|
8387 |
+
// WINDOW-WIDE EVENTS
|
8388 |
+
|
8389 |
+
// These must be handled carefully, because naively registering a
|
8390 |
+
// handler for each editor will cause the editors to never be
|
8391 |
+
// garbage collected.
|
8392 |
+
|
8393 |
+
function forEachCodeMirror(f) {
|
8394 |
+
if (!document.body.getElementsByClassName) return;
|
8395 |
+
var byClass = document.body.getElementsByClassName("CodeMirror");
|
8396 |
+
for (var i = 0; i < byClass.length; i++) {
|
8397 |
+
var cm = byClass[i].CodeMirror;
|
8398 |
+
if (cm) f(cm);
|
8399 |
+
}
|
8400 |
+
}
|
8401 |
+
|
8402 |
+
var globalsRegistered = false;
|
8403 |
+
function ensureGlobalHandlers() {
|
8404 |
+
if (globalsRegistered) return;
|
8405 |
+
registerGlobalHandlers();
|
8406 |
+
globalsRegistered = true;
|
8407 |
+
}
|
8408 |
+
function registerGlobalHandlers() {
|
8409 |
+
// When the window resizes, we need to refresh active editors.
|
8410 |
+
var resizeTimer;
|
8411 |
+
on(window, "resize", function() {
|
8412 |
+
if (resizeTimer == null) resizeTimer = setTimeout(function() {
|
8413 |
+
resizeTimer = null;
|
8414 |
+
forEachCodeMirror(onResize);
|
8415 |
+
}, 100);
|
8416 |
+
});
|
8417 |
+
// When the window loses focus, we want to show the editor as blurred
|
8418 |
+
on(window, "blur", function() {
|
8419 |
+
forEachCodeMirror(onBlur);
|
8420 |
+
});
|
8421 |
+
}
|
8422 |
+
|
8423 |
+
// FEATURE DETECTION
|
8424 |
+
|
8425 |
+
// Detect drag-and-drop
|
8426 |
+
var dragAndDrop = function() {
|
8427 |
+
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
8428 |
+
// couldn't get it to work yet.
|
8429 |
+
if (ie && ie_version < 9) return false;
|
8430 |
+
var div = elt('div');
|
8431 |
+
return "draggable" in div || "dragDrop" in div;
|
8432 |
+
}();
|
8433 |
+
|
8434 |
+
var zwspSupported;
|
8435 |
+
function zeroWidthElement(measure) {
|
8436 |
+
if (zwspSupported == null) {
|
8437 |
+
var test = elt("span", "\u200b");
|
8438 |
+
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
|
8439 |
+
if (measure.firstChild.offsetHeight != 0)
|
8440 |
+
zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);
|
8441 |
+
}
|
8442 |
+
var node = zwspSupported ? elt("span", "\u200b") :
|
8443 |
+
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
|
8444 |
+
node.setAttribute("cm-text", "");
|
8445 |
+
return node;
|
8446 |
+
}
|
8447 |
+
|
8448 |
+
// Feature-detect IE's crummy client rect reporting for bidi text
|
8449 |
+
var badBidiRects;
|
8450 |
+
function hasBadBidiRects(measure) {
|
8451 |
+
if (badBidiRects != null) return badBidiRects;
|
8452 |
+
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
|
8453 |
+
var r0 = range(txt, 0, 1).getBoundingClientRect();
|
8454 |
+
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
|
8455 |
+
var r1 = range(txt, 1, 2).getBoundingClientRect();
|
8456 |
+
return badBidiRects = (r1.right - r0.right < 3);
|
8457 |
+
}
|
8458 |
+
|
8459 |
+
// See if "".split is the broken IE version, if so, provide an
|
8460 |
+
// alternative way to split lines.
|
8461 |
+
var splitLinesAuto = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
|
8462 |
+
var pos = 0, result = [], l = string.length;
|
8463 |
+
while (pos <= l) {
|
8464 |
+
var nl = string.indexOf("\n", pos);
|
8465 |
+
if (nl == -1) nl = string.length;
|
8466 |
+
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
|
8467 |
+
var rt = line.indexOf("\r");
|
8468 |
+
if (rt != -1) {
|
8469 |
+
result.push(line.slice(0, rt));
|
8470 |
+
pos += rt + 1;
|
8471 |
+
} else {
|
8472 |
+
result.push(line);
|
8473 |
+
pos = nl + 1;
|
8474 |
+
}
|
8475 |
+
}
|
8476 |
+
return result;
|
8477 |
+
} : function(string){return string.split(/\r\n?|\n/);};
|
8478 |
+
|
8479 |
+
var hasSelection = window.getSelection ? function(te) {
|
8480 |
+
try { return te.selectionStart != te.selectionEnd; }
|
8481 |
+
catch(e) { return false; }
|
8482 |
+
} : function(te) {
|
8483 |
+
try {var range = te.ownerDocument.selection.createRange();}
|
8484 |
+
catch(e) {}
|
8485 |
+
if (!range || range.parentElement() != te) return false;
|
8486 |
+
return range.compareEndPoints("StartToEnd", range) != 0;
|
8487 |
+
};
|
8488 |
+
|
8489 |
+
var hasCopyEvent = (function() {
|
8490 |
+
var e = elt("div");
|
8491 |
+
if ("oncopy" in e) return true;
|
8492 |
+
e.setAttribute("oncopy", "return;");
|
8493 |
+
return typeof e.oncopy == "function";
|
8494 |
+
})();
|
8495 |
+
|
8496 |
+
var badZoomedRects = null;
|
8497 |
+
function hasBadZoomedRects(measure) {
|
8498 |
+
if (badZoomedRects != null) return badZoomedRects;
|
8499 |
+
var node = removeChildrenAndAdd(measure, elt("span", "x"));
|
8500 |
+
var normal = node.getBoundingClientRect();
|
8501 |
+
var fromRange = range(node, 0, 1).getBoundingClientRect();
|
8502 |
+
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;
|
8503 |
+
}
|
8504 |
+
|
8505 |
+
// KEY NAMES
|
8506 |
+
|
8507 |
+
var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
8508 |
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
8509 |
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
8510 |
+
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod", 107: "=", 109: "-", 127: "Delete",
|
8511 |
+
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
8512 |
+
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
|
8513 |
+
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"};
|
8514 |
+
CodeMirror.keyNames = keyNames;
|
8515 |
+
(function() {
|
8516 |
+
// Number keys
|
8517 |
+
for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);
|
8518 |
+
// Alphabetic keys
|
8519 |
+
for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
|
8520 |
+
// Function keys
|
8521 |
+
for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
|
8522 |
+
})();
|
8523 |
+
|
8524 |
+
// BIDI HELPERS
|
8525 |
+
|
8526 |
+
function iterateBidiSections(order, from, to, f) {
|
8527 |
+
if (!order) return f(from, to, "ltr");
|
8528 |
+
var found = false;
|
8529 |
+
for (var i = 0; i < order.length; ++i) {
|
8530 |
+
var part = order[i];
|
8531 |
+
if (part.from < to && part.to > from || from == to && part.to == from) {
|
8532 |
+
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
|
8533 |
+
found = true;
|
8534 |
+
}
|
8535 |
+
}
|
8536 |
+
if (!found) f(from, to, "ltr");
|
8537 |
+
}
|
8538 |
+
|
8539 |
+
function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
|
8540 |
+
function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
|
8541 |
+
|
8542 |
+
function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
|
8543 |
+
function lineRight(line) {
|
8544 |
+
var order = getOrder(line);
|
8545 |
+
if (!order) return line.text.length;
|
8546 |
+
return bidiRight(lst(order));
|
8547 |
+
}
|
8548 |
+
|
8549 |
+
function lineStart(cm, lineN) {
|
8550 |
+
var line = getLine(cm.doc, lineN);
|
8551 |
+
var visual = visualLine(line);
|
8552 |
+
if (visual != line) lineN = lineNo(visual);
|
8553 |
+
var order = getOrder(visual);
|
8554 |
+
var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
|
8555 |
+
return Pos(lineN, ch);
|
8556 |
+
}
|
8557 |
+
function lineEnd(cm, lineN) {
|
8558 |
+
var merged, line = getLine(cm.doc, lineN);
|
8559 |
+
while (merged = collapsedSpanAtEnd(line)) {
|
8560 |
+
line = merged.find(1, true).line;
|
8561 |
+
lineN = null;
|
8562 |
+
}
|
8563 |
+
var order = getOrder(line);
|
8564 |
+
var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
|
8565 |
+
return Pos(lineN == null ? lineNo(line) : lineN, ch);
|
8566 |
+
}
|
8567 |
+
function lineStartSmart(cm, pos) {
|
8568 |
+
var start = lineStart(cm, pos.line);
|
8569 |
+
var line = getLine(cm.doc, start.line);
|
8570 |
+
var order = getOrder(line);
|
8571 |
+
if (!order || order[0].level == 0) {
|
8572 |
+
var firstNonWS = Math.max(0, line.text.search(/\S/));
|
8573 |
+
var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
|
8574 |
+
return Pos(start.line, inWS ? 0 : firstNonWS);
|
8575 |
+
}
|
8576 |
+
return start;
|
8577 |
+
}
|
8578 |
+
|
8579 |
+
function compareBidiLevel(order, a, b) {
|
8580 |
+
var linedir = order[0].level;
|
8581 |
+
if (a == linedir) return true;
|
8582 |
+
if (b == linedir) return false;
|
8583 |
+
return a < b;
|
8584 |
+
}
|
8585 |
+
var bidiOther;
|
8586 |
+
function getBidiPartAt(order, pos) {
|
8587 |
+
bidiOther = null;
|
8588 |
+
for (var i = 0, found; i < order.length; ++i) {
|
8589 |
+
var cur = order[i];
|
8590 |
+
if (cur.from < pos && cur.to > pos) return i;
|
8591 |
+
if ((cur.from == pos || cur.to == pos)) {
|
8592 |
+
if (found == null) {
|
8593 |
+
found = i;
|
8594 |
+
} else if (compareBidiLevel(order, cur.level, order[found].level)) {
|
8595 |
+
if (cur.from != cur.to) bidiOther = found;
|
8596 |
+
return i;
|
8597 |
+
} else {
|
8598 |
+
if (cur.from != cur.to) bidiOther = i;
|
8599 |
+
return found;
|
8600 |
+
}
|
8601 |
+
}
|
8602 |
+
}
|
8603 |
+
return found;
|
8604 |
+
}
|
8605 |
+
|
8606 |
+
function moveInLine(line, pos, dir, byUnit) {
|
8607 |
+
if (!byUnit) return pos + dir;
|
8608 |
+
do pos += dir;
|
8609 |
+
while (pos > 0 && isExtendingChar(line.text.charAt(pos)));
|
8610 |
+
return pos;
|
8611 |
+
}
|
8612 |
+
|
8613 |
+
// This is needed in order to move 'visually' through bi-directional
|
8614 |
+
// text -- i.e., pressing left should make the cursor go left, even
|
8615 |
+
// when in RTL text. The tricky part is the 'jumps', where RTL and
|
8616 |
+
// LTR text touch each other. This often requires the cursor offset
|
8617 |
+
// to move more than one unit, in order to visually move one unit.
|
8618 |
+
function moveVisually(line, start, dir, byUnit) {
|
8619 |
+
var bidi = getOrder(line);
|
8620 |
+
if (!bidi) return moveLogically(line, start, dir, byUnit);
|
8621 |
+
var pos = getBidiPartAt(bidi, start), part = bidi[pos];
|
8622 |
+
var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);
|
8623 |
+
|
8624 |
+
for (;;) {
|
8625 |
+
if (target > part.from && target < part.to) return target;
|
8626 |
+
if (target == part.from || target == part.to) {
|
8627 |
+
if (getBidiPartAt(bidi, target) == pos) return target;
|
8628 |
+
part = bidi[pos += dir];
|
8629 |
+
return (dir > 0) == part.level % 2 ? part.to : part.from;
|
8630 |
+
} else {
|
8631 |
+
part = bidi[pos += dir];
|
8632 |
+
if (!part) return null;
|
8633 |
+
if ((dir > 0) == part.level % 2)
|
8634 |
+
target = moveInLine(line, part.to, -1, byUnit);
|
8635 |
+
else
|
8636 |
+
target = moveInLine(line, part.from, 1, byUnit);
|
8637 |
+
}
|
8638 |
+
}
|
8639 |
+
}
|
8640 |
+
|
8641 |
+
function moveLogically(line, start, dir, byUnit) {
|
8642 |
+
var target = start + dir;
|
8643 |
+
if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;
|
8644 |
+
return target < 0 || target > line.text.length ? null : target;
|
8645 |
+
}
|
8646 |
+
|
8647 |
+
// Bidirectional ordering algorithm
|
8648 |
+
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
8649 |
+
// that this (partially) implements.
|
8650 |
+
|
8651 |
+
// One-char codes used for character types:
|
8652 |
+
// L (L): Left-to-Right
|
8653 |
+
// R (R): Right-to-Left
|
8654 |
+
// r (AL): Right-to-Left Arabic
|
8655 |
+
// 1 (EN): European Number
|
8656 |
+
// + (ES): European Number Separator
|
8657 |
+
// % (ET): European Number Terminator
|
8658 |
+
// n (AN): Arabic Number
|
8659 |
+
// , (CS): Common Number Separator
|
8660 |
+
// m (NSM): Non-Spacing Mark
|
8661 |
+
// b (BN): Boundary Neutral
|
8662 |
+
// s (B): Paragraph Separator
|
8663 |
+
// t (S): Segment Separator
|
8664 |
+
// w (WS): Whitespace
|
8665 |
+
// N (ON): Other Neutrals
|
8666 |
+
|
8667 |
+
// Returns null if characters are ordered as they appear
|
8668 |
+
// (left-to-right), or an array of sections ({from, to, level}
|
8669 |
+
// objects) in the order in which they occur visually.
|
8670 |
+
var bidiOrdering = (function() {
|
8671 |
+
// Character types for codepoints 0 to 0xff
|
8672 |
+
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
|
8673 |
+
// Character types for codepoints 0x600 to 0x6ff
|
8674 |
+
var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm";
|
8675 |
+
function charType(code) {
|
8676 |
+
if (code <= 0xf7) return lowTypes.charAt(code);
|
8677 |
+
else if (0x590 <= code && code <= 0x5f4) return "R";
|
8678 |
+
else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);
|
8679 |
+
else if (0x6ee <= code && code <= 0x8ac) return "r";
|
8680 |
+
else if (0x2000 <= code && code <= 0x200b) return "w";
|
8681 |
+
else if (code == 0x200c) return "b";
|
8682 |
+
else return "L";
|
8683 |
+
}
|
8684 |
+
|
8685 |
+
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
8686 |
+
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
|
8687 |
+
// Browsers seem to always treat the boundaries of block elements as being L.
|
8688 |
+
var outerType = "L";
|
8689 |
+
|
8690 |
+
function BidiSpan(level, from, to) {
|
8691 |
+
this.level = level;
|
8692 |
+
this.from = from; this.to = to;
|
8693 |
+
}
|
8694 |
+
|
8695 |
+
return function(str) {
|
8696 |
+
if (!bidiRE.test(str)) return false;
|
8697 |
+
var len = str.length, types = [];
|
8698 |
+
for (var i = 0, type; i < len; ++i)
|
8699 |
+
types.push(type = charType(str.charCodeAt(i)));
|
8700 |
+
|
8701 |
+
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
8702 |
+
// change the type of the NSM to the type of the previous
|
8703 |
+
// character. If the NSM is at the start of the level run, it will
|
8704 |
+
// get the type of sor.
|
8705 |
+
for (var i = 0, prev = outerType; i < len; ++i) {
|
8706 |
+
var type = types[i];
|
8707 |
+
if (type == "m") types[i] = prev;
|
8708 |
+
else prev = type;
|
8709 |
+
}
|
8710 |
+
|
8711 |
+
// W2. Search backwards from each instance of a European number
|
8712 |
+
// until the first strong type (R, L, AL, or sor) is found. If an
|
8713 |
+
// AL is found, change the type of the European number to Arabic
|
8714 |
+
// number.
|
8715 |
+
// W3. Change all ALs to R.
|
8716 |
+
for (var i = 0, cur = outerType; i < len; ++i) {
|
8717 |
+
var type = types[i];
|
8718 |
+
if (type == "1" && cur == "r") types[i] = "n";
|
8719 |
+
else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; }
|
8720 |
+
}
|
8721 |
+
|
8722 |
+
// W4. A single European separator between two European numbers
|
8723 |
+
// changes to a European number. A single common separator between
|
8724 |
+
// two numbers of the same type changes to that type.
|
8725 |
+
for (var i = 1, prev = types[0]; i < len - 1; ++i) {
|
8726 |
+
var type = types[i];
|
8727 |
+
if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1";
|
8728 |
+
else if (type == "," && prev == types[i+1] &&
|
8729 |
+
(prev == "1" || prev == "n")) types[i] = prev;
|
8730 |
+
prev = type;
|
8731 |
+
}
|
8732 |
+
|
8733 |
+
// W5. A sequence of European terminators adjacent to European
|
8734 |
+
// numbers changes to all European numbers.
|
8735 |
+
// W6. Otherwise, separators and terminators change to Other
|
8736 |
+
// Neutral.
|
8737 |
+
for (var i = 0; i < len; ++i) {
|
8738 |
+
var type = types[i];
|
8739 |
+
if (type == ",") types[i] = "N";
|
8740 |
+
else if (type == "%") {
|
8741 |
+
for (var end = i + 1; end < len && types[end] == "%"; ++end) {}
|
8742 |
+
var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
|
8743 |
+
for (var j = i; j < end; ++j) types[j] = replace;
|
8744 |
+
i = end - 1;
|
8745 |
+
}
|
8746 |
+
}
|
8747 |
+
|
8748 |
+
// W7. Search backwards from each instance of a European number
|
8749 |
+
// until the first strong type (R, L, or sor) is found. If an L is
|
8750 |
+
// found, then change the type of the European number to L.
|
8751 |
+
for (var i = 0, cur = outerType; i < len; ++i) {
|
8752 |
+
var type = types[i];
|
8753 |
+
if (cur == "L" && type == "1") types[i] = "L";
|
8754 |
+
else if (isStrong.test(type)) cur = type;
|
8755 |
+
}
|
8756 |
+
|
8757 |
+
// N1. A sequence of neutrals takes the direction of the
|
8758 |
+
// surrounding strong text if the text on both sides has the same
|
8759 |
+
// direction. European and Arabic numbers act as if they were R in
|
8760 |
+
// terms of their influence on neutrals. Start-of-level-run (sor)
|
8761 |
+
// and end-of-level-run (eor) are used at level run boundaries.
|
8762 |
+
// N2. Any remaining neutrals take the embedding direction.
|
8763 |
+
for (var i = 0; i < len; ++i) {
|
8764 |
+
if (isNeutral.test(types[i])) {
|
8765 |
+
for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
|
8766 |
+
var before = (i ? types[i-1] : outerType) == "L";
|
8767 |
+
var after = (end < len ? types[end] : outerType) == "L";
|
8768 |
+
var replace = before || after ? "L" : "R";
|
8769 |
+
for (var j = i; j < end; ++j) types[j] = replace;
|
8770 |
+
i = end - 1;
|
8771 |
+
}
|
8772 |
+
}
|
8773 |
+
|
8774 |
+
// Here we depart from the documented algorithm, in order to avoid
|
8775 |
+
// building up an actual levels array. Since there are only three
|
8776 |
+
// levels (0, 1, 2) in an implementation that doesn't take
|
8777 |
+
// explicit embedding into account, we can build up the order on
|
8778 |
+
// the fly, without following the level-based algorithm.
|
8779 |
+
var order = [], m;
|
8780 |
+
for (var i = 0; i < len;) {
|
8781 |
+
if (countsAsLeft.test(types[i])) {
|
8782 |
+
var start = i;
|
8783 |
+
for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
|
8784 |
+
order.push(new BidiSpan(0, start, i));
|
8785 |
+
} else {
|
8786 |
+
var pos = i, at = order.length;
|
8787 |
+
for (++i; i < len && types[i] != "L"; ++i) {}
|
8788 |
+
for (var j = pos; j < i;) {
|
8789 |
+
if (countsAsNum.test(types[j])) {
|
8790 |
+
if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));
|
8791 |
+
var nstart = j;
|
8792 |
+
for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
|
8793 |
+
order.splice(at, 0, new BidiSpan(2, nstart, j));
|
8794 |
+
pos = j;
|
8795 |
+
} else ++j;
|
8796 |
+
}
|
8797 |
+
if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));
|
8798 |
+
}
|
8799 |
+
}
|
8800 |
+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
8801 |
+
order[0].from = m[0].length;
|
8802 |
+
order.unshift(new BidiSpan(0, 0, m[0].length));
|
8803 |
+
}
|
8804 |
+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
8805 |
+
lst(order).to -= m[0].length;
|
8806 |
+
order.push(new BidiSpan(0, len - m[0].length, len));
|
8807 |
+
}
|
8808 |
+
if (order[0].level == 2)
|
8809 |
+
order.unshift(new BidiSpan(1, order[0].to, order[0].to));
|
8810 |
+
if (order[0].level != lst(order).level)
|
8811 |
+
order.push(new BidiSpan(order[0].level, len, len));
|
8812 |
+
|
8813 |
+
return order;
|
8814 |
+
};
|
8815 |
+
})();
|
8816 |
+
|
8817 |
+
// THE END
|
8818 |
+
|
8819 |
+
CodeMirror.version = "5.6.0";
|
8820 |
+
|
8821 |
+
return CodeMirror;
|
8822 |
+
});
|
modules/yith-woocommerce-ajax-navigation/assets/3rd-party/codemirror/mode/css/css.js
ADDED
@@ -0,0 +1,772 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 provided = parserConfig;
|
16 |
+
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
|
17 |
+
parserConfig.inline = provided.inline;
|
18 |
+
|
19 |
+
var indentUnit = config.indentUnit,
|
20 |
+
tokenHooks = parserConfig.tokenHooks,
|
21 |
+
documentTypes = parserConfig.documentTypes || {},
|
22 |
+
mediaTypes = parserConfig.mediaTypes || {},
|
23 |
+
mediaFeatures = parserConfig.mediaFeatures || {},
|
24 |
+
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
|
25 |
+
propertyKeywords = parserConfig.propertyKeywords || {},
|
26 |
+
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
|
27 |
+
fontProperties = parserConfig.fontProperties || {},
|
28 |
+
counterDescriptors = parserConfig.counterDescriptors || {},
|
29 |
+
colorKeywords = parserConfig.colorKeywords || {},
|
30 |
+
valueKeywords = parserConfig.valueKeywords || {},
|
31 |
+
allowNested = parserConfig.allowNested;
|
32 |
+
|
33 |
+
var type, override;
|
34 |
+
function ret(style, tp) { type = tp; return style; }
|
35 |
+
|
36 |
+
// Tokenizers
|
37 |
+
|
38 |
+
function tokenBase(stream, state) {
|
39 |
+
var ch = stream.next();
|
40 |
+
if (tokenHooks[ch]) {
|
41 |
+
var result = tokenHooks[ch](stream, state);
|
42 |
+
if (result !== false) return result;
|
43 |
+
}
|
44 |
+
if (ch == "@") {
|
45 |
+
stream.eatWhile(/[\w\\\-]/);
|
46 |
+
return ret("def", stream.current());
|
47 |
+
} else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
|
48 |
+
return ret(null, "compare");
|
49 |
+
} else if (ch == "\"" || ch == "'") {
|
50 |
+
state.tokenize = tokenString(ch);
|
51 |
+
return state.tokenize(stream, state);
|
52 |
+
} else if (ch == "#") {
|
53 |
+
stream.eatWhile(/[\w\\\-]/);
|
54 |
+
return ret("atom", "hash");
|
55 |
+
} else if (ch == "!") {
|
56 |
+
stream.match(/^\s*\w*/);
|
57 |
+
return ret("keyword", "important");
|
58 |
+
} else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
|
59 |
+
stream.eatWhile(/[\w.%]/);
|
60 |
+
return ret("number", "unit");
|
61 |
+
} else if (ch === "-") {
|
62 |
+
if (/[\d.]/.test(stream.peek())) {
|
63 |
+
stream.eatWhile(/[\w.%]/);
|
64 |
+
return ret("number", "unit");
|
65 |
+
} else if (stream.match(/^-[\w\\\-]+/)) {
|
66 |
+
stream.eatWhile(/[\w\\\-]/);
|
67 |
+
if (stream.match(/^\s*:/, false))
|
68 |
+
return ret("variable-2", "variable-definition");
|
69 |
+
return ret("variable-2", "variable");
|
70 |
+
} else if (stream.match(/^\w+-/)) {
|
71 |
+
return ret("meta", "meta");
|
72 |
+
}
|
73 |
+
} else if (/[,+>*\/]/.test(ch)) {
|
74 |
+
return ret(null, "select-op");
|
75 |
+
} else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
|
76 |
+
return ret("qualifier", "qualifier");
|
77 |
+
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
|
78 |
+
return ret(null, ch);
|
79 |
+
} else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
|
80 |
+
(ch == "d" && stream.match("omain(")) ||
|
81 |
+
(ch == "r" && stream.match("egexp("))) {
|
82 |
+
stream.backUp(1);
|
83 |
+
state.tokenize = tokenParenthesized;
|
84 |
+
return ret("property", "word");
|
85 |
+
} else if (/[\w\\\-]/.test(ch)) {
|
86 |
+
stream.eatWhile(/[\w\\\-]/);
|
87 |
+
return ret("property", "word");
|
88 |
+
} else {
|
89 |
+
return ret(null, null);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
function tokenString(quote) {
|
94 |
+
return function(stream, state) {
|
95 |
+
var escaped = false, ch;
|
96 |
+
while ((ch = stream.next()) != null) {
|
97 |
+
if (ch == quote && !escaped) {
|
98 |
+
if (quote == ")") stream.backUp(1);
|
99 |
+
break;
|
100 |
+
}
|
101 |
+
escaped = !escaped && ch == "\\";
|
102 |
+
}
|
103 |
+
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
|
104 |
+
return ret("string", "string");
|
105 |
+
};
|
106 |
+
}
|
107 |
+
|
108 |
+
function tokenParenthesized(stream, state) {
|
109 |
+
stream.next(); // Must be '('
|
110 |
+
if (!stream.match(/\s*[\"\')]/, false))
|
111 |
+
state.tokenize = tokenString(")");
|
112 |
+
else
|
113 |
+
state.tokenize = null;
|
114 |
+
return ret(null, "(");
|
115 |
+
}
|
116 |
+
|
117 |
+
// Context management
|
118 |
+
|
119 |
+
function Context(type, indent, prev) {
|
120 |
+
this.type = type;
|
121 |
+
this.indent = indent;
|
122 |
+
this.prev = prev;
|
123 |
+
}
|
124 |
+
|
125 |
+
function pushContext(state, stream, type) {
|
126 |
+
state.context = new Context(type, stream.indentation() + indentUnit, state.context);
|
127 |
+
return type;
|
128 |
+
}
|
129 |
+
|
130 |
+
function popContext(state) {
|
131 |
+
state.context = state.context.prev;
|
132 |
+
return state.context.type;
|
133 |
+
}
|
134 |
+
|
135 |
+
function pass(type, stream, state) {
|
136 |
+
return states[state.context.type](type, stream, state);
|
137 |
+
}
|
138 |
+
function popAndPass(type, stream, state, n) {
|
139 |
+
for (var i = n || 1; i > 0; i--)
|
140 |
+
state.context = state.context.prev;
|
141 |
+
return pass(type, stream, state);
|
142 |
+
}
|
143 |
+
|
144 |
+
// Parser
|
145 |
+
|
146 |
+
function wordAsValue(stream) {
|
147 |
+
var word = stream.current().toLowerCase();
|
148 |
+
if (valueKeywords.hasOwnProperty(word))
|
149 |
+
override = "atom";
|
150 |
+
else if (colorKeywords.hasOwnProperty(word))
|
151 |
+
override = "keyword";
|
152 |
+
else
|
153 |
+
override = "variable";
|
154 |
+
}
|
155 |
+
|
156 |
+
var states = {};
|
157 |
+
|
158 |
+
states.top = function(type, stream, state) {
|
159 |
+
if (type == "{") {
|
160 |
+
return pushContext(state, stream, "block");
|
161 |
+
} else if (type == "}" && state.context.prev) {
|
162 |
+
return popContext(state);
|
163 |
+
} else if (/@(media|supports|(-moz-)?document)/.test(type)) {
|
164 |
+
return pushContext(state, stream, "atBlock");
|
165 |
+
} else if (/@(font-face|counter-style)/.test(type)) {
|
166 |
+
state.stateArg = type;
|
167 |
+
return "restricted_atBlock_before";
|
168 |
+
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
|
169 |
+
return "keyframes";
|
170 |
+
} else if (type && type.charAt(0) == "@") {
|
171 |
+
return pushContext(state, stream, "at");
|
172 |
+
} else if (type == "hash") {
|
173 |
+
override = "builtin";
|
174 |
+
} else if (type == "word") {
|
175 |
+
override = "tag";
|
176 |
+
} else if (type == "variable-definition") {
|
177 |
+
return "maybeprop";
|
178 |
+
} else if (type == "interpolation") {
|
179 |
+
return pushContext(state, stream, "interpolation");
|
180 |
+
} else if (type == ":") {
|
181 |
+
return "pseudo";
|
182 |
+
} else if (allowNested && type == "(") {
|
183 |
+
return pushContext(state, stream, "parens");
|
184 |
+
}
|
185 |
+
return state.context.type;
|
186 |
+
};
|
187 |
+
|
188 |
+
states.block = function(type, stream, state) {
|
189 |
+
if (type == "word") {
|
190 |
+
var word = stream.current().toLowerCase();
|
191 |
+
if (propertyKeywords.hasOwnProperty(word)) {
|
192 |
+
override = "property";
|
193 |
+
return "maybeprop";
|
194 |
+
} else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
|
195 |
+
override = "string-2";
|
196 |
+
return "maybeprop";
|
197 |
+
} else if (allowNested) {
|
198 |
+
override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
|
199 |
+
return "block";
|
200 |
+
} else {
|
201 |
+
override += " error";
|
202 |
+
return "maybeprop";
|
203 |
+
}
|
204 |
+
} else if (type == "meta") {
|
205 |
+
return "block";
|
206 |
+
} else if (!allowNested && (type == "hash" || type == "qualifier")) {
|
207 |
+
override = "error";
|
208 |
+
return "block";
|
209 |
+
} else {
|
210 |
+
return states.top(type, stream, state);
|
211 |
+
}
|
212 |
+
};
|
213 |
+
|
214 |
+
states.maybeprop = function(type, stream, state) {
|
215 |
+
if (type == ":") return pushContext(state, stream, "prop");
|
216 |
+
return pass(type, stream, state);
|
217 |
+
};
|
218 |
+
|
219 |
+
states.prop = function(type, stream, state) {
|
220 |
+
if (type == ";") return popContext(state);
|
221 |
+
if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
|
222 |
+
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
223 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
224 |
+
|
225 |
+
if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
|
226 |
+
override += " error";
|
227 |
+
} else if (type == "word") {
|
228 |
+
wordAsValue(stream);
|
229 |
+
} else if (type == "interpolation") {
|
230 |
+
return pushContext(state, stream, "interpolation");
|
231 |
+
}
|
232 |
+
return "prop";
|
233 |
+
};
|
234 |
+
|
235 |
+
states.propBlock = function(type, _stream, state) {
|
236 |
+
if (type == "}") return popContext(state);
|
237 |
+
if (type == "word") { override = "property"; return "maybeprop"; }
|
238 |
+
return state.context.type;
|
239 |
+
};
|
240 |
+
|
241 |
+
states.parens = function(type, stream, state) {
|
242 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
243 |
+
if (type == ")") return popContext(state);
|
244 |
+
if (type == "(") return pushContext(state, stream, "parens");
|
245 |
+
if (type == "interpolation") return pushContext(state, stream, "interpolation");
|
246 |
+
if (type == "word") wordAsValue(stream);
|
247 |
+
return "parens";
|
248 |
+
};
|
249 |
+
|
250 |
+
states.pseudo = function(type, stream, state) {
|
251 |
+
if (type == "word") {
|
252 |
+
override = "variable-3";
|
253 |
+
return state.context.type;
|
254 |
+
}
|
255 |
+
return pass(type, stream, state);
|
256 |
+
};
|
257 |
+
|
258 |
+
states.atBlock = function(type, stream, state) {
|
259 |
+
if (type == "(") return pushContext(state, stream, "atBlock_parens");
|
260 |
+
if (type == "}") return popAndPass(type, stream, state);
|
261 |
+
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
|
262 |
+
|
263 |
+
if (type == "word") {
|
264 |
+
var word = stream.current().toLowerCase();
|
265 |
+
if (word == "only" || word == "not" || word == "and" || word == "or")
|
266 |
+
override = "keyword";
|
267 |
+
else if (documentTypes.hasOwnProperty(word))
|
268 |
+
override = "tag";
|
269 |
+
else if (mediaTypes.hasOwnProperty(word))
|
270 |
+
override = "attribute";
|
271 |
+
else if (mediaFeatures.hasOwnProperty(word))
|
272 |
+
override = "property";
|
273 |
+
else if (mediaValueKeywords.hasOwnProperty(word))
|
274 |
+
override = "keyword";
|
275 |
+
else if (propertyKeywords.hasOwnProperty(word))
|
276 |
+
override = "property";
|
277 |
+
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
|
278 |
+
override = "string-2";
|
279 |
+
else if (valueKeywords.hasOwnProperty(word))
|
280 |
+
override = "atom";
|
281 |
+
else if (colorKeywords.hasOwnProperty(word))
|
282 |
+
override = "keyword";
|
283 |
+
else
|
284 |
+
override = "error";
|
285 |
+
}
|
286 |
+
return state.context.type;
|
287 |
+
};
|
288 |
+
|
289 |
+
states.atBlock_parens = function(type, stream, state) {
|
290 |
+
if (type == ")") return popContext(state);
|
291 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
|
292 |
+
return states.atBlock(type, stream, state);
|
293 |
+
};
|
294 |
+
|
295 |
+
states.restricted_atBlock_before = function(type, stream, state) {
|
296 |
+
if (type == "{")
|
297 |
+
return pushContext(state, stream, "restricted_atBlock");
|
298 |
+
if (type == "word" && state.stateArg == "@counter-style") {
|
299 |
+
override = "variable";
|
300 |
+
return "restricted_atBlock_before";
|
301 |
+
}
|
302 |
+
return pass(type, stream, state);
|
303 |
+
};
|
304 |
+
|
305 |
+
states.restricted_atBlock = function(type, stream, state) {
|
306 |
+
if (type == "}") {
|
307 |
+
state.stateArg = null;
|
308 |
+
return popContext(state);
|
309 |
+
}
|
310 |
+
if (type == "word") {
|
311 |
+
if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
|
312 |
+
(state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
|
313 |
+
override = "error";
|
314 |
+
else
|
315 |
+
override = "property";
|
316 |
+
return "maybeprop";
|
317 |
+
}
|
318 |
+
return "restricted_atBlock";
|
319 |
+
};
|
320 |
+
|
321 |
+
states.keyframes = function(type, stream, state) {
|
322 |
+
if (type == "word") { override = "variable"; return "keyframes"; }
|
323 |
+
if (type == "{") return pushContext(state, stream, "top");
|
324 |
+
return pass(type, stream, state);
|
325 |
+
};
|
326 |
+
|
327 |
+
states.at = function(type, stream, state) {
|
328 |
+
if (type == ";") return popContext(state);
|
329 |
+
if (type == "{" || type == "}") return popAndPass(type, stream, state);
|
330 |
+
if (type == "word") override = "tag";
|
331 |
+
else if (type == "hash") override = "builtin";
|
332 |
+
return "at";
|
333 |
+
};
|
334 |
+
|
335 |
+
states.interpolation = function(type, stream, state) {
|
336 |
+
if (type == "}") return popContext(state);
|
337 |
+
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
338 |
+
if (type == "word") override = "variable";
|
339 |
+
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
340 |
+
return "interpolation";
|
341 |
+
};
|
342 |
+
|
343 |
+
return {
|
344 |
+
startState: function(base) {
|
345 |
+
return {tokenize: null,
|
346 |
+
state: parserConfig.inline ? "block" : "top",
|
347 |
+
stateArg: null,
|
348 |
+
context: new Context(parserConfig.inline ? "block" : "top", base || 0, null)};
|
349 |
+
},
|
350 |
+
|
351 |
+
token: function(stream, state) {
|
352 |
+
if (!state.tokenize && stream.eatSpace()) return null;
|
353 |
+
var style = (state.tokenize || tokenBase)(stream, state);
|
354 |
+
if (style && typeof style == "object") {
|
355 |
+
type = style[1];
|
356 |
+
style = style[0];
|
357 |
+
}
|
358 |
+
override = style;
|
359 |
+
state.state = states[state.state](type, stream, state);
|
360 |
+
return override;
|
361 |
+
},
|
362 |
+
|
363 |
+
indent: function(state, textAfter) {
|
364 |
+
var cx = state.context, ch = textAfter && textAfter.charAt(0);
|
365 |
+
var indent = cx.indent;
|
366 |
+
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
|
367 |
+
if (cx.prev &&
|
368 |
+
(ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") ||
|
369 |
+
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
|
370 |
+
ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) {
|
371 |
+
indent = cx.indent - indentUnit;
|
372 |
+
cx = cx.prev;
|
373 |
+
}
|
374 |
+
return indent;
|
375 |
+
},
|
376 |
+
|
377 |
+
electricChars: "}",
|
378 |
+
blockCommentStart: "/*",
|
379 |
+
blockCommentEnd: "*/",
|
380 |
+
fold: "brace"
|
381 |
+
};
|
382 |
+
});
|
383 |
+
|
384 |
+
function keySet(array) {
|
385 |
+
var keys = {};
|
386 |
+
for (var i = 0; i < array.length; ++i) {
|
387 |
+
keys[array[i]] = true;
|
388 |
+
}
|
389 |
+
return keys;
|
390 |
+
}
|
391 |
+
|
392 |
+
var documentTypes_ = [
|
393 |
+
"domain", "regexp", "url", "url-prefix"
|
394 |
+
], documentTypes = keySet(documentTypes_);
|
395 |
+
|
396 |
+
var mediaTypes_ = [
|
397 |
+
"all", "aural", "braille", "handheld", "print", "projection", "screen",
|
398 |
+
"tty", "tv", "embossed"
|
399 |
+
], mediaTypes = keySet(mediaTypes_);
|
400 |
+
|
401 |
+
var mediaFeatures_ = [
|
402 |
+
"width", "min-width", "max-width", "height", "min-height", "max-height",
|
403 |
+
"device-width", "min-device-width", "max-device-width", "device-height",
|
404 |
+
"min-device-height", "max-device-height", "aspect-ratio",
|
405 |
+
"min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
|
406 |
+
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
|
407 |
+
"max-color", "color-index", "min-color-index", "max-color-index",
|
408 |
+
"monochrome", "min-monochrome", "max-monochrome", "resolution",
|
409 |
+
"min-resolution", "max-resolution", "scan", "grid", "orientation",
|
410 |
+
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
|
411 |
+
"pointer", "any-pointer", "hover", "any-hover"
|
412 |
+
], mediaFeatures = keySet(mediaFeatures_);
|
413 |
+
|
414 |
+
var mediaValueKeywords_ = [
|
415 |
+
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
|
416 |
+
"interlace", "progressive"
|
417 |
+
], mediaValueKeywords = keySet(mediaValueKeywords_);
|
418 |
+
|
419 |
+
var propertyKeywords_ = [
|
420 |
+
"align-content", "align-items", "align-self", "alignment-adjust",
|
421 |
+
"alignment-baseline", "anchor-point", "animation", "animation-delay",
|
422 |
+
"animation-direction", "animation-duration", "animation-fill-mode",
|
423 |
+
"animation-iteration-count", "animation-name", "animation-play-state",
|
424 |
+
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
|
425 |
+
"background", "background-attachment", "background-clip", "background-color",
|
426 |
+
"background-image", "background-origin", "background-position",
|
427 |
+
"background-repeat", "background-size", "baseline-shift", "binding",
|
428 |
+
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
|
429 |
+
"bookmark-target", "border", "border-bottom", "border-bottom-color",
|
430 |
+
"border-bottom-left-radius", "border-bottom-right-radius",
|
431 |
+
"border-bottom-style", "border-bottom-width", "border-collapse",
|
432 |
+
"border-color", "border-image", "border-image-outset",
|
433 |
+
"border-image-repeat", "border-image-slice", "border-image-source",
|
434 |
+
"border-image-width", "border-left", "border-left-color",
|
435 |
+
"border-left-style", "border-left-width", "border-radius", "border-right",
|
436 |
+
"border-right-color", "border-right-style", "border-right-width",
|
437 |
+
"border-spacing", "border-style", "border-top", "border-top-color",
|
438 |
+
"border-top-left-radius", "border-top-right-radius", "border-top-style",
|
439 |
+
"border-top-width", "border-width", "bottom", "box-decoration-break",
|
440 |
+
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
|
441 |
+
"caption-side", "clear", "clip", "color", "color-profile", "column-count",
|
442 |
+
"column-fill", "column-gap", "column-rule", "column-rule-color",
|
443 |
+
"column-rule-style", "column-rule-width", "column-span", "column-width",
|
444 |
+
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
|
445 |
+
"cue-after", "cue-before", "cursor", "direction", "display",
|
446 |
+
"dominant-baseline", "drop-initial-after-adjust",
|
447 |
+
"drop-initial-after-align", "drop-initial-before-adjust",
|
448 |
+
"drop-initial-before-align", "drop-initial-size", "drop-initial-value",
|
449 |
+
"elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
|
450 |
+
"flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
|
451 |
+
"float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
|
452 |
+
"font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
|
453 |
+
"font-stretch", "font-style", "font-synthesis", "font-variant",
|
454 |
+
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
455 |
+
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
456 |
+
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
457 |
+
"grid-auto-position", "grid-auto-rows", "grid-column", "grid-column-end",
|
458 |
+
"grid-column-start", "grid-row", "grid-row-end", "grid-row-start",
|
459 |
+
"grid-template", "grid-template-areas", "grid-template-columns",
|
460 |
+
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
461 |
+
"icon", "image-orientation", "image-rendering", "image-resolution",
|
462 |
+
"inline-box-align", "justify-content", "left", "letter-spacing",
|
463 |
+
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
|
464 |
+
"line-stacking-shift", "line-stacking-strategy", "list-style",
|
465 |
+
"list-style-image", "list-style-position", "list-style-type", "margin",
|
466 |
+
"margin-bottom", "margin-left", "margin-right", "margin-top",
|
467 |
+
"marker-offset", "marks", "marquee-direction", "marquee-loop",
|
468 |
+
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
|
469 |
+
"max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
|
470 |
+
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
|
471 |
+
"opacity", "order", "orphans", "outline",
|
472 |
+
"outline-color", "outline-offset", "outline-style", "outline-width",
|
473 |
+
"overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
|
474 |
+
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
|
475 |
+
"page", "page-break-after", "page-break-before", "page-break-inside",
|
476 |
+
"page-policy", "pause", "pause-after", "pause-before", "perspective",
|
477 |
+
"perspective-origin", "pitch", "pitch-range", "play-during", "position",
|
478 |
+
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
|
479 |
+
"region-break-before", "region-break-inside", "region-fragment",
|
480 |
+
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
|
481 |
+
"right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
|
482 |
+
"ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
|
483 |
+
"shape-outside", "size", "speak", "speak-as", "speak-header",
|
484 |
+
"speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
|
485 |
+
"tab-size", "table-layout", "target", "target-name", "target-new",
|
486 |
+
"target-position", "text-align", "text-align-last", "text-decoration",
|
487 |
+
"text-decoration-color", "text-decoration-line", "text-decoration-skip",
|
488 |
+
"text-decoration-style", "text-emphasis", "text-emphasis-color",
|
489 |
+
"text-emphasis-position", "text-emphasis-style", "text-height",
|
490 |
+
"text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
|
491 |
+
"text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
|
492 |
+
"text-wrap", "top", "transform", "transform-origin", "transform-style",
|
493 |
+
"transition", "transition-delay", "transition-duration",
|
494 |
+
"transition-property", "transition-timing-function", "unicode-bidi",
|
495 |
+
"vertical-align", "visibility", "voice-balance", "voice-duration",
|
496 |
+
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
|
497 |
+
"voice-volume", "volume", "white-space", "widows", "width", "word-break",
|
498 |
+
"word-spacing", "word-wrap", "z-index",
|
499 |
+
// SVG-specific
|
500 |
+
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
|
501 |
+
"flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
|
502 |
+
"color-interpolation", "color-interpolation-filters",
|
503 |
+
"color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
|
504 |
+
"marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
|
505 |
+
"stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
|
506 |
+
"stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
|
507 |
+
"baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
|
508 |
+
"glyph-orientation-vertical", "text-anchor", "writing-mode"
|
509 |
+
], propertyKeywords = keySet(propertyKeywords_);
|
510 |
+
|
511 |
+
var nonStandardPropertyKeywords_ = [
|
512 |
+
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
|
513 |
+
"scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
|
514 |
+
"scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
|
515 |
+
"searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
|
516 |
+
"searchfield-results-decoration", "zoom"
|
517 |
+
], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
|
518 |
+
|
519 |
+
var fontProperties_ = [
|
520 |
+
"font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
|
521 |
+
"font-stretch", "font-weight", "font-style"
|
522 |
+
], fontProperties = keySet(fontProperties_);
|
523 |
+
|
524 |
+
var counterDescriptors_ = [
|
525 |
+
"additive-symbols", "fallback", "negative", "pad", "prefix", "range",
|
526 |
+
"speak-as", "suffix", "symbols", "system"
|
527 |
+
], counterDescriptors = keySet(counterDescriptors_);
|
528 |
+
|
529 |
+
var colorKeywords_ = [
|
530 |
+
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
|
531 |
+
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
|
532 |
+
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
|
533 |
+
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
|
534 |
+
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
|
535 |
+
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
|
536 |
+
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
|
537 |
+
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
|
538 |
+
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
|
539 |
+
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
|
540 |
+
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
|
541 |
+
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
|
542 |
+
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
|
543 |
+
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
|
544 |
+
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
|
545 |
+
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
|
546 |
+
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
|
547 |
+
"mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
|
548 |
+
"navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
|
549 |
+
"orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
|
550 |
+
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
|
551 |
+
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
|
552 |
+
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
|
553 |
+
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
|
554 |
+
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
|
555 |
+
"whitesmoke", "yellow", "yellowgreen"
|
556 |
+
], colorKeywords = keySet(colorKeywords_);
|
557 |
+
|
558 |
+
var valueKeywords_ = [
|
559 |
+
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
|
560 |
+
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
|
561 |
+
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
|
562 |
+
"arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page",
|
563 |
+
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
|
564 |
+
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
|
565 |
+
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
|
566 |
+
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
|
567 |
+
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
|
568 |
+
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
|
569 |
+
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
|
570 |
+
"col-resize", "collapse", "column", "column-reverse", "compact", "condensed", "contain", "content",
|
571 |
+
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
572 |
+
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
|
573 |
+
"decimal-leading-zero", "default", "default-button", "destination-atop",
|
574 |
+
"destination-in", "destination-out", "destination-over", "devanagari",
|
575 |
+
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
576 |
+
"dot-dash", "dot-dot-dash",
|
577 |
+
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
|
578 |
+
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
|
579 |
+
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
|
580 |
+
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
|
581 |
+
"ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
|
582 |
+
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
|
583 |
+
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
|
584 |
+
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
585 |
+
"ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
|
586 |
+
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
587 |
+
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
|
588 |
+
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
|
589 |
+
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
590 |
+
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
|
591 |
+
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
592 |
+
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
593 |
+
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
|
594 |
+
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
595 |
+
"katakana", "katakana-iroha", "keep-all", "khmer",
|
596 |
+
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
597 |
+
"landscape", "lao", "large", "larger", "left", "level", "lighter",
|
598 |
+
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
|
599 |
+
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
|
600 |
+
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
|
601 |
+
"lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
|
602 |
+
"media-controls-background", "media-current-time-display",
|
603 |
+
"media-fullscreen-button", "media-mute-button", "media-play-button",
|
604 |
+
"media-return-to-realtime-button", "media-rewind-button",
|
605 |
+
"media-seek-back-button", "media-seek-forward-button", "media-slider",
|
606 |
+
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
|
607 |
+
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
|
608 |
+
"menu", "menulist", "menulist-button", "menulist-text",
|
609 |
+
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
|
610 |
+
"mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
|
611 |
+
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
|
612 |
+
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
|
613 |
+
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
|
614 |
+
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
|
615 |
+
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
|
616 |
+
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
|
617 |
+
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
|
618 |
+
"progress", "push-button", "radial-gradient", "radio", "read-only",
|
619 |
+
"read-write", "read-write-plaintext-only", "rectangle", "region",
|
620 |
+
"relative", "repeat", "repeating-linear-gradient",
|
621 |
+
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
|
622 |
+
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
|
623 |
+
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
|
624 |
+
"s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
|
625 |
+
"scroll", "scrollbar", "se-resize", "searchfield",
|
626 |
+
"searchfield-cancel-button", "searchfield-decoration",
|
627 |
+
"searchfield-results-button", "searchfield-results-decoration",
|
628 |
+
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
|
629 |
+
"simp-chinese-formal", "simp-chinese-informal", "single",
|
630 |
+
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
|
631 |
+
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
|
632 |
+
"small", "small-caps", "small-caption", "smaller", "solid", "somali",
|
633 |
+
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
|
634 |
+
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
|
635 |
+
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
|
636 |
+
"table-caption", "table-cell", "table-column", "table-column-group",
|
637 |
+
"table-footer-group", "table-header-group", "table-row", "table-row-group",
|
638 |
+
"tamil",
|
639 |
+
"telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
|
640 |
+
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
|
641 |
+
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
|
642 |
+
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
|
643 |
+
"trad-chinese-formal", "trad-chinese-informal",
|
644 |
+
"translate", "translate3d", "translateX", "translateY", "translateZ",
|
645 |
+
"transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
|
646 |
+
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
|
647 |
+
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
|
648 |
+
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
|
649 |
+
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
|
650 |
+
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
|
651 |
+
"xx-large", "xx-small"
|
652 |
+
], valueKeywords = keySet(valueKeywords_);
|
653 |
+
|
654 |
+
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
|
655 |
+
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
|
656 |
+
.concat(valueKeywords_);
|
657 |
+
CodeMirror.registerHelper("hintWords", "css", allWords);
|
658 |
+
|
659 |
+
function tokenCComment(stream, state) {
|
660 |
+
var maybeEnd = false, ch;
|
661 |
+
while ((ch = stream.next()) != null) {
|
662 |
+
if (maybeEnd && ch == "/") {
|
663 |
+
state.tokenize = null;
|
664 |
+
break;
|
665 |
+
}
|
666 |
+
maybeEnd = (ch == "*");
|
667 |
+
}
|
668 |
+
return ["comment", "comment"];
|
669 |
+
}
|
670 |
+
|
671 |
+
CodeMirror.defineMIME("text/css", {
|
672 |
+
documentTypes: documentTypes,
|
673 |
+
mediaTypes: mediaTypes,
|
674 |
+
mediaFeatures: mediaFeatures,
|
675 |
+
mediaValueKeywords: mediaValueKeywords,
|
676 |
+
propertyKeywords: propertyKeywords,
|
677 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
678 |
+
fontProperties: fontProperties,
|
679 |
+
counterDescriptors: counterDescriptors,
|
680 |
+
colorKeywords: colorKeywords,
|
681 |
+
valueKeywords: valueKeywords,
|
682 |
+
tokenHooks: {
|
683 |
+
"/": function(stream, state) {
|
684 |
+
if (!stream.eat("*")) return false;
|
685 |
+
state.tokenize = tokenCComment;
|
686 |
+
return tokenCComment(stream, state);
|
687 |
+
}
|
688 |
+
},
|
689 |
+
name: "css"
|
690 |
+
});
|
691 |
+
|
692 |
+
CodeMirror.defineMIME("text/x-scss", {
|
693 |
+
mediaTypes: mediaTypes,
|
694 |
+
mediaFeatures: mediaFeatures,
|
695 |
+
mediaValueKeywords: mediaValueKeywords,
|
696 |
+
propertyKeywords: propertyKeywords,
|
697 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
698 |
+
colorKeywords: colorKeywords,
|
699 |
+
valueKeywords: valueKeywords,
|
700 |
+
fontProperties: fontProperties,
|
701 |
+
allowNested: true,
|
702 |
+
tokenHooks: {
|
703 |
+
"/": function(stream, state) {
|
704 |
+
if (stream.eat("/")) {
|
705 |
+
stream.skipToEnd();
|
706 |
+
return ["comment", "comment"];
|
707 |
+
} else if (stream.eat("*")) {
|
708 |
+
state.tokenize = tokenCComment;
|
709 |
+
return tokenCComment(stream, state);
|
710 |
+
} else {
|
711 |
+
return ["operator", "operator"];
|
712 |
+
}
|
713 |
+
},
|
714 |
+
":": function(stream) {
|
715 |
+
if (stream.match(/\s*\{/))
|
716 |
+
return [null, "{"];
|
717 |
+
return false;
|
718 |
+
},
|
719 |
+
"$": function(stream) {
|
720 |
+
stream.match(/^[\w-]+/);
|
721 |
+
if (stream.match(/^\s*:/, false))
|
722 |
+
return ["variable-2", "variable-definition"];
|
723 |
+
return ["variable-2", "variable"];
|
724 |
+
},
|
725 |
+
"#": function(stream) {
|
726 |
+
if (!stream.eat("{")) return false;
|
727 |
+
return [null, "interpolation"];
|
728 |
+
}
|
729 |
+
},
|
730 |
+
name: "css",
|
731 |
+
helperType: "scss"
|
732 |
+
});
|
733 |
+
|
734 |
+
CodeMirror.defineMIME("text/x-less", {
|
735 |
+
mediaTypes: mediaTypes,
|
736 |
+
mediaFeatures: mediaFeatures,
|
737 |
+
mediaValueKeywords: mediaValueKeywords,
|
738 |
+
propertyKeywords: propertyKeywords,
|
739 |
+
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
|
740 |
+
colorKeywords: colorKeywords,
|
741 |
+
valueKeywords: valueKeywords,
|
742 |
+
fontProperties: fontProperties,
|
743 |
+
allowNested: true,
|
744 |
+
tokenHooks: {
|
745 |
+
"/": function(stream, state) {
|
746 |
+
if (stream.eat("/")) {
|
747 |
+
stream.skipToEnd();
|
748 |
+
return ["comment", "comment"];
|
749 |
+
} else if (stream.eat("*")) {
|
750 |
+
state.tokenize = tokenCComment;
|
751 |
+
return tokenCComment(stream, state);
|
752 |
+
} else {
|
753 |
+
return ["operator", "operator"];
|
754 |
+
}
|
755 |
+
},
|
756 |
+
"@": function(stream) {
|
757 |
+
if (stream.eat("{")) return [null, "interpolation"];
|
758 |
+
if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
|
759 |
+
stream.eatWhile(/[\w\\\-]/);
|
760 |
+
if (stream.match(/^\s*:/, false))
|
761 |
+
return ["variable-2", "variable-definition"];
|
762 |
+
return ["variable-2", "variable"];
|
763 |
+
},
|
764 |
+
"&": function() {
|
765 |
+
return ["atom", "atom"];
|
766 |
+
}
|
767 |
+
},
|
768 |
+
name: "css",
|
769 |
+
helperType: "less"
|
770 |
+
});
|
771 |
+
|
772 |
+
});
|
modules/yith-woocommerce-ajax-navigation/assets/css/admin.css
CHANGED
@@ -184,6 +184,18 @@ input.yith-wcan-price-filter-input.widefat {
|
|
184 |
|
185 |
input#yit_wcan_options_yith_wcan_ajax_shop_pagination,
|
186 |
input#yit_wcan_options_yith_wcan_ajax_shop_container,
|
187 |
-
input#yit_wcan_options_yith_wcan_ajax_shop_result_container
|
|
|
|
|
188 |
width: 230px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
184 |
|
185 |
input#yit_wcan_options_yith_wcan_ajax_shop_pagination,
|
186 |
input#yit_wcan_options_yith_wcan_ajax_shop_container,
|
187 |
+
input#yit_wcan_options_yith_wcan_ajax_shop_result_container,
|
188 |
+
input#yit_wcan_options_yith_wcan_ajax_widget_title_class,
|
189 |
+
input#yit_wcan_options_yith_wcan_ajax_widget_title_tag {
|
190 |
width: 230px;
|
191 |
+
}
|
192 |
+
|
193 |
+
div#yit_wcan_options_yith_wcan_custom_style-container .option {
|
194 |
+
width: 85%;
|
195 |
+
}
|
196 |
+
|
197 |
+
textarea#yit_wcan_options_yith_wcan_custom_style {
|
198 |
+
min-height: 300px;
|
199 |
+
padding: 8px;
|
200 |
+
resize: none;
|
201 |
}
|
modules/yith-woocommerce-ajax-navigation/assets/images/03-bg.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/images/03-icon.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/images/03.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/images/04-bg.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/images/04-icon.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/images/04.png
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-editor.js
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var editor = CodeMirror.fromTextArea(document.getElementById("yit_wcan_options_yith_wcan_custom_style"), {
|
2 |
+
lineNumbers: true,
|
3 |
+
mode: "text/css",
|
4 |
+
indentUnit: 4,
|
5 |
+
tabSize: 4,
|
6 |
+
indentWithTabs: true,
|
7 |
+
showCursorWhenSelecting: true
|
8 |
+
});
|
modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-frontend.js
CHANGED
@@ -161,7 +161,6 @@ jQuery(function ($) {
|
|
161 |
$('.yit-wcan-container').html($(response).find('.woocommerce-info'));
|
162 |
}
|
163 |
|
164 |
-
|
165 |
//pagination
|
166 |
if ($(response).find(yith_wcan.pagination).length > 0) {
|
167 |
//se non esiste lo creo
|
@@ -174,6 +173,10 @@ jQuery(function ($) {
|
|
174 |
.show();
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
177 |
//result count
|
178 |
if ($(response).find(yith_wcan.result_count).length > 0) {
|
179 |
$(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
|
161 |
$('.yit-wcan-container').html($(response).find('.woocommerce-info'));
|
162 |
}
|
163 |
|
|
|
164 |
//pagination
|
165 |
if ($(response).find(yith_wcan.pagination).length > 0) {
|
166 |
//se non esiste lo creo
|
173 |
.show();
|
174 |
}
|
175 |
|
176 |
+
else {
|
177 |
+
$(yith_wcan.pagination).empty();
|
178 |
+
}
|
179 |
+
|
180 |
//result count
|
181 |
if ($(response).find(yith_wcan.result_count).length > 0) {
|
182 |
$(yith_wcan.result_count).html($(response).find(yith_wcan.result_count).html()).show();
|
modules/yith-woocommerce-ajax-navigation/assets/js/yith-wcan-frontend.min.js
CHANGED
@@ -5,8 +5,9 @@ k.slice(),--l;else{for(m=0;m<p;m++)if("input"==a[c].tag){e=[];e.push("<"+a[c].ta
|
|
5 |
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},v=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
|
6 |
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,u(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return v.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return u.apply(this,arguments);if(2==arguments.length)return v.apply(this,arguments)};b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
|
7 |
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=t(a,"min_price"),a=t(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
|
8 |
-
"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));0<b(c).find(yith_wcan.pagination).length
|
9 |
-
b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show());0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());
|
10 |
-
navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var r=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
|
11 |
-
b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
|
12 |
-
b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
|
|
5 |
if(a[c].vars)for(q=0;q<a[c].vars.length;q++)console.log(a[c].tag,a[c].vars[q]),e.setAttribute(a[c].vars[q][0],a[c].vars[q][1]);a[c].id&&(e.id=a[c].id);a[c].className&&(e.className=a[c].className);a[c].text&&e.appendChild(document.createTextNode(a[c].text));k[m]=f[m];f[m]=f[m]?f[m].appendChild(e):e}l++||Array.prototype.push.apply(d,f)}n=b.merge(n,f)}return b(d)},v=function(h,p,a){for(var d=h.match(/%[^%]*%/g)||[],f=[],k=0;k<p.length;k++){for(var g=h,l=0;l<d.length;l++)var c=d[l].substr(1,d[l].length-
|
6 |
2),g=g.replace(d[l],p[k][c]);f=b.merge(f,u(g,a))}return b(f)};b.jseldom=function(h){if(2==arguments.length&&b.isPlainObject(arguments[1]))return v.apply(this,[arguments[0],[arguments[1]]]);if(1==arguments.length||2==arguments.length&&!b.isArray(arguments[1]))return u.apply(this,arguments);if(2==arguments.length)return v.apply(this,arguments)};b.fn.yith_wcan_ajax_filters=function(h,p){h.preventDefault();var a=p.href,d=b(p);if("undefined"==typeof a&&d.parents().hasClass("price_slider_wrapper")){d.parents("form");
|
7 |
var f=window.location,k=f.origin+f.pathname,g=k!=f.href,l=b(".price_slider_amount #min_price").val(),c=b(".price_slider_amount #max_price").val(),a=f.href;1==g&&(a=t(a,"min_price"),a=t(a,"max_price"));a=a+(k==a?"?":"&")+b.param({min_price:l,max_price:c})}"select"==d.data("type")&&(d.parents("div.yith-woo-ajax-navigation").find("a.yit-wcan-select-open").removeClass("active"),d.parent().find("div.yith-wcan-select-wrapper").animate({visibility:"hidden",opacity:0},300));b(yith_wcan.container).html("").addClass("yith-wcan-loading");
|
8 |
+
"undefined"!=typeof yith_wcan_frontend&&b(yith_wcan.container).css("backgroundImage","url("+yith_wcan_frontend.loader_url+")");b(yith_wcan.pagination).hide();b(yith_wcan.result_count).hide();b.ajax({url:a,success:function(c){b(yith_wcan.container).removeClass("yith-wcan-loading");0<b(c).find(yith_wcan.container).length?b(".yit-wcan-container").html(b(c).find(yith_wcan.container)):b(".yit-wcan-container").html(b(c).find(".woocommerce-info"));0<b(c).find(yith_wcan.pagination).length?(0==b(yith_wcan.pagination).length&&
|
9 |
+
b.jseldom(yith_wcan.pagination).insertAfter(b(yith_wcan.container)),b(yith_wcan.pagination).html(b(c).find(yith_wcan.pagination).html()).show()):b(yith_wcan.pagination).empty();0<b(c).find(yith_wcan.result_count).length&&b(yith_wcan.result_count).html(b(c).find(yith_wcan.result_count).html()).show();b(".yith-woo-ajax-navigation").add(".yith-wcan-sort-by").add(".yith-wcan-stock-on-sale").add(".yith-wcan-list-price-filter").each(function(){var a=b(this),d=a.attr("id");a.html(b(c).find("#"+d).html());
|
10 |
+
""==a.text()?a.hide():a.show()});navigator.userAgent.match(/msie/i)||window.history.pushState({pageTitle:c.pageTitle},"",a);b(document).trigger("ready");b(document).trigger("yith-wcan-ajax-filtered")}})};b(yith_wcan.container).wrap('<div class="yit-wcan-container"></div>');b(".woocommerce-info").wrap('<div class="yit-wcan-container"></div>');b(document).on("click",".yith-wcan a",function(h){b(this).yith_wcan_ajax_filters(h,this)});var r=function(){b("div.yith-wcan-select-wrapper").animate({visibility:"hidden",
|
11 |
+
opacity:0},0);b("a.yit-wcan-select-open").removeClass("active")};b(document).on("click","a.yit-wcan-select-open.active",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index","-1").animate({visibility:"hidden",opacity:0},300);b(this).parent().find("a.yit-wcan-select-open").removeClass("active")});b(document).on("click","a.yit-wcan-select-open:not(.active)",function(h){h.preventDefault();b(this).parent().find("div.yith-wcan-select-wrapper").css("z-index",
|
12 |
+
"1").animate({visibility:"visible",opacity:1},300);b(this).parent().find("a.yit-wcan-select-open").addClass("active")});b(document).on("ready yith-wcan-ajax-filtered",function(){b("div.yith-wcan-select-wrapper ul.yith-wcan-select li.chosen");r();b("div.yith-wcan-select-wrapper").each(function(){var h="";b(this).find("ul.yith-wcan-select li.chosen").each(function(){h+=b(this).text()+", "});h=h.substring(0,h.length-2);""!=h&&b(this).parent().find("a.yit-wcan-select-open").text(h)})});b(document).on("ready",
|
13 |
+
r);b("body").on("click",function(h){b(h.target).hasClass("yit-wcan-select-open")||r()})});
|
modules/yith-woocommerce-ajax-navigation/includes/class.yith-wcan-admin.php
CHANGED
@@ -66,11 +66,13 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
66 |
|
67 |
//Actions
|
68 |
add_action( 'init', array( $this, 'init' ) );
|
69 |
-
|
70 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
71 |
-
add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
|
72 |
|
|
|
|
|
|
|
73 |
add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
|
|
|
74 |
|
75 |
/* Plugin Informations */
|
76 |
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
|
@@ -79,7 +81,6 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
79 |
/* Add WordPress Pointer */
|
80 |
add_action( 'admin_init', array( $this, 'register_pointer' ) );
|
81 |
|
82 |
-
|
83 |
// YITH WCAN Loaded
|
84 |
do_action( 'yith_wcan_loaded' );
|
85 |
}
|
@@ -113,6 +114,13 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
113 |
wp_enqueue_script( 'wp-color-picker' );
|
114 |
wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -131,7 +139,9 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
131 |
}
|
132 |
|
133 |
$admin_tabs = array(
|
134 |
-
'
|
|
|
|
|
135 |
);
|
136 |
|
137 |
$args = array(
|
@@ -156,9 +166,31 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
156 |
$this->_panel = new YIT_Plugin_Panel( $args );
|
157 |
$this->_main_panel_option = "yit_{$args['parent']}_options";
|
158 |
|
|
|
|
|
159 |
do_action( 'yith_wcan_after_option_panel', $args );
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
public function premium_tab() {
|
163 |
require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
|
164 |
}
|
@@ -221,6 +253,9 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
221 |
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
|
222 |
}
|
223 |
|
|
|
|
|
|
|
224 |
public function register_pointer() {
|
225 |
|
226 |
if( defined( 'YITH_WCAN_PREMIUM' ) && YITH_WCAN_PREMIUM ){
|
@@ -258,5 +293,27 @@ if ( ! class_exists( 'YITH_WCAN_Admin' ) ) {
|
|
258 |
|
259 |
YIT_Pointers()->register( $args );
|
260 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
}
|
262 |
}
|
66 |
|
67 |
//Actions
|
68 |
add_action( 'init', array( $this, 'init' ) );
|
|
|
69 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
|
|
|
70 |
|
71 |
+
/* Plugin Option Panel */
|
72 |
+
add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
|
73 |
+
add_action( 'yit_panel_wcan_description', array( $this, 'frontend_description_option' ), 10, 3 );
|
74 |
add_action( 'yith_wcan_premium_tab', array( $this, 'premium_tab' ) );
|
75 |
+
add_action( 'yith_wcan_custom_style_tab', array( $this, 'custom_style_tab' ) );
|
76 |
|
77 |
/* Plugin Informations */
|
78 |
add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAN_DIR . '/' . basename( YITH_WCAN_FILE ) ), array( $this, 'action_links' ) );
|
81 |
/* Add WordPress Pointer */
|
82 |
add_action( 'admin_init', array( $this, 'register_pointer' ) );
|
83 |
|
|
|
84 |
// YITH WCAN Loaded
|
85 |
do_action( 'yith_wcan_loaded' );
|
86 |
}
|
114 |
wp_enqueue_script( 'wp-color-picker' );
|
115 |
wp_enqueue_script( 'yith_wcan_admin', YITH_WCAN_URL . 'assets/js/yith-wcan-admin.js', array( 'jquery', 'wp-color-picker' ), $this->version, true );
|
116 |
}
|
117 |
+
|
118 |
+
if( 'admin.php' == $pagenow && isset( $_GET['page'] ) && 'yith_wcan_panel' == $_GET['page'] && isset( $_GET['tab'] ) && 'custom-style' == $_GET['tab'] ){
|
119 |
+
wp_enqueue_style( 'codemirror-style', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.css', array( 'yit-plugin-style' ) );
|
120 |
+
wp_enqueue_script( 'codemirror-script', YITH_WCAN_URL . 'assets/3rd-party/codemirror/lib/codemirror.js', array( 'jquery' ), false, true );
|
121 |
+
wp_enqueue_script( 'codemirror-script-css', YITH_WCAN_URL . 'assets/3rd-party/codemirror/mode/css/css.js', array( 'codemirror-script' ), false, true );
|
122 |
+
wp_enqueue_script( 'yith-wcan-codemirror-init', YITH_WCAN_URL . 'assets/js/yith-wcan-editor.js', array( 'jquery' ), $this->version, true );
|
123 |
+
}
|
124 |
}
|
125 |
|
126 |
/**
|
139 |
}
|
140 |
|
141 |
$admin_tabs = array(
|
142 |
+
'frontend' => __( 'Front end', 'yith_wc_ajxnav' ),
|
143 |
+
'custom-style' => __( 'Custom Style', 'yith_wc_ajxnav' ),
|
144 |
+
'premium' => __( 'Premium Version', 'yith_wc_ajxnav' )
|
145 |
);
|
146 |
|
147 |
$args = array(
|
166 |
$this->_panel = new YIT_Plugin_Panel( $args );
|
167 |
$this->_main_panel_option = "yit_{$args['parent']}_options";
|
168 |
|
169 |
+
$this->save_default_options();
|
170 |
+
|
171 |
do_action( 'yith_wcan_after_option_panel', $args );
|
172 |
}
|
173 |
|
174 |
+
/**
|
175 |
+
* Add default option to panel
|
176 |
+
*
|
177 |
+
* @return void
|
178 |
+
* @since 1.0
|
179 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
180 |
+
* @use /Yit_Plugin_Panel class
|
181 |
+
* @see plugin-fw/lib/yit-plugin-panel.php
|
182 |
+
*/
|
183 |
+
public function save_default_options(){
|
184 |
+
$options = get_option( $this->_main_panel_option );
|
185 |
+
if( $options === false ){
|
186 |
+
add_option( $this->_main_panel_option, $this->_panel->get_default_options());
|
187 |
+
}
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Premium Tab
|
193 |
+
*/
|
194 |
public function premium_tab() {
|
195 |
require_once( YITH_WCAN_DIR . 'templates/admin/premium.php' );
|
196 |
}
|
253 |
return defined( 'YITH_REFER_ID' ) ? $this->_premium_landing . '?refer_id=' . YITH_REFER_ID : $this->_premium_landing . '?refer_id=1030585';
|
254 |
}
|
255 |
|
256 |
+
/**
|
257 |
+
* Add WP Pointer
|
258 |
+
*/
|
259 |
public function register_pointer() {
|
260 |
|
261 |
if( defined( 'YITH_WCAN_PREMIUM' ) && YITH_WCAN_PREMIUM ){
|
293 |
|
294 |
YIT_Pointers()->register( $args );
|
295 |
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Add the frontend tab description
|
299 |
+
*
|
300 |
+
* @param $option
|
301 |
+
* @param $db_value
|
302 |
+
* @param $custom_attributes
|
303 |
+
*
|
304 |
+
* @return string The description text
|
305 |
+
* @since 2.0.0
|
306 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
307 |
+
*/
|
308 |
+
public function frontend_description_option( $option, $db_value, $custom_attributes ){
|
309 |
+
echo "<p>{$option['desc']}</p>";
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Custom Style tab
|
314 |
+
*/
|
315 |
+
public function custom_style_tab(){
|
316 |
+
require_once( YITH_WCAN_DIR . 'templates/admin/editor.php' );
|
317 |
+
}
|
318 |
}
|
319 |
}
|
modules/yith-woocommerce-ajax-navigation/includes/class.yith-wcan-frontend.php
CHANGED
@@ -56,17 +56,21 @@ if ( ! class_exists( 'YITH_WCAN_Frontend' ) ) {
|
|
56 |
if ( yith_wcan_can_be_displayed() ) {
|
57 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
58 |
|
59 |
-
wp_enqueue_style( '
|
60 |
-
wp_enqueue_script( '
|
|
|
|
|
|
|
|
|
61 |
|
62 |
$args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
)
|
67 |
);
|
68 |
|
69 |
-
wp_localize_script( '
|
70 |
}
|
71 |
}
|
72 |
|
56 |
if ( yith_wcan_can_be_displayed() ) {
|
57 |
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
58 |
|
59 |
+
wp_enqueue_style( 'yith-wcan-frontend', YITH_WCAN_URL . 'assets/css/frontend.css', false, $this->version );
|
60 |
+
wp_enqueue_script( 'yith-wcan-script', YITH_WCAN_URL . 'assets/js/yith-wcan-frontend' . $suffix . '.js', array( 'jquery' ), $this->version, true );
|
61 |
+
|
62 |
+
$custom_style = yith_wcan_get_option( 'yith_wcan_custom_style', '' );
|
63 |
+
|
64 |
+
! empty( $custom_style ) && wp_add_inline_style( 'yith-wcan-frontend', sanitize_text_field( $custom_style ) );
|
65 |
|
66 |
$args = apply_filters( 'yith_wcan_ajax_frontend_classes', array(
|
67 |
+
'container' => yith_wcan_get_option( 'yith_wcan_ajax_shop_container', '.products' ),
|
68 |
+
'pagination' => yith_wcan_get_option( 'yith_wcan_ajax_shop_pagination', 'nav.woocommerce-pagination' ),
|
69 |
+
'result_count' => yith_wcan_get_option( 'yith_wcan_ajax_shop_result_container', '.woocommerce-result-count' ),
|
70 |
)
|
71 |
);
|
72 |
|
73 |
+
wp_localize_script( 'yith-wcan-script', 'yith_wcan', apply_filters( 'yith-wcan-frontend-args', $args ) );
|
74 |
}
|
75 |
}
|
76 |
|
modules/yith-woocommerce-ajax-navigation/init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
|
6 |
-
* Version: 2.
|
7 |
* Author: yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith_wc_ajxnav
|
@@ -65,7 +65,7 @@ if ( defined( 'YITH_WCAN_VERSION' ) ) {
|
|
65 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
66 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
67 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
68 |
-
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.
|
69 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
70 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
71 |
|
3 |
* Plugin Name: YITH WooCommerce Ajax Product Filter
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Product Filter offers the perfect way to filter all the products of your shop.
|
6 |
+
* Version: 2.3.1
|
7 |
* Author: yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
* Text Domain: yith_wc_ajxnav
|
65 |
! defined( 'YITH_WCAN' ) && define( 'YITH_WCAN', true );
|
66 |
! defined( 'YITH_WCAN_URL' ) && define( 'YITH_WCAN_URL', plugin_dir_url( __FILE__ ) );
|
67 |
! defined( 'YITH_WCAN_DIR' ) && define( 'YITH_WCAN_DIR', plugin_dir_path( __FILE__ ) );
|
68 |
+
! defined( 'YITH_WCAN_VERSION' ) && define( 'YITH_WCAN_VERSION', '2.3.1' );
|
69 |
! defined( 'YITH_WCAN_FREE_INIT') && define( 'YITH_WCAN_FREE_INIT', plugin_basename( __FILE__ ) );
|
70 |
! defined( 'YITH_WCAN_FILE' ) && define( 'YITH_WCAN_FILE', __FILE__ );
|
71 |
|
modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-it_IT.mo
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-it_IT.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2015-
|
6 |
-
"PO-Revision-Date: 2015-
|
7 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: it_IT\n"
|
@@ -20,29 +20,37 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: plugin-fw\n"
|
22 |
|
23 |
-
#: includes/class.yith-wcan-admin.php:
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
msgid "Premium Version"
|
26 |
msgstr "Versione Premium"
|
27 |
|
28 |
-
#: includes/class.yith-wcan-admin.php:
|
29 |
-
#: includes/class.yith-wcan-admin.php:
|
30 |
msgid "Ajax Product Filter"
|
31 |
msgstr "Ajax Product Filter"
|
32 |
|
33 |
-
#: includes/class.yith-wcan-admin.php:
|
34 |
msgid "Premium live demo"
|
35 |
msgstr "Anteprima versione premium"
|
36 |
|
37 |
-
#: includes/class.yith-wcan-admin.php:
|
38 |
msgid "Live demo"
|
39 |
msgstr "Anteprima"
|
40 |
|
41 |
-
#: includes/class.yith-wcan-admin.php:
|
42 |
msgid "Plugin Documentation"
|
43 |
msgstr "Documentazione Plugin"
|
44 |
|
45 |
-
#: includes/class.yith-wcan-admin.php:
|
46 |
msgid ""
|
47 |
"Dear users,\n"
|
48 |
" we would like to inform you that the YITH "
|
@@ -71,18 +79,18 @@ msgstr ""
|
|
71 |
"possibile aggiornare/tradurre il file .po seguendo la procedura classica di "
|
72 |
"traduzione."
|
73 |
|
74 |
-
#: includes/class.yith-wcan-admin.php:
|
75 |
msgctxt "Admin(Pointers): Plugin Title"
|
76 |
msgid "YITH WooCommerce Ajax Product Filter"
|
77 |
msgstr "YITH WooCommerce Ajax Product Filter"
|
78 |
|
79 |
-
#: includes/class.yith-wcan-admin.php:
|
80 |
msgid ""
|
81 |
"YITH WooCommerce Product Filter has been updated with new available options"
|
82 |
msgstr ""
|
83 |
"YITH WooCommerce Product Filter è stato aggiornato con delle nuove opzioni"
|
84 |
|
85 |
-
#: includes/class.yith-wcan-admin.php:
|
86 |
msgid "discover the PREMIUM version"
|
87 |
msgstr "scopri la versione PREMIUM"
|
88 |
|
@@ -121,139 +129,159 @@ msgstr ""
|
|
121 |
"YITH WooCommerce Ajax Product Filter è attivo, ma non operativo. Richiede "
|
122 |
"WooCommerce affinché possa funzionare correttamente."
|
123 |
|
124 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
#, php-format
|
126 |
msgid ""
|
127 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax Product "
|
128 |
"Filter%2$s to benefit from all features!"
|
129 |
msgstr ""
|
130 |
-
"Aggiorna alla %1$sversione PREMIUM%2$s di %1$sYITH WOOCOMMERCE AJAX PRODUCT "
|
131 |
-
"FILTER%2$s per beneficiare di tutte le funzionalità!"
|
132 |
|
133 |
-
#: templates/admin/premium.php:
|
134 |
msgid "UPGRADE"
|
135 |
-
msgstr "
|
136 |
|
137 |
-
#: templates/admin/premium.php:
|
138 |
msgid "to the premium version"
|
139 |
-
msgstr "
|
140 |
|
141 |
-
#: templates/admin/premium.php:
|
142 |
msgid "Premium Features"
|
143 |
-
msgstr "
|
144 |
|
145 |
-
#: templates/admin/premium.php:
|
146 |
msgid "Two more layouts"
|
147 |
-
msgstr "
|
148 |
|
149 |
-
#: templates/admin/premium.php:
|
150 |
#, php-format
|
151 |
msgid ""
|
152 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
153 |
-
"layouts to filter the products of your shop
|
154 |
-
"
|
155 |
-
"
|
156 |
-
"
|
157 |
-
"
|
158 |
-
"
|
159 |
-
"
|
160 |
-
"products by brands thanks to the ajax technology.\n"
|
161 |
-
" "
|
162 |
msgstr ""
|
163 |
-
|
164 |
-
|
165 |
-
"%1$sBicolor%2$s, perfetto per quegli attributi (di tipo colore) che fanno "
|
166 |
-
"riferimento a due colori contemporaneamente (bianco/nero), per un impatto "
|
167 |
-
"visivo agevole per l’utente finale. Scegli la tipologia %1$sTag%2$s se "
|
168 |
-
"invece vuoi che i tuoi prodotti possano essere filtrati per tag di "
|
169 |
-
"prodotto.\n"
|
170 |
-
"Se stai usando contemporaneamente anche %1$sYITH WooCommerce Brand Add-On"
|
171 |
-
"%2$s, potrai offrire la possibilità di filtrare per brand i prodotti del tuo "
|
172 |
-
"shop grazie alla tecnologia ajax."
|
173 |
-
|
174 |
-
#: templates/admin/premium.php:241
|
175 |
msgid "Price range"
|
176 |
-
msgstr "
|
177 |
|
178 |
-
#: templates/admin/premium.php:
|
179 |
#, php-format
|
180 |
msgid ""
|
181 |
"One of the most requested filter for e-commerce sites is the one that let "
|
182 |
-
"you select products by their prices
|
183 |
-
"
|
184 |
-
"
|
185 |
-
"filter products selecting on the ranges you have set."
|
186 |
msgstr ""
|
187 |
-
|
188 |
-
|
189 |
-
"base del prezzo. Grazie a YITH WooCommerce Filtro Ajax Elenco Prezzi "
|
190 |
-
"%1$spotrai definire infiniti range di prezzo%2$s, così da permettere ai tuoi "
|
191 |
-
"utenti di filtrare i prodotti selezionando uno degli intervalli di prezzo da "
|
192 |
-
"te definiti."
|
193 |
-
|
194 |
-
#: templates/admin/premium.php:261
|
195 |
msgid "Ajax Stock/On Sale Filters"
|
196 |
-
msgstr "
|
197 |
|
198 |
-
#: templates/admin/premium.php:
|
199 |
#, php-format
|
200 |
msgid ""
|
201 |
-
"A new widget for the premium version of the plugin
|
202 |
-
"
|
203 |
-
"
|
204 |
-
"
|
205 |
-
"worthy!%2$s"
|
206 |
msgstr ""
|
207 |
-
"Ancora un widget novità per la versione premium del plugin. \n"
|
208 |
-
"Con esso chiunque si trovi a navigare tra le pagine del tuo shop potrà "
|
209 |
-
"visualizzare solo i prodotti in saldo e/o i prodotti al momento disponibili."
|
210 |
-
"%3$s \n"
|
211 |
-
"%1$sUna caratteristica aggiuntiva per un e-commerce che vale!%2$s"
|
212 |
|
213 |
-
#: templates/admin/premium.php:
|
214 |
msgid "Product sorting"
|
215 |
-
msgstr "
|
216 |
|
217 |
-
#: templates/admin/premium.php:
|
218 |
#, php-format
|
219 |
msgid ""
|
220 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your "
|
221 |
-
"users the freedom to sort products with the ajax technology
|
222 |
-
"
|
223 |
-
"
|
224 |
msgstr ""
|
225 |
-
"Con il nuovo widget %1$sYITH WooCommerce Disposizione Ajax%2$s dai ai tuoi "
|
226 |
-
"utenti la possibilità di ordinare in ajax i prodotti, senza la necessità di "
|
227 |
-
"dover attendere che la pagina ricarichi.\n"
|
228 |
-
"L’ordinamento può essere fatto in base al rating, numero di vendite, prezzo "
|
229 |
-
"o data di pubblicazione."
|
230 |
|
231 |
-
#: templates/admin/premium.php:
|
232 |
msgid "Customized loader"
|
233 |
-
msgstr "
|
234 |
|
235 |
-
#: templates/admin/premium.php:
|
236 |
msgid ""
|
237 |
"From the plugin option panel, you can choose to upload a new icon for your "
|
238 |
"loader: in this way, it will better meet your needs."
|
239 |
msgstr ""
|
240 |
-
"Direttamente dal pannello opzioni del plugin potrai scegliere di effettuare "
|
241 |
-
"l’upload di una nuova icona per il loader, nel caso quello di default non "
|
242 |
-
"faccia al caso tuo."
|
243 |
|
244 |
-
#: templates/admin/premium.php:
|
245 |
msgid "WooCommerce Price Filter"
|
246 |
-
msgstr "
|
247 |
|
248 |
-
#: templates/admin/premium.php:
|
249 |
msgid ""
|
250 |
"With the premium version of the plugin, you will also be able to customize "
|
251 |
"WooCommerce Price Filter widget, changing the settings you can find in the "
|
252 |
"plugin option panel."
|
253 |
msgstr ""
|
254 |
-
"Con la versione premium del plugin avrai anche la possibilità di "
|
255 |
-
"personalizzare il widget WooCommerce Price Filter, modificando le apposite "
|
256 |
-
"impostazioni che sono state inserite nel pannello opzioni del plugin."
|
257 |
|
258 |
#: widgets/class.yith-wcan-navigation-widget.php:23
|
259 |
msgid "Filter the product list without reloading the page"
|
@@ -346,60 +374,9 @@ msgstr "Resetta tutti i filtri"
|
|
346 |
msgid "Button Label"
|
347 |
msgstr "Etichetta Pulsante"
|
348 |
|
349 |
-
#~ msgid "YITH WooCommerce Ajax Product Filter"
|
350 |
-
#~ msgstr "YITH WooCommerce Ajax Product Filter"
|
351 |
-
|
352 |
#~ msgid "Settings"
|
353 |
#~ msgstr "Impostazioni"
|
354 |
|
355 |
-
#~ msgid "Front end"
|
356 |
-
#~ msgstr "Front end"
|
357 |
-
|
358 |
-
#~ msgid "General Settings"
|
359 |
-
#~ msgstr "Impostazioni Generali"
|
360 |
-
|
361 |
-
#~ msgctxt "Admin panel: option description"
|
362 |
-
#~ msgid "How To:"
|
363 |
-
#~ msgstr "Descrizione"
|
364 |
-
|
365 |
-
#~ msgctxt "Admin: Panel section description"
|
366 |
-
#~ msgid ""
|
367 |
-
#~ "If your theme use the WooCommerce standard templates, you don't need to "
|
368 |
-
#~ "change the following values.\n"
|
369 |
-
#~ " Otherwise, add the classes used in the "
|
370 |
-
#~ "template of your theme.\n"
|
371 |
-
#~ " If you don't know them, please contact "
|
372 |
-
#~ "the developer of your theme to receive the correct classes."
|
373 |
-
#~ msgstr ""
|
374 |
-
#~ "Se il tuo tema utilizza i template standard diWooCommerce, non devi "
|
375 |
-
#~ "modificare i seguenti valori.\n"
|
376 |
-
#~ " In caso contrario, aggiungi le classe "
|
377 |
-
#~ "utilizzate nel template del tuo tema.\n"
|
378 |
-
#~ " Se non le conosci, contatta lo "
|
379 |
-
#~ "sviluppatore del tuo tema per ottenere le classi corrette."
|
380 |
-
|
381 |
-
#~ msgid "Product Container"
|
382 |
-
#~ msgstr "Contenitore Prodotti"
|
383 |
-
|
384 |
-
#~ msgid "Put here the CSS class or id for the product container"
|
385 |
-
#~ msgstr "Inserisci qui la classe CSS o l'ID per il contenitore del prodotto"
|
386 |
-
|
387 |
-
#~ msgid "Shop Pagination Container"
|
388 |
-
#~ msgstr "Contenitore Paginazione"
|
389 |
-
|
390 |
-
#~ msgid "Put here the CSS class or id for the shop pagination container"
|
391 |
-
#~ msgstr ""
|
392 |
-
#~ "Inserisci qui la classe CSS o l'ID per il contenitore della paginazione "
|
393 |
-
#~ "del negozio"
|
394 |
-
|
395 |
-
#~ msgid "Result Count Container"
|
396 |
-
#~ msgstr "Contenitore Conteggio Prodotti"
|
397 |
-
|
398 |
-
#~ msgid "Put here the CSS class or id for the result count container"
|
399 |
-
#~ msgstr ""
|
400 |
-
#~ "Inserisci qui la classe CSS o l'ID per il contenitore del conteggio dei "
|
401 |
-
#~ "prodotti"
|
402 |
-
|
403 |
#~ msgid "Ajax Loader"
|
404 |
#~ msgstr "Loader Ajax"
|
405 |
|
@@ -532,19 +509,6 @@ msgstr "Etichetta Pulsante"
|
|
532 |
#~ msgid "Brand"
|
533 |
#~ msgstr "Brand"
|
534 |
|
535 |
-
#~ msgctxt "Admin: user tooltip"
|
536 |
-
#~ msgid ""
|
537 |
-
#~ "Activating the filter type \"Tag \" you can choose which tags show in"
|
538 |
-
#~ msgstr "Attivando il filtro \"Tag\", puoi scegliere quali tag mostrare in"
|
539 |
-
|
540 |
-
#~ msgctxt "Label link"
|
541 |
-
#~ msgid "YIT Plugins -> Ajax Product Filter -> Filter by Tag"
|
542 |
-
#~ msgstr "YIT Plugins -> Ajax Product Filter -> Filtra per tag"
|
543 |
-
|
544 |
-
#~ msgctxt "Label link"
|
545 |
-
#~ msgid "Please take note of the following Widgets ID"
|
546 |
-
#~ msgstr "Si prega di prender nota dei seguenti ID dei widget"
|
547 |
-
|
548 |
#~ msgid "Use custom style for reset button"
|
549 |
#~ msgstr "Utilizza uno stile personalizzato per il pulsante di reset"
|
550 |
|
@@ -598,9 +562,25 @@ msgstr "Etichetta Pulsante"
|
|
598 |
#~ msgid "Show \"In Stock\" filter"
|
599 |
#~ msgstr "Mostra filtro \"Disponibili\""
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
#~ msgid "YITH WooCommerce Ajax List Price Filter"
|
602 |
#~ msgstr "YITH WooCommerce Filtro Ajax List Price Filter"
|
603 |
|
|
|
|
|
|
|
604 |
#~ msgid "Frontend"
|
605 |
#~ msgstr "Front end"
|
606 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2015-09-17 14:37+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-09-17 14:37+0100\n"
|
7 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: it_IT\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: plugin-fw\n"
|
22 |
|
23 |
+
#: includes/class.yith-wcan-admin.php:142
|
24 |
+
msgid "Front end"
|
25 |
+
msgstr "Front end"
|
26 |
+
|
27 |
+
#: includes/class.yith-wcan-admin.php:143 settings/custom-style-options.php:12
|
28 |
+
msgid "Custom Style"
|
29 |
+
msgstr "Modifica stile"
|
30 |
+
|
31 |
+
#: includes/class.yith-wcan-admin.php:144
|
32 |
+
#: includes/class.yith-wcan-admin.php:216
|
33 |
msgid "Premium Version"
|
34 |
msgstr "Versione Premium"
|
35 |
|
36 |
+
#: includes/class.yith-wcan-admin.php:150
|
37 |
+
#: includes/class.yith-wcan-admin.php:151
|
38 |
msgid "Ajax Product Filter"
|
39 |
msgstr "Ajax Product Filter"
|
40 |
|
41 |
+
#: includes/class.yith-wcan-admin.php:212
|
42 |
msgid "Premium live demo"
|
43 |
msgstr "Anteprima versione premium"
|
44 |
|
45 |
+
#: includes/class.yith-wcan-admin.php:212
|
46 |
msgid "Live demo"
|
47 |
msgstr "Anteprima"
|
48 |
|
49 |
+
#: includes/class.yith-wcan-admin.php:240
|
50 |
msgid "Plugin Documentation"
|
51 |
msgstr "Documentazione Plugin"
|
52 |
|
53 |
+
#: includes/class.yith-wcan-admin.php:269
|
54 |
msgid ""
|
55 |
"Dear users,\n"
|
56 |
" we would like to inform you that the YITH "
|
79 |
"possibile aggiornare/tradurre il file .po seguendo la procedura classica di "
|
80 |
"traduzione."
|
81 |
|
82 |
+
#: includes/class.yith-wcan-admin.php:274
|
83 |
msgctxt "Admin(Pointers): Plugin Title"
|
84 |
msgid "YITH WooCommerce Ajax Product Filter"
|
85 |
msgstr "YITH WooCommerce Ajax Product Filter"
|
86 |
|
87 |
+
#: includes/class.yith-wcan-admin.php:276
|
88 |
msgid ""
|
89 |
"YITH WooCommerce Product Filter has been updated with new available options"
|
90 |
msgstr ""
|
91 |
"YITH WooCommerce Product Filter è stato aggiornato con delle nuove opzioni"
|
92 |
|
93 |
+
#: includes/class.yith-wcan-admin.php:276
|
94 |
msgid "discover the PREMIUM version"
|
95 |
msgstr "scopri la versione PREMIUM"
|
96 |
|
129 |
"YITH WooCommerce Ajax Product Filter è attivo, ma non operativo. Richiede "
|
130 |
"WooCommerce affinché possa funzionare correttamente."
|
131 |
|
132 |
+
#: settings/custom-style-options.php:24
|
133 |
+
msgid "Put here your custom CSS rules:"
|
134 |
+
msgstr "Metti qui le tue modifiche delle regole del CSS"
|
135 |
+
|
136 |
+
#: settings/frontend-options.php:12
|
137 |
+
msgid "General Settings"
|
138 |
+
msgstr "Impostazioni Generali"
|
139 |
+
|
140 |
+
#: settings/frontend-options.php:25
|
141 |
+
msgctxt "Admin panel: option description"
|
142 |
+
msgid "How To:"
|
143 |
+
msgstr "Descrizione"
|
144 |
+
|
145 |
+
#: settings/frontend-options.php:27
|
146 |
+
msgctxt "Admin: Panel section description"
|
147 |
+
msgid ""
|
148 |
+
"If your theme use the WooCommerce standard templates, you don't need to "
|
149 |
+
"change the following values.\n"
|
150 |
+
" Otherwise, add the classes used in the "
|
151 |
+
"template of your theme.\n"
|
152 |
+
" If you don't know them, please contact the "
|
153 |
+
"developer of your theme to receive the correct classes."
|
154 |
+
msgstr ""
|
155 |
+
"Se il tuo tema utilizza i template standard diWooCommerce, non devi "
|
156 |
+
"modificare i seguenti valori.\n"
|
157 |
+
" In caso contrario, aggiungi le classe "
|
158 |
+
"utilizzate nel template del tuo tema.\n"
|
159 |
+
" Se non le conosci, contatta lo sviluppatore "
|
160 |
+
"del tuo tema per ottenere le classi corrette."
|
161 |
+
|
162 |
+
#: settings/frontend-options.php:33
|
163 |
+
msgid "Product Container"
|
164 |
+
msgstr "Contenitore Prodotti"
|
165 |
+
|
166 |
+
#: settings/frontend-options.php:34
|
167 |
+
msgid "Put here the CSS class or id for the product container"
|
168 |
+
msgstr "Inserisci qui la classe CSS o l'ID per il contenitore del prodotto"
|
169 |
+
|
170 |
+
#: settings/frontend-options.php:41
|
171 |
+
msgid "Shop Pagination Container"
|
172 |
+
msgstr "Contenitore Paginazione"
|
173 |
+
|
174 |
+
#: settings/frontend-options.php:42
|
175 |
+
msgid "Put here the CSS class or id for the shop pagination container"
|
176 |
+
msgstr ""
|
177 |
+
"Inserisci qui la classe CSS o l'ID per il contenitore della paginazione del "
|
178 |
+
"negozio"
|
179 |
+
|
180 |
+
#: settings/frontend-options.php:49
|
181 |
+
msgid "Result Count Container"
|
182 |
+
msgstr "Contenitore Conteggio Prodotti"
|
183 |
+
|
184 |
+
#: settings/frontend-options.php:50
|
185 |
+
msgid "Put here the CSS class or id for the result count container"
|
186 |
+
msgstr ""
|
187 |
+
"Inserisci qui la classe CSS o l'ID per il contenitore del conteggio dei "
|
188 |
+
"prodotti"
|
189 |
+
|
190 |
+
#: templates/admin/premium.php:203 templates/admin/premium.php:313
|
191 |
#, php-format
|
192 |
msgid ""
|
193 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax Product "
|
194 |
"Filter%2$s to benefit from all features!"
|
195 |
msgstr ""
|
|
|
|
|
196 |
|
197 |
+
#: templates/admin/premium.php:206 templates/admin/premium.php:316
|
198 |
msgid "UPGRADE"
|
199 |
+
msgstr ""
|
200 |
|
201 |
+
#: templates/admin/premium.php:207 templates/admin/premium.php:317
|
202 |
msgid "to the premium version"
|
203 |
+
msgstr ""
|
204 |
|
205 |
+
#: templates/admin/premium.php:213
|
206 |
msgid "Premium Features"
|
207 |
+
msgstr ""
|
208 |
|
209 |
+
#: templates/admin/premium.php:221
|
210 |
msgid "Two more layouts"
|
211 |
+
msgstr ""
|
212 |
|
213 |
+
#: templates/admin/premium.php:224
|
214 |
#, php-format
|
215 |
msgid ""
|
216 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
217 |
+
"layouts to filter the products of your shop.%1$sBicolor%2$s: the perfect "
|
218 |
+
"choice for those attributes related to two different colors at the same time "
|
219 |
+
"(white/black), for a simple visual impact for the final user. Pick the "
|
220 |
+
"%1$sTag%2$s typology, on the contrary, if you want to filter your products "
|
221 |
+
"by product tag. And if you are using also the %1$sYITH WooCommerce Brand Add-"
|
222 |
+
"On%2$s plugin, you will be able to offer the freedom to filter your shop "
|
223 |
+
"products by brands thanks to the ajax technology."
|
|
|
|
|
224 |
msgstr ""
|
225 |
+
|
226 |
+
#: templates/admin/premium.php:234
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
msgid "Price range"
|
228 |
+
msgstr ""
|
229 |
|
230 |
+
#: templates/admin/premium.php:237
|
231 |
#, php-format
|
232 |
msgid ""
|
233 |
"One of the most requested filter for e-commerce sites is the one that let "
|
234 |
+
"you select products by their prices. Thanks to YITH WooCommerce Ajax List "
|
235 |
+
"Price Filter, %1$syou can set unlimited price ranges:%2$s your users will be "
|
236 |
+
"able to filter products selecting on the ranges you have set."
|
|
|
237 |
msgstr ""
|
238 |
+
|
239 |
+
#: templates/admin/premium.php:253
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
msgid "Ajax Stock/On Sale Filters"
|
241 |
+
msgstr ""
|
242 |
|
243 |
+
#: templates/admin/premium.php:256
|
244 |
#, php-format
|
245 |
msgid ""
|
246 |
+
"A new widget for the premium version of the plugin. Whoever will surf the "
|
247 |
+
"pages of your shop will be able to display only the products on sale and/or "
|
248 |
+
"the available ones.%3$s %1$sAn additional feature for an e-commerce site "
|
249 |
+
"that is worthy!%2$s"
|
|
|
250 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
+
#: templates/admin/premium.php:266
|
253 |
msgid "Product sorting"
|
254 |
+
msgstr ""
|
255 |
|
256 |
+
#: templates/admin/premium.php:269
|
257 |
#, php-format
|
258 |
msgid ""
|
259 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your "
|
260 |
+
"users the freedom to sort products with the ajax technology, without the "
|
261 |
+
"need to reload the page. Products can be sorted by rate, sales, price or "
|
262 |
+
"publication date."
|
263 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
+
#: templates/admin/premium.php:285
|
266 |
msgid "Customized loader"
|
267 |
+
msgstr ""
|
268 |
|
269 |
+
#: templates/admin/premium.php:288
|
270 |
msgid ""
|
271 |
"From the plugin option panel, you can choose to upload a new icon for your "
|
272 |
"loader: in this way, it will better meet your needs."
|
273 |
msgstr ""
|
|
|
|
|
|
|
274 |
|
275 |
+
#: templates/admin/premium.php:298
|
276 |
msgid "WooCommerce Price Filter"
|
277 |
+
msgstr ""
|
278 |
|
279 |
+
#: templates/admin/premium.php:301
|
280 |
msgid ""
|
281 |
"With the premium version of the plugin, you will also be able to customize "
|
282 |
"WooCommerce Price Filter widget, changing the settings you can find in the "
|
283 |
"plugin option panel."
|
284 |
msgstr ""
|
|
|
|
|
|
|
285 |
|
286 |
#: widgets/class.yith-wcan-navigation-widget.php:23
|
287 |
msgid "Filter the product list without reloading the page"
|
374 |
msgid "Button Label"
|
375 |
msgstr "Etichetta Pulsante"
|
376 |
|
|
|
|
|
|
|
377 |
#~ msgid "Settings"
|
378 |
#~ msgstr "Impostazioni"
|
379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
#~ msgid "Ajax Loader"
|
381 |
#~ msgstr "Loader Ajax"
|
382 |
|
509 |
#~ msgid "Brand"
|
510 |
#~ msgstr "Brand"
|
511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
512 |
#~ msgid "Use custom style for reset button"
|
513 |
#~ msgstr "Utilizza uno stile personalizzato per il pulsante di reset"
|
514 |
|
562 |
#~ msgid "Show \"In Stock\" filter"
|
563 |
#~ msgstr "Mostra filtro \"Disponibili\""
|
564 |
|
565 |
+
#~ msgctxt "Admin: user tooltip"
|
566 |
+
#~ msgid ""
|
567 |
+
#~ "Activating the filter type \"Tag \" you can choose which tags show in"
|
568 |
+
#~ msgstr "Attivando il filtro \"Tag\", puoi scegliere quali tag mostrare in"
|
569 |
+
|
570 |
+
#~ msgctxt "Label link"
|
571 |
+
#~ msgid "YIT Plugins -> Ajax Product Filter -> Filter by Tag"
|
572 |
+
#~ msgstr "YIT Plugins -> Ajax Product Filter -> Filtra per tag"
|
573 |
+
|
574 |
+
#~ msgctxt "Label link"
|
575 |
+
#~ msgid "Please take note of the following Widgets ID"
|
576 |
+
#~ msgstr "Si prega di prender nota dei seguenti ID dei widget"
|
577 |
+
|
578 |
#~ msgid "YITH WooCommerce Ajax List Price Filter"
|
579 |
#~ msgstr "YITH WooCommerce Filtro Ajax List Price Filter"
|
580 |
|
581 |
+
#~ msgid "YITH WooCommerce Ajax Product Filter"
|
582 |
+
#~ msgstr "YITH WooCommerce Ajax Product Filter"
|
583 |
+
|
584 |
#~ msgid "Frontend"
|
585 |
#~ msgstr "Front end"
|
586 |
|
modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-tr_TR.mo
CHANGED
Binary file
|
modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav-tr_TR.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2015-
|
6 |
-
"PO-Revision-Date: 2015-
|
7 |
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
|
8 |
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
|
9 |
"Language: tr\n"
|
@@ -20,29 +20,37 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
22 |
|
23 |
-
#: includes/class.yith-wcan-admin.php:
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
msgid "Premium Version"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: includes/class.yith-wcan-admin.php:
|
29 |
-
#: includes/class.yith-wcan-admin.php:
|
30 |
msgid "Ajax Product Filter"
|
31 |
msgstr ""
|
32 |
|
33 |
-
#: includes/class.yith-wcan-admin.php:
|
34 |
msgid "Premium live demo"
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: includes/class.yith-wcan-admin.php:
|
38 |
msgid "Live demo"
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: includes/class.yith-wcan-admin.php:
|
42 |
msgid "Plugin Documentation"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: includes/class.yith-wcan-admin.php:
|
46 |
msgid ""
|
47 |
"Dear users,\n"
|
48 |
" we would like to inform you that the YITH "
|
@@ -58,17 +66,17 @@ msgid ""
|
|
58 |
"translate the .po file following the classic procedure for translations."
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: includes/class.yith-wcan-admin.php:
|
62 |
msgctxt "Admin(Pointers): Plugin Title"
|
63 |
msgid "YITH WooCommerce Ajax Product Filter"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: includes/class.yith-wcan-admin.php:
|
67 |
msgid ""
|
68 |
"YITH WooCommerce Product Filter has been updated with new available options"
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: includes/class.yith-wcan-admin.php:
|
72 |
msgid "discover the PREMIUM version"
|
73 |
msgstr ""
|
74 |
|
@@ -318,7 +326,7 @@ msgstr ""
|
|
318 |
msgid "Upload multiple files"
|
319 |
msgstr ""
|
320 |
|
321 |
-
#: plugin-fw/lib/yit-plugin-panel-wc.php:
|
322 |
msgid "The changes you have made will be lost if you leave this page."
|
323 |
msgstr ""
|
324 |
|
@@ -350,7 +358,7 @@ msgstr ""
|
|
350 |
|
351 |
#: plugin-fw/lib/yit-plugin-panel.php:298
|
352 |
#: plugin-fw/lib/yit-plugin-subpanel.php:148
|
353 |
-
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:
|
354 |
msgid "Are you sure?"
|
355 |
msgstr ""
|
356 |
|
@@ -458,26 +466,26 @@ msgstr ""
|
|
458 |
msgid "Update now."
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
462 |
msgid "Yithemes Repository"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
466 |
msgid "Invalid URL Provided."
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
470 |
msgid "Could not create Temporary file."
|
471 |
msgstr ""
|
472 |
|
473 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
474 |
#, php-format
|
475 |
msgid ""
|
476 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
477 |
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a>."
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
481 |
#, php-format
|
482 |
msgid ""
|
483 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
@@ -486,7 +494,7 @@ msgid ""
|
|
486 |
"automatic updates.</em>"
|
487 |
msgstr ""
|
488 |
|
489 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
490 |
#, php-format
|
491 |
msgid ""
|
492 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
@@ -495,7 +503,7 @@ msgid ""
|
|
495 |
"title=\"Licence activation\">activate</a> your copy of %6s.</em>"
|
496 |
msgstr ""
|
497 |
|
498 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
499 |
#, php-format
|
500 |
msgid ""
|
501 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
@@ -503,16 +511,16 @@ msgid ""
|
|
503 |
"href=\"%5$s\">update now</a>."
|
504 |
msgstr ""
|
505 |
|
506 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
507 |
msgid "You can't update the plugins for this site."
|
508 |
msgstr ""
|
509 |
|
510 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
511 |
msgid ""
|
512 |
"You do not have sufficient permissions to update the plugins for this site."
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
516 |
msgid "Update Plugin"
|
517 |
msgstr ""
|
518 |
|
@@ -1042,104 +1050,148 @@ msgstr "İtalik"
|
|
1042 |
msgid "Italic bold"
|
1043 |
msgstr "İtalik kalın"
|
1044 |
|
1045 |
-
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:
|
1046 |
msgid "Reset Defaults"
|
1047 |
msgstr ""
|
1048 |
|
1049 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1050 |
#, php-format
|
1051 |
msgid ""
|
1052 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax Product "
|
1053 |
"Filter%2$s to benefit from all features!"
|
1054 |
msgstr ""
|
1055 |
|
1056 |
-
#: templates/admin/premium.php:
|
1057 |
msgid "UPGRADE"
|
1058 |
msgstr ""
|
1059 |
|
1060 |
-
#: templates/admin/premium.php:
|
1061 |
msgid "to the premium version"
|
1062 |
msgstr ""
|
1063 |
|
1064 |
-
#: templates/admin/premium.php:
|
1065 |
msgid "Premium Features"
|
1066 |
msgstr ""
|
1067 |
|
1068 |
-
#: templates/admin/premium.php:
|
1069 |
msgid "Two more layouts"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
-
#: templates/admin/premium.php:
|
1073 |
#, php-format
|
1074 |
msgid ""
|
1075 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
1076 |
-
"layouts to filter the products of your shop
|
1077 |
-
"
|
1078 |
-
"
|
1079 |
-
"
|
1080 |
-
"
|
1081 |
-
"
|
1082 |
-
"
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
#: templates/admin/premium.php:241
|
1088 |
msgid "Price range"
|
1089 |
msgstr ""
|
1090 |
|
1091 |
-
#: templates/admin/premium.php:
|
1092 |
#, php-format
|
1093 |
msgid ""
|
1094 |
"One of the most requested filter for e-commerce sites is the one that let "
|
1095 |
-
"you select products by their prices
|
1096 |
-
"
|
1097 |
-
"
|
1098 |
-
"filter products selecting on the ranges you have set."
|
1099 |
msgstr ""
|
1100 |
|
1101 |
-
#: templates/admin/premium.php:
|
1102 |
msgid "Ajax Stock/On Sale Filters"
|
1103 |
msgstr ""
|
1104 |
|
1105 |
-
#: templates/admin/premium.php:
|
1106 |
#, php-format
|
1107 |
msgid ""
|
1108 |
-
"A new widget for the premium version of the plugin
|
1109 |
-
"
|
1110 |
-
"
|
1111 |
-
"
|
1112 |
-
"worthy!%2$s"
|
1113 |
msgstr ""
|
1114 |
|
1115 |
-
#: templates/admin/premium.php:
|
1116 |
msgid "Product sorting"
|
1117 |
msgstr ""
|
1118 |
|
1119 |
-
#: templates/admin/premium.php:
|
1120 |
#, php-format
|
1121 |
msgid ""
|
1122 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your "
|
1123 |
-
"users the freedom to sort products with the ajax technology
|
1124 |
-
"
|
1125 |
-
"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
-
#: templates/admin/premium.php:
|
1129 |
msgid "Customized loader"
|
1130 |
msgstr ""
|
1131 |
|
1132 |
-
#: templates/admin/premium.php:
|
1133 |
msgid ""
|
1134 |
"From the plugin option panel, you can choose to upload a new icon for your "
|
1135 |
"loader: in this way, it will better meet your needs."
|
1136 |
msgstr ""
|
1137 |
|
1138 |
-
#: templates/admin/premium.php:
|
1139 |
msgid "WooCommerce Price Filter"
|
1140 |
msgstr ""
|
1141 |
|
1142 |
-
#: templates/admin/premium.php:
|
1143 |
msgid ""
|
1144 |
"With the premium version of the plugin, you will also be able to customize "
|
1145 |
"WooCommerce Price Filter widget, changing the settings you can find in the "
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: YITH WooCommerce Ajax Product filter\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2015-09-17 14:37+0100\n"
|
6 |
+
"PO-Revision-Date: 2015-09-17 14:37+0100\n"
|
7 |
"Last-Translator: Caner Öncel <caneroncel@gmail.com>\n"
|
8 |
"Language-Team: Caner Öncel <caneroncel@gmail.com>\n"
|
9 |
"Language: tr\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
22 |
|
23 |
+
#: includes/class.yith-wcan-admin.php:142
|
24 |
+
msgid "Front end"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: includes/class.yith-wcan-admin.php:143 settings/custom-style-options.php:12
|
28 |
+
msgid "Custom Style"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: includes/class.yith-wcan-admin.php:144
|
32 |
+
#: includes/class.yith-wcan-admin.php:216
|
33 |
msgid "Premium Version"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: includes/class.yith-wcan-admin.php:150
|
37 |
+
#: includes/class.yith-wcan-admin.php:151
|
38 |
msgid "Ajax Product Filter"
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: includes/class.yith-wcan-admin.php:212
|
42 |
msgid "Premium live demo"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: includes/class.yith-wcan-admin.php:212
|
46 |
msgid "Live demo"
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: includes/class.yith-wcan-admin.php:240
|
50 |
msgid "Plugin Documentation"
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: includes/class.yith-wcan-admin.php:269
|
54 |
msgid ""
|
55 |
"Dear users,\n"
|
56 |
" we would like to inform you that the YITH "
|
66 |
"translate the .po file following the classic procedure for translations."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/class.yith-wcan-admin.php:274
|
70 |
msgctxt "Admin(Pointers): Plugin Title"
|
71 |
msgid "YITH WooCommerce Ajax Product Filter"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: includes/class.yith-wcan-admin.php:276
|
75 |
msgid ""
|
76 |
"YITH WooCommerce Product Filter has been updated with new available options"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: includes/class.yith-wcan-admin.php:276
|
80 |
msgid "discover the PREMIUM version"
|
81 |
msgstr ""
|
82 |
|
326 |
msgid "Upload multiple files"
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: plugin-fw/lib/yit-plugin-panel-wc.php:323
|
330 |
msgid "The changes you have made will be lost if you leave this page."
|
331 |
msgstr ""
|
332 |
|
358 |
|
359 |
#: plugin-fw/lib/yit-plugin-panel.php:298
|
360 |
#: plugin-fw/lib/yit-plugin-subpanel.php:148
|
361 |
+
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:11
|
362 |
msgid "Are you sure?"
|
363 |
msgstr ""
|
364 |
|
466 |
msgid "Update now."
|
467 |
msgstr ""
|
468 |
|
469 |
+
#: plugin-fw/lib/yit-upgrade.php:231
|
470 |
msgid "Yithemes Repository"
|
471 |
msgstr ""
|
472 |
|
473 |
+
#: plugin-fw/lib/yit-upgrade.php:265
|
474 |
msgid "Invalid URL Provided."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: plugin-fw/lib/yit-upgrade.php:278
|
478 |
msgid "Could not create Temporary file."
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: plugin-fw/lib/yit-upgrade.php:420
|
482 |
#, php-format
|
483 |
msgid ""
|
484 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
485 |
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a>."
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: plugin-fw/lib/yit-upgrade.php:422
|
489 |
#, php-format
|
490 |
msgid ""
|
491 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
494 |
"automatic updates.</em>"
|
495 |
msgstr ""
|
496 |
|
497 |
+
#: plugin-fw/lib/yit-upgrade.php:424
|
498 |
#, php-format
|
499 |
msgid ""
|
500 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
503 |
"title=\"Licence activation\">activate</a> your copy of %6s.</em>"
|
504 |
msgstr ""
|
505 |
|
506 |
+
#: plugin-fw/lib/yit-upgrade.php:426
|
507 |
#, php-format
|
508 |
msgid ""
|
509 |
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
511 |
"href=\"%5$s\">update now</a>."
|
512 |
msgstr ""
|
513 |
|
514 |
+
#: plugin-fw/lib/yit-upgrade.php:499
|
515 |
msgid "You can't update the plugins for this site."
|
516 |
msgstr ""
|
517 |
|
518 |
+
#: plugin-fw/lib/yit-upgrade.php:503
|
519 |
msgid ""
|
520 |
"You do not have sufficient permissions to update the plugins for this site."
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: plugin-fw/lib/yit-upgrade.php:510
|
524 |
msgid "Update Plugin"
|
525 |
msgstr ""
|
526 |
|
1050 |
msgid "Italic bold"
|
1051 |
msgstr "İtalik kalın"
|
1052 |
|
1053 |
+
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:11
|
1054 |
msgid "Reset Defaults"
|
1055 |
msgstr ""
|
1056 |
|
1057 |
+
#: settings/custom-style-options.php:24
|
1058 |
+
msgid "Put here your custom CSS rules:"
|
1059 |
+
msgstr ""
|
1060 |
+
|
1061 |
+
#: settings/frontend-options.php:12
|
1062 |
+
msgid "General Settings"
|
1063 |
+
msgstr ""
|
1064 |
+
|
1065 |
+
#: settings/frontend-options.php:25
|
1066 |
+
msgctxt "Admin panel: option description"
|
1067 |
+
msgid "How To:"
|
1068 |
+
msgstr ""
|
1069 |
+
|
1070 |
+
#: settings/frontend-options.php:27
|
1071 |
+
msgctxt "Admin: Panel section description"
|
1072 |
+
msgid ""
|
1073 |
+
"If your theme use the WooCommerce standard templates, you don't need to "
|
1074 |
+
"change the following values.\n"
|
1075 |
+
" Otherwise, add the classes used in the "
|
1076 |
+
"template of your theme.\n"
|
1077 |
+
" If you don't know them, please contact the "
|
1078 |
+
"developer of your theme to receive the correct classes."
|
1079 |
+
msgstr ""
|
1080 |
+
|
1081 |
+
#: settings/frontend-options.php:33
|
1082 |
+
msgid "Product Container"
|
1083 |
+
msgstr ""
|
1084 |
+
|
1085 |
+
#: settings/frontend-options.php:34
|
1086 |
+
msgid "Put here the CSS class or id for the product container"
|
1087 |
+
msgstr ""
|
1088 |
+
|
1089 |
+
#: settings/frontend-options.php:41
|
1090 |
+
msgid "Shop Pagination Container"
|
1091 |
+
msgstr ""
|
1092 |
+
|
1093 |
+
#: settings/frontend-options.php:42
|
1094 |
+
msgid "Put here the CSS class or id for the shop pagination container"
|
1095 |
+
msgstr ""
|
1096 |
+
|
1097 |
+
#: settings/frontend-options.php:49
|
1098 |
+
msgid "Result Count Container"
|
1099 |
+
msgstr ""
|
1100 |
+
|
1101 |
+
#: settings/frontend-options.php:50
|
1102 |
+
msgid "Put here the CSS class or id for the result count container"
|
1103 |
+
msgstr ""
|
1104 |
+
|
1105 |
+
#: templates/admin/premium.php:203 templates/admin/premium.php:313
|
1106 |
#, php-format
|
1107 |
msgid ""
|
1108 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax Product "
|
1109 |
"Filter%2$s to benefit from all features!"
|
1110 |
msgstr ""
|
1111 |
|
1112 |
+
#: templates/admin/premium.php:206 templates/admin/premium.php:316
|
1113 |
msgid "UPGRADE"
|
1114 |
msgstr ""
|
1115 |
|
1116 |
+
#: templates/admin/premium.php:207 templates/admin/premium.php:317
|
1117 |
msgid "to the premium version"
|
1118 |
msgstr ""
|
1119 |
|
1120 |
+
#: templates/admin/premium.php:213
|
1121 |
msgid "Premium Features"
|
1122 |
msgstr ""
|
1123 |
|
1124 |
+
#: templates/admin/premium.php:221
|
1125 |
msgid "Two more layouts"
|
1126 |
msgstr ""
|
1127 |
|
1128 |
+
#: templates/admin/premium.php:224
|
1129 |
#, php-format
|
1130 |
msgid ""
|
1131 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
1132 |
+
"layouts to filter the products of your shop.%1$sBicolor%2$s: the perfect "
|
1133 |
+
"choice for those attributes related to two different colors at the same time "
|
1134 |
+
"(white/black), for a simple visual impact for the final user. Pick the "
|
1135 |
+
"%1$sTag%2$s typology, on the contrary, if you want to filter your products "
|
1136 |
+
"by product tag. And if you are using also the %1$sYITH WooCommerce Brand Add-"
|
1137 |
+
"On%2$s plugin, you will be able to offer the freedom to filter your shop "
|
1138 |
+
"products by brands thanks to the ajax technology."
|
1139 |
+
msgstr ""
|
1140 |
+
|
1141 |
+
#: templates/admin/premium.php:234
|
|
|
|
|
1142 |
msgid "Price range"
|
1143 |
msgstr ""
|
1144 |
|
1145 |
+
#: templates/admin/premium.php:237
|
1146 |
#, php-format
|
1147 |
msgid ""
|
1148 |
"One of the most requested filter for e-commerce sites is the one that let "
|
1149 |
+
"you select products by their prices. Thanks to YITH WooCommerce Ajax List "
|
1150 |
+
"Price Filter, %1$syou can set unlimited price ranges:%2$s your users will be "
|
1151 |
+
"able to filter products selecting on the ranges you have set."
|
|
|
1152 |
msgstr ""
|
1153 |
|
1154 |
+
#: templates/admin/premium.php:253
|
1155 |
msgid "Ajax Stock/On Sale Filters"
|
1156 |
msgstr ""
|
1157 |
|
1158 |
+
#: templates/admin/premium.php:256
|
1159 |
#, php-format
|
1160 |
msgid ""
|
1161 |
+
"A new widget for the premium version of the plugin. Whoever will surf the "
|
1162 |
+
"pages of your shop will be able to display only the products on sale and/or "
|
1163 |
+
"the available ones.%3$s %1$sAn additional feature for an e-commerce site "
|
1164 |
+
"that is worthy!%2$s"
|
|
|
1165 |
msgstr ""
|
1166 |
|
1167 |
+
#: templates/admin/premium.php:266
|
1168 |
msgid "Product sorting"
|
1169 |
msgstr ""
|
1170 |
|
1171 |
+
#: templates/admin/premium.php:269
|
1172 |
#, php-format
|
1173 |
msgid ""
|
1174 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your "
|
1175 |
+
"users the freedom to sort products with the ajax technology, without the "
|
1176 |
+
"need to reload the page. Products can be sorted by rate, sales, price or "
|
1177 |
+
"publication date."
|
1178 |
msgstr ""
|
1179 |
|
1180 |
+
#: templates/admin/premium.php:285
|
1181 |
msgid "Customized loader"
|
1182 |
msgstr ""
|
1183 |
|
1184 |
+
#: templates/admin/premium.php:288
|
1185 |
msgid ""
|
1186 |
"From the plugin option panel, you can choose to upload a new icon for your "
|
1187 |
"loader: in this way, it will better meet your needs."
|
1188 |
msgstr ""
|
1189 |
|
1190 |
+
#: templates/admin/premium.php:298
|
1191 |
msgid "WooCommerce Price Filter"
|
1192 |
msgstr ""
|
1193 |
|
1194 |
+
#: templates/admin/premium.php:301
|
1195 |
msgid ""
|
1196 |
"With the premium version of the plugin, you will also be able to customize "
|
1197 |
"WooCommerce Price Filter widget, changing the settings you can find in the "
|
modules/yith-woocommerce-ajax-navigation/languages/yith_wc_ajxnav.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
-
"POT-Creation-Date: 2015-
|
7 |
"PO-Revision-Date: 2015-06-19 13:59+0100\n"
|
8 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
9 |
"Language-Team: \n"
|
@@ -21,29 +21,38 @@ msgstr ""
|
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
23 |
|
24 |
-
#: includes/class.yith-wcan-admin.php:
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
msgid "Premium Version"
|
27 |
msgstr ""
|
28 |
|
29 |
-
#: includes/class.yith-wcan-admin.php:
|
30 |
-
#: includes/class.yith-wcan-admin.php:
|
31 |
msgid "Ajax Product Filter"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: includes/class.yith-wcan-admin.php:
|
35 |
msgid "Premium live demo"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: includes/class.yith-wcan-admin.php:
|
39 |
msgid "Live demo"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: includes/class.yith-wcan-admin.php:
|
43 |
msgid "Plugin Documentation"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: includes/class.yith-wcan-admin.php:
|
47 |
msgid ""
|
48 |
"Dear users,\n"
|
49 |
" we would like to inform you that the YITH "
|
@@ -60,18 +69,18 @@ msgid ""
|
|
60 |
"translations."
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: includes/class.yith-wcan-admin.php:
|
64 |
msgctxt "Admin(Pointers): Plugin Title"
|
65 |
msgid "YITH WooCommerce Ajax Product Filter"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: includes/class.yith-wcan-admin.php:
|
69 |
msgid ""
|
70 |
"YITH WooCommerce Product Filter has been updated with new available "
|
71 |
"options"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: includes/class.yith-wcan-admin.php:
|
75 |
msgid "discover the PREMIUM version"
|
76 |
msgstr ""
|
77 |
|
@@ -320,7 +329,7 @@ msgstr ""
|
|
320 |
msgid "Upload multiple files"
|
321 |
msgstr ""
|
322 |
|
323 |
-
#: plugin-fw/lib/yit-plugin-panel-wc.php:
|
324 |
msgid "The changes you have made will be lost if you leave this page."
|
325 |
msgstr ""
|
326 |
|
@@ -353,7 +362,7 @@ msgstr ""
|
|
353 |
|
354 |
#: plugin-fw/lib/yit-plugin-panel.php:298
|
355 |
#: plugin-fw/lib/yit-plugin-subpanel.php:148
|
356 |
-
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:
|
357 |
msgid "Are you sure?"
|
358 |
msgstr ""
|
359 |
|
@@ -465,19 +474,19 @@ msgstr ""
|
|
465 |
msgid "Update now."
|
466 |
msgstr ""
|
467 |
|
468 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
469 |
msgid "Yithemes Repository"
|
470 |
msgstr ""
|
471 |
|
472 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
473 |
msgid "Invalid URL Provided."
|
474 |
msgstr ""
|
475 |
|
476 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
477 |
msgid "Could not create Temporary file."
|
478 |
msgstr ""
|
479 |
|
480 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
481 |
#, php-format
|
482 |
msgid ""
|
483 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
@@ -485,7 +494,7 @@ msgid ""
|
|
485 |
"details</a>."
|
486 |
msgstr ""
|
487 |
|
488 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
489 |
#, php-format
|
490 |
msgid ""
|
491 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
@@ -494,7 +503,7 @@ msgid ""
|
|
494 |
"the network to benefit from automatic updates.</em>"
|
495 |
msgstr ""
|
496 |
|
497 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
498 |
#, php-format
|
499 |
msgid ""
|
500 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
@@ -504,7 +513,7 @@ msgid ""
|
|
504 |
"copy of %6s.</em>"
|
505 |
msgstr ""
|
506 |
|
507 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
508 |
#, php-format
|
509 |
msgid ""
|
510 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
@@ -512,17 +521,17 @@ msgid ""
|
|
512 |
"details</a> or <a href=\"%5$s\">update now</a>."
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
516 |
msgid "You can't update the plugins for this site."
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
520 |
msgid ""
|
521 |
"You do not have sufficient permissions to update the plugins for this "
|
522 |
"site."
|
523 |
msgstr ""
|
524 |
|
525 |
-
#: plugin-fw/lib/yit-upgrade.php:
|
526 |
msgid "Update Plugin"
|
527 |
msgstr ""
|
528 |
|
@@ -1046,107 +1055,150 @@ msgstr ""
|
|
1046 |
msgid "Italic bold"
|
1047 |
msgstr ""
|
1048 |
|
1049 |
-
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:
|
1050 |
msgid "Reset Defaults"
|
1051 |
msgstr ""
|
1052 |
|
1053 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1054 |
#, php-format
|
1055 |
msgid ""
|
1056 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax "
|
1057 |
"Product Filter%2$s to benefit from all features!"
|
1058 |
msgstr ""
|
1059 |
|
1060 |
-
#: templates/admin/premium.php:
|
1061 |
msgid "UPGRADE"
|
1062 |
msgstr ""
|
1063 |
|
1064 |
-
#: templates/admin/premium.php:
|
1065 |
msgid "to the premium version"
|
1066 |
msgstr ""
|
1067 |
|
1068 |
-
#: templates/admin/premium.php:
|
1069 |
msgid "Premium Features"
|
1070 |
msgstr ""
|
1071 |
|
1072 |
-
#: templates/admin/premium.php:
|
1073 |
msgid "Two more layouts"
|
1074 |
msgstr ""
|
1075 |
|
1076 |
-
#: templates/admin/premium.php:
|
1077 |
#, php-format
|
1078 |
msgid ""
|
1079 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
1080 |
-
"layouts to filter the products of your shop
|
1081 |
-
"
|
1082 |
-
"
|
1083 |
-
"
|
1084 |
-
"
|
1085 |
-
"
|
1086 |
-
"
|
1087 |
-
"
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
#: templates/admin/premium.php:241
|
1093 |
msgid "Price range"
|
1094 |
msgstr ""
|
1095 |
|
1096 |
-
#: templates/admin/premium.php:
|
1097 |
#, php-format
|
1098 |
msgid ""
|
1099 |
"One of the most requested filter for e-commerce sites is the one that "
|
1100 |
-
"let you select products by their prices
|
1101 |
-
"
|
1102 |
-
"
|
1103 |
-
"
|
1104 |
msgstr ""
|
1105 |
|
1106 |
-
#: templates/admin/premium.php:
|
1107 |
msgid "Ajax Stock/On Sale Filters"
|
1108 |
msgstr ""
|
1109 |
|
1110 |
-
#: templates/admin/premium.php:
|
1111 |
#, php-format
|
1112 |
msgid ""
|
1113 |
-
"A new widget for the premium version of the plugin
|
1114 |
-
"
|
1115 |
-
"
|
1116 |
-
"
|
1117 |
-
" %1$sAn additional feature for an e-commerce site "
|
1118 |
-
"that is worthy!%2$s"
|
1119 |
msgstr ""
|
1120 |
|
1121 |
-
#: templates/admin/premium.php:
|
1122 |
msgid "Product sorting"
|
1123 |
msgstr ""
|
1124 |
|
1125 |
-
#: templates/admin/premium.php:
|
1126 |
#, php-format
|
1127 |
msgid ""
|
1128 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can "
|
1129 |
-
"give your users the freedom to sort products with the ajax "
|
1130 |
-
"
|
1131 |
-
"
|
1132 |
-
"be sorted by rate, sales, price or publication date."
|
1133 |
msgstr ""
|
1134 |
|
1135 |
-
#: templates/admin/premium.php:
|
1136 |
msgid "Customized loader"
|
1137 |
msgstr ""
|
1138 |
|
1139 |
-
#: templates/admin/premium.php:
|
1140 |
msgid ""
|
1141 |
"From the plugin option panel, you can choose to upload a new icon for "
|
1142 |
"your loader: in this way, it will better meet your needs."
|
1143 |
msgstr ""
|
1144 |
|
1145 |
-
#: templates/admin/premium.php:
|
1146 |
msgid "WooCommerce Price Filter"
|
1147 |
msgstr ""
|
1148 |
|
1149 |
-
#: templates/admin/premium.php:
|
1150 |
msgid ""
|
1151 |
"With the premium version of the plugin, you will also be able to "
|
1152 |
"customize WooCommerce Price Filter widget, changing the settings you "
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: YITH WooCommerce Ajax Product Filter\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2015-09-17 14:37+0100\n"
|
7 |
"PO-Revision-Date: 2015-06-19 13:59+0100\n"
|
8 |
"Last-Translator: Your Inspiration Themes <plugins@yithemes.com>\n"
|
9 |
"Language-Team: \n"
|
21 |
"X-Poedit-SearchPath-0: .\n"
|
22 |
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
23 |
|
24 |
+
#: includes/class.yith-wcan-admin.php:142
|
25 |
+
msgid "Front end"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: includes/class.yith-wcan-admin.php:143
|
29 |
+
#: settings/custom-style-options.php:12
|
30 |
+
msgid "Custom Style"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: includes/class.yith-wcan-admin.php:144
|
34 |
+
#: includes/class.yith-wcan-admin.php:216
|
35 |
msgid "Premium Version"
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: includes/class.yith-wcan-admin.php:150
|
39 |
+
#: includes/class.yith-wcan-admin.php:151
|
40 |
msgid "Ajax Product Filter"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: includes/class.yith-wcan-admin.php:212
|
44 |
msgid "Premium live demo"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: includes/class.yith-wcan-admin.php:212
|
48 |
msgid "Live demo"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: includes/class.yith-wcan-admin.php:240
|
52 |
msgid "Plugin Documentation"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: includes/class.yith-wcan-admin.php:269
|
56 |
msgid ""
|
57 |
"Dear users,\n"
|
58 |
" we would like to inform you that the YITH "
|
69 |
"translations."
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: includes/class.yith-wcan-admin.php:274
|
73 |
msgctxt "Admin(Pointers): Plugin Title"
|
74 |
msgid "YITH WooCommerce Ajax Product Filter"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: includes/class.yith-wcan-admin.php:276
|
78 |
msgid ""
|
79 |
"YITH WooCommerce Product Filter has been updated with new available "
|
80 |
"options"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: includes/class.yith-wcan-admin.php:276
|
84 |
msgid "discover the PREMIUM version"
|
85 |
msgstr ""
|
86 |
|
329 |
msgid "Upload multiple files"
|
330 |
msgstr ""
|
331 |
|
332 |
+
#: plugin-fw/lib/yit-plugin-panel-wc.php:323
|
333 |
msgid "The changes you have made will be lost if you leave this page."
|
334 |
msgstr ""
|
335 |
|
362 |
|
363 |
#: plugin-fw/lib/yit-plugin-panel.php:298
|
364 |
#: plugin-fw/lib/yit-plugin-subpanel.php:148
|
365 |
+
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:11
|
366 |
msgid "Are you sure?"
|
367 |
msgstr ""
|
368 |
|
474 |
msgid "Update now."
|
475 |
msgstr ""
|
476 |
|
477 |
+
#: plugin-fw/lib/yit-upgrade.php:231
|
478 |
msgid "Yithemes Repository"
|
479 |
msgstr ""
|
480 |
|
481 |
+
#: plugin-fw/lib/yit-upgrade.php:265
|
482 |
msgid "Invalid URL Provided."
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: plugin-fw/lib/yit-upgrade.php:278
|
486 |
msgid "Could not create Temporary file."
|
487 |
msgstr ""
|
488 |
|
489 |
+
#: plugin-fw/lib/yit-upgrade.php:420
|
490 |
#, php-format
|
491 |
msgid ""
|
492 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
494 |
"details</a>."
|
495 |
msgstr ""
|
496 |
|
497 |
+
#: plugin-fw/lib/yit-upgrade.php:422
|
498 |
#, php-format
|
499 |
msgid ""
|
500 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
503 |
"the network to benefit from automatic updates.</em>"
|
504 |
msgstr ""
|
505 |
|
506 |
+
#: plugin-fw/lib/yit-upgrade.php:424
|
507 |
#, php-format
|
508 |
msgid ""
|
509 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
513 |
"copy of %6s.</em>"
|
514 |
msgstr ""
|
515 |
|
516 |
+
#: plugin-fw/lib/yit-upgrade.php:426
|
517 |
#, php-format
|
518 |
msgid ""
|
519 |
"There is a new version of %1$s available. <a href=\"%2$s\" class="
|
521 |
"details</a> or <a href=\"%5$s\">update now</a>."
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: plugin-fw/lib/yit-upgrade.php:499
|
525 |
msgid "You can't update the plugins for this site."
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: plugin-fw/lib/yit-upgrade.php:503
|
529 |
msgid ""
|
530 |
"You do not have sufficient permissions to update the plugins for this "
|
531 |
"site."
|
532 |
msgstr ""
|
533 |
|
534 |
+
#: plugin-fw/lib/yit-upgrade.php:510
|
535 |
msgid "Update Plugin"
|
536 |
msgstr ""
|
537 |
|
1055 |
msgid "Italic bold"
|
1056 |
msgstr ""
|
1057 |
|
1058 |
+
#: plugin-fw/templates/panel/woocommerce/woocommerce-form.php:11
|
1059 |
msgid "Reset Defaults"
|
1060 |
msgstr ""
|
1061 |
|
1062 |
+
#: settings/custom-style-options.php:24
|
1063 |
+
msgid "Put here your custom CSS rules:"
|
1064 |
+
msgstr ""
|
1065 |
+
|
1066 |
+
#: settings/frontend-options.php:12
|
1067 |
+
msgid "General Settings"
|
1068 |
+
msgstr ""
|
1069 |
+
|
1070 |
+
#: settings/frontend-options.php:25
|
1071 |
+
msgctxt "Admin panel: option description"
|
1072 |
+
msgid "How To:"
|
1073 |
+
msgstr ""
|
1074 |
+
|
1075 |
+
#: settings/frontend-options.php:27
|
1076 |
+
msgctxt "Admin: Panel section description"
|
1077 |
+
msgid ""
|
1078 |
+
"If your theme use the WooCommerce standard templates, you don't need "
|
1079 |
+
"to change the following values.\n"
|
1080 |
+
" Otherwise, add the classes used in the "
|
1081 |
+
"template of your theme.\n"
|
1082 |
+
" If you don't know them, please contact "
|
1083 |
+
"the developer of your theme to receive the correct classes."
|
1084 |
+
msgstr ""
|
1085 |
+
|
1086 |
+
#: settings/frontend-options.php:33
|
1087 |
+
msgid "Product Container"
|
1088 |
+
msgstr ""
|
1089 |
+
|
1090 |
+
#: settings/frontend-options.php:34
|
1091 |
+
msgid "Put here the CSS class or id for the product container"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
+
#: settings/frontend-options.php:41
|
1095 |
+
msgid "Shop Pagination Container"
|
1096 |
+
msgstr ""
|
1097 |
+
|
1098 |
+
#: settings/frontend-options.php:42
|
1099 |
+
msgid "Put here the CSS class or id for the shop pagination container"
|
1100 |
+
msgstr ""
|
1101 |
+
|
1102 |
+
#: settings/frontend-options.php:49
|
1103 |
+
msgid "Result Count Container"
|
1104 |
+
msgstr ""
|
1105 |
+
|
1106 |
+
#: settings/frontend-options.php:50
|
1107 |
+
msgid "Put here the CSS class or id for the result count container"
|
1108 |
+
msgstr ""
|
1109 |
+
|
1110 |
+
#: templates/admin/premium.php:203 templates/admin/premium.php:313
|
1111 |
#, php-format
|
1112 |
msgid ""
|
1113 |
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Ajax "
|
1114 |
"Product Filter%2$s to benefit from all features!"
|
1115 |
msgstr ""
|
1116 |
|
1117 |
+
#: templates/admin/premium.php:206 templates/admin/premium.php:316
|
1118 |
msgid "UPGRADE"
|
1119 |
msgstr ""
|
1120 |
|
1121 |
+
#: templates/admin/premium.php:207 templates/admin/premium.php:317
|
1122 |
msgid "to the premium version"
|
1123 |
msgstr ""
|
1124 |
|
1125 |
+
#: templates/admin/premium.php:213
|
1126 |
msgid "Premium Features"
|
1127 |
msgstr ""
|
1128 |
|
1129 |
+
#: templates/admin/premium.php:221
|
1130 |
msgid "Two more layouts"
|
1131 |
msgstr ""
|
1132 |
|
1133 |
+
#: templates/admin/premium.php:224
|
1134 |
#, php-format
|
1135 |
msgid ""
|
1136 |
"The YITH WooCommerce Ajax product Filter widget get richer with 2 new "
|
1137 |
+
"layouts to filter the products of your shop.%1$sBicolor%2$s: the "
|
1138 |
+
"perfect choice for those attributes related to two different colors at "
|
1139 |
+
"the same time (white/black), for a simple visual impact for the final "
|
1140 |
+
"user. Pick the %1$sTag%2$s typology, on the contrary, if you want to "
|
1141 |
+
"filter your products by product tag. And if you are using also the "
|
1142 |
+
"%1$sYITH WooCommerce Brand Add-On%2$s plugin, you will be able to "
|
1143 |
+
"offer the freedom to filter your shop products by brands thanks to the "
|
1144 |
+
"ajax technology."
|
1145 |
+
msgstr ""
|
1146 |
+
|
1147 |
+
#: templates/admin/premium.php:234
|
|
|
|
|
1148 |
msgid "Price range"
|
1149 |
msgstr ""
|
1150 |
|
1151 |
+
#: templates/admin/premium.php:237
|
1152 |
#, php-format
|
1153 |
msgid ""
|
1154 |
"One of the most requested filter for e-commerce sites is the one that "
|
1155 |
+
"let you select products by their prices. Thanks to YITH WooCommerce "
|
1156 |
+
"Ajax List Price Filter, %1$syou can set unlimited price ranges:%2$s "
|
1157 |
+
"your users will be able to filter products selecting on the ranges you "
|
1158 |
+
"have set."
|
1159 |
msgstr ""
|
1160 |
|
1161 |
+
#: templates/admin/premium.php:253
|
1162 |
msgid "Ajax Stock/On Sale Filters"
|
1163 |
msgstr ""
|
1164 |
|
1165 |
+
#: templates/admin/premium.php:256
|
1166 |
#, php-format
|
1167 |
msgid ""
|
1168 |
+
"A new widget for the premium version of the plugin. Whoever will surf "
|
1169 |
+
"the pages of your shop will be able to display only the products on "
|
1170 |
+
"sale and/or the available ones.%3$s %1$sAn additional feature for an e-"
|
1171 |
+
"commerce site that is worthy!%2$s"
|
|
|
|
|
1172 |
msgstr ""
|
1173 |
|
1174 |
+
#: templates/admin/premium.php:266
|
1175 |
msgid "Product sorting"
|
1176 |
msgstr ""
|
1177 |
|
1178 |
+
#: templates/admin/premium.php:269
|
1179 |
#, php-format
|
1180 |
msgid ""
|
1181 |
"With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can "
|
1182 |
+
"give your users the freedom to sort products with the ajax technology, "
|
1183 |
+
"without the need to reload the page. Products can be sorted by rate, "
|
1184 |
+
"sales, price or publication date."
|
|
|
1185 |
msgstr ""
|
1186 |
|
1187 |
+
#: templates/admin/premium.php:285
|
1188 |
msgid "Customized loader"
|
1189 |
msgstr ""
|
1190 |
|
1191 |
+
#: templates/admin/premium.php:288
|
1192 |
msgid ""
|
1193 |
"From the plugin option panel, you can choose to upload a new icon for "
|
1194 |
"your loader: in this way, it will better meet your needs."
|
1195 |
msgstr ""
|
1196 |
|
1197 |
+
#: templates/admin/premium.php:298
|
1198 |
msgid "WooCommerce Price Filter"
|
1199 |
msgstr ""
|
1200 |
|
1201 |
+
#: templates/admin/premium.php:301
|
1202 |
msgid ""
|
1203 |
"With the premium version of the plugin, you will also be able to "
|
1204 |
"customize WooCommerce Price Filter widget, changing the settings you "
|
modules/yith-woocommerce-ajax-navigation/settings/custom-style-options.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$custom_style = array(
|
4 |
+
|
5 |
+
'custom-style' => array(
|
6 |
+
|
7 |
+
'header' => array(
|
8 |
+
|
9 |
+
array( 'type' => 'open' ),
|
10 |
+
|
11 |
+
array(
|
12 |
+
'name' => __( 'Custom Style', 'yith_wc_ajxnav' ),
|
13 |
+
'type' => 'title'
|
14 |
+
),
|
15 |
+
|
16 |
+
array( 'type' => 'close' )
|
17 |
+
),
|
18 |
+
|
19 |
+
'settings' => array(
|
20 |
+
|
21 |
+
array( 'type' => 'open' ),
|
22 |
+
|
23 |
+
array(
|
24 |
+
'name' => __( 'Put here your custom CSS rules:', 'yith_wc_ajxnav' ),
|
25 |
+
'desc' => '',
|
26 |
+
'id' => 'yith_wcan_custom_style',
|
27 |
+
'type' => 'textarea',
|
28 |
+
'std' => '',
|
29 |
+
'custom_attributes' => array(
|
30 |
+
'rows' => 15,
|
31 |
+
'cols' => 75
|
32 |
+
)
|
33 |
+
),
|
34 |
+
|
35 |
+
array( 'type' => 'close' ),
|
36 |
+
),
|
37 |
+
)
|
38 |
+
);
|
39 |
+
|
40 |
+
return apply_filters( 'yith_wcan_panel_custom_style_options', $custom_style );
|
modules/yith-woocommerce-ajax-navigation/settings/frontend-options.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$frontend = array(
|
4 |
+
|
5 |
+
'frontend' => array(
|
6 |
+
|
7 |
+
'header' => array(
|
8 |
+
|
9 |
+
array( 'type' => 'open' ),
|
10 |
+
|
11 |
+
array(
|
12 |
+
'name' => __( 'General Settings', 'yith_wc_ajxnav' ),
|
13 |
+
'type' => 'title'
|
14 |
+
),
|
15 |
+
|
16 |
+
array( 'type' => 'close' )
|
17 |
+
),
|
18 |
+
|
19 |
+
'settings' => array(
|
20 |
+
|
21 |
+
array( 'type' => 'open' ),
|
22 |
+
|
23 |
+
array(
|
24 |
+
'id' => 'yith_wcan_frontend_description',
|
25 |
+
'name' => _x( 'How To:', 'Admin panel: option description', 'yith_wc_ajxnav' ),
|
26 |
+
'type' => 'wcan_description',
|
27 |
+
'desc' => _x( "If your theme use the WooCommerce standard templates, you don't need to change the following values.
|
28 |
+
Otherwise, add the classes used in the template of your theme.
|
29 |
+
If you don't know them, please contact the developer of your theme to receive the correct classes.", 'Admin: Panel section description', 'yith_wc_ajxnav' ),
|
30 |
+
),
|
31 |
+
|
32 |
+
array(
|
33 |
+
'name' => __( 'Product Container', 'yith_wc_ajxnav' ),
|
34 |
+
'desc' => __( 'Put here the CSS class or id for the product container', 'yith_wc_ajxnav' ) . ' (Default: <strong>.products</strong>)',
|
35 |
+
'id' => 'yith_wcan_ajax_shop_container',
|
36 |
+
'type' => 'text',
|
37 |
+
'std' => '.products'
|
38 |
+
),
|
39 |
+
|
40 |
+
array(
|
41 |
+
'name' => __( 'Shop Pagination Container', 'yith_wc_ajxnav' ),
|
42 |
+
'desc' => __( 'Put here the CSS class or id for the shop pagination container', 'yith_wc_ajxnav' ) . ' (Default: <strong>nav.woocommerce-pagination</strong>)',
|
43 |
+
'id' => 'yith_wcan_ajax_shop_pagination',
|
44 |
+
'type' => 'text',
|
45 |
+
'std' => 'nav.woocommerce-pagination'
|
46 |
+
),
|
47 |
+
|
48 |
+
array(
|
49 |
+
'name' => __( 'Result Count Container', 'yith_wc_ajxnav' ),
|
50 |
+
'desc' => __( 'Put here the CSS class or id for the result count container', 'yith_wc_ajxnav' ) . ' (Default: <strong>.woocommerce-result-count</strong>)',
|
51 |
+
'id' => 'yith_wcan_ajax_shop_result_container',
|
52 |
+
'type' => 'text',
|
53 |
+
'std' => '.woocommerce-result-count'
|
54 |
+
),
|
55 |
+
|
56 |
+
array( 'type' => 'close' ),
|
57 |
+
),
|
58 |
+
)
|
59 |
+
);
|
60 |
+
|
61 |
+
return apply_filters( 'yith_wcan_panel_frontend_options', $frontend );
|
modules/yith-woocommerce-ajax-navigation/templates/admin/premium.php
CHANGED
@@ -1,7 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
<style>
|
6 |
.section{
|
7 |
margin-left: -20px;
|
@@ -225,10 +221,7 @@
|
|
225 |
<h2><?php _e('Two more layouts','yith_wc_ajxnav');?></h2>
|
226 |
</div>
|
227 |
<p>
|
228 |
-
<?php echo sprintf(__('The YITH WooCommerce Ajax product Filter widget get richer with 2 new layouts to filter the products of your shop.
|
229 |
-
%1$sBicolor%2$s: the perfect choice for those attributes related to two different colors at the same time (white/black), for a simple visual impact for the final user. Pick the %1$sTag%2$s typology, on the contrary, if you want to filter your products by product tag.
|
230 |
-
And if you are using also the %1$sYITH WooCommerce Brand Add-On%2$s plugin, you will be able to offer the freedom to filter your shop products by brands thanks to the ajax technology.
|
231 |
-
', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
232 |
</p>
|
233 |
</div>
|
234 |
</div>
|
@@ -241,8 +234,7 @@
|
|
241 |
<h2><?php _e('Price range','yith_wc_ajxnav');?></h2>
|
242 |
</div>
|
243 |
<p>
|
244 |
-
<?php echo sprintf(__('One of the most requested filter for e-commerce sites is the one that let you select products by their prices.
|
245 |
-
Thanks to YITH WooCommerce Ajax List Price Filter, %1$syou can set unlimited price ranges:%2$s your users will be able to filter products selecting on the ranges you have set.', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
246 |
</p>
|
247 |
</div>
|
248 |
<div class="col-1">
|
@@ -261,9 +253,7 @@
|
|
261 |
<h2><?php _e( 'Ajax Stock/On Sale Filters','yith_wc_ajxnav');?></h2>
|
262 |
</div>
|
263 |
<p>
|
264 |
-
<?php echo sprintf(__('A new widget for the premium version of the plugin.
|
265 |
-
Whoever will surf the pages of your shop will be able to display only the products on sale and/or the available ones.%3$s
|
266 |
-
%1$sAn additional feature for an e-commerce site that is worthy!%2$s', 'yith_wc_ajxnav'), '<b>', '</b>','<br>');?>
|
267 |
</p>
|
268 |
</div>
|
269 |
</div>
|
@@ -276,8 +266,7 @@
|
|
276 |
<h2><?php _e('Product sorting','yith_wc_ajxnav');?></h2>
|
277 |
</div>
|
278 |
<p>
|
279 |
-
<?php echo sprintf(__('With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your users the freedom to sort products with the ajax technology,
|
280 |
-
without the need to reload the page. Products can be sorted by rate, sales, price or publication date.', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
281 |
</p>
|
282 |
</div>
|
283 |
<div class="col-1">
|
@@ -296,7 +285,7 @@
|
|
296 |
<h2><?php _e('Customized loader','yith_wc_ajxnav');?></h2>
|
297 |
</div>
|
298 |
<p>
|
299 |
-
<?php _e('From the plugin option panel, you can choose to upload a new icon for your loader: in this way, it will better meet your needs.','') ?>
|
300 |
</p>
|
301 |
</div>
|
302 |
</div>
|
|
|
|
|
|
|
|
|
1 |
<style>
|
2 |
.section{
|
3 |
margin-left: -20px;
|
221 |
<h2><?php _e('Two more layouts','yith_wc_ajxnav');?></h2>
|
222 |
</div>
|
223 |
<p>
|
224 |
+
<?php echo sprintf(__('The YITH WooCommerce Ajax product Filter widget get richer with 2 new layouts to filter the products of your shop.%1$sBicolor%2$s: the perfect choice for those attributes related to two different colors at the same time (white/black), for a simple visual impact for the final user. Pick the %1$sTag%2$s typology, on the contrary, if you want to filter your products by product tag. And if you are using also the %1$sYITH WooCommerce Brand Add-On%2$s plugin, you will be able to offer the freedom to filter your shop products by brands thanks to the ajax technology.', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
|
|
|
|
|
|
225 |
</p>
|
226 |
</div>
|
227 |
</div>
|
234 |
<h2><?php _e('Price range','yith_wc_ajxnav');?></h2>
|
235 |
</div>
|
236 |
<p>
|
237 |
+
<?php echo sprintf(__('One of the most requested filter for e-commerce sites is the one that let you select products by their prices. Thanks to YITH WooCommerce Ajax List Price Filter, %1$syou can set unlimited price ranges:%2$s your users will be able to filter products selecting on the ranges you have set.', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
|
|
238 |
</p>
|
239 |
</div>
|
240 |
<div class="col-1">
|
253 |
<h2><?php _e( 'Ajax Stock/On Sale Filters','yith_wc_ajxnav');?></h2>
|
254 |
</div>
|
255 |
<p>
|
256 |
+
<?php echo sprintf(__('A new widget for the premium version of the plugin. Whoever will surf the pages of your shop will be able to display only the products on sale and/or the available ones.%3$s %1$sAn additional feature for an e-commerce site that is worthy!%2$s', 'yith_wc_ajxnav'), '<b>', '</b>','<br>');?>
|
|
|
|
|
257 |
</p>
|
258 |
</div>
|
259 |
</div>
|
266 |
<h2><?php _e('Product sorting','yith_wc_ajxnav');?></h2>
|
267 |
</div>
|
268 |
<p>
|
269 |
+
<?php echo sprintf(__('With the new %1$sYITH WooCommerce Ajax Sort By%2$s widget, you can give your users the freedom to sort products with the ajax technology, without the need to reload the page. Products can be sorted by rate, sales, price or publication date.', 'yith_wc_ajxnav'), '<b>', '</b>');?>
|
|
|
270 |
</p>
|
271 |
</div>
|
272 |
<div class="col-1">
|
285 |
<h2><?php _e('Customized loader','yith_wc_ajxnav');?></h2>
|
286 |
</div>
|
287 |
<p>
|
288 |
+
<?php _e('From the plugin option panel, you can choose to upload a new icon for your loader: in this way, it will better meet your needs.','yith_wc_ajxnav') ?>
|
289 |
</p>
|
290 |
</div>
|
291 |
</div>
|
modules/yith-woocommerce-ajax-navigation/widgets/class.yith-wcan-navigation-widget.php
CHANGED
@@ -761,7 +761,7 @@ if ( ! class_exists( 'YITH_WCAN_Navigation_Widget' ) ) {
|
|
761 |
|
762 |
$term_id = yit_wcan_localize_terms( $term->term_id, $taxonomy );
|
763 |
|
764 |
-
if ( $instance['labels'][$term_id]
|
765 |
|
766 |
echo '<li ' . $class . '>';
|
767 |
|
761 |
|
762 |
$term_id = yit_wcan_localize_terms( $term->term_id, $taxonomy );
|
763 |
|
764 |
+
if ( !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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== YITH WooCommerce Ajax Search ===
|
2 |
+
|
3 |
+
Contributors: yithemes
|
4 |
+
Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
|
5 |
+
Requires at least: 3.5.1
|
6 |
+
Tested up to: 4.2
|
7 |
+
Stable tag: 1.3.7
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
YITH WooCommerce Ajax Search allows your users to search products in real time.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
= Improve user experience, improve your sales =
|
16 |
+
|
17 |
+
YITH WooCommerce Ajax Search is a very easy-to-use plugin for WooCommerce. You just need to install it and it's ready to work.
|
18 |
+
|
19 |
+
It creates a simple search box that shows you instant search results, by suggesting you products from your WooCommerce store that match your searching criteria.
|
20 |
+
|
21 |
+
It is very useful to assist your users while they are trying to search any product in your website. They can just enter a keyword for the WooCommerce product they are looking for and YITH WooCommerce Ajax Search will spare them the nuisance to browse all WooCommerce categories one at a time.
|
22 |
+
|
23 |
+
Did you ever forget the name of a WooCommerce product? Just start to write your keyphrase. A list of useful suggestion will be shown to you and the more you write, the more accurate search results will be. At that point, you'll only need to choose what you need.
|
24 |
+
|
25 |
+
It works just like Google Suggest, but this tool will be available on your WooCommerce site and will be using your database.
|
26 |
+
|
27 |
+
= Features of YITH WooCommerce Ajax Search: =
|
28 |
+
|
29 |
+
* Widget and shortcodes to show your WooCommerce searchform in anywhere you want in your WooCommerce site.
|
30 |
+
* Options for customization of your WooCommerce searchform:
|
31 |
+
* Customize WooCommerce input label
|
32 |
+
* Customise WooCommerce search submit
|
33 |
+
* Options for displaying of WooCommerce search results.
|
34 |
+
* Set minimum number of characters for WooCommerce search
|
35 |
+
* Set maximum number of WooCommerce results
|
36 |
+
|
37 |
+
If you want to boost your YITH WooCommerce Ajax Search, you can also visit YIThemes page and explore the [live demo](http://plugins.yithemes.com/yith-woocommerce-ajax-search/) of the premium version, which includes all the following features to improve at the best your WooCommerce site search.
|
38 |
+
|
39 |
+
= Premium features of YITH WooCommerce Ajax Search: =
|
40 |
+
|
41 |
+
* All features of the free version of YITH WooCommerce Ajax Search
|
42 |
+
* Show filter for WooCommerce search fields
|
43 |
+
* Show list of WooCommerce categories (main categories/all categories)
|
44 |
+
* Extend search in WooCommerce product excerpt
|
45 |
+
* Extend search in WooCommerce product content
|
46 |
+
* Extend search in WooCommerce product categories
|
47 |
+
* Extend search in WooCommerce product tags
|
48 |
+
* Extend search also to WooCommerce product SKU
|
49 |
+
* Extend SKU search including WooCommerce variable products
|
50 |
+
* Show WooCommerce thumbnails in the list of search suggestions
|
51 |
+
* Show WooCommerce product price in the list of search suggestions
|
52 |
+
* Show WooCommerce sale badge (customization options available too)
|
53 |
+
* Show WooCommerce featured badge (customization options available too)
|
54 |
+
* Show excerpt of WooCommerce product (set the text to show as WooCommerce product excerpt)
|
55 |
+
* Customize WooCommerce search loader .gif image
|
56 |
+
|
57 |
+
|
58 |
+
For a more detailed list of options and features of YITH WooCommerce Ajax Search, please read the [official documentation](http://yithemes.com/docs-plugins/yith-woocommerce-ajax-search/ "YITH Woocommerce Ajax Search official documentation").
|
59 |
+
|
60 |
+
YITH WooCommerce Ajax Search is available in combination with many other plugins in [**YITH Essential Kit for WooCommerce #1**](https://wordpress.org/plugins/yith-essential-kit-for-woocommerce-1/), a bundle of indispensable tools to make your WooCommerce site look more professional and be more user-friendly. Learn more about all of WooCommerce plugins included and boost your WooCommerce site with a simple click!
|
61 |
+
|
62 |
+
|
63 |
+
= Compatibility with WooCommerce plugins =
|
64 |
+
|
65 |
+
YITH WooCommerce Ajax Search has been tested and compatibility is certain with the following WooCommerce plugins that you can add to your site:
|
66 |
+
|
67 |
+
* [**YITH Woocommerce Quick view**](https://wordpress.org/plugins/yith-woocommerce-quick-view/)
|
68 |
+
* [**YITH Woocommerce magnifier**](https://wordpress.org/plugins/yith-woocommerce-zoom-magnifier/)
|
69 |
+
* [**YITH Woocommerce Ajax Product Filter**](http://it.wordpress.org/plugins/yith-woocommerce-ajax-navigation/)
|
70 |
+
* [**YITH Woocommerce Infinite scrolling**](http://it.wordpress.org/plugins/yith-infinite-scrolling/)
|
71 |
+
|
72 |
+
Nevertheless, it could be compatible with many other WooCommerce plugins that have not been tested yet. If you want to inform us about compatibility with other plugins, please, [email to us](mailto:plugins@yithemes.com "Your Inspiration Themes").
|
73 |
+
|
74 |
+
== Installation ==
|
75 |
+
Important: First of all, you have to download and activate WooCommerce plugin, because without it YITH WooCommerce Ajax Search cannot work.
|
76 |
+
|
77 |
+
1. Unzip the downloaded .zip file.
|
78 |
+
2. Upload the YITH WooCommerce Ajax Search folder into the `wp-content/plugins/` directory of your WordPress site.
|
79 |
+
3. Activate `YITH WooCommerce Ajax Search` from Plugins page
|
80 |
+
|
81 |
+
|
82 |
+
= Configuration =
|
83 |
+
YITH WooCommerce Ajax Search will add a new tab called "Ajax Search" in "YIT Plugins" menu. There, you will find all YIThemes plugins and you will be able to access quickly plugin settings page.
|
84 |
+
|
85 |
+
== Frequently Asked Questions ==
|
86 |
+
|
87 |
+
= Is it compatible with all WordPress themes? =
|
88 |
+
|
89 |
+
Compatibility with all themes is impossible, because they are too many, but generally if themes are developed according to WordPress and WooCommerce guidelines, YITH plugins are compatible with them.
|
90 |
+
Yet, we can grant compatibility with themes developed by YIThemes, because they are constantly updated and tested with our plugins. Sometimes, especially when new versions are released, it might only require some time for them to be all updated, but you can be sure that they will be tested and will be working in a few days.
|
91 |
+
|
92 |
+
|
93 |
+
= How can I get support if my WooCommerce plugin is not working? =
|
94 |
+
|
95 |
+
If you have problems with our plugins or something is not working as it should, first follow this preliminary steps:
|
96 |
+
|
97 |
+
* Test the plugin with a WordPress default theme, to be sure that the error is not caused by the theme you are currently using.
|
98 |
+
* Deactivate all plugins you are using and check if the problem is still occurring.
|
99 |
+
* Ensure that you plugin version, your theme version and your WordPress and WooCommerce version (if required) are updated and that the problem you are experiencing has not already been solved in a later plugin update.
|
100 |
+
|
101 |
+
If none of the previous listed actions helps you solve the problem, then, submit a ticket in the forum and describe your problem accurately, specify WordPress and WooCommerce versions you are using and any other information that might help us solve your problem as quickly as possible. Thanks!
|
102 |
+
|
103 |
+
|
104 |
+
= How can I get more features for my WooCommerce plugin? =
|
105 |
+
You can get more features with the premium version of YITH WooCommerce Ajax Search, available on [YIThemes page]( https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/). Here you can read more about the premium features of the plugin and make it give it its best shot!
|
106 |
+
|
107 |
+
|
108 |
+
= How can I try the full-featured plugin? =
|
109 |
+
|
110 |
+
If you want to see a demonstration version of the premium plugin, you can see that in [this page](http://plugins.yithemes.com/yith-woocommerce-ajax-search/). Browse it and try all options available so that you can see how your plugin looks like.
|
111 |
+
|
112 |
+
= What are the main changes in plugin translation? =
|
113 |
+
Recently YITH WooCommerce Ajax Search has been selected to be included in the "translate.wordpress.org" translate programme.
|
114 |
+
In order to import correctly the plugin strings in the new system, we had to change the text domain form 'yit' to 'yith-woocommerce-ajax-search'.
|
115 |
+
Once the plugin will be imported in the translate.wordpress.org system, the translations of other languages will be downloaded directly from WordPress, without using any .po and .mo files. Moreover, users will be able to participate in a more direct way to plugin translations, suggesting texts in their languages in the dedicated tab on translate.wordpress.org.
|
116 |
+
During this transition step, .po and .mo files will be used as always, but in order to be recognized by WordPress, they will need to have a new nomenclature, renaming them in:
|
117 |
+
|
118 |
+
* yith-woocommerce-ajax-search-[WORDPRESS LOCALE].po
|
119 |
+
* yith-woocommerce-ajax-search-[WORDPRESS LOCALE].mo
|
120 |
+
|
121 |
+
== Suggestions ==
|
122 |
+
If you have any suggestions for improving YITH WooCommerce Ajax Search, you can [write to us](mailto:plugins@yithemes.com "Your Inspiration Themes"), and contribute in making your YITH WooCommerce Ajax Search more and more performing.
|
123 |
+
|
124 |
+
== Translators ==
|
125 |
+
|
126 |
+
= Available Languages =
|
127 |
+
* English (Default)
|
128 |
+
* Italian
|
129 |
+
|
130 |
+
If you have created your own language pack for YITH WooCommerce Ajax Search, or have an update for an existing one, you can send [gettext PO and MO file](http://codex.wordpress.org/Translating_WordPress "Translating WordPress")
|
131 |
+
[to us](mailto:plugins@yithemes.com "Your Inspiration Themes") so we can bundle it into YITH WooCommerce Ajax Search.
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
== Screenshots ==
|
136 |
+
|
137 |
+
1. YITH WooCommerce Ajax Search settings page
|
138 |
+
2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
|
139 |
+
|
140 |
+
== Changelog ==
|
141 |
+
= 1.3.7 =
|
142 |
+
* Updated: Changed Text Domain from 'yit' to 'yith-woocommerce-ajax-search'
|
143 |
+
* Updated: Plugin Core Framework
|
144 |
+
|
145 |
+
= 1.3.6 =
|
146 |
+
* Added: Support to WooCommerce 2.4.2
|
147 |
+
* Updated: Plugin Core Framework
|
148 |
+
|
149 |
+
= 1.3.5 =
|
150 |
+
* Added: Support more search elements on a page
|
151 |
+
|
152 |
+
= 1.3.4 =
|
153 |
+
* Fixed: Support to WPML
|
154 |
+
|
155 |
+
= 1.3.3 =
|
156 |
+
* Fixed: Called to WP_Widget construct
|
157 |
+
* Fixed: Support to WPML
|
158 |
+
|
159 |
+
= 1.3.2 =
|
160 |
+
|
161 |
+
* Fixed: Backward compatibility with Autocomplete function
|
162 |
+
|
163 |
+
= 1.3.1 =
|
164 |
+
|
165 |
+
* Updated: Renamed Autocomplete function with YithAutocomplete
|
166 |
+
|
167 |
+
= 1.3.0 =
|
168 |
+
|
169 |
+
* Added: Wordpress 4.2 compatibility
|
170 |
+
* Fixed: Shorcode output
|
171 |
+
* Fixed: WP security issue
|
172 |
+
|
173 |
+
= 1.2.7 =
|
174 |
+
|
175 |
+
* Updated: Plugin Core Framework
|
176 |
+
|
177 |
+
= 1.2.6 =
|
178 |
+
|
179 |
+
* Updated: Plugin Core Framework
|
180 |
+
* Fixed: Loader image not hidden after search
|
181 |
+
* Fixed: Disabled submit when search string is empty
|
182 |
+
* Fixed: Support to WPML in query string
|
183 |
+
|
184 |
+
= 1.2.5 =
|
185 |
+
|
186 |
+
* Fixed: Plugin installation bug
|
187 |
+
|
188 |
+
= 1.2.4 =
|
189 |
+
|
190 |
+
* Fixed: Minor bugs
|
191 |
+
|
192 |
+
= 1.2.3 =
|
193 |
+
|
194 |
+
* Added: Support to Wordpress 4.1.1
|
195 |
+
* Fixed: Minor bugs
|
196 |
+
|
197 |
+
= 1.2.2 =
|
198 |
+
|
199 |
+
* Added: Support to WooCommerce 2.3.x
|
200 |
+
* Fixed: Minor bugs
|
201 |
+
|
202 |
+
= 1.2.1 =
|
203 |
+
|
204 |
+
* Updated: Plugin Core Framework
|
205 |
+
|
206 |
+
= 1.2 =
|
207 |
+
|
208 |
+
* Updated: Plugin Core Framework
|
209 |
+
|
210 |
+
= 1.1.3 =
|
211 |
+
|
212 |
+
* Fixed: Javascript code in external file
|
213 |
+
|
214 |
+
= 1.1.2 =
|
215 |
+
|
216 |
+
* Fixed: Prevent undefined title index if the widget is called by the the_widget func
|
217 |
+
* Updated: Autocomplete js library
|
218 |
+
* Updated: Plugin Core Framework
|
219 |
+
|
220 |
+
= 1.1.1 =
|
221 |
+
|
222 |
+
* Fixed: Settings link doesn't work on WooCommerce 2.1.1
|
223 |
+
|
224 |
+
= 1.1.0 =
|
225 |
+
|
226 |
+
* Added: Support to WooCommerce 2.1.x
|
227 |
+
|
228 |
+
= 1.0.0 =
|
229 |
+
|
230 |
+
* Initial release
|
231 |
+
|
232 |
+
|
233 |
+
== Upgrade notice ==
|
234 |
+
|
235 |
+
= 1.3.2 =
|
236 |
+
|
237 |
+
* Fixed: Backward compatibility with Autocomplete function
|
238 |
+
|
239 |
+
= 1.3.1 =
|
240 |
+
|
241 |
+
* Updated: Renamed Autocomplete function with YithAutocomplete
|
242 |
+
|
243 |
+
= 1.3.0 =
|
244 |
+
|
245 |
+
* Added: Wordpress 4.2 compatibility
|
246 |
+
* Fixed: Shorcode output
|
247 |
+
* Fixed: Wp security issue
|
248 |
+
|
249 |
+
= 1.2.7 =
|
250 |
+
|
251 |
+
* Updated: Plugin Core Framework
|
252 |
+
|
253 |
+
= 1.2.6 =
|
254 |
+
|
255 |
+
* Updated: Plugin Core Framework
|
256 |
+
* Fixed: Loader image not hided after search
|
257 |
+
* Fixed: Disabled submit when search string is empty
|
258 |
+
* Fixed: Support to WPML in query string
|
259 |
+
|
260 |
+
= 1.2.5 =
|
261 |
+
|
262 |
+
* Fixed: Plugin installation bug
|
263 |
+
|
264 |
+
= 1.2.4 =
|
265 |
+
|
266 |
+
* Fixed: Minor bugs
|
267 |
+
|
268 |
+
= 1.2.3 =
|
269 |
+
|
270 |
+
* Added: Support to Wordpress 4.1.1
|
271 |
+
* Fixed: Minor bugs
|
272 |
+
|
273 |
+
= 1.2.2 =
|
274 |
+
|
275 |
+
* Added: Support to WooCommerce 2.3.x
|
276 |
+
* Fixed: Minor bugs
|
277 |
+
|
278 |
+
= 1.2.1 =
|
279 |
+
|
280 |
+
* Updated: Plugin Core Framework
|
281 |
+
|
282 |
+
= 1.2 =
|
283 |
+
|
284 |
+
* Updated: Plugin Core Framework
|
285 |
+
|
286 |
+
= 1.1.3 =
|
287 |
+
|
288 |
+
* Fixed: Javascript code in external file
|
289 |
+
|
290 |
+
= 1.1.2 =
|
291 |
+
|
292 |
+
* Fixed: Prevent undefined title index if the widget is called by the the_widget func
|
293 |
+
* Updated: Autocomplete js library
|
294 |
+
* Updated: Plugin Core Framework
|
295 |
+
|
296 |
+
= 1.1.1 =
|
297 |
+
|
298 |
+
* Fixed: Settings link doesn't work on WooCommerce 2.1.1
|
299 |
+
|
300 |
+
= 1.1.0 =
|
301 |
+
|
302 |
+
* Added: Support to WooCommerce 2.1.x
|
303 |
+
|
304 |
+
= 1.0.0 =
|
305 |
+
|
306 |
+
* Initial release
|
modules/yith-woocommerce-ajax-search/class.yith-wcas-admin.php
CHANGED
@@ -103,8 +103,8 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
103 |
*/
|
104 |
public function action_links( $links ) {
|
105 |
|
106 |
-
$links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', '
|
107 |
-
$links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', '
|
108 |
|
109 |
return $links;
|
110 |
}
|
@@ -125,15 +125,15 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
125 |
}
|
126 |
|
127 |
$admin_tabs = array(
|
128 |
-
'settings' => __( 'Settings', '
|
129 |
-
'premium' => __( 'Premium Version', '
|
130 |
);
|
131 |
|
132 |
$args = array(
|
133 |
'create_menu_page' => true,
|
134 |
'parent_slug' => '',
|
135 |
-
'page_title' => __( 'Ajax Search', '
|
136 |
-
'menu_title' => __( 'Ajax Search', '
|
137 |
'capability' => 'manage_options',
|
138 |
'parent' => '',
|
139 |
'parent_page' => 'yit_plugin_panel',
|
@@ -187,7 +187,7 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
187 |
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
188 |
|
189 |
if ( defined( 'YITH_WCAS_FREE_INIT' ) && YITH_WCAS_FREE_INIT == $plugin_file ) {
|
190 |
-
$plugin_meta[] = '<a href="' . $this->doc_url . '" target="_blank">' . __( 'Plugin Documentation', '
|
191 |
}
|
192 |
return $plugin_meta;
|
193 |
}
|
@@ -204,10 +204,10 @@ if( !class_exists( 'YITH_WCAS_Admin' ) ) {
|
|
204 |
'pointer_id' => 'yith_wcas_panel',
|
205 |
'target' => '#toplevel_page_yit_plugin_panel',
|
206 |
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
207 |
-
__( 'YITH WooCommerce Ajax Search', '
|
208 |
__( 'In the YIT Plugin tab you can find the YITH WooCommerce Ajax Search options.
|
209 |
With this menu, you can access to all the settings of our plugins that you have activated.
|
210 |
-
YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version with many new options, <a href="'.$this->_premium_landing.'">discover it now</a>', '
|
211 |
),
|
212 |
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
213 |
'init' => YITH_WCAS_FREE_INIT
|
@@ -218,11 +218,11 @@ YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version with
|
|
218 |
'pointer_id' => 'yith_wcas_panel',
|
219 |
'target' => '#toplevel_page_yit_plugin_panel',
|
220 |
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
221 |
-
__( 'YITH WooCommerce Ajax Search Updated', '
|
222 |
__( 'From now on, you can find all the options of YITH WooCommerce Ajax Search Updated under YIT Plugin -> Ajax Search instead of WooCommerce -> Settings -> Ajax Search, as in the previous version.
|
223 |
When one of our plugins updates, a new voice will be added to this menu.
|
224 |
YITH WooCommerce Ajax Search renovates with new available options, discover the <a href="'.$this->get_premium_landing_uri().'">PREMIUM version</a>.
|
225 |
-
', '
|
226 |
),
|
227 |
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
228 |
'init' => YITH_WCAS_FREE_INIT
|
103 |
*/
|
104 |
public function action_links( $links ) {
|
105 |
|
106 |
+
$links[] = '<a href="' . admin_url( "admin.php?page={$this->_panel_page}" ) . '">' . __( 'Settings', 'yith-woocommerce-ajax-search' ) . '</a>';
|
107 |
+
$links[] = '<a href="' . $this->get_premium_landing_uri() . '" target="_blank">' . __( 'Premium Version', 'yith-woocommerce-ajax-search' ) . '</a>';
|
108 |
|
109 |
return $links;
|
110 |
}
|
125 |
}
|
126 |
|
127 |
$admin_tabs = array(
|
128 |
+
'settings' => __( 'Settings', 'yith-woocommerce-ajax-search' ),
|
129 |
+
'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-search' ),
|
130 |
);
|
131 |
|
132 |
$args = array(
|
133 |
'create_menu_page' => true,
|
134 |
'parent_slug' => '',
|
135 |
+
'page_title' => __( 'Ajax Search', 'yith-woocommerce-ajax-search' ),
|
136 |
+
'menu_title' => __( 'Ajax Search', 'yith-woocommerce-ajax-search' ),
|
137 |
'capability' => 'manage_options',
|
138 |
'parent' => '',
|
139 |
'parent_page' => 'yit_plugin_panel',
|
187 |
public function plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
188 |
|
189 |
if ( defined( 'YITH_WCAS_FREE_INIT' ) && YITH_WCAS_FREE_INIT == $plugin_file ) {
|
190 |
+
$plugin_meta[] = '<a href="' . $this->doc_url . '" target="_blank">' . __( 'Plugin Documentation', 'yith-woocommerce-ajax-search' ) . '</a>';
|
191 |
}
|
192 |
return $plugin_meta;
|
193 |
}
|
204 |
'pointer_id' => 'yith_wcas_panel',
|
205 |
'target' => '#toplevel_page_yit_plugin_panel',
|
206 |
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
207 |
+
__( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
|
208 |
__( 'In the YIT Plugin tab you can find the YITH WooCommerce Ajax Search options.
|
209 |
With this menu, you can access to all the settings of our plugins that you have activated.
|
210 |
+
YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version with many new options, <a href="'.$this->_premium_landing.'">discover it now</a>', 'yith-woocommerce-ajax-search' )
|
211 |
),
|
212 |
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
213 |
'init' => YITH_WCAS_FREE_INIT
|
218 |
'pointer_id' => 'yith_wcas_panel',
|
219 |
'target' => '#toplevel_page_yit_plugin_panel',
|
220 |
'content' => sprintf( '<h3> %s </h3> <p> %s </p>',
|
221 |
+
__( 'YITH WooCommerce Ajax Search Updated', 'yith-woocommerce-ajax-search' ),
|
222 |
__( 'From now on, you can find all the options of YITH WooCommerce Ajax Search Updated under YIT Plugin -> Ajax Search instead of WooCommerce -> Settings -> Ajax Search, as in the previous version.
|
223 |
When one of our plugins updates, a new voice will be added to this menu.
|
224 |
YITH WooCommerce Ajax Search renovates with new available options, discover the <a href="'.$this->get_premium_landing_uri().'">PREMIUM version</a>.
|
225 |
+
', 'yith-woocommerce-ajax-search' )
|
226 |
),
|
227 |
'position' => array( 'edge' => 'left', 'align' => 'center' ),
|
228 |
'init' => YITH_WCAS_FREE_INIT
|
modules/yith-woocommerce-ajax-search/class.yith-wcas.php
CHANGED
@@ -172,7 +172,7 @@ if ( !class_exists( 'YITH_WCAS' ) ) {
|
|
172 |
else {
|
173 |
$suggestions[] = array(
|
174 |
'id' => - 1,
|
175 |
-
'value' => __( 'No results', '
|
176 |
'url' => '',
|
177 |
);
|
178 |
}
|
172 |
else {
|
173 |
$suggestions[] = array(
|
174 |
'id' => - 1,
|
175 |
+
'value' => __( 'No results', 'yith-woocommerce-ajax-search' ),
|
176 |
'url' => '',
|
177 |
);
|
178 |
}
|
modules/yith-woocommerce-ajax-search/init.php
CHANGED
@@ -3,10 +3,10 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Search allows your users to search products in real time.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: Yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
-
* Text Domain:
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* @author Yithemes
|
@@ -37,7 +37,7 @@ if ( defined( 'YITH_WCAS_PREMIUM' ) ) {
|
|
37 |
function yith_wcas_install_free_admin_notice() {
|
38 |
?>
|
39 |
<div class="error">
|
40 |
-
<p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Ajax Search while you are using the premium one.', '
|
41 |
</div>
|
42 |
<?php
|
43 |
}
|
@@ -59,7 +59,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
|
|
59 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
60 |
return;
|
61 |
}else{
|
62 |
-
define( 'YITH_WCAS_VERSION', '1.3.
|
63 |
}
|
64 |
|
65 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
@@ -101,7 +101,7 @@ function yith_ajax_search_constructor() {
|
|
101 |
function yith_wcas_install_woocommerce_admin_notice() {
|
102 |
?>
|
103 |
<div class="error">
|
104 |
-
<p><?php _e( 'YITH WooCommerce Ajax Search is enabled but not effective. It requires WooCommerce in order to work.', '
|
105 |
</div>
|
106 |
<?php
|
107 |
}
|
@@ -111,7 +111,7 @@ function yith_ajax_search_constructor() {
|
|
111 |
}
|
112 |
|
113 |
|
114 |
-
load_plugin_textdomain( '
|
115 |
|
116 |
// Load required classes and functions
|
117 |
require_once('functions.yith-wcas.php');
|
3 |
* Plugin Name: YITH WooCommerce Ajax Search
|
4 |
* Plugin URI: http://yithemes.com/
|
5 |
* Description: YITH WooCommerce Ajax Search allows your users to search products in real time.
|
6 |
+
* Version: 1.3.7
|
7 |
* Author: Yithemes
|
8 |
* Author URI: http://yithemes.com/
|
9 |
+
* Text Domain: yith-woocommerce-ajax-search
|
10 |
* Domain Path: /languages/
|
11 |
*
|
12 |
* @author Yithemes
|
37 |
function yith_wcas_install_free_admin_notice() {
|
38 |
?>
|
39 |
<div class="error">
|
40 |
+
<p><?php _e( 'You can\'t activate the free version of YITH WooCommerce Ajax Search while you are using the premium one.', 'yith-woocommerce-ajax-search' ); ?></p>
|
41 |
</div>
|
42 |
<?php
|
43 |
}
|
59 |
if ( defined( 'YITH_WCAS_VERSION' ) ){
|
60 |
return;
|
61 |
}else{
|
62 |
+
define( 'YITH_WCAS_VERSION', '1.3.7' );
|
63 |
}
|
64 |
|
65 |
if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
|
101 |
function yith_wcas_install_woocommerce_admin_notice() {
|
102 |
?>
|
103 |
<div class="error">
|
104 |
+
<p><?php _e( 'YITH WooCommerce Ajax Search is enabled but not effective. It requires WooCommerce in order to work.', 'yith-woocommerce-ajax-search' ); ?></p>
|
105 |
</div>
|
106 |
<?php
|
107 |
}
|
111 |
}
|
112 |
|
113 |
|
114 |
+
load_plugin_textdomain( 'yith-woocommerce-ajax-search', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );
|
115 |
|
116 |
// Load required classes and functions
|
117 |
require_once('functions.yith-wcas.php');
|
modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-it_IT.mo
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-it_IT.po
ADDED
@@ -0,0 +1,599 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Ajax Search Premium\n"
|
4 |
+
"POT-Creation-Date: 2015-09-18 11:22+0200\n"
|
5 |
+
"PO-Revision-Date: 2015-09-18 11:22+0200\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: Yithemes <plugins@yithemes.com>\n"
|
8 |
+
"Language: it_IT\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.8.4\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_x\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"X-Poedit-SearchPath-0: ..\n"
|
16 |
+
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
17 |
+
|
18 |
+
#: ../class.yith-wcas-admin.php:106 ../class.yith-wcas-admin.php:128
|
19 |
+
msgid "Settings"
|
20 |
+
msgstr "Impostazioni"
|
21 |
+
|
22 |
+
#: ../class.yith-wcas-admin.php:107 ../class.yith-wcas-admin.php:129
|
23 |
+
msgid "Premium Version"
|
24 |
+
msgstr "Versione premium"
|
25 |
+
|
26 |
+
#: ../class.yith-wcas-admin.php:135 ../class.yith-wcas-admin.php:136
|
27 |
+
msgid "Ajax Search"
|
28 |
+
msgstr "Ajax Search"
|
29 |
+
|
30 |
+
#: ../class.yith-wcas-admin.php:190
|
31 |
+
msgid "Plugin Documentation"
|
32 |
+
msgstr "Documentazione plugin"
|
33 |
+
|
34 |
+
#: ../class.yith-wcas-admin.php:207 ../plugin-options/settings-options.php:24
|
35 |
+
#: ../plugin-options/settings-options.php:31
|
36 |
+
msgid "YITH WooCommerce Ajax Search"
|
37 |
+
msgstr "YITH WooCommerce Ajax Search"
|
38 |
+
|
39 |
+
#: ../class.yith-wcas-admin.php:208
|
40 |
+
msgid ""
|
41 |
+
"In the YIT Plugin tab you can find the YITH WooCommerce Ajax Search "
|
42 |
+
"options.\n"
|
43 |
+
"With this menu, you can access to all the settings of our plugins that you "
|
44 |
+
"have activated.\n"
|
45 |
+
"YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version "
|
46 |
+
"with many new options, <a href=\""
|
47 |
+
msgstr ""
|
48 |
+
"Nella scheda del plugin puoi trovare tutte le opzioni di YITH WooCommerce "
|
49 |
+
"Ajax Search.\n"
|
50 |
+
"Da questo menu, avrai accesso a tutte le impostazioni dei nostri plugin "
|
51 |
+
"attivati finora.\n"
|
52 |
+
"YITH WooCommerce Ajax Search è disponibile in una eccezionale versione "
|
53 |
+
"PREMIUM con molte nuove optioni, <a href=\""
|
54 |
+
|
55 |
+
#: ../class.yith-wcas-admin.php:221
|
56 |
+
msgid "YITH WooCommerce Ajax Search Updated"
|
57 |
+
msgstr "YITH WooCommerce Ajax Search aggiornato"
|
58 |
+
|
59 |
+
#: ../class.yith-wcas-admin.php:222
|
60 |
+
msgid ""
|
61 |
+
"From now on, you can find all the options of YITH WooCommerce Ajax Search "
|
62 |
+
"Updated under YIT Plugin -> Ajax Search instead of WooCommerce -> Settings -"
|
63 |
+
"> Ajax Search, as in the previous version.\n"
|
64 |
+
"When one of our plugins updates, a new voice will be added to this menu.\n"
|
65 |
+
"YITH WooCommerce Ajax Search renovates with new available options, discover "
|
66 |
+
"the <a href=\""
|
67 |
+
msgstr ""
|
68 |
+
"Da adesso, puoi trovare tutte le opzioni del nuovo YITH WooCommerce Ajax "
|
69 |
+
"Search in YIT Plugin > Ajax Search invece che in WooCommerce > Settings > "
|
70 |
+
"Ajax Search, come accadeva nelle precedenti versioni.\n"
|
71 |
+
"Quando uno dei nostri plugin verrà aggiornato, una nuova voce sarà aggiunta "
|
72 |
+
"a questo menu.\n"
|
73 |
+
"YITH WooCommerce Ajax Search si è rinnovato con molte nuove opzioni "
|
74 |
+
"disponibili, scopri <a href=\""
|
75 |
+
|
76 |
+
#: ../class.yith-wcas.php:175
|
77 |
+
msgid "No results"
|
78 |
+
msgstr "Nessun risultato"
|
79 |
+
|
80 |
+
#: ../init.php:40
|
81 |
+
msgid ""
|
82 |
+
"You can't activate the free version of YITH WooCommerce Ajax Search while "
|
83 |
+
"you are using the premium one."
|
84 |
+
msgstr ""
|
85 |
+
"Non puoi attivare la versione free di YITH WooCommerce Ajax Search se stai "
|
86 |
+
"già utilizzando la premium."
|
87 |
+
|
88 |
+
#: ../init.php:104
|
89 |
+
msgid ""
|
90 |
+
"YITH WooCommerce Ajax Search is enabled but not effective. It requires "
|
91 |
+
"WooCommerce in order to work."
|
92 |
+
msgstr ""
|
93 |
+
"YITH WooCommerce Ajax Search è abilitato ma non in funzione. Devi aver "
|
94 |
+
"installato WooCommerce per poter funzionare."
|
95 |
+
|
96 |
+
#: ../plugin-options/settings-options.php:21
|
97 |
+
msgid "Upgrade to the PREMIUM VERSION"
|
98 |
+
msgstr "Aggiorna alla VERSIONE PREMIUM"
|
99 |
+
|
100 |
+
#: ../plugin-options/settings-options.php:25
|
101 |
+
msgid "Discover the Advanced Features"
|
102 |
+
msgstr "Scopri le funzionalità avanzate"
|
103 |
+
|
104 |
+
#: ../plugin-options/settings-options.php:26
|
105 |
+
msgid ""
|
106 |
+
"Upgrade to the PREMIUM VERSION\n"
|
107 |
+
"of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!"
|
108 |
+
msgstr ""
|
109 |
+
"Passa alla VERSIONE PREMIUM\n"
|
110 |
+
"di YITH WooCommerce Ajax Search per poter fruire di tutte le sue "
|
111 |
+
"funzionalità!"
|
112 |
+
|
113 |
+
#: ../plugin-options/settings-options.php:33
|
114 |
+
msgid "Get Support and Pro Features"
|
115 |
+
msgstr "Accedi al supporto e alle funzionalità premium"
|
116 |
+
|
117 |
+
#: ../plugin-options/settings-options.php:34
|
118 |
+
msgid ""
|
119 |
+
"By purchasing the premium version of the plugin, you will take advantage of "
|
120 |
+
"the advanced features of the product and you will get one year of free "
|
121 |
+
"updates and support through our platform available 24h/24."
|
122 |
+
msgstr ""
|
123 |
+
"Acquistando la versione premium del plugin, potrai utilizzare le "
|
124 |
+
"funzionalità avanzate del prodotto ed otterrai un anno di aggiornamenti "
|
125 |
+
"gratuiti e di supporto sulla nostra piattaforma disponibile 24h su 24."
|
126 |
+
|
127 |
+
#: ../plugin-options/settings-options.php:44
|
128 |
+
msgid "General settings"
|
129 |
+
msgstr "Impostazioni generali"
|
130 |
+
|
131 |
+
#: ../plugin-options/settings-options.php:53
|
132 |
+
msgid "Search input label"
|
133 |
+
msgstr "Etichetta campo \"Cerca\""
|
134 |
+
|
135 |
+
#: ../plugin-options/settings-options.php:55
|
136 |
+
#: ../plugin-options/settings-options.php:63
|
137 |
+
msgid "Label for Search input field."
|
138 |
+
msgstr "Etichetta per il campo \"Cerca\""
|
139 |
+
|
140 |
+
#: ../plugin-options/settings-options.php:57
|
141 |
+
msgid "Search for products"
|
142 |
+
msgstr "Cerca prodotto"
|
143 |
+
|
144 |
+
#: ../plugin-options/settings-options.php:61
|
145 |
+
msgid "Search submit label"
|
146 |
+
msgstr "Etichetta campo \"Submit\""
|
147 |
+
|
148 |
+
#: ../plugin-options/settings-options.php:65
|
149 |
+
msgid "Search"
|
150 |
+
msgstr "Cerca"
|
151 |
+
|
152 |
+
#: ../plugin-options/settings-options.php:69
|
153 |
+
msgid "Minimum number of characters"
|
154 |
+
msgstr "Numero minimo di caratteri"
|
155 |
+
|
156 |
+
#: ../plugin-options/settings-options.php:70
|
157 |
+
msgid "Minimum number of characters required to trigger autosuggest."
|
158 |
+
msgstr ""
|
159 |
+
"Numero minimo di caratteri richiesti per mostrare i suggerimenti automatici."
|
160 |
+
|
161 |
+
#: ../plugin-options/settings-options.php:83
|
162 |
+
msgid "Maximum number of results"
|
163 |
+
msgstr "Numero massimo di risultati"
|
164 |
+
|
165 |
+
#: ../plugin-options/settings-options.php:84
|
166 |
+
msgid "Maximum number of results showed within the autosuggest box."
|
167 |
+
msgstr "Numero massimo di risultati da mostrare tra i suggerimenti automatici."
|
168 |
+
|
169 |
+
#: ../templates/admin/premium.php:251 ../templates/admin/premium.php:299
|
170 |
+
#, php-format
|
171 |
+
msgid ""
|
172 |
+
"Upgrade to the %1$spremium version%2$s%3$s of %1$sYITH WooCommerce Ajax "
|
173 |
+
"Search%2$s to benefit from all features!"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../templates/admin/premium.php:253 ../templates/admin/premium.php:301
|
177 |
+
#, php-format
|
178 |
+
msgid "%1$sUPGRADE%2$s %3$sto the premium version%2$s"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: ../templates/admin/premium.php:259
|
182 |
+
msgid "Premium Features"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: ../templates/admin/premium.php:261
|
186 |
+
msgid "HOW TO CUSTOMIZE THE RESULTS OF THE AUTOCOMPLETE"
|
187 |
+
msgstr ""
|
188 |
+
|
189 |
+
#: ../templates/admin/premium.php:263
|
190 |
+
msgid "RESULTS OF THE AUTOCOMPLETE"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: ../templates/admin/premium.php:268
|
194 |
+
#, php-format
|
195 |
+
msgid "Show %1$sthe image%2$s of the product (left or right aligned)"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: ../templates/admin/premium.php:269
|
199 |
+
#, php-format
|
200 |
+
msgid "Enable the %1$sprice visualization%2$s"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: ../templates/admin/premium.php:270
|
204 |
+
#, php-format
|
205 |
+
msgid "Show the %1$sproduct description%2$s"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: ../templates/admin/premium.php:271
|
209 |
+
#, php-format
|
210 |
+
msgid "Tell to the client if the product is %1$son discount or is featured%2$s"
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: ../templates/admin/premium.php:279
|
214 |
+
msgid "HOW TO CUSTOMIZE THE SEARCH OPTIONS"
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: ../templates/admin/premium.php:283
|
218 |
+
#, php-format
|
219 |
+
msgid "%1$sExtend the research%2$s in the excerpt and in the content"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: ../templates/admin/premium.php:284
|
223 |
+
#, php-format
|
224 |
+
msgid "%1$sActivate%2$s the category search"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: ../templates/admin/premium.php:285
|
228 |
+
#, php-format
|
229 |
+
msgid "Configure the %1$stag%2$s search"
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: ../templates/admin/premium.php:286
|
233 |
+
#, php-format
|
234 |
+
msgid "Search a product with an %1$sID%2$s"
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: ../templates/admin/premium.php:292
|
238 |
+
msgid "SEARCH OPTIONS"
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: ../templates/yith-woocommerce-ajax-search.php:18
|
242 |
+
msgid "Search for:"
|
243 |
+
msgstr "Cerca:"
|
244 |
+
|
245 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:28
|
246 |
+
msgid "An Ajax Search box for products only."
|
247 |
+
msgstr "Un filtro di ricerca Ajax solo per i prodotti."
|
248 |
+
|
249 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:30
|
250 |
+
msgid "YITH WooCommerce Ajax Product Search"
|
251 |
+
msgstr "YITH WooCommerce Ajax Product Search"
|
252 |
+
|
253 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:89
|
254 |
+
msgid "Title:"
|
255 |
+
msgstr "Titolo:"
|
256 |
+
|
257 |
+
#~ msgid "Output"
|
258 |
+
#~ msgstr "Risultati di ricerca"
|
259 |
+
|
260 |
+
#~ msgid "sale"
|
261 |
+
#~ msgstr "in saldo"
|
262 |
+
|
263 |
+
#~ msgid "featured"
|
264 |
+
#~ msgstr "in evidenza"
|
265 |
+
|
266 |
+
#~ msgid "Search in product brands"
|
267 |
+
#~ msgstr "Cerca marche prodotti"
|
268 |
+
|
269 |
+
#~ msgid "Extend search in product brands"
|
270 |
+
#~ msgstr "Estendi la ricerca alle marche dei prodotti"
|
271 |
+
|
272 |
+
#~ msgid ""
|
273 |
+
#~ "YITH WooCommerce Ajax Search Premium is enabled but not effective. It "
|
274 |
+
#~ "requires WooCommerce in order to work."
|
275 |
+
#~ msgstr ""
|
276 |
+
#~ "YITH WooCommerce Ajax Search Premium è abilitato ma non in funzione. Devi "
|
277 |
+
#~ "aver installato WooCommerce per poterlo utilizzare."
|
278 |
+
|
279 |
+
#~ msgid "Output Options"
|
280 |
+
#~ msgstr "Impostazioni risultati di ricerca"
|
281 |
+
|
282 |
+
#~ msgid "Show thumbnail"
|
283 |
+
#~ msgstr "Mostra thumbnail"
|
284 |
+
|
285 |
+
#~ msgid "Choose if you want show thumbnail and position"
|
286 |
+
#~ msgstr "Scegli se mostrare la thumbnail e dove"
|
287 |
+
|
288 |
+
#~ msgid "Hide thumbnail"
|
289 |
+
#~ msgstr "Nascondi thumbnail"
|
290 |
+
|
291 |
+
#~ msgid "Show on the Left"
|
292 |
+
#~ msgstr "Mostra a sinistra"
|
293 |
+
|
294 |
+
#~ msgid "Show on the Right"
|
295 |
+
#~ msgstr "Mostra a destra"
|
296 |
+
|
297 |
+
#~ msgid "Size of thumbnails"
|
298 |
+
#~ msgstr "Dimensione thumbnail"
|
299 |
+
|
300 |
+
#~ msgid "Show price"
|
301 |
+
#~ msgstr "Mostra prezzo"
|
302 |
+
|
303 |
+
#~ msgid "Show price of product"
|
304 |
+
#~ msgstr "Mostra prezzo prodotto"
|
305 |
+
|
306 |
+
#~ msgid "Price Label"
|
307 |
+
#~ msgstr "Etichetta prezzo"
|
308 |
+
|
309 |
+
#~ msgid "Show a label before the price"
|
310 |
+
#~ msgstr "Mostra un'etichetta prima del prezzo"
|
311 |
+
|
312 |
+
#~ msgid "Price:"
|
313 |
+
#~ msgstr "Prezzo:"
|
314 |
+
|
315 |
+
#~ msgid "Loader"
|
316 |
+
#~ msgstr "Icona di caricamento"
|
317 |
+
|
318 |
+
#~ msgid "Loader gif"
|
319 |
+
#~ msgstr "GIF icona di caricamento"
|
320 |
+
|
321 |
+
#~ msgid "Sales and Features badges"
|
322 |
+
#~ msgstr "Simboli \"in saldo\" e \"in evidenza\""
|
323 |
+
|
324 |
+
#~ msgid "Show sale badge"
|
325 |
+
#~ msgstr "Mostra adesivo \"in saldo\""
|
326 |
+
|
327 |
+
#~ msgid "Show sale badge if the product is on sale"
|
328 |
+
#~ msgstr "Mostra adesivo \"in saldo\" per i prodotti in saldo"
|
329 |
+
|
330 |
+
#~ msgid "Sale badge background color"
|
331 |
+
#~ msgstr "Colore sfondo adesivo \"in saldo\""
|
332 |
+
|
333 |
+
#~ msgid "Sale badge color"
|
334 |
+
#~ msgstr "Colore adesivo \"in saldo\""
|
335 |
+
|
336 |
+
#~ msgid "Show featured badge"
|
337 |
+
#~ msgstr "Mostra adesivo \"in evidenza\""
|
338 |
+
|
339 |
+
#~ msgid "Featured badge background color"
|
340 |
+
#~ msgstr "Colore sfondo adesivo \"in evidenza\""
|
341 |
+
|
342 |
+
#~ msgid "Featured badge color"
|
343 |
+
#~ msgstr "Colore adesivo \"in evidenza\""
|
344 |
+
|
345 |
+
#~ msgid "Hide featured bagde if the product is on sale"
|
346 |
+
#~ msgstr "Nascondi adesivo \"in evidenza\" per i prodotti in saldo"
|
347 |
+
|
348 |
+
#~ msgid "Title & Excerpt"
|
349 |
+
#~ msgstr "Titolo & Riassunto"
|
350 |
+
|
351 |
+
#~ msgid "Title color"
|
352 |
+
#~ msgstr "Colore titolo"
|
353 |
+
|
354 |
+
#~ msgid "Show excerpt"
|
355 |
+
#~ msgstr "Mostra riassunto"
|
356 |
+
|
357 |
+
#~ msgid "Show excerpt of product"
|
358 |
+
#~ msgstr "Mostra riassunto prodotto"
|
359 |
+
|
360 |
+
#~ msgid "Number of words to show in excerpt"
|
361 |
+
#~ msgstr "Numero di parole da mostrare nel riassunto"
|
362 |
+
|
363 |
+
#~ msgid "\"View All\" Link"
|
364 |
+
#~ msgstr "Link \"Visualizza tutto\""
|
365 |
+
|
366 |
+
#~ msgid "Show \"view all\" link"
|
367 |
+
#~ msgstr "Mostra link \"Visualizza tutto\""
|
368 |
+
|
369 |
+
#~ msgid "Add a link to the bottom of results"
|
370 |
+
#~ msgstr "Aggiungi un link sotto tutti i risultati"
|
371 |
+
|
372 |
+
#~ msgid "Text of \"view all\" link"
|
373 |
+
#~ msgstr "Testo del link \"Visualizza tutto\""
|
374 |
+
|
375 |
+
#~ msgid "Add a link at the bottom of results"
|
376 |
+
#~ msgstr "Aggiungi un link sotto tutti i risultati"
|
377 |
+
|
378 |
+
#~ msgid "View all"
|
379 |
+
#~ msgstr "Visualizza tutto"
|
380 |
+
|
381 |
+
#~ msgid "Search settings"
|
382 |
+
#~ msgstr "Impostazioni di ricerca"
|
383 |
+
|
384 |
+
#~ msgid "Choose element types to search"
|
385 |
+
#~ msgstr "Scegli il tipo di elementi da cercare"
|
386 |
+
|
387 |
+
#~ msgid "Choose if you want to extend search also to posts and pages"
|
388 |
+
#~ msgstr "Scegli se estendere la ricerca anche ad articoli e pagine"
|
389 |
+
|
390 |
+
#~ msgid "All"
|
391 |
+
#~ msgstr "Tutti"
|
392 |
+
|
393 |
+
#~ msgid "Products"
|
394 |
+
#~ msgstr "Prodotti"
|
395 |
+
|
396 |
+
#~ msgid "Search in excerpt"
|
397 |
+
#~ msgstr "Cerca in riassunto"
|
398 |
+
|
399 |
+
#~ msgid "Extend search in the excerpt of the product"
|
400 |
+
#~ msgstr "Estendi ricerca anche al riassunto del prodotto"
|
401 |
+
|
402 |
+
#~ msgid "Search in content"
|
403 |
+
#~ msgstr "Cerca nel contenuto"
|
404 |
+
|
405 |
+
#~ msgid "Extend search in the content of the product"
|
406 |
+
#~ msgstr "Estendi ricerca anche al contenuto del prodotto"
|
407 |
+
|
408 |
+
#~ msgid "Search in product categories"
|
409 |
+
#~ msgstr "Cerca tra le categorie prodotto"
|
410 |
+
|
411 |
+
#~ msgid "Extend search in product categories"
|
412 |
+
#~ msgstr "Estendi ricerca alle categorie prodotto"
|
413 |
+
|
414 |
+
#~ msgid "Search in product tags"
|
415 |
+
#~ msgstr "Cerca fra i tag del prodotto"
|
416 |
+
|
417 |
+
#~ msgid "Extend search in product tags"
|
418 |
+
#~ msgstr "Estendi ricerca ai tag del prodotto"
|
419 |
+
|
420 |
+
#~ msgid "Multiple Word Search"
|
421 |
+
#~ msgstr "Ricerca per più parole"
|
422 |
+
|
423 |
+
#~ msgid "Show items containing all words typed"
|
424 |
+
#~ msgstr "Mostra articoli contenenti tutte le parole inserite"
|
425 |
+
|
426 |
+
#~ msgid "Show items containing al least one of the words typed"
|
427 |
+
#~ msgstr "Mostra articoli contenenti almeno una delle parole inserite"
|
428 |
+
|
429 |
+
#~ msgid "Search by Sku Settings"
|
430 |
+
#~ msgstr "Impostazioni per Cerca per SKU "
|
431 |
+
|
432 |
+
#~ msgid ""
|
433 |
+
#~ "Extend search functionality so that search includes also sku. Attention: "
|
434 |
+
#~ "this feature may slow down the search process on some servers."
|
435 |
+
#~ msgstr ""
|
436 |
+
#~ "Estendi la funzionalità di ricerca in modo tale che sia incluso anche lo "
|
437 |
+
#~ "SKU del prodotto. Attenzione: questa funzionalità potrebbe rallentare il "
|
438 |
+
#~ "processo di ricerca su alcuni server."
|
439 |
+
|
440 |
+
#~ msgid "Search by sku"
|
441 |
+
#~ msgstr "Cerca per SKU"
|
442 |
+
|
443 |
+
#~ msgid "Extend search functionality so that search includes also sku"
|
444 |
+
#~ msgstr ""
|
445 |
+
#~ "Estendi la funzionalità di ricerca in modo tale da includere anche lo SKU"
|
446 |
+
|
447 |
+
#~ msgid "Search by sku variable products"
|
448 |
+
#~ msgstr "Cerca tra prodotti con SKU variabile"
|
449 |
+
|
450 |
+
#~ msgid "Extend sku search including variable products."
|
451 |
+
#~ msgstr "Estendi ricerca SKU includendo prodotti variabili."
|
452 |
+
|
453 |
+
#~ msgid "Maximum number of results showed in autosuggest box."
|
454 |
+
#~ msgstr "Numero massimo di risultati da mostrare nel riquadro suggerimenti."
|
455 |
+
|
456 |
+
#~ msgid "Additional Features"
|
457 |
+
#~ msgstr "Funzionalità aggiuntive"
|
458 |
+
|
459 |
+
#~ msgid ""
|
460 |
+
#~ "If these options are not showed, your theme may not support these "
|
461 |
+
#~ "features. Please, contact the developer of theme to implement them."
|
462 |
+
#~ msgstr ""
|
463 |
+
#~ "Se non visualizzi queste opzioni, il tuo tema potrebbe non supportare "
|
464 |
+
#~ "queste funzionalità. Contatta lo sviluppatore del tuo tema per "
|
465 |
+
#~ "implementarle."
|
466 |
+
|
467 |
+
#~ msgid "Show filter for search fields"
|
468 |
+
#~ msgstr "Mostra filtro per campi di ricerca"
|
469 |
+
|
470 |
+
#~ msgid ""
|
471 |
+
#~ "Show filter for search fields (it allows searching the Whole site or only "
|
472 |
+
#~ "among products)"
|
473 |
+
#~ msgstr ""
|
474 |
+
#~ "Mostra filtro per campi di ricerca (consente la ricerca in tutto il sito "
|
475 |
+
#~ "o solo tra i prodotti)"
|
476 |
+
|
477 |
+
#~ msgid "Show the category list"
|
478 |
+
#~ msgstr "Mostra lista categorie"
|
479 |
+
|
480 |
+
#~ msgid "Categories to show"
|
481 |
+
#~ msgstr "Categorie da mostrare"
|
482 |
+
|
483 |
+
#~ msgid ""
|
484 |
+
#~ "This option lets you decide to show all the categories or only the main "
|
485 |
+
#~ "ones"
|
486 |
+
#~ msgstr ""
|
487 |
+
#~ "Con questa opzione puoi scegliere di mostrare tutte le categorie o solo "
|
488 |
+
#~ "le principali"
|
489 |
+
|
490 |
+
#~ msgid "Main Categories"
|
491 |
+
#~ msgstr "Categorie principali"
|
492 |
+
|
493 |
+
#~ msgid "All Categories"
|
494 |
+
#~ msgstr "Tutte le categorie"
|
495 |
+
|
496 |
+
#~ msgid "Test of \"view all\" link"
|
497 |
+
#~ msgstr "Testo di"
|
498 |
+
|
499 |
+
#, fuzzy
|
500 |
+
#~ msgid "Search %s"
|
501 |
+
#~ msgstr "Cerca"
|
502 |
+
|
503 |
+
#, fuzzy
|
504 |
+
#~ msgid "Search Categories"
|
505 |
+
#~ msgstr "Cerca:"
|
506 |
+
|
507 |
+
#, fuzzy
|
508 |
+
#~ msgid "%s Settings"
|
509 |
+
#~ msgstr "Impostazioni"
|
510 |
+
|
511 |
+
#, fuzzy
|
512 |
+
#~ msgid "layout settings"
|
513 |
+
#~ msgstr "Impostazioni"
|
514 |
+
|
515 |
+
#, fuzzy
|
516 |
+
#~ msgid "Plugin Settings"
|
517 |
+
#~ msgstr "Impostazioni"
|
518 |
+
|
519 |
+
#, fuzzy
|
520 |
+
#~ msgid "Settings saved"
|
521 |
+
#~ msgstr "Impostazioni"
|
522 |
+
|
523 |
+
#, fuzzy
|
524 |
+
#~ msgid "Settings reset"
|
525 |
+
#~ msgstr "Impostazioni"
|
526 |
+
|
527 |
+
#, fuzzy
|
528 |
+
#~ msgid "Maximum number of activations exceeded"
|
529 |
+
#~ msgstr "Numero massimo di risultati"
|
530 |
+
|
531 |
+
#, fuzzy
|
532 |
+
#~ msgid "Search for a product"
|
533 |
+
#~ msgstr "Cerca prodotto"
|
534 |
+
|
535 |
+
#, fuzzy
|
536 |
+
#~ msgid "Select"
|
537 |
+
#~ msgstr "Seleziona una data"
|
538 |
+
|
539 |
+
#, fuzzy
|
540 |
+
#~ msgid "File Upload"
|
541 |
+
#~ msgstr "Upload"
|
542 |
+
|
543 |
+
#, fuzzy
|
544 |
+
#~ msgid "Click to toggle"
|
545 |
+
#~ msgstr "Clicca per anteprima"
|
546 |
+
|
547 |
+
#, fuzzy
|
548 |
+
#~ msgid "Insert the title for the field."
|
549 |
+
#~ msgstr "Seleziona un font"
|
550 |
+
|
551 |
+
#, fuzzy
|
552 |
+
#~ msgid "Select the type for this field."
|
553 |
+
#~ msgstr "Seleziona un font"
|
554 |
+
|
555 |
+
#, fuzzy
|
556 |
+
#~ msgid "Selected"
|
557 |
+
#~ msgstr "Seleziona una data"
|
558 |
+
|
559 |
+
#~ msgid "Upload"
|
560 |
+
#~ msgstr "Upload"
|
561 |
+
|
562 |
+
#~ msgid "px"
|
563 |
+
#~ msgstr "px"
|
564 |
+
|
565 |
+
#~ msgid "em"
|
566 |
+
#~ msgstr "em"
|
567 |
+
|
568 |
+
#~ msgid "pt"
|
569 |
+
#~ msgstr "pt"
|
570 |
+
|
571 |
+
#~ msgid "rem"
|
572 |
+
#~ msgstr "rem"
|
573 |
+
|
574 |
+
#~ msgid "Regular"
|
575 |
+
#~ msgstr "Regular"
|
576 |
+
|
577 |
+
#~ msgid "Bold"
|
578 |
+
#~ msgstr "Bold"
|
579 |
+
|
580 |
+
#~ msgid "Extra bold"
|
581 |
+
#~ msgstr "Extra bold"
|
582 |
+
|
583 |
+
#~ msgid "Italic"
|
584 |
+
#~ msgstr "Italic"
|
585 |
+
|
586 |
+
#~ msgid "Italic bold"
|
587 |
+
#~ msgstr "Italic bold"
|
588 |
+
|
589 |
+
#~ msgid "Label for Search submit field."
|
590 |
+
#~ msgstr "Etichetta per il campo di submit"
|
591 |
+
|
592 |
+
#~ msgid "Docs"
|
593 |
+
#~ msgstr "Documentazione"
|
594 |
+
|
595 |
+
#~ msgid "Hours"
|
596 |
+
#~ msgstr "Ore"
|
597 |
+
|
598 |
+
#~ msgid "Minutes"
|
599 |
+
#~ msgstr "Minuti"
|
modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-pt_PT.mo
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search-pt_PT.po
ADDED
@@ -0,0 +1,1107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Ajax Search\n"
|
4 |
+
"POT-Creation-Date: 2015-04-24 14:41+0100\n"
|
5 |
+
"PO-Revision-Date: 2015-04-24 14:41+0100\n"
|
6 |
+
"Last-Translator: Luis Maia <lmsm76@gmail.com>\n"
|
7 |
+
"Language-Team: Your Inspiration Themes <plugins@yithemes.com>\n"
|
8 |
+
"Language: it_IT\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.6.6\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;_x\n"
|
14 |
+
"X-Poedit-Basepath: ./\n"
|
15 |
+
"X-Poedit-SearchPath-0: ..\n"
|
16 |
+
|
17 |
+
#: ../class.yith-wcas-admin.php:106 ../class.yith-wcas-admin.php:128
|
18 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1048
|
19 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1196
|
20 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1202
|
21 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:64
|
22 |
+
msgid "Settings"
|
23 |
+
msgstr "Definições"
|
24 |
+
|
25 |
+
#: ../class.yith-wcas-admin.php:107 ../class.yith-wcas-admin.php:129
|
26 |
+
msgid "Premium Version"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: ../class.yith-wcas-admin.php:135 ../class.yith-wcas-admin.php:136
|
30 |
+
msgid "Ajax Search"
|
31 |
+
msgstr "Ajax Search"
|
32 |
+
|
33 |
+
#: ../class.yith-wcas-admin.php:190
|
34 |
+
msgid "Plugin Documentation"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: ../class.yith-wcas-admin.php:207 ../plugin-options/settings-options.php:24
|
38 |
+
#: ../plugin-options/settings-options.php:31
|
39 |
+
#, fuzzy
|
40 |
+
msgid "YITH WooCommerce Ajax Search"
|
41 |
+
msgstr "YITH WooCommerce Ajax Product Search"
|
42 |
+
|
43 |
+
#: ../class.yith-wcas-admin.php:208
|
44 |
+
msgid ""
|
45 |
+
"In the YIT Plugin tab you can find the YITH WooCommerce Ajax Search "
|
46 |
+
"options.\n"
|
47 |
+
"With this menu, you can access to all the settings of our plugins that you "
|
48 |
+
"have activated.\n"
|
49 |
+
"YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version "
|
50 |
+
"with many new options, <a href=\""
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../class.yith-wcas-admin.php:221
|
54 |
+
#, fuzzy
|
55 |
+
msgid "YITH WooCommerce Ajax Search Updated"
|
56 |
+
msgstr "YITH WooCommerce Ajax Product Search"
|
57 |
+
|
58 |
+
#: ../class.yith-wcas-admin.php:222
|
59 |
+
msgid ""
|
60 |
+
"From now on, you can find all the options of YITH WooCommerce Ajax Search "
|
61 |
+
"Updated under YIT Plugin -> Ajax Search instead of WooCommerce -> Settings -"
|
62 |
+
"> Ajax Search, as in the previous version.\n"
|
63 |
+
"When one of our plugins updates, a new voice will be added to this menu.\n"
|
64 |
+
"YITH WooCommerce Ajax Search renovates with new available options, discover "
|
65 |
+
"the <a href=\""
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#: ../class.yith-wcas.php:172
|
69 |
+
msgid "No results"
|
70 |
+
msgstr "Sem resultados"
|
71 |
+
|
72 |
+
#: ../init.php:40
|
73 |
+
msgid ""
|
74 |
+
"You can't activate the free version of YITH WooCommerce Ajax Search while "
|
75 |
+
"you are using the premium one."
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#: ../init.php:104
|
79 |
+
msgid ""
|
80 |
+
"YITH WooCommerce Ajax Search is enabled but not effective. It requires "
|
81 |
+
"Woocommerce in order to work."
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:460
|
85 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:574
|
86 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:719
|
87 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1632
|
88 |
+
#, php-format
|
89 |
+
msgid "Add %s"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:461
|
93 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:575
|
94 |
+
#, php-format
|
95 |
+
msgid "Add New %s"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:462
|
99 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:576
|
100 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1267
|
101 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1304
|
102 |
+
#, php-format
|
103 |
+
msgid "Edit %s"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:463
|
107 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:577
|
108 |
+
#, php-format
|
109 |
+
msgid "New %s"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:464
|
113 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:578
|
114 |
+
#, php-format
|
115 |
+
msgid "All %s"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:465
|
119 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:579
|
120 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1251
|
121 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1305
|
122 |
+
#, php-format
|
123 |
+
msgid "View %s"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:466
|
127 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:580
|
128 |
+
#, fuzzy, php-format
|
129 |
+
msgid "Search %s"
|
130 |
+
msgstr "Procurar"
|
131 |
+
|
132 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:467
|
133 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:581
|
134 |
+
#, php-format
|
135 |
+
msgid "No %s found"
|
136 |
+
msgstr ""
|
137 |
+
|
138 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:468
|
139 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:582
|
140 |
+
#, php-format
|
141 |
+
msgid "No %s found in Trash"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:625
|
145 |
+
#, php-format
|
146 |
+
msgid "%s Categories"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:626
|
150 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:635
|
151 |
+
msgid "Category"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:627
|
155 |
+
#, fuzzy
|
156 |
+
msgid "Search Categories"
|
157 |
+
msgstr "Procurar por:"
|
158 |
+
|
159 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:628
|
160 |
+
msgid "All Categories"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:629
|
164 |
+
msgid "Parent Category"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:630
|
168 |
+
msgid "Parent Category:"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:631
|
172 |
+
msgid "Edit Category"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:632
|
176 |
+
msgid "Update Category"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:633
|
180 |
+
msgid "Add New Category"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:634
|
184 |
+
msgid "New Category Name"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:724
|
188 |
+
msgid "Categories"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1042
|
192 |
+
#, fuzzy, php-format
|
193 |
+
msgid "%s Settings"
|
194 |
+
msgstr "Definições"
|
195 |
+
|
196 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1051
|
197 |
+
msgid "Type"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1052
|
201 |
+
msgid "Layout for this "
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1058
|
205 |
+
msgid "Rewrite"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1059
|
209 |
+
msgid ""
|
210 |
+
"Univocal identification name in the URL for each product (slug from post if "
|
211 |
+
"empty)"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1064
|
215 |
+
msgid "Label in Singular"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1065
|
219 |
+
msgid "Set a label in singular (title of portfolio if empty)"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1070
|
223 |
+
msgid "Label in Plural"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1071
|
227 |
+
msgid "Set a label in plural (title of portfolio if empty)"
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1076
|
231 |
+
msgid "Taxonomy"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1077
|
235 |
+
msgid ""
|
236 |
+
"If you want to use categories in the portfolio, set a name for taxonomy. "
|
237 |
+
"Name should be a slug (must not contain capital letters nor spaces) and must "
|
238 |
+
"not be more than 32 characters long (database structure restriction)."
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1082
|
242 |
+
msgid "Taxonomy Rewrite"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1083
|
246 |
+
msgid "Set univocal name for each category page URL."
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1088
|
250 |
+
msgid "Single layout"
|
251 |
+
msgstr ""
|
252 |
+
|
253 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1089
|
254 |
+
msgid "Layout for single page of this portfolio"
|
255 |
+
msgstr ""
|
256 |
+
|
257 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1130
|
258 |
+
#, fuzzy
|
259 |
+
msgid "layout settings"
|
260 |
+
msgstr "Definições"
|
261 |
+
|
262 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1222
|
263 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1235
|
264 |
+
msgid "Quick links"
|
265 |
+
msgstr ""
|
266 |
+
|
267 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1475
|
268 |
+
#, php-format
|
269 |
+
msgid "Show frontend of the %s"
|
270 |
+
msgstr ""
|
271 |
+
|
272 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1482
|
273 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:46
|
274 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:90
|
275 |
+
msgid "Name"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1631
|
279 |
+
#, php-format
|
280 |
+
msgid "Add %s from images"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: ../plugin-fw/lib/yit-cpt-unlimited.php:1633
|
284 |
+
msgid "Add with multiupload"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: ../plugin-fw/lib/yit-plugin-panel-wc.php:295
|
288 |
+
msgid "The changes you have made will be lost if you leave this page."
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:63
|
292 |
+
#, fuzzy
|
293 |
+
msgid "Plugin Settings"
|
294 |
+
msgstr "Definições"
|
295 |
+
|
296 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:95
|
297 |
+
#: ../plugin-fw/lib/yit-plugin-subpanel.php:101
|
298 |
+
msgid "YIT Plugins"
|
299 |
+
msgstr ""
|
300 |
+
|
301 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:292
|
302 |
+
#: ../plugin-fw/lib/yit-plugin-subpanel.php:142
|
303 |
+
#: ../plugin-fw/templates/panel/woocommerce/woocommerce-form.php:5
|
304 |
+
msgid "Save Changes"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:295
|
308 |
+
#: ../plugin-fw/templates/panel/woocommerce/woocommerce-form.php:8
|
309 |
+
msgid ""
|
310 |
+
"If you continue with this action, you will reset all options in this page."
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:297
|
314 |
+
#: ../plugin-fw/lib/yit-plugin-subpanel.php:147
|
315 |
+
msgid "Reset to Default"
|
316 |
+
msgstr ""
|
317 |
+
|
318 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:297
|
319 |
+
#: ../plugin-fw/lib/yit-plugin-subpanel.php:147
|
320 |
+
#: ../plugin-fw/templates/panel/woocommerce/woocommerce-form.php:10
|
321 |
+
msgid "Are you sure?"
|
322 |
+
msgstr ""
|
323 |
+
|
324 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:431
|
325 |
+
msgid ""
|
326 |
+
"The element you have entered already exists. Please, enter another name."
|
327 |
+
msgstr ""
|
328 |
+
|
329 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:432
|
330 |
+
#, fuzzy
|
331 |
+
msgid "Settings saved"
|
332 |
+
msgstr "Definições"
|
333 |
+
|
334 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:433
|
335 |
+
#, fuzzy
|
336 |
+
msgid "Settings reset"
|
337 |
+
msgstr "Definições"
|
338 |
+
|
339 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:434
|
340 |
+
msgid "Element deleted correctly."
|
341 |
+
msgstr ""
|
342 |
+
|
343 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:435
|
344 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:436
|
345 |
+
msgid "Element updated correctly."
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:437
|
349 |
+
msgid "Database imported correctly."
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:438
|
353 |
+
msgid "An error has occurred during import. Please try again."
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:439
|
357 |
+
msgid "The added file is not valid."
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:440
|
361 |
+
msgid "Sorry, import is disabled."
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#: ../plugin-fw/lib/yit-plugin-panel.php:441
|
365 |
+
msgid "Sorting successful."
|
366 |
+
msgstr ""
|
367 |
+
|
368 |
+
#: ../plugin-fw/lib/yit-plugin-subpanel.php:145
|
369 |
+
msgid ""
|
370 |
+
"If you continue with this action, you will reset all the options in this "
|
371 |
+
"page."
|
372 |
+
msgstr ""
|
373 |
+
|
374 |
+
#: ../plugin-fw/lib/yit-pointers.php:70
|
375 |
+
msgid "Plugins Activated"
|
376 |
+
msgstr ""
|
377 |
+
|
378 |
+
#: ../plugin-fw/lib/yit-pointers.php:71
|
379 |
+
msgid ""
|
380 |
+
"From now on, you can find all plugin options in YIT Plugin menu.\n"
|
381 |
+
" For each plugin installed, "
|
382 |
+
"customization settings will be available as a new entry in YIT Plugin menu."
|
383 |
+
msgstr ""
|
384 |
+
|
385 |
+
#: ../plugin-fw/lib/yit-pointers.php:73 ../plugin-fw/lib/yit-pointers.php:89
|
386 |
+
msgid "Discover all our plugins available on:"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: ../plugin-fw/lib/yit-pointers.php:74 ../plugin-fw/lib/yit-pointers.php:90
|
390 |
+
msgid "and"
|
391 |
+
msgstr ""
|
392 |
+
|
393 |
+
#: ../plugin-fw/lib/yit-pointers.php:84
|
394 |
+
msgid "Plugins Upgraded"
|
395 |
+
msgstr ""
|
396 |
+
|
397 |
+
#: ../plugin-fw/lib/yit-pointers.php:85
|
398 |
+
msgid ""
|
399 |
+
"From now on, you can find all options of your plugins in YIT Plugin menu.\n"
|
400 |
+
" Any time one of our plugins is updated, "
|
401 |
+
"a new entry will be added to this menu.\n"
|
402 |
+
" For example, after the update, plugin "
|
403 |
+
"options (such as for YITH WooCommerce Wishlist, YITH WooCommerce Ajax "
|
404 |
+
"Search, etc.)\n"
|
405 |
+
" will be moved from previous location to "
|
406 |
+
"YIT Plugin tab."
|
407 |
+
msgstr ""
|
408 |
+
|
409 |
+
#: ../plugin-fw/lib/yit-upgrade.php:123
|
410 |
+
msgid "There is a new version of %plugin_name% available."
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
#: ../plugin-fw/lib/yit-upgrade.php:124
|
414 |
+
msgid "View version %latest% details."
|
415 |
+
msgstr ""
|
416 |
+
|
417 |
+
#: ../plugin-fw/lib/yit-upgrade.php:125
|
418 |
+
msgid "Automatic update is unavailable for this plugin,"
|
419 |
+
msgstr ""
|
420 |
+
|
421 |
+
#: ../plugin-fw/lib/yit-upgrade.php:126
|
422 |
+
msgid ""
|
423 |
+
"please <a href=\"%activate_link%\">activate</a> your copy of %plugin_name%."
|
424 |
+
msgstr ""
|
425 |
+
|
426 |
+
#: ../plugin-fw/lib/yit-upgrade.php:127
|
427 |
+
msgid "Update now."
|
428 |
+
msgstr ""
|
429 |
+
|
430 |
+
#: ../plugin-fw/lib/yit-upgrade.php:230
|
431 |
+
msgid "Yithemes Repository"
|
432 |
+
msgstr ""
|
433 |
+
|
434 |
+
#: ../plugin-fw/lib/yit-upgrade.php:264
|
435 |
+
msgid "Invalid URL Provided."
|
436 |
+
msgstr ""
|
437 |
+
|
438 |
+
#: ../plugin-fw/lib/yit-upgrade.php:277
|
439 |
+
msgid "Could not create Temporary file."
|
440 |
+
msgstr ""
|
441 |
+
|
442 |
+
#: ../plugin-fw/lib/yit-upgrade.php:419
|
443 |
+
#, php-format
|
444 |
+
msgid ""
|
445 |
+
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
446 |
+
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a>."
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
#: ../plugin-fw/lib/yit-upgrade.php:421
|
450 |
+
#, php-format
|
451 |
+
msgid ""
|
452 |
+
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
453 |
+
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a>. <em>You "
|
454 |
+
"have to activate the plugin on a single site of the network to benefit from "
|
455 |
+
"automatic updates.</em>"
|
456 |
+
msgstr ""
|
457 |
+
|
458 |
+
#: ../plugin-fw/lib/yit-upgrade.php:423
|
459 |
+
#, php-format
|
460 |
+
msgid ""
|
461 |
+
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
462 |
+
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a>. "
|
463 |
+
"<em>Automatic update is unavailable for this plugin, please <a href=\"%5$s\" "
|
464 |
+
"title=\"Licence activation\">activate</a> your copy of %6s.</em>"
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
#: ../plugin-fw/lib/yit-upgrade.php:425
|
468 |
+
#, php-format
|
469 |
+
msgid ""
|
470 |
+
"There is a new version of %1$s available. <a href=\"%2$s\" class=\"thickbox "
|
471 |
+
"yit-changelog-button\" title=\"%3$s\">View version %4$s details</a> or <a "
|
472 |
+
"href=\"%5$s\">update now</a>."
|
473 |
+
msgstr ""
|
474 |
+
|
475 |
+
#: ../plugin-fw/lib/yit-upgrade.php:498
|
476 |
+
msgid "You can't update the plugins for this site."
|
477 |
+
msgstr ""
|
478 |
+
|
479 |
+
#: ../plugin-fw/lib/yit-upgrade.php:502
|
480 |
+
msgid ""
|
481 |
+
"You do not have sufficient permissions to update the plugins for this site."
|
482 |
+
msgstr ""
|
483 |
+
|
484 |
+
#: ../plugin-fw/lib/yit-upgrade.php:509
|
485 |
+
msgid "Update Plugin"
|
486 |
+
msgstr ""
|
487 |
+
|
488 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:161
|
489 |
+
#, php-format
|
490 |
+
msgid "%field% field cannot be empty"
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:162
|
494 |
+
msgid "%field_1% and %field_2% fields cannot be empty"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:163
|
498 |
+
msgid "Unable to contact the remote server, please try again later. Thanks!"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:548
|
502 |
+
msgid "Invalid Request"
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:549
|
506 |
+
msgid "Invalid licence key"
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:550
|
510 |
+
msgid "Software has been deactivated"
|
511 |
+
msgstr ""
|
512 |
+
|
513 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:551
|
514 |
+
#, fuzzy
|
515 |
+
msgid "Maximum number of activations exceeded"
|
516 |
+
msgstr "Numero máximo de resultados"
|
517 |
+
|
518 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:552
|
519 |
+
msgid "Invalid instance ID"
|
520 |
+
msgstr ""
|
521 |
+
|
522 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:553
|
523 |
+
msgid "Invalid security key"
|
524 |
+
msgstr ""
|
525 |
+
|
526 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:554
|
527 |
+
msgid "Licence key has expired"
|
528 |
+
msgstr ""
|
529 |
+
|
530 |
+
#: ../plugin-fw/licence/lib/yit-licence.php:555
|
531 |
+
msgid "Licence key has been banned"
|
532 |
+
msgstr ""
|
533 |
+
|
534 |
+
#: ../plugin-fw/licence/lib/yit-plugin-licence.php:64
|
535 |
+
#: ../plugin-fw/licence/lib/yit-plugin-licence.php:65
|
536 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:64
|
537 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:65
|
538 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:107
|
539 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:108
|
540 |
+
msgid "Licence Activation"
|
541 |
+
msgstr ""
|
542 |
+
|
543 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:115
|
544 |
+
#: ../plugin-fw/licence/lib/yit-theme-licence.php:116
|
545 |
+
#, php-format
|
546 |
+
msgid "%s"
|
547 |
+
msgstr ""
|
548 |
+
|
549 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:19
|
550 |
+
msgid "Yithemes Licence Activation"
|
551 |
+
msgstr ""
|
552 |
+
|
553 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:23
|
554 |
+
msgid ""
|
555 |
+
"I cannot find the license key for activating the theme I have bought some "
|
556 |
+
"time ago. Where can I find it?"
|
557 |
+
msgstr ""
|
558 |
+
|
559 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:26
|
560 |
+
msgid ""
|
561 |
+
"If you have purchased one of our products before 27 January 2015, you can "
|
562 |
+
"benefit from support and updates (the services offered with the license)\n"
|
563 |
+
" until 27 January 2016 and you do not have to purchase it again "
|
564 |
+
"to get a new license key, because, before this date, your license used to be "
|
565 |
+
"activated automatically by our system.\n"
|
566 |
+
" After 27 January 2016, instead, if you want to benefit from "
|
567 |
+
"support and updates you have to buy a new license and activate it through "
|
568 |
+
"the license key you will be\n"
|
569 |
+
" provided with and that you can find in your YIThemes account, in "
|
570 |
+
"section \"My licenses\"."
|
571 |
+
msgstr ""
|
572 |
+
|
573 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:37
|
574 |
+
msgid ""
|
575 |
+
"Have you updated your licenses? Have you asked for an extension? Update "
|
576 |
+
"information concerning your products."
|
577 |
+
msgstr ""
|
578 |
+
|
579 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:39
|
580 |
+
msgid "Update licence information"
|
581 |
+
msgstr ""
|
582 |
+
|
583 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:49
|
584 |
+
msgid "Products to be activated"
|
585 |
+
msgstr ""
|
586 |
+
|
587 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:68
|
588 |
+
msgid "Activate"
|
589 |
+
msgstr ""
|
590 |
+
|
591 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:87
|
592 |
+
msgid "Activated"
|
593 |
+
msgstr ""
|
594 |
+
|
595 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:91
|
596 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:123
|
597 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:147
|
598 |
+
msgid "Product Name"
|
599 |
+
msgstr ""
|
600 |
+
|
601 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:92
|
602 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:124
|
603 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:148
|
604 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:148
|
605 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:340
|
606 |
+
msgid "Email"
|
607 |
+
msgstr ""
|
608 |
+
|
609 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:93
|
610 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:125
|
611 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:149
|
612 |
+
msgid "Licence Key"
|
613 |
+
msgstr ""
|
614 |
+
|
615 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:94
|
616 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:150
|
617 |
+
msgid "Expires"
|
618 |
+
msgstr ""
|
619 |
+
|
620 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:95
|
621 |
+
msgid "Remaining"
|
622 |
+
msgstr ""
|
623 |
+
|
624 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:96
|
625 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:109
|
626 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:151
|
627 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:161
|
628 |
+
msgid "Renew"
|
629 |
+
msgstr ""
|
630 |
+
|
631 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:107
|
632 |
+
#, php-format
|
633 |
+
msgid "%1s out of %2s"
|
634 |
+
msgstr ""
|
635 |
+
|
636 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:119
|
637 |
+
msgid "Banned"
|
638 |
+
msgstr ""
|
639 |
+
|
640 |
+
#: ../plugin-fw/licence/templates/panel/activation/activation-panel.php:143
|
641 |
+
msgid "Expired"
|
642 |
+
msgstr ""
|
643 |
+
|
644 |
+
#: ../plugin-fw/templates/metaboxes/types/ajax-products.php:23
|
645 |
+
#, fuzzy
|
646 |
+
msgid "Search for a product"
|
647 |
+
msgstr "Procurar por produtos"
|
648 |
+
|
649 |
+
#: ../plugin-fw/templates/metaboxes/types/categories.php:36
|
650 |
+
msgid "No categories."
|
651 |
+
msgstr ""
|
652 |
+
|
653 |
+
#: ../plugin-fw/templates/metaboxes/types/categories.php:42
|
654 |
+
msgid "+ Add New Category"
|
655 |
+
msgstr ""
|
656 |
+
|
657 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:7
|
658 |
+
msgid "Text Input"
|
659 |
+
msgstr ""
|
660 |
+
|
661 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:8
|
662 |
+
msgid "Checkbox"
|
663 |
+
msgstr ""
|
664 |
+
|
665 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:9
|
666 |
+
#, fuzzy
|
667 |
+
msgid "Select"
|
668 |
+
msgstr "Selecione uma data"
|
669 |
+
|
670 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:10
|
671 |
+
msgid "Textarea"
|
672 |
+
msgstr ""
|
673 |
+
|
674 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:11
|
675 |
+
msgid "Radio Input"
|
676 |
+
msgstr ""
|
677 |
+
|
678 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:12
|
679 |
+
msgid "Password Field"
|
680 |
+
msgstr ""
|
681 |
+
|
682 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:13
|
683 |
+
#, fuzzy
|
684 |
+
msgid "File Upload"
|
685 |
+
msgstr "Carregar"
|
686 |
+
|
687 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:47
|
688 |
+
msgid "Theme Icon"
|
689 |
+
msgstr ""
|
690 |
+
|
691 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:48
|
692 |
+
msgid "Custom Icon"
|
693 |
+
msgstr ""
|
694 |
+
|
695 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:49
|
696 |
+
#: ../plugin-fw/templates/metaboxes/types/responsivesliders.php:24
|
697 |
+
msgid "None"
|
698 |
+
msgstr ""
|
699 |
+
|
700 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:60
|
701 |
+
msgid "Add field"
|
702 |
+
msgstr ""
|
703 |
+
|
704 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:69
|
705 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:261
|
706 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:37
|
707 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:82
|
708 |
+
msgid "Remove"
|
709 |
+
msgstr ""
|
710 |
+
|
711 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:70
|
712 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:262
|
713 |
+
#, fuzzy
|
714 |
+
msgid "Click to toggle"
|
715 |
+
msgstr "Clicar para pré-visualizar"
|
716 |
+
|
717 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:77
|
718 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:269
|
719 |
+
msgid "Title Field"
|
720 |
+
msgstr ""
|
721 |
+
|
722 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:81
|
723 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:273
|
724 |
+
#, fuzzy
|
725 |
+
msgid "Insert the title for the field."
|
726 |
+
msgstr "Selecione uma fonte"
|
727 |
+
|
728 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:86
|
729 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:278
|
730 |
+
msgid "Data Name"
|
731 |
+
msgstr ""
|
732 |
+
|
733 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:90
|
734 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:282
|
735 |
+
msgid ""
|
736 |
+
"REQUIRED: Field identification name to be entered into email body. "
|
737 |
+
"<strong>Note:</strong>Use only lowercase characters and underscores."
|
738 |
+
msgstr ""
|
739 |
+
|
740 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:95
|
741 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:287
|
742 |
+
msgid "Type field"
|
743 |
+
msgstr ""
|
744 |
+
|
745 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:103
|
746 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:295
|
747 |
+
#, fuzzy
|
748 |
+
msgid "Select the type for this field."
|
749 |
+
msgstr "Selecione uma fonte"
|
750 |
+
|
751 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:108
|
752 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:300
|
753 |
+
msgid "Checked"
|
754 |
+
msgstr ""
|
755 |
+
|
756 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:112
|
757 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:304
|
758 |
+
msgid "Select this option if you want this field appears as already checked."
|
759 |
+
msgstr ""
|
760 |
+
|
761 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:117
|
762 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:309
|
763 |
+
msgid "Add options "
|
764 |
+
msgstr ""
|
765 |
+
|
766 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:118
|
767 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:310
|
768 |
+
msgid "Add option"
|
769 |
+
msgstr ""
|
770 |
+
|
771 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:121
|
772 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:313
|
773 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:436
|
774 |
+
#, fuzzy
|
775 |
+
msgid "Selected"
|
776 |
+
msgstr "Selecione uma data"
|
777 |
+
|
778 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:124
|
779 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:316
|
780 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:436
|
781 |
+
msgid "Delete option"
|
782 |
+
msgstr ""
|
783 |
+
|
784 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:130
|
785 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:322
|
786 |
+
msgid "Error Message"
|
787 |
+
msgstr ""
|
788 |
+
|
789 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:134
|
790 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:326
|
791 |
+
msgid "Insert the error message for validation."
|
792 |
+
msgstr ""
|
793 |
+
|
794 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:139
|
795 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:331
|
796 |
+
msgid "Required"
|
797 |
+
msgstr ""
|
798 |
+
|
799 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:143
|
800 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:335
|
801 |
+
msgid "Select this option if it must be required."
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:152
|
805 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:344
|
806 |
+
msgid "Select this option if the email must be valid."
|
807 |
+
msgstr ""
|
808 |
+
|
809 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:157
|
810 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:349
|
811 |
+
msgid "Reply To"
|
812 |
+
msgstr ""
|
813 |
+
|
814 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:161
|
815 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:353
|
816 |
+
msgid "Select this if it is the email you can reply to."
|
817 |
+
msgstr ""
|
818 |
+
|
819 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:166
|
820 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:358
|
821 |
+
msgid "Class"
|
822 |
+
msgstr ""
|
823 |
+
|
824 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:170
|
825 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:362
|
826 |
+
msgid ""
|
827 |
+
"Insert additional class(es) (separated by commas) for more personalization."
|
828 |
+
msgstr ""
|
829 |
+
|
830 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:175
|
831 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:367
|
832 |
+
msgid "Icon"
|
833 |
+
msgstr ""
|
834 |
+
|
835 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:203
|
836 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:391
|
837 |
+
#: ../plugin-fw/templates/metaboxes/types/icon-list.php:69
|
838 |
+
#: ../plugin-fw/templates/metaboxes/types/select-icon.php:33
|
839 |
+
#: ../plugin-fw/templates/metaboxes/types/upload.php:21
|
840 |
+
#: ../plugin-fw/templates/panel/types/upload.php:31
|
841 |
+
#: ../plugin-fw/templates/panel/woocommerce/woocommerce-upload.php:35
|
842 |
+
msgid "Upload"
|
843 |
+
msgstr "Carregar"
|
844 |
+
|
845 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:209
|
846 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:397
|
847 |
+
#: ../plugin-fw/templates/metaboxes/types/icon-list.php:75
|
848 |
+
#: ../plugin-fw/templates/metaboxes/types/select-icon.php:39
|
849 |
+
msgid "Image preview"
|
850 |
+
msgstr ""
|
851 |
+
|
852 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:217
|
853 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:405
|
854 |
+
msgid "Insert an icon for more personalization."
|
855 |
+
msgstr ""
|
856 |
+
|
857 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:222
|
858 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:409
|
859 |
+
msgid "Width"
|
860 |
+
msgstr ""
|
861 |
+
|
862 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:247
|
863 |
+
#: ../plugin-fw/templates/metaboxes/types/contactform.php:421
|
864 |
+
msgid "Set field length."
|
865 |
+
msgstr ""
|
866 |
+
|
867 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:28
|
868 |
+
msgid "Close all"
|
869 |
+
msgstr ""
|
870 |
+
|
871 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:28
|
872 |
+
msgid "Expand all"
|
873 |
+
msgstr ""
|
874 |
+
|
875 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:52
|
876 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:95
|
877 |
+
msgid "Value"
|
878 |
+
msgstr ""
|
879 |
+
|
880 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:53
|
881 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:96
|
882 |
+
msgid "Content of the tab. (HTML is supported)"
|
883 |
+
msgstr ""
|
884 |
+
|
885 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:65
|
886 |
+
msgid "Add custom product tab"
|
887 |
+
msgstr ""
|
888 |
+
|
889 |
+
#: ../plugin-fw/templates/metaboxes/types/customtabs.php:107
|
890 |
+
msgid "Do you want to remove the custom tab?"
|
891 |
+
msgstr ""
|
892 |
+
|
893 |
+
#: ../plugin-fw/templates/metaboxes/types/icon-list.php:89
|
894 |
+
#, php-format
|
895 |
+
msgid "(Default: %s <img src=\"%s\"/>)"
|
896 |
+
msgstr ""
|
897 |
+
|
898 |
+
#: ../plugin-fw/templates/metaboxes/types/icon-list.php:91
|
899 |
+
#, php-format
|
900 |
+
msgid "(Default: <i %s></i> )"
|
901 |
+
msgstr ""
|
902 |
+
|
903 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:40
|
904 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:45
|
905 |
+
#: ../plugin-fw/templates/metaboxes/types/images.php:38
|
906 |
+
#: ../plugin-fw/templates/metaboxes/types/images.php:64
|
907 |
+
msgid "Delete image"
|
908 |
+
msgstr ""
|
909 |
+
|
910 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:45
|
911 |
+
msgid "Add Images to Gallery"
|
912 |
+
msgstr ""
|
913 |
+
|
914 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:45
|
915 |
+
msgid "Add to gallery"
|
916 |
+
msgstr ""
|
917 |
+
|
918 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:45
|
919 |
+
msgid "Add images"
|
920 |
+
msgstr ""
|
921 |
+
|
922 |
+
#: ../plugin-fw/templates/metaboxes/types/image-gallery.php:45
|
923 |
+
msgid "Delete"
|
924 |
+
msgstr ""
|
925 |
+
|
926 |
+
#: ../plugin-fw/templates/metaboxes/types/images.php:42
|
927 |
+
msgid "Upload new images"
|
928 |
+
msgstr ""
|
929 |
+
|
930 |
+
#: ../plugin-fw/templates/metaboxes/types/images.php:75
|
931 |
+
msgid "Are you sure you want to remove this image?"
|
932 |
+
msgstr ""
|
933 |
+
|
934 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebar-layout.php:25
|
935 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:36
|
936 |
+
msgid "Left sidebar"
|
937 |
+
msgstr ""
|
938 |
+
|
939 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebar-layout.php:28
|
940 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:42
|
941 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:45
|
942 |
+
msgid "No sidebar"
|
943 |
+
msgstr ""
|
944 |
+
|
945 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebar-layout.php:31
|
946 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:39
|
947 |
+
msgid "Right sidebar"
|
948 |
+
msgstr ""
|
949 |
+
|
950 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebar-layout.php:34
|
951 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:53
|
952 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:64
|
953 |
+
msgid "Choose a sidebar"
|
954 |
+
msgstr ""
|
955 |
+
|
956 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:51
|
957 |
+
msgid "Left Sidebar"
|
958 |
+
msgstr ""
|
959 |
+
|
960 |
+
#: ../plugin-fw/templates/metaboxes/types/sidebars.php:62
|
961 |
+
msgid "Right Sidebar"
|
962 |
+
msgstr ""
|
963 |
+
|
964 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:42
|
965 |
+
msgid "px"
|
966 |
+
msgstr "px"
|
967 |
+
|
968 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:43
|
969 |
+
msgid "em"
|
970 |
+
msgstr "em"
|
971 |
+
|
972 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:44
|
973 |
+
msgid "pt"
|
974 |
+
msgstr "pt"
|
975 |
+
|
976 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:45
|
977 |
+
msgid "rem"
|
978 |
+
msgstr "rem"
|
979 |
+
|
980 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:59
|
981 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:153
|
982 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:217
|
983 |
+
msgid "Web fonts"
|
984 |
+
msgstr ""
|
985 |
+
|
986 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:71
|
987 |
+
msgid "Google fonts"
|
988 |
+
msgstr ""
|
989 |
+
|
990 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:96
|
991 |
+
msgid "Regular"
|
992 |
+
msgstr "Regular"
|
993 |
+
|
994 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:97
|
995 |
+
msgid "Bold"
|
996 |
+
msgstr "Bold"
|
997 |
+
|
998 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:98
|
999 |
+
msgid "Extra bold"
|
1000 |
+
msgstr "Extra bold"
|
1001 |
+
|
1002 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:99
|
1003 |
+
msgid "Italic"
|
1004 |
+
msgstr "Italic"
|
1005 |
+
|
1006 |
+
#: ../plugin-fw/templates/metaboxes/types/typography.php:100
|
1007 |
+
msgid "Italic bold"
|
1008 |
+
msgstr "Italic bold"
|
1009 |
+
|
1010 |
+
#: ../plugin-fw/templates/panel/woocommerce/woocommerce-form.php:10
|
1011 |
+
msgid "Reset Defaults"
|
1012 |
+
msgstr ""
|
1013 |
+
|
1014 |
+
#: ../plugin-options/settings-options.php:21
|
1015 |
+
msgid "Upgrade to the PREMIUM VERSION"
|
1016 |
+
msgstr ""
|
1017 |
+
|
1018 |
+
#: ../plugin-options/settings-options.php:25
|
1019 |
+
msgid "Discover the Advanced Features"
|
1020 |
+
msgstr ""
|
1021 |
+
|
1022 |
+
#: ../plugin-options/settings-options.php:26
|
1023 |
+
msgid ""
|
1024 |
+
"Upgrade to the PREMIUM VERSION\n"
|
1025 |
+
"of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!"
|
1026 |
+
msgstr ""
|
1027 |
+
|
1028 |
+
#: ../plugin-options/settings-options.php:33
|
1029 |
+
msgid "Get Support and Pro Features"
|
1030 |
+
msgstr ""
|
1031 |
+
|
1032 |
+
#: ../plugin-options/settings-options.php:34
|
1033 |
+
msgid ""
|
1034 |
+
"By purchasing the premium version of the plugin, you will take advantage of "
|
1035 |
+
"the advanced features of the product and you will get one year of free "
|
1036 |
+
"updates and support through our platform available 24h/24."
|
1037 |
+
msgstr ""
|
1038 |
+
|
1039 |
+
#: ../plugin-options/settings-options.php:44
|
1040 |
+
#, fuzzy
|
1041 |
+
msgid "General settings"
|
1042 |
+
msgstr "Definições Gerais"
|
1043 |
+
|
1044 |
+
#: ../plugin-options/settings-options.php:53
|
1045 |
+
msgid "Search input label"
|
1046 |
+
msgstr "Etiqueta Entrada Dados"
|
1047 |
+
|
1048 |
+
#: ../plugin-options/settings-options.php:55
|
1049 |
+
#: ../plugin-options/settings-options.php:63
|
1050 |
+
msgid "Label for Search input field."
|
1051 |
+
msgstr "Etiqueta para campo introdução Procura Dados."
|
1052 |
+
|
1053 |
+
#: ../plugin-options/settings-options.php:57
|
1054 |
+
msgid "Search for products"
|
1055 |
+
msgstr "Procurar por produtos"
|
1056 |
+
|
1057 |
+
#: ../plugin-options/settings-options.php:61
|
1058 |
+
msgid "Search submit label"
|
1059 |
+
msgstr "Etiqueta do botão submeter"
|
1060 |
+
|
1061 |
+
#: ../plugin-options/settings-options.php:65
|
1062 |
+
msgid "Search"
|
1063 |
+
msgstr "Procurar"
|
1064 |
+
|
1065 |
+
#: ../plugin-options/settings-options.php:69
|
1066 |
+
msgid "Minimum number of characters"
|
1067 |
+
msgstr "Numero minimo caracteres"
|
1068 |
+
|
1069 |
+
#: ../plugin-options/settings-options.php:70
|
1070 |
+
msgid "Minimum number of characters required to trigger autosuggest."
|
1071 |
+
msgstr "Numero de caracteres necessário para ativar a autosugestão"
|
1072 |
+
|
1073 |
+
#: ../plugin-options/settings-options.php:83
|
1074 |
+
msgid "Maximum number of results"
|
1075 |
+
msgstr "Numero máximo de resultados"
|
1076 |
+
|
1077 |
+
#: ../plugin-options/settings-options.php:84
|
1078 |
+
msgid "Maximum number of results showed within the autosuggest box."
|
1079 |
+
msgstr "Numero máximo de resultados a mostrar na caixa de autosugestão"
|
1080 |
+
|
1081 |
+
#: ../templates/yith-woocommerce-ajax-search.php:20
|
1082 |
+
msgid "Search for:"
|
1083 |
+
msgstr "Procurar por:"
|
1084 |
+
|
1085 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:29
|
1086 |
+
msgid "An Ajax Search box for products only."
|
1087 |
+
msgstr "Uma caixa de Procura somente de produtos em Ajax"
|
1088 |
+
|
1089 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:31
|
1090 |
+
msgid "YITH WooCommerce Ajax Product Search"
|
1091 |
+
msgstr "YITH WooCommerce Ajax Product Search"
|
1092 |
+
|
1093 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:90
|
1094 |
+
msgid "Title:"
|
1095 |
+
msgstr "Titulo:"
|
1096 |
+
|
1097 |
+
#~ msgid "Label for Search submit field."
|
1098 |
+
#~ msgstr "Etiqueta para o campo do botão Procurar"
|
1099 |
+
|
1100 |
+
#~ msgid "Docs"
|
1101 |
+
#~ msgstr "Documentação"
|
1102 |
+
|
1103 |
+
#~ msgid "Hours"
|
1104 |
+
#~ msgstr "Horas"
|
1105 |
+
|
1106 |
+
#~ msgid "Minutes"
|
1107 |
+
#~ msgstr "Minutos"
|
modules/yith-woocommerce-ajax-search/languages/yith-woocommerce-ajax-search.pot
ADDED
@@ -0,0 +1,233 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Project-Id-Version: YITH WooCommerce Ajax Search Free\n"
|
5 |
+
"POT-Creation-Date: 2015-09-18 11:22+0200\n"
|
6 |
+
"PO-Revision-Date: 2015-07-17 09:42+0100\n"
|
7 |
+
"Last-Translator: \n"
|
8 |
+
"Language-Team: Yithemes <plugins@yithemes.com>\n"
|
9 |
+
"Language: en\n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.4\n"
|
14 |
+
"X-Poedit-KeywordsList: __;_e;_x\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
19 |
+
|
20 |
+
#: ../class.yith-wcas-admin.php:106 ../class.yith-wcas-admin.php:128
|
21 |
+
msgid "Settings"
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: ../class.yith-wcas-admin.php:107 ../class.yith-wcas-admin.php:129
|
25 |
+
msgid "Premium Version"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: ../class.yith-wcas-admin.php:135 ../class.yith-wcas-admin.php:136
|
29 |
+
msgid "Ajax Search"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: ../class.yith-wcas-admin.php:190
|
33 |
+
msgid "Plugin Documentation"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: ../class.yith-wcas-admin.php:207 ../plugin-options/settings-options.php:24
|
37 |
+
#: ../plugin-options/settings-options.php:31
|
38 |
+
msgid "YITH WooCommerce Ajax Search"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: ../class.yith-wcas-admin.php:208
|
42 |
+
msgid ""
|
43 |
+
"In the YIT Plugin tab you can find the YITH WooCommerce Ajax Search "
|
44 |
+
"options.\n"
|
45 |
+
"With this menu, you can access to all the settings of our plugins that you "
|
46 |
+
"have activated.\n"
|
47 |
+
"YITH WooCommerce Ajax Search is available in an outstanding PREMIUM version "
|
48 |
+
"with many new options, <a href=\""
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: ../class.yith-wcas-admin.php:221
|
52 |
+
msgid "YITH WooCommerce Ajax Search Updated"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: ../class.yith-wcas-admin.php:222
|
56 |
+
msgid ""
|
57 |
+
"From now on, you can find all the options of YITH WooCommerce Ajax Search "
|
58 |
+
"Updated under YIT Plugin -> Ajax Search instead of WooCommerce -> Settings -"
|
59 |
+
"> Ajax Search, as in the previous version.\n"
|
60 |
+
"When one of our plugins updates, a new voice will be added to this menu.\n"
|
61 |
+
"YITH WooCommerce Ajax Search renovates with new available options, discover "
|
62 |
+
"the <a href=\""
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: ../class.yith-wcas.php:175
|
66 |
+
msgid "No results"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: ../init.php:40
|
70 |
+
msgid ""
|
71 |
+
"You can't activate the free version of YITH WooCommerce Ajax Search while "
|
72 |
+
"you are using the premium one."
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: ../init.php:104
|
76 |
+
msgid ""
|
77 |
+
"YITH WooCommerce Ajax Search is enabled but not effective. It requires "
|
78 |
+
"WooCommerce in order to work."
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: ../plugin-options/settings-options.php:21
|
82 |
+
msgid "Upgrade to the PREMIUM VERSION"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: ../plugin-options/settings-options.php:25
|
86 |
+
msgid "Discover the Advanced Features"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: ../plugin-options/settings-options.php:26
|
90 |
+
msgid ""
|
91 |
+
"Upgrade to the PREMIUM VERSION\n"
|
92 |
+
"of YITH WOOCOMMERCE AJAX SEARCH to benefit from all features!"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: ../plugin-options/settings-options.php:33
|
96 |
+
msgid "Get Support and Pro Features"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: ../plugin-options/settings-options.php:34
|
100 |
+
msgid ""
|
101 |
+
"By purchasing the premium version of the plugin, you will take advantage of "
|
102 |
+
"the advanced features of the product and you will get one year of free "
|
103 |
+
"updates and support through our platform available 24h/24."
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: ../plugin-options/settings-options.php:44
|
107 |
+
msgid "General settings"
|
108 |
+
msgstr ""
|
109 |
+
|
110 |
+
#: ../plugin-options/settings-options.php:53
|
111 |
+
msgid "Search input label"
|
112 |
+
msgstr ""
|
113 |
+
|
114 |
+
#: ../plugin-options/settings-options.php:55
|
115 |
+
#: ../plugin-options/settings-options.php:63
|
116 |
+
msgid "Label for Search input field."
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: ../plugin-options/settings-options.php:57
|
120 |
+
msgid "Search for products"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: ../plugin-options/settings-options.php:61
|
124 |
+
msgid "Search submit label"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: ../plugin-options/settings-options.php:65
|
128 |
+
msgid "Search"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: ../plugin-options/settings-options.php:69
|
132 |
+
msgid "Minimum number of characters"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: ../plugin-options/settings-options.php:70
|
136 |
+
msgid "Minimum number of characters required to trigger autosuggest."
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: ../plugin-options/settings-options.php:83
|
140 |
+
msgid "Maximum number of results"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: ../plugin-options/settings-options.php:84
|
144 |
+
msgid "Maximum number of results showed within the autosuggest box."
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: ../templates/admin/premium.php:251 ../templates/admin/premium.php:299
|
148 |
+
#, php-format
|
149 |
+
msgid ""
|
150 |
+
"Upgrade to the %1$spremium version%2$s%3$s of %1$sYITH WooCommerce Ajax "
|
151 |
+
"Search%2$s to benefit from all features!"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: ../templates/admin/premium.php:253 ../templates/admin/premium.php:301
|
155 |
+
#, php-format
|
156 |
+
msgid "%1$sUPGRADE%2$s %3$sto the premium version%2$s"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: ../templates/admin/premium.php:259
|
160 |
+
msgid "Premium Features"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: ../templates/admin/premium.php:261
|
164 |
+
msgid "HOW TO CUSTOMIZE THE RESULTS OF THE AUTOCOMPLETE"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: ../templates/admin/premium.php:263
|
168 |
+
msgid "RESULTS OF THE AUTOCOMPLETE"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: ../templates/admin/premium.php:268
|
172 |
+
#, php-format
|
173 |
+
msgid "Show %1$sthe image%2$s of the product (left or right aligned)"
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: ../templates/admin/premium.php:269
|
177 |
+
#, php-format
|
178 |
+
msgid "Enable the %1$sprice visualization%2$s"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: ../templates/admin/premium.php:270
|
182 |
+
#, php-format
|
183 |
+
msgid "Show the %1$sproduct description%2$s"
|
184 |
+
msgstr ""
|
185 |
+
|
186 |
+
#: ../templates/admin/premium.php:271
|
187 |
+
#, php-format
|
188 |
+
msgid "Tell to the client if the product is %1$son discount or is featured%2$s"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: ../templates/admin/premium.php:279
|
192 |
+
msgid "HOW TO CUSTOMIZE THE SEARCH OPTIONS"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: ../templates/admin/premium.php:283
|
196 |
+
#, php-format
|
197 |
+
msgid "%1$sExtend the research%2$s in the excerpt and in the content"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: ../templates/admin/premium.php:284
|
201 |
+
#, php-format
|
202 |
+
msgid "%1$sActivate%2$s the category search"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ../templates/admin/premium.php:285
|
206 |
+
#, php-format
|
207 |
+
msgid "Configure the %1$stag%2$s search"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: ../templates/admin/premium.php:286
|
211 |
+
#, php-format
|
212 |
+
msgid "Search a product with an %1$sID%2$s"
|
213 |
+
msgstr ""
|
214 |
+
|
215 |
+
#: ../templates/admin/premium.php:292
|
216 |
+
msgid "SEARCH OPTIONS"
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: ../templates/yith-woocommerce-ajax-search.php:18
|
220 |
+
msgid "Search for:"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:28
|
224 |
+
msgid "An Ajax Search box for products only."
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:30
|
228 |
+
msgid "YITH WooCommerce Ajax Product Search"
|
229 |
+
msgstr ""
|
230 |
+
|
231 |
+
#: ../widgets/class.yith-wcas-ajax-search.php:89
|
232 |
+
msgid "Title:"
|
233 |
+
msgstr ""
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/chosen/chosen.css
ADDED
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.1.0
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* @group Base */
|
14 |
+
.chosen-container {
|
15 |
+
position: relative;
|
16 |
+
display: inline-block;
|
17 |
+
vertical-align: middle;
|
18 |
+
font-size: 13px;
|
19 |
+
zoom: 1;
|
20 |
+
*display: inline;
|
21 |
+
-webkit-user-select: none;
|
22 |
+
-moz-user-select: none;
|
23 |
+
user-select: none;
|
24 |
+
}
|
25 |
+
.chosen-container .chosen-drop {
|
26 |
+
position: absolute;
|
27 |
+
top: 100%;
|
28 |
+
left: -9999px;
|
29 |
+
z-index: 1010;
|
30 |
+
-webkit-box-sizing: border-box;
|
31 |
+
-moz-box-sizing: border-box;
|
32 |
+
box-sizing: border-box;
|
33 |
+
width: 100%;
|
34 |
+
border: 1px solid #aaa;
|
35 |
+
border-top: 0;
|
36 |
+
background: #fff;
|
37 |
+
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
38 |
+
}
|
39 |
+
.chosen-container.chosen-with-drop .chosen-drop {
|
40 |
+
left: 0;
|
41 |
+
}
|
42 |
+
.chosen-container a {
|
43 |
+
cursor: pointer;
|
44 |
+
}
|
45 |
+
|
46 |
+
/* @end */
|
47 |
+
/* @group Single Chosen */
|
48 |
+
.chosen-container-single .chosen-single {
|
49 |
+
position: relative;
|
50 |
+
display: block;
|
51 |
+
overflow: hidden;
|
52 |
+
padding: 0 0 0 8px;
|
53 |
+
height: 23px;
|
54 |
+
border: 1px solid #aaa;
|
55 |
+
border-radius: 5px;
|
56 |
+
background-color: #fff;
|
57 |
+
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
|
58 |
+
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
59 |
+
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
60 |
+
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
61 |
+
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
62 |
+
background-clip: padding-box;
|
63 |
+
box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
64 |
+
color: #444;
|
65 |
+
text-decoration: none;
|
66 |
+
white-space: nowrap;
|
67 |
+
line-height: 24px;
|
68 |
+
}
|
69 |
+
.chosen-container-single .chosen-default {
|
70 |
+
color: #999;
|
71 |
+
}
|
72 |
+
.chosen-container-single .chosen-single span {
|
73 |
+
display: block;
|
74 |
+
overflow: hidden;
|
75 |
+
margin-right: 26px;
|
76 |
+
text-overflow: ellipsis;
|
77 |
+
white-space: nowrap;
|
78 |
+
}
|
79 |
+
.chosen-container-single .chosen-single-with-deselect span {
|
80 |
+
margin-right: 38px;
|
81 |
+
}
|
82 |
+
.chosen-container-single .chosen-single abbr {
|
83 |
+
position: absolute;
|
84 |
+
top: 6px;
|
85 |
+
right: 26px;
|
86 |
+
display: block;
|
87 |
+
width: 12px;
|
88 |
+
height: 12px;
|
89 |
+
background: url('../../images/chosen/chosen-sprite.png') -42px 1px no-repeat;
|
90 |
+
font-size: 1px;
|
91 |
+
}
|
92 |
+
.chosen-container-single .chosen-single abbr:hover {
|
93 |
+
background-position: -42px -10px;
|
94 |
+
}
|
95 |
+
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
96 |
+
background-position: -42px -10px;
|
97 |
+
}
|
98 |
+
.chosen-container-single .chosen-single div {
|
99 |
+
position: absolute;
|
100 |
+
top: 0;
|
101 |
+
right: 0;
|
102 |
+
display: block;
|
103 |
+
width: 18px;
|
104 |
+
height: 100%;
|
105 |
+
}
|
106 |
+
.chosen-container-single .chosen-single div b {
|
107 |
+
display: block;
|
108 |
+
width: 100%;
|
109 |
+
height: 100%;
|
110 |
+
background: url('../../images/chosen/chosen-sprite.png') no-repeat 0px 2px;
|
111 |
+
}
|
112 |
+
.chosen-container-single .chosen-search {
|
113 |
+
position: relative;
|
114 |
+
z-index: 1010;
|
115 |
+
margin: 0;
|
116 |
+
padding: 3px 4px;
|
117 |
+
white-space: nowrap;
|
118 |
+
}
|
119 |
+
.chosen-container-single .chosen-search input[type="text"] {
|
120 |
+
-webkit-box-sizing: border-box;
|
121 |
+
-moz-box-sizing: border-box;
|
122 |
+
box-sizing: border-box;
|
123 |
+
margin: 1px 0;
|
124 |
+
padding: 4px 20px 4px 5px;
|
125 |
+
width: 100%;
|
126 |
+
height: auto;
|
127 |
+
outline: 0;
|
128 |
+
border: 1px solid #aaa;
|
129 |
+
background: white url('../../images/chosen/chosen-sprite.png') no-repeat 100% -20px;
|
130 |
+
background: url('../../images/chosen/chosen-sprite.png') no-repeat 100% -20px;
|
131 |
+
font-size: 1em;
|
132 |
+
font-family: sans-serif;
|
133 |
+
line-height: normal;
|
134 |
+
border-radius: 0;
|
135 |
+
}
|
136 |
+
.chosen-container-single .chosen-drop {
|
137 |
+
margin-top: -1px;
|
138 |
+
border-radius: 0 0 4px 4px;
|
139 |
+
background-clip: padding-box;
|
140 |
+
}
|
141 |
+
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
142 |
+
position: absolute;
|
143 |
+
left: -9999px;
|
144 |
+
}
|
145 |
+
|
146 |
+
/* @end */
|
147 |
+
/* @group Results */
|
148 |
+
.chosen-container .chosen-results {
|
149 |
+
position: relative;
|
150 |
+
overflow-x: hidden;
|
151 |
+
overflow-y: auto;
|
152 |
+
margin: 0 4px 4px 0;
|
153 |
+
padding: 0 0 0 4px;
|
154 |
+
max-height: 240px;
|
155 |
+
-webkit-overflow-scrolling: touch;
|
156 |
+
}
|
157 |
+
.chosen-container .chosen-results li {
|
158 |
+
display: none;
|
159 |
+
margin: 0;
|
160 |
+
padding: 5px 6px;
|
161 |
+
list-style: none;
|
162 |
+
line-height: 15px;
|
163 |
+
-webkit-touch-callout: none;
|
164 |
+
}
|
165 |
+
.chosen-container .chosen-results li.active-result {
|
166 |
+
display: list-item;
|
167 |
+
cursor: pointer;
|
168 |
+
}
|
169 |
+
.chosen-container .chosen-results li.disabled-result {
|
170 |
+
display: list-item;
|
171 |
+
color: #ccc;
|
172 |
+
cursor: default;
|
173 |
+
}
|
174 |
+
.chosen-container .chosen-results li.highlighted {
|
175 |
+
background-color: #3875d7;
|
176 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
177 |
+
background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
178 |
+
background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
179 |
+
background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
180 |
+
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
181 |
+
color: #fff;
|
182 |
+
}
|
183 |
+
.chosen-container .chosen-results li.no-results {
|
184 |
+
display: list-item;
|
185 |
+
background: #f4f4f4;
|
186 |
+
}
|
187 |
+
.chosen-container .chosen-results li.group-result {
|
188 |
+
display: list-item;
|
189 |
+
font-weight: bold;
|
190 |
+
cursor: default;
|
191 |
+
}
|
192 |
+
.chosen-container .chosen-results li.group-option {
|
193 |
+
padding-left: 15px;
|
194 |
+
}
|
195 |
+
.chosen-container .chosen-results li em {
|
196 |
+
font-style: normal;
|
197 |
+
text-decoration: underline;
|
198 |
+
}
|
199 |
+
|
200 |
+
/* @end */
|
201 |
+
/* @group Multi Chosen */
|
202 |
+
.chosen-container-multi .chosen-choices {
|
203 |
+
position: relative;
|
204 |
+
overflow: hidden;
|
205 |
+
-webkit-box-sizing: border-box;
|
206 |
+
-moz-box-sizing: border-box;
|
207 |
+
box-sizing: border-box;
|
208 |
+
margin: 0;
|
209 |
+
padding: 0;
|
210 |
+
width: 100%;
|
211 |
+
height: auto !important;
|
212 |
+
height: 1%;
|
213 |
+
border: 1px solid #aaa;
|
214 |
+
background-color: #fff;
|
215 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
216 |
+
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
217 |
+
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
218 |
+
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
219 |
+
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
|
220 |
+
cursor: text;
|
221 |
+
}
|
222 |
+
.chosen-container-multi .chosen-choices li {
|
223 |
+
float: left;
|
224 |
+
list-style: none;
|
225 |
+
}
|
226 |
+
.chosen-container-multi .chosen-choices li.search-field {
|
227 |
+
margin: 0;
|
228 |
+
padding: 0;
|
229 |
+
white-space: nowrap;
|
230 |
+
}
|
231 |
+
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
232 |
+
margin: 1px 0;
|
233 |
+
padding: 5px;
|
234 |
+
height: 15px;
|
235 |
+
outline: 0;
|
236 |
+
border: 0 !important;
|
237 |
+
background: transparent !important;
|
238 |
+
box-shadow: none;
|
239 |
+
color: #666;
|
240 |
+
font-size: 100%;
|
241 |
+
font-family: sans-serif;
|
242 |
+
line-height: normal;
|
243 |
+
border-radius: 0;
|
244 |
+
}
|
245 |
+
.chosen-container-multi .chosen-choices li.search-field .default {
|
246 |
+
color: #999;
|
247 |
+
}
|
248 |
+
.chosen-container-multi .chosen-choices li.search-choice {
|
249 |
+
position: relative;
|
250 |
+
margin: 3px 0 3px 5px;
|
251 |
+
padding: 3px 20px 3px 5px;
|
252 |
+
border: 1px solid #aaa;
|
253 |
+
border-radius: 3px;
|
254 |
+
background-color: #e4e4e4;
|
255 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
256 |
+
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
257 |
+
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
258 |
+
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
259 |
+
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
260 |
+
background-clip: padding-box;
|
261 |
+
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
262 |
+
color: #333;
|
263 |
+
line-height: 13px;
|
264 |
+
cursor: default;
|
265 |
+
}
|
266 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
267 |
+
position: absolute;
|
268 |
+
top: 4px;
|
269 |
+
right: 3px;
|
270 |
+
display: block;
|
271 |
+
width: 12px;
|
272 |
+
height: 12px;
|
273 |
+
background: url('../../images/chosen/chosen-sprite.png') -42px 1px no-repeat;
|
274 |
+
font-size: 1px;
|
275 |
+
}
|
276 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
277 |
+
background-position: -42px -10px;
|
278 |
+
}
|
279 |
+
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
280 |
+
padding-right: 5px;
|
281 |
+
border: 1px solid #ccc;
|
282 |
+
background-color: #e4e4e4;
|
283 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
284 |
+
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
285 |
+
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
286 |
+
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
287 |
+
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
288 |
+
color: #666;
|
289 |
+
}
|
290 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
291 |
+
background: #d4d4d4;
|
292 |
+
}
|
293 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
294 |
+
background-position: -42px -10px;
|
295 |
+
}
|
296 |
+
.chosen-container-multi .chosen-results {
|
297 |
+
margin: 0;
|
298 |
+
padding: 0;
|
299 |
+
}
|
300 |
+
.chosen-container-multi .chosen-drop .result-selected {
|
301 |
+
display: list-item;
|
302 |
+
color: #ccc;
|
303 |
+
cursor: default;
|
304 |
+
}
|
305 |
+
|
306 |
+
/* @end */
|
307 |
+
/* @group Active */
|
308 |
+
.chosen-container-active .chosen-single {
|
309 |
+
border: 1px solid #5897fb;
|
310 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
311 |
+
}
|
312 |
+
.chosen-container-active.chosen-with-drop .chosen-single {
|
313 |
+
border: 1px solid #aaa;
|
314 |
+
-moz-border-radius-bottomright: 0;
|
315 |
+
border-bottom-right-radius: 0;
|
316 |
+
-moz-border-radius-bottomleft: 0;
|
317 |
+
border-bottom-left-radius: 0;
|
318 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
|
319 |
+
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
320 |
+
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
321 |
+
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
322 |
+
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
|
323 |
+
box-shadow: 0 1px 0 #fff inset;
|
324 |
+
}
|
325 |
+
.chosen-container-active.chosen-with-drop .chosen-single div {
|
326 |
+
border-left: none;
|
327 |
+
background: transparent;
|
328 |
+
}
|
329 |
+
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
330 |
+
background-position: -18px 2px;
|
331 |
+
}
|
332 |
+
.chosen-container-active .chosen-choices {
|
333 |
+
border: 1px solid #5897fb;
|
334 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
335 |
+
}
|
336 |
+
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
337 |
+
color: #111 !important;
|
338 |
+
}
|
339 |
+
|
340 |
+
/* @end */
|
341 |
+
/* @group Disabled Support */
|
342 |
+
.chosen-disabled {
|
343 |
+
opacity: 0.5 !important;
|
344 |
+
cursor: default;
|
345 |
+
}
|
346 |
+
.chosen-disabled .chosen-single {
|
347 |
+
cursor: default;
|
348 |
+
}
|
349 |
+
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
350 |
+
cursor: default;
|
351 |
+
}
|
352 |
+
|
353 |
+
/* @end */
|
354 |
+
/* @group Right to Left */
|
355 |
+
.chosen-rtl {
|
356 |
+
text-align: right;
|
357 |
+
}
|
358 |
+
.chosen-rtl .chosen-single {
|
359 |
+
overflow: visible;
|
360 |
+
padding: 0 8px 0 0;
|
361 |
+
}
|
362 |
+
.chosen-rtl .chosen-single span {
|
363 |
+
margin-right: 0;
|
364 |
+
margin-left: 26px;
|
365 |
+
direction: rtl;
|
366 |
+
}
|
367 |
+
.chosen-rtl .chosen-single-with-deselect span {
|
368 |
+
margin-left: 38px;
|
369 |
+
}
|
370 |
+
.chosen-rtl .chosen-single div {
|
371 |
+
right: auto;
|
372 |
+
left: 3px;
|
373 |
+
}
|
374 |
+
.chosen-rtl .chosen-single abbr {
|
375 |
+
right: auto;
|
376 |
+
left: 26px;
|
377 |
+
}
|
378 |
+
.chosen-rtl .chosen-choices li {
|
379 |
+
float: right;
|
380 |
+
}
|
381 |
+
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
382 |
+
direction: rtl;
|
383 |
+
}
|
384 |
+
.chosen-rtl .chosen-choices li.search-choice {
|
385 |
+
margin: 3px 5px 3px 0;
|
386 |
+
padding: 3px 5px 3px 19px;
|
387 |
+
}
|
388 |
+
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
389 |
+
right: auto;
|
390 |
+
left: 4px;
|
391 |
+
}
|
392 |
+
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
393 |
+
.chosen-rtl .chosen-drop {
|
394 |
+
left: 9999px;
|
395 |
+
}
|
396 |
+
.chosen-rtl.chosen-container-single .chosen-results {
|
397 |
+
margin: 0 0 4px 4px;
|
398 |
+
padding: 0 4px 0 0;
|
399 |
+
}
|
400 |
+
.chosen-rtl .chosen-results li.group-option {
|
401 |
+
padding-right: 15px;
|
402 |
+
padding-left: 0;
|
403 |
+
}
|
404 |
+
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
405 |
+
border-right: none;
|
406 |
+
}
|
407 |
+
.chosen-rtl .chosen-search input[type="text"] {
|
408 |
+
padding: 4px 5px 4px 20px;
|
409 |
+
background: white url('../../images/chosen/chosen-sprite.png') no-repeat -30px -20px;
|
410 |
+
background: url('../../images/chosen/chosen-sprite.png') no-repeat -30px -20px;
|
411 |
+
direction: rtl;
|
412 |
+
}
|
413 |
+
.chosen-rtl.chosen-container-single .chosen-single div b {
|
414 |
+
background-position: 6px 2px;
|
415 |
+
}
|
416 |
+
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
417 |
+
background-position: -12px 2px;
|
418 |
+
}
|
419 |
+
|
420 |
+
/* @end */
|
421 |
+
/* @group Retina compatibility */
|
422 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
|
423 |
+
.chosen-rtl .chosen-search input[type="text"],
|
424 |
+
.chosen-container-single .chosen-single abbr,
|
425 |
+
.chosen-container-single .chosen-single div b,
|
426 |
+
.chosen-container-single .chosen-search input[type="text"],
|
427 |
+
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
428 |
+
.chosen-container .chosen-results-scroll-down span,
|
429 |
+
.chosen-container .chosen-results-scroll-up span {
|
430 |
+
background-image: url('../../images/chosen/chosen-sprite@2x.png') !important;
|
431 |
+
background-size: 52px 37px !important;
|
432 |
+
background-repeat: no-repeat !important;
|
433 |
+
}
|
434 |
+
}
|
435 |
+
/* @end */
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/codemirror/codemirror.css
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* BASICS */
|
2 |
+
|
3 |
+
.CodeMirror {
|
4 |
+
/* Set height, width, borders, and global font properties here */
|
5 |
+
font-family: monospace;
|
6 |
+
height: 400px;
|
7 |
+
clear: both;
|
8 |
+
padding: 0;
|
9 |
+
}
|
10 |
+
.CodeMirror-scroll {
|
11 |
+
/* Set scrolling behaviour here */
|
12 |
+
overflow: auto;
|
13 |
+
}
|
14 |
+
|
15 |
+
/* PADDING */
|
16 |
+
|
17 |
+
.CodeMirror-lines {
|
18 |
+
padding: 4px 0; /* Vertical padding around content */
|
19 |
+
}
|
20 |
+
.CodeMirror pre {
|
21 |
+
padding: 0 4px; /* Horizontal padding of content */
|
22 |
+
}
|
23 |
+
|
24 |
+
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
25 |
+
background-color: white; /* The little square between H and V scrollbars */
|
26 |
+
}
|
27 |
+
|
28 |
+
/* GUTTER */
|
29 |
+
|
30 |
+
.CodeMirror-gutters {
|
31 |
+
border-right: 1px solid #ddd;
|
32 |
+
background-color: #f7f7f7;
|
33 |
+
white-space: nowrap;
|
34 |
+
}
|
35 |
+
.CodeMirror-linenumbers {}
|
36 |
+
.CodeMirror-linenumber {
|
37 |
+
padding: 0 3px 0 5px;
|
38 |
+
min-width: 20px;
|
39 |
+
text-align: right;
|
40 |
+
color: #999;
|
41 |
+
}
|
42 |
+
|
43 |
+
/* CURSOR */
|
44 |
+
|
45 |
+
.CodeMirror div.CodeMirror-cursor {
|
46 |
+
border-left: 1px solid black;
|
47 |
+
z-index: 3;
|
48 |
+
}
|
49 |
+
/* Shown when moving in bi-directional text */
|
50 |
+
.CodeMirror div.CodeMirror-secondarycursor {
|
51 |
+
border-left: 1px solid silver;
|
52 |
+
}
|
53 |
+
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
|
54 |
+
width: auto;
|
55 |
+
border: 0;
|
56 |
+
background: #7e7;
|
57 |
+
z-index: 1;
|
58 |
+
}
|
59 |
+
/* Can style cursor different in overwrite (non-insert) mode */
|
60 |
+
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
|
61 |
+
|
62 |
+
.cm-tab { display: inline-block; }
|
63 |
+
|
64 |
+
/* DEFAULT THEME */
|
65 |
+
|
66 |
+
.cm-s-default .cm-keyword {color: #708;}
|
67 |
+
.cm-s-default .cm-atom {color: #219;}
|
68 |
+
.cm-s-default .cm-number {color: #164;}
|
69 |
+
.cm-s-default .cm-def {color: #00f;}
|
70 |
+
.cm-s-default .cm-variable {color: black;}
|
71 |
+
.cm-s-default .cm-variable-2 {color: #05a;}
|
72 |
+
.cm-s-default .cm-variable-3 {color: #085;}
|
73 |
+
.cm-s-default .cm-property {color: black;}
|
74 |
+
.cm-s-default .cm-operator {color: black;}
|
75 |
+
.cm-s-default .cm-comment {color: #a50;}
|
76 |
+
.cm-s-default .cm-string {color: #a11;}
|
77 |
+
.cm-s-default .cm-string-2 {color: #f50;}
|
78 |
+
.cm-s-default .cm-meta {color: #555;}
|
79 |
+
.cm-s-default .cm-error {color: #f00;}
|
80 |
+
.cm-s-default .cm-qualifier {color: #555;}
|
81 |
+
.cm-s-default .cm-builtin {color: #30a;}
|
82 |
+
.cm-s-default .cm-bracket {color: #997;}
|
83 |
+
.cm-s-default .cm-tag {color: #170;}
|
84 |
+
.cm-s-default .cm-attribute {color: #00c;}
|
85 |
+
.cm-s-default .cm-header {color: blue;}
|
86 |
+
.cm-s-default .cm-quote {color: #090;}
|
87 |
+
.cm-s-default .cm-hr {color: #999;}
|
88 |
+
.cm-s-default .cm-link {color: #00c;}
|
89 |
+
|
90 |
+
.cm-negative {color: #d44;}
|
91 |
+
.cm-positive {color: #292;}
|
92 |
+
.cm-header, .cm-strong {font-weight: bold;}
|
93 |
+
.cm-em {font-style: italic;}
|
94 |
+
.cm-link {text-decoration: underline;}
|
95 |
+
|
96 |
+
.cm-invalidchar {color: #f00;}
|
97 |
+
|
98 |
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
99 |
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
100 |
+
|
101 |
+
/* STOP */
|
102 |
+
|
103 |
+
/* The rest of this file contains styles related to the mechanics of
|
104 |
+
the editor. You probably shouldn't touch them. */
|
105 |
+
|
106 |
+
.CodeMirror {
|
107 |
+
line-height: 1;
|
108 |
+
position: relative;
|
109 |
+
overflow: hidden;
|
110 |
+
background: #fafafa;
|
111 |
+
color: black;
|
112 |
+
}
|
113 |
+
|
114 |
+
.CodeMirror-scroll {
|
115 |
+
/* 30px is the magic margin used to hide the element's real scrollbars */
|
116 |
+
/* See overflow: hidden in .CodeMirror */
|
117 |
+
margin-bottom: -30px; margin-right: -30px;
|
118 |
+
padding-bottom: 30px; padding-right: 30px;
|
119 |
+
height: 100%;
|
120 |
+
outline: none; /* Prevent dragging from highlighting the element */
|
121 |
+
position: relative;
|
122 |
+
}
|
123 |
+
.CodeMirror-sizer {
|
124 |
+
position: relative;
|
125 |
+
}
|
126 |
+
|
127 |
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
128 |
+
before actuall scrolling happens, thus preventing shaking and
|
129 |
+
flickering artifacts. */
|
130 |
+
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
131 |
+
position: absolute;
|
132 |
+
z-index: 6;
|
133 |
+
display: none;
|
134 |
+
}
|
135 |
+
.CodeMirror-vscrollbar {
|
136 |
+
right: 0; top: 0;
|
137 |
+
overflow-x: hidden;
|
138 |
+
overflow-y: scroll;
|
139 |
+
}
|
140 |
+
.CodeMirror-hscrollbar {
|
141 |
+
bottom: 0; left: 0;
|
142 |
+
overflow-y: hidden;
|
143 |
+
overflow-x: scroll;
|
144 |
+
}
|
145 |
+
.CodeMirror-scrollbar-filler {
|
146 |
+
right: 0; bottom: 0;
|
147 |
+
}
|
148 |
+
.CodeMirror-gutter-filler {
|
149 |
+
left: 0; bottom: 0;
|
150 |
+
}
|
151 |
+
|
152 |
+
.CodeMirror-gutters {
|
153 |
+
position: absolute; left: 0; top: 0;
|
154 |
+
padding-bottom: 30px;
|
155 |
+
z-index: 3;
|
156 |
+
}
|
157 |
+
.CodeMirror-gutter {
|
158 |
+
white-space: normal;
|
159 |
+
height: 100%;
|
160 |
+
padding-bottom: 30px;
|
161 |
+
margin-bottom: -32px;
|
162 |
+
display: inline-block;
|
163 |
+
/* Hack to make IE7 behave */
|
164 |
+
*zoom:1;
|
165 |
+
*display:inline;
|
166 |
+
}
|
167 |
+
.CodeMirror-gutter-elt {
|
168 |
+
position: absolute;
|
169 |
+
cursor: default;
|
170 |
+
z-index: 4;
|
171 |
+
}
|
172 |
+
|
173 |
+
.CodeMirror-lines {
|
174 |
+
cursor: text;
|
175 |
+
}
|
176 |
+
.CodeMirror pre {
|
177 |
+
/* Reset some styles that the rest of the page might have set */
|
178 |
+
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
179 |
+
border-width: 0;
|
180 |
+
background: transparent;
|
181 |
+
font-family: inherit;
|
182 |
+
font-size: inherit;
|
183 |
+
margin: 0;
|
184 |
+
white-space: pre;
|
185 |
+
word-wrap: normal;
|
186 |
+
line-height: inherit;
|
187 |
+
color: inherit;
|
188 |
+
z-index: 2;
|
189 |
+
position: relative;
|
190 |
+
overflow: visible;
|
191 |
+
}
|
192 |
+
.CodeMirror-wrap pre {
|
193 |
+
word-wrap: break-word;
|
194 |
+
white-space: pre-wrap;
|
195 |
+
word-break: normal;
|
196 |
+
}
|
197 |
+
.CodeMirror-code pre {
|
198 |
+
border-right: 30px solid transparent;
|
199 |
+
width: -webkit-fit-content;
|
200 |
+
width: -moz-fit-content;
|
201 |
+
width: fit-content;
|
202 |
+
}
|
203 |
+
.CodeMirror-wrap .CodeMirror-code pre {
|
204 |
+
border-right: none;
|
205 |
+
width: auto;
|
206 |
+
}
|
207 |
+
.CodeMirror-linebackground {
|
208 |
+
position: absolute;
|
209 |
+
left: 0; right: 0; top: 0; bottom: 0;
|
210 |
+
z-index: 0;
|
211 |
+
}
|
212 |
+
|
213 |
+
.CodeMirror-linewidget {
|
214 |
+
position: relative;
|
215 |
+
z-index: 2;
|
216 |
+
overflow: auto;
|
217 |
+
}
|
218 |
+
|
219 |
+
.CodeMirror-widget {
|
220 |
+
}
|
221 |
+
|
222 |
+
.CodeMirror-wrap .CodeMirror-scroll {
|
223 |
+
overflow-x: hidden;
|
224 |
+
}
|
225 |
+
|
226 |
+
.CodeMirror-measure {
|
227 |
+
position: absolute;
|
228 |
+
width: 100%; height: 0px;
|
229 |
+
overflow: hidden;
|
230 |
+
visibility: hidden;
|
231 |
+
}
|
232 |
+
.CodeMirror-measure pre { position: static; }
|
233 |
+
|
234 |
+
.CodeMirror div.CodeMirror-cursor {
|
235 |
+
position: absolute;
|
236 |
+
visibility: hidden;
|
237 |
+
border-right: none;
|
238 |
+
width: 0;
|
239 |
+
}
|
240 |
+
.CodeMirror-focused div.CodeMirror-cursor {
|
241 |
+
visibility: visible;
|
242 |
+
}
|
243 |
+
|
244 |
+
.CodeMirror-selected { background: #d9d9d9; }
|
245 |
+
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
246 |
+
|
247 |
+
.cm-searching {
|
248 |
+
background: #ffa;
|
249 |
+
background: rgba(255, 255, 0, .4);
|
250 |
+
}
|
251 |
+
|
252 |
+
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
253 |
+
.CodeMirror span { *vertical-align: text-bottom; }
|
254 |
+
|
255 |
+
@media print {
|
256 |
+
/* Hide the cursor when printing */
|
257 |
+
.CodeMirror div.CodeMirror-cursor {
|
258 |
+
visibility: hidden;
|
259 |
+
}
|
260 |
+
}
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/metaboxes.css
ADDED
@@ -0,0 +1,609 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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css */
|
4 |
+
* html .clearfix { /* IE6 */
|
5 |
+
height:1%;
|
6 |
+
}
|
7 |
+
*:first-child+html .clearfix { /* IE7 */
|
8 |
+
min-height:1%;
|
9 |
+
}
|
10 |
+
|
11 |
+
.clearboth { clear: both }
|
12 |
+
|
13 |
+
/* === TAB STYLE */
|
14 |
+
.metaboxes-tab { margin:-6px -12px -8px; }
|
15 |
+
.metaboxes-tab div.tabs-panel { height:auto; overflow:visible; margin-top:0px; padding:0 10px; background:none; border:0; border-top:1px solid #D4D4D4; }
|
16 |
+
.metaboxes-tab ul.metaboxes-tabs { background:#F5F5F5; margin:0; padding:10px 0 0 5px; }
|
17 |
+
.metaboxes-tab ul.metaboxes-tabs li { padding:8px 15px; border:1px solid #D4D4D4; float:left; background:#EDEDED; border-bottom-color:#EDEDED; margin:0 0 -1px 5px; box-shadow:1px 1px 1px 0 #FFFFFF inset; }
|
18 |
+
.metaboxes-tab ul.metaboxes-tabs li a { color:#555; text-decoration:none; }
|
19 |
+
.metaboxes-tab ul.metaboxes-tabs li.tabs { background:#F6F6F6; border-bottom:1px solid #F6F6F6; }
|
20 |
+
.metaboxes-tab p.field-row { margin:20px 0; }
|
21 |
+
.metaboxes-tab div.sep { height:1px; background:#DFDFDF; clear:both; margin-left:-10px; margin-right:-10px; }
|
22 |
+
.metaboxes-tab label { font-weight:bold; width:160px; float:left; line-height:23px; margin-left:-184px; }
|
23 |
+
.metaboxes-tab label small { font-weight:normal; line-height:15px; font-style:italic; color:#999; display:block; }
|
24 |
+
.metaboxes-tab input[type="text"], .metaboxes-tab select, .metaboxes-tab textarea { width:30%; }
|
25 |
+
.metaboxes-tab input[type="checkbox"] { vertical-align: middle }
|
26 |
+
.metaboxes-tab select {padding:0;}
|
27 |
+
.metaboxes-tab input.button-secondary, .metaboxes-tab input.checkbox { width:auto; }
|
28 |
+
.metaboxes-tab .description { color:#AFAFAF; font-size:90%; font-style:italic; line-height:23px; padding-left:5px; }
|
29 |
+
.metaboxes-tab p.field-row.textarea .description { vertical-align:top; }
|
30 |
+
.metaboxes-tab p.field-row.checkbox {background:none;}
|
31 |
+
|
32 |
+
.metaboxes-tab .the-metabox { margin:20px 0; margin-left:184px;}
|
33 |
+
.metaboxes-tab .the-metabox.no-label { margin:20px 0; margin-left:0;}
|
34 |
+
.metaboxes-tab hr { height: 0px; border-top: 1px solid #dadada; width: auto; margin-left: -10px; margin-right: -10px; }
|
35 |
+
.metaboxes-tab .the-metabox p { margin:0;}
|
36 |
+
.metaboxes-tab .the-metabox:last-child { border-bottom: 0px; }
|
37 |
+
.metaboxes-tab .the-metabox.checkbox { background:none; }
|
38 |
+
.metaboxes-tab .the-metabox.slider .ui-slider { margin-right:15px; }
|
39 |
+
|
40 |
+
.metaboxes-tab span.desc { font-size: 11px; color: #AFAFAF; }
|
41 |
+
.metaboxes-tab span.desc.inline { display: inline-block; vertical-align: top; line-height: 23px; }
|
42 |
+
.metaboxes-tab .onoff span.desc, .metaboxes-tab .onoff label { padding:6px 0; }
|
43 |
+
.metaboxes-tab .select span.desc, .metaboxes-tab .select label { padding:2px 0; }
|
44 |
+
.metaboxes-tab .slider span.desc, .metaboxes-tab .slider label { padding:15px 0; }
|
45 |
+
.metaboxes-tab .slider span.desc { display:block; padding:20px 0; }
|
46 |
+
|
47 |
+
.metaboxes-tab ul.metaboxes-tabs li {
|
48 |
+
-webkit-border-top-left-radius: 3px;
|
49 |
+
-webkit-border-top-right-radius: 3px;
|
50 |
+
-moz-border-radius-topleft: 3px;
|
51 |
+
-moz-border-radius-topright: 3px;
|
52 |
+
border-top-left-radius: 3px;
|
53 |
+
border-top-right-radius: 3px;
|
54 |
+
}
|
55 |
+
|
56 |
+
/* image gallery */
|
57 |
+
.metaboxes-tab .image-gallery ul li{
|
58 |
+
display: inline-block;
|
59 |
+
width: 80px;
|
60 |
+
margin-left: 10px;
|
61 |
+
position: relative;
|
62 |
+
}
|
63 |
+
.metaboxes-tab .image-gallery ul li img{
|
64 |
+
width: 80px;
|
65 |
+
border: 1px solid #ccc;
|
66 |
+
}
|
67 |
+
.metaboxes-tab .image-gallery ul li ul{
|
68 |
+
position: absolute;
|
69 |
+
top: -6px;
|
70 |
+
right: -1px;
|
71 |
+
width: 20px;
|
72 |
+
height: 20px;
|
73 |
+
}
|
74 |
+
.metaboxes-tab .image-gallery ul a.delete{
|
75 |
+
background: url(../images/x.png) no-repeat;
|
76 |
+
width: 20px;
|
77 |
+
height: 20px;
|
78 |
+
display: block;
|
79 |
+
text-indent: -99999px;
|
80 |
+
}
|
81 |
+
/* sidebar layout */
|
82 |
+
.yit-sidebar-layout input[type="radio"] {
|
83 |
+
display: none;
|
84 |
+
width: 0px;
|
85 |
+
}
|
86 |
+
.yit-sidebar-layout input[type="radio"]:first-child {
|
87 |
+
margin-right: -2px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.yit-sidebar-layout input[type="radio"] + img {
|
91 |
+
border: 2px solid #fff;
|
92 |
+
padding: 1px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.yit-sidebar-layout input[type="radio"] + img:hover {
|
96 |
+
cursor: pointer;
|
97 |
+
}
|
98 |
+
|
99 |
+
.yit-sidebar-layout input[checked] + img {
|
100 |
+
border: 2px solid #f2ad35;
|
101 |
+
padding: 1px;
|
102 |
+
}
|
103 |
+
|
104 |
+
.yit-sidebar-layout select {
|
105 |
+
vertical-align: 12px;
|
106 |
+
width: inherit !important;
|
107 |
+
}
|
108 |
+
|
109 |
+
/* wp editor */
|
110 |
+
.the-metabox.textarea-editor .mceIframeContainer {
|
111 |
+
background:#fff;
|
112 |
+
}
|
113 |
+
.the-metabox.textarea-editor label {
|
114 |
+
margin-top:24px;
|
115 |
+
}
|
116 |
+
|
117 |
+
/* categories */
|
118 |
+
.categories-panel { width:30%; float:left; margin-right:4px; }
|
119 |
+
.categories-panel .box { height:200px; border:1px solid #DFDFDF; background:#fff; padding:6px 10px; overflow: auto; }
|
120 |
+
.categories-panel ul { list-style:none; margin:0; }
|
121 |
+
.categories-panel ul li { line-height: 19px; margin: 0; padding: 0; word-wrap: break-word; }
|
122 |
+
.categories-panel ul li label { font-weight:normal !important; margin-left:0 !important; }
|
123 |
+
.categories-panel input.newcategory { width:100%; margin-bottom:3px; }
|
124 |
+
|
125 |
+
/* contact form */
|
126 |
+
.contactform_item {
|
127 |
+
border-style: solid;
|
128 |
+
border-width: 1px;
|
129 |
+
line-height: 1;
|
130 |
+
margin-bottom: 20px;
|
131 |
+
padding: 0;
|
132 |
+
background-color: #F5F5F5;
|
133 |
+
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
|
134 |
+
border-color: #DFDFDF;
|
135 |
+
border-radius: 3px 3px 3px 3px;
|
136 |
+
box-shadow: 0 1px 0 #FFFFFF inset;
|
137 |
+
min-width: 255px;
|
138 |
+
position: relative;
|
139 |
+
}
|
140 |
+
.contactform_item .handlediv { position:relative; top: -4px; }
|
141 |
+
.contactform_item h3 { min-height: 21px }
|
142 |
+
.contactform_item .inside { padding: 10px !important; }
|
143 |
+
.contactform_item .deps { display: none; }
|
144 |
+
.contactform_item .addoptions p.option { margin: 5px 0 5px 200px }
|
145 |
+
.contactform_item .addoptions p label { width: 80px !important; }
|
146 |
+
.contactform_item .add-field-option { margin-bottom: 10px !important; }
|
147 |
+
.remove_item { float: right; }
|
148 |
+
.metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
|
149 |
+
|
150 |
+
/* features tab */
|
151 |
+
.featurestab_item{
|
152 |
+
border-style: solid;
|
153 |
+
border-width: 1px;
|
154 |
+
line-height: 1;
|
155 |
+
margin-bottom: 20px;
|
156 |
+
padding: 0;
|
157 |
+
background-color: #F5F5F5;
|
158 |
+
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
|
159 |
+
border-color: #DFDFDF;
|
160 |
+
border-radius: 3px 3px 3px 3px;
|
161 |
+
box-shadow: 0 1px 0 #FFFFFF inset;
|
162 |
+
min-width: 255px;
|
163 |
+
position: relative;
|
164 |
+
}
|
165 |
+
.featurestab_item .handlediv { position:relative; top: -4px; }
|
166 |
+
.featurestab_item h3 { min-height: 21px }
|
167 |
+
.featurestab_item .inside { padding: 10px !important; }
|
168 |
+
.featurestab_item .deps { display: none; }
|
169 |
+
.featurestab_item .addoptions p.option { margin: 5px 0 5px 200px }
|
170 |
+
.featurestab_item .addoptions p label { width: 80px !important; }
|
171 |
+
.featurestab_item .add-field-option { margin-bottom: 10px !important; }
|
172 |
+
|
173 |
+
/* slider */
|
174 |
+
.the-metabox.slider { padding-top:20px; }
|
175 |
+
|
176 |
+
/* on off */
|
177 |
+
.the-metabox .rm_onoff span.onoff { float:left; margin-right:5px; margin-left:-4px; /* image fix */ }
|
178 |
+
|
179 |
+
/* select */
|
180 |
+
.the-metabox .select_wrapper { width:341px; background-color:#fff; }
|
181 |
+
.the-metabox .select_wrapper select { width:100%; }
|
182 |
+
.the-metabox .icon_type{ width:30%; float: left; margin-right: 40px }
|
183 |
+
.the-metabox .icon_type select, .the-metabox div.option .select_wrapper select{ width: 100% }
|
184 |
+
|
185 |
+
#post-type-settings .category-list label { width: 187px; }
|
186 |
+
.remove_cat { float: right; text-align:center; display: block; width: 20px; height: 20px; border-radius: 20px; font-weight: bold; font-size: 10px; background: #efefef; text-decoration: none; }
|
187 |
+
|
188 |
+
.the-metabox .select_wrapper {
|
189 |
+
background: url("../images/select.png") no-repeat scroll right center #FAFAFA;
|
190 |
+
border-color: #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
|
191 |
+
border-radius: 4px 4px 4px 4px;
|
192 |
+
border-style: solid;
|
193 |
+
border-width: 1px;
|
194 |
+
color: #555555;
|
195 |
+
display: block;
|
196 |
+
float: left;
|
197 |
+
font-family: sans-serif;
|
198 |
+
font-size: 12px;
|
199 |
+
min-height: 26px;
|
200 |
+
margin-bottom: 9px !important;
|
201 |
+
margin-left: 0;
|
202 |
+
margin-right: 5px;
|
203 |
+
margin-top: 0;
|
204 |
+
width: 400px;
|
205 |
+
position: relative;
|
206 |
+
}
|
207 |
+
|
208 |
+
/*chosen*/
|
209 |
+
|
210 |
+
.chosen .select_wrapper {
|
211 |
+
background: none;
|
212 |
+
border: none;
|
213 |
+
}
|
214 |
+
.chosen .select_wrapper .chosen-container{
|
215 |
+
width: 338px!important;
|
216 |
+
}
|
217 |
+
.chosen .select_wrapper .chosen-container .search-field input{
|
218 |
+
height: 27px!important;
|
219 |
+
color: #333;
|
220 |
+
}
|
221 |
+
.chosen .select_wrapper .chosen-container .chosen-choices{
|
222 |
+
border: 1px solid #ddd;
|
223 |
+
box-shadow: none;
|
224 |
+
}
|
225 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice{
|
226 |
+
height: 15px!important;
|
227 |
+
min-width: 105px;
|
228 |
+
}
|
229 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span{
|
230 |
+
line-height: 15px;
|
231 |
+
height: 15px;
|
232 |
+
padding-top: 2px;
|
233 |
+
}
|
234 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close{
|
235 |
+
top: 5px;
|
236 |
+
}
|
237 |
+
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
|
238 |
+
width: 100%!important;
|
239 |
+
}
|
240 |
+
|
241 |
+
/* typography */
|
242 |
+
.the-metabox.typography .select_wrapper.font-family { width:200px; }
|
243 |
+
.the-metabox.typography .spinner_container { float:left; margin-right:10px; }
|
244 |
+
.the-metabox.typography .spinner_container input.number {
|
245 |
+
width:50px !important;
|
246 |
+
-webkit-border-top-right-radius: 0px;
|
247 |
+
-webkit-border-bottom-right-radius: 0px;
|
248 |
+
-moz-border-radius-topright: 0px;
|
249 |
+
-moz-border-radius-bottomright: 0px;
|
250 |
+
border-top-right-radius: 0px;
|
251 |
+
border-bottom-right-radius: 0px;
|
252 |
+
}
|
253 |
+
|
254 |
+
/* number */
|
255 |
+
.the-metabox.number input.number { width:50px !important; }
|
256 |
+
/* number */
|
257 |
+
.rm_number .number {
|
258 |
+
width: 70px;
|
259 |
+
text-align: right;
|
260 |
+
-webkit-border-top-right-radius: 0px;
|
261 |
+
-webkit-border-bottom-right-radius: 0px;
|
262 |
+
-moz-border-radius-topright: 0px;
|
263 |
+
-moz-border-radius-bottomright: 0px;
|
264 |
+
border-top-right-radius: 0px;
|
265 |
+
border-bottom-right-radius: 0px;
|
266 |
+
}
|
267 |
+
|
268 |
+
.spinner-wrapper { position: relative; height: 23px; overflow: hidden; }
|
269 |
+
.spinner-wrapper input.number { float: left; }
|
270 |
+
.spinner-wrapper .spinner-button { cursor:pointer; float: left; position: absolute; left: 69px; width: 15px; height: 12px; border: 1px solid #DFDFDF; background: #fff; margin: 0; padding: 0; line-height: 9999px; overflow: hidden; background: url('../images/spinner.png') no-repeat center -11px }
|
271 |
+
.spinner-wrapper .spinner-button.button-plus { top: 0; -webkit-border-top-right-radius: 3px !important; -moz-border-radius-topright: 3px !important; border-top-right-radius: 3px !important; }
|
272 |
+
.spinner-wrapper .spinner-button.button-minus { bottom: 0; background-position: center -30px; -webkit-border-bottom-right-radius: 3px !important; -moz-border-radius-bottomright: 3px !important; border-bottom-right-radius: 3px !important; }
|
273 |
+
|
274 |
+
|
275 |
+
.spinner-wrapper .spinner-button.button-plus:active { background-position: center 0px; }
|
276 |
+
.spinner-wrapper .spinner-button.button-minus:active { background-position: center -20px; }
|
277 |
+
|
278 |
+
|
279 |
+
.rm_typography .spinner_container { float: left; margin-right: 10px; }
|
280 |
+
.rm_typography .spinner-wrapper { height: 28px; }
|
281 |
+
.rm_typography .spinner-wrapper input.number { height: 28px; }
|
282 |
+
.rm_typography .spinner-wrapper .spinner-button.button-plus { height: 15px; background-position: center -10px; }
|
283 |
+
.rm_typography .spinner-wrapper .spinner-button.button-minus { height: 14px; }
|
284 |
+
|
285 |
+
.the-metabox .spinner-wrapper .spinner-button { left: 49px; }
|
286 |
+
.the-metabox.typography .spinner-wrapper .spinner-button { left: 35px; }
|
287 |
+
|
288 |
+
/* colorpicker */
|
289 |
+
.the-metabox.colorpicker { display:block; width: auto; height: auto; overflow: visible; background-image: none; position: static; font-family: inherit;}
|
290 |
+
.the-metabox.colorpicker input { background-color: transparent; border: 1px solid #DFDFDF; position: static; font-size: inherit; font-family: inherit; color: inherit; text-align: center; margin: 0 5px 0px; padding: 0; outline: none; width: auto; }
|
291 |
+
|
292 |
+
/* images */
|
293 |
+
.the-metabox.images, .the-metabox.images label { margin-left:0; display:block; }
|
294 |
+
.the-metabox.images .slides-wrapper { clear:both; }
|
295 |
+
.the-metabox.images .slides-wrapper li { position:relative; }
|
296 |
+
.the-metabox.images a.delete { display:block; margin-left:4px; text-decoration:none; font-weight:bold; color:red; position:absolute; top:0; right:0; width:10px; height:18px; z-index:10; cursor:pointer !important; }
|
297 |
+
|
298 |
+
/* wp editor */
|
299 |
+
.wp_themeSkin iframe { background: #fff !important; }
|
300 |
+
|
301 |
+
/* custom tabs */
|
302 |
+
.customtab_item {
|
303 |
+
border-style: solid;
|
304 |
+
border-width: 1px;
|
305 |
+
line-height: 1;
|
306 |
+
margin-bottom: 20px;
|
307 |
+
padding: 0;
|
308 |
+
background-color: #F5F5F5;
|
309 |
+
background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5);
|
310 |
+
border-color: #DFDFDF;
|
311 |
+
border-radius: 3px 3px 3px 3px;
|
312 |
+
box-shadow: 0 1px 0 #FFFFFF inset;
|
313 |
+
min-width: 255px;
|
314 |
+
position: relative;
|
315 |
+
}
|
316 |
+
.customtab_item .handlediv { position:relative; top: -4px; }
|
317 |
+
.customtab_item h3 { min-height: 21px }
|
318 |
+
.customtab_item .inside { padding: 10px !important; }
|
319 |
+
.customtab_item .deps { display: none; }
|
320 |
+
.customtab_item .addoptions p.option { margin: 5px 0 5px 200px }
|
321 |
+
.customtab_item .addoptions p label { width: 80px !important; }
|
322 |
+
.customtab_item .add-field-option { margin-bottom: 10px !important; }
|
323 |
+
.customtab_item .remove_item { float: right; }
|
324 |
+
.metabox-sortable-placeholder { border: 1px dotted #dedede; margin: 10px 0 }
|
325 |
+
|
326 |
+
.the-metabox.customtabs {
|
327 |
+
margin-left: 0;
|
328 |
+
}
|
329 |
+
|
330 |
+
#customtab_item_sample {
|
331 |
+
display: none;
|
332 |
+
}
|
333 |
+
|
334 |
+
.the-metabox.customtabs .field-row {
|
335 |
+
margin-bottom: 10px;
|
336 |
+
}
|
337 |
+
|
338 |
+
#yit_custom_tabs label {
|
339 |
+
font-weight: normal;
|
340 |
+
width: auto;
|
341 |
+
float: none;
|
342 |
+
line-height: auto;
|
343 |
+
margin-left: 0;
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
.wp-admin p label input[type=radio]{
|
348 |
+
width: 16px;
|
349 |
+
margin-right: 10px;
|
350 |
+
margin-top: 3px;
|
351 |
+
}
|
352 |
+
.wp-admin .form-field._preset_onsale_icon_field label input[type=radio]{
|
353 |
+
margin-top: 0;
|
354 |
+
}
|
355 |
+
|
356 |
+
.the-metabox .spinner {
|
357 |
+
margin-top: 5px;
|
358 |
+
float: none;
|
359 |
+
}
|
360 |
+
|
361 |
+
/* slider */
|
362 |
+
/*numbers*/
|
363 |
+
.ui-slider .maxCaption, .ui-slider .minCaption {
|
364 |
+
margin-bottom: 5px;
|
365 |
+
}
|
366 |
+
.ui-slider .feedback {
|
367 |
+
background: url(../images/slider/tooltip.png) no-repeat center top;
|
368 |
+
position: absolute;
|
369 |
+
top: -25px;
|
370 |
+
width: 35px;
|
371 |
+
height: 43px;
|
372 |
+
text-align: center;
|
373 |
+
width: 100%;
|
374 |
+
display: block;
|
375 |
+
}
|
376 |
+
.ui-slider .feedback strong {
|
377 |
+
display: inline-block;
|
378 |
+
padding-top: 4px;
|
379 |
+
top: -30px;
|
380 |
+
}
|
381 |
+
/*handle*/
|
382 |
+
.ui-slider-horizontal .ui-slider-handle{
|
383 |
+
background: transparent url(../images/slider/handle.png) no-repeat left top !important;
|
384 |
+
border: 0px !important;
|
385 |
+
top: -.35em !important;
|
386 |
+
width: 18px !important;
|
387 |
+
height: 19px !important;
|
388 |
+
}
|
389 |
+
|
390 |
+
/*bg on the left:grey*/
|
391 |
+
.ui-slider.ui-widget-content {
|
392 |
+
background: url(../images/slider/grey.gif) repeat-x left center !important;
|
393 |
+
border-color: #c1c1c0 !important;
|
394 |
+
height: 10px !important;
|
395 |
+
}
|
396 |
+
|
397 |
+
.iris-slider-offset.ui-slider.ui-widget-content {
|
398 |
+
background: transparent!important;
|
399 |
+
height: auto!important;
|
400 |
+
}
|
401 |
+
|
402 |
+
/*bg on the right:orange*/
|
403 |
+
.ui-slider.ui-widget-content .ui-widget-header {
|
404 |
+
background: url(../images/slider/orange.gif) repeat-x left center !important;
|
405 |
+
left: 2px !important;
|
406 |
+
-webkit-border-radius: 15px;
|
407 |
+
-moz-border-radius: 15px;
|
408 |
+
-khtml-border-radius: 15px;
|
409 |
+
border-radius: 15px;
|
410 |
+
}
|
411 |
+
|
412 |
+
|
413 |
+
/*sidebars*/
|
414 |
+
|
415 |
+
#choose-sidebars.choose{
|
416 |
+
margin-left: 0px;
|
417 |
+
}
|
418 |
+
|
419 |
+
|
420 |
+
#_active_page_options-container label, #_active_page_options-container p{
|
421 |
+
display: inline-block;
|
422 |
+
margin: 0px;
|
423 |
+
}
|
424 |
+
#_active_page_options-container label{
|
425 |
+
margin-right: 10px;
|
426 |
+
margin-top: 3px;
|
427 |
+
}
|
428 |
+
#_active_page_options-container {
|
429 |
+
float: right;
|
430 |
+
margin-right: 20px;
|
431 |
+
margin-top: 5px;
|
432 |
+
}
|
433 |
+
|
434 |
+
/* sortable table posts */
|
435 |
+
|
436 |
+
#the-list.ui-sortable tr:hover {
|
437 |
+
cursor: move;
|
438 |
+
}
|
439 |
+
|
440 |
+
|
441 |
+
/*datepicker*/
|
442 |
+
/*! jQuery UI - v1.11.2 - 2015-01-21
|
443 |
+
* http://jqueryui.com
|
444 |
+
* Includes: core.css, datepicker.css, theme.css
|
445 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=0px&bgColorHeader=%23dddddd&bgTextureHeader=flat&bgImgOpacityHeader=60&borderColorHeader=%23aaaaaa&fcHeader=%23222222&iconColorHeader=%23222222&bgColorContent=%23ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=%23aaaaaa&fcContent=%23222222&iconColorContent=%23222222&bgColorDefault=%23e9e9e9&bgTextureDefault=flat&bgImgOpacityDefault=75&borderColorDefault=%23d3d3d3&fcDefault=%23555555&iconColorDefault=%23888888&bgColorHover=%23dadada&bgTextureHover=flat&bgImgOpacityHover=75&borderColorHover=%23999999&fcHover=%23212121&iconColorHover=%23454545&bgColorActive=%23ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=%23aaaaaa&fcActive=%23212121&iconColorActive=%23454545&bgColorHighlight=%23fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=%2389b17e&fcHighlight=%23363636&iconColorHighlight=%232e83ff&bgColorError=%23fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=%23cd0a0a&fcError=%23cd0a0a&iconColorError=%23cd0a0a&bgColorOverlay=%23aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=%23aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
446 |
+
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
447 |
+
|
448 |
+
/* Layout helpers
|
449 |
+
----------------------------------*/
|
450 |
+
.ui-helper-hidden {
|
451 |
+
display: none;
|
452 |
+
}
|
453 |
+
.ui-helper-hidden-accessible {
|
454 |
+
border: 0;
|
455 |
+
clip: rect(0 0 0 0);
|
456 |
+
height: 1px;
|
457 |
+
margin: -1px;
|
458 |
+
overflow: hidden;
|
459 |
+
padding: 0;
|
460 |
+
position: absolute;
|
461 |
+
width: 1px;
|
462 |
+
}
|
463 |
+
.ui-helper-reset {
|
464 |
+
margin: 0;
|
465 |
+
padding: 0;
|
466 |
+
border: 0;
|
467 |
+
outline: 0;
|
468 |
+
line-height: 1.3;
|
469 |
+
text-decoration: none;
|
470 |
+
font-size: 100%;
|
471 |
+
list-style: none;
|
472 |
+
}
|
473 |
+
.ui-helper-clearfix:before,
|
474 |
+
.ui-helper-clearfix:after {
|
475 |
+
content: "";
|
476 |
+
display: table;
|
477 |
+
border-collapse: collapse;
|
478 |
+
}
|
479 |
+
.ui-helper-clearfix:after {
|
480 |
+
clear: both;
|
481 |
+
}
|
482 |
+
.ui-helper-clearfix {
|
483 |
+
min-height: 0; /* support: IE7 */
|
484 |
+
}
|
485 |
+
.ui-helper-zfix {
|
486 |
+
width: 100%;
|
487 |
+
height: 100%;
|
488 |
+
top: 0;
|
489 |
+
left: 0;
|
490 |
+
position: absolute;
|
491 |
+
opacity: 0;
|
492 |
+
filter:Alpha(Opacity=0); /* support: IE8 */
|
493 |
+
}
|
494 |
+
|
495 |
+
.ui-front {
|
496 |
+
z-index: 100;
|
497 |
+
}
|
498 |
+
|
499 |
+
|
500 |
+
/* Interaction Cues
|
501 |
+
----------------------------------*/
|
502 |
+
.ui-state-disabled {
|
503 |
+
cursor: default !important;
|
504 |
+
}
|
505 |
+
|
506 |
+
|
507 |
+
/* Icons
|
508 |
+
----------------------------------*/
|
509 |
+
|
510 |
+
/* states and images */
|
511 |
+
.ui-icon {
|
512 |
+
display: block;
|
513 |
+
text-indent: -99999px;
|
514 |
+
overflow: hidden;
|
515 |
+
background-repeat: no-repeat;
|
516 |
+
}
|
517 |
+
|
518 |
+
|
519 |
+
/* DATE PICKER
|
520 |
+
----------------------------------*/
|
521 |
+
|
522 |
+
.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}
|
523 |
+
.ui-datepicker{width:17em;padding:.2em .2em 0;display:none;z-index:100!important;}
|
524 |
+
.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}
|
525 |
+
.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}
|
526 |
+
.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}
|
527 |
+
.ui-datepicker .ui-datepicker-prev{left:2px}
|
528 |
+
.ui-datepicker .ui-datepicker-next{right:2px}
|
529 |
+
.ui-datepicker .ui-datepicker-prev-hover{left:1px}
|
530 |
+
.ui-datepicker .ui-datepicker-next-hover{right:1px}
|
531 |
+
.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}
|
532 |
+
.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}
|
533 |
+
.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}
|
534 |
+
.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}
|
535 |
+
.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}
|
536 |
+
.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:700;border:0}
|
537 |
+
.ui-datepicker td{border:0;padding:1px}
|
538 |
+
.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}
|
539 |
+
.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}
|
540 |
+
.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em;width:auto;overflow:visible}
|
541 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}
|
542 |
+
.ui-datepicker.ui-datepicker-multi{width:auto}
|
543 |
+
.ui-datepicker-multi .ui-datepicker-group{float:left}
|
544 |
+
.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}
|
545 |
+
.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}
|
546 |
+
.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}
|
547 |
+
.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}
|
548 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}
|
549 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}
|
550 |
+
.ui-datepicker-row-break{clear:both;width:100%;font-size:0}
|
551 |
+
.ui-datepicker-rtl{direction:rtl}
|
552 |
+
.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}
|
553 |
+
.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}
|
554 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}
|
555 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}
|
556 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}
|
557 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}
|
558 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}
|
559 |
+
.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}
|
560 |
+
.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}
|
561 |
+
.ui-widget .ui-widget{font-size:1em}
|
562 |
+
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}
|
563 |
+
.ui-widget-content{border:1px solid #aaa;background:#fff 50% 50% repeat-x;color:#222}
|
564 |
+
.ui-widget-content a{color:#222}
|
565 |
+
.ui-widget-header{border:1px solid #aaa;background:#ddd 50% 50% repeat-x;color:#222;font-weight:700}
|
566 |
+
.ui-widget-header a{color:#222}
|
567 |
+
.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:0 solid #d3d3d3;background:#e9e9e9 50% 50% repeat-x;font-weight:400;color:#555}
|
568 |
+
.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}
|
569 |
+
.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{border:0 solid #999;background:#dadada 50% 50% repeat-x;font-weight:400;color:#212121}
|
570 |
+
.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{color:#212121;text-decoration:none}
|
571 |
+
.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:0 solid #aaa;background:#fff 50% 50% repeat-x;font-weight:400;color:#212121}
|
572 |
+
.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}
|
573 |
+
.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:0 solid #89b17e;background:#fbf9ee 50% 50% repeat-x;color:#363636}
|
574 |
+
.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}
|
575 |
+
.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:0 solid #cd0a0a;background:#fef1ec 50% 50% repeat-x;color:#cd0a0a}
|
576 |
+
.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}
|
577 |
+
.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}
|
578 |
+
.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}
|
579 |
+
.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}
|
580 |
+
.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}
|
581 |
+
.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}
|
582 |
+
.ui-icon{width:16px;height:16px}
|
583 |
+
.ui-icon,.ui-widget-content .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
|
584 |
+
.ui-widget-header .ui-icon{background-image:url(../images/ui-icons_222222_256x240.png)}
|
585 |
+
.ui-state-default .ui-icon{background-image:url(../images/ui-icons_888888_256x240.png)}
|
586 |
+
.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
|
587 |
+
.ui-state-active .ui-icon{background-image:url(../images/ui-icons_454545_256x240.png)}
|
588 |
+
.ui-state-highlight .ui-icon{background-image:url(../images/ui-icons_2e83ff_256x240.png)}
|
589 |
+
.ui-icon-circle-triangle-e{background-position:-48px -192px}
|
590 |
+
.ui-icon-circle-triangle-s{background-position:-64px -192px}
|
591 |
+
.ui-icon-circle-triangle-w{background-position:-80px -192px}
|
592 |
+
.ui-icon-circle-triangle-n{background-position:-96px -192px}
|
593 |
+
.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:0}
|
594 |
+
.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:0}
|
595 |
+
.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:0}
|
596 |
+
.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:0}
|
597 |
+
.ui-widget-overlay{background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}
|
598 |
+
.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
|
599 |
+
|
600 |
+
|
601 |
+
.the-metabox.preview{
|
602 |
+
float: none;
|
603 |
+
}
|
604 |
+
.metaboxes-tab .the-metabox.no-label.preview{
|
605 |
+
margin-left: 184px;
|
606 |
+
}
|
607 |
+
.metaboxes-tab .the-metabox.no-label.preview img{
|
608 |
+
box-shadow: 0 1px 8px rgba(0,0,0,0.2);
|
609 |
+
}
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_0_eeeeee_40x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_55_c0402a_40x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_flat_55_eeeeee_40x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_100_f8f8f8_1x400.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_35_dddddd_1x400.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_glass_60_eeeeee_1x400.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_inset-hard_75_999999_1x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-bg_inset-soft_50_c9c9c9_1x100.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_3383bb_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_454545_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_70b2e1_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_999999_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/images/ui-icons_fbc856_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/overcast/jquery-ui-1.8.9.custom.css
ADDED
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.8
|
3 |
+
*
|
4 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
+
.ui-helper-clearfix { display: inline-block; }
|
18 |
+
/* required comment for clearfix to work in Opera \*/
|
19 |
+
* html .ui-helper-clearfix { height:1%; }
|
20 |
+
.ui-helper-clearfix { display:block; }
|
21 |
+
/* end clearfix */
|
22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
+
|
24 |
+
|
25 |
+
/* Interaction Cues
|
26 |
+
----------------------------------*/
|
27 |
+
.ui-state-disabled { cursor: default !important; }
|
28 |
+
|
29 |
+
|
30 |
+
/* Icons
|
31 |
+
----------------------------------*/
|
32 |
+
|
33 |
+
/* states and images */
|
34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
+
|
36 |
+
|
37 |
+
/* Misc visuals
|
38 |
+
----------------------------------*/
|
39 |
+
|
40 |
+
/* Overlays */
|
41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
+
|
43 |
+
|
44 |
+
/*
|
45 |
+
* jQuery UI CSS Framework 1.8.8
|
46 |
+
*
|
47 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
48 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
49 |
+
* http://jquery.org/license
|
50 |
+
*
|
51 |
+
* http://docs.jquery.com/UI/Theming/API
|
52 |
+
*
|
53 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Helvetica,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=dddddd&bgTextureHeader=02_glass.png&bgImgOpacityHeader=35&borderColorHeader=bbbbbb&fcHeader=444444&iconColorHeader=999999&bgColorContent=c9c9c9&bgTextureContent=05_inset_soft.png&bgImgOpacityContent=50&borderColorContent=aaaaaa&fcContent=333333&iconColorContent=999999&bgColorDefault=eeeeee&bgTextureDefault=02_glass.png&bgImgOpacityDefault=60&borderColorDefault=cccccc&fcDefault=3383bb&iconColorDefault=70b2e1&bgColorHover=f8f8f8&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=bbbbbb&fcHover=599fcf&iconColorHover=3383bb&bgColorActive=999999&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=75&borderColorActive=999999&fcActive=ffffff&iconColorActive=454545&bgColorHighlight=eeeeee&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=ffffff&fcHighlight=444444&iconColorHighlight=3383bb&bgColorError=c0402a&bgTextureError=01_flat.png&bgImgOpacityError=55&borderColorError=c0402a&fcError=ffffff&iconColorError=fbc856&bgColorOverlay=eeeeee&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=80&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=60&thicknessShadow=4px&offsetTopShadow=-4px&offsetLeftShadow=-4px&cornerRadiusShadow=0pxdow=0px
|
54 |
+
*/
|
55 |
+
|
56 |
+
|
57 |
+
/* Component containers
|
58 |
+
----------------------------------*/
|
59 |
+
.ui-widget { font-family: Trebuchet MS, Helvetica, Arial, sans-serif; font-size: 1.1em; }
|
60 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
61 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Helvetica, Arial, sans-serif; font-size: 1em; }
|
62 |
+
.ui-widget-content { border: 1px solid #aaaaaa; background: #f1f1f1; color: #333333; }
|
63 |
+
.ui-widget-content a { color: #333333; }
|
64 |
+
.ui-widget-header { border: 1px solid #bbbbbb; background: #ccc; color: #444444; font-weight: bold; }
|
65 |
+
.ui-widget-header a { color: #444444; }
|
66 |
+
|
67 |
+
/* Interaction states
|
68 |
+
----------------------------------*/
|
69 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #eeeeee url(images/ui-bg_glass_60_eeeeee_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #3383bb; }
|
70 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #3383bb; text-decoration: none; }
|
71 |
+
.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 { border: 1px solid #bbbbbb; background: #f8f8f8 url(images/ui-bg_glass_100_f8f8f8_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #599fcf; }
|
72 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #599fcf; text-decoration: none; }
|
73 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #999999; background: #999999 url(images/ui-bg_inset-hard_75_999999_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #ffffff; }
|
74 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #ffffff; text-decoration: none; }
|
75 |
+
.ui-widget :active { outline: none; }
|
76 |
+
|
77 |
+
/* Interaction Cues
|
78 |
+
----------------------------------*/
|
79 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #ffffff; background: #eeeeee url(images/ui-bg_flat_55_eeeeee_40x100.png) 50% 50% repeat-x; color: #444444; }
|
80 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #444444; }
|
81 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #c0402a; background: #c0402a url(images/ui-bg_flat_55_c0402a_40x100.png) 50% 50% repeat-x; color: #ffffff; }
|
82 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
|
83 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
|
84 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
85 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
86 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
87 |
+
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; }
|
88 |
+
.ui-sortable-placeholder * { visibility: hidden; }
|
89 |
+
|
90 |
+
/* Icons
|
91 |
+
----------------------------------*/
|
92 |
+
|
93 |
+
/* states and images */
|
94 |
+
/*.ui-widget-content .ui-icon {background-image: url(images/ui-icons_999999_256x240.png); }
|
95 |
+
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_999999_256x240.png); } */
|
96 |
+
.ui-state-default .ui-icon { background-image: url(images/ui-icons_70b2e1_256x240.png); }
|
97 |
+
/*.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_3383bb_256x240.png); }
|
98 |
+
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
99 |
+
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_3383bb_256x240.png); }
|
100 |
+
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_fbc856_256x240.png); } */
|
101 |
+
|
102 |
+
/* positioning */
|
103 |
+
/*.ui-icon-carat-1-n { background-position: 0 0; }
|
104 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
105 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
106 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
107 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
108 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
109 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
110 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
111 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
112 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
113 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
114 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
115 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
116 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
117 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
118 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
119 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
120 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
121 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
122 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
123 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
124 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
125 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
126 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
127 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
128 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
129 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
130 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
131 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
132 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
133 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
134 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
135 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
136 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
137 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
138 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
139 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
140 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
141 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
142 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
143 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
144 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
145 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
146 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
147 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
148 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
149 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
150 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
151 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
152 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
153 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
154 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
155 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
156 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
157 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
158 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
159 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
160 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
161 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
162 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
163 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
164 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
165 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
166 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
167 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
168 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
169 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
170 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
171 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
172 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
173 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
174 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
175 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
176 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
177 |
+
.ui-icon-document { background-position: -32px -96px; }
|
178 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
179 |
+
.ui-icon-note { background-position: -64px -96px; }
|
180 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
181 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
182 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
183 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
184 |
+
.ui-icon-person { background-position: -144px -96px; }
|
185 |
+
.ui-icon-print { background-position: -160px -96px; }
|
186 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
187 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
188 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
189 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
190 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
191 |
+
.ui-icon-home { background-position: 0 -112px; }
|
192 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
193 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
194 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
195 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
196 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
197 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
198 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
199 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
200 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
201 |
+
.ui-icon-search { background-position: -160px -112px; }
|
202 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
203 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
204 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
205 |
+
.ui-icon-star { background-position: -224px -112px; }
|
206 |
+
.ui-icon-link { background-position: -240px -112px; }
|
207 |
+
.ui-icon-cancel { background-position: 0 -128px; } */
|
208 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
209 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
210 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
211 |
+
/*.ui-icon-plusthick { background-position: -32px -128px; }
|
212 |
+
.ui-icon-close { background-position: -80px -128px; }
|
213 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
214 |
+
.ui-icon-key { background-position: -112px -128px; }
|
215 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
216 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
217 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
218 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
219 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
220 |
+
.ui-icon-image { background-position: -208px -128px; }
|
221 |
+
.ui-icon-video { background-position: -224px -128px; }
|
222 |
+
.ui-icon-script { background-position: -240px -128px; }
|
223 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
224 |
+
.ui-icon-info { background-position: -16px -144px; }
|
225 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
226 |
+
.ui-icon-help { background-position: -48px -144px; }
|
227 |
+
.ui-icon-check { background-position: -64px -144px; }
|
228 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
229 |
+
.ui-icon-radio-off { background-position: -96px -144px; }
|
230 |
+
.ui-icon-radio-on { background-position: -112px -144px; }
|
231 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
232 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
233 |
+
.ui-icon-play { background-position: 0 -160px; }
|
234 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
235 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
236 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
237 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
238 |
+
.ui-icon-seek-start { background-position: -80px -160px; } */
|
239 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
240 |
+
/*.ui-icon-seek-first { background-position: -80px -160px; }
|
241 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
242 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
243 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
244 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
245 |
+
.ui-icon-power { background-position: 0 -176px; }
|
246 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
247 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
248 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
249 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
250 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
251 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
252 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
253 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
254 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
255 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
256 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
257 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
258 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
259 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
260 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
261 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
262 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
263 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
264 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
265 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
266 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
267 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
268 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
269 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
270 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
271 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
272 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
273 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
274 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
275 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
276 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
277 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; } */
|
278 |
+
|
279 |
+
|
280 |
+
/* Misc visuals
|
281 |
+
----------------------------------*/
|
282 |
+
|
283 |
+
/* Corner radius */
|
284 |
+
.ui-corner-tl { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; }
|
285 |
+
.ui-corner-tr { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; }
|
286 |
+
.ui-corner-bl { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; }
|
287 |
+
.ui-corner-br { -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; }
|
288 |
+
.ui-corner-top { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; }
|
289 |
+
.ui-corner-bottom { -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; }
|
290 |
+
.ui-corner-right { -moz-border-radius-topright: 6px; -webkit-border-top-right-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomright: 6px; -webkit-border-bottom-right-radius: 6px; border-bottom-right-radius: 6px; }
|
291 |
+
.ui-corner-left { -moz-border-radius-topleft: 6px; -webkit-border-top-left-radius: 6px; border-top-left-radius: 6px; -moz-border-radius-bottomleft: 6px; -webkit-border-bottom-left-radius: 6px; border-bottom-left-radius: 6px; }
|
292 |
+
.ui-corner-all { -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; }
|
293 |
+
|
294 |
+
/* Overlays */
|
295 |
+
.ui-widget-overlay { background: #eeeeee url(images/ui-bg_flat_0_eeeeee_40x100.png) 50% 50% repeat-x; opacity: .80;filter:Alpha(Opacity=80); }
|
296 |
+
.ui-widget-shadow { margin: -4px 0 0 -4px; padding: 4px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 0pxdow=0px; -webkit-border-radius: 0pxdow=0px; border-radius: 0pxdow=0px; }/*
|
297 |
+
* jQuery UI Slider 1.8.8
|
298 |
+
*
|
299 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
300 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
301 |
+
* http://jquery.org/license
|
302 |
+
*
|
303 |
+
* http://docs.jquery.com/UI/Slider#theming
|
304 |
+
*/
|
305 |
+
.ui-slider { position: relative; text-align: left; width:340px; float:left }
|
306 |
+
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
307 |
+
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
308 |
+
.ui-slider .minCaption { float: left }
|
309 |
+
.ui-slider .maxCaption { float: right }
|
310 |
+
.ui-slider .feedback { text-align:center; width:100%; display:block }
|
311 |
+
|
312 |
+
.ui-slider-horizontal { height: .8em; }
|
313 |
+
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
314 |
+
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
315 |
+
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
316 |
+
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
317 |
+
|
318 |
+
.ui-slider-vertical { width: .8em; height: 100px; }
|
319 |
+
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
320 |
+
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
321 |
+
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
322 |
+
.ui-slider-vertical .ui-slider-range-max { top: 0; }
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/yit-plugin-panel.css
ADDED
@@ -0,0 +1,653 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* This file belongs to the YIT Plugin Framework.
|
3 |
+
*
|
4 |
+
* This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
|
5 |
+
* that is bundled with this package in the file LICENSE.txt.
|
6 |
+
* It is also available through the world-wide-web at this URL:
|
7 |
+
* http://www.gnu.org/licenses/gpl-3.0.txt
|
8 |
+
*/
|
9 |
+
|
10 |
+
/* onoff */
|
11 |
+
.rm_onoff input {
|
12 |
+
display: none;
|
13 |
+
}
|
14 |
+
|
15 |
+
.rm_onoff input + span {
|
16 |
+
cursor: pointer;
|
17 |
+
text-indent: -9999px;
|
18 |
+
display: block;
|
19 |
+
width: 85px;
|
20 |
+
height: 37px;
|
21 |
+
background: transparent url(../images/off.png);
|
22 |
+
}
|
23 |
+
|
24 |
+
.rm_onoff input:checked + span {
|
25 |
+
background: transparent url(../images/on.png);
|
26 |
+
}
|
27 |
+
|
28 |
+
.rm_onoff input.onoffchecked + span {
|
29 |
+
background: transparent url(../images/on.png);
|
30 |
+
}
|
31 |
+
|
32 |
+
/* slider */
|
33 |
+
/*numbers*/
|
34 |
+
.ui-slider .maxCaption, .ui-slider .minCaption {
|
35 |
+
margin-bottom: 5px;
|
36 |
+
}
|
37 |
+
.ui-slider .feedback {
|
38 |
+
background: url(../images/slider/tooltip.png) no-repeat center top;
|
39 |
+
position: absolute;
|
40 |
+
top: -25px;
|
41 |
+
width: 35px;
|
42 |
+
height: 43px;
|
43 |
+
text-align: center;
|
44 |
+
width: 100%;
|
45 |
+
display: block;
|
46 |
+
}
|
47 |
+
.ui-slider .feedback strong {
|
48 |
+
display: inline-block;
|
49 |
+
padding-top: 4px;
|
50 |
+
top: -30px;
|
51 |
+
}
|
52 |
+
/*handle*/
|
53 |
+
.yit-options .ui-slider-horizontal .ui-slider-handle,
|
54 |
+
.yit_options .ui-slider-horizontal .ui-slider-handle {
|
55 |
+
background: transparent url(../images/slider/handle.png) no-repeat left top !important;
|
56 |
+
border: 0px !important;
|
57 |
+
top: -.35em !important;
|
58 |
+
width: 18px !important;
|
59 |
+
height: 19px !important;
|
60 |
+
}
|
61 |
+
|
62 |
+
/*bg on the left:grey*/
|
63 |
+
.yit-options .ui-slider.ui-widget-content,
|
64 |
+
.yit_options .ui-slider.ui-widget-content {
|
65 |
+
background: url(../images/slider/grey.gif) repeat-x left center !important;
|
66 |
+
border-color: #c1c1c0 !important;
|
67 |
+
height: 10px !important;
|
68 |
+
}
|
69 |
+
|
70 |
+
.iris-slider-offset.ui-slider.ui-widget-content {
|
71 |
+
background: transparent!important;
|
72 |
+
height: auto!important;
|
73 |
+
}
|
74 |
+
|
75 |
+
/*bg on the right:orange*/
|
76 |
+
.ui-slider.ui-widget-content .ui-widget-header {
|
77 |
+
background: url(../images/slider/orange.gif) repeat-x left center !important;
|
78 |
+
left: 2px !important;
|
79 |
+
-webkit-border-radius: 15px;
|
80 |
+
-moz-border-radius: 15px;
|
81 |
+
-khtml-border-radius: 15px;
|
82 |
+
border-radius: 15px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.plugin-option tr{
|
86 |
+
border-bottom: 1px solid #ccc;
|
87 |
+
}
|
88 |
+
.plugin-option .yit_options,
|
89 |
+
.plugin-option .yit-options{
|
90 |
+
border-bottom: 0px;
|
91 |
+
}
|
92 |
+
.plugin-option .yit-options .option,
|
93 |
+
.plugin-option .yit_options .option {
|
94 |
+
width: 600px;
|
95 |
+
float: left;
|
96 |
+
}
|
97 |
+
|
98 |
+
.plugin-option .form-table td{
|
99 |
+
padding: 25px 10px;
|
100 |
+
}
|
101 |
+
|
102 |
+
.yit_options .select_wrapper,
|
103 |
+
.yit-options .select_wrapper {
|
104 |
+
background: url("../images/select.png") no-repeat scroll right center #FAFAFA;
|
105 |
+
border-color: #CCCCCC #EEEEEE #EEEEEE #CCCCCC;
|
106 |
+
border-radius: 4px 4px 4px 4px;
|
107 |
+
border-style: solid;
|
108 |
+
border-width: 1px;
|
109 |
+
color: #555555;
|
110 |
+
display: block;
|
111 |
+
float: left;
|
112 |
+
font-family: sans-serif;
|
113 |
+
font-size: 12px;
|
114 |
+
height: 26px;
|
115 |
+
margin-bottom: 9px !important;
|
116 |
+
margin-left: 0;
|
117 |
+
margin-right: 5px;
|
118 |
+
margin-top: 0;
|
119 |
+
width: 400px;
|
120 |
+
}
|
121 |
+
.chosen .select_wrapper {
|
122 |
+
background: none;
|
123 |
+
border: none;
|
124 |
+
}
|
125 |
+
.chosen .select_wrapper .chosen-container{
|
126 |
+
width: 338px!important;
|
127 |
+
}
|
128 |
+
.chosen .select_wrapper .chosen-container .search-field input{
|
129 |
+
height: 27px!important;
|
130 |
+
color: #333;
|
131 |
+
}
|
132 |
+
.chosen .select_wrapper .chosen-container .chosen-choices{
|
133 |
+
border: 1px solid #ddd;
|
134 |
+
box-shadow: none;
|
135 |
+
}
|
136 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice{
|
137 |
+
height: 15px!important;
|
138 |
+
min-width: 105px;
|
139 |
+
}
|
140 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice span{
|
141 |
+
line-height: 15px;
|
142 |
+
height: 15px;
|
143 |
+
padding-top: 2px;
|
144 |
+
}
|
145 |
+
.chosen .select_wrapper .chosen-container .chosen-choices li.search-choice a.search-choice-close{
|
146 |
+
top: 5px;
|
147 |
+
}
|
148 |
+
.chosen .select_wrapper .chosen-container .chosen-drop .chosen-search input{
|
149 |
+
width: 100%!important;
|
150 |
+
}
|
151 |
+
|
152 |
+
/* === Multiple Chosen Customizzation === */
|
153 |
+
|
154 |
+
.yith-choosen .chosen-choices {
|
155 |
+
line-height: 27px;
|
156 |
+
min-height: 27px;
|
157 |
+
border: 1px solid #ddd;
|
158 |
+
}
|
159 |
+
|
160 |
+
.yith-choosen .chosen-container-active .chosen-choices{
|
161 |
+
border: 1px solid #5b9dd9;
|
162 |
+
-webkit-box-shadow: 0 0 2px rgba(30,140,190,.8);
|
163 |
+
box-shadow: 0 0 2px rgba(30,140,190,.8);
|
164 |
+
}
|
165 |
+
|
166 |
+
.select_wrapper span {
|
167 |
+
height: 26px;
|
168 |
+
line-height: 26px;
|
169 |
+
padding-left: 6px;
|
170 |
+
position: absolute;
|
171 |
+
z-index: 2;
|
172 |
+
overflow: hidden;
|
173 |
+
}
|
174 |
+
.ie8 .yit_options select,
|
175 |
+
.ie8 .yit-options select {
|
176 |
+
height: 26px;
|
177 |
+
}
|
178 |
+
.yit_options select, .yit-options select, .the-metabox .select_wrapper select {
|
179 |
+
cursor: pointer;
|
180 |
+
height: 28px;
|
181 |
+
margin: 0;
|
182 |
+
opacity: 0;
|
183 |
+
padding: 0;
|
184 |
+
position: relative;
|
185 |
+
width: inherit;
|
186 |
+
z-index: 4;
|
187 |
+
background-color: #FAFAFA;
|
188 |
+
}
|
189 |
+
|
190 |
+
/* === Single Chosen Customizzation === */
|
191 |
+
|
192 |
+
.yith-choosen .chosen-container-single .chosen-default {
|
193 |
+
background: transparent;
|
194 |
+
border-color: #ddd;
|
195 |
+
}
|
196 |
+
|
197 |
+
.yith-choosen .chosen-search > input[type=text]{
|
198 |
+
width: 100% !important;
|
199 |
+
}
|
200 |
+
|
201 |
+
.yith-choosen .chosen-container-single .chosen-single {
|
202 |
+
background: transparent;
|
203 |
+
border-color: #ddd;
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
/* Style to woocommerce panel*/
|
208 |
+
|
209 |
+
#plugin-fw-wc{
|
210 |
+
padding-top: 20px;
|
211 |
+
}
|
212 |
+
#plugin-fw-wc table.form-table{
|
213 |
+
background-color: #fff;
|
214 |
+
margin-bottom: 20px;
|
215 |
+
}
|
216 |
+
#plugin-fw-wc table.form-table th {
|
217 |
+
padding: 20px;
|
218 |
+
}
|
219 |
+
#plugin-fw-wc h3{
|
220 |
+
padding:0px 10px 10px ;
|
221 |
+
border-bottom: 1px solid #eee;
|
222 |
+
}
|
223 |
+
|
224 |
+
/* === VIDEO BOX === */
|
225 |
+
|
226 |
+
.yith-videobox-wrapper {
|
227 |
+
padding-top: 20px;
|
228 |
+
}
|
229 |
+
.yith-videobox-wrapper h3{
|
230 |
+
padding:0px 10px 10px ;
|
231 |
+
border-bottom: 1px solid #eee;
|
232 |
+
}
|
233 |
+
|
234 |
+
.yith-videobox-wrapper .postbox {
|
235 |
+
display: inline-block;
|
236 |
+
}
|
237 |
+
.yith-videobox-wrapper .yith_videobox .column {
|
238 |
+
width: 45%;
|
239 |
+
float: left;
|
240 |
+
padding-right: 2.5%;
|
241 |
+
border-right: 1px solid #ebebeb;
|
242 |
+
padding-bottom: 2em;
|
243 |
+
}
|
244 |
+
.yith-videobox-wrapper .yith_videobox .column.two {
|
245 |
+
margin-right: 0;
|
246 |
+
padding-right: 0;
|
247 |
+
padding-left: 2.5%;
|
248 |
+
border: 0;
|
249 |
+
max-width: 49%;
|
250 |
+
}
|
251 |
+
.yith-videobox-wrapper .yith_videobox h2{
|
252 |
+
font-size: 16px;
|
253 |
+
margin-bottom: 20px;
|
254 |
+
}
|
255 |
+
.yith-videobox-wrapper .yith-video-link {
|
256 |
+
width: 100%;
|
257 |
+
max-width: 200px;
|
258 |
+
float: left;
|
259 |
+
margin: 0 1.5em 1.5em 0;
|
260 |
+
}
|
261 |
+
.yith-videobox-wrapper .yith-video-link {
|
262 |
+
width: 100%;
|
263 |
+
max-width: 200px;
|
264 |
+
float: left;
|
265 |
+
margin: 0 1.5em 1.5em 0;
|
266 |
+
}
|
267 |
+
.yith-videobox-wrapper .yith-image-frame img {
|
268 |
+
max-width: 100%;
|
269 |
+
height: auto;
|
270 |
+
}
|
271 |
+
.yith-videobox-wrapper .yith-video-link img {
|
272 |
+
max-width: 100%;
|
273 |
+
height: auto;
|
274 |
+
}
|
275 |
+
.yith-videobox-wrapper .yith-video-iframe {
|
276 |
+
display: none;
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
+
/* === Plugins Upgrader === */
|
281 |
+
|
282 |
+
.yit-plugin-changelog-wrapper {
|
283 |
+
display: none;
|
284 |
+
}
|
285 |
+
|
286 |
+
.yit-plugin-changelog-title {
|
287 |
+
text-transform: uppercase;
|
288 |
+
}
|
289 |
+
|
290 |
+
.yit-plugin-changelog {
|
291 |
+
background: #fcfcfc;
|
292 |
+
height: 97%;
|
293 |
+
z-index: 999;
|
294 |
+
overflow: auto;
|
295 |
+
}
|
296 |
+
|
297 |
+
/* === Plugins Licence Activation === */
|
298 |
+
|
299 |
+
.yit-container.plugin-licence-activation {
|
300 |
+
font-family: 'Raleway', sans-serif;
|
301 |
+
}
|
302 |
+
|
303 |
+
.yit-container.plugin-licence-activation .to-active-wrapper {
|
304 |
+
margin-bottom: 60px;
|
305 |
+
}
|
306 |
+
|
307 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form {
|
308 |
+
position: relative;
|
309 |
+
border-color: #e1e1e1;
|
310 |
+
border-style: solid;
|
311 |
+
border-width: 0;
|
312 |
+
}
|
313 |
+
|
314 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:first-child {
|
315 |
+
border-top-width: 1px;
|
316 |
+
}
|
317 |
+
|
318 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:last-child {
|
319 |
+
border-bottom-width: 1px;
|
320 |
+
}
|
321 |
+
|
322 |
+
.yit-container.plugin-licence-activation .to-active-wrapper table.to-active-table {
|
323 |
+
border-width: 0;
|
324 |
+
border-spacing: 0;
|
325 |
+
width: 100%;
|
326 |
+
}
|
327 |
+
|
328 |
+
.yit-container.plugin-licence-activation .message {
|
329 |
+
display: none;
|
330 |
+
line-height: normal;
|
331 |
+
background: #ffffff url(../images/licence-error.png) 15px center no-repeat;
|
332 |
+
padding-left: 65px;
|
333 |
+
padding-right: 15px;
|
334 |
+
width: 150px;
|
335 |
+
}
|
336 |
+
|
337 |
+
.yit-container.plugin-licence-activation .message-wrapper {
|
338 |
+
height: 75px;
|
339 |
+
display: none;
|
340 |
+
position: absolute;
|
341 |
+
top: 0;
|
342 |
+
right: -250px;
|
343 |
+
border: 1px solid #ff3838;
|
344 |
+
}
|
345 |
+
|
346 |
+
.yit-container.plugin-licence-activation .message-wrapper.visible {
|
347 |
+
display: table;
|
348 |
+
}
|
349 |
+
|
350 |
+
.yit-container.plugin-licence-activation .message {
|
351 |
+
display: table-cell;
|
352 |
+
vertical-align: middle;
|
353 |
+
}
|
354 |
+
|
355 |
+
.yit-container.plugin-licence-activation .arrow-left:after,
|
356 |
+
.yit-container.plugin-licence-activation .arrow-left:before {
|
357 |
+
content: "";
|
358 |
+
display: block;
|
359 |
+
width: 0;
|
360 |
+
height: 0;
|
361 |
+
position: absolute;
|
362 |
+
}
|
363 |
+
|
364 |
+
.yit-container.plugin-licence-activation .arrow-left:before {
|
365 |
+
border-top: 9px solid transparent;
|
366 |
+
border-bottom: 9px solid transparent;
|
367 |
+
border-right: 9px solid #ff3838;
|
368 |
+
top: 26px;
|
369 |
+
left: -9px;
|
370 |
+
}
|
371 |
+
|
372 |
+
.yit-container.plugin-licence-activation .arrow-left:after {
|
373 |
+
border-top: 8px solid transparent;
|
374 |
+
border-bottom: 8px solid transparent;
|
375 |
+
border-right: 8px solid #fff;
|
376 |
+
left: -8px;
|
377 |
+
top: 27px;
|
378 |
+
}
|
379 |
+
|
380 |
+
.yit-container.plugin-licence-activation h2,
|
381 |
+
.yit-container.plugin-licence-activation h3 {
|
382 |
+
text-transform: uppercase;
|
383 |
+
font-weight: 800;
|
384 |
+
margin-bottom: 30px;
|
385 |
+
}
|
386 |
+
|
387 |
+
.yit-container.plugin-licence-activation h2 {
|
388 |
+
color: #808a97;
|
389 |
+
font-size: 25px;
|
390 |
+
}
|
391 |
+
.yit-container.plugin-licence-activation h3 {
|
392 |
+
color: #313131;
|
393 |
+
font-size: 15px;
|
394 |
+
height: 20px;
|
395 |
+
}
|
396 |
+
|
397 |
+
.yit-container.plugin-licence-activation h3.to-active {
|
398 |
+
height: 20px;
|
399 |
+
position: relative;
|
400 |
+
vertical-align: top;
|
401 |
+
}
|
402 |
+
|
403 |
+
.yit-container.plugin-licence-activation .spinner.show{
|
404 |
+
display: inline-block;
|
405 |
+
vertical-align: middle;
|
406 |
+
float: none;
|
407 |
+
}
|
408 |
+
|
409 |
+
.yit-container.plugin-licence-activation h3.to-active > .spinner.show {
|
410 |
+
display: inline-block;
|
411 |
+
float: none;
|
412 |
+
top: -3px;
|
413 |
+
position: relative;
|
414 |
+
}
|
415 |
+
|
416 |
+
.yit-container.plugin-licence-activation .licence-check-section{
|
417 |
+
margin-bottom: 60px;
|
418 |
+
}
|
419 |
+
|
420 |
+
.yit-container.plugin-licence-activation span.licence-label {
|
421 |
+
font-weight: 500;
|
422 |
+
color: #606060;
|
423 |
+
margin-bottom: 30px;
|
424 |
+
}
|
425 |
+
|
426 |
+
.yit-container.plugin-licence-activation .button-licence {
|
427 |
+
border: 0;
|
428 |
+
font-size: 13px;
|
429 |
+
text-transform: uppercase;
|
430 |
+
background-color: #808a97;
|
431 |
+
color: #fff;
|
432 |
+
font-weight: 700;
|
433 |
+
border-radius: 3px;
|
434 |
+
cursor: pointer;
|
435 |
+
text-decoration: none;
|
436 |
+
padding: 5px 7px;
|
437 |
+
-webkit-transition: background-color 0.3s ease;
|
438 |
+
-moz-transition: background-color 0.3s ease;
|
439 |
+
-ms-transition: background-color 0.3s ease;
|
440 |
+
-o-transition: background-color 0.3s ease;
|
441 |
+
transition: background-color 0.3s ease;
|
442 |
+
}
|
443 |
+
|
444 |
+
.yit-container.plugin-licence-activation .button-licence:hover {
|
445 |
+
background-color: #4d5c6f;
|
446 |
+
}
|
447 |
+
|
448 |
+
.yit-container.plugin-licence-activation .button-licence.clicked {
|
449 |
+
cursor: not-allowed;
|
450 |
+
background-color: #e2e2e2 !important;
|
451 |
+
}
|
452 |
+
|
453 |
+
.yit-container.plugin-licence-activation .button-licence.licence-check {
|
454 |
+
font-weight: 400;
|
455 |
+
padding: 12px 19px;
|
456 |
+
}
|
457 |
+
|
458 |
+
.yit-container.plugin-licence-activation .button-licence.licence-renew {
|
459 |
+
text-decoration: none;
|
460 |
+
padding: 7px 12px;
|
461 |
+
font-size: 9px;
|
462 |
+
}
|
463 |
+
|
464 |
+
.yit-container.plugin-licence-activation .button-licence.licence-renew:focus {
|
465 |
+
box-shadow: none;
|
466 |
+
}
|
467 |
+
|
468 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) {
|
469 |
+
width: 100%;
|
470 |
+
border: 1px solid #dcdcdc;
|
471 |
+
border-spacing: 0;
|
472 |
+
border-radius: 5px;
|
473 |
+
border-collapse: separate;
|
474 |
+
overflow: hidden;
|
475 |
+
}
|
476 |
+
|
477 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
478 |
+
border-bottom: 1px solid #dcdcdc;
|
479 |
+
}
|
480 |
+
|
481 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) td,
|
482 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
483 |
+
border-right: 1px solid #dcdcdc;
|
484 |
+
}
|
485 |
+
.yit-container.plugin-licence-activation table td:last-child,
|
486 |
+
.yit-container.plugin-licence-activation table th:last-child {
|
487 |
+
border-right: 0;
|
488 |
+
}
|
489 |
+
|
490 |
+
.yit-container.plugin-licence-activation table thead tr {
|
491 |
+
background-color: #f6f4f4;
|
492 |
+
}
|
493 |
+
|
494 |
+
.yit-container.plugin-licence-activation table tbody tr {
|
495 |
+
background-color: #ffffff;
|
496 |
+
}
|
497 |
+
|
498 |
+
.yit-container.plugin-licence-activation table thead tr th {
|
499 |
+
font-size: 13px;
|
500 |
+
color: #313131;
|
501 |
+
text-transform: uppercase;
|
502 |
+
font-weight: bold;
|
503 |
+
}
|
504 |
+
|
505 |
+
.yit-container.plugin-licence-activation table thead tr,
|
506 |
+
.yit-container.plugin-licence-activation table tbody tr {
|
507 |
+
line-height: 60px;
|
508 |
+
}
|
509 |
+
|
510 |
+
.yit-container.plugin-licence-activation table tbody tr td{
|
511 |
+
text-align: center;
|
512 |
+
line-height: 20px;
|
513 |
+
padding: 10px 5px;
|
514 |
+
}
|
515 |
+
|
516 |
+
.yit-container.plugin-licence-activation .button-licence.licence-activation {
|
517 |
+
padding: 12px 18px;
|
518 |
+
}
|
519 |
+
|
520 |
+
.yit-container.plugin-licence-activation .to-active-table tr {
|
521 |
+
line-height: 75px;
|
522 |
+
}
|
523 |
+
|
524 |
+
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row {
|
525 |
+
background-color: transparent;
|
526 |
+
-webkit-transition: all 0.3s ease;
|
527 |
+
-moz-transition: all 0.3s ease;
|
528 |
+
-ms-transition: all 0.3s ease;
|
529 |
+
-o-transition: all 0.3s ease;
|
530 |
+
transition: all 0.3s ease;
|
531 |
+
}
|
532 |
+
|
533 |
+
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row.error {
|
534 |
+
background-color: #ffdcdc;
|
535 |
+
}
|
536 |
+
|
537 |
+
.yit-container.plugin-licence-activation .to-active-table td {
|
538 |
+
padding-right: 12px;
|
539 |
+
width: 33%;
|
540 |
+
}
|
541 |
+
|
542 |
+
|
543 |
+
.yit-container.plugin-licence-activation .to-active-table td.plugin-name {
|
544 |
+
color: #808a97;
|
545 |
+
font-size: 12px;
|
546 |
+
text-transform: uppercase;
|
547 |
+
font-weight: bold;
|
548 |
+
line-height: 20px;
|
549 |
+
width: 20%;
|
550 |
+
padding-left: 20px;
|
551 |
+
}
|
552 |
+
|
553 |
+
.yit-container.plugin-licence-activation .to-active-table td.activate-button {
|
554 |
+
width: 15%;
|
555 |
+
position: relative;
|
556 |
+
}
|
557 |
+
|
558 |
+
.yit-container.plugin-licence-activation input[type=text],
|
559 |
+
.yit-container.plugin-licence-activation input[type=email]{
|
560 |
+
-webkit-transition: all 0.3s ease;
|
561 |
+
-moz-transition: all 0.3s ease;
|
562 |
+
-ms-transition: all 0.3s ease;
|
563 |
+
-o-transition: all 0.3s ease;
|
564 |
+
transition: all 0.3s ease;
|
565 |
+
|
566 |
+
border: 1px solid #dcdcdc;
|
567 |
+
padding: 0 15px;
|
568 |
+
border-radius: 3px;
|
569 |
+
height: 41px;
|
570 |
+
width: 100%;
|
571 |
+
}
|
572 |
+
|
573 |
+
.yit-container.plugin-licence-activation input[type=text].require,
|
574 |
+
.yit-container.plugin-licence-activation input[type=email].require {
|
575 |
+
border: 1px solid #ff3838;
|
576 |
+
}
|
577 |
+
|
578 |
+
.yit-container.plugin-licence-activation input[type=text]:focus,
|
579 |
+
.yit-container.plugin-licence-activation input[type=email]:focus{
|
580 |
+
webkit-box-shadow: 0 0 1px rgba(30,140,190,.8);
|
581 |
+
box-shadow: 0 0 1px rgba(30,140,190,.8);
|
582 |
+
}
|
583 |
+
|
584 |
+
.yit-container.plugin-licence-activation input[type=text]{
|
585 |
+
text-transform: uppercase;
|
586 |
+
text-align: center;
|
587 |
+
}
|
588 |
+
|
589 |
+
.yit-container.plugin-licence-activation input[type=email] {
|
590 |
+
text-align: left;
|
591 |
+
}
|
592 |
+
|
593 |
+
.yit-container.plugin-licence-activation input[type=submit]:focus{
|
594 |
+
outline: 0;
|
595 |
+
}
|
596 |
+
|
597 |
+
/* === Woocommerce panel === */
|
598 |
+
#plugin-fw-wc .yit_options{
|
599 |
+
padding: 0;
|
600 |
+
border: 0;
|
601 |
+
}
|
602 |
+
#plugin-fw-wc .yit_options input.upload_button, .yit_options input.button{
|
603 |
+
background: none;
|
604 |
+
border: 1px solid #ccc;
|
605 |
+
}
|
606 |
+
|
607 |
+
/* === WP Pointers === */
|
608 |
+
|
609 |
+
#adminmenu li.menu-top.yit-pointer-selected-row,
|
610 |
+
#adminmenu li.menu-top.yit-pointer-selected-row:hover,
|
611 |
+
#adminmenu li.yit-pointer-selected-row a.menu-top {
|
612 |
+
background-color: #acc327;
|
613 |
+
color: #000;
|
614 |
+
}
|
615 |
+
|
616 |
+
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer{
|
617 |
+
color: #000;
|
618 |
+
}
|
619 |
+
|
620 |
+
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer:hover,
|
621 |
+
#adminmenu .wp-submenu a.yit-pointer-selected-row {
|
622 |
+
color: #fff;
|
623 |
+
}
|
624 |
+
|
625 |
+
#adminmenu .wp-submenu a.yit-pointer-selected-row:hover {
|
626 |
+
color: #45bbe6;
|
627 |
+
}
|
628 |
+
|
629 |
+
/* WooCommerce 2.4 Support */
|
630 |
+
.woocommerce table.form-table .colorpick{
|
631 |
+
width: 6em;
|
632 |
+
}
|
633 |
+
|
634 |
+
/* === Responsive === */
|
635 |
+
|
636 |
+
@media (max-width: 767px) {}
|
637 |
+
|
638 |
+
@media (max-width: 480px) {}
|
639 |
+
|
640 |
+
@media (min-width: 768px) and (max-width: 992px) {}
|
641 |
+
|
642 |
+
@media (min-width: 980px) and (max-width: 1199px) {}
|
643 |
+
|
644 |
+
@media (min-width: 1200px) {
|
645 |
+
.yit-container.plugin-licence-activation{
|
646 |
+
width: 900px;
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
651 |
+
only screen and (-o-min-device-pixel-ratio: 3/2),
|
652 |
+
only screen and (min--moz-device-pixel-ratio: 1.5),
|
653 |
+
only screen and (min-device-pixel-ratio: 1.5) {}
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/css/yit-upgrader.css
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* === Plugins Upgrader === */
|
2 |
+
|
3 |
+
.yit-plugin-changelog-wrapper {
|
4 |
+
display: none;
|
5 |
+
}
|
6 |
+
|
7 |
+
.yit-plugin-changelog-title {
|
8 |
+
text-transform: uppercase;
|
9 |
+
}
|
10 |
+
|
11 |
+
.yit-plugin-changelog {
|
12 |
+
background: #fcfcfc;
|
13 |
+
height: 97%;
|
14 |
+
}
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/chosen/chosen-sprite.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/chosen/chosen-sprite@2x.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/double-sidebar.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/licence-error.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/no-sidebar.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/off.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/on.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/select.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sidebar-left.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sidebar-right.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/sleep.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/grey.gif
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/handle.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/orange.gif
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/slider/tooltip.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/spinner.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_222222_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_2e83ff_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_454545_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/ui-icons_888888_256x240.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/x.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/images/yithemes-icon.png
ADDED
Binary file
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/ajax-chosen.jquery.js
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Generated by CoffeeScript 1.3.1
|
2 |
+
|
3 |
+
(function($) {
|
4 |
+
return $.fn.ajaxChosen = function(settings, callback) {
|
5 |
+
var chosenXhr, defaultOptions, options, select;
|
6 |
+
if (settings == null) {
|
7 |
+
settings = {};
|
8 |
+
}
|
9 |
+
if (callback == null) {
|
10 |
+
callback = function() {};
|
11 |
+
}
|
12 |
+
defaultOptions = {
|
13 |
+
minTermLength: 3,
|
14 |
+
afterTypeDelay: 500,
|
15 |
+
jsonTermKey: "term"
|
16 |
+
};
|
17 |
+
select = this;
|
18 |
+
chosenXhr = null;
|
19 |
+
options = $.extend({}, defaultOptions, settings);
|
20 |
+
this.chosen();
|
21 |
+
return this.each(function() {
|
22 |
+
return $(this).next('.chosen-container').find(".search-field > input, .chosen-search > input").bind('keyup', function() {
|
23 |
+
var field, msg, success, val;
|
24 |
+
val = $.trim($(this).attr('value'));
|
25 |
+
msg = val.length < options.minTermLength ? "Keep typing..." : "Looking for '" + val + "'";
|
26 |
+
select.next('.chosen-container').find('.no-results').text(msg);
|
27 |
+
if (val === $(this).data('prevVal')) {
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
$(this).data('prevVal', val);
|
31 |
+
if (this.timer) {
|
32 |
+
clearTimeout(this.timer);
|
33 |
+
}
|
34 |
+
if (val.length < options.minTermLength) {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
field = $(this);
|
38 |
+
if (!(options.data != null)) {
|
39 |
+
options.data = {};
|
40 |
+
}
|
41 |
+
options.data[options.jsonTermKey] = val;
|
42 |
+
if (options.dataCallback != null) {
|
43 |
+
options.data = options.dataCallback(options.data);
|
44 |
+
}
|
45 |
+
success = options.success;
|
46 |
+
options.success = function(data) {
|
47 |
+
var items, selected_values;
|
48 |
+
if (!(data != null)) {
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
selected_values = [];
|
52 |
+
select.find('option').each(function() {
|
53 |
+
if (!$(this).is(":selected")) {
|
54 |
+
return $(this).remove();
|
55 |
+
} else {
|
56 |
+
return selected_values.push($(this).val() + "-" + $(this).text());
|
57 |
+
}
|
58 |
+
});
|
59 |
+
items = callback(data);
|
60 |
+
$.each(items, function(value, text) {
|
61 |
+
if ($.inArray(value + "-" + text, selected_values) === -1) {
|
62 |
+
return $("<option />").attr('value', value).html(text).appendTo(select);
|
63 |
+
}
|
64 |
+
});
|
65 |
+
select.trigger("chosen:updated");
|
66 |
+
if (success != null) {
|
67 |
+
success(data);
|
68 |
+
}
|
69 |
+
field.attr('value', val);
|
70 |
+
return field.css('width', 'auto');
|
71 |
+
};
|
72 |
+
return this.timer = setTimeout(function() {
|
73 |
+
if (chosenXhr) {
|
74 |
+
chosenXhr.abort();
|
75 |
+
}
|
76 |
+
return chosenXhr = $.ajax(options);
|
77 |
+
}, options.afterTypeDelay);
|
78 |
+
});
|
79 |
+
});
|
80 |
+
};
|
81 |
+
})(jQuery);
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/ajax-chosen.jquery.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Generated by CoffeeScript 1.3.1
|
2 |
+
(function(e){return e.fn.ajaxChosen=function(t,n){var r,i,s,o;t==null&&(t={});n==null&&(n=function(){});i={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term"};o=this;r=null;s=e.extend({},i,t);this.chosen();return this.each(function(){return e(this).next(".chosen-container").find(".search-field > input, .chosen-search > input").bind("keyup",function(){var t,i,u,a;a=e.trim(e(this).attr("value"));i=a.length<s.minTermLength?"Keep typing...":"Looking for '"+a+"'";o.next(".chosen-container").find(".no-results").text(i);if(a===e(this).data("prevVal"))return!1;e(this).data("prevVal",a);this.timer&&clearTimeout(this.timer);if(a.length<s.minTermLength)return!1;t=e(this);s.data==null&&(s.data={});s.data[s.jsonTermKey]=a;s.dataCallback!=null&&(s.data=s.dataCallback(s.data));u=s.success;s.success=function(r){var i,s;if(r==null)return;s=[];o.find("option").each(function(){return e(this).is(":selected")?s.push(e(this).val()+"-"+e(this).text()):e(this).remove()});i=n(r);e.each(i,function(t,n){if(e.inArray(t+"-"+n,s)===-1)return e("<option />").attr("value",t).html(n).appendTo(o)});o.trigger("chosen:updated");u!=null&&u(r);t.attr("value",a);return t.css("width","auto")};return this.timer=setTimeout(function(){r&&r.abort();return r=e.ajax(s)},s.afterTypeDelay)})})}})(jQuery);
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/chosen/chosen.jquery.js
ADDED
@@ -0,0 +1,1211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.1.0
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function() {
|
14 |
+
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15 |
+
__hasProp = {}.hasOwnProperty,
|
16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
+
|
18 |
+
SelectParser = (function() {
|
19 |
+
function SelectParser() {
|
20 |
+
this.options_index = 0;
|
21 |
+
this.parsed = [];
|
22 |
+
}
|
23 |
+
|
24 |
+
SelectParser.prototype.add_node = function(child) {
|
25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
+
return this.add_group(child);
|
27 |
+
} else {
|
28 |
+
return this.add_option(child);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
|
32 |
+
SelectParser.prototype.add_group = function(group) {
|
33 |
+
var group_position, option, _i, _len, _ref, _results;
|
34 |
+
group_position = this.parsed.length;
|
35 |
+
this.parsed.push({
|
36 |
+
array_index: group_position,
|
37 |
+
group: true,
|
38 |
+
label: this.escapeExpression(group.label),
|
39 |
+
children: 0,
|
40 |
+
disabled: group.disabled
|
41 |
+
});
|
42 |
+
_ref = group.childNodes;
|
43 |
+
_results = [];
|
44 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
45 |
+
option = _ref[_i];
|
46 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
47 |
+
}
|
48 |
+
return _results;
|
49 |
+
};
|
50 |
+
|
51 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
52 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
53 |
+
if (option.text !== "") {
|
54 |
+
if (group_position != null) {
|
55 |
+
this.parsed[group_position].children += 1;
|
56 |
+
}
|
57 |
+
this.parsed.push({
|
58 |
+
array_index: this.parsed.length,
|
59 |
+
options_index: this.options_index,
|
60 |
+
value: option.value,
|
61 |
+
text: option.text,
|
62 |
+
html: option.innerHTML,
|
63 |
+
selected: option.selected,
|
64 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
65 |
+
group_array_index: group_position,
|
66 |
+
classes: option.className,
|
67 |
+
style: option.style.cssText
|
68 |
+
});
|
69 |
+
} else {
|
70 |
+
this.parsed.push({
|
71 |
+
array_index: this.parsed.length,
|
72 |
+
options_index: this.options_index,
|
73 |
+
empty: true
|
74 |
+
});
|
75 |
+
}
|
76 |
+
return this.options_index += 1;
|
77 |
+
}
|
78 |
+
};
|
79 |
+
|
80 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
81 |
+
var map, unsafe_chars;
|
82 |
+
if ((text == null) || text === false) {
|
83 |
+
return "";
|
84 |
+
}
|
85 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
86 |
+
return text;
|
87 |
+
}
|
88 |
+
map = {
|
89 |
+
"<": "<",
|
90 |
+
">": ">",
|
91 |
+
'"': """,
|
92 |
+
"'": "'",
|
93 |
+
"`": "`"
|
94 |
+
};
|
95 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
96 |
+
return text.replace(unsafe_chars, function(chr) {
|
97 |
+
return map[chr] || "&";
|
98 |
+
});
|
99 |
+
};
|
100 |
+
|
101 |
+
return SelectParser;
|
102 |
+
|
103 |
+
})();
|
104 |
+
|
105 |
+
SelectParser.select_to_array = function(select) {
|
106 |
+
var child, parser, _i, _len, _ref;
|
107 |
+
parser = new SelectParser();
|
108 |
+
_ref = select.childNodes;
|
109 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
110 |
+
child = _ref[_i];
|
111 |
+
parser.add_node(child);
|
112 |
+
}
|
113 |
+
return parser.parsed;
|
114 |
+
};
|
115 |
+
|
116 |
+
AbstractChosen = (function() {
|
117 |
+
function AbstractChosen(form_field, options) {
|
118 |
+
this.form_field = form_field;
|
119 |
+
this.options = options != null ? options : {};
|
120 |
+
if (!AbstractChosen.browser_is_supported()) {
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
this.is_multiple = this.form_field.multiple;
|
124 |
+
this.set_default_text();
|
125 |
+
this.set_default_values();
|
126 |
+
this.setup();
|
127 |
+
this.set_up_html();
|
128 |
+
this.register_observers();
|
129 |
+
}
|
130 |
+
|
131 |
+
AbstractChosen.prototype.set_default_values = function() {
|
132 |
+
var _this = this;
|
133 |
+
this.click_test_action = function(evt) {
|
134 |
+
return _this.test_active_click(evt);
|
135 |
+
};
|
136 |
+
this.activate_action = function(evt) {
|
137 |
+
return _this.activate_field(evt);
|
138 |
+
};
|
139 |
+
this.active_field = false;
|
140 |
+
this.mouse_on_container = false;
|
141 |
+
this.results_showing = false;
|
142 |
+
this.result_highlighted = null;
|
143 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
144 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
145 |
+
this.disable_search = this.options.disable_search || false;
|
146 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
147 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
148 |
+
this.search_contains = this.options.search_contains || false;
|
149 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
150 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
151 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
152 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
153 |
+
return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
154 |
+
};
|
155 |
+
|
156 |
+
AbstractChosen.prototype.set_default_text = function() {
|
157 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
158 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
159 |
+
} else if (this.is_multiple) {
|
160 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
161 |
+
} else {
|
162 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
163 |
+
}
|
164 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
165 |
+
};
|
166 |
+
|
167 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
168 |
+
return this.mouse_on_container = true;
|
169 |
+
};
|
170 |
+
|
171 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
172 |
+
return this.mouse_on_container = false;
|
173 |
+
};
|
174 |
+
|
175 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
176 |
+
var _this = this;
|
177 |
+
if (this.is_multiple) {
|
178 |
+
if (!this.active_field) {
|
179 |
+
return setTimeout((function() {
|
180 |
+
return _this.container_mousedown();
|
181 |
+
}), 50);
|
182 |
+
}
|
183 |
+
} else {
|
184 |
+
if (!this.active_field) {
|
185 |
+
return this.activate_field();
|
186 |
+
}
|
187 |
+
}
|
188 |
+
};
|
189 |
+
|
190 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
191 |
+
var _this = this;
|
192 |
+
if (!this.mouse_on_container) {
|
193 |
+
this.active_field = false;
|
194 |
+
return setTimeout((function() {
|
195 |
+
return _this.blur_test();
|
196 |
+
}), 100);
|
197 |
+
}
|
198 |
+
};
|
199 |
+
|
200 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
201 |
+
var content, data, _i, _len, _ref;
|
202 |
+
content = '';
|
203 |
+
_ref = this.results_data;
|
204 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
205 |
+
data = _ref[_i];
|
206 |
+
if (data.group) {
|
207 |
+
content += this.result_add_group(data);
|
208 |
+
} else {
|
209 |
+
content += this.result_add_option(data);
|
210 |
+
}
|
211 |
+
if (options != null ? options.first : void 0) {
|
212 |
+
if (data.selected && this.is_multiple) {
|
213 |
+
this.choice_build(data);
|
214 |
+
} else if (data.selected && !this.is_multiple) {
|
215 |
+
this.single_set_selected_text(data.text);
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
return content;
|
220 |
+
};
|
221 |
+
|
222 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
223 |
+
var classes, option_el;
|
224 |
+
if (!option.search_match) {
|
225 |
+
return '';
|
226 |
+
}
|
227 |
+
if (!this.include_option_in_results(option)) {
|
228 |
+
return '';
|
229 |
+
}
|
230 |
+
classes = [];
|
231 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
232 |
+
classes.push("active-result");
|
233 |
+
}
|
234 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
235 |
+
classes.push("disabled-result");
|
236 |
+
}
|
237 |
+
if (option.selected) {
|
238 |
+
classes.push("result-selected");
|
239 |
+
}
|
240 |
+
if (option.group_array_index != null) {
|
241 |
+
classes.push("group-option");
|
242 |
+
}
|
243 |
+
if (option.classes !== "") {
|
244 |
+
classes.push(option.classes);
|
245 |
+
}
|
246 |
+
option_el = document.createElement("li");
|
247 |
+
option_el.className = classes.join(" ");
|
248 |
+
option_el.style.cssText = option.style;
|
249 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
250 |
+
option_el.innerHTML = option.search_text;
|
251 |
+
return this.outerHTML(option_el);
|
252 |
+
};
|
253 |
+
|
254 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
255 |
+
var group_el;
|
256 |
+
if (!(group.search_match || group.group_match)) {
|
257 |
+
return '';
|
258 |
+
}
|
259 |
+
if (!(group.active_options > 0)) {
|
260 |
+
return '';
|
261 |
+
}
|
262 |
+
group_el = document.createElement("li");
|
263 |
+
group_el.className = "group-result";
|
264 |
+
group_el.innerHTML = group.search_text;
|
265 |
+
return this.outerHTML(group_el);
|
266 |
+
};
|
267 |
+
|
268 |
+
AbstractChosen.prototype.results_update_field = function() {
|
269 |
+
this.set_default_text();
|
270 |
+
if (!this.is_multiple) {
|
271 |
+
this.results_reset_cleanup();
|
272 |
+
}
|
273 |
+
this.result_clear_highlight();
|
274 |
+
this.results_build();
|
275 |
+
if (this.results_showing) {
|
276 |
+
return this.winnow_results();
|
277 |
+
}
|
278 |
+
};
|
279 |
+
|
280 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
281 |
+
var result, _i, _len, _ref, _results;
|
282 |
+
_ref = this.results_data;
|
283 |
+
_results = [];
|
284 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
285 |
+
result = _ref[_i];
|
286 |
+
if (result.selected) {
|
287 |
+
_results.push(result.selected = false);
|
288 |
+
} else {
|
289 |
+
_results.push(void 0);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
return _results;
|
293 |
+
};
|
294 |
+
|
295 |
+
AbstractChosen.prototype.results_toggle = function() {
|
296 |
+
if (this.results_showing) {
|
297 |
+
return this.results_hide();
|
298 |
+
} else {
|
299 |
+
return this.results_show();
|
300 |
+
}
|
301 |
+
};
|
302 |
+
|
303 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
304 |
+
if (this.results_showing) {
|
305 |
+
return this.winnow_results();
|
306 |
+
} else {
|
307 |
+
return this.results_show();
|
308 |
+
}
|
309 |
+
};
|
310 |
+
|
311 |
+
AbstractChosen.prototype.winnow_results = function() {
|
312 |
+
var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
313 |
+
this.no_results_clear();
|
314 |
+
results = 0;
|
315 |
+
searchText = this.get_search_text();
|
316 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
317 |
+
regexAnchor = this.search_contains ? "" : "^";
|
318 |
+
regex = new RegExp(regexAnchor + escapedSearchText, 'i');
|
319 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
320 |
+
_ref = this.results_data;
|
321 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
322 |
+
option = _ref[_i];
|
323 |
+
option.search_match = false;
|
324 |
+
results_group = null;
|
325 |
+
if (this.include_option_in_results(option)) {
|
326 |
+
if (option.group) {
|
327 |
+
option.group_match = false;
|
328 |
+
option.active_options = 0;
|
329 |
+
}
|
330 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
331 |
+
results_group = this.results_data[option.group_array_index];
|
332 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
333 |
+
results += 1;
|
334 |
+
}
|
335 |
+
results_group.active_options += 1;
|
336 |
+
}
|
337 |
+
if (!(option.group && !this.group_search)) {
|
338 |
+
option.search_text = option.group ? option.label : option.html;
|
339 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
340 |
+
if (option.search_match && !option.group) {
|
341 |
+
results += 1;
|
342 |
+
}
|
343 |
+
if (option.search_match) {
|
344 |
+
if (searchText.length) {
|
345 |
+
startpos = option.search_text.search(zregex);
|
346 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
347 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
348 |
+
}
|
349 |
+
if (results_group != null) {
|
350 |
+
results_group.group_match = true;
|
351 |
+
}
|
352 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
353 |
+
option.search_match = true;
|
354 |
+
}
|
355 |
+
}
|
356 |
+
}
|
357 |
+
}
|
358 |
+
this.result_clear_highlight();
|
359 |
+
if (results < 1 && searchText.length) {
|
360 |
+
this.update_results_content("");
|
361 |
+
return this.no_results(searchText);
|
362 |
+
} else {
|
363 |
+
this.update_results_content(this.results_option_build());
|
364 |
+
return this.winnow_results_set_highlight();
|
365 |
+
}
|
366 |
+
};
|
367 |
+
|
368 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
369 |
+
var part, parts, _i, _len;
|
370 |
+
if (regex.test(search_string)) {
|
371 |
+
return true;
|
372 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
373 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
374 |
+
if (parts.length) {
|
375 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
376 |
+
part = parts[_i];
|
377 |
+
if (regex.test(part)) {
|
378 |
+
return true;
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
};
|
384 |
+
|
385 |
+
AbstractChosen.prototype.choices_count = function() {
|
386 |
+
var option, _i, _len, _ref;
|
387 |
+
if (this.selected_option_count != null) {
|
388 |
+
return this.selected_option_count;
|
389 |
+
}
|
390 |
+
this.selected_option_count = 0;
|
391 |
+
_ref = this.form_field.options;
|
392 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
393 |
+
option = _ref[_i];
|
394 |
+
if (option.selected) {
|
395 |
+
this.selected_option_count += 1;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
return this.selected_option_count;
|
399 |
+
};
|
400 |
+
|
401 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
402 |
+
evt.preventDefault();
|
403 |
+
if (!(this.results_showing || this.is_disabled)) {
|
404 |
+
return this.results_show();
|
405 |
+
}
|
406 |
+
};
|
407 |
+
|
408 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
409 |
+
var stroke, _ref;
|
410 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
411 |
+
this.search_field_scale();
|
412 |
+
switch (stroke) {
|
413 |
+
case 8:
|
414 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
415 |
+
return this.keydown_backstroke();
|
416 |
+
} else if (!this.pending_backstroke) {
|
417 |
+
this.result_clear_highlight();
|
418 |
+
return this.results_search();
|
419 |
+
}
|
420 |
+
break;
|
421 |
+
case 13:
|
422 |
+
evt.preventDefault();
|
423 |
+
if (this.results_showing) {
|
424 |
+
return this.result_select(evt);
|
425 |
+
}
|
426 |
+
break;
|
427 |
+
case 27:
|
428 |
+
if (this.results_showing) {
|
429 |
+
this.results_hide();
|
430 |
+
}
|
431 |
+
return true;
|
432 |
+
case 9:
|
433 |
+
case 38:
|
434 |
+
case 40:
|
435 |
+
case 16:
|
436 |
+
case 91:
|
437 |
+
case 17:
|
438 |
+
break;
|
439 |
+
default:
|
440 |
+
return this.results_search();
|
441 |
+
}
|
442 |
+
};
|
443 |
+
|
444 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
445 |
+
var _this = this;
|
446 |
+
return setTimeout((function() {
|
447 |
+
return _this.results_search();
|
448 |
+
}), 50);
|
449 |
+
};
|
450 |
+
|
451 |
+
AbstractChosen.prototype.container_width = function() {
|
452 |
+
if (this.options.width != null) {
|
453 |
+
return this.options.width;
|
454 |
+
} else {
|
455 |
+
return "" + this.form_field.offsetWidth + "px";
|
456 |
+
}
|
457 |
+
};
|
458 |
+
|
459 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
460 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
461 |
+
return false;
|
462 |
+
}
|
463 |
+
if (!this.display_disabled_options && option.disabled) {
|
464 |
+
return false;
|
465 |
+
}
|
466 |
+
if (option.empty) {
|
467 |
+
return false;
|
468 |
+
}
|
469 |
+
return true;
|
470 |
+
};
|
471 |
+
|
472 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
473 |
+
this.touch_started = true;
|
474 |
+
return this.search_results_mouseover(evt);
|
475 |
+
};
|
476 |
+
|
477 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
478 |
+
this.touch_started = false;
|
479 |
+
return this.search_results_mouseout(evt);
|
480 |
+
};
|
481 |
+
|
482 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
483 |
+
if (this.touch_started) {
|
484 |
+
return this.search_results_mouseup(evt);
|
485 |
+
}
|
486 |
+
};
|
487 |
+
|
488 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
489 |
+
var tmp;
|
490 |
+
if (element.outerHTML) {
|
491 |
+
return element.outerHTML;
|
492 |
+
}
|
493 |
+
tmp = document.createElement("div");
|
494 |
+
tmp.appendChild(element);
|
495 |
+
return tmp.innerHTML;
|
496 |
+
};
|
497 |
+
|
498 |
+
AbstractChosen.browser_is_supported = function() {
|
499 |
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
500 |
+
return document.documentMode >= 8;
|
501 |
+
}
|
502 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
if (/Android/i.test(window.navigator.userAgent)) {
|
506 |
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
507 |
+
return false;
|
508 |
+
}
|
509 |
+
}
|
510 |
+
return true;
|
511 |
+
};
|
512 |
+
|
513 |
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
514 |
+
|
515 |
+
AbstractChosen.default_single_text = "Select an Option";
|
516 |
+
|
517 |
+
AbstractChosen.default_no_result_text = "No results match";
|
518 |
+
|
519 |
+
return AbstractChosen;
|
520 |
+
|
521 |
+
})();
|
522 |
+
|
523 |
+
$ = jQuery;
|
524 |
+
|
525 |
+
$.fn.extend({
|
526 |
+
chosen: function(options) {
|
527 |
+
if (!AbstractChosen.browser_is_supported()) {
|
528 |
+
return this;
|
529 |
+
}
|
530 |
+
return this.each(function(input_field) {
|
531 |
+
var $this, chosen;
|
532 |
+
$this = $(this);
|
533 |
+
chosen = $this.data('chosen');
|
534 |
+
if (options === 'destroy' && chosen) {
|
535 |
+
chosen.destroy();
|
536 |
+
} else if (!chosen) {
|
537 |
+
$this.data('chosen', new Chosen(this, options));
|
538 |
+
}
|
539 |
+
});
|
540 |
+
}
|
541 |
+
});
|
542 |
+
|
543 |
+
Chosen = (function(_super) {
|
544 |
+
__extends(Chosen, _super);
|
545 |
+
|
546 |
+
function Chosen() {
|
547 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
548 |
+
return _ref;
|
549 |
+
}
|
550 |
+
|
551 |
+
Chosen.prototype.setup = function() {
|
552 |
+
this.form_field_jq = $(this.form_field);
|
553 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
554 |
+
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
555 |
+
};
|
556 |
+
|
557 |
+
Chosen.prototype.set_up_html = function() {
|
558 |
+
var container_classes, container_props;
|
559 |
+
container_classes = ["chosen-container"];
|
560 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
561 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
562 |
+
container_classes.push(this.form_field.className);
|
563 |
+
}
|
564 |
+
if (this.is_rtl) {
|
565 |
+
container_classes.push("chosen-rtl");
|
566 |
+
}
|
567 |
+
container_props = {
|
568 |
+
'class': container_classes.join(' '),
|
569 |
+
'style': "width: " + (this.container_width()) + ";",
|
570 |
+
'title': this.form_field.title
|
571 |
+
};
|
572 |
+
if (this.form_field.id.length) {
|
573 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
574 |
+
}
|
575 |
+
this.container = $("<div />", container_props);
|
576 |
+
if (this.is_multiple) {
|
577 |
+
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
578 |
+
} else {
|
579 |
+
this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
580 |
+
}
|
581 |
+
this.form_field_jq.hide().after(this.container);
|
582 |
+
this.dropdown = this.container.find('div.chosen-drop').first();
|
583 |
+
this.search_field = this.container.find('input').first();
|
584 |
+
this.search_results = this.container.find('ul.chosen-results').first();
|
585 |
+
this.search_field_scale();
|
586 |
+
this.search_no_results = this.container.find('li.no-results').first();
|
587 |
+
if (this.is_multiple) {
|
588 |
+
this.search_choices = this.container.find('ul.chosen-choices').first();
|
589 |
+
this.search_container = this.container.find('li.search-field').first();
|
590 |
+
} else {
|
591 |
+
this.search_container = this.container.find('div.chosen-search').first();
|
592 |
+
this.selected_item = this.container.find('.chosen-single').first();
|
593 |
+
}
|
594 |
+
this.results_build();
|
595 |
+
this.set_tab_index();
|
596 |
+
this.set_label_behavior();
|
597 |
+
return this.form_field_jq.trigger("chosen:ready", {
|
598 |
+
chosen: this
|
599 |
+
});
|
600 |
+
};
|
601 |
+
|
602 |
+
Chosen.prototype.register_observers = function() {
|
603 |
+
var _this = this;
|
604 |
+
this.container.bind('mousedown.chosen', function(evt) {
|
605 |
+
_this.container_mousedown(evt);
|
606 |
+
});
|
607 |
+
this.container.bind('mouseup.chosen', function(evt) {
|
608 |
+
_this.container_mouseup(evt);
|
609 |
+
});
|
610 |
+
this.container.bind('mouseenter.chosen', function(evt) {
|
611 |
+
_this.mouse_enter(evt);
|
612 |
+
});
|
613 |
+
this.container.bind('mouseleave.chosen', function(evt) {
|
614 |
+
_this.mouse_leave(evt);
|
615 |
+
});
|
616 |
+
this.search_results.bind('mouseup.chosen', function(evt) {
|
617 |
+
_this.search_results_mouseup(evt);
|
618 |
+
});
|
619 |
+
this.search_results.bind('mouseover.chosen', function(evt) {
|
620 |
+
_this.search_results_mouseover(evt);
|
621 |
+
});
|
622 |
+
this.search_results.bind('mouseout.chosen', function(evt) {
|
623 |
+
_this.search_results_mouseout(evt);
|
624 |
+
});
|
625 |
+
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
626 |
+
_this.search_results_mousewheel(evt);
|
627 |
+
});
|
628 |
+
this.search_results.bind('touchstart.chosen', function(evt) {
|
629 |
+
_this.search_results_touchstart(evt);
|
630 |
+
});
|
631 |
+
this.search_results.bind('touchmove.chosen', function(evt) {
|
632 |
+
_this.search_results_touchmove(evt);
|
633 |
+
});
|
634 |
+
this.search_results.bind('touchend.chosen', function(evt) {
|
635 |
+
_this.search_results_touchend(evt);
|
636 |
+
});
|
637 |
+
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
638 |
+
_this.results_update_field(evt);
|
639 |
+
});
|
640 |
+
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
641 |
+
_this.activate_field(evt);
|
642 |
+
});
|
643 |
+
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
644 |
+
_this.container_mousedown(evt);
|
645 |
+
});
|
646 |
+
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
647 |
+
_this.input_blur(evt);
|
648 |
+
});
|
649 |
+
this.search_field.bind('blur.chosen', function(evt) {
|
650 |
+
_this.input_blur(evt);
|
651 |
+
});
|
652 |
+
this.search_field.bind('keyup.chosen', function(evt) {
|
653 |
+
_this.keyup_checker(evt);
|
654 |
+
});
|
655 |
+
this.search_field.bind('keydown.chosen', function(evt) {
|
656 |
+
_this.keydown_checker(evt);
|
657 |
+
});
|
658 |
+
this.search_field.bind('focus.chosen', function(evt) {
|
659 |
+
_this.input_focus(evt);
|
660 |
+
});
|
661 |
+
this.search_field.bind('cut.chosen', function(evt) {
|
662 |
+
_this.clipboard_event_checker(evt);
|
663 |
+
});
|
664 |
+
this.search_field.bind('paste.chosen', function(evt) {
|
665 |
+
_this.clipboard_event_checker(evt);
|
666 |
+
});
|
667 |
+
if (this.is_multiple) {
|
668 |
+
return this.search_choices.bind('click.chosen', function(evt) {
|
669 |
+
_this.choices_click(evt);
|
670 |
+
});
|
671 |
+
} else {
|
672 |
+
return this.container.bind('click.chosen', function(evt) {
|
673 |
+
evt.preventDefault();
|
674 |
+
});
|
675 |
+
}
|
676 |
+
};
|
677 |
+
|
678 |
+
Chosen.prototype.destroy = function() {
|
679 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
680 |
+
if (this.search_field[0].tabIndex) {
|
681 |
+
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
682 |
+
}
|
683 |
+
this.container.remove();
|
684 |
+
this.form_field_jq.removeData('chosen');
|
685 |
+
return this.form_field_jq.show();
|
686 |
+
};
|
687 |
+
|
688 |
+
Chosen.prototype.search_field_disabled = function() {
|
689 |
+
this.is_disabled = this.form_field_jq[0].disabled;
|
690 |
+
if (this.is_disabled) {
|
691 |
+
this.container.addClass('chosen-disabled');
|
692 |
+
this.search_field[0].disabled = true;
|
693 |
+
if (!this.is_multiple) {
|
694 |
+
this.selected_item.unbind("focus.chosen", this.activate_action);
|
695 |
+
}
|
696 |
+
return this.close_field();
|
697 |
+
} else {
|
698 |
+
this.container.removeClass('chosen-disabled');
|
699 |
+
this.search_field[0].disabled = false;
|
700 |
+
if (!this.is_multiple) {
|
701 |
+
return this.selected_item.bind("focus.chosen", this.activate_action);
|
702 |
+
}
|
703 |
+
}
|
704 |
+
};
|
705 |
+
|
706 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
707 |
+
if (!this.is_disabled) {
|
708 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
709 |
+
evt.preventDefault();
|
710 |
+
}
|
711 |
+
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
712 |
+
if (!this.active_field) {
|
713 |
+
if (this.is_multiple) {
|
714 |
+
this.search_field.val("");
|
715 |
+
}
|
716 |
+
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
717 |
+
this.results_show();
|
718 |
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
719 |
+
evt.preventDefault();
|
720 |
+
this.results_toggle();
|
721 |
+
}
|
722 |
+
return this.activate_field();
|
723 |
+
}
|
724 |
+
}
|
725 |
+
};
|
726 |
+
|
727 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
728 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
729 |
+
return this.results_reset(evt);
|
730 |
+
}
|
731 |
+
};
|
732 |
+
|
733 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
734 |
+
var delta;
|
735 |
+
if (evt.originalEvent) {
|
736 |
+
delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
737 |
+
}
|
738 |
+
if (delta != null) {
|
739 |
+
evt.preventDefault();
|
740 |
+
if (evt.type === 'DOMMouseScroll') {
|
741 |
+
delta = delta * 40;
|
742 |
+
}
|
743 |
+
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
744 |
+
}
|
745 |
+
};
|
746 |
+
|
747 |
+
Chosen.prototype.blur_test = function(evt) {
|
748 |
+
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
749 |
+
return this.close_field();
|
750 |
+
}
|
751 |
+
};
|
752 |
+
|
753 |
+
Chosen.prototype.close_field = function() {
|
754 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
755 |
+
this.active_field = false;
|
756 |
+
this.results_hide();
|
757 |
+
this.container.removeClass("chosen-container-active");
|
758 |
+
this.clear_backstroke();
|
759 |
+
this.show_search_field_default();
|
760 |
+
return this.search_field_scale();
|
761 |
+
};
|
762 |
+
|
763 |
+
Chosen.prototype.activate_field = function() {
|
764 |
+
this.container.addClass("chosen-container-active");
|
765 |
+
this.active_field = true;
|
766 |
+
this.search_field.val(this.search_field.val());
|
767 |
+
return this.search_field.focus();
|
768 |
+
};
|
769 |
+
|
770 |
+
Chosen.prototype.test_active_click = function(evt) {
|
771 |
+
var active_container;
|
772 |
+
active_container = $(evt.target).closest('.chosen-container');
|
773 |
+
if (active_container.length && this.container[0] === active_container[0]) {
|
774 |
+
return this.active_field = true;
|
775 |
+
} else {
|
776 |
+
return this.close_field();
|
777 |
+
}
|
778 |
+
};
|
779 |
+
|
780 |
+
Chosen.prototype.results_build = function() {
|
781 |
+
this.parsing = true;
|
782 |
+
this.selected_option_count = null;
|
783 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
784 |
+
if (this.is_multiple) {
|
785 |
+
this.search_choices.find("li.search-choice").remove();
|
786 |
+
} else if (!this.is_multiple) {
|
787 |
+
this.single_set_selected_text();
|
788 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
789 |
+
this.search_field[0].readOnly = true;
|
790 |
+
this.container.addClass("chosen-container-single-nosearch");
|
791 |
+
} else {
|
792 |
+
this.search_field[0].readOnly = false;
|
793 |
+
this.container.removeClass("chosen-container-single-nosearch");
|
794 |
+
}
|
795 |
+
}
|
796 |
+
this.update_results_content(this.results_option_build({
|
797 |
+
first: true
|
798 |
+
}));
|
799 |
+
this.search_field_disabled();
|
800 |
+
this.show_search_field_default();
|
801 |
+
this.search_field_scale();
|
802 |
+
return this.parsing = false;
|
803 |
+
};
|
804 |
+
|
805 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
806 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
807 |
+
if (el.length) {
|
808 |
+
this.result_clear_highlight();
|
809 |
+
this.result_highlight = el;
|
810 |
+
this.result_highlight.addClass("highlighted");
|
811 |
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
812 |
+
visible_top = this.search_results.scrollTop();
|
813 |
+
visible_bottom = maxHeight + visible_top;
|
814 |
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
815 |
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
816 |
+
if (high_bottom >= visible_bottom) {
|
817 |
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
818 |
+
} else if (high_top < visible_top) {
|
819 |
+
return this.search_results.scrollTop(high_top);
|
820 |
+
}
|
821 |
+
}
|
822 |
+
};
|
823 |
+
|
824 |
+
Chosen.prototype.result_clear_highlight = function() {
|
825 |
+
if (this.result_highlight) {
|
826 |
+
this.result_highlight.removeClass("highlighted");
|
827 |
+
}
|
828 |
+
return this.result_highlight = null;
|
829 |
+
};
|
830 |
+
|
831 |
+
Chosen.prototype.results_show = function() {
|
832 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
833 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
834 |
+
chosen: this
|
835 |
+
});
|
836 |
+
return false;
|
837 |
+
}
|
838 |
+
this.container.addClass("chosen-with-drop");
|
839 |
+
this.results_showing = true;
|
840 |
+
this.search_field.focus();
|
841 |
+
this.search_field.val(this.search_field.val());
|
842 |
+
this.winnow_results();
|
843 |
+
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
844 |
+
chosen: this
|
845 |
+
});
|
846 |
+
};
|
847 |
+
|
848 |
+
Chosen.prototype.update_results_content = function(content) {
|
849 |
+
return this.search_results.html(content);
|
850 |
+
};
|
851 |
+
|
852 |
+
Chosen.prototype.results_hide = function() {
|
853 |
+
if (this.results_showing) {
|
854 |
+
this.result_clear_highlight();
|
855 |
+
this.container.removeClass("chosen-with-drop");
|
856 |
+
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
857 |
+
chosen: this
|
858 |
+
});
|
859 |
+
}
|
860 |
+
return this.results_showing = false;
|
861 |
+
};
|
862 |
+
|
863 |
+
Chosen.prototype.set_tab_index = function(el) {
|
864 |
+
var ti;
|
865 |
+
if (this.form_field.tabIndex) {
|
866 |
+
ti = this.form_field.tabIndex;
|
867 |
+
this.form_field.tabIndex = -1;
|
868 |
+
return this.search_field[0].tabIndex = ti;
|
869 |
+
}
|
870 |
+
};
|
871 |
+
|
872 |
+
Chosen.prototype.set_label_behavior = function() {
|
873 |
+
var _this = this;
|
874 |
+
this.form_field_label = this.form_field_jq.parents("label");
|
875 |
+
if (!this.form_field_label.length && this.form_field.id.length) {
|
876 |
+
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
877 |
+
}
|
878 |
+
if (this.form_field_label.length > 0) {
|
879 |
+
return this.form_field_label.bind('click.chosen', function(evt) {
|
880 |
+
if (_this.is_multiple) {
|
881 |
+
return _this.container_mousedown(evt);
|
882 |
+
} else {
|
883 |
+
return _this.activate_field();
|
884 |
+
}
|
885 |
+
});
|
886 |
+
}
|
887 |
+
};
|
888 |
+
|
889 |
+
Chosen.prototype.show_search_field_default = function() {
|
890 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
891 |
+
this.search_field.val(this.default_text);
|
892 |
+
return this.search_field.addClass("default");
|
893 |
+
} else {
|
894 |
+
this.search_field.val("");
|
895 |
+
return this.search_field.removeClass("default");
|
896 |
+
}
|
897 |
+
};
|
898 |
+
|
899 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
900 |
+
var target;
|
901 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
902 |
+
if (target.length) {
|
903 |
+
this.result_highlight = target;
|
904 |
+
this.result_select(evt);
|
905 |
+
return this.search_field.focus();
|
906 |
+
}
|
907 |
+
};
|
908 |
+
|
909 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
910 |
+
var target;
|
911 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
912 |
+
if (target) {
|
913 |
+
return this.result_do_highlight(target);
|
914 |
+
}
|
915 |
+
};
|
916 |
+
|
917 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
918 |
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
919 |
+
return this.result_clear_highlight();
|
920 |
+
}
|
921 |
+
};
|
922 |
+
|
923 |
+
Chosen.prototype.choice_build = function(item) {
|
924 |
+
var choice, close_link,
|
925 |
+
_this = this;
|
926 |
+
choice = $('<li />', {
|
927 |
+
"class": "search-choice"
|
928 |
+
}).html("<span>" + item.html + "</span>");
|
929 |
+
if (item.disabled) {
|
930 |
+
choice.addClass('search-choice-disabled');
|
931 |
+
} else {
|
932 |
+
close_link = $('<a />', {
|
933 |
+
"class": 'search-choice-close',
|
934 |
+
'data-option-array-index': item.array_index
|
935 |
+
});
|
936 |
+
close_link.bind('click.chosen', function(evt) {
|
937 |
+
return _this.choice_destroy_link_click(evt);
|
938 |
+
});
|
939 |
+
choice.append(close_link);
|
940 |
+
}
|
941 |
+
return this.search_container.before(choice);
|
942 |
+
};
|
943 |
+
|
944 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
945 |
+
evt.preventDefault();
|
946 |
+
evt.stopPropagation();
|
947 |
+
if (!this.is_disabled) {
|
948 |
+
return this.choice_destroy($(evt.target));
|
949 |
+
}
|
950 |
+
};
|
951 |
+
|
952 |
+
Chosen.prototype.choice_destroy = function(link) {
|
953 |
+
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
954 |
+
this.show_search_field_default();
|
955 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
956 |
+
this.results_hide();
|
957 |
+
}
|
958 |
+
link.parents('li').first().remove();
|
959 |
+
return this.search_field_scale();
|
960 |
+
}
|
961 |
+
};
|
962 |
+
|
963 |
+
Chosen.prototype.results_reset = function() {
|
964 |
+
this.reset_single_select_options();
|
965 |
+
this.form_field.options[0].selected = true;
|
966 |
+
this.single_set_selected_text();
|
967 |
+
this.show_search_field_default();
|
968 |
+
this.results_reset_cleanup();
|
969 |
+
this.form_field_jq.trigger("change");
|
970 |
+
if (this.active_field) {
|
971 |
+
return this.results_hide();
|
972 |
+
}
|
973 |
+
};
|
974 |
+
|
975 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
976 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
977 |
+
return this.selected_item.find("abbr").remove();
|
978 |
+
};
|
979 |
+
|
980 |
+
Chosen.prototype.result_select = function(evt) {
|
981 |
+
var high, item;
|
982 |
+
if (this.result_highlight) {
|
983 |
+
high = this.result_highlight;
|
984 |
+
this.result_clear_highlight();
|
985 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
986 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
987 |
+
chosen: this
|
988 |
+
});
|
989 |
+
return false;
|
990 |
+
}
|
991 |
+
if (this.is_multiple) {
|
992 |
+
high.removeClass("active-result");
|
993 |
+
} else {
|
994 |
+
this.reset_single_select_options();
|
995 |
+
}
|
996 |
+
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
997 |
+
item.selected = true;
|
998 |
+
this.form_field.options[item.options_index].selected = true;
|
999 |
+
this.selected_option_count = null;
|
1000 |
+
if (this.is_multiple) {
|
1001 |
+
this.choice_build(item);
|
1002 |
+
} else {
|
1003 |
+
this.single_set_selected_text(item.text);
|
1004 |
+
}
|
1005 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1006 |
+
this.results_hide();
|
1007 |
+
}
|
1008 |
+
this.search_field.val("");
|
1009 |
+
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1010 |
+
this.form_field_jq.trigger("change", {
|
1011 |
+
'selected': this.form_field.options[item.options_index].value
|
1012 |
+
});
|
1013 |
+
}
|
1014 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1015 |
+
return this.search_field_scale();
|
1016 |
+
}
|
1017 |
+
};
|
1018 |
+
|
1019 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1020 |
+
if (text == null) {
|
1021 |
+
text = this.default_text;
|
1022 |
+
}
|
1023 |
+
if (text === this.default_text) {
|
1024 |
+
this.selected_item.addClass("chosen-default");
|
1025 |
+
} else {
|
1026 |
+
this.single_deselect_control_build();
|
1027 |
+
this.selected_item.removeClass("chosen-default");
|
1028 |
+
}
|
1029 |
+
return this.selected_item.find("span").text(text);
|
1030 |
+
};
|
1031 |
+
|
1032 |
+
Chosen.prototype.result_deselect = function(pos) {
|
1033 |
+
var result_data;
|
1034 |
+
result_data = this.results_data[pos];
|
1035 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1036 |
+
result_data.selected = false;
|
1037 |
+
this.form_field.options[result_data.options_index].selected = false;
|
1038 |
+
this.selected_option_count = null;
|
1039 |
+
this.result_clear_highlight();
|
1040 |
+
if (this.results_showing) {
|
1041 |
+
this.winnow_results();
|
1042 |
+
}
|
1043 |
+
this.form_field_jq.trigger("change", {
|
1044 |
+
deselected: this.form_field.options[result_data.options_index].value
|
1045 |
+
});
|
1046 |
+
this.search_field_scale();
|
1047 |
+
return true;
|
1048 |
+
} else {
|
1049 |
+
return false;
|
1050 |
+
}
|
1051 |
+
};
|
1052 |
+
|
1053 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
1054 |
+
if (!this.allow_single_deselect) {
|
1055 |
+
return;
|
1056 |
+
}
|
1057 |
+
if (!this.selected_item.find("abbr").length) {
|
1058 |
+
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1059 |
+
}
|
1060 |
+
return this.selected_item.addClass("chosen-single-with-deselect");
|
1061 |
+
};
|
1062 |
+
|
1063 |
+
Chosen.prototype.get_search_text = function() {
|
1064 |
+
if (this.search_field.val() === this.default_text) {
|
1065 |
+
return "";
|
1066 |
+
} else {
|
1067 |
+
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1068 |
+
}
|
1069 |
+
};
|
1070 |
+
|
1071 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1072 |
+
var do_high, selected_results;
|
1073 |
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1074 |
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1075 |
+
if (do_high != null) {
|
1076 |
+
return this.result_do_highlight(do_high);
|
1077 |
+
}
|
1078 |
+
};
|
1079 |
+
|
1080 |
+
Chosen.prototype.no_results = function(terms) {
|
1081 |
+
var no_results_html;
|
1082 |
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1083 |
+
no_results_html.find("span").first().html(terms);
|
1084 |
+
this.search_results.append(no_results_html);
|
1085 |
+
return this.form_field_jq.trigger("chosen:no_results", {
|
1086 |
+
chosen: this
|
1087 |
+
});
|
1088 |
+
};
|
1089 |
+
|
1090 |
+
Chosen.prototype.no_results_clear = function() {
|
1091 |
+
return this.search_results.find(".no-results").remove();
|
1092 |
+
};
|
1093 |
+
|
1094 |
+
Chosen.prototype.keydown_arrow = function() {
|
1095 |
+
var next_sib;
|
1096 |
+
if (this.results_showing && this.result_highlight) {
|
1097 |
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1098 |
+
if (next_sib) {
|
1099 |
+
return this.result_do_highlight(next_sib);
|
1100 |
+
}
|
1101 |
+
} else {
|
1102 |
+
return this.results_show();
|
1103 |
+
}
|
1104 |
+
};
|
1105 |
+
|
1106 |
+
Chosen.prototype.keyup_arrow = function() {
|
1107 |
+
var prev_sibs;
|
1108 |
+
if (!this.results_showing && !this.is_multiple) {
|
1109 |
+
return this.results_show();
|
1110 |
+
} else if (this.result_highlight) {
|
1111 |
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1112 |
+
if (prev_sibs.length) {
|
1113 |
+
return this.result_do_highlight(prev_sibs.first());
|
1114 |
+
} else {
|
1115 |
+
if (this.choices_count() > 0) {
|
1116 |
+
this.results_hide();
|
1117 |
+
}
|
1118 |
+
return this.result_clear_highlight();
|
1119 |
+
}
|
1120 |
+
}
|
1121 |
+
};
|
1122 |
+
|
1123 |
+
Chosen.prototype.keydown_backstroke = function() {
|
1124 |
+
var next_available_destroy;
|
1125 |
+
if (this.pending_backstroke) {
|
1126 |
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1127 |
+
return this.clear_backstroke();
|
1128 |
+
} else {
|
1129 |
+
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1130 |
+
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1131 |
+
this.pending_backstroke = next_available_destroy;
|
1132 |
+
if (this.single_backstroke_delete) {
|
1133 |
+
return this.keydown_backstroke();
|
1134 |
+
} else {
|
1135 |
+
return this.pending_backstroke.addClass("search-choice-focus");
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
}
|
1139 |
+
};
|
1140 |
+
|
1141 |
+
Chosen.prototype.clear_backstroke = function() {
|
1142 |
+
if (this.pending_backstroke) {
|
1143 |
+
this.pending_backstroke.removeClass("search-choice-focus");
|
1144 |
+
}
|
1145 |
+
return this.pending_backstroke = null;
|
1146 |
+
};
|
1147 |
+
|
1148 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
1149 |
+
var stroke, _ref1;
|
1150 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1151 |
+
this.search_field_scale();
|
1152 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
1153 |
+
this.clear_backstroke();
|
1154 |
+
}
|
1155 |
+
switch (stroke) {
|
1156 |
+
case 8:
|
1157 |
+
this.backstroke_length = this.search_field.val().length;
|
1158 |
+
break;
|
1159 |
+
case 9:
|
1160 |
+
if (this.results_showing && !this.is_multiple) {
|
1161 |
+
this.result_select(evt);
|
1162 |
+
}
|
1163 |
+
this.mouse_on_container = false;
|
1164 |
+
break;
|
1165 |
+
case 13:
|
1166 |
+
evt.preventDefault();
|
1167 |
+
break;
|
1168 |
+
case 38:
|
1169 |
+
evt.preventDefault();
|
1170 |
+
this.keyup_arrow();
|
1171 |
+
break;
|
1172 |
+
case 40:
|
1173 |
+
evt.preventDefault();
|
1174 |
+
this.keydown_arrow();
|
1175 |
+
break;
|
1176 |
+
}
|
1177 |
+
};
|
1178 |
+
|
1179 |
+
Chosen.prototype.search_field_scale = function() {
|
1180 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1181 |
+
if (this.is_multiple) {
|
1182 |
+
h = 0;
|
1183 |
+
w = 0;
|
1184 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1185 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1186 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1187 |
+
style = styles[_i];
|
1188 |
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
1189 |
+
}
|
1190 |
+
div = $('<div />', {
|
1191 |
+
'style': style_block
|
1192 |
+
});
|
1193 |
+
div.text(this.search_field.val());
|
1194 |
+
$('body').append(div);
|
1195 |
+
w = div.width() + 25;
|
1196 |
+
div.remove();
|
1197 |
+
f_width = this.container.outerWidth();
|
1198 |
+
if (w > f_width - 10) {
|
1199 |
+
w = f_width - 10;
|
1200 |
+
}
|
1201 |
+
return this.search_field.css({
|
1202 |
+
'width': w + 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// CodeMirror version 3.15
|
2 |
+
//
|
3 |
+
// CodeMirror is the only global var we claim
|
4 |
+
window.CodeMirror = (function() {
|
5 |
+
"use strict";
|
6 |
+
|
7 |
+
// BROWSER SNIFFING
|
8 |
+
|
9 |
+
// Crude, but necessary to handle a number of hard-to-feature-detect
|
10 |
+
// bugs and behavior differences.
|
11 |
+
var gecko = /gecko\/\d/i.test(navigator.userAgent);
|
12 |
+
var ie = /MSIE \d/.test(navigator.userAgent);
|
13 |
+
var ie_lt8 = ie && (document.documentMode == null || document.documentMode < 8);
|
14 |
+
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
|
15 |
+
var webkit = /WebKit\//.test(navigator.userAgent);
|
16 |
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
|
17 |
+
var chrome = /Chrome\//.test(navigator.userAgent);
|
18 |
+
var opera = /Opera\//.test(navigator.userAgent);
|
19 |
+
var safari = /Apple Computer/.test(navigator.vendor);
|
20 |
+
var khtml = /KHTML\//.test(navigator.userAgent);
|
21 |
+
var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
|
22 |
+
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
|
23 |
+
var phantom = /PhantomJS/.test(navigator.userAgent);
|
24 |
+
|
25 |
+
var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
|
26 |
+
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
27 |
+
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);
|
28 |
+
var mac = ios || /Mac/.test(navigator.platform);
|
29 |
+
var windows = /windows/i.test(navigator.platform);
|
30 |
+
|
31 |
+
var opera_version = opera && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
|
32 |
+
if (opera_version) opera_version = Number(opera_version[1]);
|
33 |
+
if (opera_version && opera_version >= 15) { opera = false; webkit = true; }
|
34 |
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
35 |
+
var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));
|
36 |
+
var captureMiddleClick = gecko || (ie && !ie_lt9);
|
37 |
+
|
38 |
+
// Optimize some code when these features are not used
|
39 |
+
var sawReadOnlySpans = false, sawCollapsedSpans = false;
|
40 |
+
|
41 |
+
// CONSTRUCTOR
|
42 |
+
|
43 |
+
function CodeMirror(place, options) {
|
44 |
+
if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
|
45 |
+
|
46 |
+
this.options = options = options || {};
|
47 |
+
// Determine effective options based on given values and defaults.
|
48 |
+
for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
|
49 |
+
options[opt] = defaults[opt];
|
50 |
+
setGuttersForLineNumbers(options);
|
51 |
+
|
52 |
+
var docStart = typeof options.value == "string" ? 0 : options.value.first;
|
53 |
+
var display = this.display = makeDisplay(place, docStart);
|
54 |
+
display.wrapper.CodeMirror = this;
|
55 |
+
updateGutters(this);
|
56 |
+
if (options.autofocus && !mobile) focusInput(this);
|
57 |
+
|
58 |
+
this.state = {keyMaps: [],
|
59 |
+
overlays: [],
|
60 |
+
modeGen: 0,
|
61 |
+
overwrite: false, focused: false,
|
62 |
+
suppressEdits: false, pasteIncoming: false,
|
63 |
+
draggingText: false,
|
64 |
+
highlight: new Delayed()};
|
65 |
+
|
66 |
+
themeChanged(this);
|
67 |
+
if (options.lineWrapping)
|
68 |
+
this.display.wrapper.className += " CodeMirror-wrap";
|
69 |
+
|
70 |
+
var doc = options.value;
|
71 |
+
if (typeof doc == "string") doc = new Doc(options.value, options.mode);
|
72 |
+
operation(this, attachDoc)(this, doc);
|
73 |
+
|
74 |
+
// Override magic textarea content restore that IE sometimes does
|
75 |
+
// on our hidden textarea on reload
|
76 |
+
if (ie) setTimeout(bind(resetInput, this, true), 20);
|
77 |
+
|
78 |
+
registerEventHandlers(this);
|
79 |
+
// IE throws unspecified error in certain cases, when
|
80 |
+
// trying to access activeElement before onload
|
81 |
+
var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
|
82 |
+
if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
|
83 |
+
else onBlur(this);
|
84 |
+
|
85 |
+
operation(this, function() {
|
86 |
+
for (var opt in optionHandlers)
|
87 |
+
if (optionHandlers.propertyIsEnumerable(opt))
|
88 |
+
optionHandlers[opt](this, options[opt], Init);
|
89 |
+
for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
|
90 |
+
})();
|
91 |
+
}
|
92 |
+
|
93 |
+
// DISPLAY CONSTRUCTOR
|
94 |
+
|
95 |
+
function makeDisplay(place, docStart) {
|
96 |
+
var d = {};
|
97 |
+
|
98 |
+
var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");
|
99 |
+
if (webkit) input.style.width = "1000px";
|
100 |
+
else input.setAttribute("wrap", "off");
|
101 |
+
// if border: 0; -- iOS fails to open keyboard (issue #1287)
|
102 |
+
if (ios) input.style.border = "1px solid black";
|
103 |
+
input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off"); input.setAttribute("spellcheck", "false");
|
104 |
+
|
105 |
+
// Wraps and hides input textarea
|
106 |
+
d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
|
107 |
+
// The actual fake scrollbars.
|
108 |
+
d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
|
109 |
+
d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
|
110 |
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
|
111 |
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
|
112 |
+
// DIVs containing the selection and the actual code
|
113 |
+
d.lineDiv = elt("div", null, "CodeMirror-code");
|
114 |
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
|
115 |
+
// Blinky cursor, and element used to ensure cursor fits at the end of a line
|
116 |
+
d.cursor = elt("div", "\u00a0", "CodeMirror-cursor");
|
117 |
+
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
118 |
+
d.otherCursor = elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
|
119 |
+
// Used to measure text size
|
120 |
+
d.measure = elt("div", null, "CodeMirror-measure");
|
121 |
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
122 |
+
d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
|
123 |
+
null, "position: relative; outline: none");
|
124 |
+
// Moved around its parent to cover visible view
|
125 |
+
d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
|
126 |
+
// Set to the height of the text, causes scrolling
|
127 |
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
|
128 |
+
// D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
|
129 |
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerCutOff + "px; width: 1px;");
|
130 |
+
// Will contain the gutters, if any
|
131 |
+
d.gutters = elt("div", null, "CodeMirror-gutters");
|
132 |
+
d.lineGutter = null;
|
133 |
+
// Provides scrolling
|
134 |
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
|
135 |
+
d.scroller.setAttribute("tabIndex", "-1");
|
136 |
+
// The element in which the editor lives.
|
137 |
+
d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
|
138 |
+
d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
|
139 |
+
// Work around IE7 z-index bug
|
140 |
+
if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
|
141 |
+
if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);
|
142 |
+
|
143 |
+
// Needed to hide big blue blinking cursor on Mobile Safari
|
144 |
+
if (ios) input.style.width = "0px";
|
145 |
+
if (!webkit) d.scroller.draggable = true;
|
146 |
+
// Needed to handle Tab key in KHTML
|
147 |
+
if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
|
148 |
+
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
149 |
+
else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";
|
150 |
+
|
151 |
+
// Current visible range (may be bigger than the view window).
|
152 |
+
d.viewOffset = d.lastSizeC = 0;
|
153 |
+
d.showingFrom = d.showingTo = docStart;
|
154 |
+
|
155 |
+
// Used to only resize the line number gutter when necessary (when
|
156 |
+
// the amount of lines crosses a boundary that makes its width change)
|
157 |
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
|
158 |
+
// See readInput and resetInput
|
159 |
+
d.prevInput = "";
|
160 |
+
// Set to true when a non-horizontal-scrolling widget is added. As
|
161 |
+
// an optimization, widget aligning is skipped when d is false.
|
162 |
+
d.alignWidgets = false;
|
163 |
+
// Flag that indicates whether we currently expect input to appear
|
164 |
+
// (after some event like 'keypress' or 'input') and are polling
|
165 |
+
// intensively.
|
166 |
+
d.pollingFast = false;
|
167 |
+
// Self-resetting timeout for the poller
|
168 |
+
d.poll = new Delayed();
|
169 |
+
|
170 |
+
d.cachedCharWidth = d.cachedTextHeight = null;
|
171 |
+
d.measureLineCache = [];
|
172 |
+
d.measureLineCachePos = 0;
|
173 |
+
|
174 |
+
// Tracks when resetInput has punted to just putting a short
|
175 |
+
// string instead of the (large) selection.
|
176 |
+
d.inaccurateSelection = false;
|
177 |
+
|
178 |
+
// Tracks the maximum line length so that the horizontal scrollbar
|
179 |
+
// can be kept static when scrolling.
|
180 |
+
d.maxLine = null;
|
181 |
+
d.maxLineLength = 0;
|
182 |
+
d.maxLineChanged = false;
|
183 |
+
|
184 |
+
// Used for measuring wheel scrolling granularity
|
185 |
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
|
186 |
+
|
187 |
+
return d;
|
188 |
+
}
|
189 |
+
|
190 |
+
// STATE UPDATES
|
191 |
+
|
192 |
+
// Used to get the editor into a consistent state again when options change.
|
193 |
+
|
194 |
+
function loadMode(cm) {
|
195 |
+
cm.doc.mode = CodeMirror.getMode(cm.options, cm.doc.modeOption);
|
196 |
+
cm.doc.iter(function(line) {
|
197 |
+
if (line.stateAfter) line.stateAfter = null;
|
198 |
+
if (line.styles) line.styles = null;
|
199 |
+
});
|
200 |
+
cm.doc.frontier = cm.doc.first;
|
201 |
+
startWorker(cm, 100);
|
202 |
+
cm.state.modeGen++;
|
203 |
+
if (cm.curOp) regChange(cm);
|
204 |
+
}
|
205 |
+
|
206 |
+
function wrappingChanged(cm) {
|
207 |
+
if (cm.options.lineWrapping) {
|
208 |
+
cm.display.wrapper.className += " CodeMirror-wrap";
|
209 |
+
cm.display.sizer.style.minWidth = "";
|
210 |
+
} else {
|
211 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
|
212 |
+
computeMaxLength(cm);
|
213 |
+
}
|
214 |
+
estimateLineHeights(cm);
|
215 |
+
regChange(cm);
|
216 |
+
clearCaches(cm);
|
217 |
+
setTimeout(function(){updateScrollbars(cm);}, 100);
|
218 |
+
}
|
219 |
+
|
220 |
+
function estimateHeight(cm) {
|
221 |
+
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
|
222 |
+
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
|
223 |
+
return function(line) {
|
224 |
+
if (lineIsHidden(cm.doc, line))
|
225 |
+
return 0;
|
226 |
+
else if (wrapping)
|
227 |
+
return (Math.ceil(line.text.length / perLine) || 1) * th;
|
228 |
+
else
|
229 |
+
return th;
|
230 |
+
};
|
231 |
+
}
|
232 |
+
|
233 |
+
function estimateLineHeights(cm) {
|
234 |
+
var doc = cm.doc, est = estimateHeight(cm);
|
235 |
+
doc.iter(function(line) {
|
236 |
+
var estHeight = est(line);
|
237 |
+
if (estHeight != line.height) updateLineHeight(line, estHeight);
|
238 |
+
});
|
239 |
+
}
|
240 |
+
|
241 |
+
function keyMapChanged(cm) {
|
242 |
+
var map = keyMap[cm.options.keyMap], style = map.style;
|
243 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
|
244 |
+
(style ? " cm-keymap-" + style : "");
|
245 |
+
cm.state.disableInput = map.disableInput;
|
246 |
+
}
|
247 |
+
|
248 |
+
function themeChanged(cm) {
|
249 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
|
250 |
+
cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
|
251 |
+
clearCaches(cm);
|
252 |
+
}
|
253 |
+
|
254 |
+
function guttersChanged(cm) {
|
255 |
+
updateGutters(cm);
|
256 |
+
regChange(cm);
|
257 |
+
setTimeout(function(){alignHorizontally(cm);}, 20);
|
258 |
+
}
|
259 |
+
|
260 |
+
function updateGutters(cm) {
|
261 |
+
var gutters = cm.display.gutters, specs = cm.options.gutters;
|
262 |
+
removeChildren(gutters);
|
263 |
+
for (var i = 0; i < specs.length; ++i) {
|
264 |
+
var gutterClass = specs[i];
|
265 |
+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
|
266 |
+
if (gutterClass == "CodeMirror-linenumbers") {
|
267 |
+
cm.display.lineGutter = gElt;
|
268 |
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
|
269 |
+
}
|
270 |
+
}
|
271 |
+
gutters.style.display = i ? "" : "none";
|
272 |
+
}
|
273 |
+
|
274 |
+
function lineLength(doc, line) {
|
275 |
+
if (line.height == 0) return 0;
|
276 |
+
var len = line.text.length, merged, cur = line;
|
277 |
+
while (merged = collapsedSpanAtStart(cur)) {
|
278 |
+
var found = merged.find();
|
279 |
+
cur = getLine(doc, found.from.line);
|
280 |
+
len += found.from.ch - found.to.ch;
|
281 |
+
}
|
282 |
+
cur = line;
|
283 |
+
while (merged = collapsedSpanAtEnd(cur)) {
|
284 |
+
var found = merged.find();
|
285 |
+
len -= cur.text.length - found.from.ch;
|
286 |
+
cur = getLine(doc, found.to.line);
|
287 |
+
len += cur.text.length - found.to.ch;
|
288 |
+
}
|
289 |
+
return len;
|
290 |
+
}
|
291 |
+
|
292 |
+
function computeMaxLength(cm) {
|
293 |
+
var d = cm.display, doc = cm.doc;
|
294 |
+
d.maxLine = getLine(doc, doc.first);
|
295 |
+
d.maxLineLength = lineLength(doc, d.maxLine);
|
296 |
+
d.maxLineChanged = true;
|
297 |
+
doc.iter(function(line) {
|
298 |
+
var len = lineLength(doc, line);
|
299 |
+
if (len > d.maxLineLength) {
|
300 |
+
d.maxLineLength = len;
|
301 |
+
d.maxLine = line;
|
302 |
+
}
|
303 |
+
});
|
304 |
+
}
|
305 |
+
|
306 |
+
// Make sure the gutters options contains the element
|
307 |
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
308 |
+
function setGuttersForLineNumbers(options) {
|
309 |
+
var found = false;
|
310 |
+
for (var i = 0; i < options.gutters.length; ++i) {
|
311 |
+
if (options.gutters[i] == "CodeMirror-linenumbers") {
|
312 |
+
if (options.lineNumbers) found = true;
|
313 |
+
else options.gutters.splice(i--, 1);
|
314 |
+
}
|
315 |
+
}
|
316 |
+
if (!found && options.lineNumbers)
|
317 |
+
options.gutters.push("CodeMirror-linenumbers");
|
318 |
+
}
|
319 |
+
|
320 |
+
// SCROLLBARS
|
321 |
+
|
322 |
+
// Re-synchronize the fake scrollbars with the actual size of the
|
323 |
+
// content. Optionally force a scrollTop.
|
324 |
+
function updateScrollbars(cm) {
|
325 |
+
var d = cm.display, docHeight = cm.doc.height;
|
326 |
+
var totalHeight = docHeight + paddingVert(d);
|
327 |
+
d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
|
328 |
+
d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + "px";
|
329 |
+
var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);
|
330 |
+
var needsH = d.scroller.scrollWidth > (d.scroller.clientWidth + 1);
|
331 |
+
var needsV = scrollHeight > (d.scroller.clientHeight + 1);
|
332 |
+
if (needsV) {
|
333 |
+
d.scrollbarV.style.display = "block";
|
334 |
+
d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
|
335 |
+
d.scrollbarV.firstChild.style.height =
|
336 |
+
(scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
|
337 |
+
} else d.scrollbarV.style.display = "";
|
338 |
+
if (needsH) {
|
339 |
+
d.scrollbarH.style.display = "block";
|
340 |
+
d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
|
341 |
+
d.scrollbarH.firstChild.style.width =
|
342 |
+
(d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px";
|
343 |
+
} else d.scrollbarH.style.display = "";
|
344 |
+
if (needsH && needsV) {
|
345 |
+
d.scrollbarFiller.style.display = "block";
|
346 |
+
d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px";
|
347 |
+
} else d.scrollbarFiller.style.display = "";
|
348 |
+
if (needsH && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
349 |
+
d.gutterFiller.style.display = "block";
|
350 |
+
d.gutterFiller.style.height = scrollbarWidth(d.measure) + "px";
|
351 |
+
d.gutterFiller.style.width = d.gutters.offsetWidth + "px";
|
352 |
+
} else d.gutterFiller.style.display = "";
|
353 |
+
|
354 |
+
if (mac_geLion && scrollbarWidth(d.measure) === 0)
|
355 |
+
d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
|
356 |
+
}
|
357 |
+
|
358 |
+
function visibleLines(display, doc, viewPort) {
|
359 |
+
var top = display.scroller.scrollTop, height = display.wrapper.clientHeight;
|
360 |
+
if (typeof viewPort == "number") top = viewPort;
|
361 |
+
else if (viewPort) {top = viewPort.top; height = viewPort.bottom - viewPort.top;}
|
362 |
+
top = Math.floor(top - paddingTop(display));
|
363 |
+
var bottom = Math.ceil(top + height);
|
364 |
+
return {from: lineAtHeight(doc, top), to: lineAtHeight(doc, bottom)};
|
365 |
+
}
|
366 |
+
|
367 |
+
// LINE NUMBERS
|
368 |
+
|
369 |
+
function alignHorizontally(cm) {
|
370 |
+
var display = cm.display;
|
371 |
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return;
|
372 |
+
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
|
373 |
+
var gutterW = display.gutters.offsetWidth, l = comp + "px";
|
374 |
+
for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
|
375 |
+
for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
|
376 |
+
}
|
377 |
+
if (cm.options.fixedGutter)
|
378 |
+
display.gutters.style.left = (comp + gutterW) + "px";
|
379 |
+
}
|
380 |
+
|
381 |
+
function maybeUpdateLineNumberWidth(cm) {
|
382 |
+
if (!cm.options.lineNumbers) return false;
|
383 |
+
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
|
384 |
+
if (last.length != display.lineNumChars) {
|
385 |
+
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
386 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt"));
|
387 |
+
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
|
388 |
+
display.lineGutter.style.width = "";
|
389 |
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);
|
390 |
+
display.lineNumWidth = display.lineNumInnerWidth + padding;
|
391 |
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
|
392 |
+
display.lineGutter.style.width = display.lineNumWidth + "px";
|
393 |
+
return true;
|
394 |
+
}
|
395 |
+
return false;
|
396 |
+
}
|
397 |
+
|
398 |
+
function lineNumberFor(options, i) {
|
399 |
+
return String(options.lineNumberFormatter(i + options.firstLineNumber));
|
400 |
+
}
|
401 |
+
function compensateForHScroll(display) {
|
402 |
+
return getRect(display.scroller).left - getRect(display.sizer).left;
|
403 |
+
}
|
404 |
+
|
405 |
+
// DISPLAY DRAWING
|
406 |
+
|
407 |
+
function updateDisplay(cm, changes, viewPort, forced) {
|
408 |
+
var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated;
|
409 |
+
var visible = visibleLines(cm.display, cm.doc, viewPort);
|
410 |
+
for (;;) {
|
411 |
+
if (!updateDisplayInner(cm, changes, visible, forced)) break;
|
412 |
+
forced = false;
|
413 |
+
updated = true;
|
414 |
+
updateSelection(cm);
|
415 |
+
updateScrollbars(cm);
|
416 |
+
|
417 |
+
// Clip forced viewport to actual scrollable area
|
418 |
+
if (viewPort)
|
419 |
+
viewPort = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight,
|
420 |
+
typeof viewPort == "number" ? viewPort : viewPort.top);
|
421 |
+
visible = visibleLines(cm.display, cm.doc, viewPort);
|
422 |
+
if (visible.from >= cm.display.showingFrom && visible.to <= cm.display.showingTo)
|
423 |
+
break;
|
424 |
+
changes = [];
|
425 |
+
}
|
426 |
+
|
427 |
+
if (updated) {
|
428 |
+
signalLater(cm, "update", cm);
|
429 |
+
if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
|
430 |
+
signalLater(cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
|
431 |
+
}
|
432 |
+
return updated;
|
433 |
+
}
|
434 |
+
|
435 |
+
// Uses a set of changes plus the current scroll position to
|
436 |
+
// determine which DOM updates have to be made, and makes the
|
437 |
+
// updates.
|
438 |
+
function updateDisplayInner(cm, changes, visible, forced) {
|
439 |
+
var display = cm.display, doc = cm.doc;
|
440 |
+
if (!display.wrapper.clientWidth) {
|
441 |
+
display.showingFrom = display.showingTo = doc.first;
|
442 |
+
display.viewOffset = 0;
|
443 |
+
return;
|
444 |
+
}
|
445 |
+
|
446 |
+
// Bail out if the visible area is already rendered and nothing changed.
|
447 |
+
if (!forced && changes.length == 0 &&
|
448 |
+
visible.from > display.showingFrom && visible.to < display.showingTo)
|
449 |
+
return;
|
450 |
+
|
451 |
+
if (maybeUpdateLineNumberWidth(cm))
|
452 |
+
changes = [{from: doc.first, to: doc.first + doc.size}];
|
453 |
+
var gutterW = display.sizer.style.marginLeft = display.gutters.offsetWidth + "px";
|
454 |
+
display.scrollbarH.style.left = cm.options.fixedGutter ? gutterW : "0";
|
455 |
+
|
456 |
+
// Used to determine which lines need their line numbers updated
|
457 |
+
var positionsChangedFrom = Infinity;
|
458 |
+
if (cm.options.lineNumbers)
|
459 |
+
for (var i = 0; i < changes.length; ++i)
|
460 |
+
if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; }
|
461 |
+
|
462 |
+
var end = doc.first + doc.size;
|
463 |
+
var from = Math.max(visible.from - cm.options.viewportMargin, doc.first);
|
464 |
+
var to = Math.min(end, visible.to + cm.options.viewportMargin);
|
465 |
+
if (display.showingFrom < from && from - display.showingFrom < 20) from = Math.max(doc.first, display.showingFrom);
|
466 |
+
if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(end, display.showingTo);
|
467 |
+
if (sawCollapsedSpans) {
|
468 |
+
from = lineNo(visualLine(doc, getLine(doc, from)));
|
469 |
+
while (to < end && lineIsHidden(doc, getLine(doc, to))) ++to;
|
470 |
+
}
|
471 |
+
|
472 |
+
// Create a range of theoretically intact lines, and punch holes
|
473 |
+
// in that using the change info.
|
474 |
+
var intact = [{from: Math.max(display.showingFrom, doc.first),
|
475 |
+
to: Math.min(display.showingTo, end)}];
|
476 |
+
if (intact[0].from >= intact[0].to) intact = [];
|
477 |
+
else intact = computeIntact(intact, changes);
|
478 |
+
// When merged lines are present, we might have to reduce the
|
479 |
+
// intact ranges because changes in continued fragments of the
|
480 |
+
// intact lines do require the lines to be redrawn.
|
481 |
+
if (sawCollapsedSpans)
|
482 |
+
for (var i = 0; i < intact.length; ++i) {
|
483 |
+
var range = intact[i], merged;
|
484 |
+
while (merged = collapsedSpanAtEnd(getLine(doc, range.to - 1))) {
|
485 |
+
var newTo = merged.find().from.line;
|
486 |
+
if (newTo > range.from) range.to = newTo;
|
487 |
+
else { intact.splice(i--, 1); break; }
|
488 |
+
}
|
489 |
+
}
|
490 |
+
|
491 |
+
// Clip off the parts that won't be visible
|
492 |
+
var intactLines = 0;
|
493 |
+
for (var i = 0; i < intact.length; ++i) {
|
494 |
+
var range = intact[i];
|
495 |
+
if (range.from < from) range.from = from;
|
496 |
+
if (range.to > to) range.to = to;
|
497 |
+
if (range.from >= range.to) intact.splice(i--, 1);
|
498 |
+
else intactLines += range.to - range.from;
|
499 |
+
}
|
500 |
+
if (!forced && intactLines == to - from && from == display.showingFrom && to == display.showingTo) {
|
501 |
+
updateViewOffset(cm);
|
502 |
+
return;
|
503 |
+
}
|
504 |
+
intact.sort(function(a, b) {return a.from - b.from;});
|
505 |
+
|
506 |
+
// Avoid crashing on IE's "unspecified error" when in iframes
|
507 |
+
try {
|
508 |
+
var focused = document.activeElement;
|
509 |
+
} catch(e) {}
|
510 |
+
if (intactLines < (to - from) * .7) display.lineDiv.style.display = "none";
|
511 |
+
patchDisplay(cm, from, to, intact, positionsChangedFrom);
|
512 |
+
display.lineDiv.style.display = "";
|
513 |
+
if (focused && document.activeElement != focused && focused.offsetHeight) focused.focus();
|
514 |
+
|
515 |
+
var different = from != display.showingFrom || to != display.showingTo ||
|
516 |
+
display.lastSizeC != display.wrapper.clientHeight;
|
517 |
+
// This is just a bogus formula that detects when the editor is
|
518 |
+
// resized or the font size changes.
|
519 |
+
if (different) {
|
520 |
+
display.lastSizeC = display.wrapper.clientHeight;
|
521 |
+
startWorker(cm, 400);
|
522 |
+
}
|
523 |
+
display.showingFrom = from; display.showingTo = to;
|
524 |
+
|
525 |
+
updateHeightsInViewport(cm);
|
526 |
+
updateViewOffset(cm);
|
527 |
+
|
528 |
+
return true;
|
529 |
+
}
|
530 |
+
|
531 |
+
function updateHeightsInViewport(cm) {
|
532 |
+
var display = cm.display;
|
533 |
+
var prevBottom = display.lineDiv.offsetTop;
|
534 |
+
for (var node = display.lineDiv.firstChild, height; node; node = node.nextSibling) if (node.lineObj) {
|
535 |
+
if (ie_lt8) {
|
536 |
+
var bot = node.offsetTop + node.offsetHeight;
|
537 |
+
height = bot - prevBottom;
|
538 |
+
prevBottom = bot;
|
539 |
+
} else {
|
540 |
+
var box = getRect(node);
|
541 |
+
height = box.bottom - box.top;
|
542 |
+
}
|
543 |
+
var diff = node.lineObj.height - height;
|
544 |
+
if (height < 2) height = textHeight(display);
|
545 |
+
if (diff > .001 || diff < -.001) {
|
546 |
+
updateLineHeight(node.lineObj, height);
|
547 |
+
var widgets = node.lineObj.widgets;
|
548 |
+
if (widgets) for (var i = 0; i < widgets.length; ++i)
|
549 |
+
widgets[i].height = widgets[i].node.offsetHeight;
|
550 |
+
}
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
+
function updateViewOffset(cm) {
|
555 |
+
var off = cm.display.viewOffset = heightAtLine(cm, getLine(cm.doc, cm.display.showingFrom));
|
556 |
+
// Position the mover div to align with the current virtual scroll position
|
557 |
+
cm.display.mover.style.top = off + "px";
|
558 |
+
}
|
559 |
+
|
560 |
+
function computeIntact(intact, changes) {
|
561 |
+
for (var i = 0, l = changes.length || 0; i < l; ++i) {
|
562 |
+
var change = changes[i], intact2 = [], diff = change.diff || 0;
|
563 |
+
for (var j = 0, l2 = intact.length; j < l2; ++j) {
|
564 |
+
var range = intact[j];
|
565 |
+
if (change.to <= range.from && change.diff) {
|
566 |
+
intact2.push({from: range.from + diff, to: range.to + diff});
|
567 |
+
} else if (change.to <= range.from || change.from >= range.to) {
|
568 |
+
intact2.push(range);
|
569 |
+
} else {
|
570 |
+
if (change.from > range.from)
|
571 |
+
intact2.push({from: range.from, to: change.from});
|
572 |
+
if (change.to < range.to)
|
573 |
+
intact2.push({from: change.to + diff, to: range.to + diff});
|
574 |
+
}
|
575 |
+
}
|
576 |
+
intact = intact2;
|
577 |
+
}
|
578 |
+
return intact;
|
579 |
+
}
|
580 |
+
|
581 |
+
function getDimensions(cm) {
|
582 |
+
var d = cm.display, left = {}, width = {};
|
583 |
+
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
584 |
+
left[cm.options.gutters[i]] = n.offsetLeft;
|
585 |
+
width[cm.options.gutters[i]] = n.offsetWidth;
|
586 |
+
}
|
587 |
+
return {fixedPos: compensateForHScroll(d),
|
588 |
+
gutterTotalWidth: d.gutters.offsetWidth,
|
589 |
+
gutterLeft: left,
|
590 |
+
gutterWidth: width,
|
591 |
+
wrapperWidth: d.wrapper.clientWidth};
|
592 |
+
}
|
593 |
+
|
594 |
+
function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
|
595 |
+
var dims = getDimensions(cm);
|
596 |
+
var display = cm.display, lineNumbers = cm.options.lineNumbers;
|
597 |
+
if (!intact.length && (!webkit || !cm.display.currentWheelTarget))
|
598 |
+
removeChildren(display.lineDiv);
|
599 |
+
var container = display.lineDiv, cur = container.firstChild;
|
600 |
+
|
601 |
+
function rm(node) {
|
602 |
+
var next = node.nextSibling;
|
603 |
+
if (webkit && mac && cm.display.currentWheelTarget == node) {
|
604 |
+
node.style.display = "none";
|
605 |
+
node.lineObj = null;
|
606 |
+
} else {
|
607 |
+
node.parentNode.removeChild(node);
|
608 |
+
}
|
609 |
+
return next;
|
610 |
+
}
|
611 |
+
|
612 |
+
var nextIntact = intact.shift(), lineN = from;
|
613 |
+
cm.doc.iter(from, to, function(line) {
|
614 |
+
if (nextIntact && nextIntact.to == lineN) nextIntact = intact.shift();
|
615 |
+
if (lineIsHidden(cm.doc, line)) {
|
616 |
+
if (line.height != 0) updateLineHeight(line, 0);
|
617 |
+
if (line.widgets && cur.previousSibling) for (var i = 0; i < line.widgets.length; ++i) {
|
618 |
+
var w = line.widgets[i];
|
619 |
+
if (w.showIfHidden) {
|
620 |
+
var prev = cur.previousSibling;
|
621 |
+
if (/pre/i.test(prev.nodeName)) {
|
622 |
+
var wrap = elt("div", null, null, "position: relative");
|
623 |
+
prev.parentNode.replaceChild(wrap, prev);
|
624 |
+
wrap.appendChild(prev);
|
625 |
+
prev = wrap;
|
626 |
+
}
|
627 |
+
var wnode = prev.appendChild(elt("div", [w.node], "CodeMirror-linewidget"));
|
628 |
+
if (!w.handleMouseEvents) wnode.ignoreEvents = true;
|
629 |
+
positionLineWidget(w, wnode, prev, dims);
|
630 |
+
}
|
631 |
+
}
|
632 |
+
} else if (nextIntact && nextIntact.from <= lineN && nextIntact.to > lineN) {
|
633 |
+
// This line is intact. Skip to the actual node. Update its
|
634 |
+
// line number if needed.
|
635 |
+
while (cur.lineObj != line) cur = rm(cur);
|
636 |
+
if (lineNumbers && updateNumbersFrom <= lineN && cur.lineNumber)
|
637 |
+
setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineN));
|
638 |
+
cur = cur.nextSibling;
|
639 |
+
} else {
|
640 |
+
// For lines with widgets, make an attempt to find and reuse
|
641 |
+
// the existing element, so that widgets aren't needlessly
|
642 |
+
// removed and re-inserted into the dom
|
643 |
+
if (line.widgets) for (var j = 0, search = cur, reuse; search && j < 20; ++j, search = search.nextSibling)
|
644 |
+
if (search.lineObj == line && /div/i.test(search.nodeName)) { reuse = search; break; }
|
645 |
+
// This line needs to be generated.
|
646 |
+
var lineNode = buildLineElement(cm, line, lineN, dims, reuse);
|
647 |
+
if (lineNode != reuse) {
|
648 |
+
container.insertBefore(lineNode, cur);
|
649 |
+
} else {
|
650 |
+
while (cur != reuse) cur = rm(cur);
|
651 |
+
cur = cur.nextSibling;
|
652 |
+
}
|
653 |
+
|
654 |
+
lineNode.lineObj = line;
|
655 |
+
}
|
656 |
+
++lineN;
|
657 |
+
});
|
658 |
+
while (cur) cur = rm(cur);
|
659 |
+
}
|
660 |
+
|
661 |
+
function buildLineElement(cm, line, lineNo, dims, reuse) {
|
662 |
+
var lineElement = lineContent(cm, line);
|
663 |
+
var markers = line.gutterMarkers, display = cm.display, wrap;
|
664 |
+
|
665 |
+
if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass && !line.widgets)
|
666 |
+
return lineElement;
|
667 |
+
|
668 |
+
// Lines with gutter elements, widgets or a background class need
|
669 |
+
// to be wrapped again, and have the extra elements added to the
|
670 |
+
// wrapper div
|
671 |
+
|
672 |
+
if (reuse) {
|
673 |
+
reuse.alignable = null;
|
674 |
+
var isOk = true, widgetsSeen = 0, insertBefore = null;
|
675 |
+
for (var n = reuse.firstChild, next; n; n = next) {
|
676 |
+
next = n.nextSibling;
|
677 |
+
if (!/\bCodeMirror-linewidget\b/.test(n.className)) {
|
678 |
+
reuse.removeChild(n);
|
679 |
+
} else {
|
680 |
+
for (var i = 0; i < line.widgets.length; ++i) {
|
681 |
+
var widget = line.widgets[i];
|
682 |
+
if (widget.node == n.firstChild) {
|
683 |
+
if (!widget.above && !insertBefore) insertBefore = n;
|
684 |
+
positionLineWidget(widget, n, reuse, dims);
|
685 |
+
++widgetsSeen;
|
686 |
+
break;
|
687 |
+
}
|
688 |
+
}
|
689 |
+
if (i == line.widgets.length) { isOk = false; break; }
|
690 |
+
}
|
691 |
+
}
|
692 |
+
reuse.insertBefore(lineElement, insertBefore);
|
693 |
+
if (isOk && widgetsSeen == line.widgets.length) {
|
694 |
+
wrap = reuse;
|
695 |
+
reuse.className = line.wrapClass || "";
|
696 |
+
}
|
697 |
+
}
|
698 |
+
if (!wrap) {
|
699 |
+
wrap = elt("div", null, line.wrapClass, "position: relative");
|
700 |
+
wrap.appendChild(lineElement);
|
701 |
+
}
|
702 |
+
// Kludge to make sure the styled element lies behind the selection (by z-index)
|
703 |
+
if (line.bgClass)
|
704 |
+
wrap.insertBefore(elt("div", null, line.bgClass + " CodeMirror-linebackground"), wrap.firstChild);
|
705 |
+
if (cm.options.lineNumbers || markers) {
|
706 |
+
var gutterWrap = wrap.insertBefore(elt("div", null, null, "position: absolute; left: " +
|
707 |
+
(cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"),
|
708 |
+
wrap.firstChild);
|
709 |
+
if (cm.options.fixedGutter) (wrap.alignable || (wrap.alignable = [])).push(gutterWrap);
|
710 |
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
711 |
+
wrap.lineNumber = gutterWrap.appendChild(
|
712 |
+
elt("div", lineNumberFor(cm.options, lineNo),
|
713 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
714 |
+
"left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
|
715 |
+
+ display.lineNumInnerWidth + "px"));
|
716 |
+
if (markers)
|
717 |
+
for (var k = 0; k < cm.options.gutters.length; ++k) {
|
718 |
+
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
|
719 |
+
if (found)
|
720 |
+
gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
|
721 |
+
dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
|
722 |
+
}
|
723 |
+
}
|
724 |
+
if (ie_lt8) wrap.style.zIndex = 2;
|
725 |
+
if (line.widgets && wrap != reuse) for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
726 |
+
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
|
727 |
+
if (!widget.handleMouseEvents) node.ignoreEvents = true;
|
728 |
+
positionLineWidget(widget, node, wrap, dims);
|
729 |
+
if (widget.above)
|
730 |
+
wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
|
731 |
+
else
|
732 |
+
wrap.appendChild(node);
|
733 |
+
signalLater(widget, "redraw");
|
734 |
+
}
|
735 |
+
return wrap;
|
736 |
+
}
|
737 |
+
|
738 |
+
function positionLineWidget(widget, node, wrap, dims) {
|
739 |
+
if (widget.noHScroll) {
|
740 |
+
(wrap.alignable || (wrap.alignable = [])).push(node);
|
741 |
+
var width = dims.wrapperWidth;
|
742 |
+
node.style.left = dims.fixedPos + "px";
|
743 |
+
if (!widget.coverGutter) {
|
744 |
+
width -= dims.gutterTotalWidth;
|
745 |
+
node.style.paddingLeft = dims.gutterTotalWidth + "px";
|
746 |
+
}
|
747 |
+
node.style.width = width + "px";
|
748 |
+
}
|
749 |
+
if (widget.coverGutter) {
|
750 |
+
node.style.zIndex = 5;
|
751 |
+
node.style.position = "relative";
|
752 |
+
if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
|
753 |
+
}
|
754 |
+
}
|
755 |
+
|
756 |
+
// SELECTION / CURSOR
|
757 |
+
|
758 |
+
function updateSelection(cm) {
|
759 |
+
var display = cm.display;
|
760 |
+
var collapsed = posEq(cm.doc.sel.from, cm.doc.sel.to);
|
761 |
+
if (collapsed || cm.options.showCursorWhenSelecting)
|
762 |
+
updateSelectionCursor(cm);
|
763 |
+
else
|
764 |
+
display.cursor.style.display = display.otherCursor.style.display = "none";
|
765 |
+
if (!collapsed)
|
766 |
+
updateSelectionRange(cm);
|
767 |
+
else
|
768 |
+
display.selectionDiv.style.display = "none";
|
769 |
+
|
770 |
+
// Move the hidden textarea near the cursor to prevent scrolling artifacts
|
771 |
+
if (cm.options.moveInputWithCursor) {
|
772 |
+
var headPos = cursorCoords(cm, cm.doc.sel.head, "div");
|
773 |
+
var wrapOff = getRect(display.wrapper), lineOff = getRect(display.lineDiv);
|
774 |
+
display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
|
775 |
+
headPos.top + lineOff.top - wrapOff.top)) + "px";
|
776 |
+
display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
|
777 |
+
headPos.left + lineOff.left - wrapOff.left)) + "px";
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
// No selection, plain cursor
|
782 |
+
function updateSelectionCursor(cm) {
|
783 |
+
var display = cm.display, pos = cursorCoords(cm, cm.doc.sel.head, "div");
|
784 |
+
display.cursor.style.left = pos.left + "px";
|
785 |
+
display.cursor.style.top = pos.top + "px";
|
786 |
+
display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
|
787 |
+
display.cursor.style.display = "";
|
788 |
+
|
789 |
+
if (pos.other) {
|
790 |
+
display.otherCursor.style.display = "";
|
791 |
+
display.otherCursor.style.left = pos.other.left + "px";
|
792 |
+
display.otherCursor.style.top = pos.other.top + "px";
|
793 |
+
display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
|
794 |
+
} else { display.otherCursor.style.display = "none"; }
|
795 |
+
}
|
796 |
+
|
797 |
+
// Highlight selection
|
798 |
+
function updateSelectionRange(cm) {
|
799 |
+
var display = cm.display, doc = cm.doc, sel = cm.doc.sel;
|
800 |
+
var fragment = document.createDocumentFragment();
|
801 |
+
var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
|
802 |
+
|
803 |
+
function add(left, top, width, bottom) {
|
804 |
+
if (top < 0) top = 0;
|
805 |
+
fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
|
806 |
+
"px; top: " + top + "px; width: " + (width == null ? clientWidth - left : width) +
|
807 |
+
"px; height: " + (bottom - top) + "px"));
|
808 |
+
}
|
809 |
+
|
810 |
+
function drawForLine(line, fromArg, toArg) {
|
811 |
+
var lineObj = getLine(doc, line);
|
812 |
+
var lineLen = lineObj.text.length;
|
813 |
+
var start, end;
|
814 |
+
function coords(ch, bias) {
|
815 |
+
return charCoords(cm, Pos(line, ch), "div", lineObj, bias);
|
816 |
+
}
|
817 |
+
|
818 |
+
iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
|
819 |
+
var leftPos = coords(from, "left"), rightPos, left, right;
|
820 |
+
if (from == to) {
|
821 |
+
rightPos = leftPos;
|
822 |
+
left = right = leftPos.left;
|
823 |
+
} else {
|
824 |
+
rightPos = coords(to - 1, "right");
|
825 |
+
if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp; }
|
826 |
+
left = leftPos.left;
|
827 |
+
right = rightPos.right;
|
828 |
+
}
|
829 |
+
if (fromArg == null && from == 0) left = pl;
|
830 |
+
if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
|
831 |
+
add(left, leftPos.top, null, leftPos.bottom);
|
832 |
+
left = pl;
|
833 |
+
if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
|
834 |
+
}
|
835 |
+
if (toArg == null && to == lineLen) right = clientWidth;
|
836 |
+
if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
|
837 |
+
start = leftPos;
|
838 |
+
if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
|
839 |
+
end = rightPos;
|
840 |
+
if (left < pl + 1) left = pl;
|
841 |
+
add(left, rightPos.top, right - left, rightPos.bottom);
|
842 |
+
});
|
843 |
+
return {start: start, end: end};
|
844 |
+
}
|
845 |
+
|
846 |
+
if (sel.from.line == sel.to.line) {
|
847 |
+
drawForLine(sel.from.line, sel.from.ch, sel.to.ch);
|
848 |
+
} else {
|
849 |
+
var fromLine = getLine(doc, sel.from.line), toLine = getLine(doc, sel.to.line);
|
850 |
+
var singleVLine = visualLine(doc, fromLine) == visualLine(doc, toLine);
|
851 |
+
var leftEnd = drawForLine(sel.from.line, sel.from.ch, singleVLine ? fromLine.text.length : null).end;
|
852 |
+
var rightStart = drawForLine(sel.to.line, singleVLine ? 0 : null, sel.to.ch).start;
|
853 |
+
if (singleVLine) {
|
854 |
+
if (leftEnd.top < rightStart.top - 2) {
|
855 |
+
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
|
856 |
+
add(pl, rightStart.top, rightStart.left, rightStart.bottom);
|
857 |
+
} else {
|
858 |
+
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
|
859 |
+
}
|
860 |
+
}
|
861 |
+
if (leftEnd.bottom < rightStart.top)
|
862 |
+
add(pl, leftEnd.bottom, null, rightStart.top);
|
863 |
+
}
|
864 |
+
|
865 |
+
removeChildrenAndAdd(display.selectionDiv, fragment);
|
866 |
+
display.selectionDiv.style.display = "";
|
867 |
+
}
|
868 |
+
|
869 |
+
// Cursor-blinking
|
870 |
+
function restartBlink(cm) {
|
871 |
+
if (!cm.state.focused) return;
|
872 |
+
var display = cm.display;
|
873 |
+
clearInterval(display.blinker);
|
874 |
+
var on = true;
|
875 |
+
display.cursor.style.visibility = display.otherCursor.style.visibility = "";
|
876 |
+
display.blinker = setInterval(function() {
|
877 |
+
display.cursor.style.visibility = display.otherCursor.style.visibility = (on = !on) ? "" : "hidden";
|
878 |
+
}, cm.options.cursorBlinkRate);
|
879 |
+
}
|
880 |
+
|
881 |
+
// HIGHLIGHT WORKER
|
882 |
+
|
883 |
+
function startWorker(cm, time) {
|
884 |
+
if (cm.doc.mode.startState && cm.doc.frontier < cm.display.showingTo)
|
885 |
+
cm.state.highlight.set(time, bind(highlightWorker, cm));
|
886 |
+
}
|
887 |
+
|
888 |
+
function highlightWorker(cm) {
|
889 |
+
var doc = cm.doc;
|
890 |
+
if (doc.frontier < doc.first) doc.frontier = doc.first;
|
891 |
+
if (doc.frontier >= cm.display.showingTo) return;
|
892 |
+
var end = +new Date + cm.options.workTime;
|
893 |
+
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
|
894 |
+
var changed = [], prevChange;
|
895 |
+
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.showingTo + 500), function(line) {
|
896 |
+
if (doc.frontier >= cm.display.showingFrom) { // Visible
|
897 |
+
var oldStyles = line.styles;
|
898 |
+
line.styles = highlightLine(cm, line, state);
|
899 |
+
var ischange = !oldStyles || oldStyles.length != line.styles.length;
|
900 |
+
for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
|
901 |
+
if (ischange) {
|
902 |
+
if (prevChange && prevChange.end == doc.frontier) prevChange.end++;
|
903 |
+
else changed.push(prevChange = {start: doc.frontier, end: doc.frontier + 1});
|
904 |
+
}
|
905 |
+
line.stateAfter = copyState(doc.mode, state);
|
906 |
+
} else {
|
907 |
+
processLine(cm, line, state);
|
908 |
+
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
|
909 |
+
}
|
910 |
+
++doc.frontier;
|
911 |
+
if (+new Date > end) {
|
912 |
+
startWorker(cm, cm.options.workDelay);
|
913 |
+
return true;
|
914 |
+
}
|
915 |
+
});
|
916 |
+
if (changed.length)
|
917 |
+
operation(cm, function() {
|
918 |
+
for (var i = 0; i < changed.length; ++i)
|
919 |
+
regChange(this, changed[i].start, changed[i].end);
|
920 |
+
})();
|
921 |
+
}
|
922 |
+
|
923 |
+
// Finds the line to start with when starting a parse. Tries to
|
924 |
+
// find a line with a stateAfter, so that it can start with a
|
925 |
+
// valid state. If that fails, it returns the line with the
|
926 |
+
// smallest indentation, which tends to need the least context to
|
927 |
+
// parse correctly.
|
928 |
+
function findStartLine(cm, n, precise) {
|
929 |
+
var minindent, minline, doc = cm.doc;
|
930 |
+
for (var search = n, lim = n - 100; search > lim; --search) {
|
931 |
+
if (search <= doc.first) return doc.first;
|
932 |
+
var line = getLine(doc, search - 1);
|
933 |
+
if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
|
934 |
+
var indented = countColumn(line.text, null, cm.options.tabSize);
|
935 |
+
if (minline == null || minindent > indented) {
|
936 |
+
minline = search - 1;
|
937 |
+
minindent = indented;
|
938 |
+
}
|
939 |
+
}
|
940 |
+
return minline;
|
941 |
+
}
|
942 |
+
|
943 |
+
function getStateBefore(cm, n, precise) {
|
944 |
+
var doc = cm.doc, display = cm.display;
|
945 |
+
if (!doc.mode.startState) return true;
|
946 |
+
var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter;
|
947 |
+
if (!state) state = startState(doc.mode);
|
948 |
+
else state = copyState(doc.mode, state);
|
949 |
+
doc.iter(pos, n, function(line) {
|
950 |
+
processLine(cm, line, state);
|
951 |
+
var save = pos == n - 1 || pos % 5 == 0 || pos >= display.showingFrom && pos < display.showingTo;
|
952 |
+
line.stateAfter = save ? copyState(doc.mode, state) : null;
|
953 |
+
++pos;
|
954 |
+
});
|
955 |
+
return state;
|
956 |
+
}
|
957 |
+
|
958 |
+
// POSITION MEASUREMENT
|
959 |
+
|
960 |
+
function paddingTop(display) {return display.lineSpace.offsetTop;}
|
961 |
+
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
|
962 |
+
function paddingLeft(display) {
|
963 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", null, null, "text-align: left")).appendChild(elt("span", "x"));
|
964 |
+
return e.offsetLeft;
|
965 |
+
}
|
966 |
+
|
967 |
+
function measureChar(cm, line, ch, data, bias) {
|
968 |
+
var dir = -1;
|
969 |
+
data = data || measureLine(cm, line);
|
970 |
+
|
971 |
+
for (var pos = ch;; pos += dir) {
|
972 |
+
var r = data[pos];
|
973 |
+
if (r) break;
|
974 |
+
if (dir < 0 && pos == 0) dir = 1;
|
975 |
+
}
|
976 |
+
bias = pos > ch ? "left" : pos < ch ? "right" : bias;
|
977 |
+
if (bias == "left" && r.leftSide) r = r.leftSide;
|
978 |
+
else if (bias == "right" && r.rightSide) r = r.rightSide;
|
979 |
+
return {left: pos < ch ? r.right : r.left,
|
980 |
+
right: pos > ch ? r.left : r.right,
|
981 |
+
top: r.top,
|
982 |
+
bottom: r.bottom};
|
983 |
+
}
|
984 |
+
|
985 |
+
function findCachedMeasurement(cm, line) {
|
986 |
+
var cache = cm.display.measureLineCache;
|
987 |
+
for (var i = 0; i < cache.length; ++i) {
|
988 |
+
var memo = cache[i];
|
989 |
+
if (memo.text == line.text && memo.markedSpans == line.markedSpans &&
|
990 |
+
cm.display.scroller.clientWidth == memo.width &&
|
991 |
+
memo.classes == line.textClass + "|" + line.bgClass + "|" + line.wrapClass)
|
992 |
+
return memo;
|
993 |
+
}
|
994 |
+
}
|
995 |
+
|
996 |
+
function clearCachedMeasurement(cm, line) {
|
997 |
+
var exists = findCachedMeasurement(cm, line);
|
998 |
+
if (exists) exists.text = exists.measure = exists.markedSpans = null;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
function measureLine(cm, line) {
|
1002 |
+
// First look in the cache
|
1003 |
+
var cached = findCachedMeasurement(cm, line);
|
1004 |
+
if (cached) return cached.measure;
|
1005 |
+
|
1006 |
+
// Failing that, recompute and store result in cache
|
1007 |
+
var measure = measureLineInner(cm, line);
|
1008 |
+
var cache = cm.display.measureLineCache;
|
1009 |
+
var memo = {text: line.text, width: cm.display.scroller.clientWidth,
|
1010 |
+
markedSpans: line.markedSpans, measure: measure,
|
1011 |
+
classes: line.textClass + "|" + line.bgClass + "|" + line.wrapClass};
|
1012 |
+
if (cache.length == 16) cache[++cm.display.measureLineCachePos % 16] = memo;
|
1013 |
+
else cache.push(memo);
|
1014 |
+
return measure;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
function measureLineInner(cm, line) {
|
1018 |
+
var display = cm.display, measure = emptyArray(line.text.length);
|
1019 |
+
var pre = lineContent(cm, line, measure, true);
|
1020 |
+
|
1021 |
+
// IE does not cache element positions of inline elements between
|
1022 |
+
// calls to getBoundingClientRect. This makes the loop below,
|
1023 |
+
// which gathers the positions of all the characters on the line,
|
1024 |
+
// do an amount of layout work quadratic to the number of
|
1025 |
+
// characters. When line wrapping is off, we try to improve things
|
1026 |
+
// by first subdividing the line into a bunch of inline blocks, so
|
1027 |
+
// that IE can reuse most of the layout information from caches
|
1028 |
+
// for those blocks. This does interfere with line wrapping, so it
|
1029 |
+
// doesn't work when wrapping is on, but in that case the
|
1030 |
+
// situation is slightly better, since IE does cache line-wrapping
|
1031 |
+
// information and only recomputes per-line.
|
1032 |
+
if (ie && !ie_lt8 && !cm.options.lineWrapping && pre.childNodes.length > 100) {
|
1033 |
+
var fragment = document.createDocumentFragment();
|
1034 |
+
var chunk = 10, n = pre.childNodes.length;
|
1035 |
+
for (var i = 0, chunks = Math.ceil(n / chunk); i < chunks; ++i) {
|
1036 |
+
var wrap = elt("div", null, null, "display: inline-block");
|
1037 |
+
for (var j = 0; j < chunk && n; ++j) {
|
1038 |
+
wrap.appendChild(pre.firstChild);
|
1039 |
+
--n;
|
1040 |
+
}
|
1041 |
+
fragment.appendChild(wrap);
|
1042 |
+
}
|
1043 |
+
pre.appendChild(fragment);
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
removeChildrenAndAdd(display.measure, pre);
|
1047 |
+
|
1048 |
+
var outer = getRect(display.lineDiv);
|
1049 |
+
var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight;
|
1050 |
+
// Work around an IE7/8 bug where it will sometimes have randomly
|
1051 |
+
// replaced our pre with a clone at this point.
|
1052 |
+
if (ie_lt9 && display.measure.first != pre)
|
1053 |
+
removeChildrenAndAdd(display.measure, pre);
|
1054 |
+
|
1055 |
+
function measureRect(rect) {
|
1056 |
+
var top = rect.top - outer.top, bot = rect.bottom - outer.top;
|
1057 |
+
if (bot > maxBot) bot = maxBot;
|
1058 |
+
if (top < 0) top = 0;
|
1059 |
+
for (var i = vranges.length - 2; i >= 0; i -= 2) {
|
1060 |
+
var rtop = vranges[i], rbot = vranges[i+1];
|
1061 |
+
if (rtop > bot || rbot < top) continue;
|
1062 |
+
if (rtop <= top && rbot >= bot ||
|
1063 |
+
top <= rtop && bot >= rbot ||
|
1064 |
+
Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) {
|
1065 |
+
vranges[i] = Math.min(top, rtop);
|
1066 |
+
vranges[i+1] = Math.max(bot, rbot);
|
1067 |
+
break;
|
1068 |
+
}
|
1069 |
+
}
|
1070 |
+
if (i < 0) { i = vranges.length; vranges.push(top, bot); }
|
1071 |
+
return {left: rect.left - outer.left,
|
1072 |
+
right: rect.right - outer.left,
|
1073 |
+
top: i, bottom: null};
|
1074 |
+
}
|
1075 |
+
function finishRect(rect) {
|
1076 |
+
rect.bottom = vranges[rect.top+1];
|
1077 |
+
rect.top = vranges[rect.top];
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) {
|
1081 |
+
var node = cur, rect = null;
|
1082 |
+
// A widget might wrap, needs special care
|
1083 |
+
if (/\bCodeMirror-widget\b/.test(cur.className) && cur.getClientRects) {
|
1084 |
+
if (cur.firstChild.nodeType == 1) node = cur.firstChild;
|
1085 |
+
var rects = node.getClientRects();
|
1086 |
+
if (rects.length > 1) {
|
1087 |
+
rect = data[i] = measureRect(rects[0]);
|
1088 |
+
rect.rightSide = measureRect(rects[rects.length - 1]);
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
if (!rect) rect = data[i] = measureRect(getRect(node));
|
1092 |
+
if (cur.measureRight) rect.right = getRect(cur.measureRight).left;
|
1093 |
+
if (cur.leftSide) rect.leftSide = measureRect(getRect(cur.leftSide));
|
1094 |
+
}
|
1095 |
+
for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) {
|
1096 |
+
finishRect(cur);
|
1097 |
+
if (cur.leftSide) finishRect(cur.leftSide);
|
1098 |
+
if (cur.rightSide) finishRect(cur.rightSide);
|
1099 |
+
}
|
1100 |
+
return data;
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
function measureLineWidth(cm, line) {
|
1104 |
+
var hasBadSpan = false;
|
1105 |
+
if (line.markedSpans) for (var i = 0; i < line.markedSpans; ++i) {
|
1106 |
+
var sp = line.markedSpans[i];
|
1107 |
+
if (sp.collapsed && (sp.to == null || sp.to == line.text.length)) hasBadSpan = true;
|
1108 |
+
}
|
1109 |
+
var cached = !hasBadSpan && findCachedMeasurement(cm, line);
|
1110 |
+
if (cached) return measureChar(cm, line, line.text.length, cached.measure, "right").right;
|
1111 |
+
|
1112 |
+
var pre = lineContent(cm, line, null, true);
|
1113 |
+
var end = pre.appendChild(zeroWidthElement(cm.display.measure));
|
1114 |
+
removeChildrenAndAdd(cm.display.measure, pre);
|
1115 |
+
return getRect(end).right - getRect(cm.display.lineDiv).left;
|
1116 |
+
}
|
1117 |
+
|
1118 |
+
function clearCaches(cm) {
|
1119 |
+
cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
|
1120 |
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
|
1121 |
+
if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
|
1122 |
+
cm.display.lineNumChars = null;
|
1123 |
+
}
|
1124 |
+
|
1125 |
+
function pageScrollX() { return window.pageXOffset || (document.documentElement || document.body).scrollLeft; }
|
1126 |
+
function pageScrollY() { return window.pageYOffset || (document.documentElement || document.body).scrollTop; }
|
1127 |
+
|
1128 |
+
// Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
|
1129 |
+
function intoCoordSystem(cm, lineObj, rect, context) {
|
1130 |
+
if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
|
1131 |
+
var size = widgetHeight(lineObj.widgets[i]);
|
1132 |
+
rect.top += size; rect.bottom += size;
|
1133 |
+
}
|
1134 |
+
if (context == "line") return rect;
|
1135 |
+
if (!context) context = "local";
|
1136 |
+
var yOff = heightAtLine(cm, lineObj);
|
1137 |
+
if (context == "local") yOff += paddingTop(cm.display);
|
1138 |
+
else yOff -= cm.display.viewOffset;
|
1139 |
+
if (context == "page" || context == "window") {
|
1140 |
+
var lOff = getRect(cm.display.lineSpace);
|
1141 |
+
yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
|
1142 |
+
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
|
1143 |
+
rect.left += xOff; rect.right += xOff;
|
1144 |
+
}
|
1145 |
+
rect.top += yOff; rect.bottom += yOff;
|
1146 |
+
return rect;
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
// Context may be "window", "page", "div", or "local"/null
|
1150 |
+
// Result is in "div" coords
|
1151 |
+
function fromCoordSystem(cm, coords, context) {
|
1152 |
+
if (context == "div") return coords;
|
1153 |
+
var left = coords.left, top = coords.top;
|
1154 |
+
// First move into "page" coordinate system
|
1155 |
+
if (context == "page") {
|
1156 |
+
left -= pageScrollX();
|
1157 |
+
top -= pageScrollY();
|
1158 |
+
} else if (context == "local" || !context) {
|
1159 |
+
var localBox = getRect(cm.display.sizer);
|
1160 |
+
left += localBox.left;
|
1161 |
+
top += localBox.top;
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
var lineSpaceBox = getRect(cm.display.lineSpace);
|
1165 |
+
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top};
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
function charCoords(cm, pos, context, lineObj, bias) {
|
1169 |
+
if (!lineObj) lineObj = getLine(cm.doc, pos.line);
|
1170 |
+
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, null, bias), context);
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
function cursorCoords(cm, pos, context, lineObj, measurement) {
|
1174 |
+
lineObj = lineObj || getLine(cm.doc, pos.line);
|
1175 |
+
if (!measurement) measurement = measureLine(cm, lineObj);
|
1176 |
+
function get(ch, right) {
|
1177 |
+
var m = measureChar(cm, lineObj, ch, measurement, right ? "right" : "left");
|
1178 |
+
if (right) m.left = m.right; else m.right = m.left;
|
1179 |
+
return intoCoordSystem(cm, lineObj, m, context);
|
1180 |
+
}
|
1181 |
+
function getBidi(ch, partPos) {
|
1182 |
+
var part = order[partPos], right = part.level % 2;
|
1183 |
+
if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
|
1184 |
+
part = order[--partPos];
|
1185 |
+
ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
|
1186 |
+
right = true;
|
1187 |
+
} else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
|
1188 |
+
part = order[++partPos];
|
1189 |
+
ch = bidiLeft(part) - part.level % 2;
|
1190 |
+
right = false;
|
1191 |
+
}
|
1192 |
+
if (right && ch == part.to && ch > part.from) return get(ch - 1);
|
1193 |
+
return get(ch, right);
|
1194 |
+
}
|
1195 |
+
var order = getOrder(lineObj), ch = pos.ch;
|
1196 |
+
if (!order) return get(ch);
|
1197 |
+
var partPos = getBidiPartAt(order, ch);
|
1198 |
+
var val = getBidi(ch, partPos);
|
1199 |
+
if (bidiOther != null) val.other = getBidi(ch, bidiOther);
|
1200 |
+
return val;
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
function PosWithInfo(line, ch, outside, xRel) {
|
1204 |
+
var pos = new Pos(line, ch);
|
1205 |
+
pos.xRel = xRel;
|
1206 |
+
if (outside) pos.outside = true;
|
1207 |
+
return pos;
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
// Coords must be lineSpace-local
|
1211 |
+
function coordsChar(cm, x, y) {
|
1212 |
+
var doc = cm.doc;
|
1213 |
+
y += cm.display.viewOffset;
|
1214 |
+
if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
|
1215 |
+
var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
1216 |
+
if (lineNo > last)
|
1217 |
+
return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
|
1218 |
+
if (x < 0) x = 0;
|
1219 |
+
|
1220 |
+
for (;;) {
|
1221 |
+
var lineObj = getLine(doc, lineNo);
|
1222 |
+
var found = coordsCharInner(cm, lineObj, lineNo, x, y);
|
1223 |
+
var merged = collapsedSpanAtEnd(lineObj);
|
1224 |
+
var mergedPos = merged && merged.find();
|
1225 |
+
if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
|
1226 |
+
lineNo = mergedPos.to.line;
|
1227 |
+
else
|
1228 |
+
return found;
|
1229 |
+
}
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
function coordsCharInner(cm, lineObj, lineNo, x, y) {
|
1233 |
+
var innerOff = y - heightAtLine(cm, lineObj);
|
1234 |
+
var wrongLine = false, adjust = 2 * cm.display.wrapper.clientWidth;
|
1235 |
+
var measurement = measureLine(cm, lineObj);
|
1236 |
+
|
1237 |
+
function getX(ch) {
|
1238 |
+
var sp = cursorCoords(cm, Pos(lineNo, ch), "line",
|
1239 |
+
lineObj, measurement);
|
1240 |
+
wrongLine = true;
|
1241 |
+
if (innerOff > sp.bottom) return sp.left - adjust;
|
1242 |
+
else if (innerOff < sp.top) return sp.left + adjust;
|
1243 |
+
else wrongLine = false;
|
1244 |
+
return sp.left;
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
var bidi = getOrder(lineObj), dist = lineObj.text.length;
|
1248 |
+
var from = lineLeft(lineObj), to = lineRight(lineObj);
|
1249 |
+
var fromX = getX(from), fromOutside = wrongLine, toX = getX(to), toOutside = wrongLine;
|
1250 |
+
|
1251 |
+
if (x > toX) return PosWithInfo(lineNo, to, toOutside, 1);
|
1252 |
+
// Do a binary search between these bounds.
|
1253 |
+
for (;;) {
|
1254 |
+
if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
|
1255 |
+
var ch = x < fromX || x - fromX <= toX - x ? from : to;
|
1256 |
+
var xDiff = x - (ch == from ? fromX : toX);
|
1257 |
+
while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch;
|
1258 |
+
var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
|
1259 |
+
xDiff < 0 ? -1 : xDiff ? 1 : 0);
|
1260 |
+
return pos;
|
1261 |
+
}
|
1262 |
+
var step = Math.ceil(dist / 2), middle = from + step;
|
1263 |
+
if (bidi) {
|
1264 |
+
middle = from;
|
1265 |
+
for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
|
1266 |
+
}
|
1267 |
+
var middleX = getX(middle);
|
1268 |
+
if (middleX > x) {to = middle; toX = middleX; if (toOutside = wrongLine) toX += 1000; dist = step;}
|
1269 |
+
else {from = middle; fromX = middleX; fromOutside = wrongLine; dist -= step;}
|
1270 |
+
}
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
var measureText;
|
1274 |
+
function textHeight(display) {
|
1275 |
+
if (display.cachedTextHeight != null) return display.cachedTextHeight;
|
1276 |
+
if (measureText == null) {
|
1277 |
+
measureText = elt("pre");
|
1278 |
+
// Measure a bunch of lines, for browsers that compute
|
1279 |
+
// fractional heights.
|
1280 |
+
for (var i = 0; i < 49; ++i) {
|
1281 |
+
measureText.appendChild(document.createTextNode("x"));
|
1282 |
+
measureText.appendChild(elt("br"));
|
1283 |
+
}
|
1284 |
+
measureText.appendChild(document.createTextNode("x"));
|
1285 |
+
}
|
1286 |
+
removeChildrenAndAdd(display.measure, measureText);
|
1287 |
+
var height = measureText.offsetHeight / 50;
|
1288 |
+
if (height > 3) display.cachedTextHeight = height;
|
1289 |
+
removeChildren(display.measure);
|
1290 |
+
return height || 1;
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
function charWidth(display) {
|
1294 |
+
if (display.cachedCharWidth != null) return display.cachedCharWidth;
|
1295 |
+
var anchor = elt("span", "x");
|
1296 |
+
var pre = elt("pre", [anchor]);
|
1297 |
+
removeChildrenAndAdd(display.measure, pre);
|
1298 |
+
var width = anchor.offsetWidth;
|
1299 |
+
if (width > 2) display.cachedCharWidth = width;
|
1300 |
+
return width || 10;
|
1301 |
+
}
|
1302 |
+
|
1303 |
+
// OPERATIONS
|
1304 |
+
|
1305 |
+
// Operations are used to wrap changes in such a way that each
|
1306 |
+
// change won't have to update the cursor and display (which would
|
1307 |
+
// be awkward, slow, and error-prone), but instead updates are
|
1308 |
+
// batched and then all combined and executed at once.
|
1309 |
+
|
1310 |
+
var nextOpId = 0;
|
1311 |
+
function startOperation(cm) {
|
1312 |
+
cm.curOp = {
|
1313 |
+
// An array of ranges of lines that have to be updated. See
|
1314 |
+
// updateDisplay.
|
1315 |
+
changes: [],
|
1316 |
+
forceUpdate: false,
|
1317 |
+
updateInput: null,
|
1318 |
+
userSelChange: null,
|
1319 |
+
textChanged: null,
|
1320 |
+
selectionChanged: false,
|
1321 |
+
cursorActivity: false,
|
1322 |
+
updateMaxLine: false,
|
1323 |
+
updateScrollPos: false,
|
1324 |
+
id: ++nextOpId
|
1325 |
+
};
|
1326 |
+
if (!delayedCallbackDepth++) delayedCallbacks = [];
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
function endOperation(cm) {
|
1330 |
+
var op = cm.curOp, doc = cm.doc, display = cm.display;
|
1331 |
+
cm.curOp = null;
|
1332 |
+
|
1333 |
+
if (op.updateMaxLine) computeMaxLength(cm);
|
1334 |
+
if (display.maxLineChanged && !cm.options.lineWrapping && display.maxLine) {
|
1335 |
+
var width = measureLineWidth(cm, display.maxLine);
|
1336 |
+
display.sizer.style.minWidth = Math.max(0, width + 3 + scrollerCutOff) + "px";
|
1337 |
+
display.maxLineChanged = false;
|
1338 |
+
var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth);
|
1339 |
+
if (maxScrollLeft < doc.scrollLeft && !op.updateScrollPos)
|
1340 |
+
setScrollLeft(cm, Math.min(display.scroller.scrollLeft, maxScrollLeft), true);
|
1341 |
+
}
|
1342 |
+
var newScrollPos, updated;
|
1343 |
+
if (op.updateScrollPos) {
|
1344 |
+
newScrollPos = op.updateScrollPos;
|
1345 |
+
} else if (op.selectionChanged && display.scroller.clientHeight) { // don't rescroll if not visible
|
1346 |
+
var coords = cursorCoords(cm, doc.sel.head);
|
1347 |
+
newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
|
1348 |
+
}
|
1349 |
+
if (op.changes.length || op.forceUpdate || newScrollPos && newScrollPos.scrollTop != null) {
|
1350 |
+
updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop, op.forceUpdate);
|
1351 |
+
if (cm.display.scroller.offsetHeight) cm.doc.scrollTop = cm.display.scroller.scrollTop;
|
1352 |
+
}
|
1353 |
+
if (!updated && op.selectionChanged) updateSelection(cm);
|
1354 |
+
if (op.updateScrollPos) {
|
1355 |
+
display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = newScrollPos.scrollTop;
|
1356 |
+
display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = newScrollPos.scrollLeft;
|
1357 |
+
alignHorizontally(cm);
|
1358 |
+
if (op.scrollToPos)
|
1359 |
+
scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos), op.scrollToPosMargin);
|
1360 |
+
} else if (newScrollPos) {
|
1361 |
+
scrollCursorIntoView(cm);
|
1362 |
+
}
|
1363 |
+
if (op.selectionChanged) restartBlink(cm);
|
1364 |
+
|
1365 |
+
if (cm.state.focused && op.updateInput)
|
1366 |
+
resetInput(cm, op.userSelChange);
|
1367 |
+
|
1368 |
+
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
|
1369 |
+
if (hidden) for (var i = 0; i < hidden.length; ++i)
|
1370 |
+
if (!hidden[i].lines.length) signal(hidden[i], "hide");
|
1371 |
+
if (unhidden) for (var i = 0; i < unhidden.length; ++i)
|
1372 |
+
if (unhidden[i].lines.length) signal(unhidden[i], "unhide");
|
1373 |
+
|
1374 |
+
var delayed;
|
1375 |
+
if (!--delayedCallbackDepth) {
|
1376 |
+
delayed = delayedCallbacks;
|
1377 |
+
delayedCallbacks = null;
|
1378 |
+
}
|
1379 |
+
if (op.textChanged)
|
1380 |
+
signal(cm, "change", cm, op.textChanged);
|
1381 |
+
if (op.cursorActivity) signal(cm, "cursorActivity", cm);
|
1382 |
+
if (delayed) for (var i = 0; i < delayed.length; ++i) delayed[i]();
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
// Wraps a function in an operation. Returns the wrapped function.
|
1386 |
+
function operation(cm1, f) {
|
1387 |
+
return function() {
|
1388 |
+
var cm = cm1 || this, withOp = !cm.curOp;
|
1389 |
+
if (withOp) startOperation(cm);
|
1390 |
+
try { var result = f.apply(cm, arguments); }
|
1391 |
+
finally { if (withOp) endOperation(cm); }
|
1392 |
+
return result;
|
1393 |
+
};
|
1394 |
+
}
|
1395 |
+
function docOperation(f) {
|
1396 |
+
return function() {
|
1397 |
+
var withOp = this.cm && !this.cm.curOp, result;
|
1398 |
+
if (withOp) startOperation(this.cm);
|
1399 |
+
try { result = f.apply(this, arguments); }
|
1400 |
+
finally { if (withOp) endOperation(this.cm); }
|
1401 |
+
return result;
|
1402 |
+
};
|
1403 |
+
}
|
1404 |
+
function runInOp(cm, f) {
|
1405 |
+
var withOp = !cm.curOp, result;
|
1406 |
+
if (withOp) startOperation(cm);
|
1407 |
+
try { result = f(); }
|
1408 |
+
finally { if (withOp) endOperation(cm); }
|
1409 |
+
return result;
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
function regChange(cm, from, to, lendiff) {
|
1413 |
+
if (from == null) from = cm.doc.first;
|
1414 |
+
if (to == null) to = cm.doc.first + cm.doc.size;
|
1415 |
+
cm.curOp.changes.push({from: from, to: to, diff: lendiff});
|
1416 |
+
}
|
1417 |
+
|
1418 |
+
// INPUT HANDLING
|
1419 |
+
|
1420 |
+
function slowPoll(cm) {
|
1421 |
+
if (cm.display.pollingFast) return;
|
1422 |
+
cm.display.poll.set(cm.options.pollInterval, function() {
|
1423 |
+
readInput(cm);
|
1424 |
+
if (cm.state.focused) slowPoll(cm);
|
1425 |
+
});
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
function fastPoll(cm) {
|
1429 |
+
var missed = false;
|
1430 |
+
cm.display.pollingFast = true;
|
1431 |
+
function p() {
|
1432 |
+
var changed = readInput(cm);
|
1433 |
+
if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);}
|
1434 |
+
else {cm.display.pollingFast = false; slowPoll(cm);}
|
1435 |
+
}
|
1436 |
+
cm.display.poll.set(20, p);
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
// prevInput is a hack to work with IME. If we reset the textarea
|
1440 |
+
// on every change, that breaks IME. So we look for changes
|
1441 |
+
// compared to the previous content instead. (Modern browsers have
|
1442 |
+
// events that indicate IME taking place, but these are not widely
|
1443 |
+
// supported or compatible enough yet to rely on.)
|
1444 |
+
function readInput(cm) {
|
1445 |
+
var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc, sel = doc.sel;
|
1446 |
+
if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.state.disableInput) return false;
|
1447 |
+
var text = input.value;
|
1448 |
+
if (text == prevInput && posEq(sel.from, sel.to)) return false;
|
1449 |
+
if (ie && !ie_lt9 && cm.display.inputHasSelection === text) {
|
1450 |
+
resetInput(cm, true);
|
1451 |
+
return false;
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
var withOp = !cm.curOp;
|
1455 |
+
if (withOp) startOperation(cm);
|
1456 |
+
sel.shift = false;
|
1457 |
+
var same = 0, l = Math.min(prevInput.length, text.length);
|
1458 |
+
while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
|
1459 |
+
var from = sel.from, to = sel.to;
|
1460 |
+
if (same < prevInput.length)
|
1461 |
+
from = Pos(from.line, from.ch - (prevInput.length - same));
|
1462 |
+
else if (cm.state.overwrite && posEq(from, to) && !cm.state.pasteIncoming)
|
1463 |
+
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + (text.length - same)));
|
1464 |
+
|
1465 |
+
var updateInput = cm.curOp.updateInput;
|
1466 |
+
var changeEvent = {from: from, to: to, text: splitLines(text.slice(same)),
|
1467 |
+
origin: cm.state.pasteIncoming ? "paste" : "+input"};
|
1468 |
+
makeChange(cm.doc, changeEvent, "end");
|
1469 |
+
cm.curOp.updateInput = updateInput;
|
1470 |
+
signalLater(cm, "inputRead", cm, changeEvent);
|
1471 |
+
|
1472 |
+
if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = "";
|
1473 |
+
else cm.display.prevInput = text;
|
1474 |
+
if (withOp) endOperation(cm);
|
1475 |
+
cm.state.pasteIncoming = false;
|
1476 |
+
return true;
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
function resetInput(cm, user) {
|
1480 |
+
var minimal, selected, doc = cm.doc;
|
1481 |
+
if (!posEq(doc.sel.from, doc.sel.to)) {
|
1482 |
+
cm.display.prevInput = "";
|
1483 |
+
minimal = hasCopyEvent &&
|
1484 |
+
(doc.sel.to.line - doc.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
|
1485 |
+
var content = minimal ? "-" : selected || cm.getSelection();
|
1486 |
+
cm.display.input.value = content;
|
1487 |
+
if (cm.state.focused) selectInput(cm.display.input);
|
1488 |
+
if (ie && !ie_lt9) cm.display.inputHasSelection = content;
|
1489 |
+
} else if (user) {
|
1490 |
+
cm.display.prevInput = cm.display.input.value = "";
|
1491 |
+
if (ie && !ie_lt9) cm.display.inputHasSelection = null;
|
1492 |
+
}
|
1493 |
+
cm.display.inaccurateSelection = minimal;
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
function focusInput(cm) {
|
1497 |
+
if (cm.options.readOnly != "nocursor" && (!mobile || document.activeElement != cm.display.input))
|
1498 |
+
cm.display.input.focus();
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
function isReadOnly(cm) {
|
1502 |
+
return cm.options.readOnly || cm.doc.cantEdit;
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
// EVENT HANDLERS
|
1506 |
+
|
1507 |
+
function registerEventHandlers(cm) {
|
1508 |
+
var d = cm.display;
|
1509 |
+
on(d.scroller, "mousedown", operation(cm, onMouseDown));
|
1510 |
+
if (ie)
|
1511 |
+
on(d.scroller, "dblclick", operation(cm, function(e) {
|
1512 |
+
if (signalDOMEvent(cm, e)) return;
|
1513 |
+
var pos = posFromMouse(cm, e);
|
1514 |
+
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
|
1515 |
+
e_preventDefault(e);
|
1516 |
+
var word = findWordAt(getLine(cm.doc, pos.line).text, pos);
|
1517 |
+
extendSelection(cm.doc, word.from, word.to);
|
1518 |
+
}));
|
1519 |
+
else
|
1520 |
+
on(d.scroller, "dblclick", function(e) { signalDOMEvent(cm, e) || e_preventDefault(e); });
|
1521 |
+
on(d.lineSpace, "selectstart", function(e) {
|
1522 |
+
if (!eventInWidget(d, e)) e_preventDefault(e);
|
1523 |
+
});
|
1524 |
+
// Gecko browsers fire contextmenu *after* opening the menu, at
|
1525 |
+
// which point we can't mess with it anymore. Context menu is
|
1526 |
+
// handled in onMouseDown for Gecko.
|
1527 |
+
if (!captureMiddleClick) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
|
1528 |
+
|
1529 |
+
on(d.scroller, "scroll", function() {
|
1530 |
+
if (d.scroller.clientHeight) {
|
1531 |
+
setScrollTop(cm, d.scroller.scrollTop);
|
1532 |
+
setScrollLeft(cm, d.scroller.scrollLeft, true);
|
1533 |
+
signal(cm, "scroll", cm);
|
1534 |
+
}
|
1535 |
+
});
|
1536 |
+
on(d.scrollbarV, "scroll", function() {
|
1537 |
+
if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);
|
1538 |
+
});
|
1539 |
+
on(d.scrollbarH, "scroll", function() {
|
1540 |
+
if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);
|
1541 |
+
});
|
1542 |
+
|
1543 |
+
on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
|
1544 |
+
on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
|
1545 |
+
|
1546 |
+
function reFocus() { if (cm.state.focused) setTimeout(bind(focusInput, cm), 0); }
|
1547 |
+
on(d.scrollbarH, "mousedown", reFocus);
|
1548 |
+
on(d.scrollbarV, "mousedown", reFocus);
|
1549 |
+
// Prevent wrapper from ever scrolling
|
1550 |
+
on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
|
1551 |
+
|
1552 |
+
var resizeTimer;
|
1553 |
+
function onResize() {
|
1554 |
+
if (resizeTimer == null) resizeTimer = setTimeout(function() {
|
1555 |
+
resizeTimer = null;
|
1556 |
+
// Might be a text scaling operation, clear size caches.
|
1557 |
+
d.cachedCharWidth = d.cachedTextHeight = knownScrollbarWidth = null;
|
1558 |
+
clearCaches(cm);
|
1559 |
+
runInOp(cm, bind(regChange, cm));
|
1560 |
+
}, 100);
|
1561 |
+
}
|
1562 |
+
on(window, "resize", onResize);
|
1563 |
+
// Above handler holds on to the editor and its data structures.
|
1564 |
+
// Here we poll to unregister it when the editor is no longer in
|
1565 |
+
// the document, so that it can be garbage-collected.
|
1566 |
+
function unregister() {
|
1567 |
+
for (var p = d.wrapper.parentNode; p && p != document.body; p = p.parentNode) {}
|
1568 |
+
if (p) setTimeout(unregister, 5000);
|
1569 |
+
else off(window, "resize", onResize);
|
1570 |
+
}
|
1571 |
+
setTimeout(unregister, 5000);
|
1572 |
+
|
1573 |
+
on(d.input, "keyup", operation(cm, function(e) {
|
1574 |
+
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
1575 |
+
if (e.keyCode == 16) cm.doc.sel.shift = false;
|
1576 |
+
}));
|
1577 |
+
on(d.input, "input", bind(fastPoll, cm));
|
1578 |
+
on(d.input, "keydown", operation(cm, onKeyDown));
|
1579 |
+
on(d.input, "keypress", operation(cm, onKeyPress));
|
1580 |
+
on(d.input, "focus", bind(onFocus, cm));
|
1581 |
+
on(d.input, "blur", bind(onBlur, cm));
|
1582 |
+
|
1583 |
+
function drag_(e) {
|
1584 |
+
if (signalDOMEvent(cm, e) || cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
|
1585 |
+
e_stop(e);
|
1586 |
+
}
|
1587 |
+
if (cm.options.dragDrop) {
|
1588 |
+
on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
|
1589 |
+
on(d.scroller, "dragenter", drag_);
|
1590 |
+
on(d.scroller, "dragover", drag_);
|
1591 |
+
on(d.scroller, "drop", operation(cm, onDrop));
|
1592 |
+
}
|
1593 |
+
on(d.scroller, "paste", function(e){
|
1594 |
+
if (eventInWidget(d, e)) return;
|
1595 |
+
focusInput(cm);
|
1596 |
+
fastPoll(cm);
|
1597 |
+
});
|
1598 |
+
on(d.input, "paste", function() {
|
1599 |
+
cm.state.pasteIncoming = true;
|
1600 |
+
fastPoll(cm);
|
1601 |
+
});
|
1602 |
+
|
1603 |
+
function prepareCopy() {
|
1604 |
+
if (d.inaccurateSelection) {
|
1605 |
+
d.prevInput = "";
|
1606 |
+
d.inaccurateSelection = false;
|
1607 |
+
d.input.value = cm.getSelection();
|
1608 |
+
selectInput(d.input);
|
1609 |
+
}
|
1610 |
+
}
|
1611 |
+
on(d.input, "cut", prepareCopy);
|
1612 |
+
on(d.input, "copy", prepareCopy);
|
1613 |
+
|
1614 |
+
// Needed to handle Tab key in KHTML
|
1615 |
+
if (khtml) on(d.sizer, "mouseup", function() {
|
1616 |
+
if (document.activeElement == d.input) d.input.blur();
|
1617 |
+
focusInput(cm);
|
1618 |
+
});
|
1619 |
+
}
|
1620 |
+
|
1621 |
+
function eventInWidget(display, e) {
|
1622 |
+
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
1623 |
+
if (!n || n.ignoreEvents || n.parentNode == display.sizer && n != display.mover) return true;
|
1624 |
+
}
|
1625 |
+
}
|
1626 |
+
|
1627 |
+
function posFromMouse(cm, e, liberal) {
|
1628 |
+
var display = cm.display;
|
1629 |
+
if (!liberal) {
|
1630 |
+
var target = e_target(e);
|
1631 |
+
if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
|
1632 |
+
target == display.scrollbarV || target == display.scrollbarV.firstChild ||
|
1633 |
+
target == display.scrollbarFiller || target == display.gutterFiller) return null;
|
1634 |
+
}
|
1635 |
+
var x, y, space = getRect(display.lineSpace);
|
1636 |
+
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
1637 |
+
try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
|
1638 |
+
return coordsChar(cm, x - space.left, y - space.top);
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
var lastClick, lastDoubleClick;
|
1642 |
+
function onMouseDown(e) {
|
1643 |
+
if (signalDOMEvent(this, e)) return;
|
1644 |
+
var cm = this, display = cm.display, doc = cm.doc, sel = doc.sel;
|
1645 |
+
sel.shift = e.shiftKey;
|
1646 |
+
|
1647 |
+
if (eventInWidget(display, e)) {
|
1648 |
+
if (!webkit) {
|
1649 |
+
display.scroller.draggable = false;
|
1650 |
+
setTimeout(function(){display.scroller.draggable = true;}, 100);
|
1651 |
+
}
|
1652 |
+
return;
|
1653 |
+
}
|
1654 |
+
if (clickInGutter(cm, e)) return;
|
1655 |
+
var start = posFromMouse(cm, e);
|
1656 |
+
|
1657 |
+
switch (e_button(e)) {
|
1658 |
+
case 3:
|
1659 |
+
if (captureMiddleClick) onContextMenu.call(cm, cm, e);
|
1660 |
+
return;
|
1661 |
+
case 2:
|
1662 |
+
if (start) extendSelection(cm.doc, start);
|
1663 |
+
setTimeout(bind(focusInput, cm), 20);
|
1664 |
+
e_preventDefault(e);
|
1665 |
+
return;
|
1666 |
+
}
|
1667 |
+
// For button 1, if it was clicked inside the editor
|
1668 |
+
// (posFromMouse returning non-null), we have to adjust the
|
1669 |
+
// selection.
|
1670 |
+
if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
|
1671 |
+
|
1672 |
+
if (!cm.state.focused) onFocus(cm);
|
1673 |
+
|
1674 |
+
var now = +new Date, type = "single";
|
1675 |
+
if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
|
1676 |
+
type = "triple";
|
1677 |
+
e_preventDefault(e);
|
1678 |
+
setTimeout(bind(focusInput, cm), 20);
|
1679 |
+
selectLine(cm, start.line);
|
1680 |
+
} else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
|
1681 |
+
type = "double";
|
1682 |
+
lastDoubleClick = {time: now, pos: start};
|
1683 |
+
e_preventDefault(e);
|
1684 |
+
var word = findWordAt(getLine(doc, start.line).text, start);
|
1685 |
+
extendSelection(cm.doc, word.from, word.to);
|
1686 |
+
} else { lastClick = {time: now, pos: start}; }
|
1687 |
+
|
1688 |
+
var last = start;
|
1689 |
+
if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
|
1690 |
+
!posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
|
1691 |
+
var dragEnd = operation(cm, function(e2) {
|
1692 |
+
if (webkit) display.scroller.draggable = false;
|
1693 |
+
cm.state.draggingText = false;
|
1694 |
+
off(document, "mouseup", dragEnd);
|
1695 |
+
off(display.scroller, "drop", dragEnd);
|
1696 |
+
if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
|
1697 |
+
e_preventDefault(e2);
|
1698 |
+
extendSelection(cm.doc, start);
|
1699 |
+
focusInput(cm);
|
1700 |
+
}
|
1701 |
+
});
|
1702 |
+
// Let the drag handler handle this.
|
1703 |
+
if (webkit) display.scroller.draggable = true;
|
1704 |
+
cm.state.draggingText = dragEnd;
|
1705 |
+
// IE's approach to draggable
|
1706 |
+
if (display.scroller.dragDrop) display.scroller.dragDrop();
|
1707 |
+
on(document, "mouseup", dragEnd);
|
1708 |
+
on(display.scroller, "drop", dragEnd);
|
1709 |
+
return;
|
1710 |
+
}
|
1711 |
+
e_preventDefault(e);
|
1712 |
+
if (type == "single") extendSelection(cm.doc, clipPos(doc, start));
|
1713 |
+
|
1714 |
+
var startstart = sel.from, startend = sel.to, lastPos = start;
|
1715 |
+
|
1716 |
+
function doSelect(cur) {
|
1717 |
+
if (posEq(lastPos, cur)) return;
|
1718 |
+
lastPos = cur;
|
1719 |
+
|
1720 |
+
if (type == "single") {
|
1721 |
+
extendSelection(cm.doc, clipPos(doc, start), cur);
|
1722 |
+
return;
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
startstart = clipPos(doc, startstart);
|
1726 |
+
startend = clipPos(doc, startend);
|
1727 |
+
if (type == "double") {
|
1728 |
+
var word = findWordAt(getLine(doc, cur.line).text, cur);
|
1729 |
+
if (posLess(cur, startstart)) extendSelection(cm.doc, word.from, startend);
|
1730 |
+
else extendSelection(cm.doc, startstart, word.to);
|
1731 |
+
} else if (type == "triple") {
|
1732 |
+
if (posLess(cur, startstart)) extendSelection(cm.doc, startend, clipPos(doc, Pos(cur.line, 0)));
|
1733 |
+
else extendSelection(cm.doc, startstart, clipPos(doc, Pos(cur.line + 1, 0)));
|
1734 |
+
}
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
var editorSize = getRect(display.wrapper);
|
1738 |
+
// Used to ensure timeout re-tries don't fire when another extend
|
1739 |
+
// happened in the meantime (clearTimeout isn't reliable -- at
|
1740 |
+
// least on Chrome, the timeouts still happen even when cleared,
|
1741 |
+
// if the clear happens after their scheduled firing time).
|
1742 |
+
var counter = 0;
|
1743 |
+
|
1744 |
+
function extend(e) {
|
1745 |
+
var curCount = ++counter;
|
1746 |
+
var cur = posFromMouse(cm, e, true);
|
1747 |
+
if (!cur) return;
|
1748 |
+
if (!posEq(cur, last)) {
|
1749 |
+
if (!cm.state.focused) onFocus(cm);
|
1750 |
+
last = cur;
|
1751 |
+
doSelect(cur);
|
1752 |
+
var visible = visibleLines(display, doc);
|
1753 |
+
if (cur.line >= visible.to || cur.line < visible.from)
|
1754 |
+
setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
|
1755 |
+
} else {
|
1756 |
+
var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
|
1757 |
+
if (outside) setTimeout(operation(cm, function() {
|
1758 |
+
if (counter != curCount) return;
|
1759 |
+
display.scroller.scrollTop += outside;
|
1760 |
+
extend(e);
|
1761 |
+
}), 50);
|
1762 |
+
}
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
function done(e) {
|
1766 |
+
counter = Infinity;
|
1767 |
+
e_preventDefault(e);
|
1768 |
+
focusInput(cm);
|
1769 |
+
off(document, "mousemove", move);
|
1770 |
+
off(document, "mouseup", up);
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
var move = operation(cm, function(e) {
|
1774 |
+
if (!ie && !e_button(e)) done(e);
|
1775 |
+
else extend(e);
|
1776 |
+
});
|
1777 |
+
var up = operation(cm, done);
|
1778 |
+
on(document, "mousemove", move);
|
1779 |
+
on(document, "mouseup", up);
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
function clickInGutter(cm, e) {
|
1783 |
+
var display = cm.display;
|
1784 |
+
try { var mX = e.clientX, mY = e.clientY; }
|
1785 |
+
catch(e) { return false; }
|
1786 |
+
|
1787 |
+
if (mX >= Math.floor(getRect(display.gutters).right)) return false;
|
1788 |
+
e_preventDefault(e);
|
1789 |
+
if (!hasHandler(cm, "gutterClick")) return true;
|
1790 |
+
|
1791 |
+
var lineBox = getRect(display.lineDiv);
|
1792 |
+
if (mY > lineBox.bottom) return true;
|
1793 |
+
mY -= lineBox.top - display.viewOffset;
|
1794 |
+
|
1795 |
+
for (var i = 0; i < cm.options.gutters.length; ++i) {
|
1796 |
+
var g = display.gutters.childNodes[i];
|
1797 |
+
if (g && getRect(g).right >= mX) {
|
1798 |
+
var line = lineAtHeight(cm.doc, mY);
|
1799 |
+
var gutter = cm.options.gutters[i];
|
1800 |
+
signalLater(cm, "gutterClick", cm, line, gutter, e);
|
1801 |
+
break;
|
1802 |
+
}
|
1803 |
+
}
|
1804 |
+
return true;
|
1805 |
+
}
|
1806 |
+
|
1807 |
+
// Kludge to work around strange IE behavior where it'll sometimes
|
1808 |
+
// re-fire a series of drag-related events right after the drop (#1551)
|
1809 |
+
var lastDrop = 0;
|
1810 |
+
|
1811 |
+
function onDrop(e) {
|
1812 |
+
var cm = this;
|
1813 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e) || (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))))
|
1814 |
+
return;
|
1815 |
+
e_preventDefault(e);
|
1816 |
+
if (ie) lastDrop = +new Date;
|
1817 |
+
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
|
1818 |
+
if (!pos || isReadOnly(cm)) return;
|
1819 |
+
if (files && files.length && window.FileReader && window.File) {
|
1820 |
+
var n = files.length, text = Array(n), read = 0;
|
1821 |
+
var loadFile = function(file, i) {
|
1822 |
+
var reader = new FileReader;
|
1823 |
+
reader.onload = function() {
|
1824 |
+
text[i] = reader.result;
|
1825 |
+
if (++read == n) {
|
1826 |
+
pos = clipPos(cm.doc, pos);
|
1827 |
+
makeChange(cm.doc, {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"}, "around");
|
1828 |
+
}
|
1829 |
+
};
|
1830 |
+
reader.readAsText(file);
|
1831 |
+
};
|
1832 |
+
for (var i = 0; i < n; ++i) loadFile(files[i], i);
|
1833 |
+
} else {
|
1834 |
+
// Don't do a replace if the drop happened inside of the selected text.
|
1835 |
+
if (cm.state.draggingText && !(posLess(pos, cm.doc.sel.from) || posLess(cm.doc.sel.to, pos))) {
|
1836 |
+
cm.state.draggingText(e);
|
1837 |
+
// Ensure the editor is re-focused
|
1838 |
+
setTimeout(bind(focusInput, cm), 20);
|
1839 |
+
return;
|
1840 |
+
}
|
1841 |
+
try {
|
1842 |
+
var text = e.dataTransfer.getData("Text");
|
1843 |
+
if (text) {
|
1844 |
+
var curFrom = cm.doc.sel.from, curTo = cm.doc.sel.to;
|
1845 |
+
setSelection(cm.doc, pos, pos);
|
1846 |
+
if (cm.state.draggingText) replaceRange(cm.doc, "", curFrom, curTo, "paste");
|
1847 |
+
cm.replaceSelection(text, null, "paste");
|
1848 |
+
focusInput(cm);
|
1849 |
+
onFocus(cm);
|
1850 |
+
}
|
1851 |
+
}
|
1852 |
+
catch(e){}
|
1853 |
+
}
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
function onDragStart(cm, e) {
|
1857 |
+
if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return; }
|
1858 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return;
|
1859 |
+
|
1860 |
+
var txt = cm.getSelection();
|
1861 |
+
e.dataTransfer.setData("Text", txt);
|
1862 |
+
|
1863 |
+
// Use dummy image instead of default browsers image.
|
1864 |
+
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
|
1865 |
+
if (e.dataTransfer.setDragImage && !safari) {
|
1866 |
+
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
|
1867 |
+
if (opera) {
|
1868 |
+
img.width = img.height = 1;
|
1869 |
+
cm.display.wrapper.appendChild(img);
|
1870 |
+
// Force a relayout, or Opera won't use our image for some obscure reason
|
1871 |
+
img._top = img.offsetTop;
|
1872 |
+
}
|
1873 |
+
e.dataTransfer.setDragImage(img, 0, 0);
|
1874 |
+
if (opera) img.parentNode.removeChild(img);
|
1875 |
+
}
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
function setScrollTop(cm, val) {
|
1879 |
+
if (Math.abs(cm.doc.scrollTop - val) < 2) return;
|
1880 |
+
cm.doc.scrollTop = val;
|
1881 |
+
if (!gecko) updateDisplay(cm, [], val);
|
1882 |
+
if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
|
1883 |
+
if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
|
1884 |
+
if (gecko) updateDisplay(cm, []);
|
1885 |
+
startWorker(cm, 100);
|
1886 |
+
}
|
1887 |
+
function setScrollLeft(cm, val, isScroller) {
|
1888 |
+
if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) return;
|
1889 |
+
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
|
1890 |
+
cm.doc.scrollLeft = val;
|
1891 |
+
alignHorizontally(cm);
|
1892 |
+
if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
|
1893 |
+
if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
// Since the delta values reported on mouse wheel events are
|
1897 |
+
// unstandardized between browsers and even browser versions, and
|
1898 |
+
// generally horribly unpredictable, this code starts by measuring
|
1899 |
+
// the scroll effect that the first few mouse wheel events have,
|
1900 |
+
// and, from that, detects the way it can convert deltas to pixel
|
1901 |
+
// offsets afterwards.
|
1902 |
+
//
|
1903 |
+
// The reason we want to know the amount a wheel event will scroll
|
1904 |
+
// is that it gives us a chance to update the display before the
|
1905 |
+
// actual scrolling happens, reducing flickering.
|
1906 |
+
|
1907 |
+
var wheelSamples = 0, wheelPixelsPerUnit = null;
|
1908 |
+
// Fill in a browser-detected starting value on browsers where we
|
1909 |
+
// know one. These don't have to be accurate -- the result of them
|
1910 |
+
// being wrong would just be a slight flicker on the first wheel
|
1911 |
+
// scroll (if it is large enough).
|
1912 |
+
if (ie) wheelPixelsPerUnit = -.53;
|
1913 |
+
else if (gecko) wheelPixelsPerUnit = 15;
|
1914 |
+
else if (chrome) wheelPixelsPerUnit = -.7;
|
1915 |
+
else if (safari) wheelPixelsPerUnit = -1/3;
|
1916 |
+
|
1917 |
+
function onScrollWheel(cm, e) {
|
1918 |
+
var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
|
1919 |
+
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
|
1920 |
+
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
|
1921 |
+
else if (dy == null) dy = e.wheelDelta;
|
1922 |
+
|
1923 |
+
var display = cm.display, scroll = display.scroller;
|
1924 |
+
// Quit if there's nothing to scroll here
|
1925 |
+
if (!(dx && scroll.scrollWidth > scroll.clientWidth ||
|
1926 |
+
dy && scroll.scrollHeight > scroll.clientHeight)) return;
|
1927 |
+
|
1928 |
+
// Webkit browsers on OS X abort momentum scrolls when the target
|
1929 |
+
// of the scroll event is removed from the scrollable element.
|
1930 |
+
// This hack (see related code in patchDisplay) makes sure the
|
1931 |
+
// element is kept around.
|
1932 |
+
if (dy && mac && webkit) {
|
1933 |
+
for (var cur = e.target; cur != scroll; cur = cur.parentNode) {
|
1934 |
+
if (cur.lineObj) {
|
1935 |
+
cm.display.currentWheelTarget = cur;
|
1936 |
+
break;
|
1937 |
+
}
|
1938 |
+
}
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
// On some browsers, horizontal scrolling will cause redraws to
|
1942 |
+
// happen before the gutter has been realigned, causing it to
|
1943 |
+
// wriggle around in a most unseemly way. When we have an
|
1944 |
+
// estimated pixels/delta value, we just handle horizontal
|
1945 |
+
// scrolling entirely here. It'll be slightly off from native, but
|
1946 |
+
// better than glitching out.
|
1947 |
+
if (dx && !gecko && !opera && wheelPixelsPerUnit != null) {
|
1948 |
+
if (dy)
|
1949 |
+
setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
|
1950 |
+
setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
|
1951 |
+
e_preventDefault(e);
|
1952 |
+
display.wheelStartX = null; // Abort measurement, if in progress
|
1953 |
+
return;
|
1954 |
+
}
|
1955 |
+
|
1956 |
+
if (dy && wheelPixelsPerUnit != null) {
|
1957 |
+
var pixels = dy * wheelPixelsPerUnit;
|
1958 |
+
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
|
1959 |
+
if (pixels < 0) top = Math.max(0, top + pixels - 50);
|
1960 |
+
else bot = Math.min(cm.doc.height, bot + pixels + 50);
|
1961 |
+
updateDisplay(cm, [], {top: top, bottom: bot});
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
if (wheelSamples < 20) {
|
1965 |
+
if (display.wheelStartX == null) {
|
1966 |
+
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
|
1967 |
+
display.wheelDX = dx; display.wheelDY = dy;
|
1968 |
+
setTimeout(function() {
|
1969 |
+
if (display.wheelStartX == null) return;
|
1970 |
+
var movedX = scroll.scrollLeft - display.wheelStartX;
|
1971 |
+
var movedY = scroll.scrollTop - display.wheelStartY;
|
1972 |
+
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
1973 |
+
(movedX && display.wheelDX && movedX / display.wheelDX);
|
1974 |
+
display.wheelStartX = display.wheelStartY = null;
|
1975 |
+
if (!sample) return;
|
1976 |
+
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
|
1977 |
+
++wheelSamples;
|
1978 |
+
}, 200);
|
1979 |
+
} else {
|
1980 |
+
display.wheelDX += dx; display.wheelDY += dy;
|
1981 |
+
}
|
1982 |
+
}
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
function doHandleBinding(cm, bound, dropShift) {
|
1986 |
+
if (typeof bound == "string") {
|
1987 |
+
bound = commands[bound];
|
1988 |
+
if (!bound) return false;
|
1989 |
+
}
|
1990 |
+
// Ensure previous input has been read, so that the handler sees a
|
1991 |
+
// consistent view of the document
|
1992 |
+
if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
|
1993 |
+
var doc = cm.doc, prevShift = doc.sel.shift, done = false;
|
1994 |
+
try {
|
1995 |
+
if (isReadOnly(cm)) cm.state.suppressEdits = true;
|
1996 |
+
if (dropShift) doc.sel.shift = false;
|
1997 |
+
done = bound(cm) != Pass;
|
1998 |
+
} finally {
|
1999 |
+
doc.sel.shift = prevShift;
|
2000 |
+
cm.state.suppressEdits = false;
|
2001 |
+
}
|
2002 |
+
return done;
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
function allKeyMaps(cm) {
|
2006 |
+
var maps = cm.state.keyMaps.slice(0);
|
2007 |
+
if (cm.options.extraKeys) maps.push(cm.options.extraKeys);
|
2008 |
+
maps.push(cm.options.keyMap);
|
2009 |
+
return maps;
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
var maybeTransition;
|
2013 |
+
function handleKeyBinding(cm, e) {
|
2014 |
+
// Handle auto keymap transitions
|
2015 |
+
var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
|
2016 |
+
clearTimeout(maybeTransition);
|
2017 |
+
if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
|
2018 |
+
if (getKeyMap(cm.options.keyMap) == startMap) {
|
2019 |
+
cm.options.keyMap = (next.call ? next.call(null, cm) : next);
|
2020 |
+
keyMapChanged(cm);
|
2021 |
+
}
|
2022 |
+
}, 50);
|
2023 |
+
|
2024 |
+
var name = keyName(e, true), handled = false;
|
2025 |
+
if (!name) return false;
|
2026 |
+
var keymaps = allKeyMaps(cm);
|
2027 |
+
|
2028 |
+
if (e.shiftKey) {
|
2029 |
+
// First try to resolve full name (including 'Shift-'). Failing
|
2030 |
+
// that, see if there is a cursor-motion command (starting with
|
2031 |
+
// 'go') bound to the keyname without 'Shift-'.
|
2032 |
+
handled = lookupKey("Shift-" + name, keymaps, function(b) {return doHandleBinding(cm, b, true);})
|
2033 |
+
|| lookupKey(name, keymaps, function(b) {
|
2034 |
+
if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
|
2035 |
+
return doHandleBinding(cm, b);
|
2036 |
+
});
|
2037 |
+
} else {
|
2038 |
+
handled = lookupKey(name, keymaps, function(b) { return doHandleBinding(cm, b); });
|
2039 |
+
}
|
2040 |
+
|
2041 |
+
if (handled) {
|
2042 |
+
e_preventDefault(e);
|
2043 |
+
restartBlink(cm);
|
2044 |
+
if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
|
2045 |
+
signalLater(cm, "keyHandled", cm, name, e);
|
2046 |
+
}
|
2047 |
+
return handled;
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
function handleCharBinding(cm, e, ch) {
|
2051 |
+
var handled = lookupKey("'" + ch + "'", allKeyMaps(cm),
|
2052 |
+
function(b) { return doHandleBinding(cm, b, true); });
|
2053 |
+
if (handled) {
|
2054 |
+
e_preventDefault(e);
|
2055 |
+
restartBlink(cm);
|
2056 |
+
signalLater(cm, "keyHandled", cm, "'" + ch + "'", e);
|
2057 |
+
}
|
2058 |
+
return handled;
|
2059 |
+
}
|
2060 |
+
|
2061 |
+
var lastStoppedKey = null;
|
2062 |
+
function onKeyDown(e) {
|
2063 |
+
var cm = this;
|
2064 |
+
if (!cm.state.focused) onFocus(cm);
|
2065 |
+
if (ie && e.keyCode == 27) { e.returnValue = false; }
|
2066 |
+
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
2067 |
+
var code = e.keyCode;
|
2068 |
+
// IE does strange things with escape.
|
2069 |
+
cm.doc.sel.shift = code == 16 || e.shiftKey;
|
2070 |
+
// First give onKeyEvent option a chance to handle this.
|
2071 |
+
var handled = handleKeyBinding(cm, e);
|
2072 |
+
if (opera) {
|
2073 |
+
lastStoppedKey = handled ? code : null;
|
2074 |
+
// Opera has no cut event... we try to at least catch the key combo
|
2075 |
+
if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
|
2076 |
+
cm.replaceSelection("");
|
2077 |
+
}
|
2078 |
+
}
|
2079 |
+
|
2080 |
+
function onKeyPress(e) {
|
2081 |
+
var cm = this;
|
2082 |
+
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
2083 |
+
var keyCode = e.keyCode, charCode = e.charCode;
|
2084 |
+
if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
|
2085 |
+
if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
|
2086 |
+
var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
|
2087 |
+
if (this.options.electricChars && this.doc.mode.electricChars &&
|
2088 |
+
this.options.smartIndent && !isReadOnly(this) &&
|
2089 |
+
this.doc.mode.electricChars.indexOf(ch) > -1)
|
2090 |
+
setTimeout(operation(cm, function() {indentLine(cm, cm.doc.sel.to.line, "smart");}), 75);
|
2091 |
+
if (handleCharBinding(cm, e, ch)) return;
|
2092 |
+
if (ie && !ie_lt9) cm.display.inputHasSelection = null;
|
2093 |
+
fastPoll(cm);
|
2094 |
+
}
|
2095 |
+
|
2096 |
+
function onFocus(cm) {
|
2097 |
+
if (cm.options.readOnly == "nocursor") return;
|
2098 |
+
if (!cm.state.focused) {
|
2099 |
+
signal(cm, "focus", cm);
|
2100 |
+
cm.state.focused = true;
|
2101 |
+
if (cm.display.wrapper.className.search(/\bCodeMirror-focused\b/) == -1)
|
2102 |
+
cm.display.wrapper.className += " CodeMirror-focused";
|
2103 |
+
resetInput(cm, true);
|
2104 |
+
}
|
2105 |
+
slowPoll(cm);
|
2106 |
+
restartBlink(cm);
|
2107 |
+
}
|
2108 |
+
function onBlur(cm) {
|
2109 |
+
if (cm.state.focused) {
|
2110 |
+
signal(cm, "blur", cm);
|
2111 |
+
cm.state.focused = false;
|
2112 |
+
cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-focused", "");
|
2113 |
+
}
|
2114 |
+
clearInterval(cm.display.blinker);
|
2115 |
+
setTimeout(function() {if (!cm.state.focused) cm.doc.sel.shift = false;}, 150);
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
var detectingSelectAll;
|
2119 |
+
function onContextMenu(cm, e) {
|
2120 |
+
if (signalDOMEvent(cm, e, "contextmenu")) return;
|
2121 |
+
var display = cm.display, sel = cm.doc.sel;
|
2122 |
+
if (eventInWidget(display, e)) return;
|
2123 |
+
|
2124 |
+
var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
|
2125 |
+
if (!pos || opera) return; // Opera is difficult.
|
2126 |
+
if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
|
2127 |
+
operation(cm, setSelection)(cm.doc, pos, pos);
|
2128 |
+
|
2129 |
+
var oldCSS = display.input.style.cssText;
|
2130 |
+
display.inputDiv.style.position = "absolute";
|
2131 |
+
display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
|
2132 |
+
"px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; outline: none;" +
|
2133 |
+
"border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);";
|
2134 |
+
focusInput(cm);
|
2135 |
+
resetInput(cm, true);
|
2136 |
+
// Adds "Select all" to context menu in FF
|
2137 |
+
if (posEq(sel.from, sel.to)) display.input.value = display.prevInput = " ";
|
2138 |
+
|
2139 |
+
function prepareSelectAllHack() {
|
2140 |
+
if (display.input.selectionStart != null) {
|
2141 |
+
var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value);
|
2142 |
+
display.prevInput = " ";
|
2143 |
+
display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
|
2144 |
+
}
|
2145 |
+
}
|
2146 |
+
function rehide() {
|
2147 |
+
display.inputDiv.style.position = "relative";
|
2148 |
+
display.input.style.cssText = oldCSS;
|
2149 |
+
if (ie_lt9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
|
2150 |
+
slowPoll(cm);
|
2151 |
+
|
2152 |
+
// Try to detect the user choosing select-all
|
2153 |
+
if (display.input.selectionStart != null) {
|
2154 |
+
if (!ie || ie_lt9) prepareSelectAllHack();
|
2155 |
+
clearTimeout(detectingSelectAll);
|
2156 |
+
var i = 0, poll = function(){
|
2157 |
+
if (display.prevInput == " " && display.input.selectionStart == 0)
|
2158 |
+
operation(cm, commands.selectAll)(cm);
|
2159 |
+
else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500);
|
2160 |
+
else resetInput(cm);
|
2161 |
+
};
|
2162 |
+
detectingSelectAll = setTimeout(poll, 200);
|
2163 |
+
}
|
2164 |
+
}
|
2165 |
+
|
2166 |
+
if (ie && !ie_lt9) prepareSelectAllHack();
|
2167 |
+
if (captureMiddleClick) {
|
2168 |
+
e_stop(e);
|
2169 |
+
var mouseup = function() {
|
2170 |
+
off(window, "mouseup", mouseup);
|
2171 |
+
setTimeout(rehide, 20);
|
2172 |
+
};
|
2173 |
+
on(window, "mouseup", mouseup);
|
2174 |
+
} else {
|
2175 |
+
setTimeout(rehide, 50);
|
2176 |
+
}
|
2177 |
+
}
|
2178 |
+
|
2179 |
+
// UPDATING
|
2180 |
+
|
2181 |
+
var changeEnd = CodeMirror.changeEnd = function(change) {
|
2182 |
+
if (!change.text) return change.to;
|
2183 |
+
return Pos(change.from.line + change.text.length - 1,
|
2184 |
+
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
|
2185 |
+
};
|
2186 |
+
|
2187 |
+
// Make sure a position will be valid after the given change.
|
2188 |
+
function clipPostChange(doc, change, pos) {
|
2189 |
+
if (!posLess(change.from, pos)) return clipPos(doc, pos);
|
2190 |
+
var diff = (change.text.length - 1) - (change.to.line - change.from.line);
|
2191 |
+
if (pos.line > change.to.line + diff) {
|
2192 |
+
var preLine = pos.line - diff, lastLine = doc.first + doc.size - 1;
|
2193 |
+
if (preLine > lastLine) return Pos(lastLine, getLine(doc, lastLine).text.length);
|
2194 |
+
return clipToLen(pos, getLine(doc, preLine).text.length);
|
2195 |
+
}
|
2196 |
+
if (pos.line == change.to.line + diff)
|
2197 |
+
return clipToLen(pos, lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0) +
|
2198 |
+
getLine(doc, change.to.line).text.length - change.to.ch);
|
2199 |
+
var inside = pos.line - change.from.line;
|
2200 |
+
return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));
|
2201 |
+
}
|
2202 |
+
|
2203 |
+
// Hint can be null|"end"|"start"|"around"|{anchor,head}
|
2204 |
+
function computeSelAfterChange(doc, change, hint) {
|
2205 |
+
if (hint && typeof hint == "object") // Assumed to be {anchor, head} object
|
2206 |
+
return {anchor: clipPostChange(doc, change, hint.anchor),
|
2207 |
+
head: clipPostChange(doc, change, hint.head)};
|
2208 |
+
|
2209 |
+
if (hint == "start") return {anchor: change.from, head: change.from};
|
2210 |
+
|
2211 |
+
var end = changeEnd(change);
|
2212 |
+
if (hint == "around") return {anchor: change.from, head: end};
|
2213 |
+
if (hint == "end") return {anchor: end, head: end};
|
2214 |
+
|
2215 |
+
// hint is null, leave the selection alone as much as possible
|
2216 |
+
var adjustPos = function(pos) {
|
2217 |
+
if (posLess(pos, change.from)) return pos;
|
2218 |
+
if (!posLess(change.to, pos)) return end;
|
2219 |
+
|
2220 |
+
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
|
2221 |
+
if (pos.line == change.to.line) ch += end.ch - change.to.ch;
|
2222 |
+
return Pos(line, ch);
|
2223 |
+
};
|
2224 |
+
return {anchor: adjustPos(doc.sel.anchor), head: adjustPos(doc.sel.head)};
|
2225 |
+
}
|
2226 |
+
|
2227 |
+
function filterChange(doc, change, update) {
|
2228 |
+
var obj = {
|
2229 |
+
canceled: false,
|
2230 |
+
from: change.from,
|
2231 |
+
to: change.to,
|
2232 |
+
text: change.text,
|
2233 |
+
origin: change.origin,
|
2234 |
+
cancel: function() { this.canceled = true; }
|
2235 |
+
};
|
2236 |
+
if (update) obj.update = function(from, to, text, origin) {
|
2237 |
+
if (from) this.from = clipPos(doc, from);
|
2238 |
+
if (to) this.to = clipPos(doc, to);
|
2239 |
+
if (text) this.text = text;
|
2240 |
+
if (origin !== undefined) this.origin = origin;
|
2241 |
+
};
|
2242 |
+
signal(doc, "beforeChange", doc, obj);
|
2243 |
+
if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj);
|
2244 |
+
|
2245 |
+
if (obj.canceled) return null;
|
2246 |
+
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
|
2247 |
+
}
|
2248 |
+
|
2249 |
+
// Replace the range from from to to by the strings in replacement.
|
2250 |
+
// change is a {from, to, text [, origin]} object
|
2251 |
+
function makeChange(doc, change, selUpdate, ignoreReadOnly) {
|
2252 |
+
if (doc.cm) {
|
2253 |
+
if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, selUpdate, ignoreReadOnly);
|
2254 |
+
if (doc.cm.state.suppressEdits) return;
|
2255 |
+
}
|
2256 |
+
|
2257 |
+
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
2258 |
+
change = filterChange(doc, change, true);
|
2259 |
+
if (!change) return;
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
// Possibly split or suppress the update based on the presence
|
2263 |
+
// of read-only spans in its range.
|
2264 |
+
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
|
2265 |
+
if (split) {
|
2266 |
+
for (var i = split.length - 1; i >= 1; --i)
|
2267 |
+
makeChangeNoReadonly(doc, {from: split[i].from, to: split[i].to, text: [""]});
|
2268 |
+
if (split.length)
|
2269 |
+
makeChangeNoReadonly(doc, {from: split[0].from, to: split[0].to, text: change.text}, selUpdate);
|
2270 |
+
} else {
|
2271 |
+
makeChangeNoReadonly(doc, change, selUpdate);
|
2272 |
+
}
|
2273 |
+
}
|
2274 |
+
|
2275 |
+
function makeChangeNoReadonly(doc, change, selUpdate) {
|
2276 |
+
var selAfter = computeSelAfterChange(doc, change, selUpdate);
|
2277 |
+
addToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
|
2278 |
+
|
2279 |
+
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
|
2280 |
+
var rebased = [];
|
2281 |
+
|
2282 |
+
linkedDocs(doc, function(doc, sharedHist) {
|
2283 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
2284 |
+
rebaseHist(doc.history, change);
|
2285 |
+
rebased.push(doc.history);
|
2286 |
+
}
|
2287 |
+
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
|
2288 |
+
});
|
2289 |
+
}
|
2290 |
+
|
2291 |
+
function makeChangeFromHistory(doc, type) {
|
2292 |
+
if (doc.cm && doc.cm.state.suppressEdits) return;
|
2293 |
+
|
2294 |
+
var hist = doc.history;
|
2295 |
+
var event = (type == "undo" ? hist.done : hist.undone).pop();
|
2296 |
+
if (!event) return;
|
2297 |
+
|
2298 |
+
var anti = {changes: [], anchorBefore: event.anchorAfter, headBefore: event.headAfter,
|
2299 |
+
anchorAfter: event.anchorBefore, headAfter: event.headBefore,
|
2300 |
+
generation: hist.generation};
|
2301 |
+
(type == "undo" ? hist.undone : hist.done).push(anti);
|
2302 |
+
hist.generation = event.generation || ++hist.maxGeneration;
|
2303 |
+
|
2304 |
+
var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
|
2305 |
+
|
2306 |
+
for (var i = event.changes.length - 1; i >= 0; --i) {
|
2307 |
+
var change = event.changes[i];
|
2308 |
+
change.origin = type;
|
2309 |
+
if (filter && !filterChange(doc, change, false)) {
|
2310 |
+
(type == "undo" ? hist.done : hist.undone).length = 0;
|
2311 |
+
return;
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
anti.changes.push(historyChangeFromChange(doc, change));
|
2315 |
+
|
2316 |
+
var after = i ? computeSelAfterChange(doc, change, null)
|
2317 |
+
: {anchor: event.anchorBefore, head: event.headBefore};
|
2318 |
+
makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
|
2319 |
+
var rebased = [];
|
2320 |
+
|
2321 |
+
linkedDocs(doc, function(doc, sharedHist) {
|
2322 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
2323 |
+
rebaseHist(doc.history, change);
|
2324 |
+
rebased.push(doc.history);
|
2325 |
+
}
|
2326 |
+
makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
|
2327 |
+
});
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
function shiftDoc(doc, distance) {
|
2332 |
+
function shiftPos(pos) {return Pos(pos.line + distance, pos.ch);}
|
2333 |
+
doc.first += distance;
|
2334 |
+
if (doc.cm) regChange(doc.cm, doc.first, doc.first, distance);
|
2335 |
+
doc.sel.head = shiftPos(doc.sel.head); doc.sel.anchor = shiftPos(doc.sel.anchor);
|
2336 |
+
doc.sel.from = shiftPos(doc.sel.from); doc.sel.to = shiftPos(doc.sel.to);
|
2337 |
+
}
|
2338 |
+
|
2339 |
+
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
2340 |
+
if (doc.cm && !doc.cm.curOp)
|
2341 |
+
return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans);
|
2342 |
+
|
2343 |
+
if (change.to.line < doc.first) {
|
2344 |
+
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
|
2345 |
+
return;
|
2346 |
+
}
|
2347 |
+
if (change.from.line > doc.lastLine()) return;
|
2348 |
+
|
2349 |
+
// Clip the change to the size of this doc
|
2350 |
+
if (change.from.line < doc.first) {
|
2351 |
+
var shift = change.text.length - 1 - (doc.first - change.from.line);
|
2352 |
+
shiftDoc(doc, shift);
|
2353 |
+
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
2354 |
+
text: [lst(change.text)], origin: change.origin};
|
2355 |
+
}
|
2356 |
+
var last = doc.lastLine();
|
2357 |
+
if (change.to.line > last) {
|
2358 |
+
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
2359 |
+
text: [change.text[0]], origin: change.origin};
|
2360 |
+
}
|
2361 |
+
|
2362 |
+
change.removed = getBetween(doc, change.from, change.to);
|
2363 |
+
|
2364 |
+
if (!selAfter) selAfter = computeSelAfterChange(doc, change, null);
|
2365 |
+
if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans, selAfter);
|
2366 |
+
else updateDoc(doc, change, spans, selAfter);
|
2367 |
+
}
|
2368 |
+
|
2369 |
+
function makeChangeSingleDocInEditor(cm, change, spans, selAfter) {
|
2370 |
+
var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
|
2371 |
+
|
2372 |
+
var recomputeMaxLength = false, checkWidthStart = from.line;
|
2373 |
+
if (!cm.options.lineWrapping) {
|
2374 |
+
checkWidthStart = lineNo(visualLine(doc, getLine(doc, from.line)));
|
2375 |
+
doc.iter(checkWidthStart, to.line + 1, function(line) {
|
2376 |
+
if (line == display.maxLine) {
|
2377 |
+
recomputeMaxLength = true;
|
2378 |
+
return true;
|
2379 |
+
}
|
2380 |
+
});
|
2381 |
+
}
|
2382 |
+
|
2383 |
+
if (!posLess(doc.sel.head, change.from) && !posLess(change.to, doc.sel.head))
|
2384 |
+
cm.curOp.cursorActivity = true;
|
2385 |
+
|
2386 |
+
updateDoc(doc, change, spans, selAfter, estimateHeight(cm));
|
2387 |
+
|
2388 |
+
if (!cm.options.lineWrapping) {
|
2389 |
+
doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
|
2390 |
+
var len = lineLength(doc, line);
|
2391 |
+
if (len > display.maxLineLength) {
|
2392 |
+
display.maxLine = line;
|
2393 |
+
display.maxLineLength = len;
|
2394 |
+
display.maxLineChanged = true;
|
2395 |
+
recomputeMaxLength = false;
|
2396 |
+
}
|
2397 |
+
});
|
2398 |
+
if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
|
2399 |
+
}
|
2400 |
+
|
2401 |
+
// Adjust frontier, schedule worker
|
2402 |
+
doc.frontier = Math.min(doc.frontier, from.line);
|
2403 |
+
startWorker(cm, 400);
|
2404 |
+
|
2405 |
+
var lendiff = change.text.length - (to.line - from.line) - 1;
|
2406 |
+
// Remember that these lines changed, for updating the display
|
2407 |
+
regChange(cm, from.line, to.line + 1, lendiff);
|
2408 |
+
|
2409 |
+
if (hasHandler(cm, "change")) {
|
2410 |
+
var changeObj = {from: from, to: to,
|
2411 |
+
text: change.text,
|
2412 |
+
removed: change.removed,
|
2413 |
+
origin: change.origin};
|
2414 |
+
if (cm.curOp.textChanged) {
|
2415 |
+
for (var cur = cm.curOp.textChanged; cur.next; cur = cur.next) {}
|
2416 |
+
cur.next = changeObj;
|
2417 |
+
} else cm.curOp.textChanged = changeObj;
|
2418 |
+
}
|
2419 |
+
}
|
2420 |
+
|
2421 |
+
function replaceRange(doc, code, from, to, origin) {
|
2422 |
+
if (!to) to = from;
|
2423 |
+
if (posLess(to, from)) { var tmp = to; to = from; from = tmp; }
|
2424 |
+
if (typeof code == "string") code = splitLines(code);
|
2425 |
+
makeChange(doc, {from: from, to: to, text: code, origin: origin}, null);
|
2426 |
+
}
|
2427 |
+
|
2428 |
+
// POSITION OBJECT
|
2429 |
+
|
2430 |
+
function Pos(line, ch) {
|
2431 |
+
if (!(this instanceof Pos)) return new Pos(line, ch);
|
2432 |
+
this.line = line; this.ch = ch;
|
2433 |
+
}
|
2434 |
+
CodeMirror.Pos = Pos;
|
2435 |
+
|
2436 |
+
function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
|
2437 |
+
function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
|
2438 |
+
function copyPos(x) {return Pos(x.line, x.ch);}
|
2439 |
+
|
2440 |
+
// SELECTION
|
2441 |
+
|
2442 |
+
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1));}
|
2443 |
+
function clipPos(doc, pos) {
|
2444 |
+
if (pos.line < doc.first) return Pos(doc.first, 0);
|
2445 |
+
var last = doc.first + doc.size - 1;
|
2446 |
+
if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
|
2447 |
+
return clipToLen(pos, getLine(doc, pos.line).text.length);
|
2448 |
+
}
|
2449 |
+
function clipToLen(pos, linelen) {
|
2450 |
+
var ch = pos.ch;
|
2451 |
+
if (ch == null || ch > linelen) return Pos(pos.line, linelen);
|
2452 |
+
else if (ch < 0) return Pos(pos.line, 0);
|
2453 |
+
else return pos;
|
2454 |
+
}
|
2455 |
+
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size;}
|
2456 |
+
|
2457 |
+
// If shift is held, this will move the selection anchor. Otherwise,
|
2458 |
+
// it'll set the whole selection.
|
2459 |
+
function extendSelection(doc, pos, other, bias) {
|
2460 |
+
if (doc.sel.shift || doc.sel.extend) {
|
2461 |
+
var anchor = doc.sel.anchor;
|
2462 |
+
if (other) {
|
2463 |
+
var posBefore = posLess(pos, anchor);
|
2464 |
+
if (posBefore != posLess(other, anchor)) {
|
2465 |
+
anchor = pos;
|
2466 |
+
pos = other;
|
2467 |
+
} else if (posBefore != posLess(pos, other)) {
|
2468 |
+
pos = other;
|
2469 |
+
}
|
2470 |
+
}
|
2471 |
+
setSelection(doc, anchor, pos, bias);
|
2472 |
+
} else {
|
2473 |
+
setSelection(doc, pos, other || pos, bias);
|
2474 |
+
}
|
2475 |
+
if (doc.cm) doc.cm.curOp.userSelChange = true;
|
2476 |
+
}
|
2477 |
+
|
2478 |
+
function filterSelectionChange(doc, anchor, head) {
|
2479 |
+
var obj = {anchor: anchor, head: head};
|
2480 |
+
signal(doc, "beforeSelectionChange", doc, obj);
|
2481 |
+
if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj);
|
2482 |
+
obj.anchor = clipPos(doc, obj.anchor); obj.head = clipPos(doc, obj.head);
|
2483 |
+
return obj;
|
2484 |
+
}
|
2485 |
+
|
2486 |
+
// Update the selection. Last two args are only used by
|
2487 |
+
// updateDoc, since they have to be expressed in the line
|
2488 |
+
// numbers before the update.
|
2489 |
+
function setSelection(doc, anchor, head, bias, checkAtomic) {
|
2490 |
+
if (!checkAtomic && hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange")) {
|
2491 |
+
var filtered = filterSelectionChange(doc, anchor, head);
|
2492 |
+
head = filtered.head;
|
2493 |
+
anchor = filtered.anchor;
|
2494 |
+
}
|
2495 |
+
|
2496 |
+
var sel = doc.sel;
|
2497 |
+
sel.goalColumn = null;
|
2498 |
+
// Skip over atomic spans.
|
2499 |
+
if (checkAtomic || !posEq(anchor, sel.anchor))
|
2500 |
+
anchor = skipAtomic(doc, anchor, bias, checkAtomic != "push");
|
2501 |
+
if (checkAtomic || !posEq(head, sel.head))
|
2502 |
+
head = skipAtomic(doc, head, bias, checkAtomic != "push");
|
2503 |
+
|
2504 |
+
if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;
|
2505 |
+
|
2506 |
+
sel.anchor = anchor; sel.head = head;
|
2507 |
+
var inv = posLess(head, anchor);
|
2508 |
+
sel.from = inv ? head : anchor;
|
2509 |
+
sel.to = inv ? anchor : head;
|
2510 |
+
|
2511 |
+
if (doc.cm)
|
2512 |
+
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged =
|
2513 |
+
doc.cm.curOp.cursorActivity = true;
|
2514 |
+
|
2515 |
+
signalLater(doc, "cursorActivity", doc);
|
2516 |
+
}
|
2517 |
+
|
2518 |
+
function reCheckSelection(cm) {
|
2519 |
+
setSelection(cm.doc, cm.doc.sel.from, cm.doc.sel.to, null, "push");
|
2520 |
+
}
|
2521 |
+
|
2522 |
+
function skipAtomic(doc, pos, bias, mayClear) {
|
2523 |
+
var flipped = false, curPos = pos;
|
2524 |
+
var dir = bias || 1;
|
2525 |
+
doc.cantEdit = false;
|
2526 |
+
search: for (;;) {
|
2527 |
+
var line = getLine(doc, curPos.line);
|
2528 |
+
if (line.markedSpans) {
|
2529 |
+
for (var i = 0; i < line.markedSpans.length; ++i) {
|
2530 |
+
var sp = line.markedSpans[i], m = sp.marker;
|
2531 |
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
|
2532 |
+
(sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
|
2533 |
+
if (mayClear) {
|
2534 |
+
signal(m, "beforeCursorEnter");
|
2535 |
+
if (m.explicitlyCleared) {
|
2536 |
+
if (!line.markedSpans) break;
|
2537 |
+
else {--i; continue;}
|
2538 |
+
}
|
2539 |
+
}
|
2540 |
+
if (!m.atomic) continue;
|
2541 |
+
var newPos = m.find()[dir < 0 ? "from" : "to"];
|
2542 |
+
if (posEq(newPos, curPos)) {
|
2543 |
+
newPos.ch += dir;
|
2544 |
+
if (newPos.ch < 0) {
|
2545 |
+
if (newPos.line > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
|
2546 |
+
else newPos = null;
|
2547 |
+
} else if (newPos.ch > line.text.length) {
|
2548 |
+
if (newPos.line < doc.first + doc.size - 1) newPos = Pos(newPos.line + 1, 0);
|
2549 |
+
else newPos = null;
|
2550 |
+
}
|
2551 |
+
if (!newPos) {
|
2552 |
+
if (flipped) {
|
2553 |
+
// Driven in a corner -- no valid cursor position found at all
|
2554 |
+
// -- try again *with* clearing, if we didn't already
|
2555 |
+
if (!mayClear) return skipAtomic(doc, pos, bias, true);
|
2556 |
+
// Otherwise, turn off editing until further notice, and return the start of the doc
|
2557 |
+
doc.cantEdit = true;
|
2558 |
+
return Pos(doc.first, 0);
|
2559 |
+
}
|
2560 |
+
flipped = true; newPos = pos; dir = -dir;
|
2561 |
+
}
|
2562 |
+
}
|
2563 |
+
curPos = newPos;
|
2564 |
+
continue search;
|
2565 |
+
}
|
2566 |
+
}
|
2567 |
+
}
|
2568 |
+
return curPos;
|
2569 |
+
}
|
2570 |
+
}
|
2571 |
+
|
2572 |
+
// SCROLLING
|
2573 |
+
|
2574 |
+
function scrollCursorIntoView(cm) {
|
2575 |
+
var coords = scrollPosIntoView(cm, cm.doc.sel.head, cm.options.cursorScrollMargin);
|
2576 |
+
if (!cm.state.focused) return;
|
2577 |
+
var display = cm.display, box = getRect(display.sizer), doScroll = null;
|
2578 |
+
if (coords.top + box.top < 0) doScroll = true;
|
2579 |
+
else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
|
2580 |
+
if (doScroll != null && !phantom) {
|
2581 |
+
var hidden = display.cursor.style.display == "none";
|
2582 |
+
if (hidden) {
|
2583 |
+
display.cursor.style.display = "";
|
2584 |
+
display.cursor.style.left = coords.left + "px";
|
2585 |
+
display.cursor.style.top = (coords.top - display.viewOffset) + "px";
|
2586 |
+
}
|
2587 |
+
display.cursor.scrollIntoView(doScroll);
|
2588 |
+
if (hidden) display.cursor.style.display = "none";
|
2589 |
+
}
|
2590 |
+
}
|
2591 |
+
|
2592 |
+
function scrollPosIntoView(cm, pos, margin) {
|
2593 |
+
if (margin == null) margin = 0;
|
2594 |
+
for (;;) {
|
2595 |
+
var changed = false, coords = cursorCoords(cm, pos);
|
2596 |
+
var scrollPos = calculateScrollPos(cm, coords.left, coords.top - margin, coords.left, coords.bottom + margin);
|
2597 |
+
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
|
2598 |
+
if (scrollPos.scrollTop != null) {
|
2599 |
+
setScrollTop(cm, scrollPos.scrollTop);
|
2600 |
+
if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
|
2601 |
+
}
|
2602 |
+
if (scrollPos.scrollLeft != null) {
|
2603 |
+
setScrollLeft(cm, scrollPos.scrollLeft);
|
2604 |
+
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true;
|
2605 |
+
}
|
2606 |
+
if (!changed) return coords;
|
2607 |
+
}
|
2608 |
+
}
|
2609 |
+
|
2610 |
+
function scrollIntoView(cm, x1, y1, x2, y2) {
|
2611 |
+
var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
|
2612 |
+
if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
|
2613 |
+
if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
|
2614 |
+
}
|
2615 |
+
|
2616 |
+
function calculateScrollPos(cm, x1, y1, x2, y2) {
|
2617 |
+
var display = cm.display, snapMargin = textHeight(cm.display);
|
2618 |
+
if (y1 < 0) y1 = 0;
|
2619 |
+
var screen = display.scroller.clientHeight - scrollerCutOff, screentop = display.scroller.scrollTop, result = {};
|
2620 |
+
var docBottom = cm.doc.height + paddingVert(display);
|
2621 |
+
var atTop = y1 < snapMargin, atBottom = y2 > docBottom - snapMargin;
|
2622 |
+
if (y1 < screentop) {
|
2623 |
+
result.scrollTop = atTop ? 0 : y1;
|
2624 |
+
} else if (y2 > screentop + screen) {
|
2625 |
+
var newTop = Math.min(y1, (atBottom ? docBottom : y2) - screen);
|
2626 |
+
if (newTop != screentop) result.scrollTop = newTop;
|
2627 |
+
}
|
2628 |
+
|
2629 |
+
var screenw = display.scroller.clientWidth - scrollerCutOff, screenleft = display.scroller.scrollLeft;
|
2630 |
+
x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth;
|
2631 |
+
var gutterw = display.gutters.offsetWidth;
|
2632 |
+
var atLeft = x1 < gutterw + 10;
|
2633 |
+
if (x1 < screenleft + gutterw || atLeft) {
|
2634 |
+
if (atLeft) x1 = 0;
|
2635 |
+
result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
|
2636 |
+
} else if (x2 > screenw + screenleft - 3) {
|
2637 |
+
result.scrollLeft = x2 + 10 - screenw;
|
2638 |
+
}
|
2639 |
+
return result;
|
2640 |
+
}
|
2641 |
+
|
2642 |
+
function updateScrollPos(cm, left, top) {
|
2643 |
+
cm.curOp.updateScrollPos = {scrollLeft: left == null ? cm.doc.scrollLeft : left,
|
2644 |
+
scrollTop: top == null ? cm.doc.scrollTop : top};
|
2645 |
+
}
|
2646 |
+
|
2647 |
+
function addToScrollPos(cm, left, top) {
|
2648 |
+
var pos = cm.curOp.updateScrollPos || (cm.curOp.updateScrollPos = {scrollLeft: cm.doc.scrollLeft, scrollTop: cm.doc.scrollTop});
|
2649 |
+
var scroll = cm.display.scroller;
|
2650 |
+
pos.scrollTop = Math.max(0, Math.min(scroll.scrollHeight - scroll.clientHeight, pos.scrollTop + top));
|
2651 |
+
pos.scrollLeft = Math.max(0, Math.min(scroll.scrollWidth - scroll.clientWidth, pos.scrollLeft + left));
|
2652 |
+
}
|
2653 |
+
|
2654 |
+
// API UTILITIES
|
2655 |
+
|
2656 |
+
function indentLine(cm, n, how, aggressive) {
|
2657 |
+
var doc = cm.doc;
|
2658 |
+
if (how == null) how = "add";
|
2659 |
+
if (how == "smart") {
|
2660 |
+
if (!cm.doc.mode.indent) how = "prev";
|
2661 |
+
else var state = getStateBefore(cm, n);
|
2662 |
+
}
|
2663 |
+
|
2664 |
+
var tabSize = cm.options.tabSize;
|
2665 |
+
var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
|
2666 |
+
var curSpaceString = line.text.match(/^\s*/)[0], indentation;
|
2667 |
+
if (how == "smart") {
|
2668 |
+
indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
|
2669 |
+
if (indentation == Pass) {
|
2670 |
+
if (!aggressive) return;
|
2671 |
+
how = "prev";
|
2672 |
+
}
|
2673 |
+
}
|
2674 |
+
if (how == "prev") {
|
2675 |
+
if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
|
2676 |
+
else indentation = 0;
|
2677 |
+
} else if (how == "add") {
|
2678 |
+
indentation = curSpace + cm.options.indentUnit;
|
2679 |
+
} else if (how == "subtract") {
|
2680 |
+
indentation = curSpace - cm.options.indentUnit;
|
2681 |
+
} else if (typeof how == "number") {
|
2682 |
+
indentation = curSpace + how;
|
2683 |
+
}
|
2684 |
+
indentation = Math.max(0, indentation);
|
2685 |
+
|
2686 |
+
var indentString = "", pos = 0;
|
2687 |
+
if (cm.options.indentWithTabs)
|
2688 |
+
for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
|
2689 |
+
if (pos < indentation) indentString += spaceStr(indentation - pos);
|
2690 |
+
|
2691 |
+
if (indentString != curSpaceString)
|
2692 |
+
replaceRange(cm.doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
|
2693 |
+
line.stateAfter = null;
|
2694 |
+
}
|
2695 |
+
|
2696 |
+
function changeLine(cm, handle, op) {
|
2697 |
+
var no = handle, line = handle, doc = cm.doc;
|
2698 |
+
if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
|
2699 |
+
else no = lineNo(handle);
|
2700 |
+
if (no == null) return null;
|
2701 |
+
if (op(line, no)) regChange(cm, no, no + 1);
|
2702 |
+
else return null;
|
2703 |
+
return line;
|
2704 |
+
}
|
2705 |
+
|
2706 |
+
function findPosH(doc, pos, dir, unit, visually) {
|
2707 |
+
var line = pos.line, ch = pos.ch, origDir = dir;
|
2708 |
+
var lineObj = getLine(doc, line);
|
2709 |
+
var possible = true;
|
2710 |
+
function findNextLine() {
|
2711 |
+
var l = line + dir;
|
2712 |
+
if (l < doc.first || l >= doc.first + doc.size) return (possible = false);
|
2713 |
+
line = l;
|
2714 |
+
return lineObj = getLine(doc, l);
|
2715 |
+
}
|
2716 |
+
function moveOnce(boundToLine) {
|
2717 |
+
var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
|
2718 |
+
if (next == null) {
|
2719 |
+
if (!boundToLine && findNextLine()) {
|
2720 |
+
if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
|
2721 |
+
else ch = dir < 0 ? lineObj.text.length : 0;
|
2722 |
+
} else return (possible = false);
|
2723 |
+
} else ch = next;
|
2724 |
+
return true;
|
2725 |
+
}
|
2726 |
+
|
2727 |
+
if (unit == "char") moveOnce();
|
2728 |
+
else if (unit == "column") moveOnce(true);
|
2729 |
+
else if (unit == "word" || unit == "group") {
|
2730 |
+
var sawType = null, group = unit == "group";
|
2731 |
+
for (var first = true;; first = false) {
|
2732 |
+
if (dir < 0 && !moveOnce(!first)) break;
|
2733 |
+
var cur = lineObj.text.charAt(ch) || "\n";
|
2734 |
+
var type = isWordChar(cur) ? "w"
|
2735 |
+
: !group ? null
|
2736 |
+
: /\s/.test(cur) ? null
|
2737 |
+
: "p";
|
2738 |
+
if (sawType && sawType != type) {
|
2739 |
+
if (dir < 0) {dir = 1; moveOnce();}
|
2740 |
+
break;
|
2741 |
+
}
|
2742 |
+
if (type) sawType = type;
|
2743 |
+
if (dir > 0 && !moveOnce(!first)) break;
|
2744 |
+
}
|
2745 |
+
}
|
2746 |
+
var result = skipAtomic(doc, Pos(line, ch), origDir, true);
|
2747 |
+
if (!possible) result.hitSide = true;
|
2748 |
+
return result;
|
2749 |
+
}
|
2750 |
+
|
2751 |
+
function findPosV(cm, pos, dir, unit) {
|
2752 |
+
var doc = cm.doc, x = pos.left, y;
|
2753 |
+
if (unit == "page") {
|
2754 |
+
var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
|
2755 |
+
y = pos.top + dir * (pageSize - (dir < 0 ? 1.5 : .5) * textHeight(cm.display));
|
2756 |
+
} else if (unit == "line") {
|
2757 |
+
y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
|
2758 |
+
}
|
2759 |
+
for (;;) {
|
2760 |
+
var target = coordsChar(cm, x, y);
|
2761 |
+
if (!target.outside) break;
|
2762 |
+
if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break; }
|
2763 |
+
y += dir * 5;
|
2764 |
+
}
|
2765 |
+
return target;
|
2766 |
+
}
|
2767 |
+
|
2768 |
+
function findWordAt(line, pos) {
|
2769 |
+
var start = pos.ch, end = pos.ch;
|
2770 |
+
if (line) {
|
2771 |
+
if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
|
2772 |
+
var startChar = line.charAt(start);
|
2773 |
+
var check = isWordChar(startChar) ? isWordChar
|
2774 |
+
: /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
|
2775 |
+
: function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
|
2776 |
+
while (start > 0 && check(line.charAt(start - 1))) --start;
|
2777 |
+
while (end < line.length && check(line.charAt(end))) ++end;
|
2778 |
+
}
|
2779 |
+
return {from: Pos(pos.line, start), to: Pos(pos.line, end)};
|
2780 |
+
}
|
2781 |
+
|
2782 |
+
function selectLine(cm, line) {
|
2783 |
+
extendSelection(cm.doc, Pos(line, 0), clipPos(cm.doc, Pos(line + 1, 0)));
|
2784 |
+
}
|
2785 |
+
|
2786 |
+
// PROTOTYPE
|
2787 |
+
|
2788 |
+
// The publicly visible API. Note that operation(null, f) means
|
2789 |
+
// 'wrap f in an operation, performed on its `this` parameter'
|
2790 |
+
|
2791 |
+
CodeMirror.prototype = {
|
2792 |
+
constructor: CodeMirror,
|
2793 |
+
focus: function(){window.focus(); focusInput(this); onFocus(this); fastPoll(this);},
|
2794 |
+
|
2795 |
+
setOption: function(option, value) {
|
2796 |
+
var options = this.options, old = options[option];
|
2797 |
+
if (options[option] == value && option != "mode") return;
|
2798 |
+
options[option] = value;
|
2799 |
+
if (optionHandlers.hasOwnProperty(option))
|
2800 |
+
operation(this, optionHandlers[option])(this, value, old);
|
2801 |
+
},
|
2802 |
+
|
2803 |
+
getOption: function(option) {return this.options[option];},
|
2804 |
+
getDoc: function() {return this.doc;},
|
2805 |
+
|
2806 |
+
addKeyMap: function(map, bottom) {
|
2807 |
+
this.state.keyMaps[bottom ? "push" : "unshift"](map);
|
2808 |
+
},
|
2809 |
+
removeKeyMap: function(map) {
|
2810 |
+
var maps = this.state.keyMaps;
|
2811 |
+
for (var i = 0; i < maps.length; ++i)
|
2812 |
+
if (maps[i] == map || (typeof maps[i] != "string" && maps[i].name == map)) {
|
2813 |
+
maps.splice(i, 1);
|
2814 |
+
return true;
|
2815 |
+
}
|
2816 |
+
},
|
2817 |
+
|
2818 |
+
addOverlay: operation(null, function(spec, options) {
|
2819 |
+
var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
|
2820 |
+
if (mode.startState) throw new Error("Overlays may not be stateful.");
|
2821 |
+
this.state.overlays.push({mode: mode, modeSpec: spec, opaque: options && options.opaque});
|
2822 |
+
this.state.modeGen++;
|
2823 |
+
regChange(this);
|
2824 |
+
}),
|
2825 |
+
removeOverlay: operation(null, function(spec) {
|
2826 |
+
var overlays = this.state.overlays;
|
2827 |
+
for (var i = 0; i < overlays.length; ++i) {
|
2828 |
+
var cur = overlays[i].modeSpec;
|
2829 |
+
if (cur == spec || typeof spec == "string" && cur.name == spec) {
|
2830 |
+
overlays.splice(i, 1);
|
2831 |
+
this.state.modeGen++;
|
2832 |
+
regChange(this);
|
2833 |
+
return;
|
2834 |
+
}
|
2835 |
+
}
|
2836 |
+
}),
|
2837 |
+
|
2838 |
+
indentLine: operation(null, function(n, dir, aggressive) {
|
2839 |
+
if (typeof dir != "string" && typeof dir != "number") {
|
2840 |
+
if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
|
2841 |
+
else dir = dir ? "add" : "subtract";
|
2842 |
+
}
|
2843 |
+
if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive);
|
2844 |
+
}),
|
2845 |
+
indentSelection: operation(null, function(how) {
|
2846 |
+
var sel = this.doc.sel;
|
2847 |
+
if (posEq(sel.from, sel.to)) return indentLine(this, sel.from.line, how);
|
2848 |
+
var e = sel.to.line - (sel.to.ch ? 0 : 1);
|
2849 |
+
for (var i = sel.from.line; i <= e; ++i) indentLine(this, i, how);
|
2850 |
+
}),
|
2851 |
+
|
2852 |
+
// Fetch the parser token for a given character. Useful for hacks
|
2853 |
+
// that want to inspect the mode state (say, for completion).
|
2854 |
+
getTokenAt: function(pos, precise) {
|
2855 |
+
var doc = this.doc;
|
2856 |
+
pos = clipPos(doc, pos);
|
2857 |
+
var state = getStateBefore(this, pos.line, precise), mode = this.doc.mode;
|
2858 |
+
var line = getLine(doc, pos.line);
|
2859 |
+
var stream = new StringStream(line.text, this.options.tabSize);
|
2860 |
+
while (stream.pos < pos.ch && !stream.eol()) {
|
2861 |
+
stream.start = stream.pos;
|
2862 |
+
var style = mode.token(stream, state);
|
2863 |
+
}
|
2864 |
+
return {start: stream.start,
|
2865 |
+
end: stream.pos,
|
2866 |
+
string: stream.current(),
|
2867 |
+
className: style || null, // Deprecated, use 'type' instead
|
2868 |
+
type: style || null,
|
2869 |
+
state: state};
|
2870 |
+
},
|
2871 |
+
|
2872 |
+
getTokenTypeAt: function(pos) {
|
2873 |
+
pos = clipPos(this.doc, pos);
|
2874 |
+
var styles = getLineStyles(this, getLine(this.doc, pos.line));
|
2875 |
+
var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
|
2876 |
+
if (ch == 0) return styles[2];
|
2877 |
+
for (;;) {
|
2878 |
+
var mid = (before + after) >> 1;
|
2879 |
+
if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid;
|
2880 |
+
else if (styles[mid * 2 + 1] < ch) before = mid + 1;
|
2881 |
+
else return styles[mid * 2 + 2];
|
2882 |
+
}
|
2883 |
+
},
|
2884 |
+
|
2885 |
+
getModeAt: function(pos) {
|
2886 |
+
var mode = this.doc.mode;
|
2887 |
+
if (!mode.innerMode) return mode;
|
2888 |
+
return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode;
|
2889 |
+
},
|
2890 |
+
|
2891 |
+
getHelper: function(pos, type) {
|
2892 |
+
if (!helpers.hasOwnProperty(type)) return;
|
2893 |
+
var help = helpers[type], mode = this.getModeAt(pos);
|
2894 |
+
return mode[type] && help[mode[type]] ||
|
2895 |
+
mode.helperType && help[mode.helperType] ||
|
2896 |
+
help[mode.name];
|
2897 |
+
},
|
2898 |
+
|
2899 |
+
getStateAfter: function(line, precise) {
|
2900 |
+
var doc = this.doc;
|
2901 |
+
line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
|
2902 |
+
return getStateBefore(this, line + 1, precise);
|
2903 |
+
},
|
2904 |
+
|
2905 |
+
cursorCoords: function(start, mode) {
|
2906 |
+
var pos, sel = this.doc.sel;
|
2907 |
+
if (start == null) pos = sel.head;
|
2908 |
+
else if (typeof start == "object") pos = clipPos(this.doc, start);
|
2909 |
+
else pos = start ? sel.from : sel.to;
|
2910 |
+
return cursorCoords(this, pos, mode || "page");
|
2911 |
+
},
|
2912 |
+
|
2913 |
+
charCoords: function(pos, mode) {
|
2914 |
+
return charCoords(this, clipPos(this.doc, pos), mode || "page");
|
2915 |
+
},
|
2916 |
+
|
2917 |
+
coordsChar: function(coords, mode) {
|
2918 |
+
coords = fromCoordSystem(this, coords, mode || "page");
|
2919 |
+
return coordsChar(this, coords.left, coords.top);
|
2920 |
+
},
|
2921 |
+
|
2922 |
+
lineAtHeight: function(height, mode) {
|
2923 |
+
height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
|
2924 |
+
return lineAtHeight(this.doc, height + this.display.viewOffset);
|
2925 |
+
},
|
2926 |
+
heightAtLine: function(line, mode) {
|
2927 |
+
var end = false, last = this.doc.first + this.doc.size - 1;
|
2928 |
+
if (line < this.doc.first) line = this.doc.first;
|
2929 |
+
else if (line > last) { line = last; end = true; }
|
2930 |
+
var lineObj = getLine(this.doc, line);
|
2931 |
+
return intoCoordSystem(this, getLine(this.doc, line), {top: 0, left: 0}, mode || "page").top +
|
2932 |
+
(end ? lineObj.height : 0);
|
2933 |
+
},
|
2934 |
+
|
2935 |
+
defaultTextHeight: function() { return textHeight(this.display); },
|
2936 |
+
defaultCharWidth: function() { return charWidth(this.display); },
|
2937 |
+
|
2938 |
+
setGutterMarker: operation(null, function(line, gutterID, value) {
|
2939 |
+
return changeLine(this, line, function(line) {
|
2940 |
+
var markers = line.gutterMarkers || (line.gutterMarkers = {});
|
2941 |
+
markers[gutterID] = value;
|
2942 |
+
if (!value && isEmpty(markers)) line.gutterMarkers = null;
|
2943 |
+
return true;
|
2944 |
+
});
|
2945 |
+
}),
|
2946 |
+
|
2947 |
+
clearGutter: operation(null, function(gutterID) {
|
2948 |
+
var cm = this, doc = cm.doc, i = doc.first;
|
2949 |
+
doc.iter(function(line) {
|
2950 |
+
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
|
2951 |
+
line.gutterMarkers[gutterID] = null;
|
2952 |
+
regChange(cm, i, i + 1);
|
2953 |
+
if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
|
2954 |
+
}
|
2955 |
+
++i;
|
2956 |
+
});
|
2957 |
+
}),
|
2958 |
+
|
2959 |
+
addLineClass: operation(null, function(handle, where, cls) {
|
2960 |
+
return changeLine(this, handle, function(line) {
|
2961 |
+
var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
|
2962 |
+
if (!line[prop]) line[prop] = cls;
|
2963 |
+
else if (new RegExp("(?:^|\\s)" + cls + "(?:$|\\s)").test(line[prop])) return false;
|
2964 |
+
else line[prop] += " " + cls;
|
2965 |
+
return true;
|
2966 |
+
});
|
2967 |
+
}),
|
2968 |
+
|
2969 |
+
removeLineClass: operation(null, function(handle, where, cls) {
|
2970 |
+
return changeLine(this, handle, function(line) {
|
2971 |
+
var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
|
2972 |
+
var cur = line[prop];
|
2973 |
+
if (!cur) return false;
|
2974 |
+
else if (cls == null) line[prop] = null;
|
2975 |
+
else {
|
2976 |
+
var found = cur.match(new RegExp("(?:^|\\s+)" + cls + "(?:$|\\s+)"));
|
2977 |
+
if (!found) return false;
|
2978 |
+
var end = found.index + found[0].length;
|
2979 |
+
line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
|
2980 |
+
}
|
2981 |
+
return true;
|
2982 |
+
});
|
2983 |
+
}),
|
2984 |
+
|
2985 |
+
addLineWidget: operation(null, function(handle, node, options) {
|
2986 |
+
return addLineWidget(this, handle, node, options);
|
2987 |
+
}),
|
2988 |
+
|
2989 |
+
removeLineWidget: function(widget) { widget.clear(); },
|
2990 |
+
|
2991 |
+
lineInfo: function(line) {
|
2992 |
+
if (typeof line == "number") {
|
2993 |
+
if (!isLine(this.doc, line)) return null;
|
2994 |
+
var n = line;
|
2995 |
+
line = getLine(this.doc, line);
|
2996 |
+
if (!line) return null;
|
2997 |
+
} else {
|
2998 |
+
var n = lineNo(line);
|
2999 |
+
if (n == null) return null;
|
3000 |
+
}
|
3001 |
+
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
|
3002 |
+
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
|
3003 |
+
widgets: line.widgets};
|
3004 |
+
},
|
3005 |
+
|
3006 |
+
getViewport: function() { return {from: this.display.showingFrom, to: this.display.showingTo};},
|
3007 |
+
|
3008 |
+
addWidget: function(pos, node, scroll, vert, horiz) {
|
3009 |
+
var display = this.display;
|
3010 |
+
pos = cursorCoords(this, clipPos(this.doc, pos));
|
3011 |
+
var top = pos.bottom, left = pos.left;
|
3012 |
+
node.style.position = "absolute";
|
3013 |
+
display.sizer.appendChild(node);
|
3014 |
+
if (vert == "over") {
|
3015 |
+
top = pos.top;
|
3016 |
+
} else if (vert == "above" || vert == "near") {
|
3017 |
+
var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
|
3018 |
+
hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
|
3019 |
+
// Default to positioning above (if specified and possible); otherwise default to positioning below
|
3020 |
+
if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
|
3021 |
+
top = pos.top - node.offsetHeight;
|
3022 |
+
else if (pos.bottom + node.offsetHeight <= vspace)
|
3023 |
+
top = pos.bottom;
|
3024 |
+
if (left + node.offsetWidth > hspace)
|
3025 |
+
left = hspace - node.offsetWidth;
|
3026 |
+
}
|
3027 |
+
node.style.top = top + "px";
|
3028 |
+
node.style.left = node.style.right = "";
|
3029 |
+
if (horiz == "right") {
|
3030 |
+
left = display.sizer.clientWidth - node.offsetWidth;
|
3031 |
+
node.style.right = "0px";
|
3032 |
+
} else {
|
3033 |
+
if (horiz == "left") left = 0;
|
3034 |
+
else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
|
3035 |
+
node.style.left = left + "px";
|
3036 |
+
}
|
3037 |
+
if (scroll)
|
3038 |
+
scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
|
3039 |
+
},
|
3040 |
+
|
3041 |
+
triggerOnKeyDown: operation(null, onKeyDown),
|
3042 |
+
|
3043 |
+
execCommand: function(cmd) {return commands[cmd](this);},
|
3044 |
+
|
3045 |
+
findPosH: function(from, amount, unit, visually) {
|
3046 |
+
var dir = 1;
|
3047 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
3048 |
+
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
|
3049 |
+
cur = findPosH(this.doc, cur, dir, unit, visually);
|
3050 |
+
if (cur.hitSide) break;
|
3051 |
+
}
|
3052 |
+
return cur;
|
3053 |
+
},
|
3054 |
+
|
3055 |
+
moveH: operation(null, function(dir, unit) {
|
3056 |
+
var sel = this.doc.sel, pos;
|
3057 |
+
if (sel.shift || sel.extend || posEq(sel.from, sel.to))
|
3058 |
+
pos = findPosH(this.doc, sel.head, dir, unit, this.options.rtlMoveVisually);
|
3059 |
+
else
|
3060 |
+
pos = dir < 0 ? sel.from : sel.to;
|
3061 |
+
extendSelection(this.doc, pos, pos, dir);
|
3062 |
+
}),
|
3063 |
+
|
3064 |
+
deleteH: operation(null, function(dir, unit) {
|
3065 |
+
var sel = this.doc.sel;
|
3066 |
+
if (!posEq(sel.from, sel.to)) replaceRange(this.doc, "", sel.from, sel.to, "+delete");
|
3067 |
+
else replaceRange(this.doc, "", sel.from, findPosH(this.doc, sel.head, dir, unit, false), "+delete");
|
3068 |
+
this.curOp.userSelChange = true;
|
3069 |
+
}),
|
3070 |
+
|
3071 |
+
findPosV: function(from, amount, unit, goalColumn) {
|
3072 |
+
var dir = 1, x = goalColumn;
|
3073 |
+
if (amount < 0) { dir = -1; amount = -amount; }
|
3074 |
+
for (var i = 0, cur = clipPos(this.doc, from); i < amount; ++i) {
|
3075 |
+
var coords = cursorCoords(this, cur, "div");
|
3076 |
+
if (x == null) x = coords.left;
|
3077 |
+
else coords.left = x;
|
3078 |
+
cur = findPosV(this, coords, dir, unit);
|
3079 |
+
if (cur.hitSide) break;
|
3080 |
+
}
|
3081 |
+
return cur;
|
3082 |
+
},
|
3083 |
+
|
3084 |
+
moveV: operation(null, function(dir, unit) {
|
3085 |
+
var sel = this.doc.sel;
|
3086 |
+
var pos = cursorCoords(this, sel.head, "div");
|
3087 |
+
if (sel.goalColumn != null) pos.left = sel.goalColumn;
|
3088 |
+
var target = findPosV(this, pos, dir, unit);
|
3089 |
+
|
3090 |
+
if (unit == "page") addToScrollPos(this, 0, charCoords(this, target, "div").top - pos.top);
|
3091 |
+
extendSelection(this.doc, target, target, dir);
|
3092 |
+
sel.goalColumn = pos.left;
|
3093 |
+
}),
|
3094 |
+
|
3095 |
+
toggleOverwrite: function(value) {
|
3096 |
+
if (value != null && value == this.state.overwrite) return;
|
3097 |
+
if (this.state.overwrite = !this.state.overwrite)
|
3098 |
+
this.display.cursor.className += " CodeMirror-overwrite";
|
3099 |
+
else
|
3100 |
+
this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "");
|
3101 |
+
},
|
3102 |
+
hasFocus: function() { return this.state.focused; },
|
3103 |
+
|
3104 |
+
scrollTo: operation(null, function(x, y) {
|
3105 |
+
updateScrollPos(this, x, y);
|
3106 |
+
}),
|
3107 |
+
getScrollInfo: function() {
|
3108 |
+
var scroller = this.display.scroller, co = scrollerCutOff;
|
3109 |
+
return {left: scroller.scrollLeft, top: scroller.scrollTop,
|
3110 |
+
height: scroller.scrollHeight - co, width: scroller.scrollWidth - co,
|
3111 |
+
clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
|
3112 |
+
},
|
3113 |
+
|
3114 |
+
scrollIntoView: operation(null, function(pos, margin) {
|
3115 |
+
if (typeof pos == "number") pos = Pos(pos, 0);
|
3116 |
+
if (!margin) margin = 0;
|
3117 |
+
var coords = pos;
|
3118 |
+
|
3119 |
+
if (!pos || pos.line != null) {
|
3120 |
+
this.curOp.scrollToPos = pos ? clipPos(this.doc, pos) : this.doc.sel.head;
|
3121 |
+
this.curOp.scrollToPosMargin = margin;
|
3122 |
+
coords = cursorCoords(this, this.curOp.scrollToPos);
|
3123 |
+
}
|
3124 |
+
var sPos = calculateScrollPos(this, coords.left, coords.top - margin, coords.right, coords.bottom + margin);
|
3125 |
+
updateScrollPos(this, sPos.scrollLeft, sPos.scrollTop);
|
3126 |
+
}),
|
3127 |
+
|
3128 |
+
setSize: operation(null, function(width, height) {
|
3129 |
+
function interpret(val) {
|
3130 |
+
return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
|
3131 |
+
}
|
3132 |
+
if (width != null) this.display.wrapper.style.width = interpret(width);
|
3133 |
+
if (height != null) this.display.wrapper.style.height = interpret(height);
|
3134 |
+
if (this.options.lineWrapping)
|
3135 |
+
this.display.measureLineCache.length = this.display.measureLineCachePos = 0;
|
3136 |
+
this.curOp.forceUpdate = true;
|
3137 |
+
}),
|
3138 |
+
|
3139 |
+
operation: function(f){return runInOp(this, f);},
|
3140 |
+
|
3141 |
+
refresh: operation(null, function() {
|
3142 |
+
clearCaches(this);
|
3143 |
+
updateScrollPos(this, this.doc.scrollLeft, this.doc.scrollTop);
|
3144 |
+
regChange(this);
|
3145 |
+
}),
|
3146 |
+
|
3147 |
+
swapDoc: operation(null, function(doc) {
|
3148 |
+
var old = this.doc;
|
3149 |
+
old.cm = null;
|
3150 |
+
attachDoc(this, doc);
|
3151 |
+
clearCaches(this);
|
3152 |
+
resetInput(this, true);
|
3153 |
+
updateScrollPos(this, doc.scrollLeft, doc.scrollTop);
|
3154 |
+
return old;
|
3155 |
+
}),
|
3156 |
+
|
3157 |
+
getInputField: function(){return this.display.input;},
|
3158 |
+
getWrapperElement: function(){return this.display.wrapper;},
|
3159 |
+
getScrollerElement: function(){return this.display.scroller;},
|
3160 |
+
getGutterElement: function(){return this.display.gutters;}
|
3161 |
+
};
|
3162 |
+
eventMixin(CodeMirror);
|
3163 |
+
|
3164 |
+
// OPTION DEFAULTS
|
3165 |
+
|
3166 |
+
var optionHandlers = CodeMirror.optionHandlers = {};
|
3167 |
+
|
3168 |
+
// The default configuration options.
|
3169 |
+
var defaults = CodeMirror.defaults = {};
|
3170 |
+
|
3171 |
+
function option(name, deflt, handle, notOnInit) {
|
3172 |
+
CodeMirror.defaults[name] = deflt;
|
3173 |
+
if (handle) optionHandlers[name] =
|
3174 |
+
notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
|
3175 |
+
}
|
3176 |
+
|
3177 |
+
var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
|
3178 |
+
|
3179 |
+
// These two are, on init, called from the constructor because they
|
3180 |
+
// have to be initialized before the editor can start at all.
|
3181 |
+
option("value", "", function(cm, val) {
|
3182 |
+
cm.setValue(val);
|
3183 |
+
}, true);
|
3184 |
+
option("mode", null, function(cm, val) {
|
3185 |
+
cm.doc.modeOption = val;
|
3186 |
+
loadMode(cm);
|
3187 |
+
}, true);
|
3188 |
+
|
3189 |
+
option("indentUnit", 2, loadMode, true);
|
3190 |
+
option("indentWithTabs", false);
|
3191 |
+
option("smartIndent", true);
|
3192 |
+
option("tabSize", 4, function(cm) {
|
3193 |
+
loadMode(cm);
|
3194 |
+
clearCaches(cm);
|
3195 |
+
regChange(cm);
|
3196 |
+
}, true);
|
3197 |
+
option("electricChars", true);
|
3198 |
+
option("rtlMoveVisually", !windows);
|
3199 |
+
|
3200 |
+
option("theme", "default", function(cm) {
|
3201 |
+
themeChanged(cm);
|
3202 |
+
guttersChanged(cm);
|
3203 |
+
}, true);
|
3204 |
+
option("keyMap", "default", keyMapChanged);
|
3205 |
+
option("extraKeys", null);
|
3206 |
+
|
3207 |
+
option("onKeyEvent", null);
|
3208 |
+
option("onDragEvent", null);
|
3209 |
+
|
3210 |
+
option("lineWrapping", false, wrappingChanged, true);
|
3211 |
+
option("gutters", [], function(cm) {
|
3212 |
+
setGuttersForLineNumbers(cm.options);
|
3213 |
+
guttersChanged(cm);
|
3214 |
+
}, true);
|
3215 |
+
option("fixedGutter", true, function(cm, val) {
|
3216 |
+
cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
|
3217 |
+
cm.refresh();
|
3218 |
+
}, true);
|
3219 |
+
option("coverGutterNextToScrollbar", false, updateScrollbars, true);
|
3220 |
+
option("lineNumbers", false, function(cm) {
|
3221 |
+
setGuttersForLineNumbers(cm.options);
|
3222 |
+
guttersChanged(cm);
|
3223 |
+
}, true);
|
3224 |
+
option("firstLineNumber", 1, guttersChanged, true);
|
3225 |
+
option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
|
3226 |
+
option("showCursorWhenSelecting", false, updateSelection, true);
|
3227 |
+
|
3228 |
+
option("readOnly", false, function(cm, val) {
|
3229 |
+
if (val == "nocursor") {onBlur(cm); cm.display.input.blur();}
|
3230 |
+
else if (!val) resetInput(cm, true);
|
3231 |
+
});
|
3232 |
+
option("dragDrop", true);
|
3233 |
+
|
3234 |
+
option("cursorBlinkRate", 530);
|
3235 |
+
option("cursorScrollMargin", 0);
|
3236 |
+
option("cursorHeight", 1);
|
3237 |
+
option("workTime", 100);
|
3238 |
+
option("workDelay", 100);
|
3239 |
+
option("flattenSpans", true);
|
3240 |
+
option("pollInterval", 100);
|
3241 |
+
option("undoDepth", 40, function(cm, val){cm.doc.history.undoDepth = val;});
|
3242 |
+
option("historyEventDelay", 500);
|
3243 |
+
option("viewportMargin", 10, function(cm){cm.refresh();}, true);
|
3244 |
+
option("maxHighlightLength", 10000, function(cm){loadMode(cm); cm.refresh();}, true);
|
3245 |
+
option("moveInputWithCursor", true, function(cm, val) {
|
3246 |
+
if (!val) cm.display.inputDiv.style.top = cm.display.inputDiv.style.left = 0;
|
3247 |
+
});
|
3248 |
+
|
3249 |
+
option("tabindex", null, function(cm, val) {
|
3250 |
+
cm.display.input.tabIndex = val || "";
|
3251 |
+
});
|
3252 |
+
option("autofocus", null);
|
3253 |
+
|
3254 |
+
// MODE DEFINITION AND QUERYING
|
3255 |
+
|
3256 |
+
// Known modes, by name and by MIME
|
3257 |
+
var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
|
3258 |
+
|
3259 |
+
CodeMirror.defineMode = function(name, mode) {
|
3260 |
+
if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
|
3261 |
+
if (arguments.length > 2) {
|
3262 |
+
mode.dependencies = [];
|
3263 |
+
for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
|
3264 |
+
}
|
3265 |
+
modes[name] = mode;
|
3266 |
+
};
|
3267 |
+
|
3268 |
+
CodeMirror.defineMIME = function(mime, spec) {
|
3269 |
+
mimeModes[mime] = spec;
|
3270 |
+
};
|
3271 |
+
|
3272 |
+
CodeMirror.resolveMode = function(spec) {
|
3273 |
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
3274 |
+
spec = mimeModes[spec];
|
3275 |
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
3276 |
+
var found = mimeModes[spec.name];
|
3277 |
+
spec = createObj(found, spec);
|
3278 |
+
spec.name = found.name;
|
3279 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
3280 |
+
return CodeMirror.resolveMode("application/xml");
|
3281 |
+
}
|
3282 |
+
if (typeof spec == "string") return {name: spec};
|
3283 |
+
else return spec || {name: "null"};
|
3284 |
+
};
|
3285 |
+
|
3286 |
+
CodeMirror.getMode = function(options, spec) {
|
3287 |
+
var spec = CodeMirror.resolveMode(spec);
|
3288 |
+
var mfactory = modes[spec.name];
|
3289 |
+
if (!mfactory) return CodeMirror.getMode(options, "text/plain");
|
3290 |
+
var modeObj = mfactory(options, spec);
|
3291 |
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
3292 |
+
var exts = modeExtensions[spec.name];
|
3293 |
+
for (var prop in exts) {
|
3294 |
+
if (!exts.hasOwnProperty(prop)) continue;
|
3295 |
+
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
|
3296 |
+
modeObj[prop] = exts[prop];
|
3297 |
+
}
|
3298 |
+
}
|
3299 |
+
modeObj.name = spec.name;
|
3300 |
+
|
3301 |
+
return modeObj;
|
3302 |
+
};
|
3303 |
+
|
3304 |
+
CodeMirror.defineMode("null", function() {
|
3305 |
+
return {token: function(stream) {stream.skipToEnd();}};
|
3306 |
+
});
|
3307 |
+
CodeMirror.defineMIME("text/plain", "null");
|
3308 |
+
|
3309 |
+
var modeExtensions = CodeMirror.modeExtensions = {};
|
3310 |
+
CodeMirror.extendMode = function(mode, properties) {
|
3311 |
+
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
3312 |
+
copyObj(properties, exts);
|
3313 |
+
};
|
3314 |
+
|
3315 |
+
// EXTENSIONS
|
3316 |
+
|
3317 |
+
CodeMirror.defineExtension = function(name, func) {
|
3318 |
+
CodeMirror.prototype[name] = func;
|
3319 |
+
};
|
3320 |
+
CodeMirror.defineDocExtension = function(name, func) {
|
3321 |
+
Doc.prototype[name] = func;
|
3322 |
+
};
|
3323 |
+
CodeMirror.defineOption = option;
|
3324 |
+
|
3325 |
+
var initHooks = [];
|
3326 |
+
CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
|
3327 |
+
|
3328 |
+
var helpers = CodeMirror.helpers = {};
|
3329 |
+
CodeMirror.registerHelper = function(type, name, value) {
|
3330 |
+
if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {};
|
3331 |
+
helpers[type][name] = value;
|
3332 |
+
};
|
3333 |
+
|
3334 |
+
// UTILITIES
|
3335 |
+
|
3336 |
+
CodeMirror.isWordChar = isWordChar;
|
3337 |
+
|
3338 |
+
// MODE STATE HANDLING
|
3339 |
+
|
3340 |
+
// Utility functions for working with state. Exported because modes
|
3341 |
+
// sometimes need to do this.
|
3342 |
+
function copyState(mode, state) {
|
3343 |
+
if (state === true) return state;
|
3344 |
+
if (mode.copyState) return mode.copyState(state);
|
3345 |
+
var nstate = {};
|
3346 |
+
for (var n in state) {
|
3347 |
+
var val = state[n];
|
3348 |
+
if (val instanceof Array) val = val.concat([]);
|
3349 |
+
nstate[n] = val;
|
3350 |
+
}
|
3351 |
+
return nstate;
|
3352 |
+
}
|
3353 |
+
CodeMirror.copyState = copyState;
|
3354 |
+
|
3355 |
+
function startState(mode, a1, a2) {
|
3356 |
+
return mode.startState ? mode.startState(a1, a2) : true;
|
3357 |
+
}
|
3358 |
+
CodeMirror.startState = startState;
|
3359 |
+
|
3360 |
+
CodeMirror.innerMode = function(mode, state) {
|
3361 |
+
while (mode.innerMode) {
|
3362 |
+
var info = mode.innerMode(state);
|
3363 |
+
if (!info || info.mode == mode) break;
|
3364 |
+
state = info.state;
|
3365 |
+
mode = info.mode;
|
3366 |
+
}
|
3367 |
+
return info || {mode: mode, state: state};
|
3368 |
+
};
|
3369 |
+
|
3370 |
+
// STANDARD COMMANDS
|
3371 |
+
|
3372 |
+
var commands = CodeMirror.commands = {
|
3373 |
+
selectAll: function(cm) {cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()));},
|
3374 |
+
killLine: function(cm) {
|
3375 |
+
var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
|
3376 |
+
if (!sel && cm.getLine(from.line).length == from.ch)
|
3377 |
+
cm.replaceRange("", from, Pos(from.line + 1, 0), "+delete");
|
3378 |
+
else cm.replaceRange("", from, sel ? to : Pos(from.line), "+delete");
|
3379 |
+
},
|
3380 |
+
deleteLine: function(cm) {
|
3381 |
+
var l = cm.getCursor().line;
|
3382 |
+
cm.replaceRange("", Pos(l, 0), Pos(l), "+delete");
|
3383 |
+
},
|
3384 |
+
delLineLeft: function(cm) {
|
3385 |
+
var cur = cm.getCursor();
|
3386 |
+
cm.replaceRange("", Pos(cur.line, 0), cur, "+delete");
|
3387 |
+
},
|
3388 |
+
undo: function(cm) {cm.undo();},
|
3389 |
+
redo: function(cm) {cm.redo();},
|
3390 |
+
goDocStart: function(cm) {cm.extendSelection(Pos(cm.firstLine(), 0));},
|
3391 |
+
goDocEnd: function(cm) {cm.extendSelection(Pos(cm.lastLine()));},
|
3392 |
+
goLineStart: function(cm) {
|
3393 |
+
cm.extendSelection(lineStart(cm, cm.getCursor().line));
|
3394 |
+
},
|
3395 |
+
goLineStartSmart: function(cm) {
|
3396 |
+
var cur = cm.getCursor(), start = lineStart(cm, cur.line);
|
3397 |
+
var line = cm.getLineHandle(start.line);
|
3398 |
+
var order = getOrder(line);
|
3399 |
+
if (!order || order[0].level == 0) {
|
3400 |
+
var firstNonWS = Math.max(0, line.text.search(/\S/));
|
3401 |
+
var inWS = cur.line == start.line && cur.ch <= firstNonWS && cur.ch;
|
3402 |
+
cm.extendSelection(Pos(start.line, inWS ? 0 : firstNonWS));
|
3403 |
+
} else cm.extendSelection(start);
|
3404 |
+
},
|
3405 |
+
goLineEnd: function(cm) {
|
3406 |
+
cm.extendSelection(lineEnd(cm, cm.getCursor().line));
|
3407 |
+
},
|
3408 |
+
goLineRight: function(cm) {
|
3409 |
+
var top = cm.charCoords(cm.getCursor(), "div").top + 5;
|
3410 |
+
cm.extendSelection(cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div"));
|
3411 |
+
},
|
3412 |
+
goLineLeft: function(cm) {
|
3413 |
+
var top = cm.charCoords(cm.getCursor(), "div").top + 5;
|
3414 |
+
cm.extendSelection(cm.coordsChar({left: 0, top: top}, "div"));
|
3415 |
+
},
|
3416 |
+
goLineUp: function(cm) {cm.moveV(-1, "line");},
|
3417 |
+
goLineDown: function(cm) {cm.moveV(1, "line");},
|
3418 |
+
goPageUp: function(cm) {cm.moveV(-1, "page");},
|
3419 |
+
goPageDown: function(cm) {cm.moveV(1, "page");},
|
3420 |
+
goCharLeft: function(cm) {cm.moveH(-1, "char");},
|
3421 |
+
goCharRight: function(cm) {cm.moveH(1, "char");},
|
3422 |
+
goColumnLeft: function(cm) {cm.moveH(-1, "column");},
|
3423 |
+
goColumnRight: function(cm) {cm.moveH(1, "column");},
|
3424 |
+
goWordLeft: function(cm) {cm.moveH(-1, "word");},
|
3425 |
+
goGroupRight: function(cm) {cm.moveH(1, "group");},
|
3426 |
+
goGroupLeft: function(cm) {cm.moveH(-1, "group");},
|
3427 |
+
goWordRight: function(cm) {cm.moveH(1, "word");},
|
3428 |
+
delCharBefore: function(cm) {cm.deleteH(-1, "char");},
|
3429 |
+
delCharAfter: function(cm) {cm.deleteH(1, "char");},
|
3430 |
+
delWordBefore: function(cm) {cm.deleteH(-1, "word");},
|
3431 |
+
delWordAfter: function(cm) {cm.deleteH(1, "word");},
|
3432 |
+
delGroupBefore: function(cm) {cm.deleteH(-1, "group");},
|
3433 |
+
delGroupAfter: function(cm) {cm.deleteH(1, "group");},
|
3434 |
+
indentAuto: function(cm) {cm.indentSelection("smart");},
|
3435 |
+
indentMore: function(cm) {cm.indentSelection("add");},
|
3436 |
+
indentLess: function(cm) {cm.indentSelection("subtract");},
|
3437 |
+
insertTab: function(cm) {cm.replaceSelection("\t", "end", "+input");},
|
3438 |
+
defaultTab: function(cm) {
|
3439 |
+
if (cm.somethingSelected()) cm.indentSelection("add");
|
3440 |
+
else cm.replaceSelection("\t", "end", "+input");
|
3441 |
+
},
|
3442 |
+
transposeChars: function(cm) {
|
3443 |
+
var cur = cm.getCursor(), line = cm.getLine(cur.line);
|
3444 |
+
if (cur.ch > 0 && cur.ch < line.length - 1)
|
3445 |
+
cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
|
3446 |
+
Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
|
3447 |
+
},
|
3448 |
+
newlineAndIndent: function(cm) {
|
3449 |
+
operation(cm, function() {
|
3450 |
+
cm.replaceSelection("\n", "end", "+input");
|
3451 |
+
cm.indentLine(cm.getCursor().line, null, true);
|
3452 |
+
})();
|
3453 |
+
},
|
3454 |
+
toggleOverwrite: function(cm) {cm.toggleOverwrite();}
|
3455 |
+
};
|
3456 |
+
|
3457 |
+
// STANDARD KEYMAPS
|
3458 |
+
|
3459 |
+
var keyMap = CodeMirror.keyMap = {};
|
3460 |
+
keyMap.basic = {
|
3461 |
+
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
3462 |
+
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
3463 |
+
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
3464 |
+
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
|
3465 |
+
};
|
3466 |
+
// Note that the save and find-related commands aren't defined by
|
3467 |
+
// default. Unknown commands are simply ignored.
|
3468 |
+
keyMap.pcDefault = {
|
3469 |
+
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
3470 |
+
"Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
|
3471 |
+
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
3472 |
+
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
3473 |
+
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
3474 |
+
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
3475 |
+
fallthrough: "basic"
|
3476 |
+
};
|
3477 |
+
keyMap.macDefault = {
|
3478 |
+
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
|
3479 |
+
"Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
|
3480 |
+
"Alt-Right": "goGroupRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delGroupBefore",
|
3481 |
+
"Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
|
3482 |
+
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
3483 |
+
"Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delLineLeft",
|
3484 |
+
fallthrough: ["basic", "emacsy"]
|
3485 |
+
};
|
3486 |
+
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
|
3487 |
+
keyMap.emacsy = {
|
3488 |
+
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
3489 |
+
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
3490 |
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
|
3491 |
+
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
|
3492 |
+
};
|
3493 |
+
|
3494 |
+
// KEYMAP DISPATCH
|
3495 |
+
|
3496 |
+
function getKeyMap(val) {
|
3497 |
+
if (typeof val == "string") return keyMap[val];
|
3498 |
+
else return val;
|
3499 |
+
}
|
3500 |
+
|
3501 |
+
function lookupKey(name, maps, handle) {
|
3502 |
+
function lookup(map) {
|
3503 |
+
map = getKeyMap(map);
|
3504 |
+
var found = map[name];
|
3505 |
+
if (found === false) return "stop";
|
3506 |
+
if (found != null && handle(found)) return true;
|
3507 |
+
if (map.nofallthrough) return "stop";
|
3508 |
+
|
3509 |
+
var fallthrough = map.fallthrough;
|
3510 |
+
if (fallthrough == null) return false;
|
3511 |
+
if (Object.prototype.toString.call(fallthrough) != "[object Array]")
|
3512 |
+
return lookup(fallthrough);
|
3513 |
+
for (var i = 0, e = fallthrough.length; i < e; ++i) {
|
3514 |
+
var done = lookup(fallthrough[i]);
|
3515 |
+
if (done) return done;
|
3516 |
+
}
|
3517 |
+
return false;
|
3518 |
+
}
|
3519 |
+
|
3520 |
+
for (var i = 0; i < maps.length; ++i) {
|
3521 |
+
var done = lookup(maps[i]);
|
3522 |
+
if (done) return done != "stop";
|
3523 |
+
}
|
3524 |
+
}
|
3525 |
+
function isModifierKey(event) {
|
3526 |
+
var name = keyNames[event.keyCode];
|
3527 |
+
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
|
3528 |
+
}
|
3529 |
+
function keyName(event, noShift) {
|
3530 |
+
if (opera && event.keyCode == 34 && event["char"]) return false;
|
3531 |
+
var name = keyNames[event.keyCode];
|
3532 |
+
if (name == null || event.altGraphKey) return false;
|
3533 |
+
if (event.altKey) name = "Alt-" + name;
|
3534 |
+
if (flipCtrlCmd ? event.metaKey : event.ctrlKey) name = "Ctrl-" + name;
|
3535 |
+
if (flipCtrlCmd ? event.ctrlKey : event.metaKey) name = "Cmd-" + name;
|
3536 |
+
if (!noShift && event.shiftKey) name = "Shift-" + name;
|
3537 |
+
return name;
|
3538 |
+
}
|
3539 |
+
CodeMirror.lookupKey = lookupKey;
|
3540 |
+
CodeMirror.isModifierKey = isModifierKey;
|
3541 |
+
CodeMirror.keyName = keyName;
|
3542 |
+
|
3543 |
+
// FROMTEXTAREA
|
3544 |
+
|
3545 |
+
CodeMirror.fromTextArea = function(textarea, options) {
|
3546 |
+
if (!options) options = {};
|
3547 |
+
options.value = textarea.value;
|
3548 |
+
if (!options.tabindex && textarea.tabindex)
|
3549 |
+
options.tabindex = textarea.tabindex;
|
3550 |
+
if (!options.placeholder && textarea.placeholder)
|
3551 |
+
options.placeholder = textarea.placeholder;
|
3552 |
+
// Set autofocus to true if this textarea is focused, or if it has
|
3553 |
+
// autofocus and no other element is focused.
|
3554 |
+
if (options.autofocus == null) {
|
3555 |
+
var hasFocus = document.body;
|
3556 |
+
// doc.activeElement occasionally throws on IE
|
3557 |
+
try { hasFocus = document.activeElement; } catch(e) {}
|
3558 |
+
options.autofocus = hasFocus == textarea ||
|
3559 |
+
textarea.getAttribute("autofocus") != null && hasFocus == document.body;
|
3560 |
+
}
|
3561 |
+
|
3562 |
+
function save() {textarea.value = cm.getValue();}
|
3563 |
+
if (textarea.form) {
|
3564 |
+
on(textarea.form, "submit", save);
|
3565 |
+
// Deplorable hack to make the submit method do the right thing.
|
3566 |
+
if (!options.leaveSubmitMethodAlone) {
|
3567 |
+
var form = textarea.form, realSubmit = form.submit;
|
3568 |
+
try {
|
3569 |
+
var wrappedSubmit = form.submit = function() {
|
3570 |
+
save();
|
3571 |
+
form.submit = realSubmit;
|
3572 |
+
form.submit();
|
3573 |
+
form.submit = wrappedSubmit;
|
3574 |
+
};
|
3575 |
+
} catch(e) {}
|
3576 |
+
}
|
3577 |
+
}
|
3578 |
+
|
3579 |
+
textarea.style.display = "none";
|
3580 |
+
var cm = CodeMirror(function(node) {
|
3581 |
+
textarea.parentNode.insertBefore(node, textarea.nextSibling);
|
3582 |
+
}, options);
|
3583 |
+
cm.save = save;
|
3584 |
+
cm.getTextArea = function() { return textarea; };
|
3585 |
+
cm.toTextArea = function() {
|
3586 |
+
save();
|
3587 |
+
textarea.parentNode.removeChild(cm.getWrapperElement());
|
3588 |
+
textarea.style.display = "";
|
3589 |
+
if (textarea.form) {
|
3590 |
+
off(textarea.form, "submit", save);
|
3591 |
+
if (typeof textarea.form.submit == "function")
|
3592 |
+
textarea.form.submit = realSubmit;
|
3593 |
+
}
|
3594 |
+
};
|
3595 |
+
return cm;
|
3596 |
+
};
|
3597 |
+
|
3598 |
+
// STRING STREAM
|
3599 |
+
|
3600 |
+
// Fed to the mode parsers, provides helper functions to make
|
3601 |
+
// parsers more succinct.
|
3602 |
+
|
3603 |
+
// The character stream used by a mode's parser.
|
3604 |
+
function StringStream(string, tabSize) {
|
3605 |
+
this.pos = this.start = 0;
|
3606 |
+
this.string = string;
|
3607 |
+
this.tabSize = tabSize || 8;
|
3608 |
+
this.lastColumnPos = this.lastColumnValue = 0;
|
3609 |
+
}
|
3610 |
+
|
3611 |
+
StringStream.prototype = {
|
3612 |
+
eol: function() {return this.pos >= this.string.length;},
|
3613 |
+
sol: function() {return this.pos == 0;},
|
3614 |
+
peek: function() {return this.string.charAt(this.pos) || undefined;},
|
3615 |
+
next: function() {
|
3616 |
+
if (this.pos < this.string.length)
|
3617 |
+
return this.string.charAt(this.pos++);
|
3618 |
+
},
|
3619 |
+
eat: function(match) {
|
3620 |
+
var ch = this.string.charAt(this.pos);
|
3621 |
+
if (typeof match == "string") var ok = ch == match;
|
3622 |
+
else var ok = ch && (match.test ? match.test(ch) : match(ch));
|
3623 |
+
if (ok) {++this.pos; return ch;}
|
3624 |
+
},
|
3625 |
+
eatWhile: function(match) {
|
3626 |
+
var start = this.pos;
|
3627 |
+
while (this.eat(match)){}
|
3628 |
+
return this.pos > start;
|
3629 |
+
},
|
3630 |
+
eatSpace: function() {
|
3631 |
+
var start = this.pos;
|
3632 |
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
|
3633 |
+
return this.pos > start;
|
3634 |
+
},
|
3635 |
+
skipToEnd: function() {this.pos = this.string.length;},
|
3636 |
+
skipTo: function(ch) {
|
3637 |
+
var found = this.string.indexOf(ch, this.pos);
|
3638 |
+
if (found > -1) {this.pos = found; return true;}
|
3639 |
+
},
|
3640 |
+
backUp: function(n) {this.pos -= n;},
|
3641 |
+
column: function() {
|
3642 |
+
if (this.lastColumnPos < this.start) {
|
3643 |
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
3644 |
+
this.lastColumnPos = this.start;
|
3645 |
+
}
|
3646 |
+
return this.lastColumnValue;
|
3647 |
+
},
|
3648 |
+
indentation: function() {return countColumn(this.string, null, this.tabSize);},
|
3649 |
+
match: function(pattern, consume, caseInsensitive) {
|
3650 |
+
if (typeof pattern == "string") {
|
3651 |
+
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
|
3652 |
+
var substr = this.string.substr(this.pos, pattern.length);
|
3653 |
+
if (cased(substr) == cased(pattern)) {
|
3654 |
+
if (consume !== false) this.pos += pattern.length;
|
3655 |
+
return true;
|
3656 |
+
}
|
3657 |
+
} else {
|
3658 |
+
var match = this.string.slice(this.pos).match(pattern);
|
3659 |
+
if (match && match.index > 0) return null;
|
3660 |
+
if (match && consume !== false) this.pos += match[0].length;
|
3661 |
+
return match;
|
3662 |
+
}
|
3663 |
+
},
|
3664 |
+
current: function(){return this.string.slice(this.start, this.pos);}
|
3665 |
+
};
|
3666 |
+
CodeMirror.StringStream = StringStream;
|
3667 |
+
|
3668 |
+
// TEXTMARKERS
|
3669 |
+
|
3670 |
+
function TextMarker(doc, type) {
|
3671 |
+
this.lines = [];
|
3672 |
+
this.type = type;
|
3673 |
+
this.doc = doc;
|
3674 |
+
}
|
3675 |
+
CodeMirror.TextMarker = TextMarker;
|
3676 |
+
eventMixin(TextMarker);
|
3677 |
+
|
3678 |
+
TextMarker.prototype.clear = function() {
|
3679 |
+
if (this.explicitlyCleared) return;
|
3680 |
+
var cm = this.doc.cm, withOp = cm && !cm.curOp;
|
3681 |
+
if (withOp) startOperation(cm);
|
3682 |
+
if (hasHandler(this, "clear")) {
|
3683 |
+
var found = this.find();
|
3684 |
+
if (found) signalLater(this, "clear", found.from, found.to);
|
3685 |
+
}
|
3686 |
+
var min = null, max = null;
|
3687 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
3688 |
+
var line = this.lines[i];
|
3689 |
+
var span = getMarkedSpanFor(line.markedSpans, this);
|
3690 |
+
if (span.to != null) max = lineNo(line);
|
3691 |
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span);
|
3692 |
+
if (span.from != null)
|
3693 |
+
min = lineNo(line);
|
3694 |
+
else if (this.collapsed && !lineIsHidden(this.doc, line) && cm)
|
3695 |
+
updateLineHeight(line, textHeight(cm.display));
|
3696 |
+
}
|
3697 |
+
if (cm && this.collapsed && !cm.options.lineWrapping) for (var i = 0; i < this.lines.length; ++i) {
|
3698 |
+
var visual = visualLine(cm.doc, this.lines[i]), len = lineLength(cm.doc, visual);
|
3699 |
+
if (len > cm.display.maxLineLength) {
|
3700 |
+
cm.display.maxLine = visual;
|
3701 |
+
cm.display.maxLineLength = len;
|
3702 |
+
cm.display.maxLineChanged = true;
|
3703 |
+
}
|
3704 |
+
}
|
3705 |
+
|
3706 |
+
if (min != null && cm) regChange(cm, min, max + 1);
|
3707 |
+
this.lines.length = 0;
|
3708 |
+
this.explicitlyCleared = true;
|
3709 |
+
if (this.atomic && this.doc.cantEdit) {
|
3710 |
+
this.doc.cantEdit = false;
|
3711 |
+
if (cm) reCheckSelection(cm);
|
3712 |
+
}
|
3713 |
+
if (withOp) endOperation(cm);
|
3714 |
+
};
|
3715 |
+
|
3716 |
+
TextMarker.prototype.find = function() {
|
3717 |
+
var from, to;
|
3718 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
3719 |
+
var line = this.lines[i];
|
3720 |
+
var span = getMarkedSpanFor(line.markedSpans, this);
|
3721 |
+
if (span.from != null || span.to != null) {
|
3722 |
+
var found = lineNo(line);
|
3723 |
+
if (span.from != null) from = Pos(found, span.from);
|
3724 |
+
if (span.to != null) to = Pos(found, span.to);
|
3725 |
+
}
|
3726 |
+
}
|
3727 |
+
if (this.type == "bookmark") return from;
|
3728 |
+
return from && {from: from, to: to};
|
3729 |
+
};
|
3730 |
+
|
3731 |
+
TextMarker.prototype.changed = function() {
|
3732 |
+
var pos = this.find(), cm = this.doc.cm;
|
3733 |
+
if (!pos || !cm) return;
|
3734 |
+
var line = getLine(this.doc, pos.from.line);
|
3735 |
+
clearCachedMeasurement(cm, line);
|
3736 |
+
if (pos.from.line >= cm.display.showingFrom && pos.from.line < cm.display.showingTo) {
|
3737 |
+
for (var node = cm.display.lineDiv.firstChild; node; node = node.nextSibling) if (node.lineObj == line) {
|
3738 |
+
if (node.offsetHeight != line.height) updateLineHeight(line, node.offsetHeight);
|
3739 |
+
break;
|
3740 |
+
}
|
3741 |
+
runInOp(cm, function() {
|
3742 |
+
cm.curOp.selectionChanged = cm.curOp.forceUpdate = cm.curOp.updateMaxLine = true;
|
3743 |
+
});
|
3744 |
+
}
|
3745 |
+
};
|
3746 |
+
|
3747 |
+
TextMarker.prototype.attachLine = function(line) {
|
3748 |
+
if (!this.lines.length && this.doc.cm) {
|
3749 |
+
var op = this.doc.cm.curOp;
|
3750 |
+
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
3751 |
+
(op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);
|
3752 |
+
}
|
3753 |
+
this.lines.push(line);
|
3754 |
+
};
|
3755 |
+
TextMarker.prototype.detachLine = function(line) {
|
3756 |
+
this.lines.splice(indexOf(this.lines, line), 1);
|
3757 |
+
if (!this.lines.length && this.doc.cm) {
|
3758 |
+
var op = this.doc.cm.curOp;
|
3759 |
+
(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
|
3760 |
+
}
|
3761 |
+
};
|
3762 |
+
|
3763 |
+
function markText(doc, from, to, options, type) {
|
3764 |
+
if (options && options.shared) return markTextShared(doc, from, to, options, type);
|
3765 |
+
if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);
|
3766 |
+
|
3767 |
+
var marker = new TextMarker(doc, type);
|
3768 |
+
if (type == "range" && !posLess(from, to)) return marker;
|
3769 |
+
if (options) copyObj(options, marker);
|
3770 |
+
if (marker.replacedWith) {
|
3771 |
+
marker.collapsed = true;
|
3772 |
+
marker.replacedWith = elt("span", [marker.replacedWith], "CodeMirror-widget");
|
3773 |
+
if (!options.handleMouseEvents) marker.replacedWith.ignoreEvents = true;
|
3774 |
+
}
|
3775 |
+
if (marker.collapsed) sawCollapsedSpans = true;
|
3776 |
+
|
3777 |
+
if (marker.addToHistory)
|
3778 |
+
addToHistory(doc, {from: from, to: to, origin: "markText"},
|
3779 |
+
{head: doc.sel.head, anchor: doc.sel.anchor}, NaN);
|
3780 |
+
|
3781 |
+
var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd, cm = doc.cm, updateMaxLine;
|
3782 |
+
doc.iter(curLine, to.line + 1, function(line) {
|
3783 |
+
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(doc, line) == cm.display.maxLine)
|
3784 |
+
updateMaxLine = true;
|
3785 |
+
var span = {from: null, to: null, marker: marker};
|
3786 |
+
size += line.text.length;
|
3787 |
+
if (curLine == from.line) {span.from = from.ch; size -= from.ch;}
|
3788 |
+
if (curLine == to.line) {span.to = to.ch; size -= line.text.length - to.ch;}
|
3789 |
+
if (marker.collapsed) {
|
3790 |
+
if (curLine == to.line) collapsedAtEnd = collapsedSpanAt(line, to.ch);
|
3791 |
+
if (curLine == from.line) collapsedAtStart = collapsedSpanAt(line, from.ch);
|
3792 |
+
else updateLineHeight(line, 0);
|
3793 |
+
}
|
3794 |
+
addMarkedSpan(line, span);
|
3795 |
+
++curLine;
|
3796 |
+
});
|
3797 |
+
if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {
|
3798 |
+
if (lineIsHidden(doc, line)) updateLineHeight(line, 0);
|
3799 |
+
});
|
3800 |
+
|
3801 |
+
if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); });
|
3802 |
+
|
3803 |
+
if (marker.readOnly) {
|
3804 |
+
sawReadOnlySpans = true;
|
3805 |
+
if (doc.history.done.length || doc.history.undone.length)
|
3806 |
+
doc.clearHistory();
|
3807 |
+
}
|
3808 |
+
if (marker.collapsed) {
|
3809 |
+
if (collapsedAtStart != collapsedAtEnd)
|
3810 |
+
throw new Error("Inserting collapsed marker overlapping an existing one");
|
3811 |
+
marker.size = size;
|
3812 |
+
marker.atomic = true;
|
3813 |
+
}
|
3814 |
+
if (cm) {
|
3815 |
+
if (updateMaxLine) cm.curOp.updateMaxLine = true;
|
3816 |
+
if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.collapsed)
|
3817 |
+
regChange(cm, from.line, to.line + 1);
|
3818 |
+
if (marker.atomic) reCheckSelection(cm);
|
3819 |
+
}
|
3820 |
+
return marker;
|
3821 |
+
}
|
3822 |
+
|
3823 |
+
// SHARED TEXTMARKERS
|
3824 |
+
|
3825 |
+
function SharedTextMarker(markers, primary) {
|
3826 |
+
this.markers = markers;
|
3827 |
+
this.primary = primary;
|
3828 |
+
for (var i = 0, me = this; i < markers.length; ++i) {
|
3829 |
+
markers[i].parent = this;
|
3830 |
+
on(markers[i], "clear", function(){me.clear();});
|
3831 |
+
}
|
3832 |
+
}
|
3833 |
+
CodeMirror.SharedTextMarker = SharedTextMarker;
|
3834 |
+
eventMixin(SharedTextMarker);
|
3835 |
+
|
3836 |
+
SharedTextMarker.prototype.clear = function() {
|
3837 |
+
if (this.explicitlyCleared) return;
|
3838 |
+
this.explicitlyCleared = true;
|
3839 |
+
for (var i = 0; i < this.markers.length; ++i)
|
3840 |
+
this.markers[i].clear();
|
3841 |
+
signalLater(this, "clear");
|
3842 |
+
};
|
3843 |
+
SharedTextMarker.prototype.find = function() {
|
3844 |
+
return this.primary.find();
|
3845 |
+
};
|
3846 |
+
|
3847 |
+
function markTextShared(doc, from, to, options, type) {
|
3848 |
+
options = copyObj(options);
|
3849 |
+
options.shared = false;
|
3850 |
+
var markers = [markText(doc, from, to, options, type)], primary = markers[0];
|
3851 |
+
var widget = options.replacedWith;
|
3852 |
+
linkedDocs(doc, function(doc) {
|
3853 |
+
if (widget) options.replacedWith = widget.cloneNode(true);
|
3854 |
+
markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
|
3855 |
+
for (var i = 0; i < doc.linked.length; ++i)
|
3856 |
+
if (doc.linked[i].isParent) return;
|
3857 |
+
primary = lst(markers);
|
3858 |
+
});
|
3859 |
+
return new SharedTextMarker(markers, primary);
|
3860 |
+
}
|
3861 |
+
|
3862 |
+
// TEXTMARKER SPANS
|
3863 |
+
|
3864 |
+
function getMarkedSpanFor(spans, marker) {
|
3865 |
+
if (spans) for (var i = 0; i < spans.length; ++i) {
|
3866 |
+
var span = spans[i];
|
3867 |
+
if (span.marker == marker) return span;
|
3868 |
+
}
|
3869 |
+
}
|
3870 |
+
function removeMarkedSpan(spans, span) {
|
3871 |
+
for (var r, i = 0; i < spans.length; ++i)
|
3872 |
+
if (spans[i] != span) (r || (r = [])).push(spans[i]);
|
3873 |
+
return r;
|
3874 |
+
}
|
3875 |
+
function addMarkedSpan(line, span) {
|
3876 |
+
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
|
3877 |
+
span.marker.attachLine(line);
|
3878 |
+
}
|
3879 |
+
|
3880 |
+
function markedSpansBefore(old, startCh, isInsert) {
|
3881 |
+
if (old) for (var i = 0, nw; i < old.length; ++i) {
|
3882 |
+
var span = old[i], marker = span.marker;
|
3883 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
|
3884 |
+
if (startsBefore || marker.type == "bookmark" && span.from == startCh && (!isInsert || !span.marker.insertLeft)) {
|
3885 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
|
3886 |
+
(nw || (nw = [])).push({from: span.from,
|
3887 |
+
to: endsAfter ? null : span.to,
|
3888 |
+
marker: marker});
|
3889 |
+
}
|
3890 |
+
}
|
3891 |
+
return nw;
|
3892 |
+
}
|
3893 |
+
|
3894 |
+
function markedSpansAfter(old, endCh, isInsert) {
|
3895 |
+
if (old) for (var i = 0, nw; i < old.length; ++i) {
|
3896 |
+
var span = old[i], marker = span.marker;
|
3897 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
|
3898 |
+
if (endsAfter || marker.type == "bookmark" && span.from == endCh && (!isInsert || span.marker.insertLeft)) {
|
3899 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
|
3900 |
+
(nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
|
3901 |
+
to: span.to == null ? null : span.to - endCh,
|
3902 |
+
marker: marker});
|
3903 |
+
}
|
3904 |
+
}
|
3905 |
+
return nw;
|
3906 |
+
}
|
3907 |
+
|
3908 |
+
function stretchSpansOverChange(doc, change) {
|
3909 |
+
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
|
3910 |
+
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
|
3911 |
+
if (!oldFirst && !oldLast) return null;
|
3912 |
+
|
3913 |
+
var startCh = change.from.ch, endCh = change.to.ch, isInsert = posEq(change.from, change.to);
|
3914 |
+
// Get the spans that 'stick out' on both sides
|
3915 |
+
var first = markedSpansBefore(oldFirst, startCh, isInsert);
|
3916 |
+
var last = markedSpansAfter(oldLast, endCh, isInsert);
|
3917 |
+
|
3918 |
+
// Next, merge those two ends
|
3919 |
+
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
|
3920 |
+
if (first) {
|
3921 |
+
// Fix up .to properties of first
|
3922 |
+
for (var i = 0; i < first.length; ++i) {
|
3923 |
+
var span = first[i];
|
3924 |
+
if (span.to == null) {
|
3925 |
+
var found = getMarkedSpanFor(last, span.marker);
|
3926 |
+
if (!found) span.to = startCh;
|
3927 |
+
else if (sameLine) span.to = found.to == null ? null : found.to + offset;
|
3928 |
+
}
|
3929 |
+
}
|
3930 |
+
}
|
3931 |
+
if (last) {
|
3932 |
+
// Fix up .from in last (or move them into first in case of sameLine)
|
3933 |
+
for (var i = 0; i < last.length; ++i) {
|
3934 |
+
var span = last[i];
|
3935 |
+
if (span.to != null) span.to += offset;
|
3936 |
+
if (span.from == null) {
|
3937 |
+
var found = getMarkedSpanFor(first, span.marker);
|
3938 |
+
if (!found) {
|
3939 |
+
span.from = offset;
|
3940 |
+
if (sameLine) (first || (first = [])).push(span);
|
3941 |
+
}
|
3942 |
+
} else {
|
3943 |
+
span.from += offset;
|
3944 |
+
if (sameLine) (first || (first = [])).push(span);
|
3945 |
+
}
|
3946 |
+
}
|
3947 |
+
}
|
3948 |
+
if (sameLine && first) {
|
3949 |
+
// Make sure we didn't create any zero-length spans
|
3950 |
+
for (var i = 0; i < first.length; ++i)
|
3951 |
+
if (first[i].from != null && first[i].from == first[i].to && first[i].marker.type != "bookmark")
|
3952 |
+
first.splice(i--, 1);
|
3953 |
+
if (!first.length) first = null;
|
3954 |
+
}
|
3955 |
+
|
3956 |
+
var newMarkers = [first];
|
3957 |
+
if (!sameLine) {
|
3958 |
+
// Fill gap with whole-line-spans
|
3959 |
+
var gap = change.text.length - 2, gapMarkers;
|
3960 |
+
if (gap > 0 && first)
|
3961 |
+
for (var i = 0; i < first.length; ++i)
|
3962 |
+
if (first[i].to == null)
|
3963 |
+
(gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker});
|
3964 |
+
for (var i = 0; i < gap; ++i)
|
3965 |
+
newMarkers.push(gapMarkers);
|
3966 |
+
newMarkers.push(last);
|
3967 |
+
}
|
3968 |
+
return newMarkers;
|
3969 |
+
}
|
3970 |
+
|
3971 |
+
function mergeOldSpans(doc, change) {
|
3972 |
+
var old = getOldSpans(doc, change);
|
3973 |
+
var stretched = stretchSpansOverChange(doc, change);
|
3974 |
+
if (!old) return stretched;
|
3975 |
+
if (!stretched) return old;
|
3976 |
+
|
3977 |
+
for (var i = 0; i < old.length; ++i) {
|
3978 |
+
var oldCur = old[i], stretchCur = stretched[i];
|
3979 |
+
if (oldCur && stretchCur) {
|
3980 |
+
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
3981 |
+
var span = stretchCur[j];
|
3982 |
+
for (var k = 0; k < oldCur.length; ++k)
|
3983 |
+
if (oldCur[k].marker == span.marker) continue spans;
|
3984 |
+
oldCur.push(span);
|
3985 |
+
}
|
3986 |
+
} else if (stretchCur) {
|
3987 |
+
old[i] = stretchCur;
|
3988 |
+
}
|
3989 |
+
}
|
3990 |
+
return old;
|
3991 |
+
}
|
3992 |
+
|
3993 |
+
function removeReadOnlyRanges(doc, from, to) {
|
3994 |
+
var markers = null;
|
3995 |
+
doc.iter(from.line, to.line + 1, function(line) {
|
3996 |
+
if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
|
3997 |
+
var mark = line.markedSpans[i].marker;
|
3998 |
+
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
3999 |
+
(markers || (markers = [])).push(mark);
|
4000 |
+
}
|
4001 |
+
});
|
4002 |
+
if (!markers) return null;
|
4003 |
+
var parts = [{from: from, to: to}];
|
4004 |
+
for (var i = 0; i < markers.length; ++i) {
|
4005 |
+
var mk = markers[i], m = mk.find();
|
4006 |
+
for (var j = 0; j < parts.length; ++j) {
|
4007 |
+
var p = parts[j];
|
4008 |
+
if (posLess(p.to, m.from) || posLess(m.to, p.from)) continue;
|
4009 |
+
var newParts = [j, 1];
|
4010 |
+
if (posLess(p.from, m.from) || !mk.inclusiveLeft && posEq(p.from, m.from))
|
4011 |
+
newParts.push({from: p.from, to: m.from});
|
4012 |
+
if (posLess(m.to, p.to) || !mk.inclusiveRight && posEq(p.to, m.to))
|
4013 |
+
newParts.push({from: m.to, to: p.to});
|
4014 |
+
parts.splice.apply(parts, newParts);
|
4015 |
+
j += newParts.length - 1;
|
4016 |
+
}
|
4017 |
+
}
|
4018 |
+
return parts;
|
4019 |
+
}
|
4020 |
+
|
4021 |
+
function collapsedSpanAt(line, ch) {
|
4022 |
+
var sps = sawCollapsedSpans && line.markedSpans, found;
|
4023 |
+
if (sps) for (var sp, i = 0; i < sps.length; ++i) {
|
4024 |
+
sp = sps[i];
|
4025 |
+
if (!sp.marker.collapsed) continue;
|
4026 |
+
if ((sp.from == null || sp.from < ch) &&
|
4027 |
+
(sp.to == null || sp.to > ch) &&
|
4028 |
+
(!found || found.width < sp.marker.width))
|
4029 |
+
found = sp.marker;
|
4030 |
+
}
|
4031 |
+
return found;
|
4032 |
+
}
|
4033 |
+
function collapsedSpanAtStart(line) { return collapsedSpanAt(line, -1); }
|
4034 |
+
function collapsedSpanAtEnd(line) { return collapsedSpanAt(line, line.text.length + 1); }
|
4035 |
+
|
4036 |
+
function visualLine(doc, line) {
|
4037 |
+
var merged;
|
4038 |
+
while (merged = collapsedSpanAtStart(line))
|
4039 |
+
line = getLine(doc, merged.find().from.line);
|
4040 |
+
return line;
|
4041 |
+
}
|
4042 |
+
|
4043 |
+
function lineIsHidden(doc, line) {
|
4044 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
4045 |
+
if (sps) for (var sp, i = 0; i < sps.length; ++i) {
|
4046 |
+
sp = sps[i];
|
4047 |
+
if (!sp.marker.collapsed) continue;
|
4048 |
+
if (sp.from == null) return true;
|
4049 |
+
if (sp.marker.replacedWith) continue;
|
4050 |
+
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
4051 |
+
return true;
|
4052 |
+
}
|
4053 |
+
}
|
4054 |
+
function lineIsHiddenInner(doc, line, span) {
|
4055 |
+
if (span.to == null) {
|
4056 |
+
var end = span.marker.find().to, endLine = getLine(doc, end.line);
|
4057 |
+
return lineIsHiddenInner(doc, endLine, getMarkedSpanFor(endLine.markedSpans, span.marker));
|
4058 |
+
}
|
4059 |
+
if (span.marker.inclusiveRight && span.to == line.text.length)
|
4060 |
+
return true;
|
4061 |
+
for (var sp, i = 0; i < line.markedSpans.length; ++i) {
|
4062 |
+
sp = line.markedSpans[i];
|
4063 |
+
if (sp.marker.collapsed && !sp.marker.replacedWith && sp.from == span.to &&
|
4064 |
+
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
4065 |
+
lineIsHiddenInner(doc, line, sp)) return true;
|
4066 |
+
}
|
4067 |
+
}
|
4068 |
+
|
4069 |
+
function detachMarkedSpans(line) {
|
4070 |
+
var spans = line.markedSpans;
|
4071 |
+
if (!spans) return;
|
4072 |
+
for (var i = 0; i < spans.length; ++i)
|
4073 |
+
spans[i].marker.detachLine(line);
|
4074 |
+
line.markedSpans = null;
|
4075 |
+
}
|
4076 |
+
|
4077 |
+
function attachMarkedSpans(line, spans) {
|
4078 |
+
if (!spans) return;
|
4079 |
+
for (var i = 0; i < spans.length; ++i)
|
4080 |
+
spans[i].marker.attachLine(line);
|
4081 |
+
line.markedSpans = spans;
|
4082 |
+
}
|
4083 |
+
|
4084 |
+
// LINE WIDGETS
|
4085 |
+
|
4086 |
+
var LineWidget = CodeMirror.LineWidget = function(cm, node, options) {
|
4087 |
+
if (options) for (var opt in options) if (options.hasOwnProperty(opt))
|
4088 |
+
this[opt] = options[opt];
|
4089 |
+
this.cm = cm;
|
4090 |
+
this.node = node;
|
4091 |
+
};
|
4092 |
+
eventMixin(LineWidget);
|
4093 |
+
function widgetOperation(f) {
|
4094 |
+
return function() {
|
4095 |
+
var withOp = !this.cm.curOp;
|
4096 |
+
if (withOp) startOperation(this.cm);
|
4097 |
+
try {var result = f.apply(this, arguments);}
|
4098 |
+
finally {if (withOp) endOperation(this.cm);}
|
4099 |
+
return result;
|
4100 |
+
};
|
4101 |
+
}
|
4102 |
+
LineWidget.prototype.clear = widgetOperation(function() {
|
4103 |
+
var ws = this.line.widgets, no = lineNo(this.line);
|
4104 |
+
if (no == null || !ws) return;
|
4105 |
+
for (var i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1);
|
4106 |
+
if (!ws.length) this.line.widgets = null;
|
4107 |
+
var aboveVisible = heightAtLine(this.cm, this.line) < this.cm.doc.scrollTop;
|
4108 |
+
updateLineHeight(this.line, Math.max(0, this.line.height - widgetHeight(this)));
|
4109 |
+
if (aboveVisible) addToScrollPos(this.cm, 0, -this.height);
|
4110 |
+
regChange(this.cm, no, no + 1);
|
4111 |
+
});
|
4112 |
+
LineWidget.prototype.changed = widgetOperation(function() {
|
4113 |
+
var oldH = this.height;
|
4114 |
+
this.height = null;
|
4115 |
+
var diff = widgetHeight(this) - oldH;
|
4116 |
+
if (!diff) return;
|
4117 |
+
updateLineHeight(this.line, this.line.height + diff);
|
4118 |
+
var no = lineNo(this.line);
|
4119 |
+
regChange(this.cm, no, no + 1);
|
4120 |
+
});
|
4121 |
+
|
4122 |
+
function widgetHeight(widget) {
|
4123 |
+
if (widget.height != null) return widget.height;
|
4124 |
+
if (!widget.node.parentNode || widget.node.parentNode.nodeType != 1)
|
4125 |
+
removeChildrenAndAdd(widget.cm.display.measure, elt("div", [widget.node], null, "position: relative"));
|
4126 |
+
return widget.height = widget.node.offsetHeight;
|
4127 |
+
}
|
4128 |
+
|
4129 |
+
function addLineWidget(cm, handle, node, options) {
|
4130 |
+
var widget = new LineWidget(cm, node, options);
|
4131 |
+
if (widget.noHScroll) cm.display.alignWidgets = true;
|
4132 |
+
changeLine(cm, handle, function(line) {
|
4133 |
+
var widgets = line.widgets || (line.widgets = []);
|
4134 |
+
if (widget.insertAt == null) widgets.push(widget);
|
4135 |
+
else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);
|
4136 |
+
widget.line = line;
|
4137 |
+
if (!lineIsHidden(cm.doc, line) || widget.showIfHidden) {
|
4138 |
+
var aboveVisible = heightAtLine(cm, line) < cm.doc.scrollTop;
|
4139 |
+
updateLineHeight(line, line.height + widgetHeight(widget));
|
4140 |
+
if (aboveVisible) addToScrollPos(cm, 0, widget.height);
|
4141 |
+
}
|
4142 |
+
return true;
|
4143 |
+
});
|
4144 |
+
return widget;
|
4145 |
+
}
|
4146 |
+
|
4147 |
+
// LINE DATA STRUCTURE
|
4148 |
+
|
4149 |
+
// Line objects. These hold state related to a line, including
|
4150 |
+
// highlighting info (the styles array).
|
4151 |
+
var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {
|
4152 |
+
this.text = text;
|
4153 |
+
attachMarkedSpans(this, markedSpans);
|
4154 |
+
this.height = estimateHeight ? estimateHeight(this) : 1;
|
4155 |
+
};
|
4156 |
+
eventMixin(Line);
|
4157 |
+
|
4158 |
+
function updateLine(line, text, markedSpans, estimateHeight) {
|
4159 |
+
line.text = text;
|
4160 |
+
if (line.stateAfter) line.stateAfter = null;
|
4161 |
+
if (line.styles) line.styles = null;
|
4162 |
+
if (line.order != null) line.order = null;
|
4163 |
+
detachMarkedSpans(line);
|
4164 |
+
attachMarkedSpans(line, markedSpans);
|
4165 |
+
var estHeight = estimateHeight ? estimateHeight(line) : 1;
|
4166 |
+
if (estHeight != line.height) updateLineHeight(line, estHeight);
|
4167 |
+
}
|
4168 |
+
|
4169 |
+
function cleanUpLine(line) {
|
4170 |
+
line.parent = null;
|
4171 |
+
detachMarkedSpans(line);
|
4172 |
+
}
|
4173 |
+
|
4174 |
+
// Run the given mode's parser over a line, update the styles
|
4175 |
+
// array, which contains alternating fragments of text and CSS
|
4176 |
+
// classes.
|
4177 |
+
function runMode(cm, text, mode, state, f) {
|
4178 |
+
var flattenSpans = mode.flattenSpans;
|
4179 |
+
if (flattenSpans == null) flattenSpans = cm.options.flattenSpans;
|
4180 |
+
var curStart = 0, curStyle = null;
|
4181 |
+
var stream = new StringStream(text, cm.options.tabSize), style;
|
4182 |
+
if (text == "" && mode.blankLine) mode.blankLine(state);
|
4183 |
+
while (!stream.eol()) {
|
4184 |
+
if (stream.pos > cm.options.maxHighlightLength) {
|
4185 |
+
flattenSpans = false;
|
4186 |
+
// Webkit seems to refuse to render text nodes longer than 57444 characters
|
4187 |
+
stream.pos = Math.min(text.length, stream.start + 50000);
|
4188 |
+
style = null;
|
4189 |
+
} else {
|
4190 |
+
style = mode.token(stream, state);
|
4191 |
+
}
|
4192 |
+
if (!flattenSpans || curStyle != style) {
|
4193 |
+
if (curStart < stream.start) f(stream.start, curStyle);
|
4194 |
+
curStart = stream.start; curStyle = style;
|
4195 |
+
}
|
4196 |
+
stream.start = stream.pos;
|
4197 |
+
}
|
4198 |
+
if (curStart < stream.pos) f(stream.pos, curStyle);
|
4199 |
+
}
|
4200 |
+
|
4201 |
+
function highlightLine(cm, line, state) {
|
4202 |
+
// A styles array always starts with a number identifying the
|
4203 |
+
// mode/overlays that it is based on (for easy invalidation).
|
4204 |
+
var st = [cm.state.modeGen];
|
4205 |
+
// Compute the base array of styles
|
4206 |
+
runMode(cm, line.text, cm.doc.mode, state, function(end, style) {st.push(end, style);});
|
4207 |
+
|
4208 |
+
// Run overlays, adjust style array.
|
4209 |
+
for (var o = 0; o < cm.state.overlays.length; ++o) {
|
4210 |
+
var overlay = cm.state.overlays[o], i = 1, at = 0;
|
4211 |
+
runMode(cm, line.text, overlay.mode, true, function(end, style) {
|
4212 |
+
var start = i;
|
4213 |
+
// Ensure there's a token end at the current position, and that i points at it
|
4214 |
+
while (at < end) {
|
4215 |
+
var i_end = st[i];
|
4216 |
+
if (i_end > end)
|
4217 |
+
st.splice(i, 1, end, st[i+1], i_end);
|
4218 |
+
i += 2;
|
4219 |
+
at = Math.min(end, i_end);
|
4220 |
+
}
|
4221 |
+
if (!style) return;
|
4222 |
+
if (overlay.opaque) {
|
4223 |
+
st.splice(start, i - start, end, style);
|
4224 |
+
i = start + 2;
|
4225 |
+
} else {
|
4226 |
+
for (; start < i; start += 2) {
|
4227 |
+
var cur = st[start+1];
|
4228 |
+
st[start+1] = cur ? cur + " " + style : style;
|
4229 |
+
}
|
4230 |
+
}
|
4231 |
+
});
|
4232 |
+
}
|
4233 |
+
|
4234 |
+
return st;
|
4235 |
+
}
|
4236 |
+
|
4237 |
+
function getLineStyles(cm, line) {
|
4238 |
+
if (!line.styles || line.styles[0] != cm.state.modeGen)
|
4239 |
+
line.styles = highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line)));
|
4240 |
+
return line.styles;
|
4241 |
+
}
|
4242 |
+
|
4243 |
+
// Lightweight form of highlight -- proceed over this line and
|
4244 |
+
// update state, but don't save a style array.
|
4245 |
+
function processLine(cm, line, state) {
|
4246 |
+
var mode = cm.doc.mode;
|
4247 |
+
var stream = new StringStream(line.text, cm.options.tabSize);
|
4248 |
+
if (line.text == "" && mode.blankLine) mode.blankLine(state);
|
4249 |
+
while (!stream.eol() && stream.pos <= cm.options.maxHighlightLength) {
|
4250 |
+
mode.token(stream, state);
|
4251 |
+
stream.start = stream.pos;
|
4252 |
+
}
|
4253 |
+
}
|
4254 |
+
|
4255 |
+
var styleToClassCache = {};
|
4256 |
+
function styleToClass(style) {
|
4257 |
+
if (!style) return null;
|
4258 |
+
return styleToClassCache[style] ||
|
4259 |
+
(styleToClassCache[style] = "cm-" + style.replace(/ +/g, " cm-"));
|
4260 |
+
}
|
4261 |
+
|
4262 |
+
function lineContent(cm, realLine, measure, copyWidgets) {
|
4263 |
+
var merged, line = realLine, empty = true;
|
4264 |
+
while (merged = collapsedSpanAtStart(line))
|
4265 |
+
line = getLine(cm.doc, merged.find().from.line);
|
4266 |
+
|
4267 |
+
var builder = {pre: elt("pre"), col: 0, pos: 0,
|
4268 |
+
measure: null, measuredSomething: false, cm: cm,
|
4269 |
+
copyWidgets: copyWidgets};
|
4270 |
+
if (line.textClass) builder.pre.className = line.textClass;
|
4271 |
+
|
4272 |
+
do {
|
4273 |
+
if (line.text) empty = false;
|
4274 |
+
builder.measure = line == realLine && measure;
|
4275 |
+
builder.pos = 0;
|
4276 |
+
builder.addToken = builder.measure ? buildTokenMeasure : buildToken;
|
4277 |
+
if ((ie || webkit) && cm.getOption("lineWrapping"))
|
4278 |
+
builder.addToken = buildTokenSplitSpaces(builder.addToken);
|
4279 |
+
var next = insertLineContent(line, builder, getLineStyles(cm, line));
|
4280 |
+
if (measure && line == realLine && !builder.measuredSomething) {
|
4281 |
+
measure[0] = builder.pre.appendChild(zeroWidthElement(cm.display.measure));
|
4282 |
+
builder.measuredSomething = true;
|
4283 |
+
}
|
4284 |
+
if (next) line = getLine(cm.doc, next.to.line);
|
4285 |
+
} while (next);
|
4286 |
+
|
4287 |
+
if (measure && !builder.measuredSomething && !measure[0])
|
4288 |
+
measure[0] = builder.pre.appendChild(empty ? elt("span", "\u00a0") : zeroWidthElement(cm.display.measure));
|
4289 |
+
if (!builder.pre.firstChild && !lineIsHidden(cm.doc, realLine))
|
4290 |
+
builder.pre.appendChild(document.createTextNode("\u00a0"));
|
4291 |
+
|
4292 |
+
var order;
|
4293 |
+
// Work around problem with the reported dimensions of single-char
|
4294 |
+
// direction spans on IE (issue #1129). See also the comment in
|
4295 |
+
// cursorCoords.
|
4296 |
+
if (measure && ie && (order = getOrder(line))) {
|
4297 |
+
var l = order.length - 1;
|
4298 |
+
if (order[l].from == order[l].to) --l;
|
4299 |
+
var last = order[l], prev = order[l - 1];
|
4300 |
+
if (last.from + 1 == last.to && prev && last.level < prev.level) {
|
4301 |
+
var span = measure[builder.pos - 1];
|
4302 |
+
if (span) span.parentNode.insertBefore(span.measureRight = zeroWidthElement(cm.display.measure),
|
4303 |
+
span.nextSibling);
|
4304 |
+
}
|
4305 |
+
}
|
4306 |
+
|
4307 |
+
signal(cm, "renderLine", cm, realLine, builder.pre);
|
4308 |
+
return builder.pre;
|
4309 |
+
}
|
4310 |
+
|
4311 |
+
var tokenSpecialChars = /[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\uFEFF]/g;
|
4312 |
+
function buildToken(builder, text, style, startStyle, endStyle, title) {
|
4313 |
+
if (!text) return;
|
4314 |
+
if (!tokenSpecialChars.test(text)) {
|
4315 |
+
builder.col += text.length;
|
4316 |
+
var content = document.createTextNode(text);
|
4317 |
+
} else {
|
4318 |
+
var content = document.createDocumentFragment(), pos = 0;
|
4319 |
+
while (true) {
|
4320 |
+
tokenSpecialChars.lastIndex = pos;
|
4321 |
+
var m = tokenSpecialChars.exec(text);
|
4322 |
+
var skipped = m ? m.index - pos : text.length - pos;
|
4323 |
+
if (skipped) {
|
4324 |
+
content.appendChild(document.createTextNode(text.slice(pos, pos + skipped)));
|
4325 |
+
builder.col += skipped;
|
4326 |
+
}
|
4327 |
+
if (!m) break;
|
4328 |
+
pos += skipped + 1;
|
4329 |
+
if (m[0] == "\t") {
|
4330 |
+
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
|
4331 |
+
content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
|
4332 |
+
builder.col += tabWidth;
|
4333 |
+
} else {
|
4334 |
+
var token = elt("span", "\u2022", "cm-invalidchar");
|
4335 |
+
token.title = "\\u" + m[0].charCodeAt(0).toString(16);
|
4336 |
+
content.appendChild(token);
|
4337 |
+
builder.col += 1;
|
4338 |
+
}
|
4339 |
+
}
|
4340 |
+
}
|
4341 |
+
if (style || startStyle || endStyle || builder.measure) {
|
4342 |
+
var fullStyle = style || "";
|
4343 |
+
if (startStyle) fullStyle += startStyle;
|
4344 |
+
if (endStyle) fullStyle += endStyle;
|
4345 |
+
var token = elt("span", [content], fullStyle);
|
4346 |
+
if (title) token.title = title;
|
4347 |
+
return builder.pre.appendChild(token);
|
4348 |
+
}
|
4349 |
+
builder.pre.appendChild(content);
|
4350 |
+
}
|
4351 |
+
|
4352 |
+
function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
|
4353 |
+
var wrapping = builder.cm.options.lineWrapping;
|
4354 |
+
for (var i = 0; i < text.length; ++i) {
|
4355 |
+
var ch = text.charAt(i), start = i == 0;
|
4356 |
+
if (ch >= "\ud800" && ch < "\udbff" && i < text.length - 1) {
|
4357 |
+
ch = text.slice(i, i + 2);
|
4358 |
+
++i;
|
4359 |
+
} else if (i && wrapping && spanAffectsWrapping(text, i)) {
|
4360 |
+
builder.pre.appendChild(elt("wbr"));
|
4361 |
+
}
|
4362 |
+
var old = builder.measure[builder.pos];
|
4363 |
+
var span = builder.measure[builder.pos] =
|
4364 |
+
buildToken(builder, ch, style,
|
4365 |
+
start && startStyle, i == text.length - 1 && endStyle);
|
4366 |
+
if (old) span.leftSide = old.leftSide || old;
|
4367 |
+
// In IE single-space nodes wrap differently than spaces
|
4368 |
+
// embedded in larger text nodes, except when set to
|
4369 |
+
// white-space: normal (issue #1268).
|
4370 |
+
if (ie && wrapping && ch == " " && i && !/\s/.test(text.charAt(i - 1)) &&
|
4371 |
+
i < text.length - 1 && !/\s/.test(text.charAt(i + 1)))
|
4372 |
+
span.style.whiteSpace = "normal";
|
4373 |
+
builder.pos += ch.length;
|
4374 |
+
}
|
4375 |
+
if (text.length) builder.measuredSomething = true;
|
4376 |
+
}
|
4377 |
+
|
4378 |
+
function buildTokenSplitSpaces(inner) {
|
4379 |
+
function split(old) {
|
4380 |
+
var out = " ";
|
4381 |
+
for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0";
|
4382 |
+
out += " ";
|
4383 |
+
return out;
|
4384 |
+
}
|
4385 |
+
return function(builder, text, style, startStyle, endStyle, title) {
|
4386 |
+
return inner(builder, text.replace(/ {3,}/, split), style, startStyle, endStyle, title);
|
4387 |
+
};
|
4388 |
+
}
|
4389 |
+
|
4390 |
+
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
4391 |
+
var widget = !ignoreWidget && marker.replacedWith;
|
4392 |
+
if (widget) {
|
4393 |
+
if (builder.copyWidgets) widget = widget.cloneNode(true);
|
4394 |
+
builder.pre.appendChild(widget);
|
4395 |
+
if (builder.measure) {
|
4396 |
+
if (size) {
|
4397 |
+
builder.measure[builder.pos] = widget;
|
4398 |
+
} else {
|
4399 |
+
var elt = builder.measure[builder.pos] = zeroWidthElement(builder.cm.display.measure);
|
4400 |
+
if (marker.type != "bookmark" || marker.insertLeft)
|
4401 |
+
builder.pre.insertBefore(elt, widget);
|
4402 |
+
else
|
4403 |
+
builder.pre.appendChild(elt);
|
4404 |
+
}
|
4405 |
+
builder.measuredSomething = true;
|
4406 |
+
}
|
4407 |
+
}
|
4408 |
+
builder.pos += size;
|
4409 |
+
}
|
4410 |
+
|
4411 |
+
// Outputs a number of spans to make up a line, taking highlighting
|
4412 |
+
// and marked text into account.
|
4413 |
+
function insertLineContent(line, builder, styles) {
|
4414 |
+
var spans = line.markedSpans, allText = line.text, at = 0;
|
4415 |
+
if (!spans) {
|
4416 |
+
for (var i = 1; i < styles.length; i+=2)
|
4417 |
+
builder.addToken(builder, allText.slice(at, at = styles[i]), styleToClass(styles[i+1]));
|
4418 |
+
return;
|
4419 |
+
}
|
4420 |
+
|
4421 |
+
var len = allText.length, pos = 0, i = 1, text = "", style;
|
4422 |
+
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;
|
4423 |
+
for (;;) {
|
4424 |
+
if (nextChange == pos) { // Update current marker set
|
4425 |
+
spanStyle = spanEndStyle = spanStartStyle = title = "";
|
4426 |
+
collapsed = null; nextChange = Infinity;
|
4427 |
+
var foundBookmark = null;
|
4428 |
+
for (var j = 0; j < spans.length; ++j) {
|
4429 |
+
var sp = spans[j], m = sp.marker;
|
4430 |
+
if (sp.from <= pos && (sp.to == null || sp.to > pos)) {
|
4431 |
+
if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; }
|
4432 |
+
if (m.className) spanStyle += " " + m.className;
|
4433 |
+
if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
|
4434 |
+
if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
|
4435 |
+
if (m.title && !title) title = m.title;
|
4436 |
+
if (m.collapsed && (!collapsed || collapsed.marker.size < m.size))
|
4437 |
+
collapsed = sp;
|
4438 |
+
} else if (sp.from > pos && nextChange > sp.from) {
|
4439 |
+
nextChange = sp.from;
|
4440 |
+
}
|
4441 |
+
if (m.type == "bookmark" && sp.from == pos && m.replacedWith) foundBookmark = m;
|
4442 |
+
}
|
4443 |
+
if (collapsed && (collapsed.from || 0) == pos) {
|
4444 |
+
buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,
|
4445 |
+
collapsed.marker, collapsed.from == null);
|
4446 |
+
if (collapsed.to == null) return collapsed.marker.find();
|
4447 |
+
}
|
4448 |
+
if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);
|
4449 |
+
}
|
4450 |
+
if (pos >= len) break;
|
4451 |
+
|
4452 |
+
var upto = Math.min(len, nextChange);
|
4453 |
+
while (true) {
|
4454 |
+
if (text) {
|
4455 |
+
var end = pos + text.length;
|
4456 |
+
if (!collapsed) {
|
4457 |
+
var tokenText = end > upto ? text.slice(0, upto - pos) : text;
|
4458 |
+
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
4459 |
+
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title);
|
4460 |
+
}
|
4461 |
+
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
|
4462 |
+
pos = end;
|
4463 |
+
spanStartStyle = "";
|
4464 |
+
}
|
4465 |
+
text = allText.slice(at, at = styles[i++]);
|
4466 |
+
style = styleToClass(styles[i++]);
|
4467 |
+
}
|
4468 |
+
}
|
4469 |
+
}
|
4470 |
+
|
4471 |
+
// DOCUMENT DATA STRUCTURE
|
4472 |
+
|
4473 |
+
function updateDoc(doc, change, markedSpans, selAfter, estimateHeight) {
|
4474 |
+
function spansFor(n) {return markedSpans ? markedSpans[n] : null;}
|
4475 |
+
function update(line, text, spans) {
|
4476 |
+
updateLine(line, text, spans, estimateHeight);
|
4477 |
+
signalLater(line, "change", line, change);
|
4478 |
+
}
|
4479 |
+
|
4480 |
+
var from = change.from, to = change.to, text = change.text;
|
4481 |
+
var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
|
4482 |
+
var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
|
4483 |
+
|
4484 |
+
// First adjust the line structure
|
4485 |
+
if (from.ch == 0 && to.ch == 0 && lastText == "") {
|
4486 |
+
// This is a whole-line replace. Treated specially to make
|
4487 |
+
// sure line objects move the way they are supposed to.
|
4488 |
+
for (var i = 0, e = text.length - 1, added = []; i < e; ++i)
|
4489 |
+
added.push(new Line(text[i], spansFor(i), estimateHeight));
|
4490 |
+
update(lastLine, lastLine.text, lastSpans);
|
4491 |
+
if (nlines) doc.remove(from.line, nlines);
|
4492 |
+
if (added.length) doc.insert(from.line, added);
|
4493 |
+
} else if (firstLine == lastLine) {
|
4494 |
+
if (text.length == 1) {
|
4495 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
|
4496 |
+
} else {
|
4497 |
+
for (var added = [], i = 1, e = text.length - 1; i < e; ++i)
|
4498 |
+
added.push(new Line(text[i], spansFor(i), estimateHeight));
|
4499 |
+
added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
|
4500 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4501 |
+
doc.insert(from.line + 1, added);
|
4502 |
+
}
|
4503 |
+
} else if (text.length == 1) {
|
4504 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
|
4505 |
+
doc.remove(from.line + 1, nlines);
|
4506 |
+
} else {
|
4507 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4508 |
+
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
|
4509 |
+
for (var i = 1, e = text.length - 1, added = []; i < e; ++i)
|
4510 |
+
added.push(new Line(text[i], spansFor(i), estimateHeight));
|
4511 |
+
if (nlines > 1) doc.remove(from.line + 1, nlines - 1);
|
4512 |
+
doc.insert(from.line + 1, added);
|
4513 |
+
}
|
4514 |
+
|
4515 |
+
signalLater(doc, "change", doc, change);
|
4516 |
+
setSelection(doc, selAfter.anchor, selAfter.head, null, true);
|
4517 |
+
}
|
4518 |
+
|
4519 |
+
function LeafChunk(lines) {
|
4520 |
+
this.lines = lines;
|
4521 |
+
this.parent = null;
|
4522 |
+
for (var i = 0, e = lines.length, height = 0; i < e; ++i) {
|
4523 |
+
lines[i].parent = this;
|
4524 |
+
height += lines[i].height;
|
4525 |
+
}
|
4526 |
+
this.height = height;
|
4527 |
+
}
|
4528 |
+
|
4529 |
+
LeafChunk.prototype = {
|
4530 |
+
chunkSize: function() { return this.lines.length; },
|
4531 |
+
removeInner: function(at, n) {
|
4532 |
+
for (var i = at, e = at + n; i < e; ++i) {
|
4533 |
+
var line = this.lines[i];
|
4534 |
+
this.height -= line.height;
|
4535 |
+
cleanUpLine(line);
|
4536 |
+
signalLater(line, "delete");
|
4537 |
+
}
|
4538 |
+
this.lines.splice(at, n);
|
4539 |
+
},
|
4540 |
+
collapse: function(lines) {
|
4541 |
+
lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
|
4542 |
+
},
|
4543 |
+
insertInner: function(at, lines, height) {
|
4544 |
+
this.height += height;
|
4545 |
+
this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
|
4546 |
+
for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
|
4547 |
+
},
|
4548 |
+
iterN: function(at, n, op) {
|
4549 |
+
for (var e = at + n; at < e; ++at)
|
4550 |
+
if (op(this.lines[at])) return true;
|
4551 |
+
}
|
4552 |
+
};
|
4553 |
+
|
4554 |
+
function BranchChunk(children) {
|
4555 |
+
this.children = children;
|
4556 |
+
var size = 0, height = 0;
|
4557 |
+
for (var i = 0, e = children.length; i < e; ++i) {
|
4558 |
+
var ch = children[i];
|
4559 |
+
size += ch.chunkSize(); height += ch.height;
|
4560 |
+
ch.parent = this;
|
4561 |
+
}
|
4562 |
+
this.size = size;
|
4563 |
+
this.height = height;
|
4564 |
+
this.parent = null;
|
4565 |
+
}
|
4566 |
+
|
4567 |
+
BranchChunk.prototype = {
|
4568 |
+
chunkSize: function() { return this.size; },
|
4569 |
+
removeInner: function(at, n) {
|
4570 |
+
this.size -= n;
|
4571 |
+
for (var i = 0; i < this.children.length; ++i) {
|
4572 |
+
var child = this.children[i], sz = child.chunkSize();
|
4573 |
+
if (at < sz) {
|
4574 |
+
var rm = Math.min(n, sz - at), oldHeight = child.height;
|
4575 |
+
child.removeInner(at, rm);
|
4576 |
+
this.height -= oldHeight - child.height;
|
4577 |
+
if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
|
4578 |
+
if ((n -= rm) == 0) break;
|
4579 |
+
at = 0;
|
4580 |
+
} else at -= sz;
|
4581 |
+
}
|
4582 |
+
if (this.size - n < 25) {
|
4583 |
+
var lines = [];
|
4584 |
+
this.collapse(lines);
|
4585 |
+
this.children = [new LeafChunk(lines)];
|
4586 |
+
this.children[0].parent = this;
|
4587 |
+
}
|
4588 |
+
},
|
4589 |
+
collapse: function(lines) {
|
4590 |
+
for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
|
4591 |
+
},
|
4592 |
+
insertInner: function(at, lines, height) {
|
4593 |
+
this.size += lines.length;
|
4594 |
+
this.height += height;
|
4595 |
+
for (var i = 0, e = this.children.length; i < e; ++i) {
|
4596 |
+
var child = this.children[i], sz = child.chunkSize();
|
4597 |
+
if (at <= sz) {
|
4598 |
+
child.insertInner(at, lines, height);
|
4599 |
+
if (child.lines && child.lines.length > 50) {
|
4600 |
+
while (child.lines.length > 50) {
|
4601 |
+
var spilled = child.lines.splice(child.lines.length - 25, 25);
|
4602 |
+
var newleaf = new LeafChunk(spilled);
|
4603 |
+
child.height -= newleaf.height;
|
4604 |
+
this.children.splice(i + 1, 0, newleaf);
|
4605 |
+
newleaf.parent = this;
|
4606 |
+
}
|
4607 |
+
this.maybeSpill();
|
4608 |
+
}
|
4609 |
+
break;
|
4610 |
+
}
|
4611 |
+
at -= sz;
|
4612 |
+
}
|
4613 |
+
},
|
4614 |
+
maybeSpill: function() {
|
4615 |
+
if (this.children.length <= 10) return;
|
4616 |
+
var me = this;
|
4617 |
+
do {
|
4618 |
+
var spilled = me.children.splice(me.children.length - 5, 5);
|
4619 |
+
var sibling = new BranchChunk(spilled);
|
4620 |
+
if (!me.parent) { // Become the parent node
|
4621 |
+
var copy = new BranchChunk(me.children);
|
4622 |
+
copy.parent = me;
|
4623 |
+
me.children = [copy, sibling];
|
4624 |
+
me = copy;
|
4625 |
+
} else {
|
4626 |
+
me.size -= sibling.size;
|
4627 |
+
me.height -= sibling.height;
|
4628 |
+
var myIndex = indexOf(me.parent.children, me);
|
4629 |
+
me.parent.children.splice(myIndex + 1, 0, sibling);
|
4630 |
+
}
|
4631 |
+
sibling.parent = me.parent;
|
4632 |
+
} while (me.children.length > 10);
|
4633 |
+
me.parent.maybeSpill();
|
4634 |
+
},
|
4635 |
+
iterN: function(at, n, op) {
|
4636 |
+
for (var i = 0, e = this.children.length; i < e; ++i) {
|
4637 |
+
var child = this.children[i], sz = child.chunkSize();
|
4638 |
+
if (at < sz) {
|
4639 |
+
var used = Math.min(n, sz - at);
|
4640 |
+
if (child.iterN(at, used, op)) return true;
|
4641 |
+
if ((n -= used) == 0) break;
|
4642 |
+
at = 0;
|
4643 |
+
} else at -= sz;
|
4644 |
+
}
|
4645 |
+
}
|
4646 |
+
};
|
4647 |
+
|
4648 |
+
var nextDocId = 0;
|
4649 |
+
var Doc = CodeMirror.Doc = function(text, mode, firstLine) {
|
4650 |
+
if (!(this instanceof Doc)) return new Doc(text, mode, firstLine);
|
4651 |
+
if (firstLine == null) firstLine = 0;
|
4652 |
+
|
4653 |
+
BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
|
4654 |
+
this.first = firstLine;
|
4655 |
+
this.scrollTop = this.scrollLeft = 0;
|
4656 |
+
this.cantEdit = false;
|
4657 |
+
this.history = makeHistory();
|
4658 |
+
this.cleanGeneration = 1;
|
4659 |
+
this.frontier = firstLine;
|
4660 |
+
var start = Pos(firstLine, 0);
|
4661 |
+
this.sel = {from: start, to: start, head: start, anchor: start, shift: false, extend: false, goalColumn: null};
|
4662 |
+
this.id = ++nextDocId;
|
4663 |
+
this.modeOption = mode;
|
4664 |
+
|
4665 |
+
if (typeof text == "string") text = splitLines(text);
|
4666 |
+
updateDoc(this, {from: start, to: start, text: text}, null, {head: start, anchor: start});
|
4667 |
+
};
|
4668 |
+
|
4669 |
+
Doc.prototype = createObj(BranchChunk.prototype, {
|
4670 |
+
constructor: Doc,
|
4671 |
+
iter: function(from, to, op) {
|
4672 |
+
if (op) this.iterN(from - this.first, to - from, op);
|
4673 |
+
else this.iterN(this.first, this.first + this.size, from);
|
4674 |
+
},
|
4675 |
+
|
4676 |
+
insert: function(at, lines) {
|
4677 |
+
var height = 0;
|
4678 |
+
for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
|
4679 |
+
this.insertInner(at - this.first, lines, height);
|
4680 |
+
},
|
4681 |
+
remove: function(at, n) { this.removeInner(at - this.first, n); },
|
4682 |
+
|
4683 |
+
getValue: function(lineSep) {
|
4684 |
+
var lines = getLines(this, this.first, this.first + this.size);
|
4685 |
+
if (lineSep === false) return lines;
|
4686 |
+
return lines.join(lineSep || "\n");
|
4687 |
+
},
|
4688 |
+
setValue: function(code) {
|
4689 |
+
var top = Pos(this.first, 0), last = this.first + this.size - 1;
|
4690 |
+
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
4691 |
+
text: splitLines(code), origin: "setValue"},
|
4692 |
+
{head: top, anchor: top}, true);
|
4693 |
+
},
|
4694 |
+
replaceRange: function(code, from, to, origin) {
|
4695 |
+
from = clipPos(this, from);
|
4696 |
+
to = to ? clipPos(this, to) : from;
|
4697 |
+
replaceRange(this, code, from, to, origin);
|
4698 |
+
},
|
4699 |
+
getRange: function(from, to, lineSep) {
|
4700 |
+
var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
|
4701 |
+
if (lineSep === false) return lines;
|
4702 |
+
return lines.join(lineSep || "\n");
|
4703 |
+
},
|
4704 |
+
|
4705 |
+
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
|
4706 |
+
setLine: function(line, text) {
|
4707 |
+
if (isLine(this, line))
|
4708 |
+
replaceRange(this, text, Pos(line, 0), clipPos(this, Pos(line)));
|
4709 |
+
},
|
4710 |
+
removeLine: function(line) {
|
4711 |
+
if (line) replaceRange(this, "", clipPos(this, Pos(line - 1)), clipPos(this, Pos(line)));
|
4712 |
+
else replaceRange(this, "", Pos(0, 0), clipPos(this, Pos(1, 0)));
|
4713 |
+
},
|
4714 |
+
|
4715 |
+
getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line);},
|
4716 |
+
getLineNumber: function(line) {return lineNo(line);},
|
4717 |
+
|
4718 |
+
getLineHandleVisualStart: function(line) {
|
4719 |
+
if (typeof line == "number") line = getLine(this, line);
|
4720 |
+
return visualLine(this, line);
|
4721 |
+
},
|
4722 |
+
|
4723 |
+
lineCount: function() {return this.size;},
|
4724 |
+
firstLine: function() {return this.first;},
|
4725 |
+
lastLine: function() {return this.first + this.size - 1;},
|
4726 |
+
|
4727 |
+
clipPos: function(pos) {return clipPos(this, pos);},
|
4728 |
+
|
4729 |
+
getCursor: function(start) {
|
4730 |
+
var sel = this.sel, pos;
|
4731 |
+
if (start == null || start == "head") pos = sel.head;
|
4732 |
+
else if (start == "anchor") pos = sel.anchor;
|
4733 |
+
else if (start == "end" || start === false) pos = sel.to;
|
4734 |
+
else pos = sel.from;
|
4735 |
+
return copyPos(pos);
|
4736 |
+
},
|
4737 |
+
somethingSelected: function() {return !posEq(this.sel.head, this.sel.anchor);},
|
4738 |
+
|
4739 |
+
setCursor: docOperation(function(line, ch, extend) {
|
4740 |
+
var pos = clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line);
|
4741 |
+
if (extend) extendSelection(this, pos);
|
4742 |
+
else setSelection(this, pos, pos);
|
4743 |
+
}),
|
4744 |
+
setSelection: docOperation(function(anchor, head) {
|
4745 |
+
setSelection(this, clipPos(this, anchor), clipPos(this, head || anchor));
|
4746 |
+
}),
|
4747 |
+
extendSelection: docOperation(function(from, to) {
|
4748 |
+
extendSelection(this, clipPos(this, from), to && clipPos(this, to));
|
4749 |
+
}),
|
4750 |
+
|
4751 |
+
getSelection: function(lineSep) {return this.getRange(this.sel.from, this.sel.to, lineSep);},
|
4752 |
+
replaceSelection: function(code, collapse, origin) {
|
4753 |
+
makeChange(this, {from: this.sel.from, to: this.sel.to, text: splitLines(code), origin: origin}, collapse || "around");
|
4754 |
+
},
|
4755 |
+
undo: docOperation(function() {makeChangeFromHistory(this, "undo");}),
|
4756 |
+
redo: docOperation(function() {makeChangeFromHistory(this, "redo");}),
|
4757 |
+
|
4758 |
+
setExtending: function(val) {this.sel.extend = val;},
|
4759 |
+
|
4760 |
+
historySize: function() {
|
4761 |
+
var hist = this.history;
|
4762 |
+
return {undo: hist.done.length, redo: hist.undone.length};
|
4763 |
+
},
|
4764 |
+
clearHistory: function() {this.history = makeHistory(this.history.maxGeneration);},
|
4765 |
+
|
4766 |
+
markClean: function() {
|
4767 |
+
this.cleanGeneration = this.changeGeneration();
|
4768 |
+
},
|
4769 |
+
changeGeneration: function() {
|
4770 |
+
this.history.lastOp = this.history.lastOrigin = null;
|
4771 |
+
return this.history.generation;
|
4772 |
+
},
|
4773 |
+
isClean: function (gen) {
|
4774 |
+
return this.history.generation == (gen || this.cleanGeneration);
|
4775 |
+
},
|
4776 |
+
|
4777 |
+
getHistory: function() {
|
4778 |
+
return {done: copyHistoryArray(this.history.done),
|
4779 |
+
undone: copyHistoryArray(this.history.undone)};
|
4780 |
+
},
|
4781 |
+
setHistory: function(histData) {
|
4782 |
+
var hist = this.history = makeHistory(this.history.maxGeneration);
|
4783 |
+
hist.done = histData.done.slice(0);
|
4784 |
+
hist.undone = histData.undone.slice(0);
|
4785 |
+
},
|
4786 |
+
|
4787 |
+
markText: function(from, to, options) {
|
4788 |
+
return markText(this, clipPos(this, from), clipPos(this, to), options, "range");
|
4789 |
+
},
|
4790 |
+
setBookmark: function(pos, options) {
|
4791 |
+
var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
|
4792 |
+
insertLeft: options && options.insertLeft};
|
4793 |
+
pos = clipPos(this, pos);
|
4794 |
+
return markText(this, pos, pos, realOpts, "bookmark");
|
4795 |
+
},
|
4796 |
+
findMarksAt: function(pos) {
|
4797 |
+
pos = clipPos(this, pos);
|
4798 |
+
var markers = [], spans = getLine(this, pos.line).markedSpans;
|
4799 |
+
if (spans) for (var i = 0; i < spans.length; ++i) {
|
4800 |
+
var span = spans[i];
|
4801 |
+
if ((span.from == null || span.from <= pos.ch) &&
|
4802 |
+
(span.to == null || span.to >= pos.ch))
|
4803 |
+
markers.push(span.marker.parent || span.marker);
|
4804 |
+
}
|
4805 |
+
return markers;
|
4806 |
+
},
|
4807 |
+
getAllMarks: function() {
|
4808 |
+
var markers = [];
|
4809 |
+
this.iter(function(line) {
|
4810 |
+
var sps = line.markedSpans;
|
4811 |
+
if (sps) for (var i = 0; i < sps.length; ++i)
|
4812 |
+
if (sps[i].from != null) markers.push(sps[i].marker);
|
4813 |
+
});
|
4814 |
+
return markers;
|
4815 |
+
},
|
4816 |
+
|
4817 |
+
posFromIndex: function(off) {
|
4818 |
+
var ch, lineNo = this.first;
|
4819 |
+
this.iter(function(line) {
|
4820 |
+
var sz = line.text.length + 1;
|
4821 |
+
if (sz > off) { ch = off; return true; }
|
4822 |
+
off -= sz;
|
4823 |
+
++lineNo;
|
4824 |
+
});
|
4825 |
+
return clipPos(this, Pos(lineNo, ch));
|
4826 |
+
},
|
4827 |
+
indexFromPos: function (coords) {
|
4828 |
+
coords = clipPos(this, coords);
|
4829 |
+
var index = coords.ch;
|
4830 |
+
if (coords.line < this.first || coords.ch < 0) return 0;
|
4831 |
+
this.iter(this.first, coords.line, function (line) {
|
4832 |
+
index += line.text.length + 1;
|
4833 |
+
});
|
4834 |
+
return index;
|
4835 |
+
},
|
4836 |
+
|
4837 |
+
copy: function(copyHistory) {
|
4838 |
+
var doc = new Doc(getLines(this, this.first, this.first + this.size), this.modeOption, this.first);
|
4839 |
+
doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
|
4840 |
+
doc.sel = {from: this.sel.from, to: this.sel.to, head: this.sel.head, anchor: this.sel.anchor,
|
4841 |
+
shift: this.sel.shift, extend: false, goalColumn: this.sel.goalColumn};
|
4842 |
+
if (copyHistory) {
|
4843 |
+
doc.history.undoDepth = this.history.undoDepth;
|
4844 |
+
doc.setHistory(this.getHistory());
|
4845 |
+
}
|
4846 |
+
return doc;
|
4847 |
+
},
|
4848 |
+
|
4849 |
+
linkedDoc: function(options) {
|
4850 |
+
if (!options) options = {};
|
4851 |
+
var from = this.first, to = this.first + this.size;
|
4852 |
+
if (options.from != null && options.from > from) from = options.from;
|
4853 |
+
if (options.to != null && options.to < to) to = options.to;
|
4854 |
+
var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from);
|
4855 |
+
if (options.sharedHist) copy.history = this.history;
|
4856 |
+
(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
|
4857 |
+
copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
|
4858 |
+
return copy;
|
4859 |
+
},
|
4860 |
+
unlinkDoc: function(other) {
|
4861 |
+
if (other instanceof CodeMirror) other = other.doc;
|
4862 |
+
if (this.linked) for (var i = 0; i < this.linked.length; ++i) {
|
4863 |
+
var link = this.linked[i];
|
4864 |
+
if (link.doc != other) continue;
|
4865 |
+
this.linked.splice(i, 1);
|
4866 |
+
other.unlinkDoc(this);
|
4867 |
+
break;
|
4868 |
+
}
|
4869 |
+
// If the histories were shared, split them again
|
4870 |
+
if (other.history == this.history) {
|
4871 |
+
var splitIds = [other.id];
|
4872 |
+
linkedDocs(other, function(doc) {splitIds.push(doc.id);}, true);
|
4873 |
+
other.history = makeHistory();
|
4874 |
+
other.history.done = copyHistoryArray(this.history.done, splitIds);
|
4875 |
+
other.history.undone = copyHistoryArray(this.history.undone, splitIds);
|
4876 |
+
}
|
4877 |
+
},
|
4878 |
+
iterLinkedDocs: function(f) {linkedDocs(this, f);},
|
4879 |
+
|
4880 |
+
getMode: function() {return this.mode;},
|
4881 |
+
getEditor: function() {return this.cm;}
|
4882 |
+
});
|
4883 |
+
|
4884 |
+
Doc.prototype.eachLine = Doc.prototype.iter;
|
4885 |
+
|
4886 |
+
// The Doc methods that should be available on CodeMirror instances
|
4887 |
+
var dontDelegate = "iter insert remove copy getEditor".split(" ");
|
4888 |
+
for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
4889 |
+
CodeMirror.prototype[prop] = (function(method) {
|
4890 |
+
return function() {return method.apply(this.doc, arguments);};
|
4891 |
+
})(Doc.prototype[prop]);
|
4892 |
+
|
4893 |
+
eventMixin(Doc);
|
4894 |
+
|
4895 |
+
function linkedDocs(doc, f, sharedHistOnly) {
|
4896 |
+
function propagate(doc, skip, sharedHist) {
|
4897 |
+
if (doc.linked) for (var i = 0; i < doc.linked.length; ++i) {
|
4898 |
+
var rel = doc.linked[i];
|
4899 |
+
if (rel.doc == skip) continue;
|
4900 |
+
var shared = sharedHist && rel.sharedHist;
|
4901 |
+
if (sharedHistOnly && !shared) continue;
|
4902 |
+
f(rel.doc, shared);
|
4903 |
+
propagate(rel.doc, doc, shared);
|
4904 |
+
}
|
4905 |
+
}
|
4906 |
+
propagate(doc, null, true);
|
4907 |
+
}
|
4908 |
+
|
4909 |
+
function attachDoc(cm, doc) {
|
4910 |
+
if (doc.cm) throw new Error("This document is already in use.");
|
4911 |
+
cm.doc = doc;
|
4912 |
+
doc.cm = cm;
|
4913 |
+
estimateLineHeights(cm);
|
4914 |
+
loadMode(cm);
|
4915 |
+
if (!cm.options.lineWrapping) computeMaxLength(cm);
|
4916 |
+
cm.options.mode = doc.modeOption;
|
4917 |
+
regChange(cm);
|
4918 |
+
}
|
4919 |
+
|
4920 |
+
// LINE UTILITIES
|
4921 |
+
|
4922 |
+
function getLine(chunk, n) {
|
4923 |
+
n -= chunk.first;
|
4924 |
+
while (!chunk.lines) {
|
4925 |
+
for (var i = 0;; ++i) {
|
4926 |
+
var child = chunk.children[i], sz = child.chunkSize();
|
4927 |
+
if (n < sz) { chunk = child; break; }
|
4928 |
+
n -= sz;
|
4929 |
+
}
|
4930 |
+
}
|
4931 |
+
return chunk.lines[n];
|
4932 |
+
}
|
4933 |
+
|
4934 |
+
function getBetween(doc, start, end) {
|
4935 |
+
var out = [], n = start.line;
|
4936 |
+
doc.iter(start.line, end.line + 1, function(line) {
|
4937 |
+
var text = line.text;
|
4938 |
+
if (n == end.line) text = text.slice(0, end.ch);
|
4939 |
+
if (n == start.line) text = text.slice(start.ch);
|
4940 |
+
out.push(text);
|
4941 |
+
++n;
|
4942 |
+
});
|
4943 |
+
return out;
|
4944 |
+
}
|
4945 |
+
function getLines(doc, from, to) {
|
4946 |
+
var out = [];
|
4947 |
+
doc.iter(from, to, function(line) { out.push(line.text); });
|
4948 |
+
return out;
|
4949 |
+
}
|
4950 |
+
|
4951 |
+
function updateLineHeight(line, height) {
|
4952 |
+
var diff = height - line.height;
|
4953 |
+
for (var n = line; n; n = n.parent) n.height += diff;
|
4954 |
+
}
|
4955 |
+
|
4956 |
+
function lineNo(line) {
|
4957 |
+
if (line.parent == null) return null;
|
4958 |
+
var cur = line.parent, no = indexOf(cur.lines, line);
|
4959 |
+
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
4960 |
+
for (var i = 0;; ++i) {
|
4961 |
+
if (chunk.children[i] == cur) break;
|
4962 |
+
no += chunk.children[i].chunkSize();
|
4963 |
+
}
|
4964 |
+
}
|
4965 |
+
return no + cur.first;
|
4966 |
+
}
|
4967 |
+
|
4968 |
+
function lineAtHeight(chunk, h) {
|
4969 |
+
var n = chunk.first;
|
4970 |
+
outer: do {
|
4971 |
+
for (var i = 0, e = chunk.children.length; i < e; ++i) {
|
4972 |
+
var child = chunk.children[i], ch = child.height;
|
4973 |
+
if (h < ch) { chunk = child; continue outer; }
|
4974 |
+
h -= ch;
|
4975 |
+
n += child.chunkSize();
|
4976 |
+
}
|
4977 |
+
return n;
|
4978 |
+
} while (!chunk.lines);
|
4979 |
+
for (var i = 0, e = chunk.lines.length; i < e; ++i) {
|
4980 |
+
var line = chunk.lines[i], lh = line.height;
|
4981 |
+
if (h < lh) break;
|
4982 |
+
h -= lh;
|
4983 |
+
}
|
4984 |
+
return n + i;
|
4985 |
+
}
|
4986 |
+
|
4987 |
+
function heightAtLine(cm, lineObj) {
|
4988 |
+
lineObj = visualLine(cm.doc, lineObj);
|
4989 |
+
|
4990 |
+
var h = 0, chunk = lineObj.parent;
|
4991 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
4992 |
+
var line = chunk.lines[i];
|
4993 |
+
if (line == lineObj) break;
|
4994 |
+
else h += line.height;
|
4995 |
+
}
|
4996 |
+
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
4997 |
+
for (var i = 0; i < p.children.length; ++i) {
|
4998 |
+
var cur = p.children[i];
|
4999 |
+
if (cur == chunk) break;
|
5000 |
+
else h += cur.height;
|
5001 |
+
}
|
5002 |
+
}
|
5003 |
+
return h;
|
5004 |
+
}
|
5005 |
+
|
5006 |
+
function getOrder(line) {
|
5007 |
+
var order = line.order;
|
5008 |
+
if (order == null) order = line.order = bidiOrdering(line.text);
|
5009 |
+
return order;
|
5010 |
+
}
|
5011 |
+
|
5012 |
+
// HISTORY
|
5013 |
+
|
5014 |
+
function makeHistory(startGen) {
|
5015 |
+
return {
|
5016 |
+
// Arrays of history events. Doing something adds an event to
|
5017 |
+
// done and clears undo. Undoing moves events from done to
|
5018 |
+
// undone, redoing moves them in the other direction.
|
5019 |
+
done: [], undone: [], undoDepth: Infinity,
|
5020 |
+
// Used to track when changes can be merged into a single undo
|
5021 |
+
// event
|
5022 |
+
lastTime: 0, lastOp: null, lastOrigin: null,
|
5023 |
+
// Used by the isClean() method
|
5024 |
+
generation: startGen || 1, maxGeneration: startGen || 1
|
5025 |
+
};
|
5026 |
+
}
|
5027 |
+
|
5028 |
+
function attachLocalSpans(doc, change, from, to) {
|
5029 |
+
var existing = change["spans_" + doc.id], n = 0;
|
5030 |
+
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
|
5031 |
+
if (line.markedSpans)
|
5032 |
+
(existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
|
5033 |
+
++n;
|
5034 |
+
});
|
5035 |
+
}
|
5036 |
+
|
5037 |
+
function historyChangeFromChange(doc, change) {
|
5038 |
+
var from = { line: change.from.line, ch: change.from.ch };
|
5039 |
+
var histChange = {from: from, to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
|
5040 |
+
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
|
5041 |
+
linkedDocs(doc, function(doc) {attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);}, true);
|
5042 |
+
return histChange;
|
5043 |
+
}
|
5044 |
+
|
5045 |
+
function addToHistory(doc, change, selAfter, opId) {
|
5046 |
+
var hist = doc.history;
|
5047 |
+
hist.undone.length = 0;
|
5048 |
+
var time = +new Date, cur = lst(hist.done);
|
5049 |
+
|
5050 |
+
if (cur &&
|
5051 |
+
(hist.lastOp == opId ||
|
5052 |
+
hist.lastOrigin == change.origin && change.origin &&
|
5053 |
+
((change.origin.charAt(0) == "+" && doc.cm && hist.lastTime > time - doc.cm.options.historyEventDelay) ||
|
5054 |
+
change.origin.charAt(0) == "*"))) {
|
5055 |
+
// Merge this change into the last event
|
5056 |
+
var last = lst(cur.changes);
|
5057 |
+
if (posEq(change.from, change.to) && posEq(change.from, last.to)) {
|
5058 |
+
// Optimized case for simple insertion -- don't want to add
|
5059 |
+
// new changesets for every character typed
|
5060 |
+
last.to = changeEnd(change);
|
5061 |
+
} else {
|
5062 |
+
// Add new sub-event
|
5063 |
+
cur.changes.push(historyChangeFromChange(doc, change));
|
5064 |
+
}
|
5065 |
+
cur.anchorAfter = selAfter.anchor; cur.headAfter = selAfter.head;
|
5066 |
+
} else {
|
5067 |
+
// Can not be merged, start a new event.
|
5068 |
+
cur = {changes: [historyChangeFromChange(doc, change)],
|
5069 |
+
generation: hist.generation,
|
5070 |
+
anchorBefore: doc.sel.anchor, headBefore: doc.sel.head,
|
5071 |
+
anchorAfter: selAfter.anchor, headAfter: selAfter.head};
|
5072 |
+
hist.done.push(cur);
|
5073 |
+
hist.generation = ++hist.maxGeneration;
|
5074 |
+
while (hist.done.length > hist.undoDepth)
|
5075 |
+
hist.done.shift();
|
5076 |
+
}
|
5077 |
+
hist.lastTime = time;
|
5078 |
+
hist.lastOp = opId;
|
5079 |
+
hist.lastOrigin = change.origin;
|
5080 |
+
}
|
5081 |
+
|
5082 |
+
function removeClearedSpans(spans) {
|
5083 |
+
if (!spans) return null;
|
5084 |
+
for (var i = 0, out; i < spans.length; ++i) {
|
5085 |
+
if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
|
5086 |
+
else if (out) out.push(spans[i]);
|
5087 |
+
}
|
5088 |
+
return !out ? spans : out.length ? out : null;
|
5089 |
+
}
|
5090 |
+
|
5091 |
+
function getOldSpans(doc, change) {
|
5092 |
+
var found = change["spans_" + doc.id];
|
5093 |
+
if (!found) return null;
|
5094 |
+
for (var i = 0, nw = []; i < change.text.length; ++i)
|
5095 |
+
nw.push(removeClearedSpans(found[i]));
|
5096 |
+
return nw;
|
5097 |
+
}
|
5098 |
+
|
5099 |
+
// Used both to provide a JSON-safe object in .getHistory, and, when
|
5100 |
+
// detaching a document, to split the history in two
|
5101 |
+
function copyHistoryArray(events, newGroup) {
|
5102 |
+
for (var i = 0, copy = []; i < events.length; ++i) {
|
5103 |
+
var event = events[i], changes = event.changes, newChanges = [];
|
5104 |
+
copy.push({changes: newChanges, anchorBefore: event.anchorBefore, headBefore: event.headBefore,
|
5105 |
+
anchorAfter: event.anchorAfter, headAfter: event.headAfter});
|
5106 |
+
for (var j = 0; j < changes.length; ++j) {
|
5107 |
+
var change = changes[j], m;
|
5108 |
+
newChanges.push({from: change.from, to: change.to, text: change.text});
|
5109 |
+
if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
|
5110 |
+
if (indexOf(newGroup, Number(m[1])) > -1) {
|
5111 |
+
lst(newChanges)[prop] = change[prop];
|
5112 |
+
delete change[prop];
|
5113 |
+
}
|
5114 |
+
}
|
5115 |
+
}
|
5116 |
+
}
|
5117 |
+
return copy;
|
5118 |
+
}
|
5119 |
+
|
5120 |
+
// Rebasing/resetting history to deal with externally-sourced changes
|
5121 |
+
|
5122 |
+
function rebaseHistSel(pos, from, to, diff) {
|
5123 |
+
if (to < pos.line) {
|
5124 |
+
pos.line += diff;
|
5125 |
+
} else if (from < pos.line) {
|
5126 |
+
pos.line = from;
|
5127 |
+
pos.ch = 0;
|
5128 |
+
}
|
5129 |
+
}
|
5130 |
+
|
5131 |
+
// Tries to rebase an array of history events given a change in the
|
5132 |
+
// document. If the change touches the same lines as the event, the
|
5133 |
+
// event, and everything 'behind' it, is discarded. If the change is
|
5134 |
+
// before the event, the event's positions are updated. Uses a
|
5135 |
+
// copy-on-write scheme for the positions, to avoid having to
|
5136 |
+
// reallocate them all on every rebase, but also avoid problems with
|
5137 |
+
// shared position objects being unsafely updated.
|
5138 |
+
function rebaseHistArray(array, from, to, diff) {
|
5139 |
+
for (var i = 0; i < array.length; ++i) {
|
5140 |
+
var sub = array[i], ok = true;
|
5141 |
+
for (var j = 0; j < sub.changes.length; ++j) {
|
5142 |
+
var cur = sub.changes[j];
|
5143 |
+
if (!sub.copied) { cur.from = copyPos(cur.from); cur.to = copyPos(cur.to); }
|
5144 |
+
if (to < cur.from.line) {
|
5145 |
+
cur.from.line += diff;
|
5146 |
+
cur.to.line += diff;
|
5147 |
+
} else if (from <= cur.to.line) {
|
5148 |
+
ok = false;
|
5149 |
+
break;
|
5150 |
+
}
|
5151 |
+
}
|
5152 |
+
if (!sub.copied) {
|
5153 |
+
sub.anchorBefore = copyPos(sub.anchorBefore); sub.headBefore = copyPos(sub.headBefore);
|
5154 |
+
sub.anchorAfter = copyPos(sub.anchorAfter); sub.readAfter = copyPos(sub.headAfter);
|
5155 |
+
sub.copied = true;
|
5156 |
+
}
|
5157 |
+
if (!ok) {
|
5158 |
+
array.splice(0, i + 1);
|
5159 |
+
i = 0;
|
5160 |
+
} else {
|
5161 |
+
rebaseHistSel(sub.anchorBefore); rebaseHistSel(sub.headBefore);
|
5162 |
+
rebaseHistSel(sub.anchorAfter); rebaseHistSel(sub.headAfter);
|
5163 |
+
}
|
5164 |
+
}
|
5165 |
+
}
|
5166 |
+
|
5167 |
+
function rebaseHist(hist, change) {
|
5168 |
+
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
|
5169 |
+
rebaseHistArray(hist.done, from, to, diff);
|
5170 |
+
rebaseHistArray(hist.undone, from, to, diff);
|
5171 |
+
}
|
5172 |
+
|
5173 |
+
// EVENT OPERATORS
|
5174 |
+
|
5175 |
+
function stopMethod() {e_stop(this);}
|
5176 |
+
// Ensure an event has a stop method.
|
5177 |
+
function addStop(event) {
|
5178 |
+
if (!event.stop) event.stop = stopMethod;
|
5179 |
+
return event;
|
5180 |
+
}
|
5181 |
+
|
5182 |
+
function e_preventDefault(e) {
|
5183 |
+
if (e.preventDefault) e.preventDefault();
|
5184 |
+
else e.returnValue = false;
|
5185 |
+
}
|
5186 |
+
function e_stopPropagation(e) {
|
5187 |
+
if (e.stopPropagation) e.stopPropagation();
|
5188 |
+
else e.cancelBubble = true;
|
5189 |
+
}
|
5190 |
+
function e_defaultPrevented(e) {
|
5191 |
+
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;
|
5192 |
+
}
|
5193 |
+
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
|
5194 |
+
CodeMirror.e_stop = e_stop;
|
5195 |
+
CodeMirror.e_preventDefault = e_preventDefault;
|
5196 |
+
CodeMirror.e_stopPropagation = e_stopPropagation;
|
5197 |
+
|
5198 |
+
function e_target(e) {return e.target || e.srcElement;}
|
5199 |
+
function e_button(e) {
|
5200 |
+
var b = e.which;
|
5201 |
+
if (b == null) {
|
5202 |
+
if (e.button & 1) b = 1;
|
5203 |
+
else if (e.button & 2) b = 3;
|
5204 |
+
else if (e.button & 4) b = 2;
|
5205 |
+
}
|
5206 |
+
if (mac && e.ctrlKey && b == 1) b = 3;
|
5207 |
+
return b;
|
5208 |
+
}
|
5209 |
+
|
5210 |
+
// EVENT HANDLING
|
5211 |
+
|
5212 |
+
function on(emitter, type, f) {
|
5213 |
+
if (emitter.addEventListener)
|
5214 |
+
emitter.addEventListener(type, f, false);
|
5215 |
+
else if (emitter.attachEvent)
|
5216 |
+
emitter.attachEvent("on" + type, f);
|
5217 |
+
else {
|
5218 |
+
var map = emitter._handlers || (emitter._handlers = {});
|
5219 |
+
var arr = map[type] || (map[type] = []);
|
5220 |
+
arr.push(f);
|
5221 |
+
}
|
5222 |
+
}
|
5223 |
+
|
5224 |
+
function off(emitter, type, f) {
|
5225 |
+
if (emitter.removeEventListener)
|
5226 |
+
emitter.removeEventListener(type, f, false);
|
5227 |
+
else if (emitter.detachEvent)
|
5228 |
+
emitter.detachEvent("on" + type, f);
|
5229 |
+
else {
|
5230 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
5231 |
+
if (!arr) return;
|
5232 |
+
for (var i = 0; i < arr.length; ++i)
|
5233 |
+
if (arr[i] == f) { arr.splice(i, 1); break; }
|
5234 |
+
}
|
5235 |
+
}
|
5236 |
+
|
5237 |
+
function signal(emitter, type /*, values...*/) {
|
5238 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
5239 |
+
if (!arr) return;
|
5240 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
5241 |
+
for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
|
5242 |
+
}
|
5243 |
+
|
5244 |
+
var delayedCallbacks, delayedCallbackDepth = 0;
|
5245 |
+
function signalLater(emitter, type /*, values...*/) {
|
5246 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
5247 |
+
if (!arr) return;
|
5248 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
5249 |
+
if (!delayedCallbacks) {
|
5250 |
+
++delayedCallbackDepth;
|
5251 |
+
delayedCallbacks = [];
|
5252 |
+
setTimeout(fireDelayed, 0);
|
5253 |
+
}
|
5254 |
+
function bnd(f) {return function(){f.apply(null, args);};};
|
5255 |
+
for (var i = 0; i < arr.length; ++i)
|
5256 |
+
delayedCallbacks.push(bnd(arr[i]));
|
5257 |
+
}
|
5258 |
+
|
5259 |
+
function signalDOMEvent(cm, e, override) {
|
5260 |
+
signal(cm, override || e.type, cm, e);
|
5261 |
+
return e_defaultPrevented(e) || e.codemirrorIgnore;
|
5262 |
+
}
|
5263 |
+
|
5264 |
+
function fireDelayed() {
|
5265 |
+
--delayedCallbackDepth;
|
5266 |
+
var delayed = delayedCallbacks;
|
5267 |
+
delayedCallbacks = null;
|
5268 |
+
for (var i = 0; i < delayed.length; ++i) delayed[i]();
|
5269 |
+
}
|
5270 |
+
|
5271 |
+
function hasHandler(emitter, type) {
|
5272 |
+
var arr = emitter._handlers && emitter._handlers[type];
|
5273 |
+
return arr && arr.length > 0;
|
5274 |
+
}
|
5275 |
+
|
5276 |
+
CodeMirror.on = on; CodeMirror.off = off; CodeMirror.signal = signal;
|
5277 |
+
|
5278 |
+
function eventMixin(ctor) {
|
5279 |
+
ctor.prototype.on = function(type, f) {on(this, type, f);};
|
5280 |
+
ctor.prototype.off = function(type, f) {off(this, type, f);};
|
5281 |
+
}
|
5282 |
+
|
5283 |
+
// MISC UTILITIES
|
5284 |
+
|
5285 |
+
// Number of pixels added to scroller and sizer to hide scrollbar
|
5286 |
+
var scrollerCutOff = 30;
|
5287 |
+
|
5288 |
+
// Returned or thrown by various protocols to signal 'I'm not
|
5289 |
+
// handling this'.
|
5290 |
+
var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
|
5291 |
+
|
5292 |
+
function Delayed() {this.id = null;}
|
5293 |
+
Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
|
5294 |
+
|
5295 |
+
// Counts the column offset in a string, taking tabs into account.
|
5296 |
+
// Used mostly to find indentation.
|
5297 |
+
function countColumn(string, end, tabSize, startIndex, startValue) {
|
5298 |
+
if (end == null) {
|
5299 |
+
end = string.search(/[^\s\u00a0]/);
|
5300 |
+
if (end == -1) end = string.length;
|
5301 |
+
}
|
5302 |
+
for (var i = startIndex || 0, n = startValue || 0; i < end; ++i) {
|
5303 |
+
if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
|
5304 |
+
else ++n;
|
5305 |
+
}
|
5306 |
+
return n;
|
5307 |
+
}
|
5308 |
+
CodeMirror.countColumn = countColumn;
|
5309 |
+
|
5310 |
+
var spaceStrs = [""];
|
5311 |
+
function spaceStr(n) {
|
5312 |
+
while (spaceStrs.length <= n)
|
5313 |
+
spaceStrs.push(lst(spaceStrs) + " ");
|
5314 |
+
return spaceStrs[n];
|
5315 |
+
}
|
5316 |
+
|
5317 |
+
function lst(arr) { return arr[arr.length-1]; }
|
5318 |
+
|
5319 |
+
function selectInput(node) {
|
5320 |
+
if (ios) { // Mobile Safari apparently has a bug where select() is broken.
|
5321 |
+
node.selectionStart = 0;
|
5322 |
+
node.selectionEnd = node.value.length;
|
5323 |
+
} else {
|
5324 |
+
// Suppress mysterious IE10 errors
|
5325 |
+
try { node.select(); }
|
5326 |
+
catch(_e) {}
|
5327 |
+
}
|
5328 |
+
}
|
5329 |
+
|
5330 |
+
function indexOf(collection, elt) {
|
5331 |
+
if (collection.indexOf) return collection.indexOf(elt);
|
5332 |
+
for (var i = 0, e = collection.length; i < e; ++i)
|
5333 |
+
if (collection[i] == elt) return i;
|
5334 |
+
return -1;
|
5335 |
+
}
|
5336 |
+
|
5337 |
+
function createObj(base, props) {
|
5338 |
+
function Obj() {}
|
5339 |
+
Obj.prototype = base;
|
5340 |
+
var inst = new Obj();
|
5341 |
+
if (props) copyObj(props, inst);
|
5342 |
+
return inst;
|
5343 |
+
}
|
5344 |
+
|
5345 |
+
function copyObj(obj, target) {
|
5346 |
+
if (!target) target = {};
|
5347 |
+
for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
|
5348 |
+
return target;
|
5349 |
+
}
|
5350 |
+
|
5351 |
+
function emptyArray(size) {
|
5352 |
+
for (var a = [], i = 0; i < size; ++i) a.push(undefined);
|
5353 |
+
return a;
|
5354 |
+
}
|
5355 |
+
|
5356 |
+
function bind(f) {
|
5357 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
5358 |
+
return function(){return f.apply(null, args);};
|
5359 |
+
}
|
5360 |
+
|
5361 |
+
var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
5362 |
+
function isWordChar(ch) {
|
5363 |
+
return /\w/.test(ch) || ch > "\x80" &&
|
5364 |
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
|
5365 |
+
}
|
5366 |
+
|
5367 |
+
function isEmpty(obj) {
|
5368 |
+
for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
|
5369 |
+
return true;
|
5370 |
+
}
|
5371 |
+
|
5372 |
+
var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F\udc00-\udfff]/;
|
5373 |
+
|
5374 |
+
// DOM UTILITIES
|
5375 |
+
|
5376 |
+
function elt(tag, content, className, style) {
|
5377 |
+
var e = document.createElement(tag);
|
5378 |
+
if (className) e.className = className;
|
5379 |
+
if (style) e.style.cssText = style;
|
5380 |
+
if (typeof content == "string") setTextContent(e, content);
|
5381 |
+
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
|
5382 |
+
return e;
|
5383 |
+
}
|
5384 |
+
|
5385 |
+
function removeChildren(e) {
|
5386 |
+
for (var count = e.childNodes.length; count > 0; --count)
|
5387 |
+
e.removeChild(e.firstChild);
|
5388 |
+
return e;
|
5389 |
+
}
|
5390 |
+
|
5391 |
+
function removeChildrenAndAdd(parent, e) {
|
5392 |
+
return removeChildren(parent).appendChild(e);
|
5393 |
+
}
|
5394 |
+
|
5395 |
+
function setTextContent(e, str) {
|
5396 |
+
if (ie_lt9) {
|
5397 |
+
e.innerHTML = "";
|
5398 |
+
e.appendChild(document.createTextNode(str));
|
5399 |
+
} else e.textContent = str;
|
5400 |
+
}
|
5401 |
+
|
5402 |
+
function getRect(node) {
|
5403 |
+
return node.getBoundingClientRect();
|
5404 |
+
}
|
5405 |
+
CodeMirror.replaceGetRect = function(f) { getRect = f; };
|
5406 |
+
|
5407 |
+
// FEATURE DETECTION
|
5408 |
+
|
5409 |
+
// Detect drag-and-drop
|
5410 |
+
var dragAndDrop = function() {
|
5411 |
+
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
5412 |
+
// couldn't get it to work yet.
|
5413 |
+
if (ie_lt9) return false;
|
5414 |
+
var div = elt('div');
|
5415 |
+
return "draggable" in div || "dragDrop" in div;
|
5416 |
+
}();
|
5417 |
+
|
5418 |
+
// For a reason I have yet to figure out, some browsers disallow
|
5419 |
+
// word wrapping between certain characters *only* if a new inline
|
5420 |
+
// element is started between them. This makes it hard to reliably
|
5421 |
+
// measure the position of things, since that requires inserting an
|
5422 |
+
// extra span. This terribly fragile set of tests matches the
|
5423 |
+
// character combinations that suffer from this phenomenon on the
|
5424 |
+
// various browsers.
|
5425 |
+
function spanAffectsWrapping() { return false; }
|
5426 |
+
if (gecko) // Only for "$'"
|
5427 |
+
spanAffectsWrapping = function(str, i) {
|
5428 |
+
return str.charCodeAt(i - 1) == 36 && str.charCodeAt(i) == 39;
|
5429 |
+
};
|
5430 |
+
else if (safari && !/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent))
|
5431 |
+
spanAffectsWrapping = function(str, i) {
|
5432 |
+
return /\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(str.slice(i - 1, i + 1));
|
5433 |
+
};
|
5434 |
+
else if (webkit && !/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent))
|
5435 |
+
spanAffectsWrapping = function(str, i) {
|
5436 |
+
if (i > 1 && str.charCodeAt(i - 1) == 45) {
|
5437 |
+
if (/\w/.test(str.charAt(i - 2)) && /[^\-?\.]/.test(str.charAt(i))) return true;
|
5438 |
+
if (i > 2 && /[\d\.,]/.test(str.charAt(i - 2)) && /[\d\.,]/.test(str.charAt(i))) return false;
|
5439 |
+
}
|
5440 |
+
return /[~!#%&*)=+}\]|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|…[\w~`@#$%\^&*(_=+{[><]/.test(str.slice(i - 1, i + 1));
|
5441 |
+
};
|
5442 |
+
|
5443 |
+
var knownScrollbarWidth;
|
5444 |
+
function scrollbarWidth(measure) {
|
5445 |
+
if (knownScrollbarWidth != null) return knownScrollbarWidth;
|
5446 |
+
var test = elt("div", null, null, "width: 50px; height: 50px; overflow-x: scroll");
|
5447 |
+
removeChildrenAndAdd(measure, test);
|
5448 |
+
if (test.offsetWidth)
|
5449 |
+
knownScrollbarWidth = test.offsetHeight - test.clientHeight;
|
5450 |
+
return knownScrollbarWidth || 0;
|
5451 |
+
}
|
5452 |
+
|
5453 |
+
var zwspSupported;
|
5454 |
+
function zeroWidthElement(measure) {
|
5455 |
+
if (zwspSupported == null) {
|
5456 |
+
var test = elt("span", "\u200b");
|
5457 |
+
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
|
5458 |
+
if (measure.firstChild.offsetHeight != 0)
|
5459 |
+
zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_lt8;
|
5460 |
+
}
|
5461 |
+
if (zwspSupported) return elt("span", "\u200b");
|
5462 |
+
else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
|
5463 |
+
}
|
5464 |
+
|
5465 |
+
// See if "".split is the broken IE version, if so, provide an
|
5466 |
+
// alternative way to split lines.
|
5467 |
+
var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
|
5468 |
+
var pos = 0, result = [], l = string.length;
|
5469 |
+
while (pos <= l) {
|
5470 |
+
var nl = string.indexOf("\n", pos);
|
5471 |
+
if (nl == -1) nl = string.length;
|
5472 |
+
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
|
5473 |
+
var rt = line.indexOf("\r");
|
5474 |
+
if (rt != -1) {
|
5475 |
+
result.push(line.slice(0, rt));
|
5476 |
+
pos += rt + 1;
|
5477 |
+
} else {
|
5478 |
+
result.push(line);
|
5479 |
+
pos = nl + 1;
|
5480 |
+
}
|
5481 |
+
}
|
5482 |
+
return result;
|
5483 |
+
} : function(string){return string.split(/\r\n?|\n/);};
|
5484 |
+
CodeMirror.splitLines = splitLines;
|
5485 |
+
|
5486 |
+
var hasSelection = window.getSelection ? function(te) {
|
5487 |
+
try { return te.selectionStart != te.selectionEnd; }
|
5488 |
+
catch(e) { return false; }
|
5489 |
+
} : function(te) {
|
5490 |
+
try {var range = te.ownerDocument.selection.createRange();}
|
5491 |
+
catch(e) {}
|
5492 |
+
if (!range || range.parentElement() != te) return false;
|
5493 |
+
return range.compareEndPoints("StartToEnd", range) != 0;
|
5494 |
+
};
|
5495 |
+
|
5496 |
+
var hasCopyEvent = (function() {
|
5497 |
+
var e = elt("div");
|
5498 |
+
if ("oncopy" in e) return true;
|
5499 |
+
e.setAttribute("oncopy", "return;");
|
5500 |
+
return typeof e.oncopy == 'function';
|
5501 |
+
})();
|
5502 |
+
|
5503 |
+
// KEY NAMING
|
5504 |
+
|
5505 |
+
var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
5506 |
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
5507 |
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
5508 |
+
46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete",
|
5509 |
+
186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
5510 |
+
221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home",
|
5511 |
+
63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"};
|
5512 |
+
CodeMirror.keyNames = keyNames;
|
5513 |
+
(function() {
|
5514 |
+
// Number keys
|
5515 |
+
for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i);
|
5516 |
+
// Alphabetic keys
|
5517 |
+
for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
|
5518 |
+
// Function keys
|
5519 |
+
for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
|
5520 |
+
})();
|
5521 |
+
|
5522 |
+
// BIDI HELPERS
|
5523 |
+
|
5524 |
+
function iterateBidiSections(order, from, to, f) {
|
5525 |
+
if (!order) return f(from, to, "ltr");
|
5526 |
+
var found = false;
|
5527 |
+
for (var i = 0; i < order.length; ++i) {
|
5528 |
+
var part = order[i];
|
5529 |
+
if (part.from < to && part.to > from || from == to && part.to == from) {
|
5530 |
+
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
|
5531 |
+
found = true;
|
5532 |
+
}
|
5533 |
+
}
|
5534 |
+
if (!found) f(from, to, "ltr");
|
5535 |
+
}
|
5536 |
+
|
5537 |
+
function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
|
5538 |
+
function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
|
5539 |
+
|
5540 |
+
function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
|
5541 |
+
function lineRight(line) {
|
5542 |
+
var order = getOrder(line);
|
5543 |
+
if (!order) return line.text.length;
|
5544 |
+
return bidiRight(lst(order));
|
5545 |
+
}
|
5546 |
+
|
5547 |
+
function lineStart(cm, lineN) {
|
5548 |
+
var line = getLine(cm.doc, lineN);
|
5549 |
+
var visual = visualLine(cm.doc, line);
|
5550 |
+
if (visual != line) lineN = lineNo(visual);
|
5551 |
+
var order = getOrder(visual);
|
5552 |
+
var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
|
5553 |
+
return Pos(lineN, ch);
|
5554 |
+
}
|
5555 |
+
function lineEnd(cm, lineN) {
|
5556 |
+
var merged, line;
|
5557 |
+
while (merged = collapsedSpanAtEnd(line = getLine(cm.doc, lineN)))
|
5558 |
+
lineN = merged.find().to.line;
|
5559 |
+
var order = getOrder(line);
|
5560 |
+
var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
|
5561 |
+
return Pos(lineN, ch);
|
5562 |
+
}
|
5563 |
+
|
5564 |
+
function compareBidiLevel(order, a, b) {
|
5565 |
+
var linedir = order[0].level;
|
5566 |
+
if (a == linedir) return true;
|
5567 |
+
if (b == linedir) return false;
|
5568 |
+
return a < b;
|
5569 |
+
}
|
5570 |
+
var bidiOther;
|
5571 |
+
function getBidiPartAt(order, pos) {
|
5572 |
+
for (var i = 0, found; i < order.length; ++i) {
|
5573 |
+
var cur = order[i];
|
5574 |
+
if (cur.from < pos && cur.to > pos) { bidiOther = null; return i; }
|
5575 |
+
if (cur.from == pos || cur.to == pos) {
|
5576 |
+
if (found == null) {
|
5577 |
+
found = i;
|
5578 |
+
} else if (compareBidiLevel(order, cur.level, order[found].level)) {
|
5579 |
+
bidiOther = found;
|
5580 |
+
return i;
|
5581 |
+
} else {
|
5582 |
+
bidiOther = i;
|
5583 |
+
return found;
|
5584 |
+
}
|
5585 |
+
}
|
5586 |
+
}
|
5587 |
+
bidiOther = null;
|
5588 |
+
return found;
|
5589 |
+
}
|
5590 |
+
|
5591 |
+
function moveInLine(line, pos, dir, byUnit) {
|
5592 |
+
if (!byUnit) return pos + dir;
|
5593 |
+
do pos += dir;
|
5594 |
+
while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));
|
5595 |
+
return pos;
|
5596 |
+
}
|
5597 |
+
|
5598 |
+
// This is somewhat involved. It is needed in order to move
|
5599 |
+
// 'visually' through bi-directional text -- i.e., pressing left
|
5600 |
+
// should make the cursor go left, even when in RTL text. The
|
5601 |
+
// tricky part is the 'jumps', where RTL and LTR text touch each
|
5602 |
+
// other. This often requires the cursor offset to move more than
|
5603 |
+
// one unit, in order to visually move one unit.
|
5604 |
+
function moveVisually(line, start, dir, byUnit) {
|
5605 |
+
var bidi = getOrder(line);
|
5606 |
+
if (!bidi) return moveLogically(line, start, dir, byUnit);
|
5607 |
+
var pos = getBidiPartAt(bidi, start), part = bidi[pos];
|
5608 |
+
var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);
|
5609 |
+
|
5610 |
+
for (;;) {
|
5611 |
+
if (target > part.from && target < part.to) return target;
|
5612 |
+
if (target == part.from || target == part.to) {
|
5613 |
+
if (getBidiPartAt(bidi, target) == pos) return target;
|
5614 |
+
part = bidi[pos += dir];
|
5615 |
+
return (dir > 0) == part.level % 2 ? part.to : part.from;
|
5616 |
+
} else {
|
5617 |
+
part = bidi[pos += dir];
|
5618 |
+
if (!part) return null;
|
5619 |
+
if ((dir > 0) == part.level % 2)
|
5620 |
+
target = moveInLine(line, part.to, -1, byUnit);
|
5621 |
+
else
|
5622 |
+
target = moveInLine(line, part.from, 1, byUnit);
|
5623 |
+
}
|
5624 |
+
}
|
5625 |
+
}
|
5626 |
+
|
5627 |
+
function moveLogically(line, start, dir, byUnit) {
|
5628 |
+
var target = start + dir;
|
5629 |
+
if (byUnit) while (target > 0 && isExtendingChar.test(line.text.charAt(target))) target += dir;
|
5630 |
+
return target < 0 || target > line.text.length ? null : target;
|
5631 |
+
}
|
5632 |
+
|
5633 |
+
// Bidirectional ordering algorithm
|
5634 |
+
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
5635 |
+
// that this (partially) implements.
|
5636 |
+
|
5637 |
+
// One-char codes used for character types:
|
5638 |
+
// L (L): Left-to-Right
|
5639 |
+
// R (R): Right-to-Left
|
5640 |
+
// r (AL): Right-to-Left Arabic
|
5641 |
+
// 1 (EN): European Number
|
5642 |
+
// + (ES): European Number Separator
|
5643 |
+
// % (ET): European Number Terminator
|
5644 |
+
// n (AN): Arabic Number
|
5645 |
+
// , (CS): Common Number Separator
|
5646 |
+
// m (NSM): Non-Spacing Mark
|
5647 |
+
// b (BN): Boundary Neutral
|
5648 |
+
// s (B): Paragraph Separator
|
5649 |
+
// t (S): Segment Separator
|
5650 |
+
// w (WS): Whitespace
|
5651 |
+
// N (ON): Other Neutrals
|
5652 |
+
|
5653 |
+
// Returns null if characters are ordered as they appear
|
5654 |
+
// (left-to-right), or an array of sections ({from, to, level}
|
5655 |
+
// objects) in the order in which they occur visually.
|
5656 |
+
var bidiOrdering = (function() {
|
5657 |
+
// Character types for codepoints 0 to 0xff
|
5658 |
+
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";
|
5659 |
+
// Character types for codepoints 0x600 to 0x6ff
|
5660 |
+
var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
|
5661 |
+
function charType(code) {
|
5662 |
+
if (code <= 0xff) return lowTypes.charAt(code);
|
5663 |
+
else if (0x590 <= code && code <= 0x5f4) return "R";
|
5664 |
+
else if (0x600 <= code && code <= 0x6ff) return arabicTypes.charAt(code - 0x600);
|
5665 |
+
else if (0x700 <= code && code <= 0x8ac) return "r";
|
5666 |
+
else return "L";
|
5667 |
+
}
|
5668 |
+
|
5669 |
+
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
5670 |
+
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
|
5671 |
+
// Browsers seem to always treat the boundaries of block elements as being L.
|
5672 |
+
var outerType = "L";
|
5673 |
+
|
5674 |
+
return function(str) {
|
5675 |
+
if (!bidiRE.test(str)) return false;
|
5676 |
+
var len = str.length, types = [];
|
5677 |
+
for (var i = 0, type; i < len; ++i)
|
5678 |
+
types.push(type = charType(str.charCodeAt(i)));
|
5679 |
+
|
5680 |
+
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
5681 |
+
// change the type of the NSM to the type of the previous
|
5682 |
+
// character. If the NSM is at the start of the level run, it will
|
5683 |
+
// get the type of sor.
|
5684 |
+
for (var i = 0, prev = outerType; i < len; ++i) {
|
5685 |
+
var type = types[i];
|
5686 |
+
if (type == "m") types[i] = prev;
|
5687 |
+
else prev = type;
|
5688 |
+
}
|
5689 |
+
|
5690 |
+
// W2. Search backwards from each instance of a European number
|
5691 |
+
// until the first strong type (R, L, AL, or sor) is found. If an
|
5692 |
+
// AL is found, change the type of the European number to Arabic
|
5693 |
+
// number.
|
5694 |
+
// W3. Change all ALs to R.
|
5695 |
+
for (var i = 0, cur = outerType; i < len; ++i) {
|
5696 |
+
var type = types[i];
|
5697 |
+
if (type == "1" && cur == "r") types[i] = "n";
|
5698 |
+
else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; }
|
5699 |
+
}
|
5700 |
+
|
5701 |
+
// W4. A single European separator between two European numbers
|
5702 |
+
// changes to a European number. A single common separator between
|
5703 |
+
// two numbers of the same type changes to that type.
|
5704 |
+
for (var i = 1, prev = types[0]; i < len - 1; ++i) {
|
5705 |
+
var type = types[i];
|
5706 |
+
if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1";
|
5707 |
+
else if (type == "," && prev == types[i+1] &&
|
5708 |
+
(prev == "1" || prev == "n")) types[i] = prev;
|
5709 |
+
prev = type;
|
5710 |
+
}
|
5711 |
+
|
5712 |
+
// W5. A sequence of European terminators adjacent to European
|
5713 |
+
// numbers changes to all European numbers.
|
5714 |
+
// W6. Otherwise, separators and terminators change to Other
|
5715 |
+
// Neutral.
|
5716 |
+
for (var i = 0; i < len; ++i) {
|
5717 |
+
var type = types[i];
|
5718 |
+
if (type == ",") types[i] = "N";
|
5719 |
+
else if (type == "%") {
|
5720 |
+
for (var end = i + 1; end < len && types[end] == "%"; ++end) {}
|
5721 |
+
var replace = (i && types[i-1] == "!") || (end < len - 1 && types[end] == "1") ? "1" : "N";
|
5722 |
+
for (var j = i; j < end; ++j) types[j] = replace;
|
5723 |
+
i = end - 1;
|
5724 |
+
}
|
5725 |
+
}
|
5726 |
+
|
5727 |
+
// W7. Search backwards from each instance of a European number
|
5728 |
+
// until the first strong type (R, L, or sor) is found. If an L is
|
5729 |
+
// found, then change the type of the European number to L.
|
5730 |
+
for (var i = 0, cur = outerType; i < len; ++i) {
|
5731 |
+
var type = types[i];
|
5732 |
+
if (cur == "L" && type == "1") types[i] = "L";
|
5733 |
+
else if (isStrong.test(type)) cur = type;
|
5734 |
+
}
|
5735 |
+
|
5736 |
+
// N1. A sequence of neutrals takes the direction of the
|
5737 |
+
// surrounding strong text if the text on both sides has the same
|
5738 |
+
// direction. European and Arabic numbers act as if they were R in
|
5739 |
+
// terms of their influence on neutrals. Start-of-level-run (sor)
|
5740 |
+
// and end-of-level-run (eor) are used at level run boundaries.
|
5741 |
+
// N2. Any remaining neutrals take the embedding direction.
|
5742 |
+
for (var i = 0; i < len; ++i) {
|
5743 |
+
if (isNeutral.test(types[i])) {
|
5744 |
+
for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
|
5745 |
+
var before = (i ? types[i-1] : outerType) == "L";
|
5746 |
+
var after = (end < len - 1 ? types[end] : outerType) == "L";
|
5747 |
+
var replace = before || after ? "L" : "R";
|
5748 |
+
for (var j = i; j < end; ++j) types[j] = replace;
|
5749 |
+
i = end - 1;
|
5750 |
+
}
|
5751 |
+
}
|
5752 |
+
|
5753 |
+
// Here we depart from the documented algorithm, in order to avoid
|
5754 |
+
// building up an actual levels array. Since there are only three
|
5755 |
+
// levels (0, 1, 2) in an implementation that doesn't take
|
5756 |
+
// explicit embedding into account, we can build up the order on
|
5757 |
+
// the fly, without following the level-based algorithm.
|
5758 |
+
var order = [], m;
|
5759 |
+
for (var i = 0; i < len;) {
|
5760 |
+
if (countsAsLeft.test(types[i])) {
|
5761 |
+
var start = i;
|
5762 |
+
for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
|
5763 |
+
order.push({from: start, to: i, level: 0});
|
5764 |
+
} else {
|
5765 |
+
var pos = i, at = order.length;
|
5766 |
+
for (++i; i < len && types[i] != "L"; ++i) {}
|
5767 |
+
for (var j = pos; j < i;) {
|
5768 |
+
if (countsAsNum.test(types[j])) {
|
5769 |
+
if (pos < j) order.splice(at, 0, {from: pos, to: j, level: 1});
|
5770 |
+
var nstart = j;
|
5771 |
+
for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
|
5772 |
+
order.splice(at, 0, {from: nstart, to: j, level: 2});
|
5773 |
+
pos = j;
|
5774 |
+
} else ++j;
|
5775 |
+
}
|
5776 |
+
if (pos < i) order.splice(at, 0, {from: pos, to: i, level: 1});
|
5777 |
+
}
|
5778 |
+
}
|
5779 |
+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
5780 |
+
order[0].from = m[0].length;
|
5781 |
+
order.unshift({from: 0, to: m[0].length, level: 0});
|
5782 |
+
}
|
5783 |
+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
5784 |
+
lst(order).to -= m[0].length;
|
5785 |
+
order.push({from: len - m[0].length, to: len, level: 0});
|
5786 |
+
}
|
5787 |
+
if (order[0].level != lst(order).level)
|
5788 |
+
order.push({from: len, to: len, level: order[0].level});
|
5789 |
+
|
5790 |
+
return order;
|
5791 |
+
};
|
5792 |
+
})();
|
5793 |
+
|
5794 |
+
// THE END
|
5795 |
+
|
5796 |
+
CodeMirror.version = "3.15.0";
|
5797 |
+
|
5798 |
+
return CodeMirror;
|
5799 |
+
})();
|
modules/yith-woocommerce-ajax-search/plugin-fw/assets/js/codemirror/javascript.js
ADDED
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// TODO actually recognize syntax of TypeScript constructs
|
2 |
+
|
3 |
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
4 |
+
var indentUnit = config.indentUnit;
|
5 |
+
var statementIndent = parserConfig.statementIndent;
|
6 |
+
var jsonMode = parserConfig.json;
|
7 |
+
var isTS = parserConfig.typescript;
|
8 |
+
|
9 |
+
// Tokenizer
|
10 |
+
|
11 |
+
var keywords = function(){
|
12 |
+
function kw(type) {return {type: type, style: "keyword"};}
|
13 |
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
14 |
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
15 |
+
|
16 |
+
var jsKeywords = {
|
17 |
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
18 |
+
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, "debugger": C,
|
19 |
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
20 |
+
"function": kw("function"), "catch": kw("catch"),
|
21 |
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
22 |
+
"in": operator, "typeof": operator, "instanceof": operator,
|
23 |
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
24 |
+
"this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"),
|
25 |
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
26 |
+
};
|
27 |
+
|
28 |
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
29 |
+
if (isTS) {
|
30 |
+
var type = {type: "variable", style: "variable-3"};
|
31 |
+
var tsKeywords = {
|
32 |
+
// object-like things
|
33 |
+
"interface": kw("interface"),
|
34 |
+
"extends": kw("extends"),
|
35 |
+
"constructor": kw("constructor"),
|
36 |
+
|
37 |
+
// scope modifiers
|
38 |
+
"public": kw("public"),
|
39 |
+
"private": kw("private"),
|
40 |
+
"protected": kw("protected"),
|
41 |
+
"static": kw("static"),
|
42 |
+
|
43 |
+
// types
|
44 |
+
"string": type, "number": type, "bool": type, "any": type
|
45 |
+
};
|
46 |
+
|
47 |
+
for (var attr in tsKeywords) {
|
48 |
+
jsKeywords[attr] = tsKeywords[attr];
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
return jsKeywords;
|
53 |
+
}();
|
54 |
+
|
55 |
+
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
56 |
+
|
57 |
+
function readRegexp(stream) {
|
58 |
+
var escaped = false, next, inSet = false;
|
59 |
+
while ((next = stream.next()) != null) {
|
60 |
+
if (!escaped) {
|
61 |
+
if (next == "/" && !inSet) return;
|
62 |
+
if (next == "[") inSet = true;
|
63 |
+
else if (inSet && next == "]") inSet = false;
|
64 |
+
}
|
65 |
+
escaped = !escaped && next == "\\";
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
// Used as scratch variables to communicate multiple values without
|
70 |
+
// consing up tons of objects.
|
71 |
+
var type, content;
|
72 |
+
function ret(tp, style, cont) {
|
73 |
+
type = tp; content = cont;
|
74 |
+
return style;
|
75 |
+
}
|
76 |
+
function tokenBase(stream, state) {
|
77 |
+
var ch = stream.next();
|
78 |
+
if (ch == '"' || ch == "'") {
|
79 |
+
state.tokenize = tokenString(ch);
|
80 |
+
return state.tokenize(stream, state);
|
81 |
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
82 |
+
return ret("number", "number");
|
83 |
+
} else if (ch == "." && stream.match("..")) {
|
84 |
+
return ret("spread", "meta");
|
85 |
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
86 |
+
return ret(ch);
|
87 |
+
} else if (ch == "=" && stream.eat(">")) {
|
88 |
+
return ret("=>", "operator");
|
89 |
+
} else if (ch == "0" && stream.eat(/x/i)) {
|
90 |
+
stream.eatWhile(/[\da-f]/i);
|
91 |
+
return ret("number", "number");
|
92 |
+
} else if (/\d/.test(ch)) {
|
93 |
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
94 |
+
return ret("number", "number");
|
95 |
+
} else if (ch == "/") {
|
96 |
+
if (stream.eat("*")) {
|
97 |
+
state.tokenize = tokenComment;
|
98 |
+
return tokenComment(stream, state);
|
99 |
+
} else if (stream.eat("/")) {
|
100 |
+
stream.skipToEnd();
|
101 |
+
return ret("comment", "comment");
|
102 |
+
} else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
103 |
+
state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
|
104 |
+
readRegexp(stream);
|
105 |
+
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
106 |
+
return ret("regexp", "string-2");
|
107 |
+
} else {
|
108 |
+
stream.eatWhile(isOperatorChar);
|
109 |
+
return ret("operator", "operator", stream.current());
|
110 |
+
}
|
111 |
+
} else if (ch == "`") {
|
112 |
+
state.tokenize = tokenQuasi;
|
113 |
+
return tokenQuasi(stream, state);
|
114 |
+
} else if (ch == "#") {
|
115 |
+
stream.skipToEnd();
|
116 |
+
return ret("error", "error");
|
117 |
+
} else if (isOperatorChar.test(ch)) {
|
118 |
+
stream.eatWhile(isOperatorChar);
|
119 |
+
return ret("operator", "operator", stream.current());
|
120 |
+
} else {
|
121 |
+
stream.eatWhile(/[\w\$_]/);
|
122 |
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
123 |
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
124 |
+
ret("variable", "variable", word);
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
function tokenString(quote) {
|
129 |
+
return function(stream, state) {
|
130 |
+
var escaped = false, next;
|
131 |
+
while ((next = stream.next()) != null) {
|
132 |
+
if (next == quote && !escaped) break;
|
133 |
+
escaped = !escaped && next == "\\";
|
134 |
+
}
|
135 |
+
if (!escaped) state.tokenize = tokenBase;
|
136 |
+
return ret("string", "string");
|
137 |
+
};
|
138 |
+
}
|
139 |
+
|
140 |
+
function tokenComment(stream, state) {
|
141 |
+
var maybeEnd = false, ch;
|
142 |
+
while (ch = stream.next()) {
|
143 |
+
if (ch == "/" && maybeEnd) {
|
144 |
+
state.tokenize = tokenBase;
|
145 |
+
break;
|
146 |
+
}
|
147 |
+
maybeEnd = (ch == "*");
|
148 |
+
}
|
149 |
+
return ret("comment", "comment");
|
150 |
+
}
|
151 |
+
|
152 |
+
function tokenQuasi(stream, state) {
|
153 |
+
var escaped = false, next;
|
154 |
+
while ((next = stream.next()) != null) {
|
155 |
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
156 |
+
state.tokenize = tokenBase;
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
escaped = !escaped && next == "\\";
|
160 |
+
}
|
161 |
+
return ret("quasi", "string-2", stream.current());
|
162 |
+
}
|
163 |
+
|
164 |
+
var brackets = "([{}])";
|
165 |
+
// This is a crude lookahead trick to try and notice that we're
|
166 |
+
// parsing the argument patterns for a fat-arrow function before we
|
167 |
+
// actually hit the arrow token. It only works if the arrow is on
|
168 |
+
// the same line as the arguments and there's no strange noise
|
169 |
+
// (comments) in between. Fallback is to only notice when we hit the
|
170 |
+
// arrow, and not declare the arguments as locals for the arrow
|
171 |
+
// body.
|
172 |
+
function findFatArrow(stream, state) {
|
173 |
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
174 |
+
var arrow = stream.string.indexOf("=>", stream.start);
|
175 |
+
if (arrow < 0) return;
|
176 |
+
|
177 |
+
var depth = 0, sawSomething = false;
|
178 |
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
179 |
+
var ch = stream.string.charAt(pos);
|
180 |
+
var bracket = brackets.indexOf(ch);
|
181 |
+
if (bracket >= 0 && bracket < 3) {
|
182 |
+
if (!depth) { ++pos; break; }
|
183 |
+
if (--depth == 0) break;
|
184 |
+
} else if (bracket >= 3 && bracket < 6) {
|
185 |
+
++depth;
|
186 |
+
} else if (/[$\w]/.test(ch)) {
|
187 |
+
sawSomething = true;
|
188 |
+
} else if (sawSomething && !depth) {
|
189 |
+
++pos;
|
190 |
+
break;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
194 |
+
}
|
195 |
+
|
196 |
+
// Parser
|
197 |
+
|
198 |
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true};
|
199 |
+
|
200 |
+
function JSLexical(indented, column, type, align, prev, info) {
|
201 |
+
this.indented = indented;
|
202 |
+
this.column = column;
|
203 |
+
this.type = type;
|
204 |
+
this.prev = prev;
|
205 |
+
this.info = info;
|
206 |
+
if (align != null) this.align = align;
|
207 |
+
}
|
208 |
+
|
209 |
+
function inScope(state, varname) {
|
210 |
+
for (var v = state.localVars; v; v = v.next)
|
211 |
+
if (v.name == varname) return true;
|
212 |
+
for (var cx = state.context; cx; cx = cx.prev) {
|
213 |
+
for (var v = cx.vars; v; v = v.next)
|
214 |
+
if (v.name == varname) return true;
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
+
function parseJS(state, style, type, content, stream) {
|
219 |
+
var cc = state.cc;
|
220 |
+
// Communicate our context to the combinators.
|
221 |
+
// (Less wasteful than consing up a hundred closures on every call.)
|
222 |
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
223 |
+
|
224 |
+
if (!state.lexical.hasOwnProperty("align"))
|
225 |
+
state.lexical.align = true;
|
226 |
+
|
227 |
+
while(true) {
|
228 |
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
229 |
+
if (combinator(type, content)) {
|
230 |
+
while(cc.length && cc[cc.length - 1].lex)
|
231 |
+
cc.pop()();
|
232 |
+
if (cx.marked) return cx.marked;
|
233 |
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
234 |
+
return style;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
+
// Combinator utils
|
240 |
+
|
241 |
+
var cx = {state: null, column: null, marked: null, cc: null};
|
242 |
+
function pass() {
|
243 |
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
244 |
+
}
|
245 |
+
function cont() {
|
246 |
+
pass.apply(null, arguments);
|
247 |
+
return true;
|
248 |
+
}
|
249 |
+
function register(varname) {
|
250 |
+
function inList(list) {
|
251 |
+
for (var v = list; v; v = v.next)
|
252 |
+
if (v.name == varname) return true;
|
253 |
+
return false;
|
254 |
+
}
|
255 |
+
var state = cx.state;
|
256 |
+
if (state.context) {
|
257 |
+
cx.marked = "def";
|
258 |
+
if (inList(state.localVars)) return;
|
259 |
+
state.localVars = {name: varname, next: state.localVars};
|
260 |
+
} else {
|
261 |
+
if (inList(state.globalVars)) return;
|
262 |
+
if (parserConfig.globalVars)
|
263 |
+
state.globalVars = {name: varname, next: state.globalVars};
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
267 |
+
// Combinators
|
268 |
+
|
269 |
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
270 |
+
function pushcontext() {
|
271 |
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
272 |
+
cx.state.localVars = defaultVars;
|
273 |
+
}
|
274 |
+
function popcontext() {
|
275 |
+
cx.state.localVars = cx.state.context.vars;
|
276 |
+
cx.state.context = cx.state.context.prev;
|
277 |
+
}
|
278 |
+
function pushlex(type, info) {
|
279 |
+
var result = function() {
|
280 |
+
var state = cx.state, indent = state.indented;
|
281 |
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
282 |
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
283 |
+
};
|
284 |
+
result.lex = true;
|
285 |
+
return result;
|
286 |
+
}
|
287 |
+
function poplex() {
|
288 |
+
var state = cx.state;
|
289 |
+
if (state.lexical.prev) {
|
290 |
+
if (state.lexical.type == ")")
|
291 |
+
state.indented = state.lexical.indented;
|
292 |
+
state.lexical = state.lexical.prev;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
poplex.lex = true;
|
296 |
+
|
297 |
+
function expect(wanted) {
|
298 |
+
return function(type) {
|
299 |
+
if (type == wanted) return cont();
|
300 |
+
else if (wanted == ";") return pass();
|
301 |
+
else return cont(arguments.callee);
|
302 |
+
};
|
303 |
+
}
|
304 |
+
|
305 |
+
function statement(type, value) {
|
306 |
+
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
307 |
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
308 |
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
309 |
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
310 |
+
if (type == ";") return cont();
|
311 |
+
if (type == "if") return cont(pushlex("form"), expression, statement, poplex, maybeelse);
|
312 |
+
if (type == "function") return cont(functiondef);
|
313 |
+
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
314 |
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
315 |
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
316 |
+
block, poplex, poplex);
|
317 |
+
if (type == "case") return cont(expression, expect(":"));
|
318 |
+
if (type == "default") return cont(expect(":"));
|
319 |
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
320 |
+
statement, poplex, popcontext);
|
321 |
+
if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex);
|
322 |
+
if (type == "class") return cont(pushlex("form"), className, objlit, poplex);
|
323 |
+
if (type == "export") return cont(pushlex("form"), afterExport, poplex);
|
324 |
+
if (type == "import") return cont(pushlex("form"), afterImport, poplex);
|
325 |
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
326 |
+
}
|
327 |
+
function expression(type) {
|
328 |
+
return expressionInner(type, false);
|
329 |
+
}
|
330 |
+
function expressionNoComma(type) {
|
331 |
+
return expressionInner(type, true);
|
332 |
+
}
|
333 |
+
function expressionInner(type, noComma) {
|
334 |
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
335 |
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
336 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
|
337 |
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
338 |
+
}
|
339 |
+
|
340 |
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
341 |
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
342 |
+
if (type == "function") return cont(functiondef);
|
343 |
+
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
344 |
+
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
|
345 |
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
346 |
+
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
347 |
+
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
348 |
+
return cont();
|
349 |
+
}
|
350 |
+
function maybeexpression(type) {
|
351 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
352 |
+
return pass(expression);
|
353 |
+
}
|
354 |
+
function maybeexpressionNoComma(type) {
|
355 |
+
if (type.match(/[;\}\)\],]/)) return pass();
|
356 |
+
return pass(expressionNoComma);
|
357 |
+
}
|
358 |
+
|
359 |
+
function maybeoperatorComma(type, value) {
|
360 |
+
if (type == ",") return cont(expression);
|
361 |
+
return maybeoperatorNoComma(type, value, false);
|
362 |
+
}
|
363 |
+
function maybeoperatorNoComma(type, value, noComma) {
|
364 |
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
365 |
+
var expr = noComma == false ? expression : expressionNoComma;
|
366 |
+
if (value == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
367 |
+
if (type == "operator") {
|
368 |
+
if (/\+\+|--/.test(value)) return cont(me);
|
369 |
+
if (value == "?") return cont(expression, expect(":"), expr);
|
370 |
+
return cont(expr);
|
371 |
+
}
|
372 |
+
if (type == "quasi") { cx.cc.push(me); return quasi(value); }
|
373 |
+
if (type == ";") return;
|
374 |
+
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
375 |
+
if (type == ".") return cont(property, me);
|
376 |
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
377 |
+
}
|
378 |
+
function quasi(value) {
|
379 |
+
if (value.slice(value.length - 2) != "${") return cont();
|
380 |
+
return cont(expression, continueQuasi);
|
381 |
+
}
|
382 |
+
function continueQuasi(type) {
|
383 |
+
if (type == "}") {
|
384 |
+
cx.marked = "string-2";
|
385 |
+
cx.state.tokenize = tokenQuasi;
|
386 |
+
return cont();
|
387 |
+
}
|
388 |
+
}
|
389 |
+
function arrowBody(type) {
|
390 |
+
findFatArrow(cx.stream, cx.state);
|
391 |
+
if (type == "{") return pass(statement);
|
392 |
+
return pass(expression);
|
393 |
+
}
|
394 |
+
function arrowBodyNoComma(type) {
|
395 |
+
findFatArrow(cx.stream, cx.state);
|
396 |
+
if (type == "{") return pass(statement);
|
397 |
+
return pass(expressionNoComma);
|
398 |
+
}
|
399 |
+
function maybelabel(type) {
|
400 |
+
if (type == ":") return cont(poplex, statement);
|
401 |
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
402 |
+
}
|
403 |
+
function property(type) {
|
404 |
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
405 |
+
}
|
406 |
+
function objprop(type, value) {
|
407 |
+
if (type == "variable") {
|
408 |
+
cx.marked = "property";
|
409 |
+
if (value == "get" || value == "set") return cont(getterSetter);
|
410 |
+
} else if (type == "number" || type == "string") {
|
411 |
+
cx.marked = type + " property";
|
412 |
+
} else if (type == "[") {
|
413 |
+
return cont(expression, expect("]"), afterprop);
|
414 |
+
}
|
415 |
+
if (atomicTypes.hasOwnProperty(type)) return cont(afterprop);
|
416 |
+
}
|
417 |
+
function getterSetter(type) {
|
418 |
+
if (type != "variable") return pass(afterprop);
|
419 |
+
cx.marked = "property";
|
420 |
+
return cont(functiondef);
|
421 |
+
}
|
422 |
+
function afterprop(type) {
|
423 |
+
if (type == ":") return cont(expressionNoComma);
|
424 |
+
if (type == "(") return pass(functiondef);
|
425 |
+
}
|
426 |
+
function commasep(what, end) {
|
427 |
+
function proceed(type) {
|
428 |
+
if (type == ",") {
|
429 |
+
var lex = cx.state.lexical;
|
430 |
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
431 |
+
return cont(what, proceed);
|
432 |
+
}
|
433 |
+
if (type == end) return cont();
|
434 |
+
return cont(expect(end));
|
435 |
+
}
|
436 |
+
return function(type) {
|
437 |
+
if (type == end) return cont();
|
438 |
+
return pass(what, proceed);
|
439 |
+
};
|
440 |
+
}
|
441 |
+
function contCommasep(what, end, info) {
|
442 |
+
for (var i = 3; i < arguments.length; i++)
|
443 |
+
cx.cc.push(arguments[i]);
|
444 |
+
return cont(pushlex(end, info), commasep(what, end), poplex);
|
445 |
+
}
|
446 |
+
function block(type) {
|
447 |
+
if (type == "}") return cont();
|
448 |
+
return pass(statement, block);
|
449 |
+
}
|
450 |
+
function maybetype(type) {
|
451 |
+
if (isTS && type == ":") return cont(typedef);
|
452 |
+
}
|
453 |
+
function typedef(type) {
|
454 |
+
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
455 |
+
}
|
456 |
+
function vardef() {
|
457 |
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
458 |
+
}
|
459 |
+
function pattern(type, value) {
|
460 |
+
if (type == "variable") { register(value); return cont(); }
|
461 |
+
if (type == "[") return contCommasep(pattern, "]");
|
462 |
+
if (type == "{") return contCommasep(proppattern, "}");
|
463 |
+
}
|
464 |
+
function proppattern(type, value) {
|
465 |
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
466 |
+
register(value);
|
467 |
+
return cont(maybeAssign);
|
468 |
+
}
|
469 |
+
if (type == "variable") cx.marked = "property";
|
470 |
+
return cont(expect(":"), pattern, maybeAssign);
|
471 |
+
}
|
472 |
+
function maybeAssign(_type, value) {
|
473 |
+
if (value == "=") return cont(expressionNoComma);
|
474 |
+
}
|
475 |
+
function vardefCont(type) {
|
476 |
+
if (type == ",") return cont(vardef);
|
477 |
+
}
|
478 |
+
function maybeelse(type, value) {
|
479 |
+
if (type == "keyword b" && value == "else") return cont(pushlex("form"), statement, poplex);
|
480 |
+
}
|
481 |
+
function forspec(type) {
|
482 |
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
483 |
+
}
|
484 |
+
function forspec1(type) {
|
485 |
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
486 |
+
if (type == ";") return cont(forspec2);
|
487 |
+
if (type == "variable") return cont(formaybeinof);
|
488 |
+
return pass(expression, expect(";"), forspec2);
|
489 |
+
}
|
490 |
+
function formaybeinof(_type, value) {
|
491 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
492 |
+
return cont(maybeoperatorComma, forspec2);
|
493 |
+
}
|
494 |
+
function forspec2(type, value) {
|
495 |
+
if (type == ";") return cont(forspec3);
|
496 |
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
497 |
+
return pass(expression, expect(";"), forspec3);
|
498 |
+
}
|
499 |
+
function forspec3(type) {
|
500 |
+
if (type != ")") cont(expression);
|
501 |
+
}
|
502 |
+
function functiondef(type, value) {
|
503 |
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
504 |
+
if (type == "variable") {register(value); return cont(functiondef);}
|
505 |
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext);
|
506 |
+
}
|
507 |
+
function funarg(type) {
|
508 |
+
if (type == "spread") return cont(funarg);
|
509 |
+
return pass(pattern, maybetype);
|
510 |
+
}
|
511 |
+
function className(type, value) {
|
512 |
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
513 |
+
}
|
514 |
+
function classNameAfter(_type, value) {
|
515 |
+
if (value == "extends") return cont(expression);
|
516 |
+
}
|
517 |
+
function objlit(type) {
|
518 |
+
if (type == "{") return contCommasep(objprop, "}");
|
519 |
+
}
|
520 |
+
function afterModule(type, value) {
|
521 |
+
if (type == "string") return cont(statement);
|
522 |
+
if (type == "variable") { register(value); return cont(maybeFrom); }
|
523 |
+
}
|
524 |
+
function afterExport(_type, value) {
|
525 |
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
526 |
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
527 |
+
return pass(statement);
|
528 |
+
}
|
529 |
+
function afterImport(type) {
|
530 |
+
if (type == "string") return cont();
|
531 |
+
return pass(importSpec, maybeFrom);
|
532 |
+
}
|
533 |
+
function importSpec(type, value) {
|
534 |
+
if (type == "{") return contCommasep(importSpec, "}");
|
535 |
+
if (type == "variable") register(value);
|
536 |
+
return cont();
|
537 |
+
}
|
538 |
+
function maybeFrom(_type, value) {
|
539 |
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
540 |
+
}
|
541 |
+
function arrayLiteral(type) {
|
542 |
+
if (type == "]") return cont();
|
543 |
+
return pass(expressionNoComma, maybeArrayComprehension);
|
544 |
+
}
|
545 |
+
function maybeArrayComprehension(type) {
|
546 |
+
if (type == "for") return pass(comprehension, expect("]"));
|
547 |
+
if (type == ",") return cont(commasep(expressionNoComma, "]"));
|
548 |
+
return pass(commasep(expressionNoComma, "]"));
|
549 |
+
}
|
550 |
+
function comprehension(type) {
|
551 |
+
if (type == "for") return cont(forspec, comprehension);
|
552 |
+
if (type == "if") return cont(expression, comprehension);
|
553 |
+
}
|
554 |
+
|
555 |
+
// Interface
|
556 |
+
|
557 |
+
return {
|
558 |
+
startState: function(basecolumn) {
|
559 |
+
var state = {
|
560 |
+
tokenize: tokenBase,
|
561 |
+
lastType: "sof",
|
562 |
+
cc: [],
|
563 |
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
564 |
+
localVars: parserConfig.localVars,
|
565 |
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
566 |
+
indented: 0
|
567 |
+
};
|
568 |
+
if (parserConfig.globalVars) state.globalVars = parserConfig.globalVars;
|
569 |
+
return state;
|
570 |
+
},
|
571 |
+
|
572 |
+
token: function(stream, state) {
|
573 |
+
if (stream.sol()) {
|
574 |
+
if (!state.lexical.hasOwnProperty("align"))
|
575 |
+
state.lexical.align = false;
|
576 |
+
state.indented = stream.indentation();
|
577 |
+
findFatArrow(stream, state);
|
578 |
+
}
|
579 |
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
580 |
+
var style = state.tokenize(stream, state);
|
581 |
+
if (type == "comment") return style;
|
582 |
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
583 |
+
return parseJS(state, style, type, content, stream);
|
584 |
+
},
|
585 |
+
|
586 |
+
indent: function(state, textAfter) {
|
587 |
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
588 |
+
if (state.tokenize != tokenBase) return 0;
|
589 |
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
590 |
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
591 |
+
for (var i = state.cc.length - 1; i >= 0; --i) {
|
592 |
+
var c = state.cc[i];
|
593 |
+
if (c == poplex) lexical = lexical.prev;
|
594 |
+
else if (c != maybeelse) break;
|
595 |
+
}
|
596 |
+
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
597 |
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
598 |
+
lexical = lexical.prev;
|
599 |
+
var type = lexical.type, closing = firstChar == type;
|
600 |
+
|
601 |
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
602 |
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
603 |
+
else if (type == "form") return lexical.indented + indentUnit;
|
604 |
+
else if (type == "stat")
|
605 |
+
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);
|
606 |
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
607 |
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
608 |
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
609 |
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
610 |
+
},
|
611 |
+
|
612 |
+
electricChars: ":{}",
|
613 |
+
blockCommentStart: jsonMode ? null : "/*",
|
614 |
+
blockCommentEnd: jsonMode ? null : "*/",
|
615 |
+
lineComment: jsonMode ? null : "//",
|
616 |
+
fold: "brace",
|
617 |
+
|
618 |
+
helperType: jsonMode ? "json" : "javascript",
|
619 |
+
jsonMode: jsonMode
|
620 |
+
};
|
621 |
+
});
|
622 |
+
|
623 |
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
624 |
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
625 |
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
626 |
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
627 |
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
628 |
+
CodeMirror.define
|