Version Description
Released 30 October 2019
- Update: Plugin framework
Download this release
Release Info
Developer | yithemes |
Plugin | YITH WooCommerce Quick View |
Version | 1.3.15 |
Comparing to | |
See all releases |
Code changes from version 1.3.14 to 1.3.15
- README.txt +5 -1
- init.php +1 -1
- languages/yith-woocommerce-quick-view-it_IT.po +585 -585
- languages/yith-woocommerce-quick-view.pot +274 -274
- plugin-fw/assets/css/admin.css +196 -196
- plugin-fw/assets/css/codemirror/codemirror.css +260 -260
- plugin-fw/assets/css/colorbox.css +65 -65
- plugin-fw/assets/css/metaboxes.css +720 -720
- plugin-fw/assets/css/yit-plugin-panel.css +482 -482
- plugin-fw/assets/css/yit-upgrade-to-pro.css +76 -76
- plugin-fw/assets/css/yit-upgrader.css +21 -21
- plugin-fw/assets/css/yith-fields.css +2157 -2157
- plugin-fw/assets/css/yith-select2-no-wc.css +740 -740
- plugin-fw/assets/js/codemirror/codemirror.js +5799 -5799
- plugin-fw/assets/js/codemirror/javascript.js +630 -630
- plugin-fw/assets/js/how-to.js +6 -6
- plugin-fw/assets/js/how-to.min.js +1 -1
- plugin-fw/assets/js/jquery.colorbox.js +1104 -1104
- plugin-fw/assets/js/jquery.colorbox.min.js +33 -33
- plugin-fw/assets/js/metabox.js +137 -137
- plugin-fw/assets/js/metabox.min.js +7 -7
- plugin-fw/assets/js/multisite-updater.js +222 -222
- plugin-fw/assets/js/yit-cpt-unlimited.js +79 -79
- plugin-fw/assets/js/yit-cpt-unlimited.min.js +1 -1
- plugin-fw/assets/js/yit-plugin-panel.js +151 -151
- plugin-fw/assets/js/yit-plugin-panel.min.js +7 -7
- plugin-fw/assets/js/yit-wp-pointer.js +82 -82
- plugin-fw/assets/js/yit-wp-pointer.min.js +6 -6
- plugin-fw/assets/js/yith-colorpicker.min.js +11 -11
- plugin-fw/assets/js/yith-enhanced-select-wc-2.6.js +147 -147
- plugin-fw/assets/js/yith-enhanced-select-wc-2.6.min.js +5 -5
- plugin-fw/assets/js/yith-enhanced-select.js +197 -197
- plugin-fw/assets/js/yith-fields.js +705 -705
- plugin-fw/assets/js/yith-fields.min.js +0 -6
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: yithemes
|
|
3 |
Tags: woocommerce, quick view, woocommerce quick view, products quick view
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 1.3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -42,6 +42,10 @@ Full documentation is available [here](http://yithemes.com/docs-plugins/yith-woo
|
|
42 |
|
43 |
== Changelog ==
|
44 |
|
|
|
|
|
|
|
|
|
45 |
= 1.3.14 = Released 28 October 2019
|
46 |
|
47 |
* New: Support for WooCommerce 3.8
|
3 |
Tags: woocommerce, quick view, woocommerce quick view, products quick view
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 1.3.15
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
42 |
|
43 |
== Changelog ==
|
44 |
|
45 |
+
= 1.3.15 = Released 30 October 2019
|
46 |
+
|
47 |
+
* Update: Plugin framework
|
48 |
+
|
49 |
= 1.3.14 = Released 28 October 2019
|
50 |
|
51 |
* New: Support for WooCommerce 3.8
|
init.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: YITH WooCommerce Quick View
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
|
5 |
* Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
-
* Version: 1.3.
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-quick-view
|
3 |
* Plugin Name: YITH WooCommerce Quick View
|
4 |
* Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-quick-view
|
5 |
* Description: The <code><strong>YITH WooCommerce Quick View</strong></code> plugin allows your customers to have a quick look about products. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
|
6 |
+
* Version: 1.3.15
|
7 |
* Author: YITH
|
8 |
* Author URI: https://yithemes.com/
|
9 |
* Text Domain: yith-woocommerce-quick-view
|
languages/yith-woocommerce-quick-view-it_IT.po
CHANGED
@@ -1,585 +1,585 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: YITH WooCommerce Quick View\n"
|
4 |
-
"POT-Creation-Date: 2017-10-11 12:42+0200\n"
|
5 |
-
"PO-Revision-Date: 2017-10-11 12:42+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.7.1\n"
|
13 |
-
"X-Poedit-Basepath: .\n"
|
14 |
-
"Plural-Forms: nplurals=2; plural=n!=1;\n"
|
15 |
-
"X-Poedit-KeywordsList: __ ;_e;_n:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
16 |
-
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
-
"X-Poedit-SearchPath-0: ..\n"
|
19 |
-
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
20 |
-
|
21 |
-
#: ../includes/class.yith-wcqv-admin.php:129
|
22 |
-
#: ../includes/class.yith-wcqv-admin.php:151
|
23 |
-
msgid "Settings"
|
24 |
-
msgstr "Impostazioni"
|
25 |
-
|
26 |
-
#: ../includes/class.yith-wcqv-admin.php:130
|
27 |
-
#: ../includes/class.yith-wcqv-admin.php:152
|
28 |
-
msgid "Premium Version"
|
29 |
-
msgstr "Versione premium"
|
30 |
-
|
31 |
-
#: ../includes/class.yith-wcqv-admin.php:158
|
32 |
-
#: ../includes/class.yith-wcqv-admin.php:159
|
33 |
-
#: ../plugin-options/settings-options.php:57
|
34 |
-
msgid "Quick View"
|
35 |
-
msgstr "Quick view"
|
36 |
-
|
37 |
-
#: ../includes/class.yith-wcqv-admin.php:213
|
38 |
-
msgid "Plugin Documentation"
|
39 |
-
msgstr "Documentazione plugin"
|
40 |
-
|
41 |
-
#: ../init.php:41
|
42 |
-
msgid ""
|
43 |
-
"YITH WooCommerce Quick View is enabled but not effective. It requires "
|
44 |
-
"WooCommerce in order to work."
|
45 |
-
msgstr ""
|
46 |
-
"YITH WooCommerce Quick View è abilitato ma non in funzione. Devi aver "
|
47 |
-
"installato WooCommerce perché questo possa funzionare correttamente."
|
48 |
-
|
49 |
-
#: ../init.php:50
|
50 |
-
msgid ""
|
51 |
-
"You can't activate the free version of YITH WooCommerce Quick View while you "
|
52 |
-
"are using the premium one."
|
53 |
-
msgstr ""
|
54 |
-
"Non è possibile attivare la versione free di YITH WooCommerce Colors and "
|
55 |
-
"Labels Variations se stai già utilizzando la premium."
|
56 |
-
|
57 |
-
#: ../plugin-options/settings-options.php:8
|
58 |
-
msgid "Upgrade to the PREMIUM VERSION"
|
59 |
-
msgstr "Aggiorna alla VERSIONE PREMIUM"
|
60 |
-
|
61 |
-
#: ../plugin-options/settings-options.php:11
|
62 |
-
#: ../plugin-options/settings-options.php:18
|
63 |
-
msgid "YITH WooCommerce Quick View"
|
64 |
-
msgstr "YITH WooCommerce Quick View"
|
65 |
-
|
66 |
-
#: ../plugin-options/settings-options.php:12
|
67 |
-
msgid "Discover the Advanced Features"
|
68 |
-
msgstr "Scopri le funzionalità avanzate"
|
69 |
-
|
70 |
-
#: ../plugin-options/settings-options.php:13
|
71 |
-
msgid ""
|
72 |
-
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Quick View to benefit "
|
73 |
-
"from all features!"
|
74 |
-
msgstr ""
|
75 |
-
"Aggiorna alla VERSIONE PREMIUM di YITH WooCommerce Quick View per usufruire "
|
76 |
-
"di tutte le sue funzionalità!"
|
77 |
-
|
78 |
-
#: ../plugin-options/settings-options.php:20
|
79 |
-
msgid "Get Support and Pro Features"
|
80 |
-
msgstr "Ottieni supporto e funzionalità aggiuntive"
|
81 |
-
|
82 |
-
#: ../plugin-options/settings-options.php:21
|
83 |
-
msgid ""
|
84 |
-
"By purchasing the premium version of the plugin, you will take advantage of "
|
85 |
-
"the advanced features of the product and you will get one year of free "
|
86 |
-
"updates and support through our platform available 24h/24."
|
87 |
-
msgstr ""
|
88 |
-
"Acquistando la versione premium del plugin, potrai beneficiare delle "
|
89 |
-
"funzionalità avanzate del prodotto ed otterrai un anno di aggiornamenti "
|
90 |
-
"gratuiti e supporto per mezzo della nostra piattaforma disponibile 24h/24."
|
91 |
-
|
92 |
-
#: ../plugin-options/settings-options.php:31
|
93 |
-
msgid "General Options"
|
94 |
-
msgstr "Opzioni generali"
|
95 |
-
|
96 |
-
#: ../plugin-options/settings-options.php:39
|
97 |
-
msgid "Enable Quick View"
|
98 |
-
msgstr "Abilita quick view"
|
99 |
-
|
100 |
-
#: ../plugin-options/settings-options.php:46
|
101 |
-
msgid "Enable Quick View on mobile"
|
102 |
-
msgstr "Abilita quick view su dispositivi mobili"
|
103 |
-
|
104 |
-
#: ../plugin-options/settings-options.php:47
|
105 |
-
msgid "Enable quick view features on mobile device too"
|
106 |
-
msgstr "Abilita funzionalità quick view anche sui dispositivi mobili"
|
107 |
-
|
108 |
-
#: ../plugin-options/settings-options.php:54
|
109 |
-
msgid "Quick View Button Label"
|
110 |
-
msgstr "Testo pulsante quick view"
|
111 |
-
|
112 |
-
#: ../plugin-options/settings-options.php:55
|
113 |
-
msgid "Label for the quick view button in the WooCommerce loop."
|
114 |
-
msgstr "Testo per il pulsante Quick view nella pagina shop di WooCommerce"
|
115 |
-
|
116 |
-
#: ../plugin-options/settings-options.php:62
|
117 |
-
msgid "Enable Lightbox"
|
118 |
-
msgstr "Abilita lightbox"
|
119 |
-
|
120 |
-
#: ../plugin-options/settings-options.php:63
|
121 |
-
msgid "Enable lightbox. Product images will open in a lightbox."
|
122 |
-
msgstr ""
|
123 |
-
"Abilita la lightbox. Le immagini dei prodotti si apriranno in una lightbox."
|
124 |
-
|
125 |
-
#: ../plugin-options/settings-options.php:74 ../templates/admin/premium.php:323
|
126 |
-
#: ../templates/admin/premium.php:328
|
127 |
-
msgid "Style Options"
|
128 |
-
msgstr "Opzioni di stile"
|
129 |
-
|
130 |
-
#: ../plugin-options/settings-options.php:81
|
131 |
-
msgid "Modal Window Background Color"
|
132 |
-
msgstr "Colore finestra modale"
|
133 |
-
|
134 |
-
#: ../plugin-options/settings-options.php:89
|
135 |
-
msgid "Closing Button Color"
|
136 |
-
msgstr "Colore pulsante chiusura"
|
137 |
-
|
138 |
-
#: ../plugin-options/settings-options.php:97
|
139 |
-
msgid "Closing Button Hover Color"
|
140 |
-
msgstr "Colore pulsante chiusura al passaggio del mouse"
|
141 |
-
|
142 |
-
#: ../templates/admin/premium.php:210 ../templates/admin/premium.php:364
|
143 |
-
#, php-format
|
144 |
-
msgid ""
|
145 |
-
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to "
|
146 |
-
"benefit from all features!"
|
147 |
-
msgstr ""
|
148 |
-
"Aggiorna alla %1$sversione premium%2$s di %1$sYITH WooCommerce Quick View"
|
149 |
-
"%2$s per usufruire di tutte le sue funzionalità!"
|
150 |
-
|
151 |
-
#: ../templates/admin/premium.php:213 ../templates/admin/premium.php:367
|
152 |
-
msgid "UPGRADE"
|
153 |
-
msgstr "AGGIORNA"
|
154 |
-
|
155 |
-
#: ../templates/admin/premium.php:214 ../templates/admin/premium.php:368
|
156 |
-
msgid "to the premium version"
|
157 |
-
msgstr "alla versione premium"
|
158 |
-
|
159 |
-
#: ../templates/admin/premium.php:220
|
160 |
-
msgid "Premium Features"
|
161 |
-
msgstr "Funzionalità premium"
|
162 |
-
|
163 |
-
#: ../templates/admin/premium.php:223
|
164 |
-
msgid "Button type"
|
165 |
-
msgstr "Tipologia pulsante"
|
166 |
-
|
167 |
-
#: ../templates/admin/premium.php:228
|
168 |
-
msgid "BUTTON TYPE"
|
169 |
-
msgstr "TIPOLOGIA PULSANTE"
|
170 |
-
|
171 |
-
#: ../templates/admin/premium.php:230
|
172 |
-
#, php-format
|
173 |
-
msgid ""
|
174 |
-
"Choose between the button or a custom icon to access the %1$sQuick View%2$s: "
|
175 |
-
"you can choose to place it after the \"Add To Cart\" button or inside the "
|
176 |
-
"thumbnail of the product."
|
177 |
-
msgstr ""
|
178 |
-
"Scegli tra il pulsante o un’icona personalizzata per avviare la %1$squick "
|
179 |
-
"view%2$s: scegli tu se dopo il pulsante “Aggiungi al carrello” o sulla "
|
180 |
-
"immagine thumbnail del prodotto."
|
181 |
-
|
182 |
-
#: ../templates/admin/premium.php:238 ../templates/admin/premium.php:239
|
183 |
-
#: ../templates/admin/premium.php:244
|
184 |
-
msgid "Product Navigation"
|
185 |
-
msgstr "Navigazione prodotti"
|
186 |
-
|
187 |
-
#: ../templates/admin/premium.php:241
|
188 |
-
#, php-format
|
189 |
-
msgid ""
|
190 |
-
"The navigation in the \"Quick View\" allows browsing among %1$sproducts%2$s "
|
191 |
-
"displayed in it. The navigation arrows show on mousehover the image of the "
|
192 |
-
"next/previous product."
|
193 |
-
msgstr ""
|
194 |
-
"La navigazione all’interno della visualizzazione rapida permette di scorrere "
|
195 |
-
"tra i %1$sprodotti%2$s visualizzati. Quando si passa il cursore sulle frecce "
|
196 |
-
"di navigazione, queste mostrano l’immagine del prodotto immediatamente "
|
197 |
-
"successivo o precedente."
|
198 |
-
|
199 |
-
#: ../templates/admin/premium.php:255 ../templates/admin/premium.php:256
|
200 |
-
msgid "Content to display"
|
201 |
-
msgstr "Contenuto da mostrare"
|
202 |
-
|
203 |
-
#: ../templates/admin/premium.php:258
|
204 |
-
#, php-format
|
205 |
-
msgid ""
|
206 |
-
"The display of the product information in the \"Quick View\" are managed by "
|
207 |
-
"%1$sadministrators%2$s who can decide whether to show everything or only a "
|
208 |
-
"part of it."
|
209 |
-
msgstr ""
|
210 |
-
"La visualizzazione delle informazioni del prodotto all’interno della “Quick "
|
211 |
-
"View” sono gestite dall’%1$samministratore%2$s che può decidere se mostrare "
|
212 |
-
"tutto o solo una parte di esse."
|
213 |
-
|
214 |
-
#: ../templates/admin/premium.php:267
|
215 |
-
msgid "Quick View Type"
|
216 |
-
msgstr "Tipologia quick view"
|
217 |
-
|
218 |
-
#: ../templates/admin/premium.php:269
|
219 |
-
#, php-format
|
220 |
-
msgid ""
|
221 |
-
"Quick view has two different displaying modes: the first one opens it as a "
|
222 |
-
"%1$smodal window%2$s, the other one opens it in the page itself with a "
|
223 |
-
"%1$scascading effect%2$s above content page."
|
224 |
-
msgstr ""
|
225 |
-
"La visualizzazione rapida del prodotto può avvenire in due modi: all’interno "
|
226 |
-
"di una %1$sfinestra modale%2$s o all’interno della stessa pagina con "
|
227 |
-
"%1$seffetto a cascata%2$s sul resto del contenuto."
|
228 |
-
|
229 |
-
#: ../templates/admin/premium.php:272
|
230 |
-
msgid "Quick view type"
|
231 |
-
msgstr "Tipologia quick view"
|
232 |
-
|
233 |
-
#: ../templates/admin/premium.php:284
|
234 |
-
msgid "\"View details\" button"
|
235 |
-
msgstr "Pulsante “Visualizza dettagli”"
|
236 |
-
|
237 |
-
#: ../templates/admin/premium.php:286
|
238 |
-
msgid ""
|
239 |
-
"An additional button that allows users to access product detail page "
|
240 |
-
"directly from quick view window just with a click of the mouse."
|
241 |
-
msgstr ""
|
242 |
-
"Un pulsante aggiuntivo per permettere all’utente di accedere alla pagina "
|
243 |
-
"dettaglio del prodotto direttamente dalla quick view con un semplice clic."
|
244 |
-
|
245 |
-
#: ../templates/admin/premium.php:295
|
246 |
-
msgid "Type of product images"
|
247 |
-
msgstr "Tipologia immagini prodotto"
|
248 |
-
|
249 |
-
#: ../templates/admin/premium.php:297
|
250 |
-
#, php-format
|
251 |
-
msgid ""
|
252 |
-
"Each product can have more than one image: choose whether to hide or show "
|
253 |
-
"them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s "
|
254 |
-
"display."
|
255 |
-
msgstr ""
|
256 |
-
"Ogni prodotto può avere ulteriori immagini oltre a quella in evidenza: "
|
257 |
-
"scegli se nasconderle o mostrarle con %1$seffetto scorrimento%2$s o nella "
|
258 |
-
"classica visualizzazione di %1$sWooCommerce%2$s."
|
259 |
-
|
260 |
-
#: ../templates/admin/premium.php:312
|
261 |
-
msgid "SHARE"
|
262 |
-
msgstr "Condivisione"
|
263 |
-
|
264 |
-
#: ../templates/admin/premium.php:314
|
265 |
-
#, php-format
|
266 |
-
msgid ""
|
267 |
-
"%1$sQuick View is also social-friendly!%2$s Activating this option, you will "
|
268 |
-
"be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or "
|
269 |
-
"sending an email."
|
270 |
-
msgstr ""
|
271 |
-
"%1$sLa quick view è anche social%2$s! Abilitando l’opzione, potrà essere "
|
272 |
-
"condivisa su Facebook, Twitter, Pinterest, Google+ e per email."
|
273 |
-
|
274 |
-
#: ../templates/admin/premium.php:325
|
275 |
-
#, php-format
|
276 |
-
msgid ""
|
277 |
-
"A rich option panel to change the colors of the %1$s\"Quick View\"%2$s "
|
278 |
-
"button and of everything that is within the modal window generated."
|
279 |
-
msgstr ""
|
280 |
-
"Un ricco pannello opzioni per modificare i colori del pulsante %1$s“Quick "
|
281 |
-
"View”%2$s e di tutto ciò che è all’interno della finestra modale generata."
|
282 |
-
|
283 |
-
#: ../templates/admin/premium.php:340
|
284 |
-
msgid "SHORTCODE"
|
285 |
-
msgstr ""
|
286 |
-
|
287 |
-
#: ../templates/admin/premium.php:342
|
288 |
-
msgid ""
|
289 |
-
"The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you "
|
290 |
-
"can add a button in any spot of the page to allow your users to see the "
|
291 |
-
"quick view of a specific product in your store."
|
292 |
-
msgstr ""
|
293 |
-
|
294 |
-
#: ../templates/admin/premium.php:351
|
295 |
-
msgid "Compatibility with other YITH's plugins"
|
296 |
-
msgstr ""
|
297 |
-
|
298 |
-
#: ../templates/admin/premium.php:353
|
299 |
-
#, php-format
|
300 |
-
msgid ""
|
301 |
-
"Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH "
|
302 |
-
"WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you "
|
303 |
-
"will be free to enrich further the content of your quick view.%3$s Zoom the "
|
304 |
-
"product image, show a badge, or add the button to open the quick view in all "
|
305 |
-
"products available in your users' wishlists. With YITH's plugins you make "
|
306 |
-
"the difference."
|
307 |
-
msgstr ""
|
308 |
-
|
309 |
-
#~ msgid ""
|
310 |
-
#~ "In the YIT Plugin tab you can find the YITH WooCommerce Quick View "
|
311 |
-
#~ "options.\r\n"
|
312 |
-
#~ "\t\t\t\t\t\t\t\t\t\tWith this menu, you can access to all the settings of "
|
313 |
-
#~ "our plugins that you have activated.\r\n"
|
314 |
-
#~ "\t\t\t\t\t\t\t\t\t\tYITH WooCommerce Quick View is available in an "
|
315 |
-
#~ "outstanding PREMIUM version with many new options,\r\n"
|
316 |
-
#~ "\t\t\t\t\t\t\t\t\t\t<a href=\""
|
317 |
-
#~ msgstr ""
|
318 |
-
#~ "Nella scheda YIT Plugins puoi trovare tutte le opzioni di YITH "
|
319 |
-
#~ "WooCommerce Quick View.<br>Da questo menu potrai accedere a tutte le "
|
320 |
-
#~ "impostazioni dei plugin YITH installati."
|
321 |
-
|
322 |
-
#~ msgid ""
|
323 |
-
#~ "The navigation in the \"Quick View\" allows browsing between the "
|
324 |
-
#~ "%1$sproducts%2$s within the same %1$scategory%2$s. The navigation arrows "
|
325 |
-
#~ "show on mousehover the image of the next/previous product."
|
326 |
-
#~ msgstr ""
|
327 |
-
#~ "La navigazione all’interno della visualizzazione rapida permette di "
|
328 |
-
#~ "scorrere tra i %1$sprodotti%2$s visualizzati. Quando si passa il cursore "
|
329 |
-
#~ "sulle frecce di navigazione, queste mostrano l’immagine del prodotto "
|
330 |
-
#~ "immediatamente successivo o precedente."
|
331 |
-
|
332 |
-
#~ msgid "General"
|
333 |
-
#~ msgstr "Generali"
|
334 |
-
|
335 |
-
#~ msgid "Product"
|
336 |
-
#~ msgstr "Prodotto"
|
337 |
-
|
338 |
-
#~ msgid "Style"
|
339 |
-
#~ msgstr "Stile"
|
340 |
-
|
341 |
-
#~ msgid "Quick View Navigation"
|
342 |
-
#~ msgstr "Navigazione quick view"
|
343 |
-
|
344 |
-
#~ msgid ""
|
345 |
-
#~ "Enable product navigation on quick view. NOTE: only available on modal "
|
346 |
-
#~ "window style."
|
347 |
-
#~ msgstr ""
|
348 |
-
#~ "Abilita scorrimento prodotti all\\’interno della quick view. NOTA: "
|
349 |
-
#~ "disponibile solo per lo stile finestra modale."
|
350 |
-
|
351 |
-
#~ msgid "Enable navigation in the same product category"
|
352 |
-
#~ msgstr "Abilita navigazione nella stessa categoria prodotti"
|
353 |
-
|
354 |
-
#~ msgid "Quick View Navigation Style"
|
355 |
-
#~ msgstr "Stile navigazione quick view"
|
356 |
-
|
357 |
-
#~ msgid "Slide ( thumbnail and product name )"
|
358 |
-
#~ msgstr "Scorrimento (miniatura e nome prodotto)"
|
359 |
-
|
360 |
-
#~ msgid "Rotate ( thumbnail )"
|
361 |
-
#~ msgstr "Rotazione (miniatura)"
|
362 |
-
|
363 |
-
#~ msgid "Modal Window"
|
364 |
-
#~ msgstr "Finestra modale"
|
365 |
-
|
366 |
-
#~ msgid "Cascading"
|
367 |
-
#~ msgstr "A cascata"
|
368 |
-
|
369 |
-
#~ msgid "Select modal effect"
|
370 |
-
#~ msgstr "Selezione effetto modale"
|
371 |
-
|
372 |
-
#~ msgid "Slide in"
|
373 |
-
#~ msgstr "Scorrimento"
|
374 |
-
|
375 |
-
#~ msgid "Fade in"
|
376 |
-
#~ msgstr "Dissolvenza"
|
377 |
-
|
378 |
-
#~ msgid "Scale up"
|
379 |
-
#~ msgstr "Ingrandimento"
|
380 |
-
|
381 |
-
#~ msgid "Modal Width"
|
382 |
-
#~ msgstr "Larghezza finestra"
|
383 |
-
|
384 |
-
#~ msgid "Set width of modal window."
|
385 |
-
#~ msgstr "Selezione la larghezza della finestra modale"
|
386 |
-
|
387 |
-
#~ msgid "Modal Height"
|
388 |
-
#~ msgstr "Altezza finestra"
|
389 |
-
|
390 |
-
#~ msgid "Set height of modal window."
|
391 |
-
#~ msgstr "Seleziona l\\’altezza della finestra modale"
|
392 |
-
|
393 |
-
#~ msgid "Button Options"
|
394 |
-
#~ msgstr "Opzioni pulsante"
|
395 |
-
|
396 |
-
#~ msgid "Quick View Button Type"
|
397 |
-
#~ msgstr "Tipo di pulsante quick view"
|
398 |
-
|
399 |
-
#~ msgid "Use button"
|
400 |
-
#~ msgstr "Usa pulsante"
|
401 |
-
|
402 |
-
#~ msgid "Use icon"
|
403 |
-
#~ msgstr "Usa icona"
|
404 |
-
|
405 |
-
#~ msgid "Quick View Button Icon"
|
406 |
-
#~ msgstr "Icona pulsante quick view"
|
407 |
-
|
408 |
-
#~ msgid "Icon for the quick view button in the WooCommerce loop."
|
409 |
-
#~ msgstr "Icona per il pulsante Quick view nella pagina shop di WooCommerce"
|
410 |
-
|
411 |
-
#~ msgid "Quick View Button Position"
|
412 |
-
#~ msgstr "Posizione pulsante Quick view"
|
413 |
-
|
414 |
-
#~ msgid "Position of the quick view button."
|
415 |
-
#~ msgstr "Posizione del pulsante Quick view"
|
416 |
-
|
417 |
-
#~ msgid "After 'add to cart' button"
|
418 |
-
#~ msgstr "Dopo il pulsante \\‘Aggiungi al carrello\\’"
|
419 |
-
|
420 |
-
#~ msgid "Inside product image"
|
421 |
-
#~ msgstr "Dentro l\\’immagine prodotto"
|
422 |
-
|
423 |
-
#~ msgid "Content Options"
|
424 |
-
#~ msgstr "Opzioni contenuto"
|
425 |
-
|
426 |
-
#~ msgid "Select Element to Show"
|
427 |
-
#~ msgstr "Seleziona elemento da mostrare"
|
428 |
-
|
429 |
-
#~ msgid "Show Product Image"
|
430 |
-
#~ msgstr "Mostra immagine prodotto"
|
431 |
-
|
432 |
-
#~ msgid "Show Product Name"
|
433 |
-
#~ msgstr "Mostra nome prodotto"
|
434 |
-
|
435 |
-
#~ msgid "Show Product Rating"
|
436 |
-
#~ msgstr "Mostra valutazione prodotto"
|
437 |
-
|
438 |
-
#~ msgid "Show Product Price"
|
439 |
-
#~ msgstr "Mostra prezzo prodotto"
|
440 |
-
|
441 |
-
#~ msgid "Show Product Excerpt"
|
442 |
-
#~ msgstr "Mostra riepilogo prodotto"
|
443 |
-
|
444 |
-
#~ msgid "Show Product Add To Cart"
|
445 |
-
#~ msgstr "Mostra \\”Aggiungi al carrello\\” del prodotto"
|
446 |
-
|
447 |
-
#~ msgid "Show Product Meta"
|
448 |
-
#~ msgstr "Mostra meta prodotto"
|
449 |
-
|
450 |
-
#~ msgid "Product Image Width"
|
451 |
-
#~ msgstr "Larghezza immagine prodotto"
|
452 |
-
|
453 |
-
#~ msgid "Set width of product image."
|
454 |
-
#~ msgstr "Imposta la larghezza dell\\’immagine del prodotto."
|
455 |
-
|
456 |
-
#~ msgid "Product Image Height"
|
457 |
-
#~ msgstr "Altezza immagine prodotto"
|
458 |
-
|
459 |
-
#~ msgid "Set height of product image."
|
460 |
-
#~ msgstr "Imposta l\\’altezza dell\\’immagine del prodotto."
|
461 |
-
|
462 |
-
#~ msgid "Select Thumbnails Type"
|
463 |
-
#~ msgstr "Seleziona tipo di miniatura"
|
464 |
-
|
465 |
-
#~ msgid "Don't show"
|
466 |
-
#~ msgstr "Non mostrare"
|
467 |
-
|
468 |
-
#~ msgid "Slider mode"
|
469 |
-
#~ msgstr "Modalità scorrimento"
|
470 |
-
|
471 |
-
#~ msgid "Classic mode"
|
472 |
-
#~ msgstr "Modalità classica"
|
473 |
-
|
474 |
-
#~ msgid "Add 'View Details' Button"
|
475 |
-
#~ msgstr "Aggiungi pulsante \\’Visualizza dettagli\\’"
|
476 |
-
|
477 |
-
#~ msgid "Check this option to add a button to go to the single product page."
|
478 |
-
#~ msgstr ""
|
479 |
-
#~ "Seleziona questa opzione per aggiungere un pulsante che riporti alla "
|
480 |
-
#~ "pagina singolo prodotto."
|
481 |
-
|
482 |
-
#~ msgid "'View Details' Button Label"
|
483 |
-
#~ msgstr "Testo pulsante \\’Visualizza dettagli\\’"
|
484 |
-
|
485 |
-
#~ msgid "Set label for 'View Details' button"
|
486 |
-
#~ msgstr "Scegli il testo del pulsante \\’Visualizza dettagli\\’"
|
487 |
-
|
488 |
-
#~ msgid "View Details"
|
489 |
-
#~ msgstr "Visualizza dettagli"
|
490 |
-
|
491 |
-
#~ msgid "Enable Ajax Add To Cart"
|
492 |
-
#~ msgstr "Abilita \\“Aggiungi al carrello\\” in ajax"
|
493 |
-
|
494 |
-
#~ msgid "Check this option to enable add to cart in ajax"
|
495 |
-
#~ msgstr ""
|
496 |
-
#~ "Seleziona questa opzione per abilitare il pulsante \\”Aggiungi al carrello"
|
497 |
-
#~ "\\” in ajax"
|
498 |
-
|
499 |
-
#~ msgid "Share Options"
|
500 |
-
#~ msgstr "Opzioni di condivisione"
|
501 |
-
|
502 |
-
#~ msgid "Enable Share"
|
503 |
-
#~ msgstr "Abilita condivisione"
|
504 |
-
|
505 |
-
#~ msgid ""
|
506 |
-
#~ "Check this option if you want to show the share link for products in "
|
507 |
-
#~ "quick view"
|
508 |
-
#~ msgstr ""
|
509 |
-
#~ "Seleziona questa opzione se vuoi mostrare il link di condivisione per i "
|
510 |
-
#~ "prodotti nella quick view"
|
511 |
-
|
512 |
-
#~ msgid "Select Socials"
|
513 |
-
#~ msgstr "Seleziona social"
|
514 |
-
|
515 |
-
#~ msgid "Facebook"
|
516 |
-
#~ msgstr "Facebook"
|
517 |
-
|
518 |
-
#~ msgid "Twitter"
|
519 |
-
#~ msgstr "Twitter"
|
520 |
-
|
521 |
-
#~ msgid "Google+"
|
522 |
-
#~ msgstr "Google+"
|
523 |
-
|
524 |
-
#~ msgid "Pinterest"
|
525 |
-
#~ msgstr "Pinterest"
|
526 |
-
|
527 |
-
#~ msgid "eMail"
|
528 |
-
#~ msgstr "email"
|
529 |
-
|
530 |
-
#~ msgid "General Style"
|
531 |
-
#~ msgstr "Stile generale"
|
532 |
-
|
533 |
-
#~ msgid "'Quick View' Button Color"
|
534 |
-
#~ msgstr "Colore pulsante 'Quick View'"
|
535 |
-
|
536 |
-
#~ msgid "'Quick View' Button Text Color"
|
537 |
-
#~ msgstr "Colore testo pulsante 'Quick View'"
|
538 |
-
|
539 |
-
#~ msgid "'Quick View' Button Hover Color "
|
540 |
-
#~ msgstr "Colore pulsante 'Quick View' al passaggio del mouse"
|
541 |
-
|
542 |
-
#~ msgid "'Quick View' Button Hover Text Color"
|
543 |
-
#~ msgstr "Colore testo pulsante 'Quick View' al passaggio del mouse"
|
544 |
-
|
545 |
-
#~ msgid "Content Style"
|
546 |
-
#~ msgstr "Stile contenuto"
|
547 |
-
|
548 |
-
#~ msgid "Main Text Color"
|
549 |
-
#~ msgstr "Colore principale testo"
|
550 |
-
|
551 |
-
#~ msgid "Star Color"
|
552 |
-
#~ msgstr "Colore stellina"
|
553 |
-
|
554 |
-
#~ msgid "'Add to Cart' Button Color"
|
555 |
-
#~ msgstr "Colore pulsante ‘Aggiungi al carrello’"
|
556 |
-
|
557 |
-
#~ msgid "'Add to Cart' Button Text Color"
|
558 |
-
#~ msgstr "Colore testo pulsante ‘Aggiungi al carrello’"
|
559 |
-
|
560 |
-
#~ msgid "'Add to Cart' Button Hover Color "
|
561 |
-
#~ msgstr "Colore pulsante ‘Aggiungi al carrello’ al passaggio del mouse"
|
562 |
-
|
563 |
-
#~ msgid "'Add to Cart' Button Hover Text Color"
|
564 |
-
#~ msgstr "Colore testo pulsante ‘Aggiungi al carrello’ al passaggio del mouse"
|
565 |
-
|
566 |
-
#~ msgid "'View Details' Button Color"
|
567 |
-
#~ msgstr "Colore pulsante ‘Visualizza dettagli’"
|
568 |
-
|
569 |
-
#~ msgid "'View Details' Button Text Color"
|
570 |
-
#~ msgstr "Colore testo pulsante ‘Visualizza dettagli’"
|
571 |
-
|
572 |
-
#~ msgid "'View Details' Button Hover Color "
|
573 |
-
#~ msgstr "Colore pulsante ‘Visualizza dettagli’ al passaggio del mouse "
|
574 |
-
|
575 |
-
#~ msgid "'View Details' Button Hover Text Color"
|
576 |
-
#~ msgstr "Colore testo pulsante ‘Visualizza dettagli’ al passaggio del mouse "
|
577 |
-
|
578 |
-
#~ msgid "Closing Icon Color"
|
579 |
-
#~ msgstr "Colore icona chiusura"
|
580 |
-
|
581 |
-
#~ msgid "Closing Icon Hover Color"
|
582 |
-
#~ msgstr "Colore icona chiusura al passaggio del mouse"
|
583 |
-
|
584 |
-
#~ msgid "May I ask you to see this product, please?"
|
585 |
-
#~ msgstr "Posso chiederti di guardare questo prodotto, per favore?"
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: YITH WooCommerce Quick View\n"
|
4 |
+
"POT-Creation-Date: 2017-10-11 12:42+0200\n"
|
5 |
+
"PO-Revision-Date: 2017-10-11 12:42+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.7.1\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"Plural-Forms: nplurals=2; plural=n!=1;\n"
|
15 |
+
"X-Poedit-KeywordsList: __ ;_e;_n:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
16 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
18 |
+
"X-Poedit-SearchPath-0: ..\n"
|
19 |
+
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
20 |
+
|
21 |
+
#: ../includes/class.yith-wcqv-admin.php:129
|
22 |
+
#: ../includes/class.yith-wcqv-admin.php:151
|
23 |
+
msgid "Settings"
|
24 |
+
msgstr "Impostazioni"
|
25 |
+
|
26 |
+
#: ../includes/class.yith-wcqv-admin.php:130
|
27 |
+
#: ../includes/class.yith-wcqv-admin.php:152
|
28 |
+
msgid "Premium Version"
|
29 |
+
msgstr "Versione premium"
|
30 |
+
|
31 |
+
#: ../includes/class.yith-wcqv-admin.php:158
|
32 |
+
#: ../includes/class.yith-wcqv-admin.php:159
|
33 |
+
#: ../plugin-options/settings-options.php:57
|
34 |
+
msgid "Quick View"
|
35 |
+
msgstr "Quick view"
|
36 |
+
|
37 |
+
#: ../includes/class.yith-wcqv-admin.php:213
|
38 |
+
msgid "Plugin Documentation"
|
39 |
+
msgstr "Documentazione plugin"
|
40 |
+
|
41 |
+
#: ../init.php:41
|
42 |
+
msgid ""
|
43 |
+
"YITH WooCommerce Quick View is enabled but not effective. It requires "
|
44 |
+
"WooCommerce in order to work."
|
45 |
+
msgstr ""
|
46 |
+
"YITH WooCommerce Quick View è abilitato ma non in funzione. Devi aver "
|
47 |
+
"installato WooCommerce perché questo possa funzionare correttamente."
|
48 |
+
|
49 |
+
#: ../init.php:50
|
50 |
+
msgid ""
|
51 |
+
"You can't activate the free version of YITH WooCommerce Quick View while you "
|
52 |
+
"are using the premium one."
|
53 |
+
msgstr ""
|
54 |
+
"Non è possibile attivare la versione free di YITH WooCommerce Colors and "
|
55 |
+
"Labels Variations se stai già utilizzando la premium."
|
56 |
+
|
57 |
+
#: ../plugin-options/settings-options.php:8
|
58 |
+
msgid "Upgrade to the PREMIUM VERSION"
|
59 |
+
msgstr "Aggiorna alla VERSIONE PREMIUM"
|
60 |
+
|
61 |
+
#: ../plugin-options/settings-options.php:11
|
62 |
+
#: ../plugin-options/settings-options.php:18
|
63 |
+
msgid "YITH WooCommerce Quick View"
|
64 |
+
msgstr "YITH WooCommerce Quick View"
|
65 |
+
|
66 |
+
#: ../plugin-options/settings-options.php:12
|
67 |
+
msgid "Discover the Advanced Features"
|
68 |
+
msgstr "Scopri le funzionalità avanzate"
|
69 |
+
|
70 |
+
#: ../plugin-options/settings-options.php:13
|
71 |
+
msgid ""
|
72 |
+
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Quick View to benefit "
|
73 |
+
"from all features!"
|
74 |
+
msgstr ""
|
75 |
+
"Aggiorna alla VERSIONE PREMIUM di YITH WooCommerce Quick View per usufruire "
|
76 |
+
"di tutte le sue funzionalità!"
|
77 |
+
|
78 |
+
#: ../plugin-options/settings-options.php:20
|
79 |
+
msgid "Get Support and Pro Features"
|
80 |
+
msgstr "Ottieni supporto e funzionalità aggiuntive"
|
81 |
+
|
82 |
+
#: ../plugin-options/settings-options.php:21
|
83 |
+
msgid ""
|
84 |
+
"By purchasing the premium version of the plugin, you will take advantage of "
|
85 |
+
"the advanced features of the product and you will get one year of free "
|
86 |
+
"updates and support through our platform available 24h/24."
|
87 |
+
msgstr ""
|
88 |
+
"Acquistando la versione premium del plugin, potrai beneficiare delle "
|
89 |
+
"funzionalità avanzate del prodotto ed otterrai un anno di aggiornamenti "
|
90 |
+
"gratuiti e supporto per mezzo della nostra piattaforma disponibile 24h/24."
|
91 |
+
|
92 |
+
#: ../plugin-options/settings-options.php:31
|
93 |
+
msgid "General Options"
|
94 |
+
msgstr "Opzioni generali"
|
95 |
+
|
96 |
+
#: ../plugin-options/settings-options.php:39
|
97 |
+
msgid "Enable Quick View"
|
98 |
+
msgstr "Abilita quick view"
|
99 |
+
|
100 |
+
#: ../plugin-options/settings-options.php:46
|
101 |
+
msgid "Enable Quick View on mobile"
|
102 |
+
msgstr "Abilita quick view su dispositivi mobili"
|
103 |
+
|
104 |
+
#: ../plugin-options/settings-options.php:47
|
105 |
+
msgid "Enable quick view features on mobile device too"
|
106 |
+
msgstr "Abilita funzionalità quick view anche sui dispositivi mobili"
|
107 |
+
|
108 |
+
#: ../plugin-options/settings-options.php:54
|
109 |
+
msgid "Quick View Button Label"
|
110 |
+
msgstr "Testo pulsante quick view"
|
111 |
+
|
112 |
+
#: ../plugin-options/settings-options.php:55
|
113 |
+
msgid "Label for the quick view button in the WooCommerce loop."
|
114 |
+
msgstr "Testo per il pulsante Quick view nella pagina shop di WooCommerce"
|
115 |
+
|
116 |
+
#: ../plugin-options/settings-options.php:62
|
117 |
+
msgid "Enable Lightbox"
|
118 |
+
msgstr "Abilita lightbox"
|
119 |
+
|
120 |
+
#: ../plugin-options/settings-options.php:63
|
121 |
+
msgid "Enable lightbox. Product images will open in a lightbox."
|
122 |
+
msgstr ""
|
123 |
+
"Abilita la lightbox. Le immagini dei prodotti si apriranno in una lightbox."
|
124 |
+
|
125 |
+
#: ../plugin-options/settings-options.php:74 ../templates/admin/premium.php:323
|
126 |
+
#: ../templates/admin/premium.php:328
|
127 |
+
msgid "Style Options"
|
128 |
+
msgstr "Opzioni di stile"
|
129 |
+
|
130 |
+
#: ../plugin-options/settings-options.php:81
|
131 |
+
msgid "Modal Window Background Color"
|
132 |
+
msgstr "Colore finestra modale"
|
133 |
+
|
134 |
+
#: ../plugin-options/settings-options.php:89
|
135 |
+
msgid "Closing Button Color"
|
136 |
+
msgstr "Colore pulsante chiusura"
|
137 |
+
|
138 |
+
#: ../plugin-options/settings-options.php:97
|
139 |
+
msgid "Closing Button Hover Color"
|
140 |
+
msgstr "Colore pulsante chiusura al passaggio del mouse"
|
141 |
+
|
142 |
+
#: ../templates/admin/premium.php:210 ../templates/admin/premium.php:364
|
143 |
+
#, php-format
|
144 |
+
msgid ""
|
145 |
+
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to "
|
146 |
+
"benefit from all features!"
|
147 |
+
msgstr ""
|
148 |
+
"Aggiorna alla %1$sversione premium%2$s di %1$sYITH WooCommerce Quick View"
|
149 |
+
"%2$s per usufruire di tutte le sue funzionalità!"
|
150 |
+
|
151 |
+
#: ../templates/admin/premium.php:213 ../templates/admin/premium.php:367
|
152 |
+
msgid "UPGRADE"
|
153 |
+
msgstr "AGGIORNA"
|
154 |
+
|
155 |
+
#: ../templates/admin/premium.php:214 ../templates/admin/premium.php:368
|
156 |
+
msgid "to the premium version"
|
157 |
+
msgstr "alla versione premium"
|
158 |
+
|
159 |
+
#: ../templates/admin/premium.php:220
|
160 |
+
msgid "Premium Features"
|
161 |
+
msgstr "Funzionalità premium"
|
162 |
+
|
163 |
+
#: ../templates/admin/premium.php:223
|
164 |
+
msgid "Button type"
|
165 |
+
msgstr "Tipologia pulsante"
|
166 |
+
|
167 |
+
#: ../templates/admin/premium.php:228
|
168 |
+
msgid "BUTTON TYPE"
|
169 |
+
msgstr "TIPOLOGIA PULSANTE"
|
170 |
+
|
171 |
+
#: ../templates/admin/premium.php:230
|
172 |
+
#, php-format
|
173 |
+
msgid ""
|
174 |
+
"Choose between the button or a custom icon to access the %1$sQuick View%2$s: "
|
175 |
+
"you can choose to place it after the \"Add To Cart\" button or inside the "
|
176 |
+
"thumbnail of the product."
|
177 |
+
msgstr ""
|
178 |
+
"Scegli tra il pulsante o un’icona personalizzata per avviare la %1$squick "
|
179 |
+
"view%2$s: scegli tu se dopo il pulsante “Aggiungi al carrello” o sulla "
|
180 |
+
"immagine thumbnail del prodotto."
|
181 |
+
|
182 |
+
#: ../templates/admin/premium.php:238 ../templates/admin/premium.php:239
|
183 |
+
#: ../templates/admin/premium.php:244
|
184 |
+
msgid "Product Navigation"
|
185 |
+
msgstr "Navigazione prodotti"
|
186 |
+
|
187 |
+
#: ../templates/admin/premium.php:241
|
188 |
+
#, php-format
|
189 |
+
msgid ""
|
190 |
+
"The navigation in the \"Quick View\" allows browsing among %1$sproducts%2$s "
|
191 |
+
"displayed in it. The navigation arrows show on mousehover the image of the "
|
192 |
+
"next/previous product."
|
193 |
+
msgstr ""
|
194 |
+
"La navigazione all’interno della visualizzazione rapida permette di scorrere "
|
195 |
+
"tra i %1$sprodotti%2$s visualizzati. Quando si passa il cursore sulle frecce "
|
196 |
+
"di navigazione, queste mostrano l’immagine del prodotto immediatamente "
|
197 |
+
"successivo o precedente."
|
198 |
+
|
199 |
+
#: ../templates/admin/premium.php:255 ../templates/admin/premium.php:256
|
200 |
+
msgid "Content to display"
|
201 |
+
msgstr "Contenuto da mostrare"
|
202 |
+
|
203 |
+
#: ../templates/admin/premium.php:258
|
204 |
+
#, php-format
|
205 |
+
msgid ""
|
206 |
+
"The display of the product information in the \"Quick View\" are managed by "
|
207 |
+
"%1$sadministrators%2$s who can decide whether to show everything or only a "
|
208 |
+
"part of it."
|
209 |
+
msgstr ""
|
210 |
+
"La visualizzazione delle informazioni del prodotto all’interno della “Quick "
|
211 |
+
"View” sono gestite dall’%1$samministratore%2$s che può decidere se mostrare "
|
212 |
+
"tutto o solo una parte di esse."
|
213 |
+
|
214 |
+
#: ../templates/admin/premium.php:267
|
215 |
+
msgid "Quick View Type"
|
216 |
+
msgstr "Tipologia quick view"
|
217 |
+
|
218 |
+
#: ../templates/admin/premium.php:269
|
219 |
+
#, php-format
|
220 |
+
msgid ""
|
221 |
+
"Quick view has two different displaying modes: the first one opens it as a "
|
222 |
+
"%1$smodal window%2$s, the other one opens it in the page itself with a "
|
223 |
+
"%1$scascading effect%2$s above content page."
|
224 |
+
msgstr ""
|
225 |
+
"La visualizzazione rapida del prodotto può avvenire in due modi: all’interno "
|
226 |
+
"di una %1$sfinestra modale%2$s o all’interno della stessa pagina con "
|
227 |
+
"%1$seffetto a cascata%2$s sul resto del contenuto."
|
228 |
+
|
229 |
+
#: ../templates/admin/premium.php:272
|
230 |
+
msgid "Quick view type"
|
231 |
+
msgstr "Tipologia quick view"
|
232 |
+
|
233 |
+
#: ../templates/admin/premium.php:284
|
234 |
+
msgid "\"View details\" button"
|
235 |
+
msgstr "Pulsante “Visualizza dettagli”"
|
236 |
+
|
237 |
+
#: ../templates/admin/premium.php:286
|
238 |
+
msgid ""
|
239 |
+
"An additional button that allows users to access product detail page "
|
240 |
+
"directly from quick view window just with a click of the mouse."
|
241 |
+
msgstr ""
|
242 |
+
"Un pulsante aggiuntivo per permettere all’utente di accedere alla pagina "
|
243 |
+
"dettaglio del prodotto direttamente dalla quick view con un semplice clic."
|
244 |
+
|
245 |
+
#: ../templates/admin/premium.php:295
|
246 |
+
msgid "Type of product images"
|
247 |
+
msgstr "Tipologia immagini prodotto"
|
248 |
+
|
249 |
+
#: ../templates/admin/premium.php:297
|
250 |
+
#, php-format
|
251 |
+
msgid ""
|
252 |
+
"Each product can have more than one image: choose whether to hide or show "
|
253 |
+
"them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s "
|
254 |
+
"display."
|
255 |
+
msgstr ""
|
256 |
+
"Ogni prodotto può avere ulteriori immagini oltre a quella in evidenza: "
|
257 |
+
"scegli se nasconderle o mostrarle con %1$seffetto scorrimento%2$s o nella "
|
258 |
+
"classica visualizzazione di %1$sWooCommerce%2$s."
|
259 |
+
|
260 |
+
#: ../templates/admin/premium.php:312
|
261 |
+
msgid "SHARE"
|
262 |
+
msgstr "Condivisione"
|
263 |
+
|
264 |
+
#: ../templates/admin/premium.php:314
|
265 |
+
#, php-format
|
266 |
+
msgid ""
|
267 |
+
"%1$sQuick View is also social-friendly!%2$s Activating this option, you will "
|
268 |
+
"be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or "
|
269 |
+
"sending an email."
|
270 |
+
msgstr ""
|
271 |
+
"%1$sLa quick view è anche social%2$s! Abilitando l’opzione, potrà essere "
|
272 |
+
"condivisa su Facebook, Twitter, Pinterest, Google+ e per email."
|
273 |
+
|
274 |
+
#: ../templates/admin/premium.php:325
|
275 |
+
#, php-format
|
276 |
+
msgid ""
|
277 |
+
"A rich option panel to change the colors of the %1$s\"Quick View\"%2$s "
|
278 |
+
"button and of everything that is within the modal window generated."
|
279 |
+
msgstr ""
|
280 |
+
"Un ricco pannello opzioni per modificare i colori del pulsante %1$s“Quick "
|
281 |
+
"View”%2$s e di tutto ciò che è all’interno della finestra modale generata."
|
282 |
+
|
283 |
+
#: ../templates/admin/premium.php:340
|
284 |
+
msgid "SHORTCODE"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: ../templates/admin/premium.php:342
|
288 |
+
msgid ""
|
289 |
+
"The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you "
|
290 |
+
"can add a button in any spot of the page to allow your users to see the "
|
291 |
+
"quick view of a specific product in your store."
|
292 |
+
msgstr ""
|
293 |
+
|
294 |
+
#: ../templates/admin/premium.php:351
|
295 |
+
msgid "Compatibility with other YITH's plugins"
|
296 |
+
msgstr ""
|
297 |
+
|
298 |
+
#: ../templates/admin/premium.php:353
|
299 |
+
#, php-format
|
300 |
+
msgid ""
|
301 |
+
"Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH "
|
302 |
+
"WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you "
|
303 |
+
"will be free to enrich further the content of your quick view.%3$s Zoom the "
|
304 |
+
"product image, show a badge, or add the button to open the quick view in all "
|
305 |
+
"products available in your users' wishlists. With YITH's plugins you make "
|
306 |
+
"the difference."
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#~ msgid ""
|
310 |
+
#~ "In the YIT Plugin tab you can find the YITH WooCommerce Quick View "
|
311 |
+
#~ "options.\r\n"
|
312 |
+
#~ "\t\t\t\t\t\t\t\t\t\tWith this menu, you can access to all the settings of "
|
313 |
+
#~ "our plugins that you have activated.\r\n"
|
314 |
+
#~ "\t\t\t\t\t\t\t\t\t\tYITH WooCommerce Quick View is available in an "
|
315 |
+
#~ "outstanding PREMIUM version with many new options,\r\n"
|
316 |
+
#~ "\t\t\t\t\t\t\t\t\t\t<a href=\""
|
317 |
+
#~ msgstr ""
|
318 |
+
#~ "Nella scheda YIT Plugins puoi trovare tutte le opzioni di YITH "
|
319 |
+
#~ "WooCommerce Quick View.<br>Da questo menu potrai accedere a tutte le "
|
320 |
+
#~ "impostazioni dei plugin YITH installati."
|
321 |
+
|
322 |
+
#~ msgid ""
|
323 |
+
#~ "The navigation in the \"Quick View\" allows browsing between the "
|
324 |
+
#~ "%1$sproducts%2$s within the same %1$scategory%2$s. The navigation arrows "
|
325 |
+
#~ "show on mousehover the image of the next/previous product."
|
326 |
+
#~ msgstr ""
|
327 |
+
#~ "La navigazione all’interno della visualizzazione rapida permette di "
|
328 |
+
#~ "scorrere tra i %1$sprodotti%2$s visualizzati. Quando si passa il cursore "
|
329 |
+
#~ "sulle frecce di navigazione, queste mostrano l’immagine del prodotto "
|
330 |
+
#~ "immediatamente successivo o precedente."
|
331 |
+
|
332 |
+
#~ msgid "General"
|
333 |
+
#~ msgstr "Generali"
|
334 |
+
|
335 |
+
#~ msgid "Product"
|
336 |
+
#~ msgstr "Prodotto"
|
337 |
+
|
338 |
+
#~ msgid "Style"
|
339 |
+
#~ msgstr "Stile"
|
340 |
+
|
341 |
+
#~ msgid "Quick View Navigation"
|
342 |
+
#~ msgstr "Navigazione quick view"
|
343 |
+
|
344 |
+
#~ msgid ""
|
345 |
+
#~ "Enable product navigation on quick view. NOTE: only available on modal "
|
346 |
+
#~ "window style."
|
347 |
+
#~ msgstr ""
|
348 |
+
#~ "Abilita scorrimento prodotti all\\’interno della quick view. NOTA: "
|
349 |
+
#~ "disponibile solo per lo stile finestra modale."
|
350 |
+
|
351 |
+
#~ msgid "Enable navigation in the same product category"
|
352 |
+
#~ msgstr "Abilita navigazione nella stessa categoria prodotti"
|
353 |
+
|
354 |
+
#~ msgid "Quick View Navigation Style"
|
355 |
+
#~ msgstr "Stile navigazione quick view"
|
356 |
+
|
357 |
+
#~ msgid "Slide ( thumbnail and product name )"
|
358 |
+
#~ msgstr "Scorrimento (miniatura e nome prodotto)"
|
359 |
+
|
360 |
+
#~ msgid "Rotate ( thumbnail )"
|
361 |
+
#~ msgstr "Rotazione (miniatura)"
|
362 |
+
|
363 |
+
#~ msgid "Modal Window"
|
364 |
+
#~ msgstr "Finestra modale"
|
365 |
+
|
366 |
+
#~ msgid "Cascading"
|
367 |
+
#~ msgstr "A cascata"
|
368 |
+
|
369 |
+
#~ msgid "Select modal effect"
|
370 |
+
#~ msgstr "Selezione effetto modale"
|
371 |
+
|
372 |
+
#~ msgid "Slide in"
|
373 |
+
#~ msgstr "Scorrimento"
|
374 |
+
|
375 |
+
#~ msgid "Fade in"
|
376 |
+
#~ msgstr "Dissolvenza"
|
377 |
+
|
378 |
+
#~ msgid "Scale up"
|
379 |
+
#~ msgstr "Ingrandimento"
|
380 |
+
|
381 |
+
#~ msgid "Modal Width"
|
382 |
+
#~ msgstr "Larghezza finestra"
|
383 |
+
|
384 |
+
#~ msgid "Set width of modal window."
|
385 |
+
#~ msgstr "Selezione la larghezza della finestra modale"
|
386 |
+
|
387 |
+
#~ msgid "Modal Height"
|
388 |
+
#~ msgstr "Altezza finestra"
|
389 |
+
|
390 |
+
#~ msgid "Set height of modal window."
|
391 |
+
#~ msgstr "Seleziona l\\’altezza della finestra modale"
|
392 |
+
|
393 |
+
#~ msgid "Button Options"
|
394 |
+
#~ msgstr "Opzioni pulsante"
|
395 |
+
|
396 |
+
#~ msgid "Quick View Button Type"
|
397 |
+
#~ msgstr "Tipo di pulsante quick view"
|
398 |
+
|
399 |
+
#~ msgid "Use button"
|
400 |
+
#~ msgstr "Usa pulsante"
|
401 |
+
|
402 |
+
#~ msgid "Use icon"
|
403 |
+
#~ msgstr "Usa icona"
|
404 |
+
|
405 |
+
#~ msgid "Quick View Button Icon"
|
406 |
+
#~ msgstr "Icona pulsante quick view"
|
407 |
+
|
408 |
+
#~ msgid "Icon for the quick view button in the WooCommerce loop."
|
409 |
+
#~ msgstr "Icona per il pulsante Quick view nella pagina shop di WooCommerce"
|
410 |
+
|
411 |
+
#~ msgid "Quick View Button Position"
|
412 |
+
#~ msgstr "Posizione pulsante Quick view"
|
413 |
+
|
414 |
+
#~ msgid "Position of the quick view button."
|
415 |
+
#~ msgstr "Posizione del pulsante Quick view"
|
416 |
+
|
417 |
+
#~ msgid "After 'add to cart' button"
|
418 |
+
#~ msgstr "Dopo il pulsante \\‘Aggiungi al carrello\\’"
|
419 |
+
|
420 |
+
#~ msgid "Inside product image"
|
421 |
+
#~ msgstr "Dentro l\\’immagine prodotto"
|
422 |
+
|
423 |
+
#~ msgid "Content Options"
|
424 |
+
#~ msgstr "Opzioni contenuto"
|
425 |
+
|
426 |
+
#~ msgid "Select Element to Show"
|
427 |
+
#~ msgstr "Seleziona elemento da mostrare"
|
428 |
+
|
429 |
+
#~ msgid "Show Product Image"
|
430 |
+
#~ msgstr "Mostra immagine prodotto"
|
431 |
+
|
432 |
+
#~ msgid "Show Product Name"
|
433 |
+
#~ msgstr "Mostra nome prodotto"
|
434 |
+
|
435 |
+
#~ msgid "Show Product Rating"
|
436 |
+
#~ msgstr "Mostra valutazione prodotto"
|
437 |
+
|
438 |
+
#~ msgid "Show Product Price"
|
439 |
+
#~ msgstr "Mostra prezzo prodotto"
|
440 |
+
|
441 |
+
#~ msgid "Show Product Excerpt"
|
442 |
+
#~ msgstr "Mostra riepilogo prodotto"
|
443 |
+
|
444 |
+
#~ msgid "Show Product Add To Cart"
|
445 |
+
#~ msgstr "Mostra \\”Aggiungi al carrello\\” del prodotto"
|
446 |
+
|
447 |
+
#~ msgid "Show Product Meta"
|
448 |
+
#~ msgstr "Mostra meta prodotto"
|
449 |
+
|
450 |
+
#~ msgid "Product Image Width"
|
451 |
+
#~ msgstr "Larghezza immagine prodotto"
|
452 |
+
|
453 |
+
#~ msgid "Set width of product image."
|
454 |
+
#~ msgstr "Imposta la larghezza dell\\’immagine del prodotto."
|
455 |
+
|
456 |
+
#~ msgid "Product Image Height"
|
457 |
+
#~ msgstr "Altezza immagine prodotto"
|
458 |
+
|
459 |
+
#~ msgid "Set height of product image."
|
460 |
+
#~ msgstr "Imposta l\\’altezza dell\\’immagine del prodotto."
|
461 |
+
|
462 |
+
#~ msgid "Select Thumbnails Type"
|
463 |
+
#~ msgstr "Seleziona tipo di miniatura"
|
464 |
+
|
465 |
+
#~ msgid "Don't show"
|
466 |
+
#~ msgstr "Non mostrare"
|
467 |
+
|
468 |
+
#~ msgid "Slider mode"
|
469 |
+
#~ msgstr "Modalità scorrimento"
|
470 |
+
|
471 |
+
#~ msgid "Classic mode"
|
472 |
+
#~ msgstr "Modalità classica"
|
473 |
+
|
474 |
+
#~ msgid "Add 'View Details' Button"
|
475 |
+
#~ msgstr "Aggiungi pulsante \\’Visualizza dettagli\\’"
|
476 |
+
|
477 |
+
#~ msgid "Check this option to add a button to go to the single product page."
|
478 |
+
#~ msgstr ""
|
479 |
+
#~ "Seleziona questa opzione per aggiungere un pulsante che riporti alla "
|
480 |
+
#~ "pagina singolo prodotto."
|
481 |
+
|
482 |
+
#~ msgid "'View Details' Button Label"
|
483 |
+
#~ msgstr "Testo pulsante \\’Visualizza dettagli\\’"
|
484 |
+
|
485 |
+
#~ msgid "Set label for 'View Details' button"
|
486 |
+
#~ msgstr "Scegli il testo del pulsante \\’Visualizza dettagli\\’"
|
487 |
+
|
488 |
+
#~ msgid "View Details"
|
489 |
+
#~ msgstr "Visualizza dettagli"
|
490 |
+
|
491 |
+
#~ msgid "Enable Ajax Add To Cart"
|
492 |
+
#~ msgstr "Abilita \\“Aggiungi al carrello\\” in ajax"
|
493 |
+
|
494 |
+
#~ msgid "Check this option to enable add to cart in ajax"
|
495 |
+
#~ msgstr ""
|
496 |
+
#~ "Seleziona questa opzione per abilitare il pulsante \\”Aggiungi al carrello"
|
497 |
+
#~ "\\” in ajax"
|
498 |
+
|
499 |
+
#~ msgid "Share Options"
|
500 |
+
#~ msgstr "Opzioni di condivisione"
|
501 |
+
|
502 |
+
#~ msgid "Enable Share"
|
503 |
+
#~ msgstr "Abilita condivisione"
|
504 |
+
|
505 |
+
#~ msgid ""
|
506 |
+
#~ "Check this option if you want to show the share link for products in "
|
507 |
+
#~ "quick view"
|
508 |
+
#~ msgstr ""
|
509 |
+
#~ "Seleziona questa opzione se vuoi mostrare il link di condivisione per i "
|
510 |
+
#~ "prodotti nella quick view"
|
511 |
+
|
512 |
+
#~ msgid "Select Socials"
|
513 |
+
#~ msgstr "Seleziona social"
|
514 |
+
|
515 |
+
#~ msgid "Facebook"
|
516 |
+
#~ msgstr "Facebook"
|
517 |
+
|
518 |
+
#~ msgid "Twitter"
|
519 |
+
#~ msgstr "Twitter"
|
520 |
+
|
521 |
+
#~ msgid "Google+"
|
522 |
+
#~ msgstr "Google+"
|
523 |
+
|
524 |
+
#~ msgid "Pinterest"
|
525 |
+
#~ msgstr "Pinterest"
|
526 |
+
|
527 |
+
#~ msgid "eMail"
|
528 |
+
#~ msgstr "email"
|
529 |
+
|
530 |
+
#~ msgid "General Style"
|
531 |
+
#~ msgstr "Stile generale"
|
532 |
+
|
533 |
+
#~ msgid "'Quick View' Button Color"
|
534 |
+
#~ msgstr "Colore pulsante 'Quick View'"
|
535 |
+
|
536 |
+
#~ msgid "'Quick View' Button Text Color"
|
537 |
+
#~ msgstr "Colore testo pulsante 'Quick View'"
|
538 |
+
|
539 |
+
#~ msgid "'Quick View' Button Hover Color "
|
540 |
+
#~ msgstr "Colore pulsante 'Quick View' al passaggio del mouse"
|
541 |
+
|
542 |
+
#~ msgid "'Quick View' Button Hover Text Color"
|
543 |
+
#~ msgstr "Colore testo pulsante 'Quick View' al passaggio del mouse"
|
544 |
+
|
545 |
+
#~ msgid "Content Style"
|
546 |
+
#~ msgstr "Stile contenuto"
|
547 |
+
|
548 |
+
#~ msgid "Main Text Color"
|
549 |
+
#~ msgstr "Colore principale testo"
|
550 |
+
|
551 |
+
#~ msgid "Star Color"
|
552 |
+
#~ msgstr "Colore stellina"
|
553 |
+
|
554 |
+
#~ msgid "'Add to Cart' Button Color"
|
555 |
+
#~ msgstr "Colore pulsante ‘Aggiungi al carrello’"
|
556 |
+
|
557 |
+
#~ msgid "'Add to Cart' Button Text Color"
|
558 |
+
#~ msgstr "Colore testo pulsante ‘Aggiungi al carrello’"
|
559 |
+
|
560 |
+
#~ msgid "'Add to Cart' Button Hover Color "
|
561 |
+
#~ msgstr "Colore pulsante ‘Aggiungi al carrello’ al passaggio del mouse"
|
562 |
+
|
563 |
+
#~ msgid "'Add to Cart' Button Hover Text Color"
|
564 |
+
#~ msgstr "Colore testo pulsante ‘Aggiungi al carrello’ al passaggio del mouse"
|
565 |
+
|
566 |
+
#~ msgid "'View Details' Button Color"
|
567 |
+
#~ msgstr "Colore pulsante ‘Visualizza dettagli’"
|
568 |
+
|
569 |
+
#~ msgid "'View Details' Button Text Color"
|
570 |
+
#~ msgstr "Colore testo pulsante ‘Visualizza dettagli’"
|
571 |
+
|
572 |
+
#~ msgid "'View Details' Button Hover Color "
|
573 |
+
#~ msgstr "Colore pulsante ‘Visualizza dettagli’ al passaggio del mouse "
|
574 |
+
|
575 |
+
#~ msgid "'View Details' Button Hover Text Color"
|
576 |
+
#~ msgstr "Colore testo pulsante ‘Visualizza dettagli’ al passaggio del mouse "
|
577 |
+
|
578 |
+
#~ msgid "Closing Icon Color"
|
579 |
+
#~ msgstr "Colore icona chiusura"
|
580 |
+
|
581 |
+
#~ msgid "Closing Icon Hover Color"
|
582 |
+
#~ msgstr "Colore icona chiusura al passaggio del mouse"
|
583 |
+
|
584 |
+
#~ msgid "May I ask you to see this product, please?"
|
585 |
+
#~ msgstr "Posso chiederti di guardare questo prodotto, per favore?"
|
languages/yith-woocommerce-quick-view.pot
CHANGED
@@ -1,274 +1,274 @@
|
|
1 |
-
#, fuzzy
|
2 |
-
msgid ""
|
3 |
-
msgstr ""
|
4 |
-
"Project-Id-Version: YITH WooCommerce Quick View\n"
|
5 |
-
"POT-Creation-Date: 2017-10-11 12:42+0200\n"
|
6 |
-
"PO-Revision-Date: 2015-05-18 11:52+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.7.1\n"
|
14 |
-
"X-Poedit-Basepath: .\n"
|
15 |
-
"Plural-Forms: nplurals=2; plural=n!=1;\n"
|
16 |
-
"X-Poedit-KeywordsList: __ ;_e;_n:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
17 |
-
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
18 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
-
"X-Poedit-SearchPath-0: ..\n"
|
20 |
-
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
21 |
-
|
22 |
-
#: ../includes/class.yith-wcqv-admin.php:129
|
23 |
-
#: ../includes/class.yith-wcqv-admin.php:151
|
24 |
-
msgid "Settings"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: ../includes/class.yith-wcqv-admin.php:130
|
28 |
-
#: ../includes/class.yith-wcqv-admin.php:152
|
29 |
-
msgid "Premium Version"
|
30 |
-
msgstr ""
|
31 |
-
|
32 |
-
#: ../includes/class.yith-wcqv-admin.php:158
|
33 |
-
#: ../includes/class.yith-wcqv-admin.php:159
|
34 |
-
#: ../plugin-options/settings-options.php:57
|
35 |
-
msgid "Quick View"
|
36 |
-
msgstr ""
|
37 |
-
|
38 |
-
#: ../includes/class.yith-wcqv-admin.php:213
|
39 |
-
msgid "Plugin Documentation"
|
40 |
-
msgstr ""
|
41 |
-
|
42 |
-
#: ../init.php:41
|
43 |
-
msgid ""
|
44 |
-
"YITH WooCommerce Quick View is enabled but not effective. It requires "
|
45 |
-
"WooCommerce in order to work."
|
46 |
-
msgstr ""
|
47 |
-
|
48 |
-
#: ../init.php:50
|
49 |
-
msgid ""
|
50 |
-
"You can't activate the free version of YITH WooCommerce Quick View while you "
|
51 |
-
"are using the premium one."
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
#: ../plugin-options/settings-options.php:8
|
55 |
-
msgid "Upgrade to the PREMIUM VERSION"
|
56 |
-
msgstr ""
|
57 |
-
|
58 |
-
#: ../plugin-options/settings-options.php:11
|
59 |
-
#: ../plugin-options/settings-options.php:18
|
60 |
-
msgid "YITH WooCommerce Quick View"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: ../plugin-options/settings-options.php:12
|
64 |
-
msgid "Discover the Advanced Features"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: ../plugin-options/settings-options.php:13
|
68 |
-
msgid ""
|
69 |
-
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Quick View to benefit "
|
70 |
-
"from all features!"
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
#: ../plugin-options/settings-options.php:20
|
74 |
-
msgid "Get Support and Pro Features"
|
75 |
-
msgstr ""
|
76 |
-
|
77 |
-
#: ../plugin-options/settings-options.php:21
|
78 |
-
msgid ""
|
79 |
-
"By purchasing the premium version of the plugin, you will take advantage of "
|
80 |
-
"the advanced features of the product and you will get one year of free "
|
81 |
-
"updates and support through our platform available 24h/24."
|
82 |
-
msgstr ""
|
83 |
-
|
84 |
-
#: ../plugin-options/settings-options.php:31
|
85 |
-
msgid "General Options"
|
86 |
-
msgstr ""
|
87 |
-
|
88 |
-
#: ../plugin-options/settings-options.php:39
|
89 |
-
msgid "Enable Quick View"
|
90 |
-
msgstr ""
|
91 |
-
|
92 |
-
#: ../plugin-options/settings-options.php:46
|
93 |
-
msgid "Enable Quick View on mobile"
|
94 |
-
msgstr ""
|
95 |
-
|
96 |
-
#: ../plugin-options/settings-options.php:47
|
97 |
-
msgid "Enable quick view features on mobile device too"
|
98 |
-
msgstr ""
|
99 |
-
|
100 |
-
#: ../plugin-options/settings-options.php:54
|
101 |
-
msgid "Quick View Button Label"
|
102 |
-
msgstr ""
|
103 |
-
|
104 |
-
#: ../plugin-options/settings-options.php:55
|
105 |
-
msgid "Label for the quick view button in the WooCommerce loop."
|
106 |
-
msgstr ""
|
107 |
-
|
108 |
-
#: ../plugin-options/settings-options.php:62
|
109 |
-
msgid "Enable Lightbox"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
#: ../plugin-options/settings-options.php:63
|
113 |
-
msgid "Enable lightbox. Product images will open in a lightbox."
|
114 |
-
msgstr ""
|
115 |
-
|
116 |
-
#: ../plugin-options/settings-options.php:74 ../templates/admin/premium.php:323
|
117 |
-
#: ../templates/admin/premium.php:328
|
118 |
-
msgid "Style Options"
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
#: ../plugin-options/settings-options.php:81
|
122 |
-
msgid "Modal Window Background Color"
|
123 |
-
msgstr ""
|
124 |
-
|
125 |
-
#: ../plugin-options/settings-options.php:89
|
126 |
-
msgid "Closing Button Color"
|
127 |
-
msgstr ""
|
128 |
-
|
129 |
-
#: ../plugin-options/settings-options.php:97
|
130 |
-
msgid "Closing Button Hover Color"
|
131 |
-
msgstr ""
|
132 |
-
|
133 |
-
#: ../templates/admin/premium.php:210 ../templates/admin/premium.php:364
|
134 |
-
#, php-format
|
135 |
-
msgid ""
|
136 |
-
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to "
|
137 |
-
"benefit from all features!"
|
138 |
-
msgstr ""
|
139 |
-
|
140 |
-
#: ../templates/admin/premium.php:213 ../templates/admin/premium.php:367
|
141 |
-
msgid "UPGRADE"
|
142 |
-
msgstr ""
|
143 |
-
|
144 |
-
#: ../templates/admin/premium.php:214 ../templates/admin/premium.php:368
|
145 |
-
msgid "to the premium version"
|
146 |
-
msgstr ""
|
147 |
-
|
148 |
-
#: ../templates/admin/premium.php:220
|
149 |
-
msgid "Premium Features"
|
150 |
-
msgstr ""
|
151 |
-
|
152 |
-
#: ../templates/admin/premium.php:223
|
153 |
-
msgid "Button type"
|
154 |
-
msgstr ""
|
155 |
-
|
156 |
-
#: ../templates/admin/premium.php:228
|
157 |
-
msgid "BUTTON TYPE"
|
158 |
-
msgstr ""
|
159 |
-
|
160 |
-
#: ../templates/admin/premium.php:230
|
161 |
-
#, php-format
|
162 |
-
msgid ""
|
163 |
-
"Choose between the button or a custom icon to access the %1$sQuick View%2$s: "
|
164 |
-
"you can choose to place it after the \"Add To Cart\" button or inside the "
|
165 |
-
"thumbnail of the product."
|
166 |
-
msgstr ""
|
167 |
-
|
168 |
-
#: ../templates/admin/premium.php:238 ../templates/admin/premium.php:239
|
169 |
-
#: ../templates/admin/premium.php:244
|
170 |
-
msgid "Product Navigation"
|
171 |
-
msgstr ""
|
172 |
-
|
173 |
-
#: ../templates/admin/premium.php:241
|
174 |
-
#, php-format
|
175 |
-
msgid ""
|
176 |
-
"The navigation in the \"Quick View\" allows browsing among %1$sproducts%2$s "
|
177 |
-
"displayed in it. The navigation arrows show on mousehover the image of the "
|
178 |
-
"next/previous product."
|
179 |
-
msgstr ""
|
180 |
-
|
181 |
-
#: ../templates/admin/premium.php:255 ../templates/admin/premium.php:256
|
182 |
-
msgid "Content to display"
|
183 |
-
msgstr ""
|
184 |
-
|
185 |
-
#: ../templates/admin/premium.php:258
|
186 |
-
#, php-format
|
187 |
-
msgid ""
|
188 |
-
"The display of the product information in the \"Quick View\" are managed by "
|
189 |
-
"%1$sadministrators%2$s who can decide whether to show everything or only a "
|
190 |
-
"part of it."
|
191 |
-
msgstr ""
|
192 |
-
|
193 |
-
#: ../templates/admin/premium.php:267
|
194 |
-
msgid "Quick View Type"
|
195 |
-
msgstr ""
|
196 |
-
|
197 |
-
#: ../templates/admin/premium.php:269
|
198 |
-
#, php-format
|
199 |
-
msgid ""
|
200 |
-
"Quick view has two different displaying modes: the first one opens it as a "
|
201 |
-
"%1$smodal window%2$s, the other one opens it in the page itself with a "
|
202 |
-
"%1$scascading effect%2$s above content page."
|
203 |
-
msgstr ""
|
204 |
-
|
205 |
-
#: ../templates/admin/premium.php:272
|
206 |
-
msgid "Quick view type"
|
207 |
-
msgstr ""
|
208 |
-
|
209 |
-
#: ../templates/admin/premium.php:284
|
210 |
-
msgid "\"View details\" button"
|
211 |
-
msgstr ""
|
212 |
-
|
213 |
-
#: ../templates/admin/premium.php:286
|
214 |
-
msgid ""
|
215 |
-
"An additional button that allows users to access product detail page "
|
216 |
-
"directly from quick view window just with a click of the mouse."
|
217 |
-
msgstr ""
|
218 |
-
|
219 |
-
#: ../templates/admin/premium.php:295
|
220 |
-
msgid "Type of product images"
|
221 |
-
msgstr ""
|
222 |
-
|
223 |
-
#: ../templates/admin/premium.php:297
|
224 |
-
#, php-format
|
225 |
-
msgid ""
|
226 |
-
"Each product can have more than one image: choose whether to hide or show "
|
227 |
-
"them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s "
|
228 |
-
"display."
|
229 |
-
msgstr ""
|
230 |
-
|
231 |
-
#: ../templates/admin/premium.php:312
|
232 |
-
msgid "SHARE"
|
233 |
-
msgstr ""
|
234 |
-
|
235 |
-
#: ../templates/admin/premium.php:314
|
236 |
-
#, php-format
|
237 |
-
msgid ""
|
238 |
-
"%1$sQuick View is also social-friendly!%2$s Activating this option, you will "
|
239 |
-
"be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or "
|
240 |
-
"sending an email."
|
241 |
-
msgstr ""
|
242 |
-
|
243 |
-
#: ../templates/admin/premium.php:325
|
244 |
-
#, php-format
|
245 |
-
msgid ""
|
246 |
-
"A rich option panel to change the colors of the %1$s\"Quick View\"%2$s "
|
247 |
-
"button and of everything that is within the modal window generated."
|
248 |
-
msgstr ""
|
249 |
-
|
250 |
-
#: ../templates/admin/premium.php:340
|
251 |
-
msgid "SHORTCODE"
|
252 |
-
msgstr ""
|
253 |
-
|
254 |
-
#: ../templates/admin/premium.php:342
|
255 |
-
msgid ""
|
256 |
-
"The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you "
|
257 |
-
"can add a button in any spot of the page to allow your users to see the "
|
258 |
-
"quick view of a specific product in your store."
|
259 |
-
msgstr ""
|
260 |
-
|
261 |
-
#: ../templates/admin/premium.php:351
|
262 |
-
msgid "Compatibility with other YITH's plugins"
|
263 |
-
msgstr ""
|
264 |
-
|
265 |
-
#: ../templates/admin/premium.php:353
|
266 |
-
#, php-format
|
267 |
-
msgid ""
|
268 |
-
"Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH "
|
269 |
-
"WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you "
|
270 |
-
"will be free to enrich further the content of your quick view.%3$s Zoom the "
|
271 |
-
"product image, show a badge, or add the button to open the quick view in all "
|
272 |
-
"products available in your users' wishlists. With YITH's plugins you make "
|
273 |
-
"the difference."
|
274 |
-
msgstr ""
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Project-Id-Version: YITH WooCommerce Quick View\n"
|
5 |
+
"POT-Creation-Date: 2017-10-11 12:42+0200\n"
|
6 |
+
"PO-Revision-Date: 2015-05-18 11:52+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.7.1\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=n!=1;\n"
|
16 |
+
"X-Poedit-KeywordsList: __ ;_e;_n:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
17 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
18 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
19 |
+
"X-Poedit-SearchPath-0: ..\n"
|
20 |
+
"X-Poedit-SearchPathExcluded-0: ../plugin-fw\n"
|
21 |
+
|
22 |
+
#: ../includes/class.yith-wcqv-admin.php:129
|
23 |
+
#: ../includes/class.yith-wcqv-admin.php:151
|
24 |
+
msgid "Settings"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: ../includes/class.yith-wcqv-admin.php:130
|
28 |
+
#: ../includes/class.yith-wcqv-admin.php:152
|
29 |
+
msgid "Premium Version"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: ../includes/class.yith-wcqv-admin.php:158
|
33 |
+
#: ../includes/class.yith-wcqv-admin.php:159
|
34 |
+
#: ../plugin-options/settings-options.php:57
|
35 |
+
msgid "Quick View"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: ../includes/class.yith-wcqv-admin.php:213
|
39 |
+
msgid "Plugin Documentation"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: ../init.php:41
|
43 |
+
msgid ""
|
44 |
+
"YITH WooCommerce Quick View is enabled but not effective. It requires "
|
45 |
+
"WooCommerce in order to work."
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#: ../init.php:50
|
49 |
+
msgid ""
|
50 |
+
"You can't activate the free version of YITH WooCommerce Quick View while you "
|
51 |
+
"are using the premium one."
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: ../plugin-options/settings-options.php:8
|
55 |
+
msgid "Upgrade to the PREMIUM VERSION"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: ../plugin-options/settings-options.php:11
|
59 |
+
#: ../plugin-options/settings-options.php:18
|
60 |
+
msgid "YITH WooCommerce Quick View"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: ../plugin-options/settings-options.php:12
|
64 |
+
msgid "Discover the Advanced Features"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: ../plugin-options/settings-options.php:13
|
68 |
+
msgid ""
|
69 |
+
"Upgrade to the PREMIUM VERSION of YITH WooCommerce Quick View to benefit "
|
70 |
+
"from all features!"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: ../plugin-options/settings-options.php:20
|
74 |
+
msgid "Get Support and Pro Features"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: ../plugin-options/settings-options.php:21
|
78 |
+
msgid ""
|
79 |
+
"By purchasing the premium version of the plugin, you will take advantage of "
|
80 |
+
"the advanced features of the product and you will get one year of free "
|
81 |
+
"updates and support through our platform available 24h/24."
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#: ../plugin-options/settings-options.php:31
|
85 |
+
msgid "General Options"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: ../plugin-options/settings-options.php:39
|
89 |
+
msgid "Enable Quick View"
|
90 |
+
msgstr ""
|
91 |
+
|
92 |
+
#: ../plugin-options/settings-options.php:46
|
93 |
+
msgid "Enable Quick View on mobile"
|
94 |
+
msgstr ""
|
95 |
+
|
96 |
+
#: ../plugin-options/settings-options.php:47
|
97 |
+
msgid "Enable quick view features on mobile device too"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: ../plugin-options/settings-options.php:54
|
101 |
+
msgid "Quick View Button Label"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: ../plugin-options/settings-options.php:55
|
105 |
+
msgid "Label for the quick view button in the WooCommerce loop."
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#: ../plugin-options/settings-options.php:62
|
109 |
+
msgid "Enable Lightbox"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
#: ../plugin-options/settings-options.php:63
|
113 |
+
msgid "Enable lightbox. Product images will open in a lightbox."
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: ../plugin-options/settings-options.php:74 ../templates/admin/premium.php:323
|
117 |
+
#: ../templates/admin/premium.php:328
|
118 |
+
msgid "Style Options"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: ../plugin-options/settings-options.php:81
|
122 |
+
msgid "Modal Window Background Color"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: ../plugin-options/settings-options.php:89
|
126 |
+
msgid "Closing Button Color"
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: ../plugin-options/settings-options.php:97
|
130 |
+
msgid "Closing Button Hover Color"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: ../templates/admin/premium.php:210 ../templates/admin/premium.php:364
|
134 |
+
#, php-format
|
135 |
+
msgid ""
|
136 |
+
"Upgrade to %1$spremium version%2$s of %1$sYITH WooCommerce Quick View%2$s to "
|
137 |
+
"benefit from all features!"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: ../templates/admin/premium.php:213 ../templates/admin/premium.php:367
|
141 |
+
msgid "UPGRADE"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: ../templates/admin/premium.php:214 ../templates/admin/premium.php:368
|
145 |
+
msgid "to the premium version"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: ../templates/admin/premium.php:220
|
149 |
+
msgid "Premium Features"
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: ../templates/admin/premium.php:223
|
153 |
+
msgid "Button type"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: ../templates/admin/premium.php:228
|
157 |
+
msgid "BUTTON TYPE"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: ../templates/admin/premium.php:230
|
161 |
+
#, php-format
|
162 |
+
msgid ""
|
163 |
+
"Choose between the button or a custom icon to access the %1$sQuick View%2$s: "
|
164 |
+
"you can choose to place it after the \"Add To Cart\" button or inside the "
|
165 |
+
"thumbnail of the product."
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: ../templates/admin/premium.php:238 ../templates/admin/premium.php:239
|
169 |
+
#: ../templates/admin/premium.php:244
|
170 |
+
msgid "Product Navigation"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: ../templates/admin/premium.php:241
|
174 |
+
#, php-format
|
175 |
+
msgid ""
|
176 |
+
"The navigation in the \"Quick View\" allows browsing among %1$sproducts%2$s "
|
177 |
+
"displayed in it. The navigation arrows show on mousehover the image of the "
|
178 |
+
"next/previous product."
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: ../templates/admin/premium.php:255 ../templates/admin/premium.php:256
|
182 |
+
msgid "Content to display"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: ../templates/admin/premium.php:258
|
186 |
+
#, php-format
|
187 |
+
msgid ""
|
188 |
+
"The display of the product information in the \"Quick View\" are managed by "
|
189 |
+
"%1$sadministrators%2$s who can decide whether to show everything or only a "
|
190 |
+
"part of it."
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: ../templates/admin/premium.php:267
|
194 |
+
msgid "Quick View Type"
|
195 |
+
msgstr ""
|
196 |
+
|
197 |
+
#: ../templates/admin/premium.php:269
|
198 |
+
#, php-format
|
199 |
+
msgid ""
|
200 |
+
"Quick view has two different displaying modes: the first one opens it as a "
|
201 |
+
"%1$smodal window%2$s, the other one opens it in the page itself with a "
|
202 |
+
"%1$scascading effect%2$s above content page."
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ../templates/admin/premium.php:272
|
206 |
+
msgid "Quick view type"
|
207 |
+
msgstr ""
|
208 |
+
|
209 |
+
#: ../templates/admin/premium.php:284
|
210 |
+
msgid "\"View details\" button"
|
211 |
+
msgstr ""
|
212 |
+
|
213 |
+
#: ../templates/admin/premium.php:286
|
214 |
+
msgid ""
|
215 |
+
"An additional button that allows users to access product detail page "
|
216 |
+
"directly from quick view window just with a click of the mouse."
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: ../templates/admin/premium.php:295
|
220 |
+
msgid "Type of product images"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: ../templates/admin/premium.php:297
|
224 |
+
#, php-format
|
225 |
+
msgid ""
|
226 |
+
"Each product can have more than one image: choose whether to hide or show "
|
227 |
+
"them with the %1$sslider%2$s effect or in the classic %1$sWooCommerce%2$s "
|
228 |
+
"display."
|
229 |
+
msgstr ""
|
230 |
+
|
231 |
+
#: ../templates/admin/premium.php:312
|
232 |
+
msgid "SHARE"
|
233 |
+
msgstr ""
|
234 |
+
|
235 |
+
#: ../templates/admin/premium.php:314
|
236 |
+
#, php-format
|
237 |
+
msgid ""
|
238 |
+
"%1$sQuick View is also social-friendly!%2$s Activating this option, you will "
|
239 |
+
"be able to share the Quick View on Facebook, Twitter, Pinterest, Google+, or "
|
240 |
+
"sending an email."
|
241 |
+
msgstr ""
|
242 |
+
|
243 |
+
#: ../templates/admin/premium.php:325
|
244 |
+
#, php-format
|
245 |
+
msgid ""
|
246 |
+
"A rich option panel to change the colors of the %1$s\"Quick View\"%2$s "
|
247 |
+
"button and of everything that is within the modal window generated."
|
248 |
+
msgstr ""
|
249 |
+
|
250 |
+
#: ../templates/admin/premium.php:340
|
251 |
+
msgid "SHORTCODE"
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: ../templates/admin/premium.php:342
|
255 |
+
msgid ""
|
256 |
+
"The shortcode of plugin is a $1$srapid$2$s and $1$seasy$2$s solution: you "
|
257 |
+
"can add a button in any spot of the page to allow your users to see the "
|
258 |
+
"quick view of a specific product in your store."
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: ../templates/admin/premium.php:351
|
262 |
+
msgid "Compatibility with other YITH's plugins"
|
263 |
+
msgstr ""
|
264 |
+
|
265 |
+
#: ../templates/admin/premium.php:353
|
266 |
+
#, php-format
|
267 |
+
msgid ""
|
268 |
+
"Thanks to the compatibility with %1$sYITH WooCommerce Zoom Magnifier, YITH "
|
269 |
+
"WooCommerce Badge Management%2$s and %1$sYITH WooCommerce Wishlist%2$s, you "
|
270 |
+
"will be free to enrich further the content of your quick view.%3$s Zoom the "
|
271 |
+
"product image, show a badge, or add the button to open the quick view in all "
|
272 |
+
"products available in your users' wishlists. With YITH's plugins you make "
|
273 |
+
"the difference."
|
274 |
+
msgstr ""
|
plugin-fw/assets/css/admin.css
CHANGED
@@ -1,196 +1,196 @@
|
|
1 |
-
/*-----------------------
|
2 |
-
YITH Debug
|
3 |
-
------------------------*/
|
4 |
-
#wpadminbar .yith-debug-admin-bar div,
|
5 |
-
#wpadminbar .yith-debug-admin-bar:hover div {
|
6 |
-
background: #05789c !important;
|
7 |
-
color: #fff !important;
|
8 |
-
}
|
9 |
-
|
10 |
-
#wpadminbar .yith-debug-admin-bar a,
|
11 |
-
#wpadminbar .yith-debug-admin-bar strong {
|
12 |
-
color: #fff !important;
|
13 |
-
}
|
14 |
-
|
15 |
-
#wpadminbar .yith-debug-admin-bar strong {
|
16 |
-
font-weight: 600;
|
17 |
-
}
|
18 |
-
|
19 |
-
#wpadminbar .yith-debug-admin-bar-post-meta .ab-empty-item,
|
20 |
-
#wpadminbar .yith-debug-admin-bar-option .ab-empty-item {
|
21 |
-
display: none;
|
22 |
-
}
|
23 |
-
|
24 |
-
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-post-meta-default,
|
25 |
-
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-option-default {
|
26 |
-
padding: 0;
|
27 |
-
max-height: 500px;
|
28 |
-
overflow-y: auto;
|
29 |
-
}
|
30 |
-
|
31 |
-
#wpadminbar .yith-debug-admin-bar pre {
|
32 |
-
padding: 10px;
|
33 |
-
line-height: 1.5em;
|
34 |
-
}
|
35 |
-
|
36 |
-
.notice-yith {
|
37 |
-
margin-left: 0;
|
38 |
-
border-left-color: #acc327;
|
39 |
-
}
|
40 |
-
|
41 |
-
.notice-yith.notice-alt {
|
42 |
-
background-color: #ecf7ed;
|
43 |
-
}
|
44 |
-
|
45 |
-
.yith-promo-banner-image-link {
|
46 |
-
display: block;
|
47 |
-
margin-bottom: 15px;
|
48 |
-
}
|
49 |
-
|
50 |
-
.yith-promo-banner-image {
|
51 |
-
max-width: 100%;
|
52 |
-
margin: 0 auto;
|
53 |
-
display: block;
|
54 |
-
}
|
55 |
-
|
56 |
-
/*-----------------------
|
57 |
-
YITH FEEDS
|
58 |
-
------------------------*/
|
59 |
-
|
60 |
-
.yith-feeds-logo {
|
61 |
-
display: table-cell;
|
62 |
-
background: #005b7c;
|
63 |
-
padding: 5px;
|
64 |
-
border-radius: 50%;
|
65 |
-
margin-right: 10px;
|
66 |
-
vertical-align: text-bottom;
|
67 |
-
width: 18px;
|
68 |
-
height: auto;
|
69 |
-
vertical-align: middle;
|
70 |
-
}
|
71 |
-
|
72 |
-
.yith-feeds-plugin-name {
|
73 |
-
display: table-cell;
|
74 |
-
vertical-align: middle;
|
75 |
-
}
|
76 |
-
|
77 |
-
/*-----------------------
|
78 |
-
YITH Plugins Columns
|
79 |
-
------------------------*/
|
80 |
-
@media screen and (min-width: 783px) {
|
81 |
-
|
82 |
-
.auto-fold #adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu-head {
|
83 |
-
width: 100%;
|
84 |
-
}
|
85 |
-
|
86 |
-
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu {
|
87 |
-
min-width: 320px;
|
88 |
-
display: flex;
|
89 |
-
flex-flow: row wrap;
|
90 |
-
}
|
91 |
-
|
92 |
-
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
93 |
-
width: 50%;
|
94 |
-
border-left: 1px solid #555;
|
95 |
-
box-sizing: border-box;
|
96 |
-
}
|
97 |
-
|
98 |
-
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(2n) {
|
99 |
-
border-left: none;
|
100 |
-
}
|
101 |
-
|
102 |
-
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu {
|
103 |
-
min-width: 480px;
|
104 |
-
display: flex;
|
105 |
-
flex-flow: row wrap;
|
106 |
-
}
|
107 |
-
|
108 |
-
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
109 |
-
width: calc(100% / 3);
|
110 |
-
border-left: 1px solid #555;
|
111 |
-
box-sizing: border-box;
|
112 |
-
}
|
113 |
-
|
114 |
-
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(3n + 2) {
|
115 |
-
border-left: none;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
/*---------------------------
|
120 |
-
YITH System Information
|
121 |
-
----------------------------*/
|
122 |
-
.yith-phpinfo img {
|
123 |
-
float: right;
|
124 |
-
border: 0;
|
125 |
-
}
|
126 |
-
|
127 |
-
#yith-system-alert span.yith-logo,
|
128 |
-
.yith-system-info h1 span.yith-logo {
|
129 |
-
border-radius: 50%;
|
130 |
-
background: #265b7a;
|
131 |
-
height: 30px;
|
132 |
-
width: 30px;
|
133 |
-
display: flex;
|
134 |
-
text-align: center;
|
135 |
-
margin: 0 10px 0 0;
|
136 |
-
float: left;
|
137 |
-
align-items: center;
|
138 |
-
justify-content: center;
|
139 |
-
}
|
140 |
-
|
141 |
-
.yith-system-info table {
|
142 |
-
margin: 20px 0;
|
143 |
-
}
|
144 |
-
|
145 |
-
.yith-system-info table th {
|
146 |
-
font-weight: bold;
|
147 |
-
width: 25%;
|
148 |
-
padding: 20px 12px;
|
149 |
-
}
|
150 |
-
|
151 |
-
.yith-system-info table td {
|
152 |
-
word-break: break-all;
|
153 |
-
padding: 20px 12px;
|
154 |
-
}
|
155 |
-
|
156 |
-
.yith-system-info table td.requirement-value {
|
157 |
-
font-size: 14px;
|
158 |
-
vertical-align: middle;
|
159 |
-
text-align: left;
|
160 |
-
color: #5da726;
|
161 |
-
line-height: 19px;
|
162 |
-
width: 90px;
|
163 |
-
}
|
164 |
-
|
165 |
-
.yith-system-info table td.requirement-value.has-errors {
|
166 |
-
color: #a00;
|
167 |
-
}
|
168 |
-
|
169 |
-
.yith-system-info table td.requirement-value.has-warnings {
|
170 |
-
color: #ffa200;
|
171 |
-
}
|
172 |
-
|
173 |
-
.yith-system-info table td.requirement-messages ul {
|
174 |
-
margin: 0;
|
175 |
-
padding: 0 0 10px 0;
|
176 |
-
list-style: none!important;
|
177 |
-
}
|
178 |
-
|
179 |
-
.yith-system-info table td.requirement-messages ul li {
|
180 |
-
margin-bottom: 3px;
|
181 |
-
}
|
182 |
-
|
183 |
-
.yith-system-info table td.requirement-messages ul li span.error {
|
184 |
-
color: #a00;
|
185 |
-
font-weight: bold;
|
186 |
-
}
|
187 |
-
|
188 |
-
.yith-system-info table td.requirement-messages ul li span.warning {
|
189 |
-
color: #a00;
|
190 |
-
font-weight: bold;
|
191 |
-
}
|
192 |
-
|
193 |
-
.yith-system-info-menu {
|
194 |
-
font-weight: bold;
|
195 |
-
font-size: 11px !important;
|
196 |
-
}
|
1 |
+
/*-----------------------
|
2 |
+
YITH Debug
|
3 |
+
------------------------*/
|
4 |
+
#wpadminbar .yith-debug-admin-bar div,
|
5 |
+
#wpadminbar .yith-debug-admin-bar:hover div {
|
6 |
+
background: #05789c !important;
|
7 |
+
color: #fff !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
#wpadminbar .yith-debug-admin-bar a,
|
11 |
+
#wpadminbar .yith-debug-admin-bar strong {
|
12 |
+
color: #fff !important;
|
13 |
+
}
|
14 |
+
|
15 |
+
#wpadminbar .yith-debug-admin-bar strong {
|
16 |
+
font-weight: 600;
|
17 |
+
}
|
18 |
+
|
19 |
+
#wpadminbar .yith-debug-admin-bar-post-meta .ab-empty-item,
|
20 |
+
#wpadminbar .yith-debug-admin-bar-option .ab-empty-item {
|
21 |
+
display: none;
|
22 |
+
}
|
23 |
+
|
24 |
+
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-post-meta-default,
|
25 |
+
#wpadminbar #wp-admin-bar-yith-debug-admin-bar-option-default {
|
26 |
+
padding: 0;
|
27 |
+
max-height: 500px;
|
28 |
+
overflow-y: auto;
|
29 |
+
}
|
30 |
+
|
31 |
+
#wpadminbar .yith-debug-admin-bar pre {
|
32 |
+
padding: 10px;
|
33 |
+
line-height: 1.5em;
|
34 |
+
}
|
35 |
+
|
36 |
+
.notice-yith {
|
37 |
+
margin-left: 0;
|
38 |
+
border-left-color: #acc327;
|
39 |
+
}
|
40 |
+
|
41 |
+
.notice-yith.notice-alt {
|
42 |
+
background-color: #ecf7ed;
|
43 |
+
}
|
44 |
+
|
45 |
+
.yith-promo-banner-image-link {
|
46 |
+
display: block;
|
47 |
+
margin-bottom: 15px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.yith-promo-banner-image {
|
51 |
+
max-width: 100%;
|
52 |
+
margin: 0 auto;
|
53 |
+
display: block;
|
54 |
+
}
|
55 |
+
|
56 |
+
/*-----------------------
|
57 |
+
YITH FEEDS
|
58 |
+
------------------------*/
|
59 |
+
|
60 |
+
.yith-feeds-logo {
|
61 |
+
display: table-cell;
|
62 |
+
background: #005b7c;
|
63 |
+
padding: 5px;
|
64 |
+
border-radius: 50%;
|
65 |
+
margin-right: 10px;
|
66 |
+
vertical-align: text-bottom;
|
67 |
+
width: 18px;
|
68 |
+
height: auto;
|
69 |
+
vertical-align: middle;
|
70 |
+
}
|
71 |
+
|
72 |
+
.yith-feeds-plugin-name {
|
73 |
+
display: table-cell;
|
74 |
+
vertical-align: middle;
|
75 |
+
}
|
76 |
+
|
77 |
+
/*-----------------------
|
78 |
+
YITH Plugins Columns
|
79 |
+
------------------------*/
|
80 |
+
@media screen and (min-width: 783px) {
|
81 |
+
|
82 |
+
.auto-fold #adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu-head {
|
83 |
+
width: 100%;
|
84 |
+
}
|
85 |
+
|
86 |
+
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu {
|
87 |
+
min-width: 320px;
|
88 |
+
display: flex;
|
89 |
+
flex-flow: row wrap;
|
90 |
+
}
|
91 |
+
|
92 |
+
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
93 |
+
width: 50%;
|
94 |
+
border-left: 1px solid #555;
|
95 |
+
box-sizing: border-box;
|
96 |
+
}
|
97 |
+
|
98 |
+
#adminmenu .yith-plugin-fw-menu-2-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(2n) {
|
99 |
+
border-left: none;
|
100 |
+
}
|
101 |
+
|
102 |
+
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu {
|
103 |
+
min-width: 480px;
|
104 |
+
display: flex;
|
105 |
+
flex-flow: row wrap;
|
106 |
+
}
|
107 |
+
|
108 |
+
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head) {
|
109 |
+
width: calc(100% / 3);
|
110 |
+
border-left: 1px solid #555;
|
111 |
+
box-sizing: border-box;
|
112 |
+
}
|
113 |
+
|
114 |
+
#adminmenu .yith-plugin-fw-menu-3-columns.wp-not-current-submenu .wp-submenu li:not(.wp-submenu-head):nth-child(3n + 2) {
|
115 |
+
border-left: none;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
/*---------------------------
|
120 |
+
YITH System Information
|
121 |
+
----------------------------*/
|
122 |
+
.yith-phpinfo img {
|
123 |
+
float: right;
|
124 |
+
border: 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
#yith-system-alert span.yith-logo,
|
128 |
+
.yith-system-info h1 span.yith-logo {
|
129 |
+
border-radius: 50%;
|
130 |
+
background: #265b7a;
|
131 |
+
height: 30px;
|
132 |
+
width: 30px;
|
133 |
+
display: flex;
|
134 |
+
text-align: center;
|
135 |
+
margin: 0 10px 0 0;
|
136 |
+
float: left;
|
137 |
+
align-items: center;
|
138 |
+
justify-content: center;
|
139 |
+
}
|
140 |
+
|
141 |
+
.yith-system-info table {
|
142 |
+
margin: 20px 0;
|
143 |
+
}
|
144 |
+
|
145 |
+
.yith-system-info table th {
|
146 |
+
font-weight: bold;
|
147 |
+
width: 25%;
|
148 |
+
padding: 20px 12px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.yith-system-info table td {
|
152 |
+
word-break: break-all;
|
153 |
+
padding: 20px 12px;
|
154 |
+
}
|
155 |
+
|
156 |
+
.yith-system-info table td.requirement-value {
|
157 |
+
font-size: 14px;
|
158 |
+
vertical-align: middle;
|
159 |
+
text-align: left;
|
160 |
+
color: #5da726;
|
161 |
+
line-height: 19px;
|
162 |
+
width: 90px;
|
163 |
+
}
|
164 |
+
|
165 |
+
.yith-system-info table td.requirement-value.has-errors {
|
166 |
+
color: #a00;
|
167 |
+
}
|
168 |
+
|
169 |
+
.yith-system-info table td.requirement-value.has-warnings {
|
170 |
+
color: #ffa200;
|
171 |
+
}
|
172 |
+
|
173 |
+
.yith-system-info table td.requirement-messages ul {
|
174 |
+
margin: 0;
|
175 |
+
padding: 0 0 10px 0;
|
176 |
+
list-style: none!important;
|
177 |
+
}
|
178 |
+
|
179 |
+
.yith-system-info table td.requirement-messages ul li {
|
180 |
+
margin-bottom: 3px;
|
181 |
+
}
|
182 |
+
|
183 |
+
.yith-system-info table td.requirement-messages ul li span.error {
|
184 |
+
color: #a00;
|
185 |
+
font-weight: bold;
|
186 |
+
}
|
187 |
+
|
188 |
+
.yith-system-info table td.requirement-messages ul li span.warning {
|
189 |
+
color: #a00;
|
190 |
+
font-weight: bold;
|
191 |
+
}
|
192 |
+
|
193 |
+
.yith-system-info-menu {
|
194 |
+
font-weight: bold;
|
195 |
+
font-size: 11px !important;
|
196 |
+
}
|
plugin-fw/assets/css/codemirror/codemirror.css
CHANGED
@@ -1,260 +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 |
-
}
|
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 |
+
}
|
plugin-fw/assets/css/colorbox.css
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
/*
|
2 |
-
Colorbox Core Style:
|
3 |
-
The following CSS is consistent between example themes and should not be altered.
|
4 |
-
*/
|
5 |
-
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden; -webkit-transform: translate3d(0,0,0);}
|
6 |
-
#cboxWrapper {max-width:none;}
|
7 |
-
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
8 |
-
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
9 |
-
#cboxContent{position:relative;}
|
10 |
-
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
11 |
-
#cboxTitle{margin:0;}
|
12 |
-
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
13 |
-
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
14 |
-
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
15 |
-
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
|
16 |
-
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
17 |
-
|
18 |
-
/*
|
19 |
-
User Style:
|
20 |
-
Change the following styles to modify the appearance of Colorbox. They are
|
21 |
-
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
22 |
-
*/
|
23 |
-
#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);}
|
24 |
-
#colorbox{outline:0;}
|
25 |
-
#cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;}
|
26 |
-
#cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;}
|
27 |
-
#cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;}
|
28 |
-
#cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;}
|
29 |
-
#cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;}
|
30 |
-
#cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;}
|
31 |
-
#cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;}
|
32 |
-
#cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;}
|
33 |
-
#cboxContent{background:#fff; overflow:hidden;}
|
34 |
-
.cboxIframe{background:#fff;}
|
35 |
-
#cboxError{padding:50px; border:1px solid #ccc;}
|
36 |
-
#cboxLoadedContent{margin-bottom:20px;}
|
37 |
-
#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
|
38 |
-
#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
|
39 |
-
#cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;}
|
40 |
-
|
41 |
-
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
42 |
-
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
43 |
-
|
44 |
-
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
45 |
-
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
46 |
-
|
47 |
-
#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
|
48 |
-
#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
|
49 |
-
#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
|
50 |
-
#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}
|
51 |
-
|
52 |
-
/*
|
53 |
-
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
|
54 |
-
when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
|
55 |
-
See: http://jacklmoore.com/notes/ie-transparency-problems/
|
56 |
-
*/
|
57 |
-
.cboxIE #cboxTopLeft,
|
58 |
-
.cboxIE #cboxTopCenter,
|
59 |
-
.cboxIE #cboxTopRight,
|
60 |
-
.cboxIE #cboxBottomLeft,
|
61 |
-
.cboxIE #cboxBottomCenter,
|
62 |
-
.cboxIE #cboxBottomRight,
|
63 |
-
.cboxIE #cboxMiddleLeft,
|
64 |
-
.cboxIE #cboxMiddleRight {
|
65 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
|
66 |
}
|
1 |
+
/*
|
2 |
+
Colorbox Core Style:
|
3 |
+
The following CSS is consistent between example themes and should not be altered.
|
4 |
+
*/
|
5 |
+
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden; -webkit-transform: translate3d(0,0,0);}
|
6 |
+
#cboxWrapper {max-width:none;}
|
7 |
+
#cboxOverlay{position:fixed; width:100%; height:100%;}
|
8 |
+
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
|
9 |
+
#cboxContent{position:relative;}
|
10 |
+
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
|
11 |
+
#cboxTitle{margin:0;}
|
12 |
+
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
|
13 |
+
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
|
14 |
+
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
|
15 |
+
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
|
16 |
+
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
|
17 |
+
|
18 |
+
/*
|
19 |
+
User Style:
|
20 |
+
Change the following styles to modify the appearance of Colorbox. They are
|
21 |
+
ordered & tabbed in a way that represents the nesting of the generated HTML.
|
22 |
+
*/
|
23 |
+
#cboxOverlay{background:#fff; opacity: 0.9; filter: alpha(opacity = 90);}
|
24 |
+
#colorbox{outline:0;}
|
25 |
+
#cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;}
|
26 |
+
#cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;}
|
27 |
+
#cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;}
|
28 |
+
#cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;}
|
29 |
+
#cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;}
|
30 |
+
#cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;}
|
31 |
+
#cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;}
|
32 |
+
#cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;}
|
33 |
+
#cboxContent{background:#fff; overflow:hidden;}
|
34 |
+
.cboxIframe{background:#fff;}
|
35 |
+
#cboxError{padding:50px; border:1px solid #ccc;}
|
36 |
+
#cboxLoadedContent{margin-bottom:20px;}
|
37 |
+
#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
|
38 |
+
#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
|
39 |
+
#cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;}
|
40 |
+
|
41 |
+
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
|
42 |
+
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
|
43 |
+
|
44 |
+
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
|
45 |
+
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
|
46 |
+
|
47 |
+
#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
|
48 |
+
#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
|
49 |
+
#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
|
50 |
+
#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}
|
51 |
+
|
52 |
+
/*
|
53 |
+
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
|
54 |
+
when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
|
55 |
+
See: http://jacklmoore.com/notes/ie-transparency-problems/
|
56 |
+
*/
|
57 |
+
.cboxIE #cboxTopLeft,
|
58 |
+
.cboxIE #cboxTopCenter,
|
59 |
+
.cboxIE #cboxTopRight,
|
60 |
+
.cboxIE #cboxBottomLeft,
|
61 |
+
.cboxIE #cboxBottomCenter,
|
62 |
+
.cboxIE #cboxBottomRight,
|
63 |
+
.cboxIE #cboxMiddleLeft,
|
64 |
+
.cboxIE #cboxMiddleRight {
|
65 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
|
66 |
}
|
plugin-fw/assets/css/metaboxes.css
CHANGED
@@ -1,721 +1,721 @@
|
|
1 |
-
/* self-clear floats */
|
2 |
-
.clearfix:after {
|
3 |
-
content: ".";
|
4 |
-
display: block;
|
5 |
-
height: 0;
|
6 |
-
clear: both;
|
7 |
-
visibility: hidden;
|
8 |
-
overflow: hidden;
|
9 |
-
}
|
10 |
-
|
11 |
-
/* ie.css */
|
12 |
-
* html .clearfix { /* IE6 */
|
13 |
-
height: 1%;
|
14 |
-
}
|
15 |
-
|
16 |
-
*:first-child + html .clearfix { /* IE7 */
|
17 |
-
min-height: 1%;
|
18 |
-
}
|
19 |
-
|
20 |
-
.clearboth {
|
21 |
-
clear: both
|
22 |
-
}
|
23 |
-
|
24 |
-
/* === TAB STYLE */
|
25 |
-
.metaboxes-tab {
|
26 |
-
margin: -6px -12px -8px;
|
27 |
-
}
|
28 |
-
|
29 |
-
.metaboxes-tab div.tabs-panel {
|
30 |
-
height: auto;
|
31 |
-
overflow: visible;
|
32 |
-
margin-top: 0px;
|
33 |
-
padding: 0 10px;
|
34 |
-
background: none;
|
35 |
-
border: 0;
|
36 |
-
}
|
37 |
-
|
38 |
-
.metaboxes-tab ul.metaboxes-tabs {
|
39 |
-
background: #f1f1f1;
|
40 |
-
margin: 0;
|
41 |
-
padding: 10px 0 0 5px;
|
42 |
-
}
|
43 |
-
|
44 |
-
.metaboxes-tab ul.metaboxes-tabs li {
|
45 |
-
float: left;
|
46 |
-
background: #dedede;
|
47 |
-
margin: 0 0 0 5px;
|
48 |
-
}
|
49 |
-
|
50 |
-
.metaboxes-tab ul.metaboxes-tabs li a {
|
51 |
-
color: #555;
|
52 |
-
text-decoration: none;
|
53 |
-
padding: 8px 15px;
|
54 |
-
display: block;
|
55 |
-
box-shadow: none !important;
|
56 |
-
}
|
57 |
-
|
58 |
-
.metaboxes-tab ul.metaboxes-tabs li.tabs {
|
59 |
-
background: #fff;
|
60 |
-
}
|
61 |
-
|
62 |
-
.metaboxes-tab p.field-row {
|
63 |
-
margin: 20px 0;
|
64 |
-
}
|
65 |
-
|
66 |
-
.metaboxes-tab div.sep {
|
67 |
-
height: 1px;
|
68 |
-
background: #dfdfdf;
|
69 |
-
clear: both;
|
70 |
-
margin-left: -10px;
|
71 |
-
margin-right: -10px;
|
72 |
-
}
|
73 |
-
|
74 |
-
.metaboxes-tab label {
|
75 |
-
font-weight: bold;
|
76 |
-
width: 160px;
|
77 |
-
float: left;
|
78 |
-
line-height: 23px;
|
79 |
-
margin-left: -184px;
|
80 |
-
}
|
81 |
-
|
82 |
-
.metaboxes-tab label small {
|
83 |
-
font-weight: normal;
|
84 |
-
line-height: 15px;
|
85 |
-
font-style: italic;
|
86 |
-
color: #999;
|
87 |
-
display: block;
|
88 |
-
}
|
89 |
-
|
90 |
-
.metaboxes-tab .yith-plugin-fw-radio__row {
|
91 |
-
width: 100%;
|
92 |
-
min-height: 20px;
|
93 |
-
}
|
94 |
-
|
95 |
-
.metaboxes-tab .yith-plugin-fw-radio__row label,
|
96 |
-
.metaboxes-tab .yith-toggle-elements label,
|
97 |
-
.metaboxes-tab .yith-add-box label {
|
98 |
-
margin-left: 0;
|
99 |
-
font-weight: normal;
|
100 |
-
}
|
101 |
-
|
102 |
-
.metaboxes-tab.yith-plugin-ui h3 {
|
103 |
-
color: #2a8db0;
|
104 |
-
font-size: 15px;
|
105 |
-
text-transform: uppercase;
|
106 |
-
background-color: #fff;
|
107 |
-
padding: 35px 20px;
|
108 |
-
margin: 0px 0 0 -4px;
|
109 |
-
width: auto;
|
110 |
-
background: transparent;
|
111 |
-
}
|
112 |
-
|
113 |
-
.metaboxes-tab.yith-plugin-ui .yith-add-box,
|
114 |
-
.metaboxes-tab.yith-plugin-ui .yith-toggle-row {
|
115 |
-
width: auto;
|
116 |
-
}
|
117 |
-
|
118 |
-
.metaboxes-tab .wp-picker-container label {
|
119 |
-
font-weight: inherit;
|
120 |
-
width: auto;
|
121 |
-
float: none;
|
122 |
-
line-height: inherit;
|
123 |
-
margin-left: 0;
|
124 |
-
}
|
125 |
-
|
126 |
-
.metaboxes-tab.yith-plugin-ui .yith-plugin-fw-radio__row label {
|
127 |
-
width: auto !important;
|
128 |
-
display: inline-block;
|
129 |
-
font-weight: normal;
|
130 |
-
}
|
131 |
-
|
132 |
-
.metaboxes-tab input[type="checkbox"] {
|
133 |
-
vertical-align: middle
|
134 |
-
}
|
135 |
-
|
136 |
-
.metaboxes-tab input.button-secondary, .metaboxes-tab input.checkbox {
|
137 |
-
width: auto;
|
138 |
-
}
|
139 |
-
|
140 |
-
.metaboxes-tab p.field-row.textarea .description {
|
141 |
-
vertical-align: top;
|
142 |
-
}
|
143 |
-
|
144 |
-
.metaboxes-tab p.field-row.checkbox {
|
145 |
-
background: none;
|
146 |
-
}
|
147 |
-
|
148 |
-
.metaboxes-tab .the-metabox {
|
149 |
-
margin: 20px 0;
|
150 |
-
margin-left: 184px;
|
151 |
-
}
|
152 |
-
|
153 |
-
.metaboxes-tab .the-metabox.no-label {
|
154 |
-
margin: 20px 0;
|
155 |
-
margin-left: 0;
|
156 |
-
}
|
157 |
-
|
158 |
-
.metaboxes-tab hr {
|
159 |
-
height: 0px;
|
160 |
-
border-top: 1px solid #dadada;
|
161 |
-
width: auto;
|
162 |
-
margin-left: -10px;
|
163 |
-
margin-right: -10px;
|
164 |
-
}
|
165 |
-
|
166 |
-
.metaboxes-tab .the-metabox p {
|
167 |
-
margin: 0;
|
168 |
-
}
|
169 |
-
|
170 |
-
.metaboxes-tab .the-metabox:last-child {
|
171 |
-
border-bottom: 0px;
|
172 |
-
}
|
173 |
-
|
174 |
-
.metaboxes-tab .the-metabox.checkbox {
|
175 |
-
background: none;
|
176 |
-
}
|
177 |
-
|
178 |
-
.metaboxes-tab span.description.inline {
|
179 |
-
display: inline-block;
|
180 |
-
line-height: 23px;
|
181 |
-
width: auto;
|
182 |
-
vertical-align: middle;
|
183 |
-
margin: 0;
|
184 |
-
}
|
185 |
-
|
186 |
-
.metaboxes-tab .slider label {
|
187 |
-
padding: 15px 0;
|
188 |
-
}
|
189 |
-
|
190 |
-
/* sortable table posts */
|
191 |
-
|
192 |
-
#the-list.ui-sortable tr:hover {
|
193 |
-
cursor: move;
|
194 |
-
}
|
195 |
-
|
196 |
-
.the-metabox.preview {
|
197 |
-
float: none;
|
198 |
-
}
|
199 |
-
|
200 |
-
.metaboxes-tab .the-metabox.no-label.preview {
|
201 |
-
margin-left: 184px;
|
202 |
-
}
|
203 |
-
|
204 |
-
.metaboxes-tab .the-metabox.no-label.preview img {
|
205 |
-
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
|
206 |
-
}
|
207 |
-
|
208 |
-
/**************************************
|
209 |
-
FIELDS
|
210 |
-
***************************************/
|
211 |
-
|
212 |
-
.metaboxes-tab select,
|
213 |
-
.metaboxes-tab input[type=text],
|
214 |
-
.metaboxes-tab input[type=number],
|
215 |
-
.metaboxes-tab textarea,
|
216 |
-
.metaboxes-tab .yith-plugin-fw-select,
|
217 |
-
.metaboxes-tab .yith-plugin-fw-slider-container,
|
218 |
-
.metaboxes-tab .yith-plugin-fw-text-input,
|
219 |
-
.metaboxes-tab .yith-plugin-fw-text-array-table,
|
220 |
-
.metaboxes-tab .yith-plugin-fw-textarea {
|
221 |
-
width: 400px;
|
222 |
-
max-width: 100%;
|
223 |
-
}
|
224 |
-
|
225 |
-
.metaboxes-tab.yith-plugin-ui input[type=number] {
|
226 |
-
width: auto;
|
227 |
-
min-width: 90px;
|
228 |
-
}
|
229 |
-
|
230 |
-
.metaboxes-tab.yith-plugin-ui p {
|
231 |
-
font-size: 14px;
|
232 |
-
}
|
233 |
-
|
234 |
-
.metaboxes-tab.yith-plugin-ui p.section-description {
|
235 |
-
|
236 |
-
margin: 0 20px 40px 18px;
|
237 |
-
}
|
238 |
-
|
239 |
-
.metaboxes-tab .yith-plugin-fw-text-array-table input[type=text] {
|
240 |
-
width: 100%;
|
241 |
-
}
|
242 |
-
|
243 |
-
.metaboxes-tab.yith-plugin-ui .yith-add-box h3 {
|
244 |
-
padding: 0 0 30px 0;
|
245 |
-
font-weight: 600;
|
246 |
-
margin: 0;
|
247 |
-
}
|
248 |
-
|
249 |
-
.metaboxes-tab.yith-plugin-ui .select2-container--default .select2-selection--single {
|
250 |
-
border: 0;
|
251 |
-
margin: 0;
|
252 |
-
}
|
253 |
-
|
254 |
-
/* wp editor */
|
255 |
-
.the-metabox.textarea-editor .mceIframeContainer {
|
256 |
-
background: #fff;
|
257 |
-
}
|
258 |
-
|
259 |
-
|
260 |
-
.the-metabox.textarea-editor label {
|
261 |
-
margin-top: 24px;
|
262 |
-
}
|
263 |
-
|
264 |
-
/* categories */
|
265 |
-
.categories-panel {
|
266 |
-
width: 30%;
|
267 |
-
float: left;
|
268 |
-
margin-right: 4px;
|
269 |
-
}
|
270 |
-
|
271 |
-
.categories-panel .box {
|
272 |
-
height: 200px;
|
273 |
-
border: 1px solid #dfdfdf;
|
274 |
-
background: #fff;
|
275 |
-
padding: 6px 10px;
|
276 |
-
overflow: auto;
|
277 |
-
}
|
278 |
-
|
279 |
-
.categories-panel ul {
|
280 |
-
list-style: none;
|
281 |
-
margin: 0;
|
282 |
-
}
|
283 |
-
|
284 |
-
.categories-panel ul li {
|
285 |
-
line-height: 19px;
|
286 |
-
margin: 0;
|
287 |
-
padding: 0;
|
288 |
-
word-wrap: break-word;
|
289 |
-
}
|
290 |
-
|
291 |
-
.categories-panel ul li label {
|
292 |
-
font-weight: normal !important;
|
293 |
-
margin-left: 0 !important;
|
294 |
-
}
|
295 |
-
|
296 |
-
.categories-panel input.newcategory {
|
297 |
-
width: 100%;
|
298 |
-
margin-bottom: 3px;
|
299 |
-
}
|
300 |
-
|
301 |
-
/* contact form */
|
302 |
-
.contactform_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 #fff inset;
|
313 |
-
min-width: 255px;
|
314 |
-
position: relative;
|
315 |
-
}
|
316 |
-
|
317 |
-
.contactform_item .handlediv {
|
318 |
-
position: relative;
|
319 |
-
top: -4px;
|
320 |
-
}
|
321 |
-
|
322 |
-
.contactform_item h3 {
|
323 |
-
min-height: 21px;
|
324 |
-
margin: 13px;
|
325 |
-
}
|
326 |
-
|
327 |
-
.contactform_item .inside {
|
328 |
-
padding: 10px !important;
|
329 |
-
}
|
330 |
-
|
331 |
-
.contactform_item .deps {
|
332 |
-
display: none;
|
333 |
-
}
|
334 |
-
|
335 |
-
.contactform_item .addoptions p.option {
|
336 |
-
margin: 5px 0 5px 200px
|
337 |
-
}
|
338 |
-
|
339 |
-
.contactform_item .addoptions p label {
|
340 |
-
width: 80px !important;
|
341 |
-
}
|
342 |
-
|
343 |
-
.contactform_item .add-field-option {
|
344 |
-
margin-bottom: 10px !important;
|
345 |
-
}
|
346 |
-
|
347 |
-
.remove_item {
|
348 |
-
float: right;
|
349 |
-
}
|
350 |
-
|
351 |
-
.metabox-sortable-placeholder {
|
352 |
-
border: 1px dotted #dedede;
|
353 |
-
margin: 10px 0
|
354 |
-
}
|
355 |
-
|
356 |
-
/* features tab */
|
357 |
-
.featurestab_item {
|
358 |
-
border-style: solid;
|
359 |
-
border-width: 1px;
|
360 |
-
line-height: 1;
|
361 |
-
margin-bottom: 20px;
|
362 |
-
padding: 0;
|
363 |
-
background-color: #f5f5f5;
|
364 |
-
background-image: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5);
|
365 |
-
border-color: #dfdfdf;
|
366 |
-
border-radius: 3px 3px 3px 3px;
|
367 |
-
box-shadow: 0 1px 0 #fff inset;
|
368 |
-
min-width: 255px;
|
369 |
-
position: relative;
|
370 |
-
}
|
371 |
-
|
372 |
-
.featurestab_item .handlediv {
|
373 |
-
position: relative;
|
374 |
-
top: -4px;
|
375 |
-
}
|
376 |
-
|
377 |
-
.featurestab_item h3 {
|
378 |
-
min-height: 21px
|
379 |
-
}
|
380 |
-
|
381 |
-
.featurestab_item .inside {
|
382 |
-
padding: 10px !important;
|
383 |
-
}
|
384 |
-
|
385 |
-
.featurestab_item .deps {
|
386 |
-
display: none;
|
387 |
-
}
|
388 |
-
|
389 |
-
.featurestab_item .addoptions p.option {
|
390 |
-
margin: 5px 0 5px 200px
|
391 |
-
}
|
392 |
-
|
393 |
-
.featurestab_item .addoptions p label {
|
394 |
-
width: 80px !important;
|
395 |
-
}
|
396 |
-
|
397 |
-
.featurestab_item .add-field-option {
|
398 |
-
margin-bottom: 10px !important;
|
399 |
-
}
|
400 |
-
|
401 |
-
.messages-panel.updated {
|
402 |
-
margin: 10px 0px 10px !important;
|
403 |
-
max-width: 1200px;
|
404 |
-
border-radius: 5px;
|
405 |
-
-webkit-box-sizing: border-box;
|
406 |
-
box-sizing: border-box;
|
407 |
-
}
|
408 |
-
|
409 |
-
.ui-widget-overlay {
|
410 |
-
background-image: none !important;
|
411 |
-
}
|
412 |
-
|
413 |
-
.the-metabox .icon_type {
|
414 |
-
width: 30%;
|
415 |
-
float: left;
|
416 |
-
margin-right: 40px
|
417 |
-
}
|
418 |
-
|
419 |
-
#post-type-settings .category-list label {
|
420 |
-
width: 187px;
|
421 |
-
}
|
422 |
-
|
423 |
-
.remove_cat {
|
424 |
-
float: right;
|
425 |
-
text-align: center;
|
426 |
-
display: block;
|
427 |
-
width: 20px;
|
428 |
-
height: 20px;
|
429 |
-
border-radius: 20px;
|
430 |
-
font-weight: bold;
|
431 |
-
font-size: 10px;
|
432 |
-
background: #efefef;
|
433 |
-
text-decoration: none;
|
434 |
-
}
|
435 |
-
|
436 |
-
/* typography */
|
437 |
-
.the-metabox.typography .select_wrapper.font-family {
|
438 |
-
width: 200px;
|
439 |
-
}
|
440 |
-
|
441 |
-
.the-metabox.typography .spinner_container {
|
442 |
-
float: left;
|
443 |
-
margin-right: 10px;
|
444 |
-
}
|
445 |
-
|
446 |
-
.the-metabox.typography .spinner_container input.number {
|
447 |
-
width: 50px !important;
|
448 |
-
-webkit-border-top-right-radius: 0px;
|
449 |
-
-webkit-border-bottom-right-radius: 0px;
|
450 |
-
-moz-border-radius-topright: 0px;
|
451 |
-
-moz-border-radius-bottomright: 0px;
|
452 |
-
border-top-right-radius: 0px;
|
453 |
-
border-bottom-right-radius: 0px;
|
454 |
-
}
|
455 |
-
|
456 |
-
/* number */
|
457 |
-
.the-metabox.number input.number {
|
458 |
-
width: 50px !important;
|
459 |
-
}
|
460 |
-
|
461 |
-
/* number */
|
462 |
-
.rm_number .number {
|
463 |
-
width: 70px;
|
464 |
-
text-align: right;
|
465 |
-
-webkit-border-top-right-radius: 0px;
|
466 |
-
-webkit-border-bottom-right-radius: 0px;
|
467 |
-
-moz-border-radius-topright: 0px;
|
468 |
-
-moz-border-radius-bottomright: 0px;
|
469 |
-
border-top-right-radius: 0px;
|
470 |
-
border-bottom-right-radius: 0px;
|
471 |
-
}
|
472 |
-
|
473 |
-
.spinner-wrapper {
|
474 |
-
position: relative;
|
475 |
-
height: 23px;
|
476 |
-
overflow: hidden;
|
477 |
-
}
|
478 |
-
|
479 |
-
.spinner-wrapper input.number {
|
480 |
-
float: left;
|
481 |
-
}
|
482 |
-
|
483 |
-
.spinner-wrapper .spinner-button {
|
484 |
-
cursor: pointer;
|
485 |
-
float: left;
|
486 |
-
position: absolute;
|
487 |
-
left: 69px;
|
488 |
-
width: 15px;
|
489 |
-
height: 12px;
|
490 |
-
border: 1px solid #dfdfdf;
|
491 |
-
background: #fff;
|
492 |
-
margin: 0;
|
493 |
-
padding: 0;
|
494 |
-
line-height: 9999px;
|
495 |
-
overflow: hidden;
|
496 |
-
background: url('../images/spinner.png') no-repeat center -11px
|
497 |
-
}
|
498 |
-
|
499 |
-
.spinner-wrapper .spinner-button.button-plus {
|
500 |
-
top: 0;
|
501 |
-
-webkit-border-top-right-radius: 3px !important;
|
502 |
-
-moz-border-radius-topright: 3px !important;
|
503 |
-
border-top-right-radius: 3px !important;
|
504 |
-
}
|
505 |
-
|
506 |
-
.spinner-wrapper .spinner-button.button-minus {
|
507 |
-
bottom: 0;
|
508 |
-
background-position: center -30px;
|
509 |
-
-webkit-border-bottom-right-radius: 3px !important;
|
510 |
-
-moz-border-radius-bottomright: 3px !important;
|
511 |
-
border-bottom-right-radius: 3px !important;
|
512 |
-
}
|
513 |
-
|
514 |
-
.spinner-wrapper .spinner-button.button-plus:active {
|
515 |
-
background-position: center 0px;
|
516 |
-
}
|
517 |
-
|
518 |
-
.spinner-wrapper .spinner-button.button-minus:active {
|
519 |
-
background-position: center -20px;
|
520 |
-
}
|
521 |
-
|
522 |
-
.rm_typography .spinner_container {
|
523 |
-
float: left;
|
524 |
-
margin-right: 10px;
|
525 |
-
}
|
526 |
-
|
527 |
-
.rm_typography .spinner-wrapper {
|
528 |
-
height: 28px;
|
529 |
-
}
|
530 |
-
|
531 |
-
.rm_typography .spinner-wrapper input.number {
|
532 |
-
height: 28px;
|
533 |
-
}
|
534 |
-
|
535 |
-
.rm_typography .spinner-wrapper .spinner-button.button-plus {
|
536 |
-
height: 15px;
|
537 |
-
background-position: center -10px;
|
538 |
-
}
|
539 |
-
|
540 |
-
.rm_typography .spinner-wrapper .spinner-button.button-minus {
|
541 |
-
height: 14px;
|
542 |
-
}
|
543 |
-
|
544 |
-
.the-metabox .spinner-wrapper .spinner-button {
|
545 |
-
left: 49px;
|
546 |
-
}
|
547 |
-
|
548 |
-
.the-metabox.typography .spinner-wrapper .spinner-button {
|
549 |
-
left: 35px;
|
550 |
-
}
|
551 |
-
|
552 |
-
/* images */
|
553 |
-
.the-metabox.images, .the-metabox.images label {
|
554 |
-
margin-left: 0;
|
555 |
-
display: block;
|
556 |
-
}
|
557 |
-
|
558 |
-
.the-metabox.images .slides-wrapper {
|
559 |
-
clear: both;
|
560 |
-
}
|
561 |
-
|
562 |
-
.the-metabox.images .slides-wrapper li {
|
563 |
-
position: relative;
|
564 |
-
}
|
565 |
-
|
566 |
-
.the-metabox.images a.delete {
|
567 |
-
display: block;
|
568 |
-
margin-left: 4px;
|
569 |
-
text-decoration: none;
|
570 |
-
font-weight: bold;
|
571 |
-
color: red;
|
572 |
-
position: absolute;
|
573 |
-
top: 0;
|
574 |
-
right: 0;
|
575 |
-
width: 10px;
|
576 |
-
height: 18px;
|
577 |
-
z-index: 10;
|
578 |
-
cursor: pointer !important;
|
579 |
-
}
|
580 |
-
|
581 |
-
/* wp editor */
|
582 |
-
.wp_themeSkin iframe {
|
583 |
-
background: #fff !important;
|
584 |
-
}
|
585 |
-
|
586 |
-
/* custom tabs */
|
587 |
-
.customtab_item {
|
588 |
-
border-style: solid;
|
589 |
-
border-width: 1px;
|
590 |
-
line-height: 1;
|
591 |
-
margin-bottom: 20px;
|
592 |
-
padding: 0;
|
593 |
-
background-color: #f5f5f5;
|
594 |
-
background-image: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5);
|
595 |
-
border-color: #dfdfdf;
|
596 |
-
border-radius: 3px 3px 3px 3px;
|
597 |
-
box-shadow: 0 1px 0 #fff inset;
|
598 |
-
min-width: 255px;
|
599 |
-
position: relative;
|
600 |
-
}
|
601 |
-
|
602 |
-
.customtab_item .handlediv {
|
603 |
-
position: relative;
|
604 |
-
top: -4px;
|
605 |
-
}
|
606 |
-
|
607 |
-
.customtab_item h3 {
|
608 |
-
min-height: 21px
|
609 |
-
}
|
610 |
-
|
611 |
-
.customtab_item .inside {
|
612 |
-
padding: 10px !important;
|
613 |
-
}
|
614 |
-
|
615 |
-
.customtab_item .deps {
|
616 |
-
display: none;
|
617 |
-
}
|
618 |
-
|
619 |
-
.customtab_item .addoptions p.option {
|
620 |
-
margin: 5px 0 5px 200px
|
621 |
-
}
|
622 |
-
|
623 |
-
.customtab_item .addoptions p label {
|
624 |
-
width: 80px !important;
|
625 |
-
}
|
626 |
-
|
627 |
-
.customtab_item .add-field-option {
|
628 |
-
margin-bottom: 10px !important;
|
629 |
-
}
|
630 |
-
|
631 |
-
.customtab_item .remove_item {
|
632 |
-
float: right;
|
633 |
-
}
|
634 |
-
|
635 |
-
.metabox-sortable-placeholder {
|
636 |
-
border: 1px dotted #dedede;
|
637 |
-
margin: 10px 0
|
638 |
-
}
|
639 |
-
|
640 |
-
.the-metabox.customtabs {
|
641 |
-
margin-left: 0;
|
642 |
-
}
|
643 |
-
|
644 |
-
#customtab_item_sample {
|
645 |
-
display: none;
|
646 |
-
}
|
647 |
-
|
648 |
-
.the-metabox.customtabs .field-row {
|
649 |
-
margin-bottom: 10px;
|
650 |
-
}
|
651 |
-
|
652 |
-
#yit_custom_tabs label {
|
653 |
-
font-weight: normal;
|
654 |
-
width: auto;
|
655 |
-
float: none;
|
656 |
-
line-height: auto;
|
657 |
-
margin-left: 0;
|
658 |
-
}
|
659 |
-
|
660 |
-
.wp-admin p label input[type=radio] {
|
661 |
-
width: 16px;
|
662 |
-
margin-right: 10px;
|
663 |
-
margin-top: 3px;
|
664 |
-
}
|
665 |
-
|
666 |
-
.wp-admin .form-field._preset_onsale_icon_field label input[type=radio] {
|
667 |
-
margin-top: 0;
|
668 |
-
}
|
669 |
-
|
670 |
-
.the-metabox .spinner {
|
671 |
-
margin-top: 5px;
|
672 |
-
float: none;
|
673 |
-
}
|
674 |
-
|
675 |
-
/*sidebars*/
|
676 |
-
#choose-sidebars.choose {
|
677 |
-
margin-left: 0px;
|
678 |
-
}
|
679 |
-
|
680 |
-
#_active_page_options-container label, #_active_page_options-container p {
|
681 |
-
display: inline-block;
|
682 |
-
margin: 0px;
|
683 |
-
}
|
684 |
-
|
685 |
-
#_active_page_options-container label {
|
686 |
-
margin-right: 10px;
|
687 |
-
margin-top: 3px;
|
688 |
-
}
|
689 |
-
|
690 |
-
#_active_page_options-container {
|
691 |
-
float: right;
|
692 |
-
margin-right: 20px;
|
693 |
-
margin-top: 5px;
|
694 |
-
z-index: 9999 !important;
|
695 |
-
position: absolute;
|
696 |
-
right: 0;
|
697 |
-
}
|
698 |
-
|
699 |
-
/*-----------------------
|
700 |
-
* Colorpicker - fix issues in combination with third-party themes or plugin (Basel, VC Addons, ...)
|
701 |
-
*/
|
702 |
-
.metaboxes-tab .the-metabox.colorpicker {
|
703 |
-
display: block;
|
704 |
-
width: auto;
|
705 |
-
height: auto;
|
706 |
-
overflow: visible;
|
707 |
-
top: auto;
|
708 |
-
left: auto;
|
709 |
-
background: transparent;
|
710 |
-
position: static;
|
711 |
-
z-index: 1;
|
712 |
-
font-family: inherit;
|
713 |
-
}
|
714 |
-
|
715 |
-
.the-metabox.checkbox.checkboxgroup-start.clearfix {
|
716 |
-
margin: 40px 0 0 264px;
|
717 |
-
}
|
718 |
-
|
719 |
-
.the-metabox.checkbox.checkboxgroup.clearfix {
|
720 |
-
margin: 0 0 0 264px;
|
721 |
}
|
1 |
+
/* self-clear floats */
|
2 |
+
.clearfix:after {
|
3 |
+
content: ".";
|
4 |
+
display: block;
|
5 |
+
height: 0;
|
6 |
+
clear: both;
|
7 |
+
visibility: hidden;
|
8 |
+
overflow: hidden;
|
9 |
+
}
|
10 |
+
|
11 |
+
/* ie.css */
|
12 |
+
* html .clearfix { /* IE6 */
|
13 |
+
height: 1%;
|
14 |
+
}
|
15 |
+
|
16 |
+
*:first-child + html .clearfix { /* IE7 */
|
17 |
+
min-height: 1%;
|
18 |
+
}
|
19 |
+
|
20 |
+
.clearboth {
|
21 |
+
clear: both
|
22 |
+
}
|
23 |
+
|
24 |
+
/* === TAB STYLE */
|
25 |
+
.metaboxes-tab {
|
26 |
+
margin: -6px -12px -8px;
|
27 |
+
}
|
28 |
+
|
29 |
+
.metaboxes-tab div.tabs-panel {
|
30 |
+
height: auto;
|
31 |
+
overflow: visible;
|
32 |
+
margin-top: 0px;
|
33 |
+
padding: 0 10px;
|
34 |
+
background: none;
|
35 |
+
border: 0;
|
36 |
+
}
|
37 |
+
|
38 |
+
.metaboxes-tab ul.metaboxes-tabs {
|
39 |
+
background: #f1f1f1;
|
40 |
+
margin: 0;
|
41 |
+
padding: 10px 0 0 5px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.metaboxes-tab ul.metaboxes-tabs li {
|
45 |
+
float: left;
|
46 |
+
background: #dedede;
|
47 |
+
margin: 0 0 0 5px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.metaboxes-tab ul.metaboxes-tabs li a {
|
51 |
+
color: #555;
|
52 |
+
text-decoration: none;
|
53 |
+
padding: 8px 15px;
|
54 |
+
display: block;
|
55 |
+
box-shadow: none !important;
|
56 |
+
}
|
57 |
+
|
58 |
+
.metaboxes-tab ul.metaboxes-tabs li.tabs {
|
59 |
+
background: #fff;
|
60 |
+
}
|
61 |
+
|
62 |
+
.metaboxes-tab p.field-row {
|
63 |
+
margin: 20px 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
.metaboxes-tab div.sep {
|
67 |
+
height: 1px;
|
68 |
+
background: #dfdfdf;
|
69 |
+
clear: both;
|
70 |
+
margin-left: -10px;
|
71 |
+
margin-right: -10px;
|
72 |
+
}
|
73 |
+
|
74 |
+
.metaboxes-tab label {
|
75 |
+
font-weight: bold;
|
76 |
+
width: 160px;
|
77 |
+
float: left;
|
78 |
+
line-height: 23px;
|
79 |
+
margin-left: -184px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.metaboxes-tab label small {
|
83 |
+
font-weight: normal;
|
84 |
+
line-height: 15px;
|
85 |
+
font-style: italic;
|
86 |
+
color: #999;
|
87 |
+
display: block;
|
88 |
+
}
|
89 |
+
|
90 |
+
.metaboxes-tab .yith-plugin-fw-radio__row {
|
91 |
+
width: 100%;
|
92 |
+
min-height: 20px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.metaboxes-tab .yith-plugin-fw-radio__row label,
|
96 |
+
.metaboxes-tab .yith-toggle-elements label,
|
97 |
+
.metaboxes-tab .yith-add-box label {
|
98 |
+
margin-left: 0;
|
99 |
+
font-weight: normal;
|
100 |
+
}
|
101 |
+
|
102 |
+
.metaboxes-tab.yith-plugin-ui h3 {
|
103 |
+
color: #2a8db0;
|
104 |
+
font-size: 15px;
|
105 |
+
text-transform: uppercase;
|
106 |
+
background-color: #fff;
|
107 |
+
padding: 35px 20px;
|
108 |
+
margin: 0px 0 0 -4px;
|
109 |
+
width: auto;
|
110 |
+
background: transparent;
|
111 |
+
}
|
112 |
+
|
113 |
+
.metaboxes-tab.yith-plugin-ui .yith-add-box,
|
114 |
+
.metaboxes-tab.yith-plugin-ui .yith-toggle-row {
|
115 |
+
width: auto;
|
116 |
+
}
|
117 |
+
|
118 |
+
.metaboxes-tab .wp-picker-container label {
|
119 |
+
font-weight: inherit;
|
120 |
+
width: auto;
|
121 |
+
float: none;
|
122 |
+
line-height: inherit;
|
123 |
+
margin-left: 0;
|
124 |
+
}
|
125 |
+
|
126 |
+
.metaboxes-tab.yith-plugin-ui .yith-plugin-fw-radio__row label {
|
127 |
+
width: auto !important;
|
128 |
+
display: inline-block;
|
129 |
+
font-weight: normal;
|
130 |
+
}
|
131 |
+
|
132 |
+
.metaboxes-tab input[type="checkbox"] {
|
133 |
+
vertical-align: middle
|
134 |
+
}
|
135 |
+
|
136 |
+
.metaboxes-tab input.button-secondary, .metaboxes-tab input.checkbox {
|
137 |
+
width: auto;
|
138 |
+
}
|
139 |
+
|
140 |
+
.metaboxes-tab p.field-row.textarea .description {
|
141 |
+
vertical-align: top;
|
142 |
+
}
|
143 |
+
|
144 |
+
.metaboxes-tab p.field-row.checkbox {
|
145 |
+
background: none;
|
146 |
+
}
|
147 |
+
|
148 |
+
.metaboxes-tab .the-metabox {
|
149 |
+
margin: 20px 0;
|
150 |
+
margin-left: 184px;
|
151 |
+
}
|
152 |
+
|
153 |
+
.metaboxes-tab .the-metabox.no-label {
|
154 |
+
margin: 20px 0;
|
155 |
+
margin-left: 0;
|
156 |
+
}
|
157 |
+
|
158 |
+
.metaboxes-tab hr {
|
159 |
+
height: 0px;
|
160 |
+
border-top: 1px solid #dadada;
|
161 |
+
width: auto;
|
162 |
+
margin-left: -10px;
|
163 |
+
margin-right: -10px;
|
164 |
+
}
|
165 |
+
|
166 |
+
.metaboxes-tab .the-metabox p {
|
167 |
+
margin: 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
.metaboxes-tab .the-metabox:last-child {
|
171 |
+
border-bottom: 0px;
|
172 |
+
}
|
173 |
+
|
174 |
+
.metaboxes-tab .the-metabox.checkbox {
|
175 |
+
background: none;
|
176 |
+
}
|
177 |
+
|
178 |
+
.metaboxes-tab span.description.inline {
|
179 |
+
display: inline-block;
|
180 |
+
line-height: 23px;
|
181 |
+
width: auto;
|
182 |
+
vertical-align: middle;
|
183 |
+
margin: 0;
|
184 |
+
}
|
185 |
+
|
186 |
+
.metaboxes-tab .slider label {
|
187 |
+
padding: 15px 0;
|
188 |
+
}
|
189 |
+
|
190 |
+
/* sortable table posts */
|
191 |
+
|
192 |
+
#the-list.ui-sortable tr:hover {
|
193 |
+
cursor: move;
|
194 |
+
}
|
195 |
+
|
196 |
+
.the-metabox.preview {
|
197 |
+
float: none;
|
198 |
+
}
|
199 |
+
|
200 |
+
.metaboxes-tab .the-metabox.no-label.preview {
|
201 |
+
margin-left: 184px;
|
202 |
+
}
|
203 |
+
|
204 |
+
.metaboxes-tab .the-metabox.no-label.preview img {
|
205 |
+
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
|
206 |
+
}
|
207 |
+
|
208 |
+
/**************************************
|
209 |
+
FIELDS
|
210 |
+
***************************************/
|
211 |
+
|
212 |
+
.metaboxes-tab select,
|
213 |
+
.metaboxes-tab input[type=text],
|
214 |
+
.metaboxes-tab input[type=number],
|
215 |
+
.metaboxes-tab textarea,
|
216 |
+
.metaboxes-tab .yith-plugin-fw-select,
|
217 |
+
.metaboxes-tab .yith-plugin-fw-slider-container,
|
218 |
+
.metaboxes-tab .yith-plugin-fw-text-input,
|
219 |
+
.metaboxes-tab .yith-plugin-fw-text-array-table,
|
220 |
+
.metaboxes-tab .yith-plugin-fw-textarea {
|
221 |
+
width: 400px;
|
222 |
+
max-width: 100%;
|
223 |
+
}
|
224 |
+
|
225 |
+
.metaboxes-tab.yith-plugin-ui input[type=number] {
|
226 |
+
width: auto;
|
227 |
+
min-width: 90px;
|
228 |
+
}
|
229 |
+
|
230 |
+
.metaboxes-tab.yith-plugin-ui p {
|
231 |
+
font-size: 14px;
|
232 |
+
}
|
233 |
+
|
234 |
+
.metaboxes-tab.yith-plugin-ui p.section-description {
|
235 |
+
|
236 |
+
margin: 0 20px 40px 18px;
|
237 |
+
}
|
238 |
+
|
239 |
+
.metaboxes-tab .yith-plugin-fw-text-array-table input[type=text] {
|
240 |
+
width: 100%;
|
241 |
+
}
|
242 |
+
|
243 |
+
.metaboxes-tab.yith-plugin-ui .yith-add-box h3 {
|
244 |
+
padding: 0 0 30px 0;
|
245 |
+
font-weight: 600;
|
246 |
+
margin: 0;
|
247 |
+
}
|
248 |
+
|
249 |
+
.metaboxes-tab.yith-plugin-ui .select2-container--default .select2-selection--single {
|
250 |
+
border: 0;
|
251 |
+
margin: 0;
|
252 |
+
}
|
253 |
+
|
254 |
+
/* wp editor */
|
255 |
+
.the-metabox.textarea-editor .mceIframeContainer {
|
256 |
+
background: #fff;
|
257 |
+
}
|
258 |
+
|
259 |
+
|
260 |
+
.the-metabox.textarea-editor label {
|
261 |
+
margin-top: 24px;
|
262 |
+
}
|
263 |
+
|
264 |
+
/* categories */
|
265 |
+
.categories-panel {
|
266 |
+
width: 30%;
|
267 |
+
float: left;
|
268 |
+
margin-right: 4px;
|
269 |
+
}
|
270 |
+
|
271 |
+
.categories-panel .box {
|
272 |
+
height: 200px;
|
273 |
+
border: 1px solid #dfdfdf;
|
274 |
+
background: #fff;
|
275 |
+
padding: 6px 10px;
|
276 |
+
overflow: auto;
|
277 |
+
}
|
278 |
+
|
279 |
+
.categories-panel ul {
|
280 |
+
list-style: none;
|
281 |
+
margin: 0;
|
282 |
+
}
|
283 |
+
|
284 |
+
.categories-panel ul li {
|
285 |
+
line-height: 19px;
|
286 |
+
margin: 0;
|
287 |
+
padding: 0;
|
288 |
+
word-wrap: break-word;
|
289 |
+
}
|
290 |
+
|
291 |
+
.categories-panel ul li label {
|
292 |
+
font-weight: normal !important;
|
293 |
+
margin-left: 0 !important;
|
294 |
+
}
|
295 |
+
|
296 |
+
.categories-panel input.newcategory {
|
297 |
+
width: 100%;
|
298 |
+
margin-bottom: 3px;
|
299 |
+
}
|
300 |
+
|
301 |
+
/* contact form */
|
302 |
+
.contactform_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 #fff inset;
|
313 |
+
min-width: 255px;
|
314 |
+
position: relative;
|
315 |
+
}
|
316 |
+
|
317 |
+
.contactform_item .handlediv {
|
318 |
+
position: relative;
|
319 |
+
top: -4px;
|
320 |
+
}
|
321 |
+
|
322 |
+
.contactform_item h3 {
|
323 |
+
min-height: 21px;
|
324 |
+
margin: 13px;
|
325 |
+
}
|
326 |
+
|
327 |
+
.contactform_item .inside {
|
328 |
+
padding: 10px !important;
|
329 |
+
}
|
330 |
+
|
331 |
+
.contactform_item .deps {
|
332 |
+
display: none;
|
333 |
+
}
|
334 |
+
|
335 |
+
.contactform_item .addoptions p.option {
|
336 |
+
margin: 5px 0 5px 200px
|
337 |
+
}
|
338 |
+
|
339 |
+
.contactform_item .addoptions p label {
|
340 |
+
width: 80px !important;
|
341 |
+
}
|
342 |
+
|
343 |
+
.contactform_item .add-field-option {
|
344 |
+
margin-bottom: 10px !important;
|
345 |
+
}
|
346 |
+
|
347 |
+
.remove_item {
|
348 |
+
float: right;
|
349 |
+
}
|
350 |
+
|
351 |
+
.metabox-sortable-placeholder {
|
352 |
+
border: 1px dotted #dedede;
|
353 |
+
margin: 10px 0
|
354 |
+
}
|
355 |
+
|
356 |
+
/* features tab */
|
357 |
+
.featurestab_item {
|
358 |
+
border-style: solid;
|
359 |
+
border-width: 1px;
|
360 |
+
line-height: 1;
|
361 |
+
margin-bottom: 20px;
|
362 |
+
padding: 0;
|
363 |
+
background-color: #f5f5f5;
|
364 |
+
background-image: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5);
|
365 |
+
border-color: #dfdfdf;
|
366 |
+
border-radius: 3px 3px 3px 3px;
|
367 |
+
box-shadow: 0 1px 0 #fff inset;
|
368 |
+
min-width: 255px;
|
369 |
+
position: relative;
|
370 |
+
}
|
371 |
+
|
372 |
+
.featurestab_item .handlediv {
|
373 |
+
position: relative;
|
374 |
+
top: -4px;
|
375 |
+
}
|
376 |
+
|
377 |
+
.featurestab_item h3 {
|
378 |
+
min-height: 21px
|
379 |
+
}
|
380 |
+
|
381 |
+
.featurestab_item .inside {
|
382 |
+
padding: 10px !important;
|
383 |
+
}
|
384 |
+
|
385 |
+
.featurestab_item .deps {
|
386 |
+
display: none;
|
387 |
+
}
|
388 |
+
|
389 |
+
.featurestab_item .addoptions p.option {
|
390 |
+
margin: 5px 0 5px 200px
|
391 |
+
}
|
392 |
+
|
393 |
+
.featurestab_item .addoptions p label {
|
394 |
+
width: 80px !important;
|
395 |
+
}
|
396 |
+
|
397 |
+
.featurestab_item .add-field-option {
|
398 |
+
margin-bottom: 10px !important;
|
399 |
+
}
|
400 |
+
|
401 |
+
.messages-panel.updated {
|
402 |
+
margin: 10px 0px 10px !important;
|
403 |
+
max-width: 1200px;
|
404 |
+
border-radius: 5px;
|
405 |
+
-webkit-box-sizing: border-box;
|
406 |
+
box-sizing: border-box;
|
407 |
+
}
|
408 |
+
|
409 |
+
.ui-widget-overlay {
|
410 |
+
background-image: none !important;
|
411 |
+
}
|
412 |
+
|
413 |
+
.the-metabox .icon_type {
|
414 |
+
width: 30%;
|
415 |
+
float: left;
|
416 |
+
margin-right: 40px
|
417 |
+
}
|
418 |
+
|
419 |
+
#post-type-settings .category-list label {
|
420 |
+
width: 187px;
|
421 |
+
}
|
422 |
+
|
423 |
+
.remove_cat {
|
424 |
+
float: right;
|
425 |
+
text-align: center;
|
426 |
+
display: block;
|
427 |
+
width: 20px;
|
428 |
+
height: 20px;
|
429 |
+
border-radius: 20px;
|
430 |
+
font-weight: bold;
|
431 |
+
font-size: 10px;
|
432 |
+
background: #efefef;
|
433 |
+
text-decoration: none;
|
434 |
+
}
|
435 |
+
|
436 |
+
/* typography */
|
437 |
+
.the-metabox.typography .select_wrapper.font-family {
|
438 |
+
width: 200px;
|
439 |
+
}
|
440 |
+
|
441 |
+
.the-metabox.typography .spinner_container {
|
442 |
+
float: left;
|
443 |
+
margin-right: 10px;
|
444 |
+
}
|
445 |
+
|
446 |
+
.the-metabox.typography .spinner_container input.number {
|
447 |
+
width: 50px !important;
|
448 |
+
-webkit-border-top-right-radius: 0px;
|
449 |
+
-webkit-border-bottom-right-radius: 0px;
|
450 |
+
-moz-border-radius-topright: 0px;
|
451 |
+
-moz-border-radius-bottomright: 0px;
|
452 |
+
border-top-right-radius: 0px;
|
453 |
+
border-bottom-right-radius: 0px;
|
454 |
+
}
|
455 |
+
|
456 |
+
/* number */
|
457 |
+
.the-metabox.number input.number {
|
458 |
+
width: 50px !important;
|
459 |
+
}
|
460 |
+
|
461 |
+
/* number */
|
462 |
+
.rm_number .number {
|
463 |
+
width: 70px;
|
464 |
+
text-align: right;
|
465 |
+
-webkit-border-top-right-radius: 0px;
|
466 |
+
-webkit-border-bottom-right-radius: 0px;
|
467 |
+
-moz-border-radius-topright: 0px;
|
468 |
+
-moz-border-radius-bottomright: 0px;
|
469 |
+
border-top-right-radius: 0px;
|
470 |
+
border-bottom-right-radius: 0px;
|
471 |
+
}
|
472 |
+
|
473 |
+
.spinner-wrapper {
|
474 |
+
position: relative;
|
475 |
+
height: 23px;
|
476 |
+
overflow: hidden;
|
477 |
+
}
|
478 |
+
|
479 |
+
.spinner-wrapper input.number {
|
480 |
+
float: left;
|
481 |
+
}
|
482 |
+
|
483 |
+
.spinner-wrapper .spinner-button {
|
484 |
+
cursor: pointer;
|
485 |
+
float: left;
|
486 |
+
position: absolute;
|
487 |
+
left: 69px;
|
488 |
+
width: 15px;
|
489 |
+
height: 12px;
|
490 |
+
border: 1px solid #dfdfdf;
|
491 |
+
background: #fff;
|
492 |
+
margin: 0;
|
493 |
+
padding: 0;
|
494 |
+
line-height: 9999px;
|
495 |
+
overflow: hidden;
|
496 |
+
background: url('../images/spinner.png') no-repeat center -11px
|
497 |
+
}
|
498 |
+
|
499 |
+
.spinner-wrapper .spinner-button.button-plus {
|
500 |
+
top: 0;
|
501 |
+
-webkit-border-top-right-radius: 3px !important;
|
502 |
+
-moz-border-radius-topright: 3px !important;
|
503 |
+
border-top-right-radius: 3px !important;
|
504 |
+
}
|
505 |
+
|
506 |
+
.spinner-wrapper .spinner-button.button-minus {
|
507 |
+
bottom: 0;
|
508 |
+
background-position: center -30px;
|
509 |
+
-webkit-border-bottom-right-radius: 3px !important;
|
510 |
+
-moz-border-radius-bottomright: 3px !important;
|
511 |
+
border-bottom-right-radius: 3px !important;
|
512 |
+
}
|
513 |
+
|
514 |
+
.spinner-wrapper .spinner-button.button-plus:active {
|
515 |
+
background-position: center 0px;
|
516 |
+
}
|
517 |
+
|
518 |
+
.spinner-wrapper .spinner-button.button-minus:active {
|
519 |
+
background-position: center -20px;
|
520 |
+
}
|
521 |
+
|
522 |
+
.rm_typography .spinner_container {
|
523 |
+
float: left;
|
524 |
+
margin-right: 10px;
|
525 |
+
}
|
526 |
+
|
527 |
+
.rm_typography .spinner-wrapper {
|
528 |
+
height: 28px;
|
529 |
+
}
|
530 |
+
|
531 |
+
.rm_typography .spinner-wrapper input.number {
|
532 |
+
height: 28px;
|
533 |
+
}
|
534 |
+
|
535 |
+
.rm_typography .spinner-wrapper .spinner-button.button-plus {
|
536 |
+
height: 15px;
|
537 |
+
background-position: center -10px;
|
538 |
+
}
|
539 |
+
|
540 |
+
.rm_typography .spinner-wrapper .spinner-button.button-minus {
|
541 |
+
height: 14px;
|
542 |
+
}
|
543 |
+
|
544 |
+
.the-metabox .spinner-wrapper .spinner-button {
|
545 |
+
left: 49px;
|
546 |
+
}
|
547 |
+
|
548 |
+
.the-metabox.typography .spinner-wrapper .spinner-button {
|
549 |
+
left: 35px;
|
550 |
+
}
|
551 |
+
|
552 |
+
/* images */
|
553 |
+
.the-metabox.images, .the-metabox.images label {
|
554 |
+
margin-left: 0;
|
555 |
+
display: block;
|
556 |
+
}
|
557 |
+
|
558 |
+
.the-metabox.images .slides-wrapper {
|
559 |
+
clear: both;
|
560 |
+
}
|
561 |
+
|
562 |
+
.the-metabox.images .slides-wrapper li {
|
563 |
+
position: relative;
|
564 |
+
}
|
565 |
+
|
566 |
+
.the-metabox.images a.delete {
|
567 |
+
display: block;
|
568 |
+
margin-left: 4px;
|
569 |
+
text-decoration: none;
|
570 |
+
font-weight: bold;
|
571 |
+
color: red;
|
572 |
+
position: absolute;
|
573 |
+
top: 0;
|
574 |
+
right: 0;
|
575 |
+
width: 10px;
|
576 |
+
height: 18px;
|
577 |
+
z-index: 10;
|
578 |
+
cursor: pointer !important;
|
579 |
+
}
|
580 |
+
|
581 |
+
/* wp editor */
|
582 |
+
.wp_themeSkin iframe {
|
583 |
+
background: #fff !important;
|
584 |
+
}
|
585 |
+
|
586 |
+
/* custom tabs */
|
587 |
+
.customtab_item {
|
588 |
+
border-style: solid;
|
589 |
+
border-width: 1px;
|
590 |
+
line-height: 1;
|
591 |
+
margin-bottom: 20px;
|
592 |
+
padding: 0;
|
593 |
+
background-color: #f5f5f5;
|
594 |
+
background-image: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5);
|
595 |
+
border-color: #dfdfdf;
|
596 |
+
border-radius: 3px 3px 3px 3px;
|
597 |
+
box-shadow: 0 1px 0 #fff inset;
|
598 |
+
min-width: 255px;
|
599 |
+
position: relative;
|
600 |
+
}
|
601 |
+
|
602 |
+
.customtab_item .handlediv {
|
603 |
+
position: relative;
|
604 |
+
top: -4px;
|
605 |
+
}
|
606 |
+
|
607 |
+
.customtab_item h3 {
|
608 |
+
min-height: 21px
|
609 |
+
}
|
610 |
+
|
611 |
+
.customtab_item .inside {
|
612 |
+
padding: 10px !important;
|
613 |
+
}
|
614 |
+
|
615 |
+
.customtab_item .deps {
|
616 |
+
display: none;
|
617 |
+
}
|
618 |
+
|
619 |
+
.customtab_item .addoptions p.option {
|
620 |
+
margin: 5px 0 5px 200px
|
621 |
+
}
|
622 |
+
|
623 |
+
.customtab_item .addoptions p label {
|
624 |
+
width: 80px !important;
|
625 |
+
}
|
626 |
+
|
627 |
+
.customtab_item .add-field-option {
|
628 |
+
margin-bottom: 10px !important;
|
629 |
+
}
|
630 |
+
|
631 |
+
.customtab_item .remove_item {
|
632 |
+
float: right;
|
633 |
+
}
|
634 |
+
|
635 |
+
.metabox-sortable-placeholder {
|
636 |
+
border: 1px dotted #dedede;
|
637 |
+
margin: 10px 0
|
638 |
+
}
|
639 |
+
|
640 |
+
.the-metabox.customtabs {
|
641 |
+
margin-left: 0;
|
642 |
+
}
|
643 |
+
|
644 |
+
#customtab_item_sample {
|
645 |
+
display: none;
|
646 |
+
}
|
647 |
+
|
648 |
+
.the-metabox.customtabs .field-row {
|
649 |
+
margin-bottom: 10px;
|
650 |
+
}
|
651 |
+
|
652 |
+
#yit_custom_tabs label {
|
653 |
+
font-weight: normal;
|
654 |
+
width: auto;
|
655 |
+
float: none;
|
656 |
+
line-height: auto;
|
657 |
+
margin-left: 0;
|
658 |
+
}
|
659 |
+
|
660 |
+
.wp-admin p label input[type=radio] {
|
661 |
+
width: 16px;
|
662 |
+
margin-right: 10px;
|
663 |
+
margin-top: 3px;
|
664 |
+
}
|
665 |
+
|
666 |
+
.wp-admin .form-field._preset_onsale_icon_field label input[type=radio] {
|
667 |
+
margin-top: 0;
|
668 |
+
}
|
669 |
+
|
670 |
+
.the-metabox .spinner {
|
671 |
+
margin-top: 5px;
|
672 |
+
float: none;
|
673 |
+
}
|
674 |
+
|
675 |
+
/*sidebars*/
|
676 |
+
#choose-sidebars.choose {
|
677 |
+
margin-left: 0px;
|
678 |
+
}
|
679 |
+
|
680 |
+
#_active_page_options-container label, #_active_page_options-container p {
|
681 |
+
display: inline-block;
|
682 |
+
margin: 0px;
|
683 |
+
}
|
684 |
+
|
685 |
+
#_active_page_options-container label {
|
686 |
+
margin-right: 10px;
|
687 |
+
margin-top: 3px;
|
688 |
+
}
|
689 |
+
|
690 |
+
#_active_page_options-container {
|
691 |
+
float: right;
|
692 |
+
margin-right: 20px;
|
693 |
+
margin-top: 5px;
|
694 |
+
z-index: 9999 !important;
|
695 |
+
position: absolute;
|
696 |
+
right: 0;
|
697 |
+
}
|
698 |
+
|
699 |
+
/*-----------------------
|
700 |
+
* Colorpicker - fix issues in combination with third-party themes or plugin (Basel, VC Addons, ...)
|
701 |
+
*/
|
702 |
+
.metaboxes-tab .the-metabox.colorpicker {
|
703 |
+
display: block;
|
704 |
+
width: auto;
|
705 |
+
height: auto;
|
706 |
+
overflow: visible;
|
707 |
+
top: auto;
|
708 |
+
left: auto;
|
709 |
+
background: transparent;
|
710 |
+
position: static;
|
711 |
+
z-index: 1;
|
712 |
+
font-family: inherit;
|
713 |
+
}
|
714 |
+
|
715 |
+
.the-metabox.checkbox.checkboxgroup-start.clearfix {
|
716 |
+
margin: 40px 0 0 264px;
|
717 |
+
}
|
718 |
+
|
719 |
+
.the-metabox.checkbox.checkboxgroup.clearfix {
|
720 |
+
margin: 0 0 0 264px;
|
721 |
}
|
plugin-fw/assets/css/yit-plugin-panel.css
CHANGED
@@ -1,482 +1,482 @@
|
|
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 |
-
.plugin-option tr {
|
10 |
-
border-bottom : 1px solid #ebebeb;
|
11 |
-
}
|
12 |
-
|
13 |
-
.plugin-option .yit_options,
|
14 |
-
.plugin-option .yit-options {
|
15 |
-
border-bottom : 0px;
|
16 |
-
}
|
17 |
-
|
18 |
-
.plugin-option .yit-options .option,
|
19 |
-
.plugin-option .yit_options .option {
|
20 |
-
width : 600px;
|
21 |
-
}
|
22 |
-
|
23 |
-
.plugin-option .form-table > tbody > tr > td {
|
24 |
-
padding : 25px 15px;
|
25 |
-
}
|
26 |
-
|
27 |
-
.ie8 .yit_options select,
|
28 |
-
.ie8 .yit-options select {
|
29 |
-
height : 26px;
|
30 |
-
}
|
31 |
-
|
32 |
-
/* Style to woocommerce panel*/
|
33 |
-
|
34 |
-
#plugin-fw-wc, #yith-plugin-fw-panel {
|
35 |
-
padding-top : 20px;
|
36 |
-
}
|
37 |
-
|
38 |
-
#plugin-fw-wc table.form-table, #yith-plugin-fw-panel table.form-table {
|
39 |
-
background-color : #fff;
|
40 |
-
margin-bottom : 20px;
|
41 |
-
}
|
42 |
-
|
43 |
-
#plugin-fw-wc table.form-table th, #yith-plugin-fw-panel table.form-table th {
|
44 |
-
padding : 20px;
|
45 |
-
}
|
46 |
-
|
47 |
-
#plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
|
48 |
-
padding : 0 0 0 10px;
|
49 |
-
margin : 0;
|
50 |
-
}
|
51 |
-
|
52 |
-
/* === Plugins Upgrader === */
|
53 |
-
|
54 |
-
.yit-plugin-changelog-wrapper {
|
55 |
-
display : none;
|
56 |
-
}
|
57 |
-
|
58 |
-
.yit-plugin-changelog-title {
|
59 |
-
text-transform : uppercase;
|
60 |
-
}
|
61 |
-
|
62 |
-
.yit-plugin-changelog {
|
63 |
-
height : calc(100% - 15px);
|
64 |
-
width : calc(100% - 15px);
|
65 |
-
overflow-x : hidden;
|
66 |
-
overflow-y : auto;
|
67 |
-
z-index : 999;
|
68 |
-
background : #fcfcfc;
|
69 |
-
}
|
70 |
-
|
71 |
-
/* === Plugins Licence Activation === */
|
72 |
-
|
73 |
-
.yit-container.plugin-licence-activation {
|
74 |
-
font-family : 'Raleway', sans-serif;
|
75 |
-
}
|
76 |
-
|
77 |
-
.yit-container.plugin-licence-activation .to-active-wrapper {
|
78 |
-
margin-bottom : 60px;
|
79 |
-
}
|
80 |
-
|
81 |
-
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form {
|
82 |
-
position : relative;
|
83 |
-
border-color : #e1e1e1;
|
84 |
-
border-style : solid;
|
85 |
-
border-width : 0;
|
86 |
-
}
|
87 |
-
|
88 |
-
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:first-child {
|
89 |
-
border-top-width : 1px;
|
90 |
-
}
|
91 |
-
|
92 |
-
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:last-child {
|
93 |
-
border-bottom-width : 1px;
|
94 |
-
}
|
95 |
-
|
96 |
-
.yit-container.plugin-licence-activation .to-active-wrapper table.to-active-table {
|
97 |
-
border-width : 0;
|
98 |
-
border-spacing : 0;
|
99 |
-
width : 100%;
|
100 |
-
}
|
101 |
-
|
102 |
-
.yit-container.plugin-licence-activation .message {
|
103 |
-
display : none;
|
104 |
-
line-height : normal;
|
105 |
-
background : #fff url(../images/licence-error.png) 15px center no-repeat;
|
106 |
-
padding-left : 65px;
|
107 |
-
padding-right : 15px;
|
108 |
-
width : 150px;
|
109 |
-
}
|
110 |
-
|
111 |
-
.yit-container.plugin-licence-activation .message-wrapper {
|
112 |
-
height : 75px;
|
113 |
-
display : none;
|
114 |
-
position : absolute;
|
115 |
-
top : 0;
|
116 |
-
right : -250px;
|
117 |
-
border : 1px solid #ff3838;
|
118 |
-
}
|
119 |
-
|
120 |
-
.yit-container.plugin-licence-activation .message-wrapper.visible {
|
121 |
-
display : table;
|
122 |
-
}
|
123 |
-
|
124 |
-
.yit-container.plugin-licence-activation .message {
|
125 |
-
display : table-cell;
|
126 |
-
vertical-align : middle;
|
127 |
-
}
|
128 |
-
|
129 |
-
.yit-container.plugin-licence-activation .arrow-left:after,
|
130 |
-
.yit-container.plugin-licence-activation .arrow-left:before {
|
131 |
-
content : "";
|
132 |
-
display : block;
|
133 |
-
width : 0;
|
134 |
-
height : 0;
|
135 |
-
position : absolute;
|
136 |
-
}
|
137 |
-
|
138 |
-
.yit-container.plugin-licence-activation .arrow-left:before {
|
139 |
-
border-top : 9px solid transparent;
|
140 |
-
border-bottom : 9px solid transparent;
|
141 |
-
border-right : 9px solid #ff3838;
|
142 |
-
top : 26px;
|
143 |
-
left : -9px;
|
144 |
-
}
|
145 |
-
|
146 |
-
.yit-container.plugin-licence-activation .arrow-left:after {
|
147 |
-
border-top : 8px solid transparent;
|
148 |
-
border-bottom : 8px solid transparent;
|
149 |
-
border-right : 8px solid #fff;
|
150 |
-
left : -8px;
|
151 |
-
top : 27px;
|
152 |
-
}
|
153 |
-
|
154 |
-
.yit-container.plugin-licence-activation h2,
|
155 |
-
.yit-container.plugin-licence-activation h3 {
|
156 |
-
text-transform : uppercase;
|
157 |
-
font-weight : 800;
|
158 |
-
margin-bottom : 30px;
|
159 |
-
}
|
160 |
-
|
161 |
-
.yit-container.plugin-licence-activation h2 {
|
162 |
-
color : #808a97;
|
163 |
-
font-size : 25px;
|
164 |
-
}
|
165 |
-
|
166 |
-
.yit-container.plugin-licence-activation h3 {
|
167 |
-
color : #313131;
|
168 |
-
font-size : 15px;
|
169 |
-
height : 20px;
|
170 |
-
}
|
171 |
-
|
172 |
-
.yit-container.plugin-licence-activation h3.to-active {
|
173 |
-
height : 20px;
|
174 |
-
position : relative;
|
175 |
-
vertical-align : top;
|
176 |
-
}
|
177 |
-
|
178 |
-
.yit-container.plugin-licence-activation .spinner.show {
|
179 |
-
display : inline-block;
|
180 |
-
vertical-align : middle;
|
181 |
-
float : none;
|
182 |
-
}
|
183 |
-
|
184 |
-
.yit-container.plugin-licence-activation h3.to-active > .spinner.show {
|
185 |
-
display : inline-block;
|
186 |
-
float : none;
|
187 |
-
top : -3px;
|
188 |
-
position : relative;
|
189 |
-
}
|
190 |
-
|
191 |
-
.yit-container.plugin-licence-activation .licence-check-section {
|
192 |
-
margin-bottom : 60px;
|
193 |
-
}
|
194 |
-
|
195 |
-
.yit-container.plugin-licence-activation span.licence-label {
|
196 |
-
font-weight : 500;
|
197 |
-
color : #606060;
|
198 |
-
margin-bottom : 30px;
|
199 |
-
}
|
200 |
-
|
201 |
-
.yit-container.plugin-licence-activation .button-licence {
|
202 |
-
border : 0;
|
203 |
-
font-size : 13px;
|
204 |
-
text-transform : uppercase;
|
205 |
-
background-color : #808a97;
|
206 |
-
color : #fff;
|
207 |
-
font-weight : 700;
|
208 |
-
border-radius : 3px;
|
209 |
-
cursor : pointer;
|
210 |
-
text-decoration : none;
|
211 |
-
padding : 5px 7px;
|
212 |
-
-webkit-transition : background-color 0.3s ease;
|
213 |
-
-moz-transition : background-color 0.3s ease;
|
214 |
-
-ms-transition : background-color 0.3s ease;
|
215 |
-
-o-transition : background-color 0.3s ease;
|
216 |
-
transition : background-color 0.3s ease;
|
217 |
-
}
|
218 |
-
|
219 |
-
.yit-container.plugin-licence-activation .button-licence:hover {
|
220 |
-
background-color : #4d5c6f;
|
221 |
-
}
|
222 |
-
|
223 |
-
.yit-container.plugin-licence-activation .button-licence.clicked {
|
224 |
-
cursor : not-allowed;
|
225 |
-
background-color : #e2e2e2 !important;
|
226 |
-
}
|
227 |
-
|
228 |
-
.yit-container.plugin-licence-activation .button-licence.licence-check {
|
229 |
-
font-weight : 400;
|
230 |
-
padding : 12px 19px;
|
231 |
-
}
|
232 |
-
|
233 |
-
.yit-container.plugin-licence-activation .button-licence.licence-renew {
|
234 |
-
text-decoration : none;
|
235 |
-
padding : 7px 12px;
|
236 |
-
font-size : 9px;
|
237 |
-
}
|
238 |
-
|
239 |
-
.yit-container.plugin-licence-activation .button-licence.licence-renew:focus {
|
240 |
-
box-shadow : none;
|
241 |
-
}
|
242 |
-
|
243 |
-
.yit-container.plugin-licence-activation table:not(.to-active-table) {
|
244 |
-
width : 100%;
|
245 |
-
border : 1px solid #dcdcdc;
|
246 |
-
border-spacing : 0;
|
247 |
-
border-radius : 5px;
|
248 |
-
border-collapse : separate;
|
249 |
-
overflow : hidden;
|
250 |
-
}
|
251 |
-
|
252 |
-
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
253 |
-
border-bottom : 1px solid #dcdcdc;
|
254 |
-
}
|
255 |
-
|
256 |
-
.yit-container.plugin-licence-activation table:not(.to-active-table) td,
|
257 |
-
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
258 |
-
border-right : 1px solid #dcdcdc;
|
259 |
-
}
|
260 |
-
|
261 |
-
.yit-container.plugin-licence-activation table td:last-child,
|
262 |
-
.yit-container.plugin-licence-activation table th:last-child {
|
263 |
-
border-right : 0;
|
264 |
-
}
|
265 |
-
|
266 |
-
.yit-container.plugin-licence-activation table thead tr {
|
267 |
-
background-color : #f6f4f4;
|
268 |
-
}
|
269 |
-
|
270 |
-
.yit-container.plugin-licence-activation table tbody tr {
|
271 |
-
background-color : #fff;
|
272 |
-
}
|
273 |
-
|
274 |
-
.yit-container.plugin-licence-activation table thead tr th {
|
275 |
-
font-size : 13px;
|
276 |
-
color : #313131;
|
277 |
-
text-transform : uppercase;
|
278 |
-
font-weight : bold;
|
279 |
-
}
|
280 |
-
|
281 |
-
.yit-container.plugin-licence-activation table thead tr,
|
282 |
-
.yit-container.plugin-licence-activation table tbody tr {
|
283 |
-
line-height : 60px;
|
284 |
-
}
|
285 |
-
|
286 |
-
.yit-container.plugin-licence-activation table tbody tr td {
|
287 |
-
text-align : center;
|
288 |
-
line-height : 20px;
|
289 |
-
padding : 10px 5px;
|
290 |
-
}
|
291 |
-
|
292 |
-
.yit-container.plugin-licence-activation .button-licence.licence-activation {
|
293 |
-
padding : 12px 18px;
|
294 |
-
}
|
295 |
-
|
296 |
-
.yit-container.plugin-licence-activation .to-active-table tr {
|
297 |
-
line-height : 75px;
|
298 |
-
}
|
299 |
-
|
300 |
-
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row {
|
301 |
-
background-color : transparent;
|
302 |
-
-webkit-transition : all 0.3s ease;
|
303 |
-
-moz-transition : all 0.3s ease;
|
304 |
-
-ms-transition : all 0.3s ease;
|
305 |
-
-o-transition : all 0.3s ease;
|
306 |
-
transition : all 0.3s ease;
|
307 |
-
}
|
308 |
-
|
309 |
-
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row.error {
|
310 |
-
background-color : #ffdcdc;
|
311 |
-
}
|
312 |
-
|
313 |
-
.yit-container.plugin-licence-activation .to-active-table td {
|
314 |
-
padding-right : 12px;
|
315 |
-
width : 33%;
|
316 |
-
}
|
317 |
-
|
318 |
-
.yit-container.plugin-licence-activation .to-active-table td.plugin-name {
|
319 |
-
color : #808a97;
|
320 |
-
font-size : 12px;
|
321 |
-
text-transform : uppercase;
|
322 |
-
font-weight : bold;
|
323 |
-
line-height : 20px;
|
324 |
-
width : 20%;
|
325 |
-
padding-left : 20px;
|
326 |
-
}
|
327 |
-
|
328 |
-
.yit-container.plugin-licence-activation .to-active-table td.activate-button {
|
329 |
-
width : 15%;
|
330 |
-
position : relative;
|
331 |
-
}
|
332 |
-
|
333 |
-
.yit-container.plugin-licence-activation input[type=text],
|
334 |
-
.yit-container.plugin-licence-activation input[type=email] {
|
335 |
-
-webkit-transition : all 0.3s ease;
|
336 |
-
-moz-transition : all 0.3s ease;
|
337 |
-
-ms-transition : all 0.3s ease;
|
338 |
-
-o-transition : all 0.3s ease;
|
339 |
-
transition : all 0.3s ease;
|
340 |
-
|
341 |
-
border : 1px solid #dcdcdc;
|
342 |
-
padding : 0 15px;
|
343 |
-
border-radius : 3px;
|
344 |
-
height : 41px;
|
345 |
-
width : 100%;
|
346 |
-
}
|
347 |
-
|
348 |
-
.yit-container.plugin-licence-activation input[type=text].require,
|
349 |
-
.yit-container.plugin-licence-activation input[type=email].require {
|
350 |
-
border : 1px solid #ff3838;
|
351 |
-
}
|
352 |
-
|
353 |
-
.yit-container.plugin-licence-activation input[type=text]:focus,
|
354 |
-
.yit-container.plugin-licence-activation input[type=email]:focus {
|
355 |
-
webkit-box-shadow : 0 0 1px rgba(30, 140, 190, .8);
|
356 |
-
box-shadow : 0 0 1px rgba(30, 140, 190, .8);
|
357 |
-
}
|
358 |
-
|
359 |
-
.yit-container.plugin-licence-activation input[type=text] {
|
360 |
-
text-transform : uppercase;
|
361 |
-
text-align : center;
|
362 |
-
}
|
363 |
-
|
364 |
-
.yit-container.plugin-licence-activation input[type=email] {
|
365 |
-
text-align : left;
|
366 |
-
}
|
367 |
-
|
368 |
-
.yit-container.plugin-licence-activation input[type=submit]:focus {
|
369 |
-
outline : 0;
|
370 |
-
}
|
371 |
-
|
372 |
-
/* === Woocommerce panel === */
|
373 |
-
#plugin-fw-wc .yit_options {
|
374 |
-
padding : 0;
|
375 |
-
border : 0;
|
376 |
-
}
|
377 |
-
|
378 |
-
#plugin-fw-wc .yit_options input.upload_button, .yit_options input.button {
|
379 |
-
background : none;
|
380 |
-
border : 1px solid #ccc;
|
381 |
-
}
|
382 |
-
|
383 |
-
/* === WP Pointers === */
|
384 |
-
|
385 |
-
#adminmenu li.menu-top.yit-pointer-selected-row,
|
386 |
-
#adminmenu li.menu-top.yit-pointer-selected-row:hover,
|
387 |
-
#adminmenu li.yit-pointer-selected-row a.menu-top {
|
388 |
-
background-color : #acc327;
|
389 |
-
color : #000;
|
390 |
-
}
|
391 |
-
|
392 |
-
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer {
|
393 |
-
color : #000;
|
394 |
-
}
|
395 |
-
|
396 |
-
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer:hover,
|
397 |
-
#adminmenu .wp-submenu a.yit-pointer-selected-row {
|
398 |
-
color : #fff;
|
399 |
-
}
|
400 |
-
|
401 |
-
#adminmenu .wp-submenu a.yit-pointer-selected-row:hover {
|
402 |
-
color : #45bbe6;
|
403 |
-
}
|
404 |
-
|
405 |
-
/* WooCommerce 2.4 Support */
|
406 |
-
.woocommerce table.form-table .colorpick {
|
407 |
-
width : 6em;
|
408 |
-
}
|
409 |
-
|
410 |
-
#wpwrap h2.nav-tab-wrapper, #wpbody-content h2.nav-tab-wrapper {
|
411 |
-
border-bottom : 1px solid #ccc;
|
412 |
-
margin-right: 15px;
|
413 |
-
}
|
414 |
-
|
415 |
-
/* === YIT FRAMEWORK === */
|
416 |
-
.plugin-card .plugin-icon img {
|
417 |
-
max-width : 100%;
|
418 |
-
width : auto;
|
419 |
-
height : auto;
|
420 |
-
}
|
421 |
-
|
422 |
-
/* === Panel Content and Container === */
|
423 |
-
.yit-admin-panel-container {
|
424 |
-
position : relative;
|
425 |
-
margin-right: 15px;
|
426 |
-
}
|
427 |
-
|
428 |
-
.yit-admin-panel-content-wrap {
|
429 |
-
width : 100%;
|
430 |
-
display : block;
|
431 |
-
}
|
432 |
-
|
433 |
-
.yith-disabled {
|
434 |
-
opacity : 0.3;
|
435 |
-
pointer-events : none;
|
436 |
-
}
|
437 |
-
|
438 |
-
.yith-plugin-fw-select,
|
439 |
-
.yith-plugin-fw-slider-container,
|
440 |
-
.yith-plugin-fw-text-input,
|
441 |
-
.yith-plugin-fw-text-array-table,
|
442 |
-
.yith-plugin-fw-textarea {
|
443 |
-
width : 400px;
|
444 |
-
max-width : 100%;
|
445 |
-
}
|
446 |
-
|
447 |
-
.yith-plugin-fw-text-array-table input {
|
448 |
-
width : 100%;
|
449 |
-
}
|
450 |
-
|
451 |
-
.yith-plugin-fw-panel-wc-row.preview {
|
452 |
-
float : none;
|
453 |
-
}
|
454 |
-
|
455 |
-
.yith-plugin-fw-panel .subsubsub {
|
456 |
-
margin : 0;
|
457 |
-
}
|
458 |
-
|
459 |
-
/* === Responsive === */
|
460 |
-
|
461 |
-
@media (max-width : 767px) {
|
462 |
-
|
463 |
-
}
|
464 |
-
|
465 |
-
@media (max-width : 480px) {
|
466 |
-
|
467 |
-
}
|
468 |
-
|
469 |
-
@media (min-width : 768px) and (max-width : 992px) {
|
470 |
-
}
|
471 |
-
|
472 |
-
@media (min-width : 980px) and (max-width : 1199px) {
|
473 |
-
}
|
474 |
-
|
475 |
-
@media (min-width : 1200px) {
|
476 |
-
.yit-container.plugin-licence-activation {
|
477 |
-
width : 900px;
|
478 |
-
}
|
479 |
-
}
|
480 |
-
|
481 |
-
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (-o-min-device-pixel-ratio : 3/2), only screen and (min--moz-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
|
482 |
-
}
|
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 |
+
.plugin-option tr {
|
10 |
+
border-bottom : 1px solid #ebebeb;
|
11 |
+
}
|
12 |
+
|
13 |
+
.plugin-option .yit_options,
|
14 |
+
.plugin-option .yit-options {
|
15 |
+
border-bottom : 0px;
|
16 |
+
}
|
17 |
+
|
18 |
+
.plugin-option .yit-options .option,
|
19 |
+
.plugin-option .yit_options .option {
|
20 |
+
width : 600px;
|
21 |
+
}
|
22 |
+
|
23 |
+
.plugin-option .form-table > tbody > tr > td {
|
24 |
+
padding : 25px 15px;
|
25 |
+
}
|
26 |
+
|
27 |
+
.ie8 .yit_options select,
|
28 |
+
.ie8 .yit-options select {
|
29 |
+
height : 26px;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Style to woocommerce panel*/
|
33 |
+
|
34 |
+
#plugin-fw-wc, #yith-plugin-fw-panel {
|
35 |
+
padding-top : 20px;
|
36 |
+
}
|
37 |
+
|
38 |
+
#plugin-fw-wc table.form-table, #yith-plugin-fw-panel table.form-table {
|
39 |
+
background-color : #fff;
|
40 |
+
margin-bottom : 20px;
|
41 |
+
}
|
42 |
+
|
43 |
+
#plugin-fw-wc table.form-table th, #yith-plugin-fw-panel table.form-table th {
|
44 |
+
padding : 20px;
|
45 |
+
}
|
46 |
+
|
47 |
+
#plugin-fw-wc h3, #yith-plugin-fw-panel h3 {
|
48 |
+
padding : 0 0 0 10px;
|
49 |
+
margin : 0;
|
50 |
+
}
|
51 |
+
|
52 |
+
/* === Plugins Upgrader === */
|
53 |
+
|
54 |
+
.yit-plugin-changelog-wrapper {
|
55 |
+
display : none;
|
56 |
+
}
|
57 |
+
|
58 |
+
.yit-plugin-changelog-title {
|
59 |
+
text-transform : uppercase;
|
60 |
+
}
|
61 |
+
|
62 |
+
.yit-plugin-changelog {
|
63 |
+
height : calc(100% - 15px);
|
64 |
+
width : calc(100% - 15px);
|
65 |
+
overflow-x : hidden;
|
66 |
+
overflow-y : auto;
|
67 |
+
z-index : 999;
|
68 |
+
background : #fcfcfc;
|
69 |
+
}
|
70 |
+
|
71 |
+
/* === Plugins Licence Activation === */
|
72 |
+
|
73 |
+
.yit-container.plugin-licence-activation {
|
74 |
+
font-family : 'Raleway', sans-serif;
|
75 |
+
}
|
76 |
+
|
77 |
+
.yit-container.plugin-licence-activation .to-active-wrapper {
|
78 |
+
margin-bottom : 60px;
|
79 |
+
}
|
80 |
+
|
81 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form {
|
82 |
+
position : relative;
|
83 |
+
border-color : #e1e1e1;
|
84 |
+
border-style : solid;
|
85 |
+
border-width : 0;
|
86 |
+
}
|
87 |
+
|
88 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:first-child {
|
89 |
+
border-top-width : 1px;
|
90 |
+
}
|
91 |
+
|
92 |
+
.yit-container.plugin-licence-activation .to-active-wrapper form.to-active-form:last-child {
|
93 |
+
border-bottom-width : 1px;
|
94 |
+
}
|
95 |
+
|
96 |
+
.yit-container.plugin-licence-activation .to-active-wrapper table.to-active-table {
|
97 |
+
border-width : 0;
|
98 |
+
border-spacing : 0;
|
99 |
+
width : 100%;
|
100 |
+
}
|
101 |
+
|
102 |
+
.yit-container.plugin-licence-activation .message {
|
103 |
+
display : none;
|
104 |
+
line-height : normal;
|
105 |
+
background : #fff url(../images/licence-error.png) 15px center no-repeat;
|
106 |
+
padding-left : 65px;
|
107 |
+
padding-right : 15px;
|
108 |
+
width : 150px;
|
109 |
+
}
|
110 |
+
|
111 |
+
.yit-container.plugin-licence-activation .message-wrapper {
|
112 |
+
height : 75px;
|
113 |
+
display : none;
|
114 |
+
position : absolute;
|
115 |
+
top : 0;
|
116 |
+
right : -250px;
|
117 |
+
border : 1px solid #ff3838;
|
118 |
+
}
|
119 |
+
|
120 |
+
.yit-container.plugin-licence-activation .message-wrapper.visible {
|
121 |
+
display : table;
|
122 |
+
}
|
123 |
+
|
124 |
+
.yit-container.plugin-licence-activation .message {
|
125 |
+
display : table-cell;
|
126 |
+
vertical-align : middle;
|
127 |
+
}
|
128 |
+
|
129 |
+
.yit-container.plugin-licence-activation .arrow-left:after,
|
130 |
+
.yit-container.plugin-licence-activation .arrow-left:before {
|
131 |
+
content : "";
|
132 |
+
display : block;
|
133 |
+
width : 0;
|
134 |
+
height : 0;
|
135 |
+
position : absolute;
|
136 |
+
}
|
137 |
+
|
138 |
+
.yit-container.plugin-licence-activation .arrow-left:before {
|
139 |
+
border-top : 9px solid transparent;
|
140 |
+
border-bottom : 9px solid transparent;
|
141 |
+
border-right : 9px solid #ff3838;
|
142 |
+
top : 26px;
|
143 |
+
left : -9px;
|
144 |
+
}
|
145 |
+
|
146 |
+
.yit-container.plugin-licence-activation .arrow-left:after {
|
147 |
+
border-top : 8px solid transparent;
|
148 |
+
border-bottom : 8px solid transparent;
|
149 |
+
border-right : 8px solid #fff;
|
150 |
+
left : -8px;
|
151 |
+
top : 27px;
|
152 |
+
}
|
153 |
+
|
154 |
+
.yit-container.plugin-licence-activation h2,
|
155 |
+
.yit-container.plugin-licence-activation h3 {
|
156 |
+
text-transform : uppercase;
|
157 |
+
font-weight : 800;
|
158 |
+
margin-bottom : 30px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.yit-container.plugin-licence-activation h2 {
|
162 |
+
color : #808a97;
|
163 |
+
font-size : 25px;
|
164 |
+
}
|
165 |
+
|
166 |
+
.yit-container.plugin-licence-activation h3 {
|
167 |
+
color : #313131;
|
168 |
+
font-size : 15px;
|
169 |
+
height : 20px;
|
170 |
+
}
|
171 |
+
|
172 |
+
.yit-container.plugin-licence-activation h3.to-active {
|
173 |
+
height : 20px;
|
174 |
+
position : relative;
|
175 |
+
vertical-align : top;
|
176 |
+
}
|
177 |
+
|
178 |
+
.yit-container.plugin-licence-activation .spinner.show {
|
179 |
+
display : inline-block;
|
180 |
+
vertical-align : middle;
|
181 |
+
float : none;
|
182 |
+
}
|
183 |
+
|
184 |
+
.yit-container.plugin-licence-activation h3.to-active > .spinner.show {
|
185 |
+
display : inline-block;
|
186 |
+
float : none;
|
187 |
+
top : -3px;
|
188 |
+
position : relative;
|
189 |
+
}
|
190 |
+
|
191 |
+
.yit-container.plugin-licence-activation .licence-check-section {
|
192 |
+
margin-bottom : 60px;
|
193 |
+
}
|
194 |
+
|
195 |
+
.yit-container.plugin-licence-activation span.licence-label {
|
196 |
+
font-weight : 500;
|
197 |
+
color : #606060;
|
198 |
+
margin-bottom : 30px;
|
199 |
+
}
|
200 |
+
|
201 |
+
.yit-container.plugin-licence-activation .button-licence {
|
202 |
+
border : 0;
|
203 |
+
font-size : 13px;
|
204 |
+
text-transform : uppercase;
|
205 |
+
background-color : #808a97;
|
206 |
+
color : #fff;
|
207 |
+
font-weight : 700;
|
208 |
+
border-radius : 3px;
|
209 |
+
cursor : pointer;
|
210 |
+
text-decoration : none;
|
211 |
+
padding : 5px 7px;
|
212 |
+
-webkit-transition : background-color 0.3s ease;
|
213 |
+
-moz-transition : background-color 0.3s ease;
|
214 |
+
-ms-transition : background-color 0.3s ease;
|
215 |
+
-o-transition : background-color 0.3s ease;
|
216 |
+
transition : background-color 0.3s ease;
|
217 |
+
}
|
218 |
+
|
219 |
+
.yit-container.plugin-licence-activation .button-licence:hover {
|
220 |
+
background-color : #4d5c6f;
|
221 |
+
}
|
222 |
+
|
223 |
+
.yit-container.plugin-licence-activation .button-licence.clicked {
|
224 |
+
cursor : not-allowed;
|
225 |
+
background-color : #e2e2e2 !important;
|
226 |
+
}
|
227 |
+
|
228 |
+
.yit-container.plugin-licence-activation .button-licence.licence-check {
|
229 |
+
font-weight : 400;
|
230 |
+
padding : 12px 19px;
|
231 |
+
}
|
232 |
+
|
233 |
+
.yit-container.plugin-licence-activation .button-licence.licence-renew {
|
234 |
+
text-decoration : none;
|
235 |
+
padding : 7px 12px;
|
236 |
+
font-size : 9px;
|
237 |
+
}
|
238 |
+
|
239 |
+
.yit-container.plugin-licence-activation .button-licence.licence-renew:focus {
|
240 |
+
box-shadow : none;
|
241 |
+
}
|
242 |
+
|
243 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) {
|
244 |
+
width : 100%;
|
245 |
+
border : 1px solid #dcdcdc;
|
246 |
+
border-spacing : 0;
|
247 |
+
border-radius : 5px;
|
248 |
+
border-collapse : separate;
|
249 |
+
overflow : hidden;
|
250 |
+
}
|
251 |
+
|
252 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
253 |
+
border-bottom : 1px solid #dcdcdc;
|
254 |
+
}
|
255 |
+
|
256 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) td,
|
257 |
+
.yit-container.plugin-licence-activation table:not(.to-active-table) th {
|
258 |
+
border-right : 1px solid #dcdcdc;
|
259 |
+
}
|
260 |
+
|
261 |
+
.yit-container.plugin-licence-activation table td:last-child,
|
262 |
+
.yit-container.plugin-licence-activation table th:last-child {
|
263 |
+
border-right : 0;
|
264 |
+
}
|
265 |
+
|
266 |
+
.yit-container.plugin-licence-activation table thead tr {
|
267 |
+
background-color : #f6f4f4;
|
268 |
+
}
|
269 |
+
|
270 |
+
.yit-container.plugin-licence-activation table tbody tr {
|
271 |
+
background-color : #fff;
|
272 |
+
}
|
273 |
+
|
274 |
+
.yit-container.plugin-licence-activation table thead tr th {
|
275 |
+
font-size : 13px;
|
276 |
+
color : #313131;
|
277 |
+
text-transform : uppercase;
|
278 |
+
font-weight : bold;
|
279 |
+
}
|
280 |
+
|
281 |
+
.yit-container.plugin-licence-activation table thead tr,
|
282 |
+
.yit-container.plugin-licence-activation table tbody tr {
|
283 |
+
line-height : 60px;
|
284 |
+
}
|
285 |
+
|
286 |
+
.yit-container.plugin-licence-activation table tbody tr td {
|
287 |
+
text-align : center;
|
288 |
+
line-height : 20px;
|
289 |
+
padding : 10px 5px;
|
290 |
+
}
|
291 |
+
|
292 |
+
.yit-container.plugin-licence-activation .button-licence.licence-activation {
|
293 |
+
padding : 12px 18px;
|
294 |
+
}
|
295 |
+
|
296 |
+
.yit-container.plugin-licence-activation .to-active-table tr {
|
297 |
+
line-height : 75px;
|
298 |
+
}
|
299 |
+
|
300 |
+
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row {
|
301 |
+
background-color : transparent;
|
302 |
+
-webkit-transition : all 0.3s ease;
|
303 |
+
-moz-transition : all 0.3s ease;
|
304 |
+
-ms-transition : all 0.3s ease;
|
305 |
+
-o-transition : all 0.3s ease;
|
306 |
+
transition : all 0.3s ease;
|
307 |
+
}
|
308 |
+
|
309 |
+
.yit-container.plugin-licence-activation .to-active-table tr.plugin-row.error {
|
310 |
+
background-color : #ffdcdc;
|
311 |
+
}
|
312 |
+
|
313 |
+
.yit-container.plugin-licence-activation .to-active-table td {
|
314 |
+
padding-right : 12px;
|
315 |
+
width : 33%;
|
316 |
+
}
|
317 |
+
|
318 |
+
.yit-container.plugin-licence-activation .to-active-table td.plugin-name {
|
319 |
+
color : #808a97;
|
320 |
+
font-size : 12px;
|
321 |
+
text-transform : uppercase;
|
322 |
+
font-weight : bold;
|
323 |
+
line-height : 20px;
|
324 |
+
width : 20%;
|
325 |
+
padding-left : 20px;
|
326 |
+
}
|
327 |
+
|
328 |
+
.yit-container.plugin-licence-activation .to-active-table td.activate-button {
|
329 |
+
width : 15%;
|
330 |
+
position : relative;
|
331 |
+
}
|
332 |
+
|
333 |
+
.yit-container.plugin-licence-activation input[type=text],
|
334 |
+
.yit-container.plugin-licence-activation input[type=email] {
|
335 |
+
-webkit-transition : all 0.3s ease;
|
336 |
+
-moz-transition : all 0.3s ease;
|
337 |
+
-ms-transition : all 0.3s ease;
|
338 |
+
-o-transition : all 0.3s ease;
|
339 |
+
transition : all 0.3s ease;
|
340 |
+
|
341 |
+
border : 1px solid #dcdcdc;
|
342 |
+
padding : 0 15px;
|
343 |
+
border-radius : 3px;
|
344 |
+
height : 41px;
|
345 |
+
width : 100%;
|
346 |
+
}
|
347 |
+
|
348 |
+
.yit-container.plugin-licence-activation input[type=text].require,
|
349 |
+
.yit-container.plugin-licence-activation input[type=email].require {
|
350 |
+
border : 1px solid #ff3838;
|
351 |
+
}
|
352 |
+
|
353 |
+
.yit-container.plugin-licence-activation input[type=text]:focus,
|
354 |
+
.yit-container.plugin-licence-activation input[type=email]:focus {
|
355 |
+
webkit-box-shadow : 0 0 1px rgba(30, 140, 190, .8);
|
356 |
+
box-shadow : 0 0 1px rgba(30, 140, 190, .8);
|
357 |
+
}
|
358 |
+
|
359 |
+
.yit-container.plugin-licence-activation input[type=text] {
|
360 |
+
text-transform : uppercase;
|
361 |
+
text-align : center;
|
362 |
+
}
|
363 |
+
|
364 |
+
.yit-container.plugin-licence-activation input[type=email] {
|
365 |
+
text-align : left;
|
366 |
+
}
|
367 |
+
|
368 |
+
.yit-container.plugin-licence-activation input[type=submit]:focus {
|
369 |
+
outline : 0;
|
370 |
+
}
|
371 |
+
|
372 |
+
/* === Woocommerce panel === */
|
373 |
+
#plugin-fw-wc .yit_options {
|
374 |
+
padding : 0;
|
375 |
+
border : 0;
|
376 |
+
}
|
377 |
+
|
378 |
+
#plugin-fw-wc .yit_options input.upload_button, .yit_options input.button {
|
379 |
+
background : none;
|
380 |
+
border : 1px solid #ccc;
|
381 |
+
}
|
382 |
+
|
383 |
+
/* === WP Pointers === */
|
384 |
+
|
385 |
+
#adminmenu li.menu-top.yit-pointer-selected-row,
|
386 |
+
#adminmenu li.menu-top.yit-pointer-selected-row:hover,
|
387 |
+
#adminmenu li.yit-pointer-selected-row a.menu-top {
|
388 |
+
background-color : #acc327;
|
389 |
+
color : #000;
|
390 |
+
}
|
391 |
+
|
392 |
+
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer {
|
393 |
+
color : #000;
|
394 |
+
}
|
395 |
+
|
396 |
+
#adminmenu a.menu-top.toplevel_page_yit_plugin_panel.yit-pointer:hover,
|
397 |
+
#adminmenu .wp-submenu a.yit-pointer-selected-row {
|
398 |
+
color : #fff;
|
399 |
+
}
|
400 |
+
|
401 |
+
#adminmenu .wp-submenu a.yit-pointer-selected-row:hover {
|
402 |
+
color : #45bbe6;
|
403 |
+
}
|
404 |
+
|
405 |
+
/* WooCommerce 2.4 Support */
|
406 |
+
.woocommerce table.form-table .colorpick {
|
407 |
+
width : 6em;
|
408 |
+
}
|
409 |
+
|
410 |
+
#wpwrap h2.nav-tab-wrapper, #wpbody-content h2.nav-tab-wrapper {
|
411 |
+
border-bottom : 1px solid #ccc;
|
412 |
+
margin-right: 15px;
|
413 |
+
}
|
414 |
+
|
415 |
+
/* === YIT FRAMEWORK === */
|
416 |
+
.plugin-card .plugin-icon img {
|
417 |
+
max-width : 100%;
|
418 |
+
width : auto;
|
419 |
+
height : auto;
|
420 |
+
}
|
421 |
+
|
422 |
+
/* === Panel Content and Container === */
|
423 |
+
.yit-admin-panel-container {
|
424 |
+
position : relative;
|
425 |
+
margin-right: 15px;
|
426 |
+
}
|
427 |
+
|
428 |
+
.yit-admin-panel-content-wrap {
|
429 |
+
width : 100%;
|
430 |
+
display : block;
|
431 |
+
}
|
432 |
+
|
433 |
+
.yith-disabled {
|
434 |
+
opacity : 0.3;
|
435 |
+
pointer-events : none;
|
436 |
+
}
|
437 |
+
|
438 |
+
.yith-plugin-fw-select,
|
439 |
+
.yith-plugin-fw-slider-container,
|
440 |
+
.yith-plugin-fw-text-input,
|
441 |
+
.yith-plugin-fw-text-array-table,
|
442 |
+
.yith-plugin-fw-textarea {
|
443 |
+
width : 400px;
|
444 |
+
max-width : 100%;
|
445 |
+
}
|
446 |
+
|
447 |
+
.yith-plugin-fw-text-array-table input {
|
448 |
+
width : 100%;
|
449 |
+
}
|
450 |
+
|
451 |
+
.yith-plugin-fw-panel-wc-row.preview {
|
452 |
+
float : none;
|
453 |
+
}
|
454 |
+
|
455 |
+
.yith-plugin-fw-panel .subsubsub {
|
456 |
+
margin : 0;
|
457 |
+
}
|
458 |
+
|
459 |
+
/* === Responsive === */
|
460 |
+
|
461 |
+
@media (max-width : 767px) {
|
462 |
+
|
463 |
+
}
|
464 |
+
|
465 |
+
@media (max-width : 480px) {
|
466 |
+
|
467 |
+
}
|
468 |
+
|
469 |
+
@media (min-width : 768px) and (max-width : 992px) {
|
470 |
+
}
|
471 |
+
|
472 |
+
@media (min-width : 980px) and (max-width : 1199px) {
|
473 |
+
}
|
474 |
+
|
475 |
+
@media (min-width : 1200px) {
|
476 |
+
.yit-container.plugin-licence-activation {
|
477 |
+
width : 900px;
|
478 |
+
}
|
479 |
+
}
|
480 |
+
|
481 |
+
@media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (-o-min-device-pixel-ratio : 3/2), only screen and (min--moz-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) {
|
482 |
+
}
|
plugin-fw/assets/css/yit-upgrade-to-pro.css
CHANGED
@@ -1,77 +1,77 @@
|
|
1 |
-
/* === Upgrade to Premium Landing page === */
|
2 |
-
|
3 |
-
#upgrade-to-premium{
|
4 |
-
width: 900px;
|
5 |
-
}
|
6 |
-
#upgrade-to-premium h1{
|
7 |
-
font-family: 'Raleway',san-serif;
|
8 |
-
text-transform: uppercase;
|
9 |
-
font-size: 30px;
|
10 |
-
font-weight: 700;
|
11 |
-
color: #808a97;
|
12 |
-
}
|
13 |
-
|
14 |
-
#upgrade-to-premium h3{
|
15 |
-
font-family: 'Raleway',san-serif;
|
16 |
-
font-size: 20px;
|
17 |
-
line-height: 29px;
|
18 |
-
font-weight: 700;
|
19 |
-
color: #808a97;
|
20 |
-
}
|
21 |
-
|
22 |
-
#upgrade-to-premium p{
|
23 |
-
font-family: 'Open Sans',san-serif;
|
24 |
-
font-size: 15px;
|
25 |
-
line-height: 29px;
|
26 |
-
font-weight: 400;
|
27 |
-
color: #6a6a6b;
|
28 |
-
}
|
29 |
-
#upgrade-to-premium p.highlighted{
|
30 |
-
font-family: 'Raleway',san-serif;
|
31 |
-
font-size: 20px;
|
32 |
-
line-height: 27px;
|
33 |
-
color: #808a97;
|
34 |
-
font-weight: 400;
|
35 |
-
}
|
36 |
-
#upgrade-to-premium ol{
|
37 |
-
counter-reset: item;
|
38 |
-
list-style-type: none;
|
39 |
-
margin-left: 0;
|
40 |
-
}
|
41 |
-
#upgrade-to-premium li.step{
|
42 |
-
font-family: 'open sans',san-serif;
|
43 |
-
font-size: 15px;
|
44 |
-
color: #6a6a6b;
|
45 |
-
font-weight: 400;
|
46 |
-
position: relative;
|
47 |
-
padding-left: 50px;
|
48 |
-
line-height: 25px;
|
49 |
-
margin-bottom: 25px;
|
50 |
-
}
|
51 |
-
#upgrade-to-premium li.step:before{
|
52 |
-
content: counters(item, ".") " ";
|
53 |
-
counter-increment: item;
|
54 |
-
position: absolute;
|
55 |
-
left: 0;
|
56 |
-
top: 0;
|
57 |
-
border: 1px solid #808a97;
|
58 |
-
width: 30px;
|
59 |
-
height: 30px;
|
60 |
-
border-radius: 16px;
|
61 |
-
background-color: #808a97;
|
62 |
-
color: #ffffff;
|
63 |
-
font-weight: 700;
|
64 |
-
font-size: 18px;
|
65 |
-
text-align: center;
|
66 |
-
line-height: 27px;
|
67 |
-
}
|
68 |
-
#upgrade-to-premium li.step img{
|
69 |
-
border: 1px solid #b8b8b8;
|
70 |
-
width: 600px;
|
71 |
-
display: block;
|
72 |
-
margin: 15px 0 25px 0;
|
73 |
-
}
|
74 |
-
|
75 |
-
#cboxLoadedContent {
|
76 |
-
margin-bottom: 60px!important;
|
77 |
}
|
1 |
+
/* === Upgrade to Premium Landing page === */
|
2 |
+
|
3 |
+
#upgrade-to-premium{
|
4 |
+
width: 900px;
|
5 |
+
}
|
6 |
+
#upgrade-to-premium h1{
|
7 |
+
font-family: 'Raleway',san-serif;
|
8 |
+
text-transform: uppercase;
|
9 |
+
font-size: 30px;
|
10 |
+
font-weight: 700;
|
11 |
+
color: #808a97;
|
12 |
+
}
|
13 |
+
|
14 |
+
#upgrade-to-premium h3{
|
15 |
+
font-family: 'Raleway',san-serif;
|
16 |
+
font-size: 20px;
|
17 |
+
line-height: 29px;
|
18 |
+
font-weight: 700;
|
19 |
+
color: #808a97;
|
20 |
+
}
|
21 |
+
|
22 |
+
#upgrade-to-premium p{
|
23 |
+
font-family: 'Open Sans',san-serif;
|
24 |
+
font-size: 15px;
|
25 |
+
line-height: 29px;
|
26 |
+
font-weight: 400;
|
27 |
+
color: #6a6a6b;
|
28 |
+
}
|
29 |
+
#upgrade-to-premium p.highlighted{
|
30 |
+
font-family: 'Raleway',san-serif;
|
31 |
+
font-size: 20px;
|
32 |
+
line-height: 27px;
|
33 |
+
color: #808a97;
|
34 |
+
font-weight: 400;
|
35 |
+
}
|
36 |
+
#upgrade-to-premium ol{
|
37 |
+
counter-reset: item;
|
38 |
+
list-style-type: none;
|
39 |
+
margin-left: 0;
|
40 |
+
}
|
41 |
+
#upgrade-to-premium li.step{
|
42 |
+
font-family: 'open sans',san-serif;
|
43 |
+
font-size: 15px;
|
44 |
+
color: #6a6a6b;
|
45 |
+
font-weight: 400;
|
46 |
+
position: relative;
|
47 |
+
padding-left: 50px;
|
48 |
+
line-height: 25px;
|
49 |
+
margin-bottom: 25px;
|
50 |
+
}
|
51 |
+
#upgrade-to-premium li.step:before{
|
52 |
+
content: counters(item, ".") " ";
|
53 |
+
counter-increment: item;
|
54 |
+
position: absolute;
|
55 |
+
left: 0;
|
56 |
+
top: 0;
|
57 |
+
border: 1px solid #808a97;
|
58 |
+
width: 30px;
|
59 |
+
height: 30px;
|
60 |
+
border-radius: 16px;
|
61 |
+
background-color: #808a97;
|
62 |
+
color: #ffffff;
|
63 |
+
font-weight: 700;
|
64 |
+
font-size: 18px;
|
65 |
+
text-align: center;
|
66 |
+
line-height: 27px;
|
67 |
+
}
|
68 |
+
#upgrade-to-premium li.step img{
|
69 |
+
border: 1px solid #b8b8b8;
|
70 |
+
width: 600px;
|
71 |
+
display: block;
|
72 |
+
margin: 15px 0 25px 0;
|
73 |
+
}
|
74 |
+
|
75 |
+
#cboxLoadedContent {
|
76 |
+
margin-bottom: 60px!important;
|
77 |
}
|
plugin-fw/assets/css/yit-upgrader.css
CHANGED
@@ -1,22 +1,22 @@
|
|
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 |
-
height : calc(100% - 15px);
|
13 |
-
width : calc(100% - 15px);
|
14 |
-
overflow-x : hidden;
|
15 |
-
overflow-y : auto;
|
16 |
-
z-index : 999;
|
17 |
-
background: #fcfcfc;
|
18 |
-
}
|
19 |
-
|
20 |
-
.yith-updating:before{
|
21 |
-
animation: rotation 2s infinite linear;
|
22 |
}
|
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 |
+
height : calc(100% - 15px);
|
13 |
+
width : calc(100% - 15px);
|
14 |
+
overflow-x : hidden;
|
15 |
+
overflow-y : auto;
|
16 |
+
z-index : 999;
|
17 |
+
background: #fcfcfc;
|
18 |
+
}
|
19 |
+
|
20 |
+
.yith-updating:before{
|
21 |
+
animation: rotation 2s infinite linear;
|
22 |
}
|
plugin-fw/assets/css/yith-fields.css
CHANGED
@@ -1,2157 +1,2157 @@
|
|
1 |
-
.yith-plugin-fw span.description {
|
2 |
-
display: block;
|
3 |
-
margin-top: 5px;
|
4 |
-
font-size: 12px;
|
5 |
-
color: #777;
|
6 |
-
font-style: italic;
|
7 |
-
clear: both;
|
8 |
-
}
|
9 |
-
|
10 |
-
.yith-plugin-fw span.description.inline {
|
11 |
-
display: inline-block;
|
12 |
-
margin: 0 0 0 5px;
|
13 |
-
}
|
14 |
-
|
15 |
-
.yith-disabled {
|
16 |
-
opacity: 0.3;
|
17 |
-
pointer-events: none;
|
18 |
-
}
|
19 |
-
|
20 |
-
.yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
21 |
-
display: block;
|
22 |
-
width: 100%;
|
23 |
-
}
|
24 |
-
|
25 |
-
.yith-plugin-fw-field-wrapper span.desc {
|
26 |
-
display: block;
|
27 |
-
width: 100%;
|
28 |
-
}
|
29 |
-
|
30 |
-
.yith-plugin-fw-title-field-wrapper h3.title {
|
31 |
-
width: 100%;
|
32 |
-
}
|
33 |
-
|
34 |
-
.the-metabox .yith-plugin-fw-title-field-wrapper h3.title {
|
35 |
-
float: left;
|
36 |
-
}
|
37 |
-
|
38 |
-
.yith-plugin-fw span.color-alpha {
|
39 |
-
height: 23px!important;
|
40 |
-
}
|
41 |
-
.yith-plugin-fw .wp-color-result-text{
|
42 |
-
height: 100%;
|
43 |
-
}
|
44 |
-
.yith-plugin-fw input[type=email],
|
45 |
-
.yith-plugin-fw input[type=number],
|
46 |
-
.yith-plugin-fw input[type=text]:not(.select2-search__field),
|
47 |
-
.yith-plugin-fw select,
|
48 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=email],
|
49 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=number],
|
50 |
-
.yith-plugin-ui input[type=password],
|
51 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=text]:not(.select2-search__field),
|
52 |
-
.woocommerce .yith-plugin-fw table.form-table select {
|
53 |
-
width: 400px;
|
54 |
-
max-width: 100%;
|
55 |
-
height: 30px;
|
56 |
-
padding: 5px;
|
57 |
-
line-height: 1;
|
58 |
-
}
|
59 |
-
|
60 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
|
61 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=text].yith-plugin-fw-colorpicker,
|
62 |
-
.yith-plugin-fw input[type=text].wp-color-picker,
|
63 |
-
.yith-plugin-fw input[type=text].yith-plugin-fw-colorpicker {
|
64 |
-
width: 6em;
|
65 |
-
max-width: none;
|
66 |
-
height: auto;
|
67 |
-
padding: 3px 5px;
|
68 |
-
}
|
69 |
-
|
70 |
-
.wp-core-ui .yith-plugin-fw-colorpicker-field-wrapper button{
|
71 |
-
border-color: #7e8993;
|
72 |
-
}
|
73 |
-
|
74 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
|
75 |
-
.yith-plugin-fw input[type=text].colorpick {
|
76 |
-
width: 6em;
|
77 |
-
max-width: none;
|
78 |
-
height: auto;
|
79 |
-
padding: 6px;
|
80 |
-
}
|
81 |
-
|
82 |
-
.yith-plugin-fw input.select2-search__field,
|
83 |
-
.yith-plugin-fw .select2-container .select2-search--inline .select2-search__field,
|
84 |
-
.woocommerce .yith-plugin-fw input.select2-search__field,
|
85 |
-
.woocommerce .yith-plugin-fw table.form-table input.select2-search__field {
|
86 |
-
padding: 3px;
|
87 |
-
}
|
88 |
-
|
89 |
-
.yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
|
90 |
-
line-height: 27px;
|
91 |
-
}
|
92 |
-
|
93 |
-
.yith-plugin-fw textarea {
|
94 |
-
width: 400px;
|
95 |
-
max-width: 100%;
|
96 |
-
padding: 5px;
|
97 |
-
}
|
98 |
-
|
99 |
-
/* ------------- ICONS ------------- */
|
100 |
-
.yit-icons-manager-wrapper {
|
101 |
-
width: 100%;
|
102 |
-
max-width: 400px;
|
103 |
-
}
|
104 |
-
|
105 |
-
.yit-icons-manager-text {
|
106 |
-
width: 100%;
|
107 |
-
}
|
108 |
-
|
109 |
-
.yit-icons-manager-icon-text {
|
110 |
-
width: calc(100% - 35px) !important;
|
111 |
-
height: 30px;
|
112 |
-
float: left;
|
113 |
-
margin: 0;
|
114 |
-
}
|
115 |
-
|
116 |
-
.yit-icons-manager-icon-preview {
|
117 |
-
width: 30px;
|
118 |
-
height: 30px;
|
119 |
-
margin-right: 5px;
|
120 |
-
float: left;
|
121 |
-
padding-top: 6px;
|
122 |
-
box-sizing: border-box;
|
123 |
-
text-align: center;
|
124 |
-
background: #f1f1f1;
|
125 |
-
}
|
126 |
-
|
127 |
-
.yit-icons-manager-list-wrapper {
|
128 |
-
margin: 10px 0;
|
129 |
-
box-shadow: 0 0 0 1px #ddd;
|
130 |
-
}
|
131 |
-
|
132 |
-
ul.yit-icons-manager-list {
|
133 |
-
width: 100%;
|
134 |
-
height: 300px;
|
135 |
-
overflow-y: scroll;
|
136 |
-
margin: 0;
|
137 |
-
}
|
138 |
-
|
139 |
-
ul.yit-icons-manager-list li {
|
140 |
-
float: left;
|
141 |
-
width: 30px;
|
142 |
-
height: 30px;
|
143 |
-
padding-top: 6px;
|
144 |
-
box-sizing: border-box;
|
145 |
-
text-align: center;
|
146 |
-
background: #f1f1f1;
|
147 |
-
margin: 1px;
|
148 |
-
cursor: pointer;
|
149 |
-
}
|
150 |
-
|
151 |
-
ul.yit-icons-manager-list li:hover {
|
152 |
-
background: #c5dcf6;
|
153 |
-
}
|
154 |
-
|
155 |
-
ul.yit-icons-manager-list li.active {
|
156 |
-
background: #d4f0ff;
|
157 |
-
}
|
158 |
-
|
159 |
-
.yit-icons-manager-action-set-default {
|
160 |
-
margin-bottom: 0;
|
161 |
-
}
|
162 |
-
|
163 |
-
.yit-icons-manager-default-icon-preview {
|
164 |
-
height: 100%;
|
165 |
-
display: inline-block;
|
166 |
-
padding-left: 10px;
|
167 |
-
border-left: 1px solid #ccc;
|
168 |
-
margin-left: 10px;
|
169 |
-
}
|
170 |
-
|
171 |
-
/* ------- Text Array ------- */
|
172 |
-
.yith-plugin-fw-text-array-table td {
|
173 |
-
padding: 1px;
|
174 |
-
}
|
175 |
-
|
176 |
-
.yith-plugin-fw-text-array-table input[type=text],
|
177 |
-
.woocommerce table.form-table table.yith-plugin-fw-text-array-table input[type=text] {
|
178 |
-
width: 100%;
|
179 |
-
}
|
180 |
-
|
181 |
-
/* ------- Image Gallery ------- */
|
182 |
-
.yith-plugin-fw .image-gallery ul li {
|
183 |
-
display: inline-block;
|
184 |
-
width: 80px;
|
185 |
-
margin-left: 10px;
|
186 |
-
position: relative;
|
187 |
-
}
|
188 |
-
|
189 |
-
.yith-plugin-fw .image-gallery ul li img {
|
190 |
-
width: 80px;
|
191 |
-
border: 1px solid #ccc;
|
192 |
-
}
|
193 |
-
|
194 |
-
.yith-plugin-fw .image-gallery ul li ul {
|
195 |
-
position: absolute;
|
196 |
-
top: -6px;
|
197 |
-
right: -1px;
|
198 |
-
width: 20px;
|
199 |
-
height: 20px;
|
200 |
-
}
|
201 |
-
|
202 |
-
.yith-plugin-fw .image-gallery ul a.delete {
|
203 |
-
background: url(../images/x.png) no-repeat;
|
204 |
-
width: 20px;
|
205 |
-
height: 20px;
|
206 |
-
display: block;
|
207 |
-
text-indent: -99999px;
|
208 |
-
}
|
209 |
-
|
210 |
-
/* ------- OnOff ------- */
|
211 |
-
.yith-plugin-fw-onoff-container {
|
212 |
-
display: inline-block;
|
213 |
-
}
|
214 |
-
|
215 |
-
.yith-plugin-fw-onoff-container input {
|
216 |
-
display: none;
|
217 |
-
}
|
218 |
-
|
219 |
-
.yith-plugin-fw-onoff-container input + span {
|
220 |
-
cursor: pointer;
|
221 |
-
text-indent: -9999px;
|
222 |
-
display: block;
|
223 |
-
width: 36px;
|
224 |
-
line-height: 1;
|
225 |
-
height: 20px;
|
226 |
-
background: #a4a4a4;
|
227 |
-
border-radius: 24px;
|
228 |
-
position: relative;
|
229 |
-
transition: all 0.3s;
|
230 |
-
}
|
231 |
-
|
232 |
-
|
233 |
-
.yith-plugin-fw-onoff-container input + span:before {
|
234 |
-
content: '';
|
235 |
-
background: #fff;
|
236 |
-
width: 16px;
|
237 |
-
height: 16px;
|
238 |
-
border-radius: 50%;
|
239 |
-
position: absolute;
|
240 |
-
top: 2px;
|
241 |
-
left: 2px;
|
242 |
-
transition: all 0.3s;
|
243 |
-
}
|
244 |
-
|
245 |
-
.yith-plugin-fw-onoff-container input:checked + span,
|
246 |
-
.yith-plugin-fw-onoff-container input.onoffchecked + span {
|
247 |
-
background: #0073aa;
|
248 |
-
}
|
249 |
-
|
250 |
-
.yith-plugin-fw-onoff-container input:checked + span:before,
|
251 |
-
.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
252 |
-
left: 18px;
|
253 |
-
}
|
254 |
-
|
255 |
-
/* ------- Preview ------- */
|
256 |
-
.yith-plugin-fw-preview-field {
|
257 |
-
max-height: 200px;
|
258 |
-
}
|
259 |
-
|
260 |
-
/* ------- Radio ------- */
|
261 |
-
.yith-plugin-fw-radio input[type=radio] {
|
262 |
-
margin: 0 3px 0 0;
|
263 |
-
}
|
264 |
-
|
265 |
-
.yith-plugin-fw-radio__row {
|
266 |
-
margin-bottom: 8px;
|
267 |
-
}
|
268 |
-
|
269 |
-
/* ------- Sidebar Layout ------- */
|
270 |
-
.yith-plugin-fw-sidebar-layout input[type="radio"] {
|
271 |
-
display: none;
|
272 |
-
width: 0px;
|
273 |
-
}
|
274 |
-
|
275 |
-
.yith-plugin-fw-sidebar-layout input[type="radio"]:first-child {
|
276 |
-
margin-right: -2px;
|
277 |
-
}
|
278 |
-
|
279 |
-
.yith-plugin-fw-sidebar-layout input[type="radio"] + img {
|
280 |
-
border: 2px solid #fff;
|
281 |
-
padding: 1px;
|
282 |
-
}
|
283 |
-
|
284 |
-
.yith-plugin-fw-sidebar-layout input[type="radio"] + img:hover {
|
285 |
-
cursor: pointer;
|
286 |
-
}
|
287 |
-
|
288 |
-
.yith-plugin-fw-sidebar-layout input[checked] + img {
|
289 |
-
border: 2px solid #f2ad35;
|
290 |
-
padding: 1px;
|
291 |
-
}
|
292 |
-
|
293 |
-
.yith-plugin-fw-sidebar-layout select {
|
294 |
-
vertical-align: 12px;
|
295 |
-
}
|
296 |
-
|
297 |
-
.yit-admin-panel-content-wrap .yith-plugin-fw-sidebar-layout label {
|
298 |
-
font-weight: bold;
|
299 |
-
width: 200px;
|
300 |
-
float: left;
|
301 |
-
line-height: 23px;
|
302 |
-
margin-left: -230px;
|
303 |
-
}
|
304 |
-
|
305 |
-
/* ------- Slider ------- */
|
306 |
-
.yith-plugin-fw .slider {
|
307 |
-
padding-top: 20px;
|
308 |
-
}
|
309 |
-
|
310 |
-
.ui-slider .minCaption {
|
311 |
-
position: absolute;
|
312 |
-
right: 95%;
|
313 |
-
top: -6px;
|
314 |
-
margin-right: 11px;
|
315 |
-
}
|
316 |
-
|
317 |
-
.ui-slider .maxCaption {
|
318 |
-
position: absolute;
|
319 |
-
left: 95%;
|
320 |
-
top: -6px;
|
321 |
-
margin-left: 20px;
|
322 |
-
}
|
323 |
-
|
324 |
-
.ui-slider-horizontal .ui-slider-handle {
|
325 |
-
background: #fff;
|
326 |
-
border: 0px !important;
|
327 |
-
top: -12px !important;
|
328 |
-
border-radius: 50%;
|
329 |
-
width: 27px !important;
|
330 |
-
height: 27px !important;
|
331 |
-
box-sizing: border-box;
|
332 |
-
box-shadow: 0 1px 7px -1px rgba(0, 0, 0, 0.5);
|
333 |
-
font-size: 13px;
|
334 |
-
padding: 6px 0;
|
335 |
-
font-weight: 600;
|
336 |
-
color: #555;
|
337 |
-
text-align: center;
|
338 |
-
}
|
339 |
-
|
340 |
-
.ui-slider.ui-widget-content {
|
341 |
-
background: #ccc;
|
342 |
-
border: none !important;
|
343 |
-
height: 3px !important;
|
344 |
-
border-radius: 3px !important;
|
345 |
-
width: 90%;
|
346 |
-
margin: 15px 5% 20px 5%;
|
347 |
-
}
|
348 |
-
|
349 |
-
.iris-slider-offset.ui-slider.ui-widget-content {
|
350 |
-
background: transparent !important;
|
351 |
-
height: auto !important;
|
352 |
-
}
|
353 |
-
|
354 |
-
.ui-slider.ui-widget-content .ui-widget-header {
|
355 |
-
background: #4b93ff;
|
356 |
-
left: 0px !important;
|
357 |
-
-webkit-border-radius: 3px;
|
358 |
-
-moz-border-radius: 3px;
|
359 |
-
-khtml-border-radius: 3px;
|
360 |
-
border-radius: 3px;
|
361 |
-
}
|
362 |
-
|
363 |
-
/* ------- Select2 ------- */
|
364 |
-
.yith-plugin-fw-select2-wrapper {
|
365 |
-
width: 400px;
|
366 |
-
}
|
367 |
-
|
368 |
-
/* ------- Textarea ------- */
|
369 |
-
.yith-plugin-fw-textarea-editor-field-wrapper {
|
370 |
-
max-width: 1000px;
|
371 |
-
clear: both;
|
372 |
-
}
|
373 |
-
|
374 |
-
.yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area,
|
375 |
-
.woocommerce table.form-table .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area {
|
376 |
-
width: 100%;
|
377 |
-
}
|
378 |
-
|
379 |
-
/* ------- Buttons ------- */
|
380 |
-
.yith-plugin-fw-buttons-field-wrapper {
|
381 |
-
margin-top: 7px;
|
382 |
-
}
|
383 |
-
|
384 |
-
/* ------- Select Images ------- */
|
385 |
-
.yith-plugin-fw-select-images__list {
|
386 |
-
margin: 0;
|
387 |
-
display: flex;
|
388 |
-
flex-wrap: wrap;
|
389 |
-
}
|
390 |
-
|
391 |
-
.yith-plugin-fw-select-images__item {
|
392 |
-
width: calc(20% - 10px);
|
393 |
-
min-width: 150px;
|
394 |
-
margin: 0 10px 10px 0;
|
395 |
-
padding: 10px;
|
396 |
-
box-sizing: border-box;
|
397 |
-
cursor: pointer;
|
398 |
-
transition: all .3s;
|
399 |
-
border: 2px solid #eee;
|
400 |
-
display: flex;
|
401 |
-
flex-direction: column;
|
402 |
-
justify-content: space-between;
|
403 |
-
}
|
404 |
-
|
405 |
-
.yith-plugin-fw-select-images__item:hover,
|
406 |
-
.yith-plugin-fw-select-images__item.yith-plugin-fw-select-images__item--selected {
|
407 |
-
border-color: #07bcce;
|
408 |
-
}
|
409 |
-
|
410 |
-
.yith-plugin-fw-select-images__item__label {
|
411 |
-
text-align: center;
|
412 |
-
font-weight: 600;
|
413 |
-
margin-bottom: 10px;
|
414 |
-
}
|
415 |
-
|
416 |
-
.yith-plugin-fw-select-images__item img {
|
417 |
-
display: block;
|
418 |
-
max-width: 100%;
|
419 |
-
margin: 0 auto;
|
420 |
-
}
|
421 |
-
|
422 |
-
/****************
|
423 |
-
WordPress 5.3 with old panel fixes
|
424 |
-
****************/
|
425 |
-
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single {
|
426 |
-
height: auto;
|
427 |
-
line-height: 1;
|
428 |
-
}
|
429 |
-
|
430 |
-
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single .select2-selection__arrow{
|
431 |
-
height: 100%;
|
432 |
-
}
|
433 |
-
|
434 |
-
/****************
|
435 |
-
YITH UI
|
436 |
-
****************/
|
437 |
-
@font-face {
|
438 |
-
font-family: 'yith-icon';
|
439 |
-
src: url('../fonts/yith-icon.eot?7ik896');
|
440 |
-
src: url('../fonts/yith-icon.eot?7ik896#iefix') format('embedded-opentype'),
|
441 |
-
url('../fonts/yith-icon.ttf?7ik896') format('truetype'),
|
442 |
-
url('../fonts/yith-icon.woff?7ik896') format('woff'),
|
443 |
-
url('../fonts/yith-icon.svg?7ik896#yith-icon') format('svg');
|
444 |
-
font-weight: normal;
|
445 |
-
font-style: normal;
|
446 |
-
}
|
447 |
-
|
448 |
-
[class^="icon-"], [class*=" icon-"][class^="yith-icon-"], [class*=" yith-icon-"] {
|
449 |
-
/* use !important to prevent issues with browser extensions that change fonts */
|
450 |
-
font-family: 'yith-icon' !important;
|
451 |
-
speak: none;
|
452 |
-
font-style: normal;
|
453 |
-
font-weight: normal;
|
454 |
-
font-variant: normal;
|
455 |
-
text-transform: none;
|
456 |
-
line-height: 1;
|
457 |
-
|
458 |
-
/* Better Font Rendering =========== */
|
459 |
-
-webkit-font-smoothing: antialiased;
|
460 |
-
-moz-osx-font-smoothing: grayscale;
|
461 |
-
}
|
462 |
-
|
463 |
-
.yith-icon-calendar_add:before {
|
464 |
-
content: "\e913";
|
465 |
-
color: #757575;
|
466 |
-
}
|
467 |
-
|
468 |
-
.yith-icon-calendar_money:before {
|
469 |
-
content: "\e914";
|
470 |
-
color: #757575;
|
471 |
-
}
|
472 |
-
|
473 |
-
.yith-icon-calendar2:before {
|
474 |
-
content: "\e915";
|
475 |
-
color: #757575;
|
476 |
-
}
|
477 |
-
|
478 |
-
.yith-icon-people:before {
|
479 |
-
content: "\e916";
|
480 |
-
color: #757575;
|
481 |
-
}
|
482 |
-
|
483 |
-
.yith-icon-shield_money:before {
|
484 |
-
content: "\e917";
|
485 |
-
color: #757575;
|
486 |
-
}
|
487 |
-
|
488 |
-
.yith-icon-time_check:before {
|
489 |
-
content: "\e918";
|
490 |
-
color: #757575;
|
491 |
-
}
|
492 |
-
|
493 |
-
.yith-icon-world_settings:before {
|
494 |
-
content: "\e919";
|
495 |
-
color: #757575;
|
496 |
-
}
|
497 |
-
|
498 |
-
.yith-icon-arrow_eye_closed:before {
|
499 |
-
content: "\e912";
|
500 |
-
color: #757575;
|
501 |
-
}
|
502 |
-
|
503 |
-
.yith-icon-arrow_eye:before {
|
504 |
-
content: "\e911";
|
505 |
-
color: #757575;
|
506 |
-
}
|
507 |
-
|
508 |
-
.yith-icon-reset:before {
|
509 |
-
content: "\e910";
|
510 |
-
color: #757575;
|
511 |
-
}
|
512 |
-
|
513 |
-
.yith-icon-drag:before {
|
514 |
-
content: "\e90f";
|
515 |
-
color: #757575;
|
516 |
-
}
|
517 |
-
|
518 |
-
.yith-icon-trash:before {
|
519 |
-
content: "\e90d";
|
520 |
-
color: #757575;
|
521 |
-
}
|
522 |
-
|
523 |
-
.yith-icon-info:before {
|
524 |
-
content: "\e90e";
|
525 |
-
color: #757575;
|
526 |
-
}
|
527 |
-
|
528 |
-
.yith-icon-arrow_down:before {
|
529 |
-
content: "\e900";
|
530 |
-
color: #757575;
|
531 |
-
}
|
532 |
-
|
533 |
-
.yith-icon-arrow_left:before {
|
534 |
-
content: "\e901";
|
535 |
-
color: #757575;
|
536 |
-
}
|
537 |
-
|
538 |
-
.yith-icon-arrow_right:before {
|
539 |
-
content: "\e902";
|
540 |
-
color: #757575;
|
541 |
-
}
|
542 |
-
|
543 |
-
.yith-icon-arrow_up:before {
|
544 |
-
content: "\e903";
|
545 |
-
color: #757575;
|
546 |
-
}
|
547 |
-
|
548 |
-
.yith-icon-calendar:before {
|
549 |
-
content: "\e904";
|
550 |
-
color: #757575;
|
551 |
-
}
|
552 |
-
|
553 |
-
.yith-icon-check:before {
|
554 |
-
content: "\e905";
|
555 |
-
color: #757575;
|
556 |
-
}
|
557 |
-
|
558 |
-
.yith-icon-close:before {
|
559 |
-
content: "\e906";
|
560 |
-
color: #757575;
|
561 |
-
}
|
562 |
-
|
563 |
-
.yith-icon-edit:before {
|
564 |
-
content: "\e907";
|
565 |
-
color: #757575;
|
566 |
-
}
|
567 |
-
|
568 |
-
.yith-icon-magnifier:before {
|
569 |
-
content: "\e908";
|
570 |
-
color: #757575;
|
571 |
-
}
|
572 |
-
|
573 |
-
.yith-icon-pencil:before {
|
574 |
-
content: "\e909";
|
575 |
-
color: #757575;
|
576 |
-
}
|
577 |
-
|
578 |
-
.yith-icon-plus:before {
|
579 |
-
content: "\e90a";
|
580 |
-
color: #757575;
|
581 |
-
}
|
582 |
-
|
583 |
-
.yith-icon-update:before {
|
584 |
-
content: "\e90b";
|
585 |
-
color: #757575;
|
586 |
-
}
|
587 |
-
|
588 |
-
.yith-icon-upload:before {
|
589 |
-
content: "\e90c";
|
590 |
-
color: #757575;
|
591 |
-
}
|
592 |
-
|
593 |
-
.yith-plugin-fw-banner {
|
594 |
-
width: 100%;
|
595 |
-
height: 75px;
|
596 |
-
background: url('../images/banner-premium.png');
|
597 |
-
}
|
598 |
-
|
599 |
-
.yith-plugin-fw-banner.yith-plugin-fw-banner-free {
|
600 |
-
height: 290px;
|
601 |
-
background: url('../images/banner-free.png') no-repeat;
|
602 |
-
}
|
603 |
-
|
604 |
-
.yith-plugin-fw-banner.yith-plugin-fw-banner-free h1 {
|
605 |
-
max-width: auto;
|
606 |
-
text-align: left;
|
607 |
-
margin-left: 110px;
|
608 |
-
padding-top: 15px;
|
609 |
-
padding-bottom: 8px;
|
610 |
-
}
|
611 |
-
|
612 |
-
.yith-plugin-fw-banner h1 {
|
613 |
-
text-transform: uppercase;
|
614 |
-
color: #0c5777;
|
615 |
-
font-size: 15px;
|
616 |
-
padding-left: 150px;
|
617 |
-
font-weight: 700;
|
618 |
-
text-align: left;
|
619 |
-
display: inline-block;
|
620 |
-
box-sizing: border-box;
|
621 |
-
}
|
622 |
-
|
623 |
-
.yith-plugin-fw-banner span {
|
624 |
-
font-style: italic;
|
625 |
-
display: block;
|
626 |
-
font-size: 15px;
|
627 |
-
color: #214249;
|
628 |
-
text-transform: none;
|
629 |
-
text-align: right;
|
630 |
-
}
|
631 |
-
|
632 |
-
.yith-plugin-fw-banner a,
|
633 |
-
.yith-plugin-fw-banner a:focus {
|
634 |
-
text-decoration: none;
|
635 |
-
outline: none;
|
636 |
-
box-shadow: none;
|
637 |
-
}
|
638 |
-
|
639 |
-
.yith-banners ul {
|
640 |
-
list-style: none;
|
641 |
-
margin-left: 10px;
|
642 |
-
}
|
643 |
-
|
644 |
-
.yith-banners ul li {
|
645 |
-
display: inline-block;
|
646 |
-
margin-left: 10px;
|
647 |
-
}
|
648 |
-
|
649 |
-
.yith-plugin-ui a {
|
650 |
-
outline: none;
|
651 |
-
box-shadow: none;
|
652 |
-
}
|
653 |
-
|
654 |
-
.yith-plugin-ui {
|
655 |
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
656 |
-
}
|
657 |
-
|
658 |
-
.yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper {
|
659 |
-
margin-top: 10px;
|
660 |
-
}
|
661 |
-
|
662 |
-
.yith-plugin-ui .nav-tab {
|
663 |
-
margin-left: 0px;
|
664 |
-
margin-right: 2px;
|
665 |
-
background-color: #336374;
|
666 |
-
color: #fff;
|
667 |
-
font-size: 15px;
|
668 |
-
padding: 7px 20px;
|
669 |
-
border: 0;
|
670 |
-
}
|
671 |
-
|
672 |
-
.yith-plugin-ui .nav-tab:first-child {
|
673 |
-
border-left: 1px solid #d9d9d9;
|
674 |
-
}
|
675 |
-
|
676 |
-
.yith-plugin-ui .nav-tab.yith-premium {
|
677 |
-
background-color: #be421c;
|
678 |
-
}
|
679 |
-
|
680 |
-
.yith-plugin-ui .nav-tab-active {
|
681 |
-
background-color: #fff;
|
682 |
-
color: #336374;
|
683 |
-
border-bottom: 1px solid #fff;
|
684 |
-
}
|
685 |
-
|
686 |
-
.yith-plugin-ui .nav-tab-active.yith-premium {
|
687 |
-
background-color: #fff;
|
688 |
-
color: #be421c;
|
689 |
-
}
|
690 |
-
|
691 |
-
.yith-plugin-ui #plugin-fw-wc {
|
692 |
-
padding-top: 0px;
|
693 |
-
}
|
694 |
-
|
695 |
-
.yith-plugin-ui .form-table td {
|
696 |
-
padding: 15px 20px;
|
697 |
-
}
|
698 |
-
|
699 |
-
.yith-plugin-ui.metaboxes-tab label {
|
700 |
-
color: #33373b;
|
701 |
-
font-size: 14px;
|
702 |
-
margin-left: -248px;
|
703 |
-
}
|
704 |
-
|
705 |
-
.yith-plugin-ui.metaboxes-tab .the-metabox {
|
706 |
-
margin: 40px 0 40px 290px;
|
707 |
-
margin-left: 264px;
|
708 |
-
}
|
709 |
-
|
710 |
-
.yith-plugin-ui.metaboxes-tab label {
|
711 |
-
width: 200px;
|
712 |
-
font-weight: 600;
|
713 |
-
}
|
714 |
-
|
715 |
-
.yith-plugin-ui span.description {
|
716 |
-
color: #716269;
|
717 |
-
font-size: 14px;
|
718 |
-
font-style: normal;
|
719 |
-
font-weight: 400;
|
720 |
-
margin-top: 15px;
|
721 |
-
margin-left: 0;
|
722 |
-
}
|
723 |
-
|
724 |
-
#wpwrap .yith-plugin-ui h2.nav-tab-wrapper, #wpbody-content .yith-plugin-ui h2.nav-tab-wrapper {
|
725 |
-
border: 0;
|
726 |
-
border-bottom: 1px solid #ccc;
|
727 |
-
margin-right: 15px;
|
728 |
-
margin-bottom: 0;
|
729 |
-
background-color: transparent;
|
730 |
-
padding-left: 0;
|
731 |
-
}
|
732 |
-
|
733 |
-
.yith-plugin-ui #plugin-fw-wc table.form-table,
|
734 |
-
.yith-plugin-ui #yith-plugin-fw-panel table.form-table,
|
735 |
-
.yith-plugin-ui table.form-table {
|
736 |
-
border: 1px solid #d8d8d8;
|
737 |
-
border-top: 0;
|
738 |
-
margin-bottom: 40px;
|
739 |
-
}
|
740 |
-
|
741 |
-
.yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper {
|
742 |
-
background-color: transparent;
|
743 |
-
border: 0;
|
744 |
-
text-transform: none;
|
745 |
-
border-bottom: 1px solid #ddd;
|
746 |
-
}
|
747 |
-
|
748 |
-
.yith-plugin-ui h2 {
|
749 |
-
color: #2a8db0;
|
750 |
-
font-size: 15px;
|
751 |
-
text-transform: uppercase;
|
752 |
-
border: 1px solid #d8d8d8;
|
753 |
-
border-bottom: 0;
|
754 |
-
background-color: #fff;
|
755 |
-
padding: 35px 20px;
|
756 |
-
margin: 0px;
|
757 |
-
}
|
758 |
-
|
759 |
-
.yith-plugin-ui .yith-plugin-fw-custom-tab h2 {
|
760 |
-
border: 0px solid #d8d8d8;
|
761 |
-
padding-left: 0;
|
762 |
-
}
|
763 |
-
|
764 |
-
.yith-plugin-ui #plugin-fw-wc table.form-table th, #yith-plugin-fw-panel table.form-table th.titledesc, .yith-plugin-ui #plugin-fw-wc table.form-table td, #yith-plugin-fw-panel table.form-table td.forminp {
|
765 |
-
padding: 30px 20px;
|
766 |
-
}
|
767 |
-
|
768 |
-
.yith-plugin-ui #plugin-fw-wc h2 + div {
|
769 |
-
background: #fff;
|
770 |
-
border-left: 1px solid #d9d9d9;
|
771 |
-
border-right: 1px solid #d9d9d9;
|
772 |
-
margin: -20px 0 0 0;
|
773 |
-
padding-left: 20px;
|
774 |
-
padding-bottom: 5px;
|
775 |
-
}
|
776 |
-
|
777 |
-
.yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box {
|
778 |
-
background: #f1f1f1;
|
779 |
-
font-size: 14px;
|
780 |
-
font-weight: 700;
|
781 |
-
width: 40%;
|
782 |
-
display: block;
|
783 |
-
padding: 15px;
|
784 |
-
margin-bottom: 0;
|
785 |
-
}
|
786 |
-
|
787 |
-
.yith-plugin-ui #plugin-fw-wc h2 + div p:before, .yith-plugin-ui p.info-box:before {
|
788 |
-
content: "\e90e";
|
789 |
-
font-family: yith-icon;
|
790 |
-
font-size: 30px;
|
791 |
-
font-weight: normal;
|
792 |
-
display: block;
|
793 |
-
margin-top: -5px;
|
794 |
-
float: left;
|
795 |
-
margin-right: 15px;
|
796 |
-
}
|
797 |
-
|
798 |
-
.yith-plugin-ui h2:first-child {
|
799 |
-
border-top: 0;
|
800 |
-
}
|
801 |
-
|
802 |
-
/*** Icon ***/
|
803 |
-
.yith-plugin-ui span.yith-icon {
|
804 |
-
margin-left: -36px;
|
805 |
-
line-height: 36px;
|
806 |
-
font-size: 20px;
|
807 |
-
}
|
808 |
-
|
809 |
-
/*** General Input Style ***/
|
810 |
-
|
811 |
-
.yith-plugin-ui .yith-plugin-fw select,
|
812 |
-
.yith-plugin-ui textarea,
|
813 |
-
.yith-plugin-ui input[type=number],
|
814 |
-
.yith-plugin-ui.metaboxes-tab input[type=number],
|
815 |
-
.yith-plugin-ui input[type=text],
|
816 |
-
.yith-plugin-ui input[type=text],
|
817 |
-
.yith-plugin-ui input[type=email],
|
818 |
-
.yith-plugin-ui input[type=password],
|
819 |
-
.yith-plugin-ui .search-box input[name="s"],
|
820 |
-
.yith-plugin-fw.yith-plugin-ui input[type=text]:not(.select2-search__field),
|
821 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text]:not(.select2-search__field),
|
822 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table select,
|
823 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea,
|
824 |
-
.woocommerce .yith-plugin-fw table.form-table input[type=password],
|
825 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=number],
|
826 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text] {
|
827 |
-
border: 1px solid #d8d8d8;
|
828 |
-
border-radius: 8px;
|
829 |
-
padding: 8px 10px;
|
830 |
-
height: 38px;
|
831 |
-
min-width: 90px;
|
832 |
-
box-shadow: none;
|
833 |
-
color: #716269;
|
834 |
-
}
|
835 |
-
|
836 |
-
.yith-plugin-ui textarea,
|
837 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea {
|
838 |
-
height: auto;
|
839 |
-
}
|
840 |
-
|
841 |
-
.yith-plugin-ui table.form-table input[type=text].wp-color-picker,
|
842 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
|
843 |
-
border: 0;
|
844 |
-
height: 30px;
|
845 |
-
max-width: 121px;
|
846 |
-
font-size: 11px;
|
847 |
-
padding: 0;
|
848 |
-
|
849 |
-
}
|
850 |
-
|
851 |
-
.yith-plugin-ui .search-box input[name="s"] {
|
852 |
-
height: 35px;
|
853 |
-
}
|
854 |
-
|
855 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].small-text,
|
856 |
-
.yith-plugin-ui input[type=text].small-text {
|
857 |
-
width: 100px;
|
858 |
-
height: 25px;
|
859 |
-
border: 1px solid #d9d9d9;
|
860 |
-
}
|
861 |
-
|
862 |
-
.yith-plugin-ui textarea {
|
863 |
-
height: auto;
|
864 |
-
padding: 8px;
|
865 |
-
}
|
866 |
-
|
867 |
-
.yith-plugin-ui select:focus,
|
868 |
-
.yith-plugin-ui input:focus {
|
869 |
-
border-color: #a7d9ec !important;
|
870 |
-
}
|
871 |
-
|
872 |
-
.woocommerce .yith-plugin-ui table.form-table select,
|
873 |
-
.yith-plugin-ui select {
|
874 |
-
-webkit-appearance: none;
|
875 |
-
line-height: 1.2em;
|
876 |
-
min-height: 35px;
|
877 |
-
background: url("../images/arrow_down.svg") no-repeat right center;
|
878 |
-
background-size: 35px 13px;
|
879 |
-
border-radius: 8px;
|
880 |
-
padding-left: 10px;
|
881 |
-
}
|
882 |
-
|
883 |
-
.yith-plugin-ui .form-table th {
|
884 |
-
width: 200px;
|
885 |
-
padding-right: 50px;
|
886 |
-
}
|
887 |
-
|
888 |
-
/** BUTTONS **/
|
889 |
-
.wp-core-ui .yith-plugin-ui .button-primary,
|
890 |
-
.wp-core-ui .yith-plugin-ui .button-secondary,
|
891 |
-
.yith-plugin-ui .yith-add-button,
|
892 |
-
.yith-plugin-ui .yith-save-button,
|
893 |
-
.yith-plugin-ui .yith-edit-button,
|
894 |
-
.yith-plugin-ui .yith-update-button,
|
895 |
-
.yith-plugin-ui .yith-plugin-fw-select-all,
|
896 |
-
.yith-plugin-ui .yith-plugin-fw-deselect-all,
|
897 |
-
.yith-plugin-ui .yith-plugin-fw-upload-button,
|
898 |
-
.yith-plugin-ui .yith-plugin-fw-upload-button-reset {
|
899 |
-
border-radius: 3px;
|
900 |
-
text-transform: uppercase;
|
901 |
-
box-shadow: none;
|
902 |
-
border: 0;
|
903 |
-
font-weight: 700;
|
904 |
-
font-size: 11px;
|
905 |
-
padding: 0px 14px;
|
906 |
-
outline: none;
|
907 |
-
height: auto;
|
908 |
-
transition: all ease 0.3s;
|
909 |
-
background-color: #d6d6d6;
|
910 |
-
color: #656565;
|
911 |
-
text-shadow: none;
|
912 |
-
vertical-align: middle;
|
913 |
-
line-height: 26px;
|
914 |
-
display: inline-block;
|
915 |
-
text-decoration: none;
|
916 |
-
cursor: pointer;
|
917 |
-
}
|
918 |
-
|
919 |
-
.wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
|
920 |
-
.wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button,
|
921 |
-
.yith-plugin-ui .yith-plugin-fw-upload-button-reset,
|
922 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
|
923 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button {
|
924 |
-
height: 38px;
|
925 |
-
}
|
926 |
-
|
927 |
-
.wp-core-ui .yith-plugin-ui .button:focus,
|
928 |
-
.wp-core-ui .yith-plugin-ui .button-primary:focus,
|
929 |
-
.yith-plugin-ui .yith-add-button:focus,
|
930 |
-
.yith-plugin-ui .yith-save-button:focus,
|
931 |
-
.yith-plugin-ui .yith-edit-button:focus,
|
932 |
-
.yith-plugin-ui .yith-update-button:focus,
|
933 |
-
.wp-core-ui .yith-plugin-ui .button-secondary:focus {
|
934 |
-
outline: none;
|
935 |
-
box-shadow: none;
|
936 |
-
}
|
937 |
-
|
938 |
-
.wp-core-ui .yith-plugin-ui .button-xl {
|
939 |
-
padding: 0px 20px;
|
940 |
-
font-size: 14px;
|
941 |
-
line-height: 38px;
|
942 |
-
display: inline-block;
|
943 |
-
font-weight: 600;
|
944 |
-
}
|
945 |
-
|
946 |
-
/** button with inside a span with icon class */
|
947 |
-
.yith-plugin-ui .button-secondary span.yith-icon {
|
948 |
-
margin-left: 0px;
|
949 |
-
margin-right: 10px;
|
950 |
-
line-height: normal;
|
951 |
-
}
|
952 |
-
|
953 |
-
.yith-plugin-ui .button-secondary span.yith-icon:before {
|
954 |
-
color: #656565;
|
955 |
-
font-size: 15px;
|
956 |
-
}
|
957 |
-
|
958 |
-
|
959 |
-
.wp-core-ui .yith-plugin-ui .button:focus,
|
960 |
-
.wp-core-ui .yith-plugin-ui .button-secondary:focus,
|
961 |
-
.yith-plugin-ui .yith-save-button:hover,
|
962 |
-
.wp-core-ui .yith-plugin-ui .button-secondary:hover,
|
963 |
-
.yith-plugin-ui .yith-plugin-fw-upload-button-reset:hover {
|
964 |
-
background-color: #cacaca;
|
965 |
-
color: #515151;
|
966 |
-
}
|
967 |
-
|
968 |
-
.wp-core-ui .yith-plugin-ui .button-primary,
|
969 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all,
|
970 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button {
|
971 |
-
background-color: #007694;
|
972 |
-
color: #fff;
|
973 |
-
}
|
974 |
-
|
975 |
-
|
976 |
-
.yith-plugin-ui .yith-add-button,
|
977 |
-
.wp-core-ui .yith-plugin-ui .button-primary:focus,
|
978 |
-
.wp-core-ui .yith-plugin-ui .button-primary:hover {
|
979 |
-
background-color: #375f6b;
|
980 |
-
color: #fff;
|
981 |
-
cursor: pointer;
|
982 |
-
}
|
983 |
-
|
984 |
-
|
985 |
-
.yith-plugin-ui .yith-add-button:hover,
|
986 |
-
.wp-core-ui .yith-plugin-ui .yith-plugin-fw-upload-button:focus,
|
987 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:hover,
|
988 |
-
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:focus,
|
989 |
-
.yith-plugin-ui .yith-plugin-fw-upload-button:hover {
|
990 |
-
border-color: #007694;
|
991 |
-
background: #007694;
|
992 |
-
color: #fff;
|
993 |
-
line-height: 26px;
|
994 |
-
margin-left: 0;
|
995 |
-
}
|
996 |
-
|
997 |
-
.yith-plugin-ui .button-primary:before,
|
998 |
-
.yith-plugin-ui .yith-add-button:before,
|
999 |
-
.yith-plugin-ui .yith-save-button:before,
|
1000 |
-
.yith-plugin-ui .yith-edit-button:before,
|
1001 |
-
.yith-plugin-ui .yith-update-button:before,
|
1002 |
-
.yith-plugin-ui .button-secondary:before {
|
1003 |
-
font-family: 'yith-icon';
|
1004 |
-
font-size: 10px;
|
1005 |
-
font-weight: 700;
|
1006 |
-
margin-right: 10px;
|
1007 |
-
vertical-align: bottom;
|
1008 |
-
display: inline-block;
|
1009 |
-
}
|
1010 |
-
|
1011 |
-
/** yith-edit-button **/
|
1012 |
-
.yith-plugin-ui .yith-edit-button {
|
1013 |
-
background-color: #7f9298;
|
1014 |
-
color: #fff;
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
.yith-plugin-ui .yith-edit-button:focus,
|
1018 |
-
.yith-plugin-ui .yith-edit-button:hover {
|
1019 |
-
background-color: #718085;
|
1020 |
-
color: #fff;
|
1021 |
-
}
|
1022 |
-
|
1023 |
-
.yith-plugin-ui .yith-edit-button:before {
|
1024 |
-
content: "\e907";
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
/** yith-update-button **/
|
1028 |
-
.yith-plugin-ui .yith-update-button {
|
1029 |
-
background-color: #94aa09;
|
1030 |
-
color: #fff;
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
.yith-plugin-ui .yith-update-button:focus,
|
1034 |
-
.yith-plugin-ui .yith-update-button:hover {
|
1035 |
-
background-color: #7a9009;
|
1036 |
-
color: #fff;
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
.yith-plugin-ui .yith-update-button:before {
|
1040 |
-
content: "\e90b";
|
1041 |
-
font-size: 15px;
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
/** yith-save-button **/
|
1045 |
-
|
1046 |
-
.yith-plugin-ui .yith-save-button {
|
1047 |
-
background-color: #267390;
|
1048 |
-
color: #fff;
|
1049 |
-
}
|
1050 |
-
|
1051 |
-
.yith-plugin-ui .yith-save-button:focus,
|
1052 |
-
.yith-plugin-ui .yith-save-button:hover {
|
1053 |
-
background-color: #1c4863;
|
1054 |
-
color: #fff;
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
|
1058 |
-
/** yith-remove-button **/
|
1059 |
-
|
1060 |
-
.yith-plugin-ui .button-secondary.yith-remove-button:before {
|
1061 |
-
content: "\e90d";
|
1062 |
-
font-size: 15px;
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
|
1066 |
-
/** yith-add-button **/
|
1067 |
-
.yith-plugin-ui .yith-add-button:before {
|
1068 |
-
content: "\e90a";
|
1069 |
-
}
|
1070 |
-
|
1071 |
-
.yith-plugin-ui .yith-add-button.closed {
|
1072 |
-
background-color: #fff;
|
1073 |
-
color: #375f6b;
|
1074 |
-
border: 1px solid #375f6b;
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
.yith-plugin-ui .yith-add-button.closed:before {
|
1078 |
-
content: "\e906";
|
1079 |
-
}
|
1080 |
-
|
1081 |
-
|
1082 |
-
/** yith-plugin-fw-upload-button **/
|
1083 |
-
.yith-plugin-ui button.yith-plugin-fw-upload-button:before {
|
1084 |
-
content: "\e90c";
|
1085 |
-
font-family: 'yith-icon';
|
1086 |
-
font-size: 19px;
|
1087 |
-
font-weight: 400;
|
1088 |
-
margin-right: 10px;
|
1089 |
-
vertical-align: middle;
|
1090 |
-
display: inline-block;
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
/** SELECT 2 **/
|
1094 |
-
.yith-plugin-ui .select2-container,
|
1095 |
-
.yith-plugin-ui .select2-selection--single {
|
1096 |
-
height: auto;
|
1097 |
-
padding: 2px;
|
1098 |
-
outline: none;
|
1099 |
-
}
|
1100 |
-
|
1101 |
-
.yith-plugin-ui .select2-selection--single {
|
1102 |
-
margin: 0;
|
1103 |
-
border: 0;
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
/* old panel*/
|
1107 |
-
|
1108 |
-
.yith-plugin-ui span.select2.select2-container.select2-container--default {
|
1109 |
-
border: 1px solid #d8d8d8;
|
1110 |
-
border-radius: 8px;
|
1111 |
-
}
|
1112 |
-
|
1113 |
-
.yith-plugin-ui span.select2.select2-container.select2-container--default:hover,
|
1114 |
-
.yith-plugin-ui span.select2.select2-container.select2-container--default:active,
|
1115 |
-
.yith-plugin-ui span.select2.select2-container.select2-container--default:focus {
|
1116 |
-
border-color: #a7d9ec;
|
1117 |
-
}
|
1118 |
-
|
1119 |
-
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
1120 |
-
color: #fff;
|
1121 |
-
}
|
1122 |
-
|
1123 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].select2-search__field,
|
1124 |
-
.yith-plugin-ui .yith-plugin-fw table.form-table input.select2-search__field {
|
1125 |
-
border: 0;
|
1126 |
-
padding: 0;
|
1127 |
-
height: initial;
|
1128 |
-
}
|
1129 |
-
|
1130 |
-
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice,
|
1131 |
-
.yith-plugin-ui .select2-selection__choice {
|
1132 |
-
color: #fff;
|
1133 |
-
background-color: #4e8ba2;
|
1134 |
-
border-radius: 12px;
|
1135 |
-
padding: 3px 11px;
|
1136 |
-
border-color: #33937e;
|
1137 |
-
font-size: 13px;
|
1138 |
-
}
|
1139 |
-
|
1140 |
-
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
1141 |
-
content: "\e900";
|
1142 |
-
font-family: 'yith-icon' !important;
|
1143 |
-
line-height: 36px;
|
1144 |
-
color: #d9d9d9;
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow b {
|
1148 |
-
display: none;
|
1149 |
-
}
|
1150 |
-
|
1151 |
-
.yith-plugin-ui .select2-container--open .select2-dropdown--below,
|
1152 |
-
.yith-plugin-ui .select2-container--open .select2-dropdown--above,
|
1153 |
-
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--below,
|
1154 |
-
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
|
1155 |
-
margin-top: 10px;
|
1156 |
-
border-radius: 8px;
|
1157 |
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 10px 0 rgba(0, 0, 0, 0.12) !important;
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
.yith-plugin-ui .select2-container--open .select2-dropdown--above,
|
1161 |
-
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
|
1162 |
-
margin-top: -10px;
|
1163 |
-
}
|
1164 |
-
|
1165 |
-
.yith-plugin-ui .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
|
1166 |
-
.yith-plugin-ui .select2-container--default.select2-container--open.select2-container--above .select2-selection--single,
|
1167 |
-
.yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
|
1168 |
-
.yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--above .select2-selection--single {
|
1169 |
-
border-radius: 8px;
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
.yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:first-child,
|
1173 |
-
.yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:first-child {
|
1174 |
-
border-top-left-radius: 8px;
|
1175 |
-
border-top-right-radius: 8px;
|
1176 |
-
}
|
1177 |
-
.yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:last-child,
|
1178 |
-
.yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:last-child,
|
1179 |
-
.yith-plugin-ui .select2-results .select2-results__group,
|
1180 |
-
.yith-plugin-ui .select2-results .select2-results__option:last-child,
|
1181 |
-
.yith-plugin-fw-panel .select2-results .select2-results__group,
|
1182 |
-
.yith-plugin-fw-panel .select2-results .select2-results__option:last-child,
|
1183 |
-
.yith-plugin-ui .select2-results .select2-results__group,
|
1184 |
-
.yith-plugin-ui .select2-results .select2-results__option:last-child,
|
1185 |
-
.yith-plugin-fw-panel .select2-results .select2-results__group,
|
1186 |
-
.yith-plugin-fw-panel .select2-results .select2-results__option:last-child {
|
1187 |
-
border-bottom-left-radius: 8px;
|
1188 |
-
border-bottom-right-radius: 8px;
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
.yith-plugin-ui .select2-dropdown{
|
1192 |
-
border: 0;
|
1193 |
-
}
|
1194 |
-
.yith-plugin-ui .select2-container--default .select2-results__option[data-selected=true],
|
1195 |
-
.yith-plugin-ui .select2-container--default .select2-results__option[aria-selected=true],
|
1196 |
-
.yith-plugin-fw-panel .select2-container--default .select2-results__option[data-selected=true],
|
1197 |
-
.yith-plugin-fw-panel .select2-container--default .select2-results__option[aria-selected=true] {
|
1198 |
-
background-color: #fff;
|
1199 |
-
outline: none;
|
1200 |
-
}
|
1201 |
-
|
1202 |
-
.yith-plugin-ui .select2-container--default .select2-results__option--highlighted[aria-selected],
|
1203 |
-
.yith-plugin-ui .select2-container--default .select2-results__option--highlighted[data-selected],
|
1204 |
-
.yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[aria-selected],
|
1205 |
-
.yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[data-selected] {
|
1206 |
-
background-color: #e8eff1;
|
1207 |
-
color: #4e8ba2;
|
1208 |
-
outline: none;
|
1209 |
-
}
|
1210 |
-
|
1211 |
-
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove,
|
1212 |
-
.yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
1213 |
-
float: right;
|
1214 |
-
padding-left: 15px;
|
1215 |
-
text-indent: -9999px;
|
1216 |
-
}
|
1217 |
-
|
1218 |
-
|
1219 |
-
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
|
1220 |
-
.woocommerce .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
|
1221 |
-
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1222 |
-
float: right;
|
1223 |
-
color: #fff;
|
1224 |
-
content: "\e906";
|
1225 |
-
font-family: 'yith-icon' !important;
|
1226 |
-
font-size: 9px;
|
1227 |
-
line-height: 21px;
|
1228 |
-
text-indent: 0;
|
1229 |
-
}
|
1230 |
-
|
1231 |
-
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1232 |
-
color: #000;
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after
|
1236 |
-
.yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1237 |
-
color: #000;
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
.yith-plugin-ui .select2-container .select2-selection--multiple,
|
1241 |
-
.yith-plugin-ui .select2-container--default.select2-container--focus .select2-selection--multiple {
|
1242 |
-
border: 0;
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
.yith-plugin-fw .select2-search input[type=text] {
|
1246 |
-
border: 0;
|
1247 |
-
padding: 0;
|
1248 |
-
height: auto;
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
.yith-plugin-ui .yith-plugin-fw-select-field-wrapper span.yith-icon.yith-icon-magnifier,
|
1252 |
-
.yith-plugin-fw-panel .yith-plugin-fw-select-field-wrapper span.yith-icon.yith-icon-magnifier {
|
1253 |
-
position: absolute;
|
1254 |
-
padding-top: 5px;
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
.yith-plugin-ui input[type=text].select2-search__field {
|
1258 |
-
border: 0;
|
1259 |
-
padding: 0;
|
1260 |
-
height: 30px;
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
.yith-plugin-ui .select2-container--default .select2-search--dropdown .select2-search__field,
|
1264 |
-
.yith-plugin-fw-panel .select2-container--default .select2-search--dropdown .select2-search__field {
|
1265 |
-
border: 1px solid #d9d9d9;
|
1266 |
-
border-radius: 8px;
|
1267 |
-
box-shadow: none;
|
1268 |
-
}
|
1269 |
-
|
1270 |
-
.yith-plugin-ui .select2-dropdown,
|
1271 |
-
.yith-plugin-fw-panel .select2-dropdown {
|
1272 |
-
border: 1px solid #d9d9d9;
|
1273 |
-
}
|
1274 |
-
|
1275 |
-
/** RADIO BUTTON **/
|
1276 |
-
.yith-plugin-ui [type="radio"]:checked,
|
1277 |
-
.yith-plugin-ui [type="radio"]:not(:checked) {
|
1278 |
-
position: absolute;
|
1279 |
-
left: -9999px;
|
1280 |
-
}
|
1281 |
-
|
1282 |
-
.yith-plugin-ui [type="radio"]:checked + label,
|
1283 |
-
.yith-plugin-ui [type="radio"]:not(:checked) + label {
|
1284 |
-
position: relative;
|
1285 |
-
padding-left: 35px;
|
1286 |
-
cursor: pointer;
|
1287 |
-
line-height: 20px;
|
1288 |
-
display: inline-block;
|
1289 |
-
color: #716269;
|
1290 |
-
font-size: 14px;
|
1291 |
-
}
|
1292 |
-
|
1293 |
-
.yith-plugin-ui [type="radio"]:checked + label:before,
|
1294 |
-
.yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
1295 |
-
content: '';
|
1296 |
-
position: absolute;
|
1297 |
-
left: 0;
|
1298 |
-
top: 0;
|
1299 |
-
width: 19px;
|
1300 |
-
height: 19px;
|
1301 |
-
border: 1px solid #d8d8d8;
|
1302 |
-
border-radius: 100%;
|
1303 |
-
background: #fff;
|
1304 |
-
}
|
1305 |
-
|
1306 |
-
.yith-plugin-ui [type="radio"]:checked + label:after,
|
1307 |
-
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1308 |
-
content: '';
|
1309 |
-
width: 13px;
|
1310 |
-
height: 13px;
|
1311 |
-
background: #4e8ba2;
|
1312 |
-
position: absolute;
|
1313 |
-
top: 4px;
|
1314 |
-
left: 4px;
|
1315 |
-
border-radius: 100%;
|
1316 |
-
-webkit-transition: all 0.2s ease;
|
1317 |
-
transition: all 0.2s ease;
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1321 |
-
opacity: 0;
|
1322 |
-
-webkit-transform: scale(0);
|
1323 |
-
transform: scale(0);
|
1324 |
-
}
|
1325 |
-
|
1326 |
-
.yith-plugin-ui [type="radio"]:checked + label:after {
|
1327 |
-
opacity: 1;
|
1328 |
-
-webkit-transform: scale(1);
|
1329 |
-
transform: scale(1);
|
1330 |
-
}
|
1331 |
-
|
1332 |
-
/** CHECKBOX **/
|
1333 |
-
.yith-plugin-ui input[type="checkbox"] {
|
1334 |
-
-webkit-appearance: none;
|
1335 |
-
background-color: #fff;
|
1336 |
-
border: 1px solid #d8d8d8;
|
1337 |
-
box-shadow: none;
|
1338 |
-
width: 18px;
|
1339 |
-
height: 18px;
|
1340 |
-
border-radius: 3px;
|
1341 |
-
display: inline-block;
|
1342 |
-
position: relative;
|
1343 |
-
margin-right: 10px;
|
1344 |
-
}
|
1345 |
-
|
1346 |
-
.yith-plugin-ui input[type="checkbox"]:checked {
|
1347 |
-
background-color: #4e8ba2;
|
1348 |
-
border-color: #488197;
|
1349 |
-
}
|
1350 |
-
|
1351 |
-
.yith-plugin-ui .forminp-checkbox span.description.inline {
|
1352 |
-
margin-left: 10px;
|
1353 |
-
}
|
1354 |
-
|
1355 |
-
.yith-plugin-ui input[type="checkbox"]:checked:before {
|
1356 |
-
display: none;
|
1357 |
-
}
|
1358 |
-
|
1359 |
-
.yith-plugin-ui input[type="checkbox"]:checked:after {
|
1360 |
-
content: "\e905";
|
1361 |
-
font-family: 'yith-icon';
|
1362 |
-
font-size: 15px;
|
1363 |
-
position: absolute;
|
1364 |
-
top: 8px;
|
1365 |
-
left: 1px;
|
1366 |
-
color: #fff;
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
/** ONOFF **/
|
1370 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input[type="checkbox"] {
|
1371 |
-
display: none;
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1375 |
-
border: 1px solid #d8d8d8;
|
1376 |
-
background-color: #fff;
|
1377 |
-
width: 60px;
|
1378 |
-
height: 24px;
|
1379 |
-
}
|
1380 |
-
|
1381 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1382 |
-
background-color: #d8d8d8;
|
1383 |
-
}
|
1384 |
-
|
1385 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1386 |
-
width: 14px;
|
1387 |
-
height: 14px;
|
1388 |
-
top: 5px;
|
1389 |
-
left: 6px;
|
1390 |
-
background-color: #d8d8d8;
|
1391 |
-
}
|
1392 |
-
|
1393 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
|
1394 |
-
content: 'OFF';
|
1395 |
-
width: 14px;
|
1396 |
-
height: 14px;
|
1397 |
-
font-size: 13px;
|
1398 |
-
font-weight: 600;
|
1399 |
-
padding-left: 27px;
|
1400 |
-
color: #979797;
|
1401 |
-
margin-top: 5px;
|
1402 |
-
display: inline-block;
|
1403 |
-
}
|
1404 |
-
|
1405 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
|
1406 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span {
|
1407 |
-
background-color: #fff;
|
1408 |
-
border-color: #98aa36;
|
1409 |
-
}
|
1410 |
-
|
1411 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1412 |
-
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1413 |
-
background-color: #98aa36;
|
1414 |
-
left: 41px;
|
1415 |
-
}
|
1416 |
-
|
1417 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
1418 |
-
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
|
1419 |
-
content: 'ON';
|
1420 |
-
color: #98aa36;
|
1421 |
-
width: 14px;
|
1422 |
-
height: 14px;
|
1423 |
-
display: inline-block;
|
1424 |
-
font-size: 13px;
|
1425 |
-
font-weight: 600;
|
1426 |
-
padding: 0 10px;
|
1427 |
-
margin-top: 5px;
|
1428 |
-
}
|
1429 |
-
|
1430 |
-
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1431 |
-
text-indent: 0;
|
1432 |
-
}
|
1433 |
-
|
1434 |
-
|
1435 |
-
/**
|
1436 |
-
DATEPICKER
|
1437 |
-
*/
|
1438 |
-
.yith-plugin-ui div#ui-datepicker-div,
|
1439 |
-
.yith-plugin-fw-panel div#ui-datepicker-div {
|
1440 |
-
border: 0;
|
1441 |
-
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 10px 0 rgba(0, 0, 0, 0.12) !important;
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
.yith-plugin-ui .ui-datepicker-header.ui-widget-header,
|
1445 |
-
.yith-plugin-fw-panel .ui-datepicker-header.ui-widget-header {
|
1446 |
-
background: #4e8ba2;
|
1447 |
-
color: #fff;
|
1448 |
-
font-size: 11px;
|
1449 |
-
line-height: 25px;
|
1450 |
-
border: 0;
|
1451 |
-
min-height: 25px;
|
1452 |
-
}
|
1453 |
-
|
1454 |
-
.yith-plugin-ui .ui-datepicker-title,
|
1455 |
-
.yith-plugin-fw-panel .ui-datepicker-title {
|
1456 |
-
line-height: 25px;
|
1457 |
-
}
|
1458 |
-
|
1459 |
-
.yith-plugin-ui .ui-datepicker th,
|
1460 |
-
.yith-plugin-fw-panel .ui-datepicker th {
|
1461 |
-
color: #716269;
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
.yith-plugin-ui .ui-widget-header .ui-icon,
|
1465 |
-
.yith-plugin-ui .ui-widget-header .ui-state-hover,
|
1466 |
-
.yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
|
1467 |
-
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1468 |
-
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w,
|
1469 |
-
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e,
|
1470 |
-
.yith-plugin-fw-panel .ui-widget-header .ui-icon,
|
1471 |
-
.yith-plugin-fw-panel .ui-widget-header .ui-state-hover,
|
1472 |
-
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
|
1473 |
-
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1474 |
-
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w,
|
1475 |
-
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e {
|
1476 |
-
background: none;
|
1477 |
-
content: "";
|
1478 |
-
border: 0;
|
1479 |
-
text-indent: 0;
|
1480 |
-
width: 15px;
|
1481 |
-
height: 20px;
|
1482 |
-
display: block;
|
1483 |
-
overflow: hidden;
|
1484 |
-
}
|
1485 |
-
|
1486 |
-
.yith-plugin-ui .yith-password-wrapper {
|
1487 |
-
display: inline-block;
|
1488 |
-
width: auto;
|
1489 |
-
position: relative;
|
1490 |
-
}
|
1491 |
-
|
1492 |
-
.yith-plugin-ui .yith-password-wrapper .yith-password-eye-closed:before,
|
1493 |
-
.yith-plugin-ui .yith-password-wrapper .yith-password-eye:before {
|
1494 |
-
content: '\e911';
|
1495 |
-
color: #999;
|
1496 |
-
font-family: 'yith-icon';
|
1497 |
-
font-size: 20px;
|
1498 |
-
font-weight: normal;
|
1499 |
-
width: 15px;
|
1500 |
-
display: block;
|
1501 |
-
position: absolute;
|
1502 |
-
right: 13px;
|
1503 |
-
top: 0;
|
1504 |
-
line-height: 38px;
|
1505 |
-
bottom: 0;
|
1506 |
-
cursor: pointer;
|
1507 |
-
}
|
1508 |
-
|
1509 |
-
.yith-plugin-ui .yith-password-wrapper .yith-password-eye-closed:before {
|
1510 |
-
content: '\e912';
|
1511 |
-
}
|
1512 |
-
|
1513 |
-
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w:before,
|
1514 |
-
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w:before {
|
1515 |
-
content: "\e901";
|
1516 |
-
color: #fff;
|
1517 |
-
font-family: 'yith-icon';
|
1518 |
-
font-size: 12px;
|
1519 |
-
font-weight: normal;
|
1520 |
-
width: 15px;
|
1521 |
-
display: block;
|
1522 |
-
}
|
1523 |
-
|
1524 |
-
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e:before,
|
1525 |
-
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e:before {
|
1526 |
-
content: "\e902";
|
1527 |
-
color: #fff;
|
1528 |
-
text-indent: 0;
|
1529 |
-
font-family: 'yith-icon';
|
1530 |
-
font-size: 12px;
|
1531 |
-
font-weight: normal;
|
1532 |
-
width: 15px;
|
1533 |
-
display: block;
|
1534 |
-
}
|
1535 |
-
|
1536 |
-
/* arrow */
|
1537 |
-
.yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
|
1538 |
-
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1539 |
-
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1540 |
-
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-next-hover,
|
1541 |
-
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
|
1542 |
-
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1543 |
-
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1544 |
-
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-next-hover {
|
1545 |
-
top: 1px;
|
1546 |
-
cursor: pointer;
|
1547 |
-
}
|
1548 |
-
|
1549 |
-
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev,
|
1550 |
-
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1551 |
-
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev,
|
1552 |
-
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover {
|
1553 |
-
left: 5px;
|
1554 |
-
}
|
1555 |
-
|
1556 |
-
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1557 |
-
.yith-plugin-ui .ui-datepicker-next.ui-datepicker-next-hover,
|
1558 |
-
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1559 |
-
.yith-plugin-fw-panel .ui-datepicker-next.ui-datepicker-next-hover {
|
1560 |
-
right: 1px;
|
1561 |
-
}
|
1562 |
-
|
1563 |
-
.yith-plugin-ui .ui-datepicker table,
|
1564 |
-
.yith-plugin-fw-panel .ui-datepicker table {
|
1565 |
-
font-size: 10px;
|
1566 |
-
}
|
1567 |
-
|
1568 |
-
.yith-plugin-ui .ui-state-default,
|
1569 |
-
.yith-plugin-ui .ui-widget-content .ui-state-default,
|
1570 |
-
.yith-plugin-ui .ui-widget-header .ui-state-default,
|
1571 |
-
.yith-plugin-fw-panel .ui-state-default,
|
1572 |
-
.yith-plugin-fw-panel .ui-widget-content .ui-state-default,
|
1573 |
-
.yith-plugin-fw-panel .ui-widget-header .ui-state-default {
|
1574 |
-
background: #fff;
|
1575 |
-
border: 1px solid #d9d9d9;
|
1576 |
-
|
1577 |
-
}
|
1578 |
-
|
1579 |
-
.yith-plugin-ui .ui-state-hover,
|
1580 |
-
.yith-plugin-ui .ui-widget-content .ui-state-hover,
|
1581 |
-
.yith-plugin-ui a.ui-state-default:focus,
|
1582 |
-
.yith-plugin-ui .ui-widget-content .ui-state-focus,
|
1583 |
-
.yith-plugin-ui .ui-widget-header .ui-state-focus,
|
1584 |
-
.yith-plugin-fw-panel .ui-state-hover,
|
1585 |
-
.yith-plugin-fw-panel .ui-widget-content .ui-state-hover,
|
1586 |
-
.yith-plugin-fw-panel a.ui-state-default:focus,
|
1587 |
-
.yith-plugin-fw-panel .ui-widget-content .ui-state-focus,
|
1588 |
-
.yith-plugin-fw-panel .ui-widget-header .ui-state-focus {
|
1589 |
-
background: #ebf1f3;
|
1590 |
-
border: 1px solid #bfd5dd;
|
1591 |
-
outline: none;
|
1592 |
-
box-shadow: none;
|
1593 |
-
}
|
1594 |
-
|
1595 |
-
.yith-plugin-ui .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus,
|
1596 |
-
.yith-plugin-fw-panel .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus {
|
1597 |
-
background: none;
|
1598 |
-
border: 0;
|
1599 |
-
}
|
1600 |
-
|
1601 |
-
/** colorpicker **/
|
1602 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .yith-colorpicker-group:not(:first-child) {
|
1603 |
-
margin-top: 20px;
|
1604 |
-
}
|
1605 |
-
|
1606 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .iris-picker,
|
1607 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-holder {
|
1608 |
-
display: none !important;
|
1609 |
-
}
|
1610 |
-
|
1611 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap,
|
1612 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap > * {
|
1613 |
-
display: inline-block !important;
|
1614 |
-
vertical-align: middle;
|
1615 |
-
}
|
1616 |
-
|
1617 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
|
1618 |
-
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .wp-picker-holder {
|
1619 |
-
display: block !important;
|
1620 |
-
}
|
1621 |
-
|
1622 |
-
.woocommerce .yith-plugin-ui .iris-picker {
|
1623 |
-
border: 0;
|
1624 |
-
margin-top: 20px;
|
1625 |
-
}
|
1626 |
-
|
1627 |
-
.yith-plugin-ui .yith-plugin-fw input[type=text].wp-color-picker {
|
1628 |
-
border: 0;
|
1629 |
-
padding: 2px 5px;
|
1630 |
-
height: 30px;
|
1631 |
-
}
|
1632 |
-
|
1633 |
-
.yith-plugin-ui .wp-color-result-text {
|
1634 |
-
display: none;
|
1635 |
-
}
|
1636 |
-
|
1637 |
-
.yith-plugin-ui .wp-picker-container .wp-color-result.button{
|
1638 |
-
height: 30px!important;
|
1639 |
-
}
|
1640 |
-
|
1641 |
-
.yith-plugin-ui .wp-picker-container .color-alpha {
|
1642 |
-
height: 28px!important;
|
1643 |
-
}
|
1644 |
-
|
1645 |
-
.yith-plugin-ui .wp-picker-container .wp-color-result.button {
|
1646 |
-
width: 30px;
|
1647 |
-
height: 30px;
|
1648 |
-
border: 0;
|
1649 |
-
box-shadow: none;
|
1650 |
-
border: 1px solid #d9d9d9;
|
1651 |
-
margin-bottom: 0;
|
1652 |
-
display: inline-block;
|
1653 |
-
vertical-align: middle;
|
1654 |
-
}
|
1655 |
-
|
1656 |
-
.yith-plugin-ui .wp-picker-default-custom {
|
1657 |
-
cursor: pointer;
|
1658 |
-
width: 25px;
|
1659 |
-
padding: 0 5px;
|
1660 |
-
display: inline-block;
|
1661 |
-
vertical-align: middle;
|
1662 |
-
position: relative;
|
1663 |
-
}
|
1664 |
-
|
1665 |
-
.yith-plugin-ui .wp-picker-default-custom input.button {
|
1666 |
-
opacity: 0;
|
1667 |
-
margin: 0;
|
1668 |
-
padding: 0;
|
1669 |
-
position: absolute;
|
1670 |
-
top: 0;
|
1671 |
-
right: 0;
|
1672 |
-
left: 0;
|
1673 |
-
bottom: 0;
|
1674 |
-
z-index: 2;
|
1675 |
-
}
|
1676 |
-
|
1677 |
-
.yith-plugin-ui .wp-picker-default-custom:before {
|
1678 |
-
content: "\e910";
|
1679 |
-
text-indent: 0;
|
1680 |
-
font-family: 'yith-icon';
|
1681 |
-
font-size: 20px;
|
1682 |
-
color: #d8d8d8;
|
1683 |
-
font-weight: normal;
|
1684 |
-
width: 15px;
|
1685 |
-
display: block;
|
1686 |
-
background: none;
|
1687 |
-
line-height: 20px;
|
1688 |
-
margin-left: 8px;
|
1689 |
-
}
|
1690 |
-
|
1691 |
-
.yith-plugin-ui .wp-picker-container {
|
1692 |
-
width: auto;
|
1693 |
-
display: inline-block;
|
1694 |
-
border: 1px solid #d9d9d9;
|
1695 |
-
border-radius: 8px;
|
1696 |
-
padding: 5px;
|
1697 |
-
}
|
1698 |
-
|
1699 |
-
.yith-plugin-ui .iris-picker .iris-square-inner {
|
1700 |
-
box-shadow: none;
|
1701 |
-
border: 1px solid #d9d9d9;
|
1702 |
-
}
|
1703 |
-
|
1704 |
-
.yith-plugin-ui .yith-single-colorpicker {
|
1705 |
-
display: inline-block;
|
1706 |
-
width: 220px;
|
1707 |
-
}
|
1708 |
-
|
1709 |
-
.yith-plugin-ui .yith-single-colorpicker > label {
|
1710 |
-
display: block;
|
1711 |
-
font-size: 11px;
|
1712 |
-
font-weight: 600;
|
1713 |
-
margin: 0 0 10px 0;
|
1714 |
-
}
|
1715 |
-
|
1716 |
-
/* RANGE SLIDER */
|
1717 |
-
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
|
1718 |
-
top: -45px !important;
|
1719 |
-
}
|
1720 |
-
|
1721 |
-
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
|
1722 |
-
position: absolute;
|
1723 |
-
top: -33px;
|
1724 |
-
left: 0;
|
1725 |
-
width: auto !important;
|
1726 |
-
height: auto !important;
|
1727 |
-
padding: 2px 8px;
|
1728 |
-
margin-left: -15px;
|
1729 |
-
font-size: 12px;
|
1730 |
-
line-height: 20px;
|
1731 |
-
color: #4e8ba2;
|
1732 |
-
text-align: center;
|
1733 |
-
background-color: #fff;
|
1734 |
-
border: 1px solid #fff;
|
1735 |
-
border-radius: 3px;
|
1736 |
-
-webkit-transition: opacity .3s ease-in-out 0s;
|
1737 |
-
transition: opacity .3s ease-in-out 0s;
|
1738 |
-
box-shadow: 0px 1px 7px 0px rgba(1, 1, 1, 0.13);
|
1739 |
-
}
|
1740 |
-
|
1741 |
-
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:before {
|
1742 |
-
position: absolute;
|
1743 |
-
bottom: -3px;
|
1744 |
-
left: 50%;
|
1745 |
-
display: inline-block;
|
1746 |
-
width: 6px;
|
1747 |
-
height: 6px;
|
1748 |
-
margin-left: -3px;
|
1749 |
-
content: "";
|
1750 |
-
background-color: #fff;
|
1751 |
-
-webkit-transform: rotate(-45deg);
|
1752 |
-
-ms-transform: rotate(-45deg);
|
1753 |
-
transform: rotate(-45deg);
|
1754 |
-
}
|
1755 |
-
|
1756 |
-
.yith-plugin-ui .ui-slider.ui-widget-content .ui-widget-header {
|
1757 |
-
background: #4e8ba2;
|
1758 |
-
}
|
1759 |
-
|
1760 |
-
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:after {
|
1761 |
-
content: '';
|
1762 |
-
width: 17px;
|
1763 |
-
height: 17px;
|
1764 |
-
display: block;
|
1765 |
-
position: absolute;
|
1766 |
-
background: #fff;
|
1767 |
-
top: 37px;
|
1768 |
-
border-radius: 50%;
|
1769 |
-
box-shadow: 0px 1px 6px 0px rgba(1, 1, 1, 0.25);
|
1770 |
-
}
|
1771 |
-
|
1772 |
-
.yith-plugin-ui .ui-slider.ui-widget-content {
|
1773 |
-
height: 5px !important;
|
1774 |
-
}
|
1775 |
-
|
1776 |
-
.yith-plugin-ui .ui-slider .minCaption,
|
1777 |
-
.yith-plugin-ui .ui-slider .maxCaption {
|
1778 |
-
font-weight: 700;
|
1779 |
-
font-size: 12px;
|
1780 |
-
}
|
1781 |
-
|
1782 |
-
|
1783 |
-
/* ADD_BOX AND TOGGLE */
|
1784 |
-
.yith-plugin-ui .yith-add-box,
|
1785 |
-
.yith-plugin-ui .yith-toggle-row {
|
1786 |
-
width: 70%;
|
1787 |
-
border: 1px solid #d9d9d9;
|
1788 |
-
box-shadow: none;
|
1789 |
-
border-radius: 4px;
|
1790 |
-
margin: 20px 0;
|
1791 |
-
padding: 10px;
|
1792 |
-
box-sizing: border-box;
|
1793 |
-
background: white;
|
1794 |
-
}
|
1795 |
-
|
1796 |
-
.yith-plugin-ui .yith-toggle-row {
|
1797 |
-
cursor: pointer;
|
1798 |
-
transition: all ease 0.5s;
|
1799 |
-
}
|
1800 |
-
|
1801 |
-
.yith-plugin-ui .yith-toggle-row.highlight {
|
1802 |
-
transition: all ease 0.5s;
|
1803 |
-
/*box-shadow: 0 0 7px rgb(81, 117, 129);*/
|
1804 |
-
box-shadow: 0 0 7px rgb(30, 140, 190);
|
1805 |
-
|
1806 |
-
display: block;
|
1807 |
-
}
|
1808 |
-
|
1809 |
-
.yith-plugin-ui .yith-add-box {
|
1810 |
-
padding: 25px;
|
1811 |
-
display: none;
|
1812 |
-
}
|
1813 |
-
|
1814 |
-
.yith-plugin-ui .yith-toggle-title {
|
1815 |
-
position: relative;
|
1816 |
-
}
|
1817 |
-
|
1818 |
-
.yith-plugin-ui #plugin-fw-wc .yith-toggle-title h3,
|
1819 |
-
.yith-plugin-ui.metaboxes-tab.yith-plugin-ui h3,
|
1820 |
-
.yith-plugin-ui .yith-toggle-title h3 {
|
1821 |
-
padding: 0px 20px 0px 25px;
|
1822 |
-
margin: 3px 0;
|
1823 |
-
|
1824 |
-
display: inline-block;
|
1825 |
-
position: relative;
|
1826 |
-
min-width: 173px;
|
1827 |
-
box-sizing: border-box;
|
1828 |
-
font-weight: 600;
|
1829 |
-
font-size: 15px;
|
1830 |
-
color: #23282d;
|
1831 |
-
text-transform: inherit;
|
1832 |
-
}
|
1833 |
-
|
1834 |
-
.yith-plugin-ui .yith-toggle-title .subtitle {
|
1835 |
-
padding-left: 0;
|
1836 |
-
padding-top: 8px;
|
1837 |
-
font-size: 12px;
|
1838 |
-
}
|
1839 |
-
|
1840 |
-
.yith-plugin-ui .yith-toggle {
|
1841 |
-
position: absolute;
|
1842 |
-
width: 30px;
|
1843 |
-
cursor: pointer;
|
1844 |
-
left: 0;
|
1845 |
-
top: 0;
|
1846 |
-
bottom: 0;
|
1847 |
-
margin: auto;
|
1848 |
-
display: flex;
|
1849 |
-
align-items: center;
|
1850 |
-
}
|
1851 |
-
|
1852 |
-
.yith-plugin-ui .yith-toggle > span:before {
|
1853 |
-
color: #405e69;
|
1854 |
-
}
|
1855 |
-
|
1856 |
-
.yith-plugin-ui .yith-toggle > span {
|
1857 |
-
position: absolute;
|
1858 |
-
right: 50%;
|
1859 |
-
transition: transform .3s;
|
1860 |
-
line-height: 1;
|
1861 |
-
}
|
1862 |
-
|
1863 |
-
|
1864 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle span {
|
1865 |
-
transform: rotateZ(90deg);
|
1866 |
-
}
|
1867 |
-
|
1868 |
-
.yith-plugin-ui .yith-toggle-content {
|
1869 |
-
display: none;
|
1870 |
-
position: relative;
|
1871 |
-
padding: 30px 25px;
|
1872 |
-
}
|
1873 |
-
|
1874 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content {
|
1875 |
-
/* display: block;*/
|
1876 |
-
}
|
1877 |
-
|
1878 |
-
.yith-plugin-ui .yith-add-box-row,
|
1879 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row {
|
1880 |
-
display: table;
|
1881 |
-
margin-bottom: 40px;
|
1882 |
-
}
|
1883 |
-
|
1884 |
-
.yith-plugin-ui .yith-add-box-row label,
|
1885 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row label {
|
1886 |
-
display: table-cell;
|
1887 |
-
width: 200px;
|
1888 |
-
padding-right: 21px;
|
1889 |
-
color: #33373b;
|
1890 |
-
font-size: 14px;
|
1891 |
-
vertical-align: top;
|
1892 |
-
font-weight: 600;
|
1893 |
-
}
|
1894 |
-
.yith-plugin-ui .yith-plugin-fw-radio__row label{
|
1895 |
-
font-weight: 400!important;
|
1896 |
-
}
|
1897 |
-
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
|
1898 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
1899 |
-
margin-top: 10px;
|
1900 |
-
width: auto;
|
1901 |
-
float: none;
|
1902 |
-
vertical-align: middle;
|
1903 |
-
position: relative;
|
1904 |
-
}
|
1905 |
-
|
1906 |
-
.yith-plugin-ui .yith-add-box-row span.yith-icon,
|
1907 |
-
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row span.yith-icon {
|
1908 |
-
position: absolute;
|
1909 |
-
right: 15px;
|
1910 |
-
top: 0;
|
1911 |
-
bottom: 0;
|
1912 |
-
}
|
1913 |
-
|
1914 |
-
.yith-plugin-ui .yith-add-box-buttons,
|
1915 |
-
.yith-plugin-ui .yith-toggle-content-buttons {
|
1916 |
-
text-align: right;
|
1917 |
-
}
|
1918 |
-
|
1919 |
-
.yith-plugin-ui .yith-toggle-onoff {
|
1920 |
-
position: absolute;
|
1921 |
-
cursor: pointer;
|
1922 |
-
right: 0;
|
1923 |
-
}
|
1924 |
-
|
1925 |
-
.yith-plugin-ui .yith-toggle_wrapper.ui-sortable .yith-toggle-onoff {
|
1926 |
-
right: 30px;
|
1927 |
-
}
|
1928 |
-
|
1929 |
-
.yith-plugin-ui .yith-toggle-row .yith-icon-drag {
|
1930 |
-
position: absolute;
|
1931 |
-
right: 0;
|
1932 |
-
top: 25%;
|
1933 |
-
bottom: 0;
|
1934 |
-
line-height: 1;
|
1935 |
-
}
|
1936 |
-
|
1937 |
-
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff {
|
1938 |
-
top: 25%;
|
1939 |
-
}
|
1940 |
-
|
1941 |
-
/** SPINNER **/
|
1942 |
-
.yith-plugin-ui .spinner {
|
1943 |
-
vertical-align: -5px;
|
1944 |
-
float: none;
|
1945 |
-
}
|
1946 |
-
|
1947 |
-
.yith-plugin-ui .spinner.show {
|
1948 |
-
visibility: visible;
|
1949 |
-
}
|
1950 |
-
|
1951 |
-
/* LIST TABLE */
|
1952 |
-
.yith-plugin-ui .form-table .list-table td {
|
1953 |
-
padding: 15px 0px;
|
1954 |
-
}
|
1955 |
-
|
1956 |
-
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table .bulkactions select {
|
1957 |
-
border: 1px solid #d8d8d8;
|
1958 |
-
max-width: 200px;
|
1959 |
-
max-height: 30px;
|
1960 |
-
padding: 0 10px;
|
1961 |
-
margin-right: 5px;
|
1962 |
-
}
|
1963 |
-
|
1964 |
-
.yith-plugin-ui .form-table .list-table th {
|
1965 |
-
width: initial;
|
1966 |
-
}
|
1967 |
-
|
1968 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tbody td {
|
1969 |
-
padding-left: 20px;
|
1970 |
-
}
|
1971 |
-
|
1972 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table th,
|
1973 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table td {
|
1974 |
-
padding: 15px 20px 15px 20px;
|
1975 |
-
}
|
1976 |
-
|
1977 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead td,
|
1978 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead th,
|
1979 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot td,
|
1980 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot th {
|
1981 |
-
padding: 3px 20px;
|
1982 |
-
}
|
1983 |
-
|
1984 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead a,
|
1985 |
-
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot a {
|
1986 |
-
padding-left: 0;
|
1987 |
-
}
|
1988 |
-
|
1989 |
-
.yith-plugin-ui .yith-plugin-fw-list-table h2 {
|
1990 |
-
border: 0;
|
1991 |
-
padding: 35px 0 15px;
|
1992 |
-
display: inline-block;
|
1993 |
-
margin-right: 10px;
|
1994 |
-
}
|
1995 |
-
|
1996 |
-
.yith-plugin-ui .form-table .yith-plugin-fw-list-table table th {
|
1997 |
-
vertical-align: middle;
|
1998 |
-
}
|
1999 |
-
|
2000 |
-
.yith-plugin-ui .yith-plugin-fw-list-table-container {
|
2001 |
-
padding: 0 20px;
|
2002 |
-
}
|
2003 |
-
|
2004 |
-
.yith-plugin-ui #doaction, .yith-plugin-ui #doaction2,
|
2005 |
-
.yith-plugin-ui #post-query-submit,
|
2006 |
-
.yith-plugin-ui #search-submit,
|
2007 |
-
.yith-plugin-ui .button.filter-button {
|
2008 |
-
margin-left: 0;
|
2009 |
-
height: 33px;
|
2010 |
-
padding: 0 10px;
|
2011 |
-
line-height: 33px;
|
2012 |
-
}
|
2013 |
-
|
2014 |
-
.yith-plugin-ui .bulkactions {
|
2015 |
-
margin: 10px 0;
|
2016 |
-
}
|
2017 |
-
|
2018 |
-
.yith-plugin-ui .form-table td p.yith-section-description {
|
2019 |
-
color: #716269;
|
2020 |
-
margin-bottom: 20px;
|
2021 |
-
}
|
2022 |
-
|
2023 |
-
/** Time picker width*/
|
2024 |
-
.yith-plugin-ui input.ui-timepicker-input {
|
2025 |
-
width: 100px !important;
|
2026 |
-
}
|
2027 |
-
|
2028 |
-
/** date format **/
|
2029 |
-
.yith-plugin-ui .yith-plugin-fw-date-format code {
|
2030 |
-
margin-left: 30px;
|
2031 |
-
}
|
2032 |
-
|
2033 |
-
.yith-plugin-ui .yith-plugin-fw-date-format input[type=text].small-text {
|
2034 |
-
margin-left: 45px;
|
2035 |
-
}
|
2036 |
-
|
2037 |
-
/** checkbox columns **/
|
2038 |
-
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
|
2039 |
-
width: calc(50% - 20px);
|
2040 |
-
padding-right: 20px;
|
2041 |
-
float: left;
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1) {
|
2045 |
-
clear: both;
|
2046 |
-
}
|
2047 |
-
|
2048 |
-
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2049 |
-
width: calc(33% - 10px);
|
2050 |
-
padding-right: 10px;
|
2051 |
-
float: left;
|
2052 |
-
}
|
2053 |
-
|
2054 |
-
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2055 |
-
clear: both;
|
2056 |
-
}
|
2057 |
-
|
2058 |
-
.yith-plugin-fw-checkbox-field-wrapper {
|
2059 |
-
display: inline-block !important;
|
2060 |
-
}
|
2061 |
-
|
2062 |
-
.yith-plugin-fw-checkbox-field-wrapper + span.description {
|
2063 |
-
display: inline-block;
|
2064 |
-
vertical-align: middle;
|
2065 |
-
margin: 0;
|
2066 |
-
}
|
2067 |
-
|
2068 |
-
.yith-plugin-ui span.description {
|
2069 |
-
margin-top: 10px;
|
2070 |
-
line-height: 20px;
|
2071 |
-
}
|
2072 |
-
|
2073 |
-
.yith-plugin-fw-option-with-description {
|
2074 |
-
display: table-cell;
|
2075 |
-
width: auto;
|
2076 |
-
vertical-align: top;
|
2077 |
-
}
|
2078 |
-
|
2079 |
-
/** YITH PANEL **/
|
2080 |
-
.yith-plugin-ui #yith-plugin-fw-panel {
|
2081 |
-
margin-top: -10px;
|
2082 |
-
}
|
2083 |
-
|
2084 |
-
.yith-plugin-ui #plugin-fw-wc, .yith-plugin-ui #yith-plugin-fw-panel {
|
2085 |
-
padding-top: 0;
|
2086 |
-
}
|
2087 |
-
|
2088 |
-
.yith-plugin-ui .plugin-option tr {
|
2089 |
-
border: 0;
|
2090 |
-
}
|
2091 |
-
|
2092 |
-
@media screen and (max-width: 1440px) {
|
2093 |
-
.yith-plugin-ui .yith-add-box,
|
2094 |
-
.yith-plugin-ui .yith-toggle-row {
|
2095 |
-
width: 80%;
|
2096 |
-
}
|
2097 |
-
}
|
2098 |
-
|
2099 |
-
@media screen and (max-width: 1024px) {
|
2100 |
-
.yith-plugin-ui .yith-add-box,
|
2101 |
-
.yith-plugin-ui .yith-toggle-row {
|
2102 |
-
width: 90%;
|
2103 |
-
}
|
2104 |
-
|
2105 |
-
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
|
2106 |
-
width: 100%;
|
2107 |
-
padding-right: 20px;
|
2108 |
-
float: left;
|
2109 |
-
}
|
2110 |
-
|
2111 |
-
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2112 |
-
width: calc(50% - 10px);
|
2113 |
-
padding-right: 10px;
|
2114 |
-
float: left;
|
2115 |
-
}
|
2116 |
-
|
2117 |
-
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1) {
|
2118 |
-
clear: both;
|
2119 |
-
}
|
2120 |
-
|
2121 |
-
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2122 |
-
clear: initial;
|
2123 |
-
}
|
2124 |
-
}
|
2125 |
-
|
2126 |
-
@media screen and (max-width: 782px) {
|
2127 |
-
.yith-plugin-fw-banner.yith-plugin-fw-banner-free {
|
2128 |
-
height: auto;
|
2129 |
-
background-color: #a9c7d3;
|
2130 |
-
}
|
2131 |
-
|
2132 |
-
.yith-plugin-fw-banner.yith-plugin-fw-banner-free ul {
|
2133 |
-
width: 90%;
|
2134 |
-
text-align: center;
|
2135 |
-
}
|
2136 |
-
|
2137 |
-
.yith-plugin-fw-banner.yith-plugin-fw-banner-free li img {
|
2138 |
-
width: 90%;
|
2139 |
-
margin: 0 auto;
|
2140 |
-
}
|
2141 |
-
|
2142 |
-
.yith-plugin-fw-banner h1 {
|
2143 |
-
line-height: 1.2em;
|
2144 |
-
}
|
2145 |
-
|
2146 |
-
.yith-plugin-ui .yith-add-box,
|
2147 |
-
.yith-plugin-ui .yith-toggle-row {
|
2148 |
-
width: 100%;
|
2149 |
-
}
|
2150 |
-
|
2151 |
-
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
|
2152 |
-
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2153 |
-
width: 100%;
|
2154 |
-
clear: initial;
|
2155 |
-
}
|
2156 |
-
|
2157 |
-
}
|
1 |
+
.yith-plugin-fw span.description {
|
2 |
+
display: block;
|
3 |
+
margin-top: 5px;
|
4 |
+
font-size: 12px;
|
5 |
+
color: #777;
|
6 |
+
font-style: italic;
|
7 |
+
clear: both;
|
8 |
+
}
|
9 |
+
|
10 |
+
.yith-plugin-fw span.description.inline {
|
11 |
+
display: inline-block;
|
12 |
+
margin: 0 0 0 5px;
|
13 |
+
}
|
14 |
+
|
15 |
+
.yith-disabled {
|
16 |
+
opacity: 0.3;
|
17 |
+
pointer-events: none;
|
18 |
+
}
|
19 |
+
|
20 |
+
.yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
21 |
+
display: block;
|
22 |
+
width: 100%;
|
23 |
+
}
|
24 |
+
|
25 |
+
.yith-plugin-fw-field-wrapper span.desc {
|
26 |
+
display: block;
|
27 |
+
width: 100%;
|
28 |
+
}
|
29 |
+
|
30 |
+
.yith-plugin-fw-title-field-wrapper h3.title {
|
31 |
+
width: 100%;
|
32 |
+
}
|
33 |
+
|
34 |
+
.the-metabox .yith-plugin-fw-title-field-wrapper h3.title {
|
35 |
+
float: left;
|
36 |
+
}
|
37 |
+
|
38 |
+
.yith-plugin-fw span.color-alpha {
|
39 |
+
height: 23px!important;
|
40 |
+
}
|
41 |
+
.yith-plugin-fw .wp-color-result-text{
|
42 |
+
height: 100%;
|
43 |
+
}
|
44 |
+
.yith-plugin-fw input[type=email],
|
45 |
+
.yith-plugin-fw input[type=number],
|
46 |
+
.yith-plugin-fw input[type=text]:not(.select2-search__field),
|
47 |
+
.yith-plugin-fw select,
|
48 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=email],
|
49 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=number],
|
50 |
+
.yith-plugin-ui input[type=password],
|
51 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=text]:not(.select2-search__field),
|
52 |
+
.woocommerce .yith-plugin-fw table.form-table select {
|
53 |
+
width: 400px;
|
54 |
+
max-width: 100%;
|
55 |
+
height: 30px;
|
56 |
+
padding: 5px;
|
57 |
+
line-height: 1;
|
58 |
+
}
|
59 |
+
|
60 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=text].wp-color-picker,
|
61 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=text].yith-plugin-fw-colorpicker,
|
62 |
+
.yith-plugin-fw input[type=text].wp-color-picker,
|
63 |
+
.yith-plugin-fw input[type=text].yith-plugin-fw-colorpicker {
|
64 |
+
width: 6em;
|
65 |
+
max-width: none;
|
66 |
+
height: auto;
|
67 |
+
padding: 3px 5px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.wp-core-ui .yith-plugin-fw-colorpicker-field-wrapper button{
|
71 |
+
border-color: #7e8993;
|
72 |
+
}
|
73 |
+
|
74 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=text].colorpick,
|
75 |
+
.yith-plugin-fw input[type=text].colorpick {
|
76 |
+
width: 6em;
|
77 |
+
max-width: none;
|
78 |
+
height: auto;
|
79 |
+
padding: 6px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.yith-plugin-fw input.select2-search__field,
|
83 |
+
.yith-plugin-fw .select2-container .select2-search--inline .select2-search__field,
|
84 |
+
.woocommerce .yith-plugin-fw input.select2-search__field,
|
85 |
+
.woocommerce .yith-plugin-fw table.form-table input.select2-search__field {
|
86 |
+
padding: 3px;
|
87 |
+
}
|
88 |
+
|
89 |
+
.yith-plugin-fw .select2-container .select2-selection--single .select2-selection__rendered {
|
90 |
+
line-height: 27px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.yith-plugin-fw textarea {
|
94 |
+
width: 400px;
|
95 |
+
max-width: 100%;
|
96 |
+
padding: 5px;
|
97 |
+
}
|
98 |
+
|
99 |
+
/* ------------- ICONS ------------- */
|
100 |
+
.yit-icons-manager-wrapper {
|
101 |
+
width: 100%;
|
102 |
+
max-width: 400px;
|
103 |
+
}
|
104 |
+
|
105 |
+
.yit-icons-manager-text {
|
106 |
+
width: 100%;
|
107 |
+
}
|
108 |
+
|
109 |
+
.yit-icons-manager-icon-text {
|
110 |
+
width: calc(100% - 35px) !important;
|
111 |
+
height: 30px;
|
112 |
+
float: left;
|
113 |
+
margin: 0;
|
114 |
+
}
|
115 |
+
|
116 |
+
.yit-icons-manager-icon-preview {
|
117 |
+
width: 30px;
|
118 |
+
height: 30px;
|
119 |
+
margin-right: 5px;
|
120 |
+
float: left;
|
121 |
+
padding-top: 6px;
|
122 |
+
box-sizing: border-box;
|
123 |
+
text-align: center;
|
124 |
+
background: #f1f1f1;
|
125 |
+
}
|
126 |
+
|
127 |
+
.yit-icons-manager-list-wrapper {
|
128 |
+
margin: 10px 0;
|
129 |
+
box-shadow: 0 0 0 1px #ddd;
|
130 |
+
}
|
131 |
+
|
132 |
+
ul.yit-icons-manager-list {
|
133 |
+
width: 100%;
|
134 |
+
height: 300px;
|
135 |
+
overflow-y: scroll;
|
136 |
+
margin: 0;
|
137 |
+
}
|
138 |
+
|
139 |
+
ul.yit-icons-manager-list li {
|
140 |
+
float: left;
|
141 |
+
width: 30px;
|
142 |
+
height: 30px;
|
143 |
+
padding-top: 6px;
|
144 |
+
box-sizing: border-box;
|
145 |
+
text-align: center;
|
146 |
+
background: #f1f1f1;
|
147 |
+
margin: 1px;
|
148 |
+
cursor: pointer;
|
149 |
+
}
|
150 |
+
|
151 |
+
ul.yit-icons-manager-list li:hover {
|
152 |
+
background: #c5dcf6;
|
153 |
+
}
|
154 |
+
|
155 |
+
ul.yit-icons-manager-list li.active {
|
156 |
+
background: #d4f0ff;
|
157 |
+
}
|
158 |
+
|
159 |
+
.yit-icons-manager-action-set-default {
|
160 |
+
margin-bottom: 0;
|
161 |
+
}
|
162 |
+
|
163 |
+
.yit-icons-manager-default-icon-preview {
|
164 |
+
height: 100%;
|
165 |
+
display: inline-block;
|
166 |
+
padding-left: 10px;
|
167 |
+
border-left: 1px solid #ccc;
|
168 |
+
margin-left: 10px;
|
169 |
+
}
|
170 |
+
|
171 |
+
/* ------- Text Array ------- */
|
172 |
+
.yith-plugin-fw-text-array-table td {
|
173 |
+
padding: 1px;
|
174 |
+
}
|
175 |
+
|
176 |
+
.yith-plugin-fw-text-array-table input[type=text],
|
177 |
+
.woocommerce table.form-table table.yith-plugin-fw-text-array-table input[type=text] {
|
178 |
+
width: 100%;
|
179 |
+
}
|
180 |
+
|
181 |
+
/* ------- Image Gallery ------- */
|
182 |
+
.yith-plugin-fw .image-gallery ul li {
|
183 |
+
display: inline-block;
|
184 |
+
width: 80px;
|
185 |
+
margin-left: 10px;
|
186 |
+
position: relative;
|
187 |
+
}
|
188 |
+
|
189 |
+
.yith-plugin-fw .image-gallery ul li img {
|
190 |
+
width: 80px;
|
191 |
+
border: 1px solid #ccc;
|
192 |
+
}
|
193 |
+
|
194 |
+
.yith-plugin-fw .image-gallery ul li ul {
|
195 |
+
position: absolute;
|
196 |
+
top: -6px;
|
197 |
+
right: -1px;
|
198 |
+
width: 20px;
|
199 |
+
height: 20px;
|
200 |
+
}
|
201 |
+
|
202 |
+
.yith-plugin-fw .image-gallery ul a.delete {
|
203 |
+
background: url(../images/x.png) no-repeat;
|
204 |
+
width: 20px;
|
205 |
+
height: 20px;
|
206 |
+
display: block;
|
207 |
+
text-indent: -99999px;
|
208 |
+
}
|
209 |
+
|
210 |
+
/* ------- OnOff ------- */
|
211 |
+
.yith-plugin-fw-onoff-container {
|
212 |
+
display: inline-block;
|
213 |
+
}
|
214 |
+
|
215 |
+
.yith-plugin-fw-onoff-container input {
|
216 |
+
display: none;
|
217 |
+
}
|
218 |
+
|
219 |
+
.yith-plugin-fw-onoff-container input + span {
|
220 |
+
cursor: pointer;
|
221 |
+
text-indent: -9999px;
|
222 |
+
display: block;
|
223 |
+
width: 36px;
|
224 |
+
line-height: 1;
|
225 |
+
height: 20px;
|
226 |
+
background: #a4a4a4;
|
227 |
+
border-radius: 24px;
|
228 |
+
position: relative;
|
229 |
+
transition: all 0.3s;
|
230 |
+
}
|
231 |
+
|
232 |
+
|
233 |
+
.yith-plugin-fw-onoff-container input + span:before {
|
234 |
+
content: '';
|
235 |
+
background: #fff;
|
236 |
+
width: 16px;
|
237 |
+
height: 16px;
|
238 |
+
border-radius: 50%;
|
239 |
+
position: absolute;
|
240 |
+
top: 2px;
|
241 |
+
left: 2px;
|
242 |
+
transition: all 0.3s;
|
243 |
+
}
|
244 |
+
|
245 |
+
.yith-plugin-fw-onoff-container input:checked + span,
|
246 |
+
.yith-plugin-fw-onoff-container input.onoffchecked + span {
|
247 |
+
background: #0073aa;
|
248 |
+
}
|
249 |
+
|
250 |
+
.yith-plugin-fw-onoff-container input:checked + span:before,
|
251 |
+
.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
252 |
+
left: 18px;
|
253 |
+
}
|
254 |
+
|
255 |
+
/* ------- Preview ------- */
|
256 |
+
.yith-plugin-fw-preview-field {
|
257 |
+
max-height: 200px;
|
258 |
+
}
|
259 |
+
|
260 |
+
/* ------- Radio ------- */
|
261 |
+
.yith-plugin-fw-radio input[type=radio] {
|
262 |
+
margin: 0 3px 0 0;
|
263 |
+
}
|
264 |
+
|
265 |
+
.yith-plugin-fw-radio__row {
|
266 |
+
margin-bottom: 8px;
|
267 |
+
}
|
268 |
+
|
269 |
+
/* ------- Sidebar Layout ------- */
|
270 |
+
.yith-plugin-fw-sidebar-layout input[type="radio"] {
|
271 |
+
display: none;
|
272 |
+
width: 0px;
|
273 |
+
}
|
274 |
+
|
275 |
+
.yith-plugin-fw-sidebar-layout input[type="radio"]:first-child {
|
276 |
+
margin-right: -2px;
|
277 |
+
}
|
278 |
+
|
279 |
+
.yith-plugin-fw-sidebar-layout input[type="radio"] + img {
|
280 |
+
border: 2px solid #fff;
|
281 |
+
padding: 1px;
|
282 |
+
}
|
283 |
+
|
284 |
+
.yith-plugin-fw-sidebar-layout input[type="radio"] + img:hover {
|
285 |
+
cursor: pointer;
|
286 |
+
}
|
287 |
+
|
288 |
+
.yith-plugin-fw-sidebar-layout input[checked] + img {
|
289 |
+
border: 2px solid #f2ad35;
|
290 |
+
padding: 1px;
|
291 |
+
}
|
292 |
+
|
293 |
+
.yith-plugin-fw-sidebar-layout select {
|
294 |
+
vertical-align: 12px;
|
295 |
+
}
|
296 |
+
|
297 |
+
.yit-admin-panel-content-wrap .yith-plugin-fw-sidebar-layout label {
|
298 |
+
font-weight: bold;
|
299 |
+
width: 200px;
|
300 |
+
float: left;
|
301 |
+
line-height: 23px;
|
302 |
+
margin-left: -230px;
|
303 |
+
}
|
304 |
+
|
305 |
+
/* ------- Slider ------- */
|
306 |
+
.yith-plugin-fw .slider {
|
307 |
+
padding-top: 20px;
|
308 |
+
}
|
309 |
+
|
310 |
+
.ui-slider .minCaption {
|
311 |
+
position: absolute;
|
312 |
+
right: 95%;
|
313 |
+
top: -6px;
|
314 |
+
margin-right: 11px;
|
315 |
+
}
|
316 |
+
|
317 |
+
.ui-slider .maxCaption {
|
318 |
+
position: absolute;
|
319 |
+
left: 95%;
|
320 |
+
top: -6px;
|
321 |
+
margin-left: 20px;
|
322 |
+
}
|
323 |
+
|
324 |
+
.ui-slider-horizontal .ui-slider-handle {
|
325 |
+
background: #fff;
|
326 |
+
border: 0px !important;
|
327 |
+
top: -12px !important;
|
328 |
+
border-radius: 50%;
|
329 |
+
width: 27px !important;
|
330 |
+
height: 27px !important;
|
331 |
+
box-sizing: border-box;
|
332 |
+
box-shadow: 0 1px 7px -1px rgba(0, 0, 0, 0.5);
|
333 |
+
font-size: 13px;
|
334 |
+
padding: 6px 0;
|
335 |
+
font-weight: 600;
|
336 |
+
color: #555;
|
337 |
+
text-align: center;
|
338 |
+
}
|
339 |
+
|
340 |
+
.ui-slider.ui-widget-content {
|
341 |
+
background: #ccc;
|
342 |
+
border: none !important;
|
343 |
+
height: 3px !important;
|
344 |
+
border-radius: 3px !important;
|
345 |
+
width: 90%;
|
346 |
+
margin: 15px 5% 20px 5%;
|
347 |
+
}
|
348 |
+
|
349 |
+
.iris-slider-offset.ui-slider.ui-widget-content {
|
350 |
+
background: transparent !important;
|
351 |
+
height: auto !important;
|
352 |
+
}
|
353 |
+
|
354 |
+
.ui-slider.ui-widget-content .ui-widget-header {
|
355 |
+
background: #4b93ff;
|
356 |
+
left: 0px !important;
|
357 |
+
-webkit-border-radius: 3px;
|
358 |
+
-moz-border-radius: 3px;
|
359 |
+
-khtml-border-radius: 3px;
|
360 |
+
border-radius: 3px;
|
361 |
+
}
|
362 |
+
|
363 |
+
/* ------- Select2 ------- */
|
364 |
+
.yith-plugin-fw-select2-wrapper {
|
365 |
+
width: 400px;
|
366 |
+
}
|
367 |
+
|
368 |
+
/* ------- Textarea ------- */
|
369 |
+
.yith-plugin-fw-textarea-editor-field-wrapper {
|
370 |
+
max-width: 1000px;
|
371 |
+
clear: both;
|
372 |
+
}
|
373 |
+
|
374 |
+
.yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area,
|
375 |
+
.woocommerce table.form-table .yith-plugin-fw-textarea-editor-field-wrapper textarea.wp-editor-area {
|
376 |
+
width: 100%;
|
377 |
+
}
|
378 |
+
|
379 |
+
/* ------- Buttons ------- */
|
380 |
+
.yith-plugin-fw-buttons-field-wrapper {
|
381 |
+
margin-top: 7px;
|
382 |
+
}
|
383 |
+
|
384 |
+
/* ------- Select Images ------- */
|
385 |
+
.yith-plugin-fw-select-images__list {
|
386 |
+
margin: 0;
|
387 |
+
display: flex;
|
388 |
+
flex-wrap: wrap;
|
389 |
+
}
|
390 |
+
|
391 |
+
.yith-plugin-fw-select-images__item {
|
392 |
+
width: calc(20% - 10px);
|
393 |
+
min-width: 150px;
|
394 |
+
margin: 0 10px 10px 0;
|
395 |
+
padding: 10px;
|
396 |
+
box-sizing: border-box;
|
397 |
+
cursor: pointer;
|
398 |
+
transition: all .3s;
|
399 |
+
border: 2px solid #eee;
|
400 |
+
display: flex;
|
401 |
+
flex-direction: column;
|
402 |
+
justify-content: space-between;
|
403 |
+
}
|
404 |
+
|
405 |
+
.yith-plugin-fw-select-images__item:hover,
|
406 |
+
.yith-plugin-fw-select-images__item.yith-plugin-fw-select-images__item--selected {
|
407 |
+
border-color: #07bcce;
|
408 |
+
}
|
409 |
+
|
410 |
+
.yith-plugin-fw-select-images__item__label {
|
411 |
+
text-align: center;
|
412 |
+
font-weight: 600;
|
413 |
+
margin-bottom: 10px;
|
414 |
+
}
|
415 |
+
|
416 |
+
.yith-plugin-fw-select-images__item img {
|
417 |
+
display: block;
|
418 |
+
max-width: 100%;
|
419 |
+
margin: 0 auto;
|
420 |
+
}
|
421 |
+
|
422 |
+
/****************
|
423 |
+
WordPress 5.3 with old panel fixes
|
424 |
+
****************/
|
425 |
+
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single {
|
426 |
+
height: auto;
|
427 |
+
line-height: 1;
|
428 |
+
}
|
429 |
+
|
430 |
+
.yith-plugin-fw-field-wrapper .select2-container .select2-selection--single .select2-selection__arrow{
|
431 |
+
height: 100%;
|
432 |
+
}
|
433 |
+
|
434 |
+
/****************
|
435 |
+
YITH UI
|
436 |
+
****************/
|
437 |
+
@font-face {
|
438 |
+
font-family: 'yith-icon';
|
439 |
+
src: url('../fonts/yith-icon.eot?7ik896');
|
440 |
+
src: url('../fonts/yith-icon.eot?7ik896#iefix') format('embedded-opentype'),
|
441 |
+
url('../fonts/yith-icon.ttf?7ik896') format('truetype'),
|
442 |
+
url('../fonts/yith-icon.woff?7ik896') format('woff'),
|
443 |
+
url('../fonts/yith-icon.svg?7ik896#yith-icon') format('svg');
|
444 |
+
font-weight: normal;
|
445 |
+
font-style: normal;
|
446 |
+
}
|
447 |
+
|
448 |
+
[class^="icon-"], [class*=" icon-"][class^="yith-icon-"], [class*=" yith-icon-"] {
|
449 |
+
/* use !important to prevent issues with browser extensions that change fonts */
|
450 |
+
font-family: 'yith-icon' !important;
|
451 |
+
speak: none;
|
452 |
+
font-style: normal;
|
453 |
+
font-weight: normal;
|
454 |
+
font-variant: normal;
|
455 |
+
text-transform: none;
|
456 |
+
line-height: 1;
|
457 |
+
|
458 |
+
/* Better Font Rendering =========== */
|
459 |
+
-webkit-font-smoothing: antialiased;
|
460 |
+
-moz-osx-font-smoothing: grayscale;
|
461 |
+
}
|
462 |
+
|
463 |
+
.yith-icon-calendar_add:before {
|
464 |
+
content: "\e913";
|
465 |
+
color: #757575;
|
466 |
+
}
|
467 |
+
|
468 |
+
.yith-icon-calendar_money:before {
|
469 |
+
content: "\e914";
|
470 |
+
color: #757575;
|
471 |
+
}
|
472 |
+
|
473 |
+
.yith-icon-calendar2:before {
|
474 |
+
content: "\e915";
|
475 |
+
color: #757575;
|
476 |
+
}
|
477 |
+
|
478 |
+
.yith-icon-people:before {
|
479 |
+
content: "\e916";
|
480 |
+
color: #757575;
|
481 |
+
}
|
482 |
+
|
483 |
+
.yith-icon-shield_money:before {
|
484 |
+
content: "\e917";
|
485 |
+
color: #757575;
|
486 |
+
}
|
487 |
+
|
488 |
+
.yith-icon-time_check:before {
|
489 |
+
content: "\e918";
|
490 |
+
color: #757575;
|
491 |
+
}
|
492 |
+
|
493 |
+
.yith-icon-world_settings:before {
|
494 |
+
content: "\e919";
|
495 |
+
color: #757575;
|
496 |
+
}
|
497 |
+
|
498 |
+
.yith-icon-arrow_eye_closed:before {
|
499 |
+
content: "\e912";
|
500 |
+
color: #757575;
|
501 |
+
}
|
502 |
+
|
503 |
+
.yith-icon-arrow_eye:before {
|
504 |
+
content: "\e911";
|
505 |
+
color: #757575;
|
506 |
+
}
|
507 |
+
|
508 |
+
.yith-icon-reset:before {
|
509 |
+
content: "\e910";
|
510 |
+
color: #757575;
|
511 |
+
}
|
512 |
+
|
513 |
+
.yith-icon-drag:before {
|
514 |
+
content: "\e90f";
|
515 |
+
color: #757575;
|
516 |
+
}
|
517 |
+
|
518 |
+
.yith-icon-trash:before {
|
519 |
+
content: "\e90d";
|
520 |
+
color: #757575;
|
521 |
+
}
|
522 |
+
|
523 |
+
.yith-icon-info:before {
|
524 |
+
content: "\e90e";
|
525 |
+
color: #757575;
|
526 |
+
}
|
527 |
+
|
528 |
+
.yith-icon-arrow_down:before {
|
529 |
+
content: "\e900";
|
530 |
+
color: #757575;
|
531 |
+
}
|
532 |
+
|
533 |
+
.yith-icon-arrow_left:before {
|
534 |
+
content: "\e901";
|
535 |
+
color: #757575;
|
536 |
+
}
|
537 |
+
|
538 |
+
.yith-icon-arrow_right:before {
|
539 |
+
content: "\e902";
|
540 |
+
color: #757575;
|
541 |
+
}
|
542 |
+
|
543 |
+
.yith-icon-arrow_up:before {
|
544 |
+
content: "\e903";
|
545 |
+
color: #757575;
|
546 |
+
}
|
547 |
+
|
548 |
+
.yith-icon-calendar:before {
|
549 |
+
content: "\e904";
|
550 |
+
color: #757575;
|
551 |
+
}
|
552 |
+
|
553 |
+
.yith-icon-check:before {
|
554 |
+
content: "\e905";
|
555 |
+
color: #757575;
|
556 |
+
}
|
557 |
+
|
558 |
+
.yith-icon-close:before {
|
559 |
+
content: "\e906";
|
560 |
+
color: #757575;
|
561 |
+
}
|
562 |
+
|
563 |
+
.yith-icon-edit:before {
|
564 |
+
content: "\e907";
|
565 |
+
color: #757575;
|
566 |
+
}
|
567 |
+
|
568 |
+
.yith-icon-magnifier:before {
|
569 |
+
content: "\e908";
|
570 |
+
color: #757575;
|
571 |
+
}
|
572 |
+
|
573 |
+
.yith-icon-pencil:before {
|
574 |
+
content: "\e909";
|
575 |
+
color: #757575;
|
576 |
+
}
|
577 |
+
|
578 |
+
.yith-icon-plus:before {
|
579 |
+
content: "\e90a";
|
580 |
+
color: #757575;
|
581 |
+
}
|
582 |
+
|
583 |
+
.yith-icon-update:before {
|
584 |
+
content: "\e90b";
|
585 |
+
color: #757575;
|
586 |
+
}
|
587 |
+
|
588 |
+
.yith-icon-upload:before {
|
589 |
+
content: "\e90c";
|
590 |
+
color: #757575;
|
591 |
+
}
|
592 |
+
|
593 |
+
.yith-plugin-fw-banner {
|
594 |
+
width: 100%;
|
595 |
+
height: 75px;
|
596 |
+
background: url('../images/banner-premium.png');
|
597 |
+
}
|
598 |
+
|
599 |
+
.yith-plugin-fw-banner.yith-plugin-fw-banner-free {
|
600 |
+
height: 290px;
|
601 |
+
background: url('../images/banner-free.png') no-repeat;
|
602 |
+
}
|
603 |
+
|
604 |
+
.yith-plugin-fw-banner.yith-plugin-fw-banner-free h1 {
|
605 |
+
max-width: auto;
|
606 |
+
text-align: left;
|
607 |
+
margin-left: 110px;
|
608 |
+
padding-top: 15px;
|
609 |
+
padding-bottom: 8px;
|
610 |
+
}
|
611 |
+
|
612 |
+
.yith-plugin-fw-banner h1 {
|
613 |
+
text-transform: uppercase;
|
614 |
+
color: #0c5777;
|
615 |
+
font-size: 15px;
|
616 |
+
padding-left: 150px;
|
617 |
+
font-weight: 700;
|
618 |
+
text-align: left;
|
619 |
+
display: inline-block;
|
620 |
+
box-sizing: border-box;
|
621 |
+
}
|
622 |
+
|
623 |
+
.yith-plugin-fw-banner span {
|
624 |
+
font-style: italic;
|
625 |
+
display: block;
|
626 |
+
font-size: 15px;
|
627 |
+
color: #214249;
|
628 |
+
text-transform: none;
|
629 |
+
text-align: right;
|
630 |
+
}
|
631 |
+
|
632 |
+
.yith-plugin-fw-banner a,
|
633 |
+
.yith-plugin-fw-banner a:focus {
|
634 |
+
text-decoration: none;
|
635 |
+
outline: none;
|
636 |
+
box-shadow: none;
|
637 |
+
}
|
638 |
+
|
639 |
+
.yith-banners ul {
|
640 |
+
list-style: none;
|
641 |
+
margin-left: 10px;
|
642 |
+
}
|
643 |
+
|
644 |
+
.yith-banners ul li {
|
645 |
+
display: inline-block;
|
646 |
+
margin-left: 10px;
|
647 |
+
}
|
648 |
+
|
649 |
+
.yith-plugin-ui a {
|
650 |
+
outline: none;
|
651 |
+
box-shadow: none;
|
652 |
+
}
|
653 |
+
|
654 |
+
.yith-plugin-ui {
|
655 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
656 |
+
}
|
657 |
+
|
658 |
+
.yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper {
|
659 |
+
margin-top: 10px;
|
660 |
+
}
|
661 |
+
|
662 |
+
.yith-plugin-ui .nav-tab {
|
663 |
+
margin-left: 0px;
|
664 |
+
margin-right: 2px;
|
665 |
+
background-color: #336374;
|
666 |
+
color: #fff;
|
667 |
+
font-size: 15px;
|
668 |
+
padding: 7px 20px;
|
669 |
+
border: 0;
|
670 |
+
}
|
671 |
+
|
672 |
+
.yith-plugin-ui .nav-tab:first-child {
|
673 |
+
border-left: 1px solid #d9d9d9;
|
674 |
+
}
|
675 |
+
|
676 |
+
.yith-plugin-ui .nav-tab.yith-premium {
|
677 |
+
background-color: #be421c;
|
678 |
+
}
|
679 |
+
|
680 |
+
.yith-plugin-ui .nav-tab-active {
|
681 |
+
background-color: #fff;
|
682 |
+
color: #336374;
|
683 |
+
border-bottom: 1px solid #fff;
|
684 |
+
}
|
685 |
+
|
686 |
+
.yith-plugin-ui .nav-tab-active.yith-premium {
|
687 |
+
background-color: #fff;
|
688 |
+
color: #be421c;
|
689 |
+
}
|
690 |
+
|
691 |
+
.yith-plugin-ui #plugin-fw-wc {
|
692 |
+
padding-top: 0px;
|
693 |
+
}
|
694 |
+
|
695 |
+
.yith-plugin-ui .form-table td {
|
696 |
+
padding: 15px 20px;
|
697 |
+
}
|
698 |
+
|
699 |
+
.yith-plugin-ui.metaboxes-tab label {
|
700 |
+
color: #33373b;
|
701 |
+
font-size: 14px;
|
702 |
+
margin-left: -248px;
|
703 |
+
}
|
704 |
+
|
705 |
+
.yith-plugin-ui.metaboxes-tab .the-metabox {
|
706 |
+
margin: 40px 0 40px 290px;
|
707 |
+
margin-left: 264px;
|
708 |
+
}
|
709 |
+
|
710 |
+
.yith-plugin-ui.metaboxes-tab label {
|
711 |
+
width: 200px;
|
712 |
+
font-weight: 600;
|
713 |
+
}
|
714 |
+
|
715 |
+
.yith-plugin-ui span.description {
|
716 |
+
color: #716269;
|
717 |
+
font-size: 14px;
|
718 |
+
font-style: normal;
|
719 |
+
font-weight: 400;
|
720 |
+
margin-top: 15px;
|
721 |
+
margin-left: 0;
|
722 |
+
}
|
723 |
+
|
724 |
+
#wpwrap .yith-plugin-ui h2.nav-tab-wrapper, #wpbody-content .yith-plugin-ui h2.nav-tab-wrapper {
|
725 |
+
border: 0;
|
726 |
+
border-bottom: 1px solid #ccc;
|
727 |
+
margin-right: 15px;
|
728 |
+
margin-bottom: 0;
|
729 |
+
background-color: transparent;
|
730 |
+
padding-left: 0;
|
731 |
+
}
|
732 |
+
|
733 |
+
.yith-plugin-ui #plugin-fw-wc table.form-table,
|
734 |
+
.yith-plugin-ui #yith-plugin-fw-panel table.form-table,
|
735 |
+
.yith-plugin-ui table.form-table {
|
736 |
+
border: 1px solid #d8d8d8;
|
737 |
+
border-top: 0;
|
738 |
+
margin-bottom: 40px;
|
739 |
+
}
|
740 |
+
|
741 |
+
.yith-plugin-ui #wpwrap h2.nav-tab-wrapper, .yith-plugin-ui #wpbody-content h2.nav-tab-wrapper {
|
742 |
+
background-color: transparent;
|
743 |
+
border: 0;
|
744 |
+
text-transform: none;
|
745 |
+
border-bottom: 1px solid #ddd;
|
746 |
+
}
|
747 |
+
|
748 |
+
.yith-plugin-ui h2 {
|
749 |
+
color: #2a8db0;
|
750 |
+
font-size: 15px;
|
751 |
+
text-transform: uppercase;
|
752 |
+
border: 1px solid #d8d8d8;
|
753 |
+
border-bottom: 0;
|
754 |
+
background-color: #fff;
|
755 |
+
padding: 35px 20px;
|
756 |
+
margin: 0px;
|
757 |
+
}
|
758 |
+
|
759 |
+
.yith-plugin-ui .yith-plugin-fw-custom-tab h2 {
|
760 |
+
border: 0px solid #d8d8d8;
|
761 |
+
padding-left: 0;
|
762 |
+
}
|
763 |
+
|
764 |
+
.yith-plugin-ui #plugin-fw-wc table.form-table th, #yith-plugin-fw-panel table.form-table th.titledesc, .yith-plugin-ui #plugin-fw-wc table.form-table td, #yith-plugin-fw-panel table.form-table td.forminp {
|
765 |
+
padding: 30px 20px;
|
766 |
+
}
|
767 |
+
|
768 |
+
.yith-plugin-ui #plugin-fw-wc h2 + div {
|
769 |
+
background: #fff;
|
770 |
+
border-left: 1px solid #d9d9d9;
|
771 |
+
border-right: 1px solid #d9d9d9;
|
772 |
+
margin: -20px 0 0 0;
|
773 |
+
padding-left: 20px;
|
774 |
+
padding-bottom: 5px;
|
775 |
+
}
|
776 |
+
|
777 |
+
.yith-plugin-ui #plugin-fw-wc h2 + div p, .yith-plugin-ui p.info-box {
|
778 |
+
background: #f1f1f1;
|
779 |
+
font-size: 14px;
|
780 |
+
font-weight: 700;
|
781 |
+
width: 40%;
|
782 |
+
display: block;
|
783 |
+
padding: 15px;
|
784 |
+
margin-bottom: 0;
|
785 |
+
}
|
786 |
+
|
787 |
+
.yith-plugin-ui #plugin-fw-wc h2 + div p:before, .yith-plugin-ui p.info-box:before {
|
788 |
+
content: "\e90e";
|
789 |
+
font-family: yith-icon;
|
790 |
+
font-size: 30px;
|
791 |
+
font-weight: normal;
|
792 |
+
display: block;
|
793 |
+
margin-top: -5px;
|
794 |
+
float: left;
|
795 |
+
margin-right: 15px;
|
796 |
+
}
|
797 |
+
|
798 |
+
.yith-plugin-ui h2:first-child {
|
799 |
+
border-top: 0;
|
800 |
+
}
|
801 |
+
|
802 |
+
/*** Icon ***/
|
803 |
+
.yith-plugin-ui span.yith-icon {
|
804 |
+
margin-left: -36px;
|
805 |
+
line-height: 36px;
|
806 |
+
font-size: 20px;
|
807 |
+
}
|
808 |
+
|
809 |
+
/*** General Input Style ***/
|
810 |
+
|
811 |
+
.yith-plugin-ui .yith-plugin-fw select,
|
812 |
+
.yith-plugin-ui textarea,
|
813 |
+
.yith-plugin-ui input[type=number],
|
814 |
+
.yith-plugin-ui.metaboxes-tab input[type=number],
|
815 |
+
.yith-plugin-ui input[type=text],
|
816 |
+
.yith-plugin-ui input[type=text],
|
817 |
+
.yith-plugin-ui input[type=email],
|
818 |
+
.yith-plugin-ui input[type=password],
|
819 |
+
.yith-plugin-ui .search-box input[name="s"],
|
820 |
+
.yith-plugin-fw.yith-plugin-ui input[type=text]:not(.select2-search__field),
|
821 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text]:not(.select2-search__field),
|
822 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table select,
|
823 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea,
|
824 |
+
.woocommerce .yith-plugin-fw table.form-table input[type=password],
|
825 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=number],
|
826 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text] {
|
827 |
+
border: 1px solid #d8d8d8;
|
828 |
+
border-radius: 8px;
|
829 |
+
padding: 8px 10px;
|
830 |
+
height: 38px;
|
831 |
+
min-width: 90px;
|
832 |
+
box-shadow: none;
|
833 |
+
color: #716269;
|
834 |
+
}
|
835 |
+
|
836 |
+
.yith-plugin-ui textarea,
|
837 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table textarea {
|
838 |
+
height: auto;
|
839 |
+
}
|
840 |
+
|
841 |
+
.yith-plugin-ui table.form-table input[type=text].wp-color-picker,
|
842 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].wp-color-picker {
|
843 |
+
border: 0;
|
844 |
+
height: 30px;
|
845 |
+
max-width: 121px;
|
846 |
+
font-size: 11px;
|
847 |
+
padding: 0;
|
848 |
+
|
849 |
+
}
|
850 |
+
|
851 |
+
.yith-plugin-ui .search-box input[name="s"] {
|
852 |
+
height: 35px;
|
853 |
+
}
|
854 |
+
|
855 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].small-text,
|
856 |
+
.yith-plugin-ui input[type=text].small-text {
|
857 |
+
width: 100px;
|
858 |
+
height: 25px;
|
859 |
+
border: 1px solid #d9d9d9;
|
860 |
+
}
|
861 |
+
|
862 |
+
.yith-plugin-ui textarea {
|
863 |
+
height: auto;
|
864 |
+
padding: 8px;
|
865 |
+
}
|
866 |
+
|
867 |
+
.yith-plugin-ui select:focus,
|
868 |
+
.yith-plugin-ui input:focus {
|
869 |
+
border-color: #a7d9ec !important;
|
870 |
+
}
|
871 |
+
|
872 |
+
.woocommerce .yith-plugin-ui table.form-table select,
|
873 |
+
.yith-plugin-ui select {
|
874 |
+
-webkit-appearance: none;
|
875 |
+
line-height: 1.2em;
|
876 |
+
min-height: 35px;
|
877 |
+
background: url("../images/arrow_down.svg") no-repeat right center;
|
878 |
+
background-size: 35px 13px;
|
879 |
+
border-radius: 8px;
|
880 |
+
padding-left: 10px;
|
881 |
+
}
|
882 |
+
|
883 |
+
.yith-plugin-ui .form-table th {
|
884 |
+
width: 200px;
|
885 |
+
padding-right: 50px;
|
886 |
+
}
|
887 |
+
|
888 |
+
/** BUTTONS **/
|
889 |
+
.wp-core-ui .yith-plugin-ui .button-primary,
|
890 |
+
.wp-core-ui .yith-plugin-ui .button-secondary,
|
891 |
+
.yith-plugin-ui .yith-add-button,
|
892 |
+
.yith-plugin-ui .yith-save-button,
|
893 |
+
.yith-plugin-ui .yith-edit-button,
|
894 |
+
.yith-plugin-ui .yith-update-button,
|
895 |
+
.yith-plugin-ui .yith-plugin-fw-select-all,
|
896 |
+
.yith-plugin-ui .yith-plugin-fw-deselect-all,
|
897 |
+
.yith-plugin-ui .yith-plugin-fw-upload-button,
|
898 |
+
.yith-plugin-ui .yith-plugin-fw-upload-button-reset {
|
899 |
+
border-radius: 3px;
|
900 |
+
text-transform: uppercase;
|
901 |
+
box-shadow: none;
|
902 |
+
border: 0;
|
903 |
+
font-weight: 700;
|
904 |
+
font-size: 11px;
|
905 |
+
padding: 0px 14px;
|
906 |
+
outline: none;
|
907 |
+
height: auto;
|
908 |
+
transition: all ease 0.3s;
|
909 |
+
background-color: #d6d6d6;
|
910 |
+
color: #656565;
|
911 |
+
text-shadow: none;
|
912 |
+
vertical-align: middle;
|
913 |
+
line-height: 26px;
|
914 |
+
display: inline-block;
|
915 |
+
text-decoration: none;
|
916 |
+
cursor: pointer;
|
917 |
+
}
|
918 |
+
|
919 |
+
.wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
|
920 |
+
.wp-core-ui .yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button,
|
921 |
+
.yith-plugin-ui .yith-plugin-fw-upload-button-reset,
|
922 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button-reset,
|
923 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button {
|
924 |
+
height: 38px;
|
925 |
+
}
|
926 |
+
|
927 |
+
.wp-core-ui .yith-plugin-ui .button:focus,
|
928 |
+
.wp-core-ui .yith-plugin-ui .button-primary:focus,
|
929 |
+
.yith-plugin-ui .yith-add-button:focus,
|
930 |
+
.yith-plugin-ui .yith-save-button:focus,
|
931 |
+
.yith-plugin-ui .yith-edit-button:focus,
|
932 |
+
.yith-plugin-ui .yith-update-button:focus,
|
933 |
+
.wp-core-ui .yith-plugin-ui .button-secondary:focus {
|
934 |
+
outline: none;
|
935 |
+
box-shadow: none;
|
936 |
+
}
|
937 |
+
|
938 |
+
.wp-core-ui .yith-plugin-ui .button-xl {
|
939 |
+
padding: 0px 20px;
|
940 |
+
font-size: 14px;
|
941 |
+
line-height: 38px;
|
942 |
+
display: inline-block;
|
943 |
+
font-weight: 600;
|
944 |
+
}
|
945 |
+
|
946 |
+
/** button with inside a span with icon class */
|
947 |
+
.yith-plugin-ui .button-secondary span.yith-icon {
|
948 |
+
margin-left: 0px;
|
949 |
+
margin-right: 10px;
|
950 |
+
line-height: normal;
|
951 |
+
}
|
952 |
+
|
953 |
+
.yith-plugin-ui .button-secondary span.yith-icon:before {
|
954 |
+
color: #656565;
|
955 |
+
font-size: 15px;
|
956 |
+
}
|
957 |
+
|
958 |
+
|
959 |
+
.wp-core-ui .yith-plugin-ui .button:focus,
|
960 |
+
.wp-core-ui .yith-plugin-ui .button-secondary:focus,
|
961 |
+
.yith-plugin-ui .yith-save-button:hover,
|
962 |
+
.wp-core-ui .yith-plugin-ui .button-secondary:hover,
|
963 |
+
.yith-plugin-ui .yith-plugin-fw-upload-button-reset:hover {
|
964 |
+
background-color: #cacaca;
|
965 |
+
color: #515151;
|
966 |
+
}
|
967 |
+
|
968 |
+
.wp-core-ui .yith-plugin-ui .button-primary,
|
969 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all,
|
970 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-upload-button {
|
971 |
+
background-color: #007694;
|
972 |
+
color: #fff;
|
973 |
+
}
|
974 |
+
|
975 |
+
|
976 |
+
.yith-plugin-ui .yith-add-button,
|
977 |
+
.wp-core-ui .yith-plugin-ui .button-primary:focus,
|
978 |
+
.wp-core-ui .yith-plugin-ui .button-primary:hover {
|
979 |
+
background-color: #375f6b;
|
980 |
+
color: #fff;
|
981 |
+
cursor: pointer;
|
982 |
+
}
|
983 |
+
|
984 |
+
|
985 |
+
.yith-plugin-ui .yith-add-button:hover,
|
986 |
+
.wp-core-ui .yith-plugin-ui .yith-plugin-fw-upload-button:focus,
|
987 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:hover,
|
988 |
+
.yith-plugin-ui .button-secondary.yith-plugin-fw-select-all:focus,
|
989 |
+
.yith-plugin-ui .yith-plugin-fw-upload-button:hover {
|
990 |
+
border-color: #007694;
|
991 |
+
background: #007694;
|
992 |
+
color: #fff;
|
993 |
+
line-height: 26px;
|
994 |
+
margin-left: 0;
|
995 |
+
}
|
996 |
+
|
997 |
+
.yith-plugin-ui .button-primary:before,
|
998 |
+
.yith-plugin-ui .yith-add-button:before,
|
999 |
+
.yith-plugin-ui .yith-save-button:before,
|
1000 |
+
.yith-plugin-ui .yith-edit-button:before,
|
1001 |
+
.yith-plugin-ui .yith-update-button:before,
|
1002 |
+
.yith-plugin-ui .button-secondary:before {
|
1003 |
+
font-family: 'yith-icon';
|
1004 |
+
font-size: 10px;
|
1005 |
+
font-weight: 700;
|
1006 |
+
margin-right: 10px;
|
1007 |
+
vertical-align: bottom;
|
1008 |
+
display: inline-block;
|
1009 |
+
}
|
1010 |
+
|
1011 |
+
/** yith-edit-button **/
|
1012 |
+
.yith-plugin-ui .yith-edit-button {
|
1013 |
+
background-color: #7f9298;
|
1014 |
+
color: #fff;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
.yith-plugin-ui .yith-edit-button:focus,
|
1018 |
+
.yith-plugin-ui .yith-edit-button:hover {
|
1019 |
+
background-color: #718085;
|
1020 |
+
color: #fff;
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
.yith-plugin-ui .yith-edit-button:before {
|
1024 |
+
content: "\e907";
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
/** yith-update-button **/
|
1028 |
+
.yith-plugin-ui .yith-update-button {
|
1029 |
+
background-color: #94aa09;
|
1030 |
+
color: #fff;
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
.yith-plugin-ui .yith-update-button:focus,
|
1034 |
+
.yith-plugin-ui .yith-update-button:hover {
|
1035 |
+
background-color: #7a9009;
|
1036 |
+
color: #fff;
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
.yith-plugin-ui .yith-update-button:before {
|
1040 |
+
content: "\e90b";
|
1041 |
+
font-size: 15px;
|
1042 |
+
}
|
1043 |
+
|
1044 |
+
/** yith-save-button **/
|
1045 |
+
|
1046 |
+
.yith-plugin-ui .yith-save-button {
|
1047 |
+
background-color: #267390;
|
1048 |
+
color: #fff;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
.yith-plugin-ui .yith-save-button:focus,
|
1052 |
+
.yith-plugin-ui .yith-save-button:hover {
|
1053 |
+
background-color: #1c4863;
|
1054 |
+
color: #fff;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
|
1058 |
+
/** yith-remove-button **/
|
1059 |
+
|
1060 |
+
.yith-plugin-ui .button-secondary.yith-remove-button:before {
|
1061 |
+
content: "\e90d";
|
1062 |
+
font-size: 15px;
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
|
1066 |
+
/** yith-add-button **/
|
1067 |
+
.yith-plugin-ui .yith-add-button:before {
|
1068 |
+
content: "\e90a";
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
.yith-plugin-ui .yith-add-button.closed {
|
1072 |
+
background-color: #fff;
|
1073 |
+
color: #375f6b;
|
1074 |
+
border: 1px solid #375f6b;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
.yith-plugin-ui .yith-add-button.closed:before {
|
1078 |
+
content: "\e906";
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
|
1082 |
+
/** yith-plugin-fw-upload-button **/
|
1083 |
+
.yith-plugin-ui button.yith-plugin-fw-upload-button:before {
|
1084 |
+
content: "\e90c";
|
1085 |
+
font-family: 'yith-icon';
|
1086 |
+
font-size: 19px;
|
1087 |
+
font-weight: 400;
|
1088 |
+
margin-right: 10px;
|
1089 |
+
vertical-align: middle;
|
1090 |
+
display: inline-block;
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
/** SELECT 2 **/
|
1094 |
+
.yith-plugin-ui .select2-container,
|
1095 |
+
.yith-plugin-ui .select2-selection--single {
|
1096 |
+
height: auto;
|
1097 |
+
padding: 2px;
|
1098 |
+
outline: none;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
.yith-plugin-ui .select2-selection--single {
|
1102 |
+
margin: 0;
|
1103 |
+
border: 0;
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
/* old panel*/
|
1107 |
+
|
1108 |
+
.yith-plugin-ui span.select2.select2-container.select2-container--default {
|
1109 |
+
border: 1px solid #d8d8d8;
|
1110 |
+
border-radius: 8px;
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
.yith-plugin-ui span.select2.select2-container.select2-container--default:hover,
|
1114 |
+
.yith-plugin-ui span.select2.select2-container.select2-container--default:active,
|
1115 |
+
.yith-plugin-ui span.select2.select2-container.select2-container--default:focus {
|
1116 |
+
border-color: #a7d9ec;
|
1117 |
+
}
|
1118 |
+
|
1119 |
+
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
1120 |
+
color: #fff;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table input[type=text].select2-search__field,
|
1124 |
+
.yith-plugin-ui .yith-plugin-fw table.form-table input.select2-search__field {
|
1125 |
+
border: 0;
|
1126 |
+
padding: 0;
|
1127 |
+
height: initial;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice,
|
1131 |
+
.yith-plugin-ui .select2-selection__choice {
|
1132 |
+
color: #fff;
|
1133 |
+
background-color: #4e8ba2;
|
1134 |
+
border-radius: 12px;
|
1135 |
+
padding: 3px 11px;
|
1136 |
+
border-color: #33937e;
|
1137 |
+
font-size: 13px;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow:before {
|
1141 |
+
content: "\e900";
|
1142 |
+
font-family: 'yith-icon' !important;
|
1143 |
+
line-height: 36px;
|
1144 |
+
color: #d9d9d9;
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
.yith-plugin-ui .select2-container--default .select2-selection--single .select2-selection__arrow b {
|
1148 |
+
display: none;
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
.yith-plugin-ui .select2-container--open .select2-dropdown--below,
|
1152 |
+
.yith-plugin-ui .select2-container--open .select2-dropdown--above,
|
1153 |
+
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--below,
|
1154 |
+
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
|
1155 |
+
margin-top: 10px;
|
1156 |
+
border-radius: 8px;
|
1157 |
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 10px 0 rgba(0, 0, 0, 0.12) !important;
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
.yith-plugin-ui .select2-container--open .select2-dropdown--above,
|
1161 |
+
.yith-plugin-fw-panel .select2-container--open .select2-dropdown--above {
|
1162 |
+
margin-top: -10px;
|
1163 |
+
}
|
1164 |
+
|
1165 |
+
.yith-plugin-ui .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
|
1166 |
+
.yith-plugin-ui .select2-container--default.select2-container--open.select2-container--above .select2-selection--single,
|
1167 |
+
.yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
|
1168 |
+
.yith-plugin-fw-panel .select2-container--default.select2-container--open.select2-container--above .select2-selection--single {
|
1169 |
+
border-radius: 8px;
|
1170 |
+
}
|
1171 |
+
|
1172 |
+
.yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:first-child,
|
1173 |
+
.yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:first-child {
|
1174 |
+
border-top-left-radius: 8px;
|
1175 |
+
border-top-right-radius: 8px;
|
1176 |
+
}
|
1177 |
+
.yith-plugin-ui .select2-results .select2-results__group, .select2-results .select2-results__option:last-child,
|
1178 |
+
.yith-plugin-fw-panel .select2-results .select2-results__group, .select2-results .select2-results__option:last-child,
|
1179 |
+
.yith-plugin-ui .select2-results .select2-results__group,
|
1180 |
+
.yith-plugin-ui .select2-results .select2-results__option:last-child,
|
1181 |
+
.yith-plugin-fw-panel .select2-results .select2-results__group,
|
1182 |
+
.yith-plugin-fw-panel .select2-results .select2-results__option:last-child,
|
1183 |
+
.yith-plugin-ui .select2-results .select2-results__group,
|
1184 |
+
.yith-plugin-ui .select2-results .select2-results__option:last-child,
|
1185 |
+
.yith-plugin-fw-panel .select2-results .select2-results__group,
|
1186 |
+
.yith-plugin-fw-panel .select2-results .select2-results__option:last-child {
|
1187 |
+
border-bottom-left-radius: 8px;
|
1188 |
+
border-bottom-right-radius: 8px;
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
.yith-plugin-ui .select2-dropdown{
|
1192 |
+
border: 0;
|
1193 |
+
}
|
1194 |
+
.yith-plugin-ui .select2-container--default .select2-results__option[data-selected=true],
|
1195 |
+
.yith-plugin-ui .select2-container--default .select2-results__option[aria-selected=true],
|
1196 |
+
.yith-plugin-fw-panel .select2-container--default .select2-results__option[data-selected=true],
|
1197 |
+
.yith-plugin-fw-panel .select2-container--default .select2-results__option[aria-selected=true] {
|
1198 |
+
background-color: #fff;
|
1199 |
+
outline: none;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
.yith-plugin-ui .select2-container--default .select2-results__option--highlighted[aria-selected],
|
1203 |
+
.yith-plugin-ui .select2-container--default .select2-results__option--highlighted[data-selected],
|
1204 |
+
.yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[aria-selected],
|
1205 |
+
.yith-plugin-fw-panel .select2-container--default .select2-results__option--highlighted[data-selected] {
|
1206 |
+
background-color: #e8eff1;
|
1207 |
+
color: #4e8ba2;
|
1208 |
+
outline: none;
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove,
|
1212 |
+
.yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
1213 |
+
float: right;
|
1214 |
+
padding-left: 15px;
|
1215 |
+
text-indent: -9999px;
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
|
1219 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
|
1220 |
+
.woocommerce .yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after,
|
1221 |
+
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1222 |
+
float: right;
|
1223 |
+
color: #fff;
|
1224 |
+
content: "\e906";
|
1225 |
+
font-family: 'yith-icon' !important;
|
1226 |
+
font-size: 9px;
|
1227 |
+
line-height: 21px;
|
1228 |
+
text-indent: 0;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1232 |
+
color: #000;
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
.yith-plugin-ui .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after
|
1236 |
+
.yith-plugin-fw-panel .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:after {
|
1237 |
+
color: #000;
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
.yith-plugin-ui .select2-container .select2-selection--multiple,
|
1241 |
+
.yith-plugin-ui .select2-container--default.select2-container--focus .select2-selection--multiple {
|
1242 |
+
border: 0;
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
.yith-plugin-fw .select2-search input[type=text] {
|
1246 |
+
border: 0;
|
1247 |
+
padding: 0;
|
1248 |
+
height: auto;
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
.yith-plugin-ui .yith-plugin-fw-select-field-wrapper span.yith-icon.yith-icon-magnifier,
|
1252 |
+
.yith-plugin-fw-panel .yith-plugin-fw-select-field-wrapper span.yith-icon.yith-icon-magnifier {
|
1253 |
+
position: absolute;
|
1254 |
+
padding-top: 5px;
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
.yith-plugin-ui input[type=text].select2-search__field {
|
1258 |
+
border: 0;
|
1259 |
+
padding: 0;
|
1260 |
+
height: 30px;
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
.yith-plugin-ui .select2-container--default .select2-search--dropdown .select2-search__field,
|
1264 |
+
.yith-plugin-fw-panel .select2-container--default .select2-search--dropdown .select2-search__field {
|
1265 |
+
border: 1px solid #d9d9d9;
|
1266 |
+
border-radius: 8px;
|
1267 |
+
box-shadow: none;
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
.yith-plugin-ui .select2-dropdown,
|
1271 |
+
.yith-plugin-fw-panel .select2-dropdown {
|
1272 |
+
border: 1px solid #d9d9d9;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
/** RADIO BUTTON **/
|
1276 |
+
.yith-plugin-ui [type="radio"]:checked,
|
1277 |
+
.yith-plugin-ui [type="radio"]:not(:checked) {
|
1278 |
+
position: absolute;
|
1279 |
+
left: -9999px;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
.yith-plugin-ui [type="radio"]:checked + label,
|
1283 |
+
.yith-plugin-ui [type="radio"]:not(:checked) + label {
|
1284 |
+
position: relative;
|
1285 |
+
padding-left: 35px;
|
1286 |
+
cursor: pointer;
|
1287 |
+
line-height: 20px;
|
1288 |
+
display: inline-block;
|
1289 |
+
color: #716269;
|
1290 |
+
font-size: 14px;
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
.yith-plugin-ui [type="radio"]:checked + label:before,
|
1294 |
+
.yith-plugin-ui [type="radio"]:not(:checked) + label:before {
|
1295 |
+
content: '';
|
1296 |
+
position: absolute;
|
1297 |
+
left: 0;
|
1298 |
+
top: 0;
|
1299 |
+
width: 19px;
|
1300 |
+
height: 19px;
|
1301 |
+
border: 1px solid #d8d8d8;
|
1302 |
+
border-radius: 100%;
|
1303 |
+
background: #fff;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
.yith-plugin-ui [type="radio"]:checked + label:after,
|
1307 |
+
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1308 |
+
content: '';
|
1309 |
+
width: 13px;
|
1310 |
+
height: 13px;
|
1311 |
+
background: #4e8ba2;
|
1312 |
+
position: absolute;
|
1313 |
+
top: 4px;
|
1314 |
+
left: 4px;
|
1315 |
+
border-radius: 100%;
|
1316 |
+
-webkit-transition: all 0.2s ease;
|
1317 |
+
transition: all 0.2s ease;
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
.yith-plugin-ui [type="radio"]:not(:checked) + label:after {
|
1321 |
+
opacity: 0;
|
1322 |
+
-webkit-transform: scale(0);
|
1323 |
+
transform: scale(0);
|
1324 |
+
}
|
1325 |
+
|
1326 |
+
.yith-plugin-ui [type="radio"]:checked + label:after {
|
1327 |
+
opacity: 1;
|
1328 |
+
-webkit-transform: scale(1);
|
1329 |
+
transform: scale(1);
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
/** CHECKBOX **/
|
1333 |
+
.yith-plugin-ui input[type="checkbox"] {
|
1334 |
+
-webkit-appearance: none;
|
1335 |
+
background-color: #fff;
|
1336 |
+
border: 1px solid #d8d8d8;
|
1337 |
+
box-shadow: none;
|
1338 |
+
width: 18px;
|
1339 |
+
height: 18px;
|
1340 |
+
border-radius: 3px;
|
1341 |
+
display: inline-block;
|
1342 |
+
position: relative;
|
1343 |
+
margin-right: 10px;
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
.yith-plugin-ui input[type="checkbox"]:checked {
|
1347 |
+
background-color: #4e8ba2;
|
1348 |
+
border-color: #488197;
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
.yith-plugin-ui .forminp-checkbox span.description.inline {
|
1352 |
+
margin-left: 10px;
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
.yith-plugin-ui input[type="checkbox"]:checked:before {
|
1356 |
+
display: none;
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
.yith-plugin-ui input[type="checkbox"]:checked:after {
|
1360 |
+
content: "\e905";
|
1361 |
+
font-family: 'yith-icon';
|
1362 |
+
font-size: 15px;
|
1363 |
+
position: absolute;
|
1364 |
+
top: 8px;
|
1365 |
+
left: 1px;
|
1366 |
+
color: #fff;
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
/** ONOFF **/
|
1370 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input[type="checkbox"] {
|
1371 |
+
display: none;
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1375 |
+
border: 1px solid #d8d8d8;
|
1376 |
+
background-color: #fff;
|
1377 |
+
width: 60px;
|
1378 |
+
height: 24px;
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1382 |
+
background-color: #d8d8d8;
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:before {
|
1386 |
+
width: 14px;
|
1387 |
+
height: 14px;
|
1388 |
+
top: 5px;
|
1389 |
+
left: 6px;
|
1390 |
+
background-color: #d8d8d8;
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span:after {
|
1394 |
+
content: 'OFF';
|
1395 |
+
width: 14px;
|
1396 |
+
height: 14px;
|
1397 |
+
font-size: 13px;
|
1398 |
+
font-weight: 600;
|
1399 |
+
padding-left: 27px;
|
1400 |
+
color: #979797;
|
1401 |
+
margin-top: 5px;
|
1402 |
+
display: inline-block;
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span,
|
1406 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input.onoffchecked + span {
|
1407 |
+
background-color: #fff;
|
1408 |
+
border-color: #98aa36;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:before,
|
1412 |
+
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:before {
|
1413 |
+
background-color: #98aa36;
|
1414 |
+
left: 41px;
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input:checked + span:after,
|
1418 |
+
.yith-plugin-ui.yith-plugin-fw-onoff-container input.onoffchecked + span:after {
|
1419 |
+
content: 'ON';
|
1420 |
+
color: #98aa36;
|
1421 |
+
width: 14px;
|
1422 |
+
height: 14px;
|
1423 |
+
display: inline-block;
|
1424 |
+
font-size: 13px;
|
1425 |
+
font-weight: 600;
|
1426 |
+
padding: 0 10px;
|
1427 |
+
margin-top: 5px;
|
1428 |
+
}
|
1429 |
+
|
1430 |
+
.yith-plugin-ui .yith-plugin-fw-onoff-container input + span {
|
1431 |
+
text-indent: 0;
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
|
1435 |
+
/**
|
1436 |
+
DATEPICKER
|
1437 |
+
*/
|
1438 |
+
.yith-plugin-ui div#ui-datepicker-div,
|
1439 |
+
.yith-plugin-fw-panel div#ui-datepicker-div {
|
1440 |
+
border: 0;
|
1441 |
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 2px 10px 0 rgba(0, 0, 0, 0.12) !important;
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
.yith-plugin-ui .ui-datepicker-header.ui-widget-header,
|
1445 |
+
.yith-plugin-fw-panel .ui-datepicker-header.ui-widget-header {
|
1446 |
+
background: #4e8ba2;
|
1447 |
+
color: #fff;
|
1448 |
+
font-size: 11px;
|
1449 |
+
line-height: 25px;
|
1450 |
+
border: 0;
|
1451 |
+
min-height: 25px;
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
.yith-plugin-ui .ui-datepicker-title,
|
1455 |
+
.yith-plugin-fw-panel .ui-datepicker-title {
|
1456 |
+
line-height: 25px;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
.yith-plugin-ui .ui-datepicker th,
|
1460 |
+
.yith-plugin-fw-panel .ui-datepicker th {
|
1461 |
+
color: #716269;
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
.yith-plugin-ui .ui-widget-header .ui-icon,
|
1465 |
+
.yith-plugin-ui .ui-widget-header .ui-state-hover,
|
1466 |
+
.yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
|
1467 |
+
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1468 |
+
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w,
|
1469 |
+
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e,
|
1470 |
+
.yith-plugin-fw-panel .ui-widget-header .ui-icon,
|
1471 |
+
.yith-plugin-fw-panel .ui-widget-header .ui-state-hover,
|
1472 |
+
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
|
1473 |
+
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1474 |
+
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w,
|
1475 |
+
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e {
|
1476 |
+
background: none;
|
1477 |
+
content: "";
|
1478 |
+
border: 0;
|
1479 |
+
text-indent: 0;
|
1480 |
+
width: 15px;
|
1481 |
+
height: 20px;
|
1482 |
+
display: block;
|
1483 |
+
overflow: hidden;
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
.yith-plugin-ui .yith-password-wrapper {
|
1487 |
+
display: inline-block;
|
1488 |
+
width: auto;
|
1489 |
+
position: relative;
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
.yith-plugin-ui .yith-password-wrapper .yith-password-eye-closed:before,
|
1493 |
+
.yith-plugin-ui .yith-password-wrapper .yith-password-eye:before {
|
1494 |
+
content: '\e911';
|
1495 |
+
color: #999;
|
1496 |
+
font-family: 'yith-icon';
|
1497 |
+
font-size: 20px;
|
1498 |
+
font-weight: normal;
|
1499 |
+
width: 15px;
|
1500 |
+
display: block;
|
1501 |
+
position: absolute;
|
1502 |
+
right: 13px;
|
1503 |
+
top: 0;
|
1504 |
+
line-height: 38px;
|
1505 |
+
bottom: 0;
|
1506 |
+
cursor: pointer;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
.yith-plugin-ui .yith-password-wrapper .yith-password-eye-closed:before {
|
1510 |
+
content: '\e912';
|
1511 |
+
}
|
1512 |
+
|
1513 |
+
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-w:before,
|
1514 |
+
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-w:before {
|
1515 |
+
content: "\e901";
|
1516 |
+
color: #fff;
|
1517 |
+
font-family: 'yith-icon';
|
1518 |
+
font-size: 12px;
|
1519 |
+
font-weight: normal;
|
1520 |
+
width: 15px;
|
1521 |
+
display: block;
|
1522 |
+
}
|
1523 |
+
|
1524 |
+
.yith-plugin-ui .ui-icon.ui-icon-circle-triangle-e:before,
|
1525 |
+
.yith-plugin-fw-panel .ui-icon.ui-icon-circle-triangle-e:before {
|
1526 |
+
content: "\e902";
|
1527 |
+
color: #fff;
|
1528 |
+
text-indent: 0;
|
1529 |
+
font-family: 'yith-icon';
|
1530 |
+
font-size: 12px;
|
1531 |
+
font-weight: normal;
|
1532 |
+
width: 15px;
|
1533 |
+
display: block;
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
/* arrow */
|
1537 |
+
.yith-plugin-ui .ui-datepicker .ui-datepicker-prev,
|
1538 |
+
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1539 |
+
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1540 |
+
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-next-hover,
|
1541 |
+
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-prev,
|
1542 |
+
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1543 |
+
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1544 |
+
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-next-hover {
|
1545 |
+
top: 1px;
|
1546 |
+
cursor: pointer;
|
1547 |
+
}
|
1548 |
+
|
1549 |
+
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev,
|
1550 |
+
.yith-plugin-ui .ui-datepicker-prev.ui-datepicker-prev-hover,
|
1551 |
+
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev,
|
1552 |
+
.yith-plugin-fw-panel .ui-datepicker-prev.ui-datepicker-prev-hover {
|
1553 |
+
left: 5px;
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
.yith-plugin-ui .ui-datepicker .ui-datepicker-next,
|
1557 |
+
.yith-plugin-ui .ui-datepicker-next.ui-datepicker-next-hover,
|
1558 |
+
.yith-plugin-fw-panel .ui-datepicker .ui-datepicker-next,
|
1559 |
+
.yith-plugin-fw-panel .ui-datepicker-next.ui-datepicker-next-hover {
|
1560 |
+
right: 1px;
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
.yith-plugin-ui .ui-datepicker table,
|
1564 |
+
.yith-plugin-fw-panel .ui-datepicker table {
|
1565 |
+
font-size: 10px;
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
.yith-plugin-ui .ui-state-default,
|
1569 |
+
.yith-plugin-ui .ui-widget-content .ui-state-default,
|
1570 |
+
.yith-plugin-ui .ui-widget-header .ui-state-default,
|
1571 |
+
.yith-plugin-fw-panel .ui-state-default,
|
1572 |
+
.yith-plugin-fw-panel .ui-widget-content .ui-state-default,
|
1573 |
+
.yith-plugin-fw-panel .ui-widget-header .ui-state-default {
|
1574 |
+
background: #fff;
|
1575 |
+
border: 1px solid #d9d9d9;
|
1576 |
+
|
1577 |
+
}
|
1578 |
+
|
1579 |
+
.yith-plugin-ui .ui-state-hover,
|
1580 |
+
.yith-plugin-ui .ui-widget-content .ui-state-hover,
|
1581 |
+
.yith-plugin-ui a.ui-state-default:focus,
|
1582 |
+
.yith-plugin-ui .ui-widget-content .ui-state-focus,
|
1583 |
+
.yith-plugin-ui .ui-widget-header .ui-state-focus,
|
1584 |
+
.yith-plugin-fw-panel .ui-state-hover,
|
1585 |
+
.yith-plugin-fw-panel .ui-widget-content .ui-state-hover,
|
1586 |
+
.yith-plugin-fw-panel a.ui-state-default:focus,
|
1587 |
+
.yith-plugin-fw-panel .ui-widget-content .ui-state-focus,
|
1588 |
+
.yith-plugin-fw-panel .ui-widget-header .ui-state-focus {
|
1589 |
+
background: #ebf1f3;
|
1590 |
+
border: 1px solid #bfd5dd;
|
1591 |
+
outline: none;
|
1592 |
+
box-shadow: none;
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
.yith-plugin-ui .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus,
|
1596 |
+
.yith-plugin-fw-panel .ui-widget-header .ui-state-hover, .woocommerce .yith-plugin-ui .ui-state-focus {
|
1597 |
+
background: none;
|
1598 |
+
border: 0;
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
/** colorpicker **/
|
1602 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .yith-colorpicker-group:not(:first-child) {
|
1603 |
+
margin-top: 20px;
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .iris-picker,
|
1607 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-holder {
|
1608 |
+
display: none !important;
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap,
|
1612 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-input-wrap > * {
|
1613 |
+
display: inline-block !important;
|
1614 |
+
vertical-align: middle;
|
1615 |
+
}
|
1616 |
+
|
1617 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .iris-picker,
|
1618 |
+
.yith-plugin-ui .yith-plugin-fw-field-wrapper .wp-picker-active .wp-picker-holder {
|
1619 |
+
display: block !important;
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
.woocommerce .yith-plugin-ui .iris-picker {
|
1623 |
+
border: 0;
|
1624 |
+
margin-top: 20px;
|
1625 |
+
}
|
1626 |
+
|
1627 |
+
.yith-plugin-ui .yith-plugin-fw input[type=text].wp-color-picker {
|
1628 |
+
border: 0;
|
1629 |
+
padding: 2px 5px;
|
1630 |
+
height: 30px;
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
.yith-plugin-ui .wp-color-result-text {
|
1634 |
+
display: none;
|
1635 |
+
}
|
1636 |
+
|
1637 |
+
.yith-plugin-ui .wp-picker-container .wp-color-result.button{
|
1638 |
+
height: 30px!important;
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
.yith-plugin-ui .wp-picker-container .color-alpha {
|
1642 |
+
height: 28px!important;
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
.yith-plugin-ui .wp-picker-container .wp-color-result.button {
|
1646 |
+
width: 30px;
|
1647 |
+
height: 30px;
|
1648 |
+
border: 0;
|
1649 |
+
box-shadow: none;
|
1650 |
+
border: 1px solid #d9d9d9;
|
1651 |
+
margin-bottom: 0;
|
1652 |
+
display: inline-block;
|
1653 |
+
vertical-align: middle;
|
1654 |
+
}
|
1655 |
+
|
1656 |
+
.yith-plugin-ui .wp-picker-default-custom {
|
1657 |
+
cursor: pointer;
|
1658 |
+
width: 25px;
|
1659 |
+
padding: 0 5px;
|
1660 |
+
display: inline-block;
|
1661 |
+
vertical-align: middle;
|
1662 |
+
position: relative;
|
1663 |
+
}
|
1664 |
+
|
1665 |
+
.yith-plugin-ui .wp-picker-default-custom input.button {
|
1666 |
+
opacity: 0;
|
1667 |
+
margin: 0;
|
1668 |
+
padding: 0;
|
1669 |
+
position: absolute;
|
1670 |
+
top: 0;
|
1671 |
+
right: 0;
|
1672 |
+
left: 0;
|
1673 |
+
bottom: 0;
|
1674 |
+
z-index: 2;
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
.yith-plugin-ui .wp-picker-default-custom:before {
|
1678 |
+
content: "\e910";
|
1679 |
+
text-indent: 0;
|
1680 |
+
font-family: 'yith-icon';
|
1681 |
+
font-size: 20px;
|
1682 |
+
color: #d8d8d8;
|
1683 |
+
font-weight: normal;
|
1684 |
+
width: 15px;
|
1685 |
+
display: block;
|
1686 |
+
background: none;
|
1687 |
+
line-height: 20px;
|
1688 |
+
margin-left: 8px;
|
1689 |
+
}
|
1690 |
+
|
1691 |
+
.yith-plugin-ui .wp-picker-container {
|
1692 |
+
width: auto;
|
1693 |
+
display: inline-block;
|
1694 |
+
border: 1px solid #d9d9d9;
|
1695 |
+
border-radius: 8px;
|
1696 |
+
padding: 5px;
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
.yith-plugin-ui .iris-picker .iris-square-inner {
|
1700 |
+
box-shadow: none;
|
1701 |
+
border: 1px solid #d9d9d9;
|
1702 |
+
}
|
1703 |
+
|
1704 |
+
.yith-plugin-ui .yith-single-colorpicker {
|
1705 |
+
display: inline-block;
|
1706 |
+
width: 220px;
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
.yith-plugin-ui .yith-single-colorpicker > label {
|
1710 |
+
display: block;
|
1711 |
+
font-size: 11px;
|
1712 |
+
font-weight: 600;
|
1713 |
+
margin: 0 0 10px 0;
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
/* RANGE SLIDER */
|
1717 |
+
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
|
1718 |
+
top: -45px !important;
|
1719 |
+
}
|
1720 |
+
|
1721 |
+
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle {
|
1722 |
+
position: absolute;
|
1723 |
+
top: -33px;
|
1724 |
+
left: 0;
|
1725 |
+
width: auto !important;
|
1726 |
+
height: auto !important;
|
1727 |
+
padding: 2px 8px;
|
1728 |
+
margin-left: -15px;
|
1729 |
+
font-size: 12px;
|
1730 |
+
line-height: 20px;
|
1731 |
+
color: #4e8ba2;
|
1732 |
+
text-align: center;
|
1733 |
+
background-color: #fff;
|
1734 |
+
border: 1px solid #fff;
|
1735 |
+
border-radius: 3px;
|
1736 |
+
-webkit-transition: opacity .3s ease-in-out 0s;
|
1737 |
+
transition: opacity .3s ease-in-out 0s;
|
1738 |
+
box-shadow: 0px 1px 7px 0px rgba(1, 1, 1, 0.13);
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:before {
|
1742 |
+
position: absolute;
|
1743 |
+
bottom: -3px;
|
1744 |
+
left: 50%;
|
1745 |
+
display: inline-block;
|
1746 |
+
width: 6px;
|
1747 |
+
height: 6px;
|
1748 |
+
margin-left: -3px;
|
1749 |
+
content: "";
|
1750 |
+
background-color: #fff;
|
1751 |
+
-webkit-transform: rotate(-45deg);
|
1752 |
+
-ms-transform: rotate(-45deg);
|
1753 |
+
transform: rotate(-45deg);
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
.yith-plugin-ui .ui-slider.ui-widget-content .ui-widget-header {
|
1757 |
+
background: #4e8ba2;
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
.yith-plugin-ui .ui-slider-horizontal .ui-slider-handle:after {
|
1761 |
+
content: '';
|
1762 |
+
width: 17px;
|
1763 |
+
height: 17px;
|
1764 |
+
display: block;
|
1765 |
+
position: absolute;
|
1766 |
+
background: #fff;
|
1767 |
+
top: 37px;
|
1768 |
+
border-radius: 50%;
|
1769 |
+
box-shadow: 0px 1px 6px 0px rgba(1, 1, 1, 0.25);
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
.yith-plugin-ui .ui-slider.ui-widget-content {
|
1773 |
+
height: 5px !important;
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
.yith-plugin-ui .ui-slider .minCaption,
|
1777 |
+
.yith-plugin-ui .ui-slider .maxCaption {
|
1778 |
+
font-weight: 700;
|
1779 |
+
font-size: 12px;
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
|
1783 |
+
/* ADD_BOX AND TOGGLE */
|
1784 |
+
.yith-plugin-ui .yith-add-box,
|
1785 |
+
.yith-plugin-ui .yith-toggle-row {
|
1786 |
+
width: 70%;
|
1787 |
+
border: 1px solid #d9d9d9;
|
1788 |
+
box-shadow: none;
|
1789 |
+
border-radius: 4px;
|
1790 |
+
margin: 20px 0;
|
1791 |
+
padding: 10px;
|
1792 |
+
box-sizing: border-box;
|
1793 |
+
background: white;
|
1794 |
+
}
|
1795 |
+
|
1796 |
+
.yith-plugin-ui .yith-toggle-row {
|
1797 |
+
cursor: pointer;
|
1798 |
+
transition: all ease 0.5s;
|
1799 |
+
}
|
1800 |
+
|
1801 |
+
.yith-plugin-ui .yith-toggle-row.highlight {
|
1802 |
+
transition: all ease 0.5s;
|
1803 |
+
/*box-shadow: 0 0 7px rgb(81, 117, 129);*/
|
1804 |
+
box-shadow: 0 0 7px rgb(30, 140, 190);
|
1805 |
+
|
1806 |
+
display: block;
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
.yith-plugin-ui .yith-add-box {
|
1810 |
+
padding: 25px;
|
1811 |
+
display: none;
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
.yith-plugin-ui .yith-toggle-title {
|
1815 |
+
position: relative;
|
1816 |
+
}
|
1817 |
+
|
1818 |
+
.yith-plugin-ui #plugin-fw-wc .yith-toggle-title h3,
|
1819 |
+
.yith-plugin-ui.metaboxes-tab.yith-plugin-ui h3,
|
1820 |
+
.yith-plugin-ui .yith-toggle-title h3 {
|
1821 |
+
padding: 0px 20px 0px 25px;
|
1822 |
+
margin: 3px 0;
|
1823 |
+
|
1824 |
+
display: inline-block;
|
1825 |
+
position: relative;
|
1826 |
+
min-width: 173px;
|
1827 |
+
box-sizing: border-box;
|
1828 |
+
font-weight: 600;
|
1829 |
+
font-size: 15px;
|
1830 |
+
color: #23282d;
|
1831 |
+
text-transform: inherit;
|
1832 |
+
}
|
1833 |
+
|
1834 |
+
.yith-plugin-ui .yith-toggle-title .subtitle {
|
1835 |
+
padding-left: 0;
|
1836 |
+
padding-top: 8px;
|
1837 |
+
font-size: 12px;
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
.yith-plugin-ui .yith-toggle {
|
1841 |
+
position: absolute;
|
1842 |
+
width: 30px;
|
1843 |
+
cursor: pointer;
|
1844 |
+
left: 0;
|
1845 |
+
top: 0;
|
1846 |
+
bottom: 0;
|
1847 |
+
margin: auto;
|
1848 |
+
display: flex;
|
1849 |
+
align-items: center;
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
.yith-plugin-ui .yith-toggle > span:before {
|
1853 |
+
color: #405e69;
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
.yith-plugin-ui .yith-toggle > span {
|
1857 |
+
position: absolute;
|
1858 |
+
right: 50%;
|
1859 |
+
transition: transform .3s;
|
1860 |
+
line-height: 1;
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
|
1864 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle span {
|
1865 |
+
transform: rotateZ(90deg);
|
1866 |
+
}
|
1867 |
+
|
1868 |
+
.yith-plugin-ui .yith-toggle-content {
|
1869 |
+
display: none;
|
1870 |
+
position: relative;
|
1871 |
+
padding: 30px 25px;
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content {
|
1875 |
+
/* display: block;*/
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
.yith-plugin-ui .yith-add-box-row,
|
1879 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row {
|
1880 |
+
display: table;
|
1881 |
+
margin-bottom: 40px;
|
1882 |
+
}
|
1883 |
+
|
1884 |
+
.yith-plugin-ui .yith-add-box-row label,
|
1885 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row label {
|
1886 |
+
display: table-cell;
|
1887 |
+
width: 200px;
|
1888 |
+
padding-right: 21px;
|
1889 |
+
color: #33373b;
|
1890 |
+
font-size: 14px;
|
1891 |
+
vertical-align: top;
|
1892 |
+
font-weight: 600;
|
1893 |
+
}
|
1894 |
+
.yith-plugin-ui .yith-plugin-fw-radio__row label{
|
1895 |
+
font-weight: 400!important;
|
1896 |
+
}
|
1897 |
+
.yith-plugin-ui .yith-add-box-row .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper),
|
1898 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-plugin-fw-field-wrapper:not(.yith-plugin-fw-title-field-wrapper) {
|
1899 |
+
margin-top: 10px;
|
1900 |
+
width: auto;
|
1901 |
+
float: none;
|
1902 |
+
vertical-align: middle;
|
1903 |
+
position: relative;
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
.yith-plugin-ui .yith-add-box-row span.yith-icon,
|
1907 |
+
.yith-plugin-ui .yith-toggle-row-opened .yith-toggle-content .yith-toggle-content-row span.yith-icon {
|
1908 |
+
position: absolute;
|
1909 |
+
right: 15px;
|
1910 |
+
top: 0;
|
1911 |
+
bottom: 0;
|
1912 |
+
}
|
1913 |
+
|
1914 |
+
.yith-plugin-ui .yith-add-box-buttons,
|
1915 |
+
.yith-plugin-ui .yith-toggle-content-buttons {
|
1916 |
+
text-align: right;
|
1917 |
+
}
|
1918 |
+
|
1919 |
+
.yith-plugin-ui .yith-toggle-onoff {
|
1920 |
+
position: absolute;
|
1921 |
+
cursor: pointer;
|
1922 |
+
right: 0;
|
1923 |
+
}
|
1924 |
+
|
1925 |
+
.yith-plugin-ui .yith-toggle_wrapper.ui-sortable .yith-toggle-onoff {
|
1926 |
+
right: 30px;
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
.yith-plugin-ui .yith-toggle-row .yith-icon-drag {
|
1930 |
+
position: absolute;
|
1931 |
+
right: 0;
|
1932 |
+
top: 25%;
|
1933 |
+
bottom: 0;
|
1934 |
+
line-height: 1;
|
1935 |
+
}
|
1936 |
+
|
1937 |
+
.yith-plugin-ui .yith-toggle-row.with-subtitle .yith-toggle-onoff {
|
1938 |
+
top: 25%;
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
/** SPINNER **/
|
1942 |
+
.yith-plugin-ui .spinner {
|
1943 |
+
vertical-align: -5px;
|
1944 |
+
float: none;
|
1945 |
+
}
|
1946 |
+
|
1947 |
+
.yith-plugin-ui .spinner.show {
|
1948 |
+
visibility: visible;
|
1949 |
+
}
|
1950 |
+
|
1951 |
+
/* LIST TABLE */
|
1952 |
+
.yith-plugin-ui .form-table .list-table td {
|
1953 |
+
padding: 15px 0px;
|
1954 |
+
}
|
1955 |
+
|
1956 |
+
.woocommerce.yith-plugin-fw-panel .yith-plugin-ui table.form-table .bulkactions select {
|
1957 |
+
border: 1px solid #d8d8d8;
|
1958 |
+
max-width: 200px;
|
1959 |
+
max-height: 30px;
|
1960 |
+
padding: 0 10px;
|
1961 |
+
margin-right: 5px;
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
.yith-plugin-ui .form-table .list-table th {
|
1965 |
+
width: initial;
|
1966 |
+
}
|
1967 |
+
|
1968 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tbody td {
|
1969 |
+
padding-left: 20px;
|
1970 |
+
}
|
1971 |
+
|
1972 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table th,
|
1973 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table td {
|
1974 |
+
padding: 15px 20px 15px 20px;
|
1975 |
+
}
|
1976 |
+
|
1977 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead td,
|
1978 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead th,
|
1979 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot td,
|
1980 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot th {
|
1981 |
+
padding: 3px 20px;
|
1982 |
+
}
|
1983 |
+
|
1984 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table thead a,
|
1985 |
+
.yith-plugin-ui #plugin-fw-wc table.wp-list-table tfoot a {
|
1986 |
+
padding-left: 0;
|
1987 |
+
}
|
1988 |
+
|
1989 |
+
.yith-plugin-ui .yith-plugin-fw-list-table h2 {
|
1990 |
+
border: 0;
|
1991 |
+
padding: 35px 0 15px;
|
1992 |
+
display: inline-block;
|
1993 |
+
margin-right: 10px;
|
1994 |
+
}
|
1995 |
+
|
1996 |
+
.yith-plugin-ui .form-table .yith-plugin-fw-list-table table th {
|
1997 |
+
vertical-align: middle;
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
.yith-plugin-ui .yith-plugin-fw-list-table-container {
|
2001 |
+
padding: 0 20px;
|
2002 |
+
}
|
2003 |
+
|
2004 |
+
.yith-plugin-ui #doaction, .yith-plugin-ui #doaction2,
|
2005 |
+
.yith-plugin-ui #post-query-submit,
|
2006 |
+
.yith-plugin-ui #search-submit,
|
2007 |
+
.yith-plugin-ui .button.filter-button {
|
2008 |
+
margin-left: 0;
|
2009 |
+
height: 33px;
|
2010 |
+
padding: 0 10px;
|
2011 |
+
line-height: 33px;
|
2012 |
+
}
|
2013 |
+
|
2014 |
+
.yith-plugin-ui .bulkactions {
|
2015 |
+
margin: 10px 0;
|
2016 |
+
}
|
2017 |
+
|
2018 |
+
.yith-plugin-ui .form-table td p.yith-section-description {
|
2019 |
+
color: #716269;
|
2020 |
+
margin-bottom: 20px;
|
2021 |
+
}
|
2022 |
+
|
2023 |
+
/** Time picker width*/
|
2024 |
+
.yith-plugin-ui input.ui-timepicker-input {
|
2025 |
+
width: 100px !important;
|
2026 |
+
}
|
2027 |
+
|
2028 |
+
/** date format **/
|
2029 |
+
.yith-plugin-ui .yith-plugin-fw-date-format code {
|
2030 |
+
margin-left: 30px;
|
2031 |
+
}
|
2032 |
+
|
2033 |
+
.yith-plugin-ui .yith-plugin-fw-date-format input[type=text].small-text {
|
2034 |
+
margin-left: 45px;
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
/** checkbox columns **/
|
2038 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
|
2039 |
+
width: calc(50% - 20px);
|
2040 |
+
padding-right: 20px;
|
2041 |
+
float: left;
|
2042 |
+
}
|
2043 |
+
|
2044 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1) {
|
2045 |
+
clear: both;
|
2046 |
+
}
|
2047 |
+
|
2048 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2049 |
+
width: calc(33% - 10px);
|
2050 |
+
padding-right: 10px;
|
2051 |
+
float: left;
|
2052 |
+
}
|
2053 |
+
|
2054 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2055 |
+
clear: both;
|
2056 |
+
}
|
2057 |
+
|
2058 |
+
.yith-plugin-fw-checkbox-field-wrapper {
|
2059 |
+
display: inline-block !important;
|
2060 |
+
}
|
2061 |
+
|
2062 |
+
.yith-plugin-fw-checkbox-field-wrapper + span.description {
|
2063 |
+
display: inline-block;
|
2064 |
+
vertical-align: middle;
|
2065 |
+
margin: 0;
|
2066 |
+
}
|
2067 |
+
|
2068 |
+
.yith-plugin-ui span.description {
|
2069 |
+
margin-top: 10px;
|
2070 |
+
line-height: 20px;
|
2071 |
+
}
|
2072 |
+
|
2073 |
+
.yith-plugin-fw-option-with-description {
|
2074 |
+
display: table-cell;
|
2075 |
+
width: auto;
|
2076 |
+
vertical-align: top;
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
/** YITH PANEL **/
|
2080 |
+
.yith-plugin-ui #yith-plugin-fw-panel {
|
2081 |
+
margin-top: -10px;
|
2082 |
+
}
|
2083 |
+
|
2084 |
+
.yith-plugin-ui #plugin-fw-wc, .yith-plugin-ui #yith-plugin-fw-panel {
|
2085 |
+
padding-top: 0;
|
2086 |
+
}
|
2087 |
+
|
2088 |
+
.yith-plugin-ui .plugin-option tr {
|
2089 |
+
border: 0;
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
@media screen and (max-width: 1440px) {
|
2093 |
+
.yith-plugin-ui .yith-add-box,
|
2094 |
+
.yith-plugin-ui .yith-toggle-row {
|
2095 |
+
width: 80%;
|
2096 |
+
}
|
2097 |
+
}
|
2098 |
+
|
2099 |
+
@media screen and (max-width: 1024px) {
|
2100 |
+
.yith-plugin-ui .yith-add-box,
|
2101 |
+
.yith-plugin-ui .yith-toggle-row {
|
2102 |
+
width: 90%;
|
2103 |
+
}
|
2104 |
+
|
2105 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset {
|
2106 |
+
width: 100%;
|
2107 |
+
padding-right: 20px;
|
2108 |
+
float: left;
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2112 |
+
width: calc(50% - 10px);
|
2113 |
+
padding-right: 10px;
|
2114 |
+
float: left;
|
2115 |
+
}
|
2116 |
+
|
2117 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset:nth-child(2n+1) {
|
2118 |
+
clear: both;
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset:nth-child(3n+1) {
|
2122 |
+
clear: initial;
|
2123 |
+
}
|
2124 |
+
}
|
2125 |
+
|
2126 |
+
@media screen and (max-width: 782px) {
|
2127 |
+
.yith-plugin-fw-banner.yith-plugin-fw-banner-free {
|
2128 |
+
height: auto;
|
2129 |
+
background-color: #a9c7d3;
|
2130 |
+
}
|
2131 |
+
|
2132 |
+
.yith-plugin-fw-banner.yith-plugin-fw-banner-free ul {
|
2133 |
+
width: 90%;
|
2134 |
+
text-align: center;
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
.yith-plugin-fw-banner.yith-plugin-fw-banner-free li img {
|
2138 |
+
width: 90%;
|
2139 |
+
margin: 0 auto;
|
2140 |
+
}
|
2141 |
+
|
2142 |
+
.yith-plugin-fw-banner h1 {
|
2143 |
+
line-height: 1.2em;
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
.yith-plugin-ui .yith-add-box,
|
2147 |
+
.yith-plugin-ui .yith-toggle-row {
|
2148 |
+
width: 100%;
|
2149 |
+
}
|
2150 |
+
|
2151 |
+
.yith-plugin-ui td.forminp-checkbox.two-cols fieldset,
|
2152 |
+
.yith-plugin-ui td.forminp-checkbox.three-cols fieldset {
|
2153 |
+
width: 100%;
|
2154 |
+
clear: initial;
|
2155 |
+
}
|
2156 |
+
|
2157 |
+
}
|
plugin-fw/assets/css/yith-select2-no-wc.css
CHANGED
@@ -1,741 +1,741 @@
|
|
1 |
-
.select2-container {
|
2 |
-
-webkit-box-sizing : border-box;
|
3 |
-
box-sizing : border-box;
|
4 |
-
display : inline-block;
|
5 |
-
margin : 0;
|
6 |
-
position : relative;
|
7 |
-
vertical-align : middle
|
8 |
-
}
|
9 |
-
|
10 |
-
.select2-container .select2-selection--single {
|
11 |
-
-webkit-box-sizing : border-box;
|
12 |
-
box-sizing : border-box;
|
13 |
-
cursor : pointer;
|
14 |
-
display : block;
|
15 |
-
height : 28px;
|
16 |
-
margin : 0 0 -4px;
|
17 |
-
-moz-user-select : none;
|
18 |
-
-ms-user-select : none;
|
19 |
-
user-select : none;
|
20 |
-
-webkit-user-select : none
|
21 |
-
}
|
22 |
-
|
23 |
-
.select2-container .select2-selection--single .select2-selection__rendered {
|
24 |
-
display : block;
|
25 |
-
padding-left : 8px;
|
26 |
-
padding-right : 20px;
|
27 |
-
overflow : hidden;
|
28 |
-
text-overflow : ellipsis;
|
29 |
-
white-space : nowrap
|
30 |
-
}
|
31 |
-
|
32 |
-
.select2-container .select2-selection--single .select2-selection__clear {
|
33 |
-
position : relative
|
34 |
-
}
|
35 |
-
|
36 |
-
.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered {
|
37 |
-
padding-right : 8px;
|
38 |
-
padding-left : 20px
|
39 |
-
}
|
40 |
-
|
41 |
-
.select2-container .select2-selection--multiple {
|
42 |
-
-webkit-box-sizing : border-box;
|
43 |
-
box-sizing : border-box;
|
44 |
-
cursor : pointer;
|
45 |
-
display : block;
|
46 |
-
min-height : 32px;
|
47 |
-
-moz-user-select : none;
|
48 |
-
-ms-user-select : none;
|
49 |
-
user-select : none;
|
50 |
-
-webkit-user-select : none
|
51 |
-
}
|
52 |
-
|
53 |
-
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
54 |
-
display : inline-block;
|
55 |
-
overflow : hidden;
|
56 |
-
padding-left : 8px;
|
57 |
-
text-overflow : ellipsis;
|
58 |
-
white-space : nowrap
|
59 |
-
}
|
60 |
-
|
61 |
-
.select2-container .select2-search--inline {
|
62 |
-
float : left;
|
63 |
-
padding : 0
|
64 |
-
}
|
65 |
-
|
66 |
-
.select2-container .select2-search--inline .select2-search__field {
|
67 |
-
-webkit-box-sizing : border-box;
|
68 |
-
box-sizing : border-box;
|
69 |
-
border : none;
|
70 |
-
font-size : 100%;
|
71 |
-
margin : 0;
|
72 |
-
padding : 0
|
73 |
-
}
|
74 |
-
|
75 |
-
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
76 |
-
-webkit-appearance : none
|
77 |
-
}
|
78 |
-
|
79 |
-
.select2-dropdown {
|
80 |
-
background-color : #fff;
|
81 |
-
border : 1px solid #aaa;
|
82 |
-
border-radius : 4px;
|
83 |
-
-webkit-box-sizing : border-box;
|
84 |
-
box-sizing : border-box;
|
85 |
-
display : block;
|
86 |
-
position : absolute;
|
87 |
-
left : -100000px;
|
88 |
-
width : 100%;
|
89 |
-
z-index : 1051
|
90 |
-
}
|
91 |
-
|
92 |
-
.select2-results {
|
93 |
-
display : block
|
94 |
-
}
|
95 |
-
|
96 |
-
.select2-results__options {
|
97 |
-
list-style : none;
|
98 |
-
margin : 0;
|
99 |
-
padding : 0
|
100 |
-
}
|
101 |
-
|
102 |
-
.select2-results__option {
|
103 |
-
padding : 6px;
|
104 |
-
-moz-user-select : none;
|
105 |
-
-ms-user-select : none;
|
106 |
-
user-select : none;
|
107 |
-
-webkit-user-select : none
|
108 |
-
}
|
109 |
-
|
110 |
-
.select2-results__option[aria-selected], .select2-results__option[data-selected] {
|
111 |
-
cursor : pointer
|
112 |
-
}
|
113 |
-
|
114 |
-
.select2-container--open .select2-dropdown {
|
115 |
-
left : 0
|
116 |
-
}
|
117 |
-
|
118 |
-
.select2-container--open .select2-dropdown--above {
|
119 |
-
border-bottom : none;
|
120 |
-
border-bottom-left-radius : 0;
|
121 |
-
border-bottom-right-radius : 0
|
122 |
-
}
|
123 |
-
|
124 |
-
.select2-container--open .select2-dropdown--below {
|
125 |
-
border-top : none;
|
126 |
-
border-top-left-radius : 0;
|
127 |
-
border-top-right-radius : 0
|
128 |
-
}
|
129 |
-
|
130 |
-
.select2-search--dropdown {
|
131 |
-
display : block;
|
132 |
-
padding : 4px
|
133 |
-
}
|
134 |
-
|
135 |
-
.select2-search--dropdown .select2-search__field {
|
136 |
-
padding : 4px;
|
137 |
-
width : 100%;
|
138 |
-
-webkit-box-sizing : border-box;
|
139 |
-
box-sizing : border-box
|
140 |
-
}
|
141 |
-
|
142 |
-
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
143 |
-
-webkit-appearance : none
|
144 |
-
}
|
145 |
-
|
146 |
-
.select2-search--dropdown.select2-search--hide {
|
147 |
-
display : none
|
148 |
-
}
|
149 |
-
|
150 |
-
.select2-close-mask {
|
151 |
-
border : 0;
|
152 |
-
margin : 0;
|
153 |
-
padding : 0;
|
154 |
-
display : block;
|
155 |
-
position : fixed;
|
156 |
-
left : 0;
|
157 |
-
top : 0;
|
158 |
-
min-height : 100%;
|
159 |
-
min-width : 100%;
|
160 |
-
height : auto;
|
161 |
-
width : auto;
|
162 |
-
opacity : 0;
|
163 |
-
z-index : 99;
|
164 |
-
background-color : #fff
|
165 |
-
}
|
166 |
-
|
167 |
-
.select2-hidden-accessible {
|
168 |
-
border : 0 !important;
|
169 |
-
clip : rect(0 0 0 0) !important;
|
170 |
-
height : 1px !important;
|
171 |
-
margin : -1px !important;
|
172 |
-
overflow : hidden !important;
|
173 |
-
padding : 0 !important;
|
174 |
-
position : absolute !important;
|
175 |
-
width : 1px !important
|
176 |
-
}
|
177 |
-
|
178 |
-
.select2-container--default .select2-selection--single {
|
179 |
-
background-color : #fff;
|
180 |
-
border : 1px solid #aaa;
|
181 |
-
border-radius : 4px
|
182 |
-
}
|
183 |
-
|
184 |
-
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
185 |
-
color : #444;
|
186 |
-
line-height : 28px
|
187 |
-
}
|
188 |
-
|
189 |
-
.select2-container--default .select2-selection--single .select2-selection__clear {
|
190 |
-
cursor : pointer;
|
191 |
-
float : right;
|
192 |
-
font-weight : 700
|
193 |
-
}
|
194 |
-
|
195 |
-
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
196 |
-
color : #999
|
197 |
-
}
|
198 |
-
|
199 |
-
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
200 |
-
height : 26px;
|
201 |
-
position : absolute;
|
202 |
-
top : 1px;
|
203 |
-
right : 1px;
|
204 |
-
width : 20px
|
205 |
-
}
|
206 |
-
|
207 |
-
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
208 |
-
border-color : #888 transparent transparent transparent;
|
209 |
-
border-style : solid;
|
210 |
-
border-width : 5px 4px 0 4px;
|
211 |
-
height : 0;
|
212 |
-
left : 50%;
|
213 |
-
margin-left : -4px;
|
214 |
-
margin-top : -2px;
|
215 |
-
position : absolute;
|
216 |
-
top : 50%;
|
217 |
-
width : 0
|
218 |
-
}
|
219 |
-
|
220 |
-
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear {
|
221 |
-
float : left
|
222 |
-
}
|
223 |
-
|
224 |
-
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow {
|
225 |
-
left : 1px;
|
226 |
-
right : auto
|
227 |
-
}
|
228 |
-
|
229 |
-
.select2-container--default.select2-container--disabled .select2-selection--single {
|
230 |
-
background-color : #eee;
|
231 |
-
cursor : default
|
232 |
-
}
|
233 |
-
|
234 |
-
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
235 |
-
display : none
|
236 |
-
}
|
237 |
-
|
238 |
-
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
239 |
-
border-color : transparent transparent #888 transparent;
|
240 |
-
border-width : 0 4px 5px 4px
|
241 |
-
}
|
242 |
-
|
243 |
-
.select2-container--default .select2-selection--multiple {
|
244 |
-
background-color : #fff;
|
245 |
-
border : 1px solid #aaa;
|
246 |
-
cursor : text;
|
247 |
-
}
|
248 |
-
|
249 |
-
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
250 |
-
-webkit-box-sizing : border-box;
|
251 |
-
box-sizing : border-box;
|
252 |
-
list-style : none;
|
253 |
-
margin : 0;
|
254 |
-
padding : 0 5px;
|
255 |
-
width : 100%
|
256 |
-
}
|
257 |
-
|
258 |
-
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
259 |
-
list-style : none;
|
260 |
-
margin : 5px 5px 0 0
|
261 |
-
}
|
262 |
-
|
263 |
-
.select2-container--default .select2-selection--multiple .select2-selection__rendered li:before {
|
264 |
-
content : '';
|
265 |
-
display : none
|
266 |
-
}
|
267 |
-
|
268 |
-
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
269 |
-
color : #999;
|
270 |
-
margin-top : 5px;
|
271 |
-
float : left
|
272 |
-
}
|
273 |
-
|
274 |
-
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
275 |
-
cursor : pointer;
|
276 |
-
float : right;
|
277 |
-
font-weight : 700;
|
278 |
-
margin-top : 5px;
|
279 |
-
margin-right : 10px
|
280 |
-
}
|
281 |
-
|
282 |
-
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
283 |
-
background-color : #e4e4e4;
|
284 |
-
border : 1px solid #aaa;
|
285 |
-
border-radius : 4px;
|
286 |
-
cursor : default;
|
287 |
-
float : left;
|
288 |
-
margin-right : 5px;
|
289 |
-
margin-top : 5px;
|
290 |
-
padding : 0 5px
|
291 |
-
}
|
292 |
-
|
293 |
-
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
294 |
-
color : #999;
|
295 |
-
cursor : pointer;
|
296 |
-
display : inline-block;
|
297 |
-
font-weight : 700;
|
298 |
-
margin-right : 2px
|
299 |
-
}
|
300 |
-
|
301 |
-
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
302 |
-
color : #333
|
303 |
-
}
|
304 |
-
|
305 |
-
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline, .select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder {
|
306 |
-
float : right
|
307 |
-
}
|
308 |
-
|
309 |
-
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
310 |
-
margin-left : 5px;
|
311 |
-
margin-right : auto
|
312 |
-
}
|
313 |
-
|
314 |
-
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove {
|
315 |
-
margin-left : 2px;
|
316 |
-
margin-right : auto
|
317 |
-
}
|
318 |
-
|
319 |
-
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
320 |
-
border : solid #000 1px;
|
321 |
-
outline : 0
|
322 |
-
}
|
323 |
-
|
324 |
-
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
325 |
-
background-color : #eee;
|
326 |
-
cursor : default
|
327 |
-
}
|
328 |
-
|
329 |
-
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
330 |
-
display : none
|
331 |
-
}
|
332 |
-
|
333 |
-
.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple, .select2-container--default.select2-container--open.select2-container--above .select2-selection--single {
|
334 |
-
border-top-left-radius : 0;
|
335 |
-
border-top-right-radius : 0
|
336 |
-
}
|
337 |
-
|
338 |
-
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple, .select2-container--default.select2-container--open.select2-container--below .select2-selection--single {
|
339 |
-
border-bottom-left-radius : 0;
|
340 |
-
border-bottom-right-radius : 0
|
341 |
-
}
|
342 |
-
|
343 |
-
.select2-container--default .select2-search--dropdown .select2-search__field {
|
344 |
-
border : 1px solid #aaa
|
345 |
-
}
|
346 |
-
|
347 |
-
.select2-container--default .select2-search--inline .select2-search__field {
|
348 |
-
background : 0 0;
|
349 |
-
border : none;
|
350 |
-
outline : 0;
|
351 |
-
-webkit-box-shadow : none;
|
352 |
-
box-shadow : none;
|
353 |
-
-webkit-appearance : textfield
|
354 |
-
}
|
355 |
-
|
356 |
-
.select2-container--default .select2-results > .select2-results__options {
|
357 |
-
max-height : 200px;
|
358 |
-
overflow-y : auto
|
359 |
-
}
|
360 |
-
|
361 |
-
.select2-container--default .select2-results__option[role=group] {
|
362 |
-
padding : 0
|
363 |
-
}
|
364 |
-
|
365 |
-
.select2-container--default .select2-results__option[aria-disabled=true] {
|
366 |
-
color : #999
|
367 |
-
}
|
368 |
-
|
369 |
-
.select2-container--default .select2-results__option[aria-selected=true], .select2-container--default .select2-results__option[data-selected=true] {
|
370 |
-
background-color : #ddd
|
371 |
-
}
|
372 |
-
|
373 |
-
.select2-container--default .select2-results__option .select2-results__option {
|
374 |
-
padding-left : 1em
|
375 |
-
}
|
376 |
-
|
377 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
378 |
-
padding-left : 0
|
379 |
-
}
|
380 |
-
|
381 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
382 |
-
margin-left : -1em;
|
383 |
-
padding-left : 2em
|
384 |
-
}
|
385 |
-
|
386 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
387 |
-
margin-left : -2em;
|
388 |
-
padding-left : 3em
|
389 |
-
}
|
390 |
-
|
391 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
392 |
-
margin-left : -3em;
|
393 |
-
padding-left : 4em
|
394 |
-
}
|
395 |
-
|
396 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
397 |
-
margin-left : -4em;
|
398 |
-
padding-left : 5em
|
399 |
-
}
|
400 |
-
|
401 |
-
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
402 |
-
margin-left : -5em;
|
403 |
-
padding-left : 6em
|
404 |
-
}
|
405 |
-
|
406 |
-
.select2-container--default .select2-results__option--highlighted[aria-selected], .select2-container--default .select2-results__option--highlighted[data-selected] {
|
407 |
-
background-color : #0073aa;
|
408 |
-
color : #fff
|
409 |
-
}
|
410 |
-
|
411 |
-
.select2-container--default .select2-results__group {
|
412 |
-
cursor : default;
|
413 |
-
display : block;
|
414 |
-
padding : 6px
|
415 |
-
}
|
416 |
-
|
417 |
-
.select2-container--classic .select2-selection--single {
|
418 |
-
background-color : #f7f7f7;
|
419 |
-
border : 1px solid #aaa;
|
420 |
-
border-radius : 4px;
|
421 |
-
outline : 0;
|
422 |
-
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #fff), to(#eee));
|
423 |
-
background-image : -webkit-linear-gradient(top, #fff 50%, #eee 100%);
|
424 |
-
background-image : linear-gradient(to bottom, #fff 50%, #eee 100%);
|
425 |
-
background-repeat : repeat-x
|
426 |
-
}
|
427 |
-
|
428 |
-
.select2-container--classic .select2-selection--single:focus {
|
429 |
-
border : 1px solid #0073aa
|
430 |
-
}
|
431 |
-
|
432 |
-
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
433 |
-
color : #444;
|
434 |
-
line-height : 28px
|
435 |
-
}
|
436 |
-
|
437 |
-
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
438 |
-
cursor : pointer;
|
439 |
-
float : right;
|
440 |
-
font-weight : 700;
|
441 |
-
margin-right : 10px
|
442 |
-
}
|
443 |
-
|
444 |
-
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
445 |
-
color : #999
|
446 |
-
}
|
447 |
-
|
448 |
-
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
449 |
-
background-color : #ddd;
|
450 |
-
border : none;
|
451 |
-
border-left : 1px solid #aaa;
|
452 |
-
border-top-right-radius : 4px;
|
453 |
-
border-bottom-right-radius : 4px;
|
454 |
-
height : 26px;
|
455 |
-
position : absolute;
|
456 |
-
top : 1px;
|
457 |
-
right : 1px;
|
458 |
-
width : 20px;
|
459 |
-
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #eee), to(#ccc));
|
460 |
-
background-image : -webkit-linear-gradient(top, #eee 50%, #ccc 100%);
|
461 |
-
background-image : linear-gradient(to bottom, #eee 50%, #ccc 100%);
|
462 |
-
background-repeat : repeat-x
|
463 |
-
}
|
464 |
-
|
465 |
-
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
466 |
-
border-color : #888 transparent transparent transparent;
|
467 |
-
border-style : solid;
|
468 |
-
border-width : 5px 4px 0 4px;
|
469 |
-
height : 0;
|
470 |
-
left : 50%;
|
471 |
-
margin-left : -4px;
|
472 |
-
margin-top : -2px;
|
473 |
-
position : absolute;
|
474 |
-
top : 50%;
|
475 |
-
width : 0
|
476 |
-
}
|
477 |
-
|
478 |
-
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear {
|
479 |
-
float : left
|
480 |
-
}
|
481 |
-
|
482 |
-
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow {
|
483 |
-
border : none;
|
484 |
-
border-right : 1px solid #aaa;
|
485 |
-
border-radius : 0;
|
486 |
-
border-top-left-radius : 4px;
|
487 |
-
border-bottom-left-radius : 4px;
|
488 |
-
left : 1px;
|
489 |
-
right : auto
|
490 |
-
}
|
491 |
-
|
492 |
-
.select2-container--classic.select2-container--open .select2-selection--single {
|
493 |
-
border : 1px solid #0073aa
|
494 |
-
}
|
495 |
-
|
496 |
-
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
497 |
-
background : 0 0;
|
498 |
-
border : none
|
499 |
-
}
|
500 |
-
|
501 |
-
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
502 |
-
border-color : transparent transparent #888 transparent;
|
503 |
-
border-width : 0 4px 5px 4px
|
504 |
-
}
|
505 |
-
|
506 |
-
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
507 |
-
border-top : none;
|
508 |
-
border-top-left-radius : 0;
|
509 |
-
border-top-right-radius : 0;
|
510 |
-
background-image : -webkit-gradient(linear, left top, left bottom, from(white), color-stop(50%, #eee));
|
511 |
-
background-image : -webkit-linear-gradient(top, #fff 0, #eee 50%);
|
512 |
-
background-image : linear-gradient(to bottom, #fff 0, #eee 50%);
|
513 |
-
background-repeat : repeat-x
|
514 |
-
}
|
515 |
-
|
516 |
-
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
517 |
-
border-bottom : none;
|
518 |
-
border-bottom-left-radius : 0;
|
519 |
-
border-bottom-right-radius : 0;
|
520 |
-
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #eee), to(white));
|
521 |
-
background-image : -webkit-linear-gradient(top, #eee 50%, #fff 100%);
|
522 |
-
background-image : linear-gradient(to bottom, #eee 50%, #fff 100%);
|
523 |
-
background-repeat : repeat-x
|
524 |
-
}
|
525 |
-
|
526 |
-
.select2-container--classic .select2-selection--multiple {
|
527 |
-
background-color : #fff;
|
528 |
-
border : 1px solid #aaa;
|
529 |
-
border-radius : 4px;
|
530 |
-
cursor : text;
|
531 |
-
outline : 0
|
532 |
-
}
|
533 |
-
|
534 |
-
.select2-container--classic .select2-selection--multiple:focus {
|
535 |
-
border : 1px solid #0073aa
|
536 |
-
}
|
537 |
-
|
538 |
-
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
539 |
-
list-style : none;
|
540 |
-
margin : 0;
|
541 |
-
padding : 0 5px
|
542 |
-
}
|
543 |
-
|
544 |
-
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
545 |
-
display : none
|
546 |
-
}
|
547 |
-
|
548 |
-
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
549 |
-
background-color : #e4e4e4;
|
550 |
-
border : 1px solid #aaa;
|
551 |
-
border-radius : 4px;
|
552 |
-
cursor : default;
|
553 |
-
float : left;
|
554 |
-
margin-right : 5px;
|
555 |
-
margin-top : 5px;
|
556 |
-
padding : 0 5px
|
557 |
-
}
|
558 |
-
|
559 |
-
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
560 |
-
color : #888;
|
561 |
-
cursor : pointer;
|
562 |
-
display : inline-block;
|
563 |
-
font-weight : 700;
|
564 |
-
margin-right : 2px
|
565 |
-
}
|
566 |
-
|
567 |
-
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
568 |
-
color : #555
|
569 |
-
}
|
570 |
-
|
571 |
-
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
572 |
-
float : right
|
573 |
-
}
|
574 |
-
|
575 |
-
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
576 |
-
margin-left : 5px;
|
577 |
-
margin-right : auto
|
578 |
-
}
|
579 |
-
|
580 |
-
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove {
|
581 |
-
margin-left : 2px;
|
582 |
-
margin-right : auto
|
583 |
-
}
|
584 |
-
|
585 |
-
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
586 |
-
border : 1px solid #0073aa
|
587 |
-
}
|
588 |
-
|
589 |
-
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
590 |
-
border-top : none;
|
591 |
-
border-top-left-radius : 0;
|
592 |
-
border-top-right-radius : 0
|
593 |
-
}
|
594 |
-
|
595 |
-
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
596 |
-
border-bottom : none;
|
597 |
-
border-bottom-left-radius : 0;
|
598 |
-
border-bottom-right-radius : 0
|
599 |
-
}
|
600 |
-
|
601 |
-
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
602 |
-
border : 1px solid #aaa;
|
603 |
-
outline : 0
|
604 |
-
}
|
605 |
-
|
606 |
-
.select2-container--classic .select2-search--inline .select2-search__field {
|
607 |
-
outline : 0;
|
608 |
-
-webkit-box-shadow : none;
|
609 |
-
box-shadow : none
|
610 |
-
}
|
611 |
-
|
612 |
-
.select2-container--classic .select2-dropdown {
|
613 |
-
background-color : #fff;
|
614 |
-
border : 1px solid transparent
|
615 |
-
}
|
616 |
-
|
617 |
-
.select2-container--classic .select2-dropdown--above {
|
618 |
-
border-bottom : none
|
619 |
-
}
|
620 |
-
|
621 |
-
.select2-container--classic .select2-dropdown--below {
|
622 |
-
border-top : none
|
623 |
-
}
|
624 |
-
|
625 |
-
.select2-container--classic .select2-results > .select2-results__options {
|
626 |
-
max-height : 200px;
|
627 |
-
overflow-y : auto
|
628 |
-
}
|
629 |
-
|
630 |
-
.select2-container--classic .select2-results__option[role=group] {
|
631 |
-
padding : 0
|
632 |
-
}
|
633 |
-
|
634 |
-
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
635 |
-
color : grey
|
636 |
-
}
|
637 |
-
|
638 |
-
.select2-container--classic .select2-results__option--highlighted[aria-selected], .select2-container--classic .select2-results__option--highlighted[data-selected] {
|
639 |
-
background-color : #3875d7;
|
640 |
-
color : #fff
|
641 |
-
}
|
642 |
-
|
643 |
-
.select2-container--classic .select2-results__group {
|
644 |
-
cursor : default;
|
645 |
-
display : block;
|
646 |
-
padding : 6px
|
647 |
-
}
|
648 |
-
|
649 |
-
.select2-container--classic.select2-container--open .select2-dropdown {
|
650 |
-
border-color : #0073aa
|
651 |
-
}
|
652 |
-
|
653 |
-
|
654 |
-
.select2-drop, .select2-dropdown {
|
655 |
-
z-index : 999999 !important
|
656 |
-
}
|
657 |
-
|
658 |
-
.select2-results {
|
659 |
-
line-height : 1.5em
|
660 |
-
}
|
661 |
-
|
662 |
-
.select2-results .select2-results__group, .select2-results .select2-results__option {
|
663 |
-
margin : 0;
|
664 |
-
padding : 8px
|
665 |
-
}
|
666 |
-
|
667 |
-
.select2-results .description {
|
668 |
-
display : block;
|
669 |
-
color : #999;
|
670 |
-
padding-top : 4px
|
671 |
-
}
|
672 |
-
|
673 |
-
.select2-dropdown {
|
674 |
-
border-color : #ddd
|
675 |
-
}
|
676 |
-
|
677 |
-
.select2-dropdown--below {
|
678 |
-
-webkit-box-shadow : 0 1px 1px rgba(0, 0, 0, .1);
|
679 |
-
box-shadow : 0 1px 1px rgba(0, 0, 0, .1)
|
680 |
-
}
|
681 |
-
|
682 |
-
.select2-dropdown--above {
|
683 |
-
-webkit-box-shadow : 0 -1px 1px rgba(0, 0, 0, .1);
|
684 |
-
box-shadow : 0 -1px 1px rgba(0, 0, 0, .1)
|
685 |
-
}
|
686 |
-
|
687 |
-
.select2-container .select2-selection__rendered.ui-sortable li {
|
688 |
-
cursor : move
|
689 |
-
}
|
690 |
-
|
691 |
-
.select2-container .select2-selection {
|
692 |
-
border-color : #ddd
|
693 |
-
}
|
694 |
-
|
695 |
-
.select2-container .select2-search__field {
|
696 |
-
min-width : 150px
|
697 |
-
}
|
698 |
-
|
699 |
-
.select2-container .select2-selection--single {
|
700 |
-
height : 32px
|
701 |
-
}
|
702 |
-
|
703 |
-
.select2-container .select2-selection--single .select2-selection__rendered {
|
704 |
-
line-height : 32px;
|
705 |
-
padding-right : 24px
|
706 |
-
}
|
707 |
-
|
708 |
-
.select2-container .select2-selection--single .select2-selection__arrow {
|
709 |
-
right : 3px;
|
710 |
-
height : 30px
|
711 |
-
}
|
712 |
-
|
713 |
-
.select2-container .select2-selection--multiple {
|
714 |
-
min-height : 28px;
|
715 |
-
border-radius : 0;
|
716 |
-
line-height : 1.5
|
717 |
-
}
|
718 |
-
|
719 |
-
.select2-container .select2-selection--multiple li {
|
720 |
-
margin : 0
|
721 |
-
}
|
722 |
-
|
723 |
-
.select2-container .select2-selection--multiple .select2-selection__choice {
|
724 |
-
padding : 2px 6px
|
725 |
-
}
|
726 |
-
|
727 |
-
.select2-container .select2-selection--multiple .select2-selection__choice .description {
|
728 |
-
display : none
|
729 |
-
}
|
730 |
-
|
731 |
-
.select2-container .select2-selection__clear {
|
732 |
-
color : #999;
|
733 |
-
margin-top : -1px
|
734 |
-
}
|
735 |
-
|
736 |
-
.select2-container .select2-search--inline .select2-search__field {
|
737 |
-
font-family : inherit;
|
738 |
-
font-size : inherit;
|
739 |
-
font-weight : inherit;
|
740 |
-
padding : 3px 0
|
741 |
}
|
1 |
+
.select2-container {
|
2 |
+
-webkit-box-sizing : border-box;
|
3 |
+
box-sizing : border-box;
|
4 |
+
display : inline-block;
|
5 |
+
margin : 0;
|
6 |
+
position : relative;
|
7 |
+
vertical-align : middle
|
8 |
+
}
|
9 |
+
|
10 |
+
.select2-container .select2-selection--single {
|
11 |
+
-webkit-box-sizing : border-box;
|
12 |
+
box-sizing : border-box;
|
13 |
+
cursor : pointer;
|
14 |
+
display : block;
|
15 |
+
height : 28px;
|
16 |
+
margin : 0 0 -4px;
|
17 |
+
-moz-user-select : none;
|
18 |
+
-ms-user-select : none;
|
19 |
+
user-select : none;
|
20 |
+
-webkit-user-select : none
|
21 |
+
}
|
22 |
+
|
23 |
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
24 |
+
display : block;
|
25 |
+
padding-left : 8px;
|
26 |
+
padding-right : 20px;
|
27 |
+
overflow : hidden;
|
28 |
+
text-overflow : ellipsis;
|
29 |
+
white-space : nowrap
|
30 |
+
}
|
31 |
+
|
32 |
+
.select2-container .select2-selection--single .select2-selection__clear {
|
33 |
+
position : relative
|
34 |
+
}
|
35 |
+
|
36 |
+
.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered {
|
37 |
+
padding-right : 8px;
|
38 |
+
padding-left : 20px
|
39 |
+
}
|
40 |
+
|
41 |
+
.select2-container .select2-selection--multiple {
|
42 |
+
-webkit-box-sizing : border-box;
|
43 |
+
box-sizing : border-box;
|
44 |
+
cursor : pointer;
|
45 |
+
display : block;
|
46 |
+
min-height : 32px;
|
47 |
+
-moz-user-select : none;
|
48 |
+
-ms-user-select : none;
|
49 |
+
user-select : none;
|
50 |
+
-webkit-user-select : none
|
51 |
+
}
|
52 |
+
|
53 |
+
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
54 |
+
display : inline-block;
|
55 |
+
overflow : hidden;
|
56 |
+
padding-left : 8px;
|
57 |
+
text-overflow : ellipsis;
|
58 |
+
white-space : nowrap
|
59 |
+
}
|
60 |
+
|
61 |
+
.select2-container .select2-search--inline {
|
62 |
+
float : left;
|
63 |
+
padding : 0
|
64 |
+
}
|
65 |
+
|
66 |
+
.select2-container .select2-search--inline .select2-search__field {
|
67 |
+
-webkit-box-sizing : border-box;
|
68 |
+
box-sizing : border-box;
|
69 |
+
border : none;
|
70 |
+
font-size : 100%;
|
71 |
+
margin : 0;
|
72 |
+
padding : 0
|
73 |
+
}
|
74 |
+
|
75 |
+
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
76 |
+
-webkit-appearance : none
|
77 |
+
}
|
78 |
+
|
79 |
+
.select2-dropdown {
|
80 |
+
background-color : #fff;
|
81 |
+
border : 1px solid #aaa;
|
82 |
+
border-radius : 4px;
|
83 |
+
-webkit-box-sizing : border-box;
|
84 |
+
box-sizing : border-box;
|
85 |
+
display : block;
|
86 |
+
position : absolute;
|
87 |
+
left : -100000px;
|
88 |
+
width : 100%;
|
89 |
+
z-index : 1051
|
90 |
+
}
|
91 |
+
|
92 |
+
.select2-results {
|
93 |
+
display : block
|
94 |
+
}
|
95 |
+
|
96 |
+
.select2-results__options {
|
97 |
+
list-style : none;
|
98 |
+
margin : 0;
|
99 |
+
padding : 0
|
100 |
+
}
|
101 |
+
|
102 |
+
.select2-results__option {
|
103 |
+
padding : 6px;
|
104 |
+
-moz-user-select : none;
|
105 |
+
-ms-user-select : none;
|
106 |
+
user-select : none;
|
107 |
+
-webkit-user-select : none
|
108 |
+
}
|
109 |
+
|
110 |
+
.select2-results__option[aria-selected], .select2-results__option[data-selected] {
|
111 |
+
cursor : pointer
|
112 |
+
}
|
113 |
+
|
114 |
+
.select2-container--open .select2-dropdown {
|
115 |
+
left : 0
|
116 |
+
}
|
117 |
+
|
118 |
+
.select2-container--open .select2-dropdown--above {
|
119 |
+
border-bottom : none;
|
120 |
+
border-bottom-left-radius : 0;
|
121 |
+
border-bottom-right-radius : 0
|
122 |
+
}
|
123 |
+
|
124 |
+
.select2-container--open .select2-dropdown--below {
|
125 |
+
border-top : none;
|
126 |
+
border-top-left-radius : 0;
|
127 |
+
border-top-right-radius : 0
|
128 |
+
}
|
129 |
+
|
130 |
+
.select2-search--dropdown {
|
131 |
+
display : block;
|
132 |
+
padding : 4px
|
133 |
+
}
|
134 |
+
|
135 |
+
.select2-search--dropdown .select2-search__field {
|
136 |
+
padding : 4px;
|
137 |
+
width : 100%;
|
138 |
+
-webkit-box-sizing : border-box;
|
139 |
+
box-sizing : border-box
|
140 |
+
}
|
141 |
+
|
142 |
+
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
143 |
+
-webkit-appearance : none
|
144 |
+
}
|
145 |
+
|
146 |
+
.select2-search--dropdown.select2-search--hide {
|
147 |
+
display : none
|
148 |
+
}
|
149 |
+
|
150 |
+
.select2-close-mask {
|
151 |
+
border : 0;
|
152 |
+
margin : 0;
|
153 |
+
padding : 0;
|
154 |
+
display : block;
|
155 |
+
position : fixed;
|
156 |
+
left : 0;
|
157 |
+
top : 0;
|
158 |
+
min-height : 100%;
|
159 |
+
min-width : 100%;
|
160 |
+
height : auto;
|
161 |
+
width : auto;
|
162 |
+
opacity : 0;
|
163 |
+
z-index : 99;
|
164 |
+
background-color : #fff
|
165 |
+
}
|
166 |
+
|
167 |
+
.select2-hidden-accessible {
|
168 |
+
border : 0 !important;
|
169 |
+
clip : rect(0 0 0 0) !important;
|
170 |
+
height : 1px !important;
|
171 |
+
margin : -1px !important;
|
172 |
+
overflow : hidden !important;
|
173 |
+
padding : 0 !important;
|
174 |
+
position : absolute !important;
|
175 |
+
width : 1px !important
|
176 |
+
}
|
177 |
+
|
178 |
+
.select2-container--default .select2-selection--single {
|
179 |
+
background-color : #fff;
|
180 |
+
border : 1px solid #aaa;
|
181 |
+
border-radius : 4px
|
182 |
+
}
|
183 |
+
|
184 |
+
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
185 |
+
color : #444;
|
186 |
+
line-height : 28px
|
187 |
+
}
|
188 |
+
|
189 |
+
.select2-container--default .select2-selection--single .select2-selection__clear {
|
190 |
+
cursor : pointer;
|
191 |
+
float : right;
|
192 |
+
font-weight : 700
|
193 |
+
}
|
194 |
+
|
195 |
+
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
196 |
+
color : #999
|
197 |
+
}
|
198 |
+
|
199 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
200 |
+
height : 26px;
|
201 |
+
position : absolute;
|
202 |
+
top : 1px;
|
203 |
+
right : 1px;
|
204 |
+
width : 20px
|
205 |
+
}
|
206 |
+
|
207 |
+
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
208 |
+
border-color : #888 transparent transparent transparent;
|
209 |
+
border-style : solid;
|
210 |
+
border-width : 5px 4px 0 4px;
|
211 |
+
height : 0;
|
212 |
+
left : 50%;
|
213 |
+
margin-left : -4px;
|
214 |
+
margin-top : -2px;
|
215 |
+
position : absolute;
|
216 |
+
top : 50%;
|
217 |
+
width : 0
|
218 |
+
}
|
219 |
+
|
220 |
+
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear {
|
221 |
+
float : left
|
222 |
+
}
|
223 |
+
|
224 |
+
.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow {
|
225 |
+
left : 1px;
|
226 |
+
right : auto
|
227 |
+
}
|
228 |
+
|
229 |
+
.select2-container--default.select2-container--disabled .select2-selection--single {
|
230 |
+
background-color : #eee;
|
231 |
+
cursor : default
|
232 |
+
}
|
233 |
+
|
234 |
+
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
235 |
+
display : none
|
236 |
+
}
|
237 |
+
|
238 |
+
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
239 |
+
border-color : transparent transparent #888 transparent;
|
240 |
+
border-width : 0 4px 5px 4px
|
241 |
+
}
|
242 |
+
|
243 |
+
.select2-container--default .select2-selection--multiple {
|
244 |
+
background-color : #fff;
|
245 |
+
border : 1px solid #aaa;
|
246 |
+
cursor : text;
|
247 |
+
}
|
248 |
+
|
249 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
250 |
+
-webkit-box-sizing : border-box;
|
251 |
+
box-sizing : border-box;
|
252 |
+
list-style : none;
|
253 |
+
margin : 0;
|
254 |
+
padding : 0 5px;
|
255 |
+
width : 100%
|
256 |
+
}
|
257 |
+
|
258 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
259 |
+
list-style : none;
|
260 |
+
margin : 5px 5px 0 0
|
261 |
+
}
|
262 |
+
|
263 |
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered li:before {
|
264 |
+
content : '';
|
265 |
+
display : none
|
266 |
+
}
|
267 |
+
|
268 |
+
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
269 |
+
color : #999;
|
270 |
+
margin-top : 5px;
|
271 |
+
float : left
|
272 |
+
}
|
273 |
+
|
274 |
+
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
275 |
+
cursor : pointer;
|
276 |
+
float : right;
|
277 |
+
font-weight : 700;
|
278 |
+
margin-top : 5px;
|
279 |
+
margin-right : 10px
|
280 |
+
}
|
281 |
+
|
282 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
283 |
+
background-color : #e4e4e4;
|
284 |
+
border : 1px solid #aaa;
|
285 |
+
border-radius : 4px;
|
286 |
+
cursor : default;
|
287 |
+
float : left;
|
288 |
+
margin-right : 5px;
|
289 |
+
margin-top : 5px;
|
290 |
+
padding : 0 5px
|
291 |
+
}
|
292 |
+
|
293 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
294 |
+
color : #999;
|
295 |
+
cursor : pointer;
|
296 |
+
display : inline-block;
|
297 |
+
font-weight : 700;
|
298 |
+
margin-right : 2px
|
299 |
+
}
|
300 |
+
|
301 |
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
302 |
+
color : #333
|
303 |
+
}
|
304 |
+
|
305 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline, .select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder {
|
306 |
+
float : right
|
307 |
+
}
|
308 |
+
|
309 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
310 |
+
margin-left : 5px;
|
311 |
+
margin-right : auto
|
312 |
+
}
|
313 |
+
|
314 |
+
.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove {
|
315 |
+
margin-left : 2px;
|
316 |
+
margin-right : auto
|
317 |
+
}
|
318 |
+
|
319 |
+
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
320 |
+
border : solid #000 1px;
|
321 |
+
outline : 0
|
322 |
+
}
|
323 |
+
|
324 |
+
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
325 |
+
background-color : #eee;
|
326 |
+
cursor : default
|
327 |
+
}
|
328 |
+
|
329 |
+
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
330 |
+
display : none
|
331 |
+
}
|
332 |
+
|
333 |
+
.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple, .select2-container--default.select2-container--open.select2-container--above .select2-selection--single {
|
334 |
+
border-top-left-radius : 0;
|
335 |
+
border-top-right-radius : 0
|
336 |
+
}
|
337 |
+
|
338 |
+
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple, .select2-container--default.select2-container--open.select2-container--below .select2-selection--single {
|
339 |
+
border-bottom-left-radius : 0;
|
340 |
+
border-bottom-right-radius : 0
|
341 |
+
}
|
342 |
+
|
343 |
+
.select2-container--default .select2-search--dropdown .select2-search__field {
|
344 |
+
border : 1px solid #aaa
|
345 |
+
}
|
346 |
+
|
347 |
+
.select2-container--default .select2-search--inline .select2-search__field {
|
348 |
+
background : 0 0;
|
349 |
+
border : none;
|
350 |
+
outline : 0;
|
351 |
+
-webkit-box-shadow : none;
|
352 |
+
box-shadow : none;
|
353 |
+
-webkit-appearance : textfield
|
354 |
+
}
|
355 |
+
|
356 |
+
.select2-container--default .select2-results > .select2-results__options {
|
357 |
+
max-height : 200px;
|
358 |
+
overflow-y : auto
|
359 |
+
}
|
360 |
+
|
361 |
+
.select2-container--default .select2-results__option[role=group] {
|
362 |
+
padding : 0
|
363 |
+
}
|
364 |
+
|
365 |
+
.select2-container--default .select2-results__option[aria-disabled=true] {
|
366 |
+
color : #999
|
367 |
+
}
|
368 |
+
|
369 |
+
.select2-container--default .select2-results__option[aria-selected=true], .select2-container--default .select2-results__option[data-selected=true] {
|
370 |
+
background-color : #ddd
|
371 |
+
}
|
372 |
+
|
373 |
+
.select2-container--default .select2-results__option .select2-results__option {
|
374 |
+
padding-left : 1em
|
375 |
+
}
|
376 |
+
|
377 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
378 |
+
padding-left : 0
|
379 |
+
}
|
380 |
+
|
381 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
382 |
+
margin-left : -1em;
|
383 |
+
padding-left : 2em
|
384 |
+
}
|
385 |
+
|
386 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
387 |
+
margin-left : -2em;
|
388 |
+
padding-left : 3em
|
389 |
+
}
|
390 |
+
|
391 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
392 |
+
margin-left : -3em;
|
393 |
+
padding-left : 4em
|
394 |
+
}
|
395 |
+
|
396 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
397 |
+
margin-left : -4em;
|
398 |
+
padding-left : 5em
|
399 |
+
}
|
400 |
+
|
401 |
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
402 |
+
margin-left : -5em;
|
403 |
+
padding-left : 6em
|
404 |
+
}
|
405 |
+
|
406 |
+
.select2-container--default .select2-results__option--highlighted[aria-selected], .select2-container--default .select2-results__option--highlighted[data-selected] {
|
407 |
+
background-color : #0073aa;
|
408 |
+
color : #fff
|
409 |
+
}
|
410 |
+
|
411 |
+
.select2-container--default .select2-results__group {
|
412 |
+
cursor : default;
|
413 |
+
display : block;
|
414 |
+
padding : 6px
|
415 |
+
}
|
416 |
+
|
417 |
+
.select2-container--classic .select2-selection--single {
|
418 |
+
background-color : #f7f7f7;
|
419 |
+
border : 1px solid #aaa;
|
420 |
+
border-radius : 4px;
|
421 |
+
outline : 0;
|
422 |
+
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #fff), to(#eee));
|
423 |
+
background-image : -webkit-linear-gradient(top, #fff 50%, #eee 100%);
|
424 |
+
background-image : linear-gradient(to bottom, #fff 50%, #eee 100%);
|
425 |
+
background-repeat : repeat-x
|
426 |
+
}
|
427 |
+
|
428 |
+
.select2-container--classic .select2-selection--single:focus {
|
429 |
+
border : 1px solid #0073aa
|
430 |
+
}
|
431 |
+
|
432 |
+
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
433 |
+
color : #444;
|
434 |
+
line-height : 28px
|
435 |
+
}
|
436 |
+
|
437 |
+
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
438 |
+
cursor : pointer;
|
439 |
+
float : right;
|
440 |
+
font-weight : 700;
|
441 |
+
margin-right : 10px
|
442 |
+
}
|
443 |
+
|
444 |
+
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
445 |
+
color : #999
|
446 |
+
}
|
447 |
+
|
448 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
449 |
+
background-color : #ddd;
|
450 |
+
border : none;
|
451 |
+
border-left : 1px solid #aaa;
|
452 |
+
border-top-right-radius : 4px;
|
453 |
+
border-bottom-right-radius : 4px;
|
454 |
+
height : 26px;
|
455 |
+
position : absolute;
|
456 |
+
top : 1px;
|
457 |
+
right : 1px;
|
458 |
+
width : 20px;
|
459 |
+
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #eee), to(#ccc));
|
460 |
+
background-image : -webkit-linear-gradient(top, #eee 50%, #ccc 100%);
|
461 |
+
background-image : linear-gradient(to bottom, #eee 50%, #ccc 100%);
|
462 |
+
background-repeat : repeat-x
|
463 |
+
}
|
464 |
+
|
465 |
+
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
466 |
+
border-color : #888 transparent transparent transparent;
|
467 |
+
border-style : solid;
|
468 |
+
border-width : 5px 4px 0 4px;
|
469 |
+
height : 0;
|
470 |
+
left : 50%;
|
471 |
+
margin-left : -4px;
|
472 |
+
margin-top : -2px;
|
473 |
+
position : absolute;
|
474 |
+
top : 50%;
|
475 |
+
width : 0
|
476 |
+
}
|
477 |
+
|
478 |
+
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear {
|
479 |
+
float : left
|
480 |
+
}
|
481 |
+
|
482 |
+
.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow {
|
483 |
+
border : none;
|
484 |
+
border-right : 1px solid #aaa;
|
485 |
+
border-radius : 0;
|
486 |
+
border-top-left-radius : 4px;
|
487 |
+
border-bottom-left-radius : 4px;
|
488 |
+
left : 1px;
|
489 |
+
right : auto
|
490 |
+
}
|
491 |
+
|
492 |
+
.select2-container--classic.select2-container--open .select2-selection--single {
|
493 |
+
border : 1px solid #0073aa
|
494 |
+
}
|
495 |
+
|
496 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
497 |
+
background : 0 0;
|
498 |
+
border : none
|
499 |
+
}
|
500 |
+
|
501 |
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
502 |
+
border-color : transparent transparent #888 transparent;
|
503 |
+
border-width : 0 4px 5px 4px
|
504 |
+
}
|
505 |
+
|
506 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
507 |
+
border-top : none;
|
508 |
+
border-top-left-radius : 0;
|
509 |
+
border-top-right-radius : 0;
|
510 |
+
background-image : -webkit-gradient(linear, left top, left bottom, from(white), color-stop(50%, #eee));
|
511 |
+
background-image : -webkit-linear-gradient(top, #fff 0, #eee 50%);
|
512 |
+
background-image : linear-gradient(to bottom, #fff 0, #eee 50%);
|
513 |
+
background-repeat : repeat-x
|
514 |
+
}
|
515 |
+
|
516 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
517 |
+
border-bottom : none;
|
518 |
+
border-bottom-left-radius : 0;
|
519 |
+
border-bottom-right-radius : 0;
|
520 |
+
background-image : -webkit-gradient(linear, left top, left bottom, color-stop(50%, #eee), to(white));
|
521 |
+
background-image : -webkit-linear-gradient(top, #eee 50%, #fff 100%);
|
522 |
+
background-image : linear-gradient(to bottom, #eee 50%, #fff 100%);
|
523 |
+
background-repeat : repeat-x
|
524 |
+
}
|
525 |
+
|
526 |
+
.select2-container--classic .select2-selection--multiple {
|
527 |
+
background-color : #fff;
|
528 |
+
border : 1px solid #aaa;
|
529 |
+
border-radius : 4px;
|
530 |
+
cursor : text;
|
531 |
+
outline : 0
|
532 |
+
}
|
533 |
+
|
534 |
+
.select2-container--classic .select2-selection--multiple:focus {
|
535 |
+
border : 1px solid #0073aa
|
536 |
+
}
|
537 |
+
|
538 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
539 |
+
list-style : none;
|
540 |
+
margin : 0;
|
541 |
+
padding : 0 5px
|
542 |
+
}
|
543 |
+
|
544 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
545 |
+
display : none
|
546 |
+
}
|
547 |
+
|
548 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
549 |
+
background-color : #e4e4e4;
|
550 |
+
border : 1px solid #aaa;
|
551 |
+
border-radius : 4px;
|
552 |
+
cursor : default;
|
553 |
+
float : left;
|
554 |
+
margin-right : 5px;
|
555 |
+
margin-top : 5px;
|
556 |
+
padding : 0 5px
|
557 |
+
}
|
558 |
+
|
559 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
560 |
+
color : #888;
|
561 |
+
cursor : pointer;
|
562 |
+
display : inline-block;
|
563 |
+
font-weight : 700;
|
564 |
+
margin-right : 2px
|
565 |
+
}
|
566 |
+
|
567 |
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
568 |
+
color : #555
|
569 |
+
}
|
570 |
+
|
571 |
+
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
572 |
+
float : right
|
573 |
+
}
|
574 |
+
|
575 |
+
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice {
|
576 |
+
margin-left : 5px;
|
577 |
+
margin-right : auto
|
578 |
+
}
|
579 |
+
|
580 |
+
.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove {
|
581 |
+
margin-left : 2px;
|
582 |
+
margin-right : auto
|
583 |
+
}
|
584 |
+
|
585 |
+
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
586 |
+
border : 1px solid #0073aa
|
587 |
+
}
|
588 |
+
|
589 |
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
590 |
+
border-top : none;
|
591 |
+
border-top-left-radius : 0;
|
592 |
+
border-top-right-radius : 0
|
593 |
+
}
|
594 |
+
|
595 |
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
596 |
+
border-bottom : none;
|
597 |
+
border-bottom-left-radius : 0;
|
598 |
+
border-bottom-right-radius : 0
|
599 |
+
}
|
600 |
+
|
601 |
+
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
602 |
+
border : 1px solid #aaa;
|
603 |
+
outline : 0
|
604 |
+
}
|
605 |
+
|
606 |
+
.select2-container--classic .select2-search--inline .select2-search__field {
|
607 |
+
outline : 0;
|
608 |
+
-webkit-box-shadow : none;
|
609 |
+
box-shadow : none
|
610 |
+
}
|
611 |
+
|
612 |
+
.select2-container--classic .select2-dropdown {
|
613 |
+
background-color : #fff;
|
614 |
+
border : 1px solid transparent
|
615 |
+
}
|
616 |
+
|
617 |
+
.select2-container--classic .select2-dropdown--above {
|
618 |
+
border-bottom : none
|
619 |
+
}
|
620 |
+
|
621 |
+
.select2-container--classic .select2-dropdown--below {
|
622 |
+
border-top : none
|
623 |
+
}
|
624 |
+
|
625 |
+
.select2-container--classic .select2-results > .select2-results__options {
|
626 |
+
max-height : 200px;
|
627 |
+
overflow-y : auto
|
628 |
+
}
|
629 |
+
|
630 |
+
.select2-container--classic .select2-results__option[role=group] {
|
631 |
+
padding : 0
|
632 |
+
}
|
633 |
+
|
634 |
+
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
635 |
+
color : grey
|
636 |
+
}
|
637 |
+
|
638 |
+
.select2-container--classic .select2-results__option--highlighted[aria-selected], .select2-container--classic .select2-results__option--highlighted[data-selected] {
|
639 |
+
background-color : #3875d7;
|
640 |
+
color : #fff
|
641 |
+
}
|
642 |
+
|
643 |
+
.select2-container--classic .select2-results__group {
|
644 |
+
cursor : default;
|
645 |
+
display : block;
|
646 |
+
padding : 6px
|
647 |
+
}
|
648 |
+
|
649 |
+
.select2-container--classic.select2-container--open .select2-dropdown {
|
650 |
+
border-color : #0073aa
|
651 |
+
}
|
652 |
+
|
653 |
+
|
654 |
+
.select2-drop, .select2-dropdown {
|
655 |
+
z-index : 999999 !important
|
656 |
+
}
|
657 |
+
|
658 |
+
.select2-results {
|
659 |
+
line-height : 1.5em
|
660 |
+
}
|
661 |
+
|
662 |
+
.select2-results .select2-results__group, .select2-results .select2-results__option {
|
663 |
+
margin : 0;
|
664 |
+
padding : 8px
|
665 |
+
}
|
666 |
+
|
667 |
+
.select2-results .description {
|
668 |
+
display : block;
|
669 |
+
color : #999;
|
670 |
+
padding-top : 4px
|
671 |
+
}
|
672 |
+
|
673 |
+
.select2-dropdown {
|
674 |
+
border-color : #ddd
|
675 |
+
}
|
676 |
+
|
677 |
+
.select2-dropdown--below {
|
678 |
+
-webkit-box-shadow : 0 1px 1px rgba(0, 0, 0, .1);
|
679 |
+
box-shadow : 0 1px 1px rgba(0, 0, 0, .1)
|
680 |
+
}
|
681 |
+
|
682 |
+
.select2-dropdown--above {
|
683 |
+
-webkit-box-shadow : 0 -1px 1px rgba(0, 0, 0, .1);
|
684 |
+
box-shadow : 0 -1px 1px rgba(0, 0, 0, .1)
|
685 |
+
}
|
686 |
+
|
687 |
+
.select2-container .select2-selection__rendered.ui-sortable li {
|
688 |
+
cursor : move
|
689 |
+
}
|
690 |
+
|
691 |
+
.select2-container .select2-selection {
|
692 |
+
border-color : #ddd
|
693 |
+
}
|
694 |
+
|
695 |
+
.select2-container .select2-search__field {
|
696 |
+
min-width : 150px
|
697 |
+
}
|
698 |
+
|
699 |
+
.select2-container .select2-selection--single {
|
700 |
+
height : 32px
|
701 |
+
}
|
702 |
+
|
703 |
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
704 |
+
line-height : 32px;
|
705 |
+
padding-right : 24px
|
706 |
+
}
|
707 |
+
|
708 |
+
.select2-container .select2-selection--single .select2-selection__arrow {
|
709 |
+
right : 3px;
|
710 |
+
height : 30px
|
711 |
+
}
|
712 |
+
|
713 |
+
.select2-container .select2-selection--multiple {
|
714 |
+
min-height : 28px;
|
715 |
+
border-radius : 0;
|
716 |
+
line-height : 1.5
|
717 |
+
}
|
718 |
+
|
719 |
+
.select2-container .select2-selection--multiple li {
|
720 |
+
margin : 0
|
721 |
+
}
|
722 |
+
|
723 |
+
.select2-container .select2-selection--multiple .select2-selection__choice {
|
724 |
+
padding : 2px 6px
|
725 |
+
}
|
726 |
+
|
727 |
+
.select2-container .select2-selection--multiple .select2-selection__choice .description {
|
728 |
+
display : none
|
729 |
+
}
|
730 |
+
|
731 |
+
.select2-container .select2-selection__clear {
|
732 |
+
color : #999;
|
733 |
+
margin-top : -1px
|
734 |
+
}
|
735 |
+
|
736 |
+
.select2-container .select2-search--inline .select2-search__field {
|
737 |
+
font-family : inherit;
|
738 |
+
font-size : inherit;
|
739 |
+
font-weight : inherit;
|
740 |
+
padding : 3px 0
|
741 |
}
|
plugin-fw/assets/js/codemirror/codemirror.js
CHANGED
@@ -1,5799 +1,5799 @@
|
|
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 |
-
})();
|
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 |
+
})();
|
plugin-fw/assets/js/codemirror/javascript.js
CHANGED
@@ -1,630 +1,630 @@
|
|
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.defineMIME("application/x-json", {name: "javascript", json: true});
|
629 |
-
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
630 |
-
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
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.defineMIME("application/x-json", {name: "javascript", json: true});
|
629 |
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
630 |
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
plugin-fw/assets/js/how-to.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
(function ( $ ) {
|
2 |
-
var how_to_link = $( '#yith-how-to-premium' ).parent();
|
3 |
-
if ( typeof how_to_link != 'undefined' ) {
|
4 |
-
how_to_link.prop( 'target', '_blank' );
|
5 |
-
}
|
6 |
-
})( jQuery );
|
1 |
+
(function ( $ ) {
|
2 |
+
var how_to_link = $( '#yith-how-to-premium' ).parent();
|
3 |
+
if ( typeof how_to_link != 'undefined' ) {
|
4 |
+
how_to_link.prop( 'target', '_blank' );
|
5 |
+
}
|
6 |
+
})( jQuery );
|
plugin-fw/assets/js/how-to.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){a=a("#yith-how-to-premium").parent();"undefined"!=typeof a&&a.prop("target","_blank")})(jQuery);
|
1 |
+
(function(a){a=a("#yith-how-to-premium").parent();"undefined"!=typeof a&&a.prop("target","_blank")})(jQuery);
|
plugin-fw/assets/js/jquery.colorbox.js
CHANGED
@@ -1,1105 +1,1105 @@
|
|
1 |
-
/*!
|
2 |
-
Colorbox 1.6.3
|
3 |
-
license: MIT
|
4 |
-
http://www.jacklmoore.com/colorbox
|
5 |
-
*/
|
6 |
-
(function ($, document, window) {
|
7 |
-
var
|
8 |
-
// Default settings object.
|
9 |
-
// See http://jacklmoore.com/colorbox for details.
|
10 |
-
defaults = {
|
11 |
-
// data sources
|
12 |
-
html: false,
|
13 |
-
photo: false,
|
14 |
-
iframe: false,
|
15 |
-
inline: false,
|
16 |
-
|
17 |
-
// behavior and appearance
|
18 |
-
transition: "elastic",
|
19 |
-
speed: 300,
|
20 |
-
fadeOut: 300,
|
21 |
-
width: false,
|
22 |
-
initialWidth: "600",
|
23 |
-
innerWidth: false,
|
24 |
-
maxWidth: false,
|
25 |
-
height: false,
|
26 |
-
initialHeight: "450",
|
27 |
-
innerHeight: false,
|
28 |
-
maxHeight: false,
|
29 |
-
scalePhotos: true,
|
30 |
-
scrolling: true,
|
31 |
-
opacity: 0.9,
|
32 |
-
preloading: true,
|
33 |
-
className: false,
|
34 |
-
overlayClose: true,
|
35 |
-
escKey: true,
|
36 |
-
arrowKey: true,
|
37 |
-
top: false,
|
38 |
-
bottom: false,
|
39 |
-
left: false,
|
40 |
-
right: false,
|
41 |
-
fixed: false,
|
42 |
-
data: undefined,
|
43 |
-
closeButton: true,
|
44 |
-
fastIframe: true,
|
45 |
-
open: false,
|
46 |
-
reposition: true,
|
47 |
-
loop: true,
|
48 |
-
slideshow: false,
|
49 |
-
slideshowAuto: true,
|
50 |
-
slideshowSpeed: 2500,
|
51 |
-
slideshowStart: "start slideshow",
|
52 |
-
slideshowStop: "stop slideshow",
|
53 |
-
photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
|
54 |
-
|
55 |
-
// alternate image paths for high-res displays
|
56 |
-
retinaImage: false,
|
57 |
-
retinaUrl: false,
|
58 |
-
retinaSuffix: '@2x.$1',
|
59 |
-
|
60 |
-
// internationalization
|
61 |
-
current: "image {current} of {total}",
|
62 |
-
previous: "previous",
|
63 |
-
next: "next",
|
64 |
-
close: "close",
|
65 |
-
xhrError: "This content failed to load.",
|
66 |
-
imgError: "This image failed to load.",
|
67 |
-
|
68 |
-
// accessbility
|
69 |
-
returnFocus: true,
|
70 |
-
trapFocus: true,
|
71 |
-
|
72 |
-
// callbacks
|
73 |
-
onOpen: false,
|
74 |
-
onLoad: false,
|
75 |
-
onComplete: false,
|
76 |
-
onCleanup: false,
|
77 |
-
onClosed: false,
|
78 |
-
|
79 |
-
rel: function() {
|
80 |
-
return this.rel;
|
81 |
-
},
|
82 |
-
href: function() {
|
83 |
-
// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
|
84 |
-
return $(this).attr('href');
|
85 |
-
},
|
86 |
-
title: function() {
|
87 |
-
return this.title;
|
88 |
-
},
|
89 |
-
createImg: function() {
|
90 |
-
var img = new Image();
|
91 |
-
var attrs = $(this).data('cbox-img-attrs');
|
92 |
-
|
93 |
-
if (typeof attrs === 'object') {
|
94 |
-
$.each(attrs, function(key, val){
|
95 |
-
img[key] = val;
|
96 |
-
});
|
97 |
-
}
|
98 |
-
|
99 |
-
return img;
|
100 |
-
},
|
101 |
-
createIframe: function() {
|
102 |
-
var iframe = document.createElement('iframe');
|
103 |
-
var attrs = $(this).data('cbox-iframe-attrs');
|
104 |
-
|
105 |
-
if (typeof attrs === 'object') {
|
106 |
-
$.each(attrs, function(key, val){
|
107 |
-
iframe[key] = val;
|
108 |
-
});
|
109 |
-
}
|
110 |
-
|
111 |
-
if ('frameBorder' in iframe) {
|
112 |
-
iframe.frameBorder = 0;
|
113 |
-
}
|
114 |
-
if ('allowTransparency' in iframe) {
|
115 |
-
iframe.allowTransparency = "true";
|
116 |
-
}
|
117 |
-
iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
|
118 |
-
iframe.allowFullscreen = true;
|
119 |
-
|
120 |
-
return iframe;
|
121 |
-
}
|
122 |
-
},
|
123 |
-
|
124 |
-
// Abstracting the HTML and event identifiers for easy rebranding
|
125 |
-
colorbox = 'colorbox',
|
126 |
-
prefix = 'cbox',
|
127 |
-
boxElement = prefix + 'Element',
|
128 |
-
|
129 |
-
// Events
|
130 |
-
event_open = prefix + '_open',
|
131 |
-
event_load = prefix + '_load',
|
132 |
-
event_complete = prefix + '_complete',
|
133 |
-
event_cleanup = prefix + '_cleanup',
|
134 |
-
event_closed = prefix + '_closed',
|
135 |
-
event_purge = prefix + '_purge',
|
136 |
-
|
137 |
-
// Cached jQuery Object Variables
|
138 |
-
$overlay,
|
139 |
-
$box,
|
140 |
-
$wrap,
|
141 |
-
$content,
|
142 |
-
$topBorder,
|
143 |
-
$leftBorder,
|
144 |
-
$rightBorder,
|
145 |
-
$bottomBorder,
|
146 |
-
$related,
|
147 |
-
$window,
|
148 |
-
$loaded,
|
149 |
-
$loadingBay,
|
150 |
-
$loadingOverlay,
|
151 |
-
$title,
|
152 |
-
$current,
|
153 |
-
$slideshow,
|
154 |
-
$next,
|
155 |
-
$prev,
|
156 |
-
$close,
|
157 |
-
$groupControls,
|
158 |
-
$events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
|
159 |
-
|
160 |
-
// Variables for cached values or use across multiple functions
|
161 |
-
settings,
|
162 |
-
interfaceHeight,
|
163 |
-
interfaceWidth,
|
164 |
-
loadedHeight,
|
165 |
-
loadedWidth,
|
166 |
-
index,
|
167 |
-
photo,
|
168 |
-
open,
|
169 |
-
active,
|
170 |
-
closing,
|
171 |
-
loadingTimer,
|
172 |
-
publicMethod,
|
173 |
-
div = "div",
|
174 |
-
requests = 0,
|
175 |
-
previousCSS = {},
|
176 |
-
init;
|
177 |
-
|
178 |
-
// ****************
|
179 |
-
// HELPER FUNCTIONS
|
180 |
-
// ****************
|
181 |
-
|
182 |
-
// Convenience function for creating new jQuery objects
|
183 |
-
function $tag(tag, id, css) {
|
184 |
-
var element = document.createElement(tag);
|
185 |
-
|
186 |
-
if (id) {
|
187 |
-
element.id = prefix + id;
|
188 |
-
}
|
189 |
-
|
190 |
-
if (css) {
|
191 |
-
element.style.cssText = css;
|
192 |
-
}
|
193 |
-
|
194 |
-
return $(element);
|
195 |
-
}
|
196 |
-
|
197 |
-
// Get the window height using innerHeight when available to avoid an issue with iOS
|
198 |
-
// http://bugs.jquery.com/ticket/6724
|
199 |
-
function winheight() {
|
200 |
-
return window.innerHeight ? window.innerHeight : $(window).height();
|
201 |
-
}
|
202 |
-
|
203 |
-
function Settings(element, options) {
|
204 |
-
if (options !== Object(options)) {
|
205 |
-
options = {};
|
206 |
-
}
|
207 |
-
|
208 |
-
this.cache = {};
|
209 |
-
this.el = element;
|
210 |
-
|
211 |
-
this.value = function(key) {
|
212 |
-
var dataAttr;
|
213 |
-
|
214 |
-
if (this.cache[key] === undefined) {
|
215 |
-
dataAttr = $(this.el).attr('data-cbox-'+key);
|
216 |
-
|
217 |
-
if (dataAttr !== undefined) {
|
218 |
-
this.cache[key] = dataAttr;
|
219 |
-
} else if (options[key] !== undefined) {
|
220 |
-
this.cache[key] = options[key];
|
221 |
-
} else if (defaults[key] !== undefined) {
|
222 |
-
this.cache[key] = defaults[key];
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
return this.cache[key];
|
227 |
-
};
|
228 |
-
|
229 |
-
this.get = function(key) {
|
230 |
-
var value = this.value(key);
|
231 |
-
return $.isFunction(value) ? value.call(this.el, this) : value;
|
232 |
-
};
|
233 |
-
}
|
234 |
-
|
235 |
-
// Determine the next and previous members in a group.
|
236 |
-
function getIndex(increment) {
|
237 |
-
var
|
238 |
-
max = $related.length,
|
239 |
-
newIndex = (index + increment) % max;
|
240 |
-
|
241 |
-
return (newIndex < 0) ? max + newIndex : newIndex;
|
242 |
-
}
|
243 |
-
|
244 |
-
// Convert '%' and 'px' values to integers
|
245 |
-
function setSize(size, dimension) {
|
246 |
-
return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
|
247 |
-
}
|
248 |
-
|
249 |
-
// Checks an href to see if it is a photo.
|
250 |
-
// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
|
251 |
-
function isImage(settings, url) {
|
252 |
-
return settings.get('photo') || settings.get('photoRegex').test(url);
|
253 |
-
}
|
254 |
-
|
255 |
-
function retinaUrl(settings, url) {
|
256 |
-
return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
|
257 |
-
}
|
258 |
-
|
259 |
-
function trapFocus(e) {
|
260 |
-
if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
|
261 |
-
e.stopPropagation();
|
262 |
-
$box.focus();
|
263 |
-
}
|
264 |
-
}
|
265 |
-
|
266 |
-
function setClass(str) {
|
267 |
-
if (setClass.str !== str) {
|
268 |
-
$box.add($overlay).removeClass(setClass.str).addClass(str);
|
269 |
-
setClass.str = str;
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
function getRelated(rel) {
|
274 |
-
index = 0;
|
275 |
-
|
276 |
-
if (rel && rel !== false && rel !== 'nofollow') {
|
277 |
-
$related = $('.' + boxElement).filter(function () {
|
278 |
-
var options = $.data(this, colorbox);
|
279 |
-
var settings = new Settings(this, options);
|
280 |
-
return (settings.get('rel') === rel);
|
281 |
-
});
|
282 |
-
index = $related.index(settings.el);
|
283 |
-
|
284 |
-
// Check direct calls to Colorbox.
|
285 |
-
if (index === -1) {
|
286 |
-
$related = $related.add(settings.el);
|
287 |
-
index = $related.length - 1;
|
288 |
-
}
|
289 |
-
} else {
|
290 |
-
$related = $(settings.el);
|
291 |
-
}
|
292 |
-
}
|
293 |
-
|
294 |
-
function trigger(event) {
|
295 |
-
// for external use
|
296 |
-
$(document).trigger(event);
|
297 |
-
// for internal use
|
298 |
-
$events.triggerHandler(event);
|
299 |
-
}
|
300 |
-
|
301 |
-
var slideshow = (function(){
|
302 |
-
var active,
|
303 |
-
className = prefix + "Slideshow_",
|
304 |
-
click = "click." + prefix,
|
305 |
-
timeOut;
|
306 |
-
|
307 |
-
function clear () {
|
308 |
-
clearTimeout(timeOut);
|
309 |
-
}
|
310 |
-
|
311 |
-
function set() {
|
312 |
-
if (settings.get('loop') || $related[index + 1]) {
|
313 |
-
clear();
|
314 |
-
timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
|
315 |
-
}
|
316 |
-
}
|
317 |
-
|
318 |
-
function start() {
|
319 |
-
$slideshow
|
320 |
-
.html(settings.get('slideshowStop'))
|
321 |
-
.unbind(click)
|
322 |
-
.one(click, stop);
|
323 |
-
|
324 |
-
$events
|
325 |
-
.bind(event_complete, set)
|
326 |
-
.bind(event_load, clear);
|
327 |
-
|
328 |
-
$box.removeClass(className + "off").addClass(className + "on");
|
329 |
-
}
|
330 |
-
|
331 |
-
function stop() {
|
332 |
-
clear();
|
333 |
-
|
334 |
-
$events
|
335 |
-
.unbind(event_complete, set)
|
336 |
-
.unbind(event_load, clear);
|
337 |
-
|
338 |
-
$slideshow
|
339 |
-
.html(settings.get('slideshowStart'))
|
340 |
-
.unbind(click)
|
341 |
-
.one(click, function () {
|
342 |
-
publicMethod.next();
|
343 |
-
start();
|
344 |
-
});
|
345 |
-
|
346 |
-
$box.removeClass(className + "on").addClass(className + "off");
|
347 |
-
}
|
348 |
-
|
349 |
-
function reset() {
|
350 |
-
active = false;
|
351 |
-
$slideshow.hide();
|
352 |
-
clear();
|
353 |
-
$events
|
354 |
-
.unbind(event_complete, set)
|
355 |
-
.unbind(event_load, clear);
|
356 |
-
$box.removeClass(className + "off " + className + "on");
|
357 |
-
}
|
358 |
-
|
359 |
-
return function(){
|
360 |
-
if (active) {
|
361 |
-
if (!settings.get('slideshow')) {
|
362 |
-
$events.unbind(event_cleanup, reset);
|
363 |
-
reset();
|
364 |
-
}
|
365 |
-
} else {
|
366 |
-
if (settings.get('slideshow') && $related[1]) {
|
367 |
-
active = true;
|
368 |
-
$events.one(event_cleanup, reset);
|
369 |
-
if (settings.get('slideshowAuto')) {
|
370 |
-
start();
|
371 |
-
} else {
|
372 |
-
stop();
|
373 |
-
}
|
374 |
-
$slideshow.show();
|
375 |
-
}
|
376 |
-
}
|
377 |
-
};
|
378 |
-
|
379 |
-
}());
|
380 |
-
|
381 |
-
|
382 |
-
function launch(element) {
|
383 |
-
var options;
|
384 |
-
|
385 |
-
if (!closing) {
|
386 |
-
|
387 |
-
options = $(element).data(colorbox);
|
388 |
-
|
389 |
-
settings = new Settings(element, options);
|
390 |
-
|
391 |
-
getRelated(settings.get('rel'));
|
392 |
-
|
393 |
-
if (!open) {
|
394 |
-
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
395 |
-
|
396 |
-
setClass(settings.get('className'));
|
397 |
-
|
398 |
-
// Show colorbox so the sizes can be calculated in older versions of jQuery
|
399 |
-
$box.css({visibility:'hidden', display:'block', opacity:''});
|
400 |
-
|
401 |
-
$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
|
402 |
-
$content.css({width:'', height:''}).append($loaded);
|
403 |
-
|
404 |
-
// Cache values needed for size calculations
|
405 |
-
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
|
406 |
-
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
407 |
-
loadedHeight = $loaded.outerHeight(true);
|
408 |
-
loadedWidth = $loaded.outerWidth(true);
|
409 |
-
|
410 |
-
// Opens inital empty Colorbox prior to content being loaded.
|
411 |
-
var initialWidth = setSize(settings.get('initialWidth'), 'x');
|
412 |
-
var initialHeight = setSize(settings.get('initialHeight'), 'y');
|
413 |
-
var maxWidth = settings.get('maxWidth');
|
414 |
-
var maxHeight = settings.get('maxHeight');
|
415 |
-
|
416 |
-
settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
|
417 |
-
settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
|
418 |
-
|
419 |
-
$loaded.css({width:'', height:settings.h});
|
420 |
-
publicMethod.position();
|
421 |
-
|
422 |
-
trigger(event_open);
|
423 |
-
settings.get('onOpen');
|
424 |
-
|
425 |
-
$groupControls.add($title).hide();
|
426 |
-
|
427 |
-
$box.focus();
|
428 |
-
|
429 |
-
if (settings.get('trapFocus')) {
|
430 |
-
// Confine focus to the modal
|
431 |
-
// Uses event capturing that is not supported in IE8-
|
432 |
-
if (document.addEventListener) {
|
433 |
-
|
434 |
-
document.addEventListener('focus', trapFocus, true);
|
435 |
-
|
436 |
-
$events.one(event_closed, function () {
|
437 |
-
document.removeEventListener('focus', trapFocus, true);
|
438 |
-
});
|
439 |
-
}
|
440 |
-
}
|
441 |
-
|
442 |
-
// Return focus on closing
|
443 |
-
if (settings.get('returnFocus')) {
|
444 |
-
$events.one(event_closed, function () {
|
445 |
-
$(settings.el).focus();
|
446 |
-
});
|
447 |
-
}
|
448 |
-
}
|
449 |
-
|
450 |
-
var opacity = parseFloat(settings.get('opacity'));
|
451 |
-
$overlay.css({
|
452 |
-
opacity: opacity === opacity ? opacity : '',
|
453 |
-
cursor: settings.get('overlayClose') ? 'pointer' : '',
|
454 |
-
visibility: 'visible'
|
455 |
-
}).show();
|
456 |
-
|
457 |
-
if (settings.get('closeButton')) {
|
458 |
-
$close.html(settings.get('close')).appendTo($content);
|
459 |
-
} else {
|
460 |
-
$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
|
461 |
-
}
|
462 |
-
|
463 |
-
load();
|
464 |
-
}
|
465 |
-
}
|
466 |
-
|
467 |
-
// Colorbox's markup needs to be added to the DOM prior to being called
|
468 |
-
// so that the browser will go ahead and load the CSS background images.
|
469 |
-
function appendHTML() {
|
470 |
-
if (!$box) {
|
471 |
-
init = false;
|
472 |
-
$window = $(window);
|
473 |
-
$box = $tag(div).attr({
|
474 |
-
id: colorbox,
|
475 |
-
'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
|
476 |
-
role: 'dialog',
|
477 |
-
tabindex: '-1'
|
478 |
-
}).hide();
|
479 |
-
$overlay = $tag(div, "Overlay").hide();
|
480 |
-
$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
|
481 |
-
$wrap = $tag(div, "Wrapper");
|
482 |
-
$content = $tag(div, "Content").append(
|
483 |
-
$title = $tag(div, "Title"),
|
484 |
-
$current = $tag(div, "Current"),
|
485 |
-
$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
|
486 |
-
$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
|
487 |
-
$slideshow = $tag('button', "Slideshow"),
|
488 |
-
$loadingOverlay
|
489 |
-
);
|
490 |
-
|
491 |
-
$close = $('<button type="button"/>').attr({id:prefix+'Close'});
|
492 |
-
|
493 |
-
$wrap.append( // The 3x3 Grid that makes up Colorbox
|
494 |
-
$tag(div).append(
|
495 |
-
$tag(div, "TopLeft"),
|
496 |
-
$topBorder = $tag(div, "TopCenter"),
|
497 |
-
$tag(div, "TopRight")
|
498 |
-
),
|
499 |
-
$tag(div, false, 'clear:left').append(
|
500 |
-
$leftBorder = $tag(div, "MiddleLeft"),
|
501 |
-
$content,
|
502 |
-
$rightBorder = $tag(div, "MiddleRight")
|
503 |
-
),
|
504 |
-
$tag(div, false, 'clear:left').append(
|
505 |
-
$tag(div, "BottomLeft"),
|
506 |
-
$bottomBorder = $tag(div, "BottomCenter"),
|
507 |
-
$tag(div, "BottomRight")
|
508 |
-
)
|
509 |
-
).find('div div').css({'float': 'left'});
|
510 |
-
|
511 |
-
$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
|
512 |
-
|
513 |
-
$groupControls = $next.add($prev).add($current).add($slideshow);
|
514 |
-
}
|
515 |
-
if (document.body && !$box.parent().length) {
|
516 |
-
$(document.body).append($overlay, $box.append($wrap, $loadingBay));
|
517 |
-
}
|
518 |
-
}
|
519 |
-
|
520 |
-
// Add Colorbox's event bindings
|
521 |
-
function addBindings() {
|
522 |
-
function clickHandler(e) {
|
523 |
-
// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
|
524 |
-
// See: http://jacklmoore.com/notes/click-events/
|
525 |
-
if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
|
526 |
-
e.preventDefault();
|
527 |
-
launch(this);
|
528 |
-
}
|
529 |
-
}
|
530 |
-
|
531 |
-
if ($box) {
|
532 |
-
if (!init) {
|
533 |
-
init = true;
|
534 |
-
|
535 |
-
// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
|
536 |
-
$next.click(function () {
|
537 |
-
publicMethod.next();
|
538 |
-
});
|
539 |
-
$prev.click(function () {
|
540 |
-
publicMethod.prev();
|
541 |
-
});
|
542 |
-
$close.click(function () {
|
543 |
-
publicMethod.close();
|
544 |
-
});
|
545 |
-
$overlay.click(function () {
|
546 |
-
if (settings.get('overlayClose')) {
|
547 |
-
publicMethod.close();
|
548 |
-
}
|
549 |
-
});
|
550 |
-
|
551 |
-
// Key Bindings
|
552 |
-
$(document).bind('keydown.' + prefix, function (e) {
|
553 |
-
var key = e.keyCode;
|
554 |
-
if (open && settings.get('escKey') && key === 27) {
|
555 |
-
e.preventDefault();
|
556 |
-
publicMethod.close();
|
557 |
-
}
|
558 |
-
if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
|
559 |
-
if (key === 37) {
|
560 |
-
e.preventDefault();
|
561 |
-
$prev.click();
|
562 |
-
} else if (key === 39) {
|
563 |
-
e.preventDefault();
|
564 |
-
$next.click();
|
565 |
-
}
|
566 |
-
}
|
567 |
-
});
|
568 |
-
|
569 |
-
if ($.isFunction($.fn.on)) {
|
570 |
-
// For jQuery 1.7+
|
571 |
-
$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
|
572 |
-
} else {
|
573 |
-
// For jQuery 1.3.x -> 1.6.x
|
574 |
-
// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
|
575 |
-
// This is not here for jQuery 1.9, it's here for legacy users.
|
576 |
-
$('.'+boxElement).live('click.'+prefix, clickHandler);
|
577 |
-
}
|
578 |
-
}
|
579 |
-
return true;
|
580 |
-
}
|
581 |
-
return false;
|
582 |
-
}
|
583 |
-
|
584 |
-
// Don't do anything if Colorbox already exists.
|
585 |
-
if ($[colorbox]) {
|
586 |
-
return;
|
587 |
-
}
|
588 |
-
|
589 |
-
// Append the HTML when the DOM loads
|
590 |
-
$(appendHTML);
|
591 |
-
|
592 |
-
|
593 |
-
// ****************
|
594 |
-
// PUBLIC FUNCTIONS
|
595 |
-
// Usage format: $.colorbox.close();
|
596 |
-
// Usage from within an iframe: parent.jQuery.colorbox.close();
|
597 |
-
// ****************
|
598 |
-
|
599 |
-
publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
|
600 |
-
var settings;
|
601 |
-
var $obj = this;
|
602 |
-
|
603 |
-
options = options || {};
|
604 |
-
|
605 |
-
if ($.isFunction($obj)) { // assume a call to $.colorbox
|
606 |
-
$obj = $('<a/>');
|
607 |
-
options.open = true;
|
608 |
-
}
|
609 |
-
|
610 |
-
if (!$obj[0]) { // colorbox being applied to empty collection
|
611 |
-
return $obj;
|
612 |
-
}
|
613 |
-
|
614 |
-
appendHTML();
|
615 |
-
|
616 |
-
if (addBindings()) {
|
617 |
-
|
618 |
-
if (callback) {
|
619 |
-
options.onComplete = callback;
|
620 |
-
}
|
621 |
-
|
622 |
-
$obj.each(function () {
|
623 |
-
var old = $.data(this, colorbox) || {};
|
624 |
-
$.data(this, colorbox, $.extend(old, options));
|
625 |
-
}).addClass(boxElement);
|
626 |
-
|
627 |
-
settings = new Settings($obj[0], options);
|
628 |
-
|
629 |
-
if (settings.get('open')) {
|
630 |
-
launch($obj[0]);
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
return $obj;
|
635 |
-
};
|
636 |
-
|
637 |
-
publicMethod.position = function (speed, loadedCallback) {
|
638 |
-
var
|
639 |
-
css,
|
640 |
-
top = 0,
|
641 |
-
left = 0,
|
642 |
-
offset = $box.offset(),
|
643 |
-
scrollTop,
|
644 |
-
scrollLeft;
|
645 |
-
|
646 |
-
$window.unbind('resize.' + prefix);
|
647 |
-
|
648 |
-
// remove the modal so that it doesn't influence the document width/height
|
649 |
-
$box.css({top: -9e4, left: -9e4});
|
650 |
-
|
651 |
-
scrollTop = $window.scrollTop();
|
652 |
-
scrollLeft = $window.scrollLeft();
|
653 |
-
|
654 |
-
if (settings.get('fixed')) {
|
655 |
-
offset.top -= scrollTop;
|
656 |
-
offset.left -= scrollLeft;
|
657 |
-
$box.css({position: 'fixed'});
|
658 |
-
} else {
|
659 |
-
top = scrollTop;
|
660 |
-
left = scrollLeft;
|
661 |
-
$box.css({position: 'absolute'});
|
662 |
-
}
|
663 |
-
|
664 |
-
// keeps the top and left positions within the browser's viewport.
|
665 |
-
if (settings.get('right') !== false) {
|
666 |
-
left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
|
667 |
-
} else if (settings.get('left') !== false) {
|
668 |
-
left += setSize(settings.get('left'), 'x');
|
669 |
-
} else {
|
670 |
-
left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
|
671 |
-
}
|
672 |
-
|
673 |
-
if (settings.get('bottom') !== false) {
|
674 |
-
top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
|
675 |
-
} else if (settings.get('top') !== false) {
|
676 |
-
top += setSize(settings.get('top'), 'y');
|
677 |
-
} else {
|
678 |
-
top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
|
679 |
-
}
|
680 |
-
|
681 |
-
$box.css({top: offset.top, left: offset.left, visibility:'visible'});
|
682 |
-
|
683 |
-
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
|
684 |
-
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
|
685 |
-
// it can invoke an obscure IE bug when using iframes.
|
686 |
-
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
687 |
-
|
688 |
-
function modalDimensions() {
|
689 |
-
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
|
690 |
-
$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
|
691 |
-
}
|
692 |
-
|
693 |
-
css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
|
694 |
-
|
695 |
-
// setting the speed to 0 if the content hasn't changed size or position
|
696 |
-
if (speed) {
|
697 |
-
var tempSpeed = 0;
|
698 |
-
$.each(css, function(i){
|
699 |
-
if (css[i] !== previousCSS[i]) {
|
700 |
-
tempSpeed = speed;
|
701 |
-
return;
|
702 |
-
}
|
703 |
-
});
|
704 |
-
speed = tempSpeed;
|
705 |
-
}
|
706 |
-
|
707 |
-
previousCSS = css;
|
708 |
-
|
709 |
-
if (!speed) {
|
710 |
-
$box.css(css);
|
711 |
-
}
|
712 |
-
|
713 |
-
$box.dequeue().animate(css, {
|
714 |
-
duration: speed || 0,
|
715 |
-
complete: function () {
|
716 |
-
modalDimensions();
|
717 |
-
|
718 |
-
active = false;
|
719 |
-
|
720 |
-
// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
|
721 |
-
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
|
722 |
-
$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
|
723 |
-
|
724 |
-
if (settings.get('reposition')) {
|
725 |
-
setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
|
726 |
-
$window.bind('resize.' + prefix, publicMethod.position);
|
727 |
-
}, 1);
|
728 |
-
}
|
729 |
-
|
730 |
-
if ($.isFunction(loadedCallback)) {
|
731 |
-
loadedCallback();
|
732 |
-
}
|
733 |
-
},
|
734 |
-
step: modalDimensions
|
735 |
-
});
|
736 |
-
};
|
737 |
-
|
738 |
-
publicMethod.resize = function (options) {
|
739 |
-
var scrolltop;
|
740 |
-
|
741 |
-
if (open) {
|
742 |
-
options = options || {};
|
743 |
-
|
744 |
-
if (options.width) {
|
745 |
-
settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
|
746 |
-
}
|
747 |
-
|
748 |
-
if (options.innerWidth) {
|
749 |
-
settings.w = setSize(options.innerWidth, 'x');
|
750 |
-
}
|
751 |
-
|
752 |
-
$loaded.css({width: settings.w});
|
753 |
-
|
754 |
-
if (options.height) {
|
755 |
-
settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
|
756 |
-
}
|
757 |
-
|
758 |
-
if (options.innerHeight) {
|
759 |
-
settings.h = setSize(options.innerHeight, 'y');
|
760 |
-
}
|
761 |
-
|
762 |
-
if (!options.innerHeight && !options.height) {
|
763 |
-
scrolltop = $loaded.scrollTop();
|
764 |
-
$loaded.css({height: "auto"});
|
765 |
-
settings.h = $loaded.height();
|
766 |
-
}
|
767 |
-
|
768 |
-
$loaded.css({height: settings.h});
|
769 |
-
|
770 |
-
if(scrolltop) {
|
771 |
-
$loaded.scrollTop(scrolltop);
|
772 |
-
}
|
773 |
-
|
774 |
-
publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
|
775 |
-
}
|
776 |
-
};
|
777 |
-
|
778 |
-
publicMethod.prep = function (object) {
|
779 |
-
if (!open) {
|
780 |
-
return;
|
781 |
-
}
|
782 |
-
|
783 |
-
var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
|
784 |
-
|
785 |
-
$loaded.remove();
|
786 |
-
|
787 |
-
$loaded = $tag(div, 'LoadedContent').append(object);
|
788 |
-
|
789 |
-
function getWidth() {
|
790 |
-
settings.w = settings.w || $loaded.width();
|
791 |
-
settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
|
792 |
-
return settings.w;
|
793 |
-
}
|
794 |
-
function getHeight() {
|
795 |
-
settings.h = settings.h || $loaded.height();
|
796 |
-
settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
|
797 |
-
return settings.h;
|
798 |
-
}
|
799 |
-
|
800 |
-
$loaded.hide()
|
801 |
-
.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
|
802 |
-
.css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
|
803 |
-
.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
|
804 |
-
.prependTo($content);
|
805 |
-
|
806 |
-
$loadingBay.hide();
|
807 |
-
|
808 |
-
// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
|
809 |
-
|
810 |
-
$(photo).css({'float': 'none'});
|
811 |
-
|
812 |
-
setClass(settings.get('className'));
|
813 |
-
|
814 |
-
callback = function () {
|
815 |
-
var total = $related.length,
|
816 |
-
iframe,
|
817 |
-
complete;
|
818 |
-
|
819 |
-
if (!open) {
|
820 |
-
return;
|
821 |
-
}
|
822 |
-
|
823 |
-
function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
|
824 |
-
if ($.support.opacity === false) {
|
825 |
-
$box[0].style.removeAttribute('filter');
|
826 |
-
}
|
827 |
-
}
|
828 |
-
|
829 |
-
complete = function () {
|
830 |
-
clearTimeout(loadingTimer);
|
831 |
-
$loadingOverlay.hide();
|
832 |
-
trigger(event_complete);
|
833 |
-
settings.get('onComplete');
|
834 |
-
};
|
835 |
-
|
836 |
-
|
837 |
-
$title.html(settings.get('title')).show();
|
838 |
-
$loaded.show();
|
839 |
-
|
840 |
-
if (total > 1) { // handle grouping
|
841 |
-
if (typeof settings.get('current') === "string") {
|
842 |
-
$current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
|
843 |
-
}
|
844 |
-
|
845 |
-
$next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
|
846 |
-
$prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
|
847 |
-
|
848 |
-
slideshow();
|
849 |
-
|
850 |
-
// Preloads images within a rel group
|
851 |
-
if (settings.get('preloading')) {
|
852 |
-
$.each([getIndex(-1), getIndex(1)], function(){
|
853 |
-
var img,
|
854 |
-
i = $related[this],
|
855 |
-
settings = new Settings(i, $.data(i, colorbox)),
|
856 |
-
src = settings.get('href');
|
857 |
-
|
858 |
-
if (src && isImage(settings, src)) {
|
859 |
-
src = retinaUrl(settings, src);
|
860 |
-
img = document.createElement('img');
|
861 |
-
img.src = src;
|
862 |
-
}
|
863 |
-
});
|
864 |
-
}
|
865 |
-
} else {
|
866 |
-
$groupControls.hide();
|
867 |
-
}
|
868 |
-
|
869 |
-
if (settings.get('iframe')) {
|
870 |
-
|
871 |
-
iframe = settings.get('createIframe');
|
872 |
-
|
873 |
-
if (!settings.get('scrolling')) {
|
874 |
-
iframe.scrolling = "no";
|
875 |
-
}
|
876 |
-
|
877 |
-
$(iframe)
|
878 |
-
.attr({
|
879 |
-
src: settings.get('href'),
|
880 |
-
'class': prefix + 'Iframe'
|
881 |
-
})
|
882 |
-
.one('load', complete)
|
883 |
-
.appendTo($loaded);
|
884 |
-
|
885 |
-
$events.one(event_purge, function () {
|
886 |
-
iframe.src = "//about:blank";
|
887 |
-
});
|
888 |
-
|
889 |
-
if (settings.get('fastIframe')) {
|
890 |
-
$(iframe).trigger('load');
|
891 |
-
}
|
892 |
-
} else {
|
893 |
-
complete();
|
894 |
-
}
|
895 |
-
|
896 |
-
if (settings.get('transition') === 'fade') {
|
897 |
-
$box.fadeTo(speed, 1, removeFilter);
|
898 |
-
} else {
|
899 |
-
removeFilter();
|
900 |
-
}
|
901 |
-
};
|
902 |
-
|
903 |
-
if (settings.get('transition') === 'fade') {
|
904 |
-
$box.fadeTo(speed, 0, function () {
|
905 |
-
publicMethod.position(0, callback);
|
906 |
-
});
|
907 |
-
} else {
|
908 |
-
publicMethod.position(speed, callback);
|
909 |
-
}
|
910 |
-
};
|
911 |
-
|
912 |
-
function load () {
|
913 |
-
var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
|
914 |
-
|
915 |
-
active = true;
|
916 |
-
|
917 |
-
photo = false;
|
918 |
-
|
919 |
-
trigger(event_purge);
|
920 |
-
trigger(event_load);
|
921 |
-
settings.get('onLoad');
|
922 |
-
|
923 |
-
settings.h = settings.get('height') ?
|
924 |
-
setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
|
925 |
-
settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
|
926 |
-
|
927 |
-
settings.w = settings.get('width') ?
|
928 |
-
setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
|
929 |
-
settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
|
930 |
-
|
931 |
-
// Sets the minimum dimensions for use in image scaling
|
932 |
-
settings.mw = settings.w;
|
933 |
-
settings.mh = settings.h;
|
934 |
-
|
935 |
-
// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
|
936 |
-
// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
|
937 |
-
if (settings.get('maxWidth')) {
|
938 |
-
settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
|
939 |
-
settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
|
940 |
-
}
|
941 |
-
if (settings.get('maxHeight')) {
|
942 |
-
settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
|
943 |
-
settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
|
944 |
-
}
|
945 |
-
|
946 |
-
href = settings.get('href');
|
947 |
-
|
948 |
-
loadingTimer = setTimeout(function () {
|
949 |
-
$loadingOverlay.show();
|
950 |
-
}, 100);
|
951 |
-
|
952 |
-
if (settings.get('inline')) {
|
953 |
-
var $target = $(href);
|
954 |
-
// Inserts an empty placeholder where inline content is being pulled from.
|
955 |
-
// An event is bound to put inline content back when Colorbox closes or loads new content.
|
956 |
-
$inline = $('<div>').hide().insertBefore($target);
|
957 |
-
|
958 |
-
$events.one(event_purge, function () {
|
959 |
-
$inline.replaceWith($target);
|
960 |
-
});
|
961 |
-
|
962 |
-
prep($target);
|
963 |
-
} else if (settings.get('iframe')) {
|
964 |
-
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
965 |
-
// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
|
966 |
-
prep(" ");
|
967 |
-
} else if (settings.get('html')) {
|
968 |
-
prep(settings.get('html'));
|
969 |
-
} else if (isImage(settings, href)) {
|
970 |
-
|
971 |
-
href = retinaUrl(settings, href);
|
972 |
-
|
973 |
-
photo = settings.get('createImg');
|
974 |
-
|
975 |
-
$(photo)
|
976 |
-
.addClass(prefix + 'Photo')
|
977 |
-
.bind('error.'+prefix,function () {
|
978 |
-
prep($tag(div, 'Error').html(settings.get('imgError')));
|
979 |
-
})
|
980 |
-
.one('load', function () {
|
981 |
-
if (request !== requests) {
|
982 |
-
return;
|
983 |
-
}
|
984 |
-
|
985 |
-
// A small pause because some browsers will occassionaly report a
|
986 |
-
// img.width and img.height of zero immediately after the img.onload fires
|
987 |
-
setTimeout(function(){
|
988 |
-
var percent;
|
989 |
-
|
990 |
-
if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
|
991 |
-
photo.height = photo.height / window.devicePixelRatio;
|
992 |
-
photo.width = photo.width / window.devicePixelRatio;
|
993 |
-
}
|
994 |
-
|
995 |
-
if (settings.get('scalePhotos')) {
|
996 |
-
setResize = function () {
|
997 |
-
photo.height -= photo.height * percent;
|
998 |
-
photo.width -= photo.width * percent;
|
999 |
-
};
|
1000 |
-
if (settings.mw && photo.width > settings.mw) {
|
1001 |
-
percent = (photo.width - settings.mw) / photo.width;
|
1002 |
-
setResize();
|
1003 |
-
}
|
1004 |
-
if (settings.mh && photo.height > settings.mh) {
|
1005 |
-
percent = (photo.height - settings.mh) / photo.height;
|
1006 |
-
setResize();
|
1007 |
-
}
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
if (settings.h) {
|
1011 |
-
photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
if ($related[1] && (settings.get('loop') || $related[index + 1])) {
|
1015 |
-
photo.style.cursor = 'pointer';
|
1016 |
-
|
1017 |
-
$(photo).bind('click.'+prefix, function () {
|
1018 |
-
publicMethod.next();
|
1019 |
-
});
|
1020 |
-
}
|
1021 |
-
|
1022 |
-
photo.style.width = photo.width + 'px';
|
1023 |
-
photo.style.height = photo.height + 'px';
|
1024 |
-
prep(photo);
|
1025 |
-
}, 1);
|
1026 |
-
});
|
1027 |
-
|
1028 |
-
photo.src = href;
|
1029 |
-
|
1030 |
-
} else if (href) {
|
1031 |
-
$loadingBay.load(href, settings.get('data'), function (data, status) {
|
1032 |
-
if (request === requests) {
|
1033 |
-
prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
|
1034 |
-
}
|
1035 |
-
});
|
1036 |
-
}
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
// Navigates to the next page/image in a set.
|
1040 |
-
publicMethod.next = function () {
|
1041 |
-
if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
|
1042 |
-
index = getIndex(1);
|
1043 |
-
launch($related[index]);
|
1044 |
-
}
|
1045 |
-
};
|
1046 |
-
|
1047 |
-
publicMethod.prev = function () {
|
1048 |
-
if (!active && $related[1] && (settings.get('loop') || index)) {
|
1049 |
-
index = getIndex(-1);
|
1050 |
-
launch($related[index]);
|
1051 |
-
}
|
1052 |
-
};
|
1053 |
-
|
1054 |
-
// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
|
1055 |
-
publicMethod.close = function () {
|
1056 |
-
if (open && !closing) {
|
1057 |
-
|
1058 |
-
closing = true;
|
1059 |
-
open = false;
|
1060 |
-
trigger(event_cleanup);
|
1061 |
-
settings.get('onCleanup');
|
1062 |
-
$window.unbind('.' + prefix);
|
1063 |
-
$overlay.fadeTo(settings.get('fadeOut') || 0, 0);
|
1064 |
-
|
1065 |
-
$box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
|
1066 |
-
$box.hide();
|
1067 |
-
$overlay.hide();
|
1068 |
-
trigger(event_purge);
|
1069 |
-
$loaded.remove();
|
1070 |
-
|
1071 |
-
setTimeout(function () {
|
1072 |
-
closing = false;
|
1073 |
-
trigger(event_closed);
|
1074 |
-
settings.get('onClosed');
|
1075 |
-
}, 1);
|
1076 |
-
});
|
1077 |
-
}
|
1078 |
-
};
|
1079 |
-
|
1080 |
-
// Removes changes Colorbox made to the document, but does not remove the plugin.
|
1081 |
-
publicMethod.remove = function () {
|
1082 |
-
if (!$box) { return; }
|
1083 |
-
|
1084 |
-
$box.stop();
|
1085 |
-
$[colorbox].close();
|
1086 |
-
$box.stop(false, true).remove();
|
1087 |
-
$overlay.remove();
|
1088 |
-
closing = false;
|
1089 |
-
$box = null;
|
1090 |
-
$('.' + boxElement)
|
1091 |
-
.removeData(colorbox)
|
1092 |
-
.removeClass(boxElement);
|
1093 |
-
|
1094 |
-
$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
|
1095 |
-
};
|
1096 |
-
|
1097 |
-
// A method for fetching the current element Colorbox is referencing.
|
1098 |
-
// returns a jQuery object.
|
1099 |
-
publicMethod.element = function () {
|
1100 |
-
return $(settings.el);
|
1101 |
-
};
|
1102 |
-
|
1103 |
-
publicMethod.settings = defaults;
|
1104 |
-
|
1105 |
}(jQuery, document, window));
|
1 |
+
/*!
|
2 |
+
Colorbox 1.6.3
|
3 |
+
license: MIT
|
4 |
+
http://www.jacklmoore.com/colorbox
|
5 |
+
*/
|
6 |
+
(function ($, document, window) {
|
7 |
+
var
|
8 |
+
// Default settings object.
|
9 |
+
// See http://jacklmoore.com/colorbox for details.
|
10 |
+
defaults = {
|
11 |
+
// data sources
|
12 |
+
html: false,
|
13 |
+
photo: false,
|
14 |
+
iframe: false,
|
15 |
+
inline: false,
|
16 |
+
|
17 |
+
// behavior and appearance
|
18 |
+
transition: "elastic",
|
19 |
+
speed: 300,
|
20 |
+
fadeOut: 300,
|
21 |
+
width: false,
|
22 |
+
initialWidth: "600",
|
23 |
+
innerWidth: false,
|
24 |
+
maxWidth: false,
|
25 |
+
height: false,
|
26 |
+
initialHeight: "450",
|
27 |
+
innerHeight: false,
|
28 |
+
maxHeight: false,
|
29 |
+
scalePhotos: true,
|
30 |
+
scrolling: true,
|
31 |
+
opacity: 0.9,
|
32 |
+
preloading: true,
|
33 |
+
className: false,
|
34 |
+
overlayClose: true,
|
35 |
+
escKey: true,
|
36 |
+
arrowKey: true,
|
37 |
+
top: false,
|
38 |
+
bottom: false,
|
39 |
+
left: false,
|
40 |
+
right: false,
|
41 |
+
fixed: false,
|
42 |
+
data: undefined,
|
43 |
+
closeButton: true,
|
44 |
+
fastIframe: true,
|
45 |
+
open: false,
|
46 |
+
reposition: true,
|
47 |
+
loop: true,
|
48 |
+
slideshow: false,
|
49 |
+
slideshowAuto: true,
|
50 |
+
slideshowSpeed: 2500,
|
51 |
+
slideshowStart: "start slideshow",
|
52 |
+
slideshowStop: "stop slideshow",
|
53 |
+
photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,
|
54 |
+
|
55 |
+
// alternate image paths for high-res displays
|
56 |
+
retinaImage: false,
|
57 |
+
retinaUrl: false,
|
58 |
+
retinaSuffix: '@2x.$1',
|
59 |
+
|
60 |
+
// internationalization
|
61 |
+
current: "image {current} of {total}",
|
62 |
+
previous: "previous",
|
63 |
+
next: "next",
|
64 |
+
close: "close",
|
65 |
+
xhrError: "This content failed to load.",
|
66 |
+
imgError: "This image failed to load.",
|
67 |
+
|
68 |
+
// accessbility
|
69 |
+
returnFocus: true,
|
70 |
+
trapFocus: true,
|
71 |
+
|
72 |
+
// callbacks
|
73 |
+
onOpen: false,
|
74 |
+
onLoad: false,
|
75 |
+
onComplete: false,
|
76 |
+
onCleanup: false,
|
77 |
+
onClosed: false,
|
78 |
+
|
79 |
+
rel: function() {
|
80 |
+
return this.rel;
|
81 |
+
},
|
82 |
+
href: function() {
|
83 |
+
// using this.href would give the absolute url, when the href may have been inteded as a selector (e.g. '#container')
|
84 |
+
return $(this).attr('href');
|
85 |
+
},
|
86 |
+
title: function() {
|
87 |
+
return this.title;
|
88 |
+
},
|
89 |
+
createImg: function() {
|
90 |
+
var img = new Image();
|
91 |
+
var attrs = $(this).data('cbox-img-attrs');
|
92 |
+
|
93 |
+
if (typeof attrs === 'object') {
|
94 |
+
$.each(attrs, function(key, val){
|
95 |
+
img[key] = val;
|
96 |
+
});
|
97 |
+
}
|
98 |
+
|
99 |
+
return img;
|
100 |
+
},
|
101 |
+
createIframe: function() {
|
102 |
+
var iframe = document.createElement('iframe');
|
103 |
+
var attrs = $(this).data('cbox-iframe-attrs');
|
104 |
+
|
105 |
+
if (typeof attrs === 'object') {
|
106 |
+
$.each(attrs, function(key, val){
|
107 |
+
iframe[key] = val;
|
108 |
+
});
|
109 |
+
}
|
110 |
+
|
111 |
+
if ('frameBorder' in iframe) {
|
112 |
+
iframe.frameBorder = 0;
|
113 |
+
}
|
114 |
+
if ('allowTransparency' in iframe) {
|
115 |
+
iframe.allowTransparency = "true";
|
116 |
+
}
|
117 |
+
iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching
|
118 |
+
iframe.allowFullscreen = true;
|
119 |
+
|
120 |
+
return iframe;
|
121 |
+
}
|
122 |
+
},
|
123 |
+
|
124 |
+
// Abstracting the HTML and event identifiers for easy rebranding
|
125 |
+
colorbox = 'colorbox',
|
126 |
+
prefix = 'cbox',
|
127 |
+
boxElement = prefix + 'Element',
|
128 |
+
|
129 |
+
// Events
|
130 |
+
event_open = prefix + '_open',
|
131 |
+
event_load = prefix + '_load',
|
132 |
+
event_complete = prefix + '_complete',
|
133 |
+
event_cleanup = prefix + '_cleanup',
|
134 |
+
event_closed = prefix + '_closed',
|
135 |
+
event_purge = prefix + '_purge',
|
136 |
+
|
137 |
+
// Cached jQuery Object Variables
|
138 |
+
$overlay,
|
139 |
+
$box,
|
140 |
+
$wrap,
|
141 |
+
$content,
|
142 |
+
$topBorder,
|
143 |
+
$leftBorder,
|
144 |
+
$rightBorder,
|
145 |
+
$bottomBorder,
|
146 |
+
$related,
|
147 |
+
$window,
|
148 |
+
$loaded,
|
149 |
+
$loadingBay,
|
150 |
+
$loadingOverlay,
|
151 |
+
$title,
|
152 |
+
$current,
|
153 |
+
$slideshow,
|
154 |
+
$next,
|
155 |
+
$prev,
|
156 |
+
$close,
|
157 |
+
$groupControls,
|
158 |
+
$events = $('<a/>'), // $({}) would be prefered, but there is an issue with jQuery 1.4.2
|
159 |
+
|
160 |
+
// Variables for cached values or use across multiple functions
|
161 |
+
settings,
|
162 |
+
interfaceHeight,
|
163 |
+
interfaceWidth,
|
164 |
+
loadedHeight,
|
165 |
+
loadedWidth,
|
166 |
+
index,
|
167 |
+
photo,
|
168 |
+
open,
|
169 |
+
active,
|
170 |
+
closing,
|
171 |
+
loadingTimer,
|
172 |
+
publicMethod,
|
173 |
+
div = "div",
|
174 |
+
requests = 0,
|
175 |
+
previousCSS = {},
|
176 |
+
init;
|
177 |
+
|
178 |
+
// ****************
|
179 |
+
// HELPER FUNCTIONS
|
180 |
+
// ****************
|
181 |
+
|
182 |
+
// Convenience function for creating new jQuery objects
|
183 |
+
function $tag(tag, id, css) {
|
184 |
+
var element = document.createElement(tag);
|
185 |
+
|
186 |
+
if (id) {
|
187 |
+
element.id = prefix + id;
|
188 |
+
}
|
189 |
+
|
190 |
+
if (css) {
|
191 |
+
element.style.cssText = css;
|
192 |
+
}
|
193 |
+
|
194 |
+
return $(element);
|
195 |
+
}
|
196 |
+
|
197 |
+
// Get the window height using innerHeight when available to avoid an issue with iOS
|
198 |
+
// http://bugs.jquery.com/ticket/6724
|
199 |
+
function winheight() {
|
200 |
+
return window.innerHeight ? window.innerHeight : $(window).height();
|
201 |
+
}
|
202 |
+
|
203 |
+
function Settings(element, options) {
|
204 |
+
if (options !== Object(options)) {
|
205 |
+
options = {};
|
206 |
+
}
|
207 |
+
|
208 |
+
this.cache = {};
|
209 |
+
this.el = element;
|
210 |
+
|
211 |
+
this.value = function(key) {
|
212 |
+
var dataAttr;
|
213 |
+
|
214 |
+
if (this.cache[key] === undefined) {
|
215 |
+
dataAttr = $(this.el).attr('data-cbox-'+key);
|
216 |
+
|
217 |
+
if (dataAttr !== undefined) {
|
218 |
+
this.cache[key] = dataAttr;
|
219 |
+
} else if (options[key] !== undefined) {
|
220 |
+
this.cache[key] = options[key];
|
221 |
+
} else if (defaults[key] !== undefined) {
|
222 |
+
this.cache[key] = defaults[key];
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
return this.cache[key];
|
227 |
+
};
|
228 |
+
|
229 |
+
this.get = function(key) {
|
230 |
+
var value = this.value(key);
|
231 |
+
return $.isFunction(value) ? value.call(this.el, this) : value;
|
232 |
+
};
|
233 |
+
}
|
234 |
+
|
235 |
+
// Determine the next and previous members in a group.
|
236 |
+
function getIndex(increment) {
|
237 |
+
var
|
238 |
+
max = $related.length,
|
239 |
+
newIndex = (index + increment) % max;
|
240 |
+
|
241 |
+
return (newIndex < 0) ? max + newIndex : newIndex;
|
242 |
+
}
|
243 |
+
|
244 |
+
// Convert '%' and 'px' values to integers
|
245 |
+
function setSize(size, dimension) {
|
246 |
+
return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
|
247 |
+
}
|
248 |
+
|
249 |
+
// Checks an href to see if it is a photo.
|
250 |
+
// There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
|
251 |
+
function isImage(settings, url) {
|
252 |
+
return settings.get('photo') || settings.get('photoRegex').test(url);
|
253 |
+
}
|
254 |
+
|
255 |
+
function retinaUrl(settings, url) {
|
256 |
+
return settings.get('retinaUrl') && window.devicePixelRatio > 1 ? url.replace(settings.get('photoRegex'), settings.get('retinaSuffix')) : url;
|
257 |
+
}
|
258 |
+
|
259 |
+
function trapFocus(e) {
|
260 |
+
if ('contains' in $box[0] && !$box[0].contains(e.target) && e.target !== $overlay[0]) {
|
261 |
+
e.stopPropagation();
|
262 |
+
$box.focus();
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
function setClass(str) {
|
267 |
+
if (setClass.str !== str) {
|
268 |
+
$box.add($overlay).removeClass(setClass.str).addClass(str);
|
269 |
+
setClass.str = str;
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
function getRelated(rel) {
|
274 |
+
index = 0;
|
275 |
+
|
276 |
+
if (rel && rel !== false && rel !== 'nofollow') {
|
277 |
+
$related = $('.' + boxElement).filter(function () {
|
278 |
+
var options = $.data(this, colorbox);
|
279 |
+
var settings = new Settings(this, options);
|
280 |
+
return (settings.get('rel') === rel);
|
281 |
+
});
|
282 |
+
index = $related.index(settings.el);
|
283 |
+
|
284 |
+
// Check direct calls to Colorbox.
|
285 |
+
if (index === -1) {
|
286 |
+
$related = $related.add(settings.el);
|
287 |
+
index = $related.length - 1;
|
288 |
+
}
|
289 |
+
} else {
|
290 |
+
$related = $(settings.el);
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
function trigger(event) {
|
295 |
+
// for external use
|
296 |
+
$(document).trigger(event);
|
297 |
+
// for internal use
|
298 |
+
$events.triggerHandler(event);
|
299 |
+
}
|
300 |
+
|
301 |
+
var slideshow = (function(){
|
302 |
+
var active,
|
303 |
+
className = prefix + "Slideshow_",
|
304 |
+
click = "click." + prefix,
|
305 |
+
timeOut;
|
306 |
+
|
307 |
+
function clear () {
|
308 |
+
clearTimeout(timeOut);
|
309 |
+
}
|
310 |
+
|
311 |
+
function set() {
|
312 |
+
if (settings.get('loop') || $related[index + 1]) {
|
313 |
+
clear();
|
314 |
+
timeOut = setTimeout(publicMethod.next, settings.get('slideshowSpeed'));
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
function start() {
|
319 |
+
$slideshow
|
320 |
+
.html(settings.get('slideshowStop'))
|
321 |
+
.unbind(click)
|
322 |
+
.one(click, stop);
|
323 |
+
|
324 |
+
$events
|
325 |
+
.bind(event_complete, set)
|
326 |
+
.bind(event_load, clear);
|
327 |
+
|
328 |
+
$box.removeClass(className + "off").addClass(className + "on");
|
329 |
+
}
|
330 |
+
|
331 |
+
function stop() {
|
332 |
+
clear();
|
333 |
+
|
334 |
+
$events
|
335 |
+
.unbind(event_complete, set)
|
336 |
+
.unbind(event_load, clear);
|
337 |
+
|
338 |
+
$slideshow
|
339 |
+
.html(settings.get('slideshowStart'))
|
340 |
+
.unbind(click)
|
341 |
+
.one(click, function () {
|
342 |
+
publicMethod.next();
|
343 |
+
start();
|
344 |
+
});
|
345 |
+
|
346 |
+
$box.removeClass(className + "on").addClass(className + "off");
|
347 |
+
}
|
348 |
+
|
349 |
+
function reset() {
|
350 |
+
active = false;
|
351 |
+
$slideshow.hide();
|
352 |
+
clear();
|
353 |
+
$events
|
354 |
+
.unbind(event_complete, set)
|
355 |
+
.unbind(event_load, clear);
|
356 |
+
$box.removeClass(className + "off " + className + "on");
|
357 |
+
}
|
358 |
+
|
359 |
+
return function(){
|
360 |
+
if (active) {
|
361 |
+
if (!settings.get('slideshow')) {
|
362 |
+
$events.unbind(event_cleanup, reset);
|
363 |
+
reset();
|
364 |
+
}
|
365 |
+
} else {
|
366 |
+
if (settings.get('slideshow') && $related[1]) {
|
367 |
+
active = true;
|
368 |
+
$events.one(event_cleanup, reset);
|
369 |
+
if (settings.get('slideshowAuto')) {
|
370 |
+
start();
|
371 |
+
} else {
|
372 |
+
stop();
|
373 |
+
}
|
374 |
+
$slideshow.show();
|
375 |
+
}
|
376 |
+
}
|
377 |
+
};
|
378 |
+
|
379 |
+
}());
|
380 |
+
|
381 |
+
|
382 |
+
function launch(element) {
|
383 |
+
var options;
|
384 |
+
|
385 |
+
if (!closing) {
|
386 |
+
|
387 |
+
options = $(element).data(colorbox);
|
388 |
+
|
389 |
+
settings = new Settings(element, options);
|
390 |
+
|
391 |
+
getRelated(settings.get('rel'));
|
392 |
+
|
393 |
+
if (!open) {
|
394 |
+
open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
|
395 |
+
|
396 |
+
setClass(settings.get('className'));
|
397 |
+
|
398 |
+
// Show colorbox so the sizes can be calculated in older versions of jQuery
|
399 |
+
$box.css({visibility:'hidden', display:'block', opacity:''});
|
400 |
+
|
401 |
+
$loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden');
|
402 |
+
$content.css({width:'', height:''}).append($loaded);
|
403 |
+
|
404 |
+
// Cache values needed for size calculations
|
405 |
+
interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
|
406 |
+
interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
|
407 |
+
loadedHeight = $loaded.outerHeight(true);
|
408 |
+
loadedWidth = $loaded.outerWidth(true);
|
409 |
+
|
410 |
+
// Opens inital empty Colorbox prior to content being loaded.
|
411 |
+
var initialWidth = setSize(settings.get('initialWidth'), 'x');
|
412 |
+
var initialHeight = setSize(settings.get('initialHeight'), 'y');
|
413 |
+
var maxWidth = settings.get('maxWidth');
|
414 |
+
var maxHeight = settings.get('maxHeight');
|
415 |
+
|
416 |
+
settings.w = Math.max((maxWidth !== false ? Math.min(initialWidth, setSize(maxWidth, 'x')) : initialWidth) - loadedWidth - interfaceWidth, 0);
|
417 |
+
settings.h = Math.max((maxHeight !== false ? Math.min(initialHeight, setSize(maxHeight, 'y')) : initialHeight) - loadedHeight - interfaceHeight, 0);
|
418 |
+
|
419 |
+
$loaded.css({width:'', height:settings.h});
|
420 |
+
publicMethod.position();
|
421 |
+
|
422 |
+
trigger(event_open);
|
423 |
+
settings.get('onOpen');
|
424 |
+
|
425 |
+
$groupControls.add($title).hide();
|
426 |
+
|
427 |
+
$box.focus();
|
428 |
+
|
429 |
+
if (settings.get('trapFocus')) {
|
430 |
+
// Confine focus to the modal
|
431 |
+
// Uses event capturing that is not supported in IE8-
|
432 |
+
if (document.addEventListener) {
|
433 |
+
|
434 |
+
document.addEventListener('focus', trapFocus, true);
|
435 |
+
|
436 |
+
$events.one(event_closed, function () {
|
437 |
+
document.removeEventListener('focus', trapFocus, true);
|
438 |
+
});
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
// Return focus on closing
|
443 |
+
if (settings.get('returnFocus')) {
|
444 |
+
$events.one(event_closed, function () {
|
445 |
+
$(settings.el).focus();
|
446 |
+
});
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
var opacity = parseFloat(settings.get('opacity'));
|
451 |
+
$overlay.css({
|
452 |
+
opacity: opacity === opacity ? opacity : '',
|
453 |
+
cursor: settings.get('overlayClose') ? 'pointer' : '',
|
454 |
+
visibility: 'visible'
|
455 |
+
}).show();
|
456 |
+
|
457 |
+
if (settings.get('closeButton')) {
|
458 |
+
$close.html(settings.get('close')).appendTo($content);
|
459 |
+
} else {
|
460 |
+
$close.appendTo('<div/>'); // replace with .detach() when dropping jQuery < 1.4
|
461 |
+
}
|
462 |
+
|
463 |
+
load();
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
// Colorbox's markup needs to be added to the DOM prior to being called
|
468 |
+
// so that the browser will go ahead and load the CSS background images.
|
469 |
+
function appendHTML() {
|
470 |
+
if (!$box) {
|
471 |
+
init = false;
|
472 |
+
$window = $(window);
|
473 |
+
$box = $tag(div).attr({
|
474 |
+
id: colorbox,
|
475 |
+
'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
|
476 |
+
role: 'dialog',
|
477 |
+
tabindex: '-1'
|
478 |
+
}).hide();
|
479 |
+
$overlay = $tag(div, "Overlay").hide();
|
480 |
+
$loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
|
481 |
+
$wrap = $tag(div, "Wrapper");
|
482 |
+
$content = $tag(div, "Content").append(
|
483 |
+
$title = $tag(div, "Title"),
|
484 |
+
$current = $tag(div, "Current"),
|
485 |
+
$prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
|
486 |
+
$next = $('<button type="button"/>').attr({id:prefix+'Next'}),
|
487 |
+
$slideshow = $tag('button', "Slideshow"),
|
488 |
+
$loadingOverlay
|
489 |
+
);
|
490 |
+
|
491 |
+
$close = $('<button type="button"/>').attr({id:prefix+'Close'});
|
492 |
+
|
493 |
+
$wrap.append( // The 3x3 Grid that makes up Colorbox
|
494 |
+
$tag(div).append(
|
495 |
+
$tag(div, "TopLeft"),
|
496 |
+
$topBorder = $tag(div, "TopCenter"),
|
497 |
+
$tag(div, "TopRight")
|
498 |
+
),
|
499 |
+
$tag(div, false, 'clear:left').append(
|
500 |
+
$leftBorder = $tag(div, "MiddleLeft"),
|
501 |
+
$content,
|
502 |
+
$rightBorder = $tag(div, "MiddleRight")
|
503 |
+
),
|
504 |
+
$tag(div, false, 'clear:left').append(
|
505 |
+
$tag(div, "BottomLeft"),
|
506 |
+
$bottomBorder = $tag(div, "BottomCenter"),
|
507 |
+
$tag(div, "BottomRight")
|
508 |
+
)
|
509 |
+
).find('div div').css({'float': 'left'});
|
510 |
+
|
511 |
+
$loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');
|
512 |
+
|
513 |
+
$groupControls = $next.add($prev).add($current).add($slideshow);
|
514 |
+
}
|
515 |
+
if (document.body && !$box.parent().length) {
|
516 |
+
$(document.body).append($overlay, $box.append($wrap, $loadingBay));
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
// Add Colorbox's event bindings
|
521 |
+
function addBindings() {
|
522 |
+
function clickHandler(e) {
|
523 |
+
// ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
|
524 |
+
// See: http://jacklmoore.com/notes/click-events/
|
525 |
+
if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
|
526 |
+
e.preventDefault();
|
527 |
+
launch(this);
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
if ($box) {
|
532 |
+
if (!init) {
|
533 |
+
init = true;
|
534 |
+
|
535 |
+
// Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
|
536 |
+
$next.click(function () {
|
537 |
+
publicMethod.next();
|
538 |
+
});
|
539 |
+
$prev.click(function () {
|
540 |
+
publicMethod.prev();
|
541 |
+
});
|
542 |
+
$close.click(function () {
|
543 |
+
publicMethod.close();
|
544 |
+
});
|
545 |
+
$overlay.click(function () {
|
546 |
+
if (settings.get('overlayClose')) {
|
547 |
+
publicMethod.close();
|
548 |
+
}
|
549 |
+
});
|
550 |
+
|
551 |
+
// Key Bindings
|
552 |
+
$(document).bind('keydown.' + prefix, function (e) {
|
553 |
+
var key = e.keyCode;
|
554 |
+
if (open && settings.get('escKey') && key === 27) {
|
555 |
+
e.preventDefault();
|
556 |
+
publicMethod.close();
|
557 |
+
}
|
558 |
+
if (open && settings.get('arrowKey') && $related[1] && !e.altKey) {
|
559 |
+
if (key === 37) {
|
560 |
+
e.preventDefault();
|
561 |
+
$prev.click();
|
562 |
+
} else if (key === 39) {
|
563 |
+
e.preventDefault();
|
564 |
+
$next.click();
|
565 |
+
}
|
566 |
+
}
|
567 |
+
});
|
568 |
+
|
569 |
+
if ($.isFunction($.fn.on)) {
|
570 |
+
// For jQuery 1.7+
|
571 |
+
$(document).on('click.'+prefix, '.'+boxElement, clickHandler);
|
572 |
+
} else {
|
573 |
+
// For jQuery 1.3.x -> 1.6.x
|
574 |
+
// This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
|
575 |
+
// This is not here for jQuery 1.9, it's here for legacy users.
|
576 |
+
$('.'+boxElement).live('click.'+prefix, clickHandler);
|
577 |
+
}
|
578 |
+
}
|
579 |
+
return true;
|
580 |
+
}
|
581 |
+
return false;
|
582 |
+
}
|
583 |
+
|
584 |
+
// Don't do anything if Colorbox already exists.
|
585 |
+
if ($[colorbox]) {
|
586 |
+
return;
|
587 |
+
}
|
588 |
+
|
589 |
+
// Append the HTML when the DOM loads
|
590 |
+
$(appendHTML);
|
591 |
+
|
592 |
+
|
593 |
+
// ****************
|
594 |
+
// PUBLIC FUNCTIONS
|
595 |
+
// Usage format: $.colorbox.close();
|
596 |
+
// Usage from within an iframe: parent.jQuery.colorbox.close();
|
597 |
+
// ****************
|
598 |
+
|
599 |
+
publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
|
600 |
+
var settings;
|
601 |
+
var $obj = this;
|
602 |
+
|
603 |
+
options = options || {};
|
604 |
+
|
605 |
+
if ($.isFunction($obj)) { // assume a call to $.colorbox
|
606 |
+
$obj = $('<a/>');
|
607 |
+
options.open = true;
|
608 |
+
}
|
609 |
+
|
610 |
+
if (!$obj[0]) { // colorbox being applied to empty collection
|
611 |
+
return $obj;
|
612 |
+
}
|
613 |
+
|
614 |
+
appendHTML();
|
615 |
+
|
616 |
+
if (addBindings()) {
|
617 |
+
|
618 |
+
if (callback) {
|
619 |
+
options.onComplete = callback;
|
620 |
+
}
|
621 |
+
|
622 |
+
$obj.each(function () {
|
623 |
+
var old = $.data(this, colorbox) || {};
|
624 |
+
$.data(this, colorbox, $.extend(old, options));
|
625 |
+
}).addClass(boxElement);
|
626 |
+
|
627 |
+
settings = new Settings($obj[0], options);
|
628 |
+
|
629 |
+
if (settings.get('open')) {
|
630 |
+
launch($obj[0]);
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
return $obj;
|
635 |
+
};
|
636 |
+
|
637 |
+
publicMethod.position = function (speed, loadedCallback) {
|
638 |
+
var
|
639 |
+
css,
|
640 |
+
top = 0,
|
641 |
+
left = 0,
|
642 |
+
offset = $box.offset(),
|
643 |
+
scrollTop,
|
644 |
+
scrollLeft;
|
645 |
+
|
646 |
+
$window.unbind('resize.' + prefix);
|
647 |
+
|
648 |
+
// remove the modal so that it doesn't influence the document width/height
|
649 |
+
$box.css({top: -9e4, left: -9e4});
|
650 |
+
|
651 |
+
scrollTop = $window.scrollTop();
|
652 |
+
scrollLeft = $window.scrollLeft();
|
653 |
+
|
654 |
+
if (settings.get('fixed')) {
|
655 |
+
offset.top -= scrollTop;
|
656 |
+
offset.left -= scrollLeft;
|
657 |
+
$box.css({position: 'fixed'});
|
658 |
+
} else {
|
659 |
+
top = scrollTop;
|
660 |
+
left = scrollLeft;
|
661 |
+
$box.css({position: 'absolute'});
|
662 |
+
}
|
663 |
+
|
664 |
+
// keeps the top and left positions within the browser's viewport.
|
665 |
+
if (settings.get('right') !== false) {
|
666 |
+
left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.get('right'), 'x'), 0);
|
667 |
+
} else if (settings.get('left') !== false) {
|
668 |
+
left += setSize(settings.get('left'), 'x');
|
669 |
+
} else {
|
670 |
+
left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
|
671 |
+
}
|
672 |
+
|
673 |
+
if (settings.get('bottom') !== false) {
|
674 |
+
top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.get('bottom'), 'y'), 0);
|
675 |
+
} else if (settings.get('top') !== false) {
|
676 |
+
top += setSize(settings.get('top'), 'y');
|
677 |
+
} else {
|
678 |
+
top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
|
679 |
+
}
|
680 |
+
|
681 |
+
$box.css({top: offset.top, left: offset.left, visibility:'visible'});
|
682 |
+
|
683 |
+
// this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
|
684 |
+
// but it has to be shrank down around the size of div#colorbox when it's done. If not,
|
685 |
+
// it can invoke an obscure IE bug when using iframes.
|
686 |
+
$wrap[0].style.width = $wrap[0].style.height = "9999px";
|
687 |
+
|
688 |
+
function modalDimensions() {
|
689 |
+
$topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt($box[0].style.width,10) - interfaceWidth)+'px';
|
690 |
+
$content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt($box[0].style.height,10) - interfaceHeight)+'px';
|
691 |
+
}
|
692 |
+
|
693 |
+
css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
|
694 |
+
|
695 |
+
// setting the speed to 0 if the content hasn't changed size or position
|
696 |
+
if (speed) {
|
697 |
+
var tempSpeed = 0;
|
698 |
+
$.each(css, function(i){
|
699 |
+
if (css[i] !== previousCSS[i]) {
|
700 |
+
tempSpeed = speed;
|
701 |
+
return;
|
702 |
+
}
|
703 |
+
});
|
704 |
+
speed = tempSpeed;
|
705 |
+
}
|
706 |
+
|
707 |
+
previousCSS = css;
|
708 |
+
|
709 |
+
if (!speed) {
|
710 |
+
$box.css(css);
|
711 |
+
}
|
712 |
+
|
713 |
+
$box.dequeue().animate(css, {
|
714 |
+
duration: speed || 0,
|
715 |
+
complete: function () {
|
716 |
+
modalDimensions();
|
717 |
+
|
718 |
+
active = false;
|
719 |
+
|
720 |
+
// shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
|
721 |
+
$wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
|
722 |
+
$wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
|
723 |
+
|
724 |
+
if (settings.get('reposition')) {
|
725 |
+
setTimeout(function () { // small delay before binding onresize due to an IE8 bug.
|
726 |
+
$window.bind('resize.' + prefix, publicMethod.position);
|
727 |
+
}, 1);
|
728 |
+
}
|
729 |
+
|
730 |
+
if ($.isFunction(loadedCallback)) {
|
731 |
+
loadedCallback();
|
732 |
+
}
|
733 |
+
},
|
734 |
+
step: modalDimensions
|
735 |
+
});
|
736 |
+
};
|
737 |
+
|
738 |
+
publicMethod.resize = function (options) {
|
739 |
+
var scrolltop;
|
740 |
+
|
741 |
+
if (open) {
|
742 |
+
options = options || {};
|
743 |
+
|
744 |
+
if (options.width) {
|
745 |
+
settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
|
746 |
+
}
|
747 |
+
|
748 |
+
if (options.innerWidth) {
|
749 |
+
settings.w = setSize(options.innerWidth, 'x');
|
750 |
+
}
|
751 |
+
|
752 |
+
$loaded.css({width: settings.w});
|
753 |
+
|
754 |
+
if (options.height) {
|
755 |
+
settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
|
756 |
+
}
|
757 |
+
|
758 |
+
if (options.innerHeight) {
|
759 |
+
settings.h = setSize(options.innerHeight, 'y');
|
760 |
+
}
|
761 |
+
|
762 |
+
if (!options.innerHeight && !options.height) {
|
763 |
+
scrolltop = $loaded.scrollTop();
|
764 |
+
$loaded.css({height: "auto"});
|
765 |
+
settings.h = $loaded.height();
|
766 |
+
}
|
767 |
+
|
768 |
+
$loaded.css({height: settings.h});
|
769 |
+
|
770 |
+
if(scrolltop) {
|
771 |
+
$loaded.scrollTop(scrolltop);
|
772 |
+
}
|
773 |
+
|
774 |
+
publicMethod.position(settings.get('transition') === "none" ? 0 : settings.get('speed'));
|
775 |
+
}
|
776 |
+
};
|
777 |
+
|
778 |
+
publicMethod.prep = function (object) {
|
779 |
+
if (!open) {
|
780 |
+
return;
|
781 |
+
}
|
782 |
+
|
783 |
+
var callback, speed = settings.get('transition') === "none" ? 0 : settings.get('speed');
|
784 |
+
|
785 |
+
$loaded.remove();
|
786 |
+
|
787 |
+
$loaded = $tag(div, 'LoadedContent').append(object);
|
788 |
+
|
789 |
+
function getWidth() {
|
790 |
+
settings.w = settings.w || $loaded.width();
|
791 |
+
settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
|
792 |
+
return settings.w;
|
793 |
+
}
|
794 |
+
function getHeight() {
|
795 |
+
settings.h = settings.h || $loaded.height();
|
796 |
+
settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
|
797 |
+
return settings.h;
|
798 |
+
}
|
799 |
+
|
800 |
+
$loaded.hide()
|
801 |
+
.appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
|
802 |
+
.css({width: getWidth(), overflow: settings.get('scrolling') ? 'auto' : 'hidden'})
|
803 |
+
.css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
|
804 |
+
.prependTo($content);
|
805 |
+
|
806 |
+
$loadingBay.hide();
|
807 |
+
|
808 |
+
// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
|
809 |
+
|
810 |
+
$(photo).css({'float': 'none'});
|
811 |
+
|
812 |
+
setClass(settings.get('className'));
|
813 |
+
|
814 |
+
callback = function () {
|
815 |
+
var total = $related.length,
|
816 |
+
iframe,
|
817 |
+
complete;
|
818 |
+
|
819 |
+
if (!open) {
|
820 |
+
return;
|
821 |
+
}
|
822 |
+
|
823 |
+
function removeFilter() { // Needed for IE8 in versions of jQuery prior to 1.7.2
|
824 |
+
if ($.support.opacity === false) {
|
825 |
+
$box[0].style.removeAttribute('filter');
|
826 |
+
}
|
827 |
+
}
|
828 |
+
|
829 |
+
complete = function () {
|
830 |
+
clearTimeout(loadingTimer);
|
831 |
+
$loadingOverlay.hide();
|
832 |
+
trigger(event_complete);
|
833 |
+
settings.get('onComplete');
|
834 |
+
};
|
835 |
+
|
836 |
+
|
837 |
+
$title.html(settings.get('title')).show();
|
838 |
+
$loaded.show();
|
839 |
+
|
840 |
+
if (total > 1) { // handle grouping
|
841 |
+
if (typeof settings.get('current') === "string") {
|
842 |
+
$current.html(settings.get('current').replace('{current}', index + 1).replace('{total}', total)).show();
|
843 |
+
}
|
844 |
+
|
845 |
+
$next[(settings.get('loop') || index < total - 1) ? "show" : "hide"]().html(settings.get('next'));
|
846 |
+
$prev[(settings.get('loop') || index) ? "show" : "hide"]().html(settings.get('previous'));
|
847 |
+
|
848 |
+
slideshow();
|
849 |
+
|
850 |
+
// Preloads images within a rel group
|
851 |
+
if (settings.get('preloading')) {
|
852 |
+
$.each([getIndex(-1), getIndex(1)], function(){
|
853 |
+
var img,
|
854 |
+
i = $related[this],
|
855 |
+
settings = new Settings(i, $.data(i, colorbox)),
|
856 |
+
src = settings.get('href');
|
857 |
+
|
858 |
+
if (src && isImage(settings, src)) {
|
859 |
+
src = retinaUrl(settings, src);
|
860 |
+
img = document.createElement('img');
|
861 |
+
img.src = src;
|
862 |
+
}
|
863 |
+
});
|
864 |
+
}
|
865 |
+
} else {
|
866 |
+
$groupControls.hide();
|
867 |
+
}
|
868 |
+
|
869 |
+
if (settings.get('iframe')) {
|
870 |
+
|
871 |
+
iframe = settings.get('createIframe');
|
872 |
+
|
873 |
+
if (!settings.get('scrolling')) {
|
874 |
+
iframe.scrolling = "no";
|
875 |
+
}
|
876 |
+
|
877 |
+
$(iframe)
|
878 |
+
.attr({
|
879 |
+
src: settings.get('href'),
|
880 |
+
'class': prefix + 'Iframe'
|
881 |
+
})
|
882 |
+
.one('load', complete)
|
883 |
+
.appendTo($loaded);
|
884 |
+
|
885 |
+
$events.one(event_purge, function () {
|
886 |
+
iframe.src = "//about:blank";
|
887 |
+
});
|
888 |
+
|
889 |
+
if (settings.get('fastIframe')) {
|
890 |
+
$(iframe).trigger('load');
|
891 |
+
}
|
892 |
+
} else {
|
893 |
+
complete();
|
894 |
+
}
|
895 |
+
|
896 |
+
if (settings.get('transition') === 'fade') {
|
897 |
+
$box.fadeTo(speed, 1, removeFilter);
|
898 |
+
} else {
|
899 |
+
removeFilter();
|
900 |
+
}
|
901 |
+
};
|
902 |
+
|
903 |
+
if (settings.get('transition') === 'fade') {
|
904 |
+
$box.fadeTo(speed, 0, function () {
|
905 |
+
publicMethod.position(0, callback);
|
906 |
+
});
|
907 |
+
} else {
|
908 |
+
publicMethod.position(speed, callback);
|
909 |
+
}
|
910 |
+
};
|
911 |
+
|
912 |
+
function load () {
|
913 |
+
var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
|
914 |
+
|
915 |
+
active = true;
|
916 |
+
|
917 |
+
photo = false;
|
918 |
+
|
919 |
+
trigger(event_purge);
|
920 |
+
trigger(event_load);
|
921 |
+
settings.get('onLoad');
|
922 |
+
|
923 |
+
settings.h = settings.get('height') ?
|
924 |
+
setSize(settings.get('height'), 'y') - loadedHeight - interfaceHeight :
|
925 |
+
settings.get('innerHeight') && setSize(settings.get('innerHeight'), 'y');
|
926 |
+
|
927 |
+
settings.w = settings.get('width') ?
|
928 |
+
setSize(settings.get('width'), 'x') - loadedWidth - interfaceWidth :
|
929 |
+
settings.get('innerWidth') && setSize(settings.get('innerWidth'), 'x');
|
930 |
+
|
931 |
+
// Sets the minimum dimensions for use in image scaling
|
932 |
+
settings.mw = settings.w;
|
933 |
+
settings.mh = settings.h;
|
934 |
+
|
935 |
+
// Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
|
936 |
+
// If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
|
937 |
+
if (settings.get('maxWidth')) {
|
938 |
+
settings.mw = setSize(settings.get('maxWidth'), 'x') - loadedWidth - interfaceWidth;
|
939 |
+
settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
|
940 |
+
}
|
941 |
+
if (settings.get('maxHeight')) {
|
942 |
+
settings.mh = setSize(settings.get('maxHeight'), 'y') - loadedHeight - interfaceHeight;
|
943 |
+
settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
|
944 |
+
}
|
945 |
+
|
946 |
+
href = settings.get('href');
|
947 |
+
|
948 |
+
loadingTimer = setTimeout(function () {
|
949 |
+
$loadingOverlay.show();
|
950 |
+
}, 100);
|
951 |
+
|
952 |
+
if (settings.get('inline')) {
|
953 |
+
var $target = $(href);
|
954 |
+
// Inserts an empty placeholder where inline content is being pulled from.
|
955 |
+
// An event is bound to put inline content back when Colorbox closes or loads new content.
|
956 |
+
$inline = $('<div>').hide().insertBefore($target);
|
957 |
+
|
958 |
+
$events.one(event_purge, function () {
|
959 |
+
$inline.replaceWith($target);
|
960 |
+
});
|
961 |
+
|
962 |
+
prep($target);
|
963 |
+
} else if (settings.get('iframe')) {
|
964 |
+
// IFrame element won't be added to the DOM until it is ready to be displayed,
|
965 |
+
// to avoid problems with DOM-ready JS that might be trying to run in that iframe.
|
966 |
+
prep(" ");
|
967 |
+
} else if (settings.get('html')) {
|
968 |
+
prep(settings.get('html'));
|
969 |
+
} else if (isImage(settings, href)) {
|
970 |
+
|
971 |
+
href = retinaUrl(settings, href);
|
972 |
+
|
973 |
+
photo = settings.get('createImg');
|
974 |
+
|
975 |
+
$(photo)
|
976 |
+
.addClass(prefix + 'Photo')
|
977 |
+
.bind('error.'+prefix,function () {
|
978 |
+
prep($tag(div, 'Error').html(settings.get('imgError')));
|
979 |
+
})
|
980 |
+
.one('load', function () {
|
981 |
+
if (request !== requests) {
|
982 |
+
return;
|
983 |
+
}
|
984 |
+
|
985 |
+
// A small pause because some browsers will occassionaly report a
|
986 |
+
// img.width and img.height of zero immediately after the img.onload fires
|
987 |
+
setTimeout(function(){
|
988 |
+
var percent;
|
989 |
+
|
990 |
+
if (settings.get('retinaImage') && window.devicePixelRatio > 1) {
|
991 |
+
photo.height = photo.height / window.devicePixelRatio;
|
992 |
+
photo.width = photo.width / window.devicePixelRatio;
|
993 |
+
}
|
994 |
+
|
995 |
+
if (settings.get('scalePhotos')) {
|
996 |
+
setResize = function () {
|
997 |
+
photo.height -= photo.height * percent;
|
998 |
+
photo.width -= photo.width * percent;
|
999 |
+
};
|
1000 |
+
if (settings.mw && photo.width > settings.mw) {
|
1001 |
+
percent = (photo.width - settings.mw) / photo.width;
|
1002 |
+
setResize();
|
1003 |
+
}
|
1004 |
+
if (settings.mh && photo.height > settings.mh) {
|
1005 |
+
percent = (photo.height - settings.mh) / photo.height;
|
1006 |
+
setResize();
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
if (settings.h) {
|
1011 |
+
photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
if ($related[1] && (settings.get('loop') || $related[index + 1])) {
|
1015 |
+
photo.style.cursor = 'pointer';
|
1016 |
+
|
1017 |
+
$(photo).bind('click.'+prefix, function () {
|
1018 |
+
publicMethod.next();
|
1019 |
+
});
|
1020 |
+
}
|
1021 |
+
|
1022 |
+
photo.style.width = photo.width + 'px';
|
1023 |
+
photo.style.height = photo.height + 'px';
|
1024 |
+
prep(photo);
|
1025 |
+
}, 1);
|
1026 |
+
});
|
1027 |
+
|
1028 |
+
photo.src = href;
|
1029 |
+
|
1030 |
+
} else if (href) {
|
1031 |
+
$loadingBay.load(href, settings.get('data'), function (data, status) {
|
1032 |
+
if (request === requests) {
|
1033 |
+
prep(status === 'error' ? $tag(div, 'Error').html(settings.get('xhrError')) : $(this).contents());
|
1034 |
+
}
|
1035 |
+
});
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
// Navigates to the next page/image in a set.
|
1040 |
+
publicMethod.next = function () {
|
1041 |
+
if (!active && $related[1] && (settings.get('loop') || $related[index + 1])) {
|
1042 |
+
index = getIndex(1);
|
1043 |
+
launch($related[index]);
|
1044 |
+
}
|
1045 |
+
};
|
1046 |
+
|
1047 |
+
publicMethod.prev = function () {
|
1048 |
+
if (!active && $related[1] && (settings.get('loop') || index)) {
|
1049 |
+
index = getIndex(-1);
|
1050 |
+
launch($related[index]);
|
1051 |
+
}
|
1052 |
+
};
|
1053 |
+
|
1054 |
+
// Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
|
1055 |
+
publicMethod.close = function () {
|
1056 |
+
if (open && !closing) {
|
1057 |
+
|
1058 |
+
closing = true;
|
1059 |
+
open = false;
|
1060 |
+
trigger(event_cleanup);
|
1061 |
+
settings.get('onCleanup');
|
1062 |
+
$window.unbind('.' + prefix);
|
1063 |
+
$overlay.fadeTo(settings.get('fadeOut') || 0, 0);
|
1064 |
+
|
1065 |
+
$box.stop().fadeTo(settings.get('fadeOut') || 0, 0, function () {
|
1066 |
+
$box.hide();
|
1067 |
+
$overlay.hide();
|
1068 |
+
trigger(event_purge);
|
1069 |
+
$loaded.remove();
|
1070 |
+
|
1071 |
+
setTimeout(function () {
|
1072 |
+
closing = false;
|
1073 |
+
trigger(event_closed);
|
1074 |
+
settings.get('onClosed');
|
1075 |
+
}, 1);
|
1076 |
+
});
|
1077 |
+
}
|
1078 |
+
};
|
1079 |
+
|
1080 |
+
// Removes changes Colorbox made to the document, but does not remove the plugin.
|
1081 |
+
publicMethod.remove = function () {
|
1082 |
+
if (!$box) { return; }
|
1083 |
+
|
1084 |
+
$box.stop();
|
1085 |
+
$[colorbox].close();
|
1086 |
+
$box.stop(false, true).remove();
|
1087 |
+
$overlay.remove();
|
1088 |
+
closing = false;
|
1089 |
+
$box = null;
|
1090 |
+
$('.' + boxElement)
|
1091 |
+
.removeData(colorbox)
|
1092 |
+
.removeClass(boxElement);
|
1093 |
+
|
1094 |
+
$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);
|
1095 |
+
};
|
1096 |
+
|
1097 |
+
// A method for fetching the current element Colorbox is referencing.
|
1098 |
+
// returns a jQuery object.
|
1099 |
+
publicMethod.element = function () {
|
1100 |
+
return $(settings.el);
|
1101 |
+
};
|
1102 |
+
|
1103 |
+
publicMethod.settings = defaults;
|
1104 |
+
|
1105 |
}(jQuery, document, window));
|
plugin-fw/assets/js/jquery.colorbox.min.js
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
/*
|
2 |
-
Colorbox 1.6.3
|
3 |
-
license: MIT
|
4 |
-
http://www.jacklmoore.com/colorbox
|
5 |
-
*/
|
6 |
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,h,g){b instanceof String&&(b=String(b));for(var d=b.length,r=0;r<d;r++){var C=b[r];if(h.call(g,C,r,b))return{i:r,v:C}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,h,g){b!=Array.prototype&&b!=Object.prototype&&(b[h]=g.value)};
|
7 |
-
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,h,g,d){if(h){g=$jscomp.global;b=b.split(".");for(d=0;d<b.length-1;d++){var r=b[d];r in g||(g[r]={});g=g[r]}b=b[b.length-1];d=g[b];h=h(d);h!=d&&null!=h&&$jscomp.defineProperty(g,b,{configurable:!0,writable:!0,value:h})}};
|
8 |
-
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,g){return $jscomp.findInternal(this,b,g).v}},"es6","es3");
|
9 |
-
(function(b,h,g){function d(a,f,H){a=h.createElement(a);f&&(a.id="cbox"+f);H&&(a.style.cssText=H);return b(a)}function r(){return g.innerHeight?g.innerHeight:b(g).height()}function C(a,f){f!==Object(f)&&(f={});this.cache={};this.el=a;this.value=function(a){if(void 0===this.cache[a]){var c=b(this.el).attr("data-cbox-"+a);void 0!==c?this.cache[a]=c:void 0!==f[a]?this.cache[a]=f[a]:void 0!==S[a]&&(this.cache[a]=S[a])}return this.cache[a]};this.get=function(a){a=this.value(a);return b.isFunction(a)?a.call(this.el,
|
10 |
-
this):a}}function O(a){var c=n.length;a=(p+a)%c;return 0>a?c+a:a}function q(a,b){return Math.round((/%/.test(a)?("x"===b?x.width():r())/100:1)*parseInt(a,10))}function ca(a,b){return a.get("photo")||a.get("photoRegex").test(b)}function da(a,b){return a.get("retinaUrl")&&1<g.devicePixelRatio?b.replace(a.get("photoRegex"),a.get("retinaSuffix")):b}function ea(a){"contains"in k[0]&&!k[0].contains(a.target)&&a.target!==y[0]&&(a.stopPropagation(),k.focus())}function I(a){I.str!==a&&(k.add(y).removeClass(I.str).addClass(a),
|
11 |
-
I.str=a)}function ja(c){p=0;c&&!1!==c&&"nofollow"!==c?(n=b(".cboxElement").filter(function(){var a=b.data(this,"colorbox");return(new C(this,a)).get("rel")===c}),p=n.index(a.el),-1===p&&(n=n.add(a.el),p=n.length-1)):n=b(a.el)}function E(a){b(h).trigger(a);t.triggerHandler(a)}function P(c){if(!J){var f=b(c).data("colorbox");a=new C(c,f);ja(a.get("rel"));if(!z){z=K=!0;I(a.get("className"));k.css({visibility:"hidden",display:"block",opacity:""});l=d("div","LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden");
|
12 |
-
u.css({width:"",height:""}).append(l);v=T.height()+U.height()+u.outerHeight(!0)-u.height();w=V.width()+W.width()+u.outerWidth(!0)-u.width();A=l.outerHeight(!0);B=l.outerWidth(!0);c=q(a.get("initialWidth"),"x");f=q(a.get("initialHeight"),"y");var H=a.get("maxWidth"),e=a.get("maxHeight");a.w=Math.max((!1!==H?Math.min(c,q(H,"x")):c)-B-w,0);a.h=Math.max((!1!==e?Math.min(f,q(e,"y")):f)-A-v,0);l.css({width:"",height:a.h});m.position();E("cbox_open");a.get("onOpen");X.add(Y).hide();k.focus();a.get("trapFocus")&&
|
13 |
-
h.addEventListener&&(h.addEventListener("focus",ea,!0),t.one("cbox_closed",function(){h.removeEventListener("focus",ea,!0)}));if(a.get("returnFocus"))t.one("cbox_closed",function(){b(a.el).focus()})}c=parseFloat(a.get("opacity"));y.css({opacity:c===c?c:"",cursor:a.get("overlayClose")?"pointer":"",visibility:"visible"}).show();a.get("closeButton")?Q.html(a.get("close")).appendTo(u):Q.appendTo("<div/>");ka()}}function fa(){k||(Z=!1,x=b(g),k=d("div").attr({id:"colorbox","class":!1===b.support.opacity?
|
14 |
-
"cboxIE":"",role:"dialog",tabindex:"-1"}).hide(),y=d("div","Overlay").hide(),R=b([d("div","LoadingOverlay")[0],d("div","LoadingGraphic")[0]]),F=d("div","Wrapper"),u=d("div","Content").append(Y=d("div","Title"),aa=d("div","Current"),L=b('<button type="button"/>').attr({id:"cboxPrevious"}),M=b('<button type="button"/>').attr({id:"cboxNext"}),G=d("button","Slideshow"),R),Q=b('<button type="button"/>').attr({id:"cboxClose"}),F.append(d("div").append(d("div","TopLeft"),T=d("div","TopCenter"),d("div","TopRight")),
|
15 |
-
d("div",!1,"clear:left").append(V=d("div","MiddleLeft"),u,W=d("div","MiddleRight")),d("div",!1,"clear:left").append(d("div","BottomLeft"),U=d("div","BottomCenter"),d("div","BottomRight"))).find("div div").css({"float":"left"}),N=d("div",!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),X=M.add(L).add(aa).add(G));h.body&&!k.parent().length&&b(h.body).append(y,k.append(F,N))}function la(){function c(a){1<a.which||a.shiftKey||a.altKey||a.metaKey||a.ctrlKey||(a.preventDefault(),
|
16 |
-
P(this))}if(k){if(!Z)if(Z=!0,M.click(function(){m.next()}),L.click(function(){m.prev()}),Q.click(function(){m.close()}),y.click(function(){a.get("overlayClose")&&m.close()}),b(h).bind("keydown.cbox",function(b){var c=b.keyCode;z&&a.get("escKey")&&27===c&&(b.preventDefault(),m.close());z&&a.get("arrowKey")&&n[1]&&!b.altKey&&(37===c?(b.preventDefault(),L.click()):39===c&&(b.preventDefault(),M.click()))}),b.isFunction(b.fn.on))b(h).on("click.cbox",".cboxElement",c);else b(".cboxElement").live("click.cbox",
|
17 |
-
c);return!0}return!1}function ka(){var c,f=m.prep,k=++ba;K=!0;e=!1;E("cbox_purge");E("cbox_load");a.get("onLoad");a.h=a.get("height")?q(a.get("height"),"y")-A-v:a.get("innerHeight")&&q(a.get("innerHeight"),"y");a.w=a.get("width")?q(a.get("width"),"x")-B-w:a.get("innerWidth")&&q(a.get("innerWidth"),"x");a.mw=a.w;a.mh=a.h;a.get("maxWidth")&&(a.mw=q(a.get("maxWidth"),"x")-B-w,a.mw=a.w&&a.w<a.mw?a.w:a.mw);a.get("maxHeight")&&(a.mh=q(a.get("maxHeight"),"y")-A-v,a.mh=a.h&&a.h<a.mh?a.h:a.mh);var D=a.get("href");
|
18 |
-
ha=setTimeout(function(){R.show()},100);if(a.get("inline")){var h=b(D);var l=b("<div>").hide().insertBefore(h);t.one("cbox_purge",function(){l.replaceWith(h)});f(h)}else a.get("iframe")?f(" "):a.get("html")?f(a.get("html")):ca(a,D)?(D=da(a,D),e=a.get("createImg"),b(e).addClass("cboxPhoto").bind("error.cbox",function(){f(d("div","Error").html(a.get("imgError")))}).one("load",function(){k===ba&&setTimeout(function(){a.get("retinaImage")&&1<g.devicePixelRatio&&(e.height/=g.devicePixelRatio,e.width/=
|
19 |
-
g.devicePixelRatio);if(a.get("scalePhotos")){c=function(){e.height-=e.height*d;e.width-=e.width*d};if(a.mw&&e.width>a.mw){var d=(e.width-a.mw)/e.width;c()}a.mh&&e.height>a.mh&&(d=(e.height-a.mh)/e.height,c())}a.h&&(e.style.marginTop=Math.max(a.mh-e.height,0)/2+"px");n[1]&&(a.get("loop")||n[p+1])&&(e.style.cursor="pointer",b(e).bind("click.cbox",function(){m.next()}));e.style.width=e.width+"px";e.style.height=e.height+"px";f(e)},1)}),e.src=D):D&&N.load(D,a.get("data"),function(c,e){k===ba&&f("error"===
|
20 |
-
e?d("div","Error").html(a.get("xhrError")):b(this).contents())})}var S={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,
|
21 |
-
slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return b(this).attr("href")},
|
22 |
-
title:function(){return this.title},createImg:function(){var a=new Image,f=b(this).data("cbox-img-attrs");"object"===typeof f&&b.each(f,function(b,c){a[b]=c});return a},createIframe:function(){var a=h.createElement("iframe"),f=b(this).data("cbox-iframe-attrs");"object"===typeof f&&b.each(f,function(b,c){a[b]=c});"frameBorder"in a&&(a.frameBorder=0);"allowTransparency"in a&&(a.allowTransparency="true");a.name=(new Date).getTime();a.allowFullscreen=!0;return a}},y,k,F,u,T,V,W,U,n,x,l,N,R,Y,aa,G,M,L,
|
23 |
-
Q,X,t=b("<a/>"),a,v,w,A,B,p,e,z,K,J,ha,ba=0,ia={},Z,ma=function(){function b(){clearTimeout(l)}function f(){if(a.get("loop")||n[p+1])b(),l=setTimeout(m.next,a.get("slideshowSpeed"))}function d(){G.html(a.get("slideshowStop")).unbind("click.cbox").one("click.cbox",e);t.bind("cbox_complete",f).bind("cbox_load",b);k.removeClass("cboxSlideshow_off").addClass("cboxSlideshow_on")}function e(){b();t.unbind("cbox_complete",f).unbind("cbox_load",b);G.html(a.get("slideshowStart")).unbind("click.cbox").one("click.cbox",
|
24 |
-
function(){m.next();d()});k.removeClass("cboxSlideshow_on").addClass("cboxSlideshow_off")}function h(){g=!1;G.hide();b();t.unbind("cbox_complete",f).unbind("cbox_load",b);k.removeClass("cboxSlideshow_off cboxSlideshow_on")}var g,l;return function(){g?a.get("slideshow")||(t.unbind("cbox_cleanup",h),h()):a.get("slideshow")&&n[1]&&(g=!0,t.one("cbox_cleanup",h),a.get("slideshowAuto")?d():e(),G.show())}}();if(!b.colorbox){b(fa);var m=b.fn.colorbox=b.colorbox=function(a,f){var c=this;a=a||{};b.isFunction(c)&&
|
25 |
-
(c=b("<a/>"),a.open=!0);if(!c[0])return c;fa();la()&&(f&&(a.onComplete=f),c.each(function(){var c=b.data(this,"colorbox")||{};b.data(this,"colorbox",b.extend(c,a))}).addClass("cboxElement"),f=new C(c[0],a),f.get("open")&&P(c[0]));return c};m.position=function(c,f){function d(){T[0].style.width=U[0].style.width=u[0].style.width=parseInt(k[0].style.width,10)-w+"px";u[0].style.height=V[0].style.height=W[0].style.height=parseInt(k[0].style.height,10)-v+"px"}var e=0,h=0,g=k.offset();x.unbind("resize.cbox");
|
26 |
-
k.css({top:-9E4,left:-9E4});var l=x.scrollTop();var n=x.scrollLeft();a.get("fixed")?(g.top-=l,g.left-=n,k.css({position:"fixed"})):(e=l,h=n,k.css({position:"absolute"}));h=!1!==a.get("right")?h+Math.max(x.width()-a.w-B-w-q(a.get("right"),"x"),0):!1!==a.get("left")?h+q(a.get("left"),"x"):h+Math.round(Math.max(x.width()-a.w-B-w,0)/2);e=!1!==a.get("bottom")?e+Math.max(r()-a.h-A-v-q(a.get("bottom"),"y"),0):!1!==a.get("top")?e+q(a.get("top"),"y"):e+Math.round(Math.max(r()-a.h-A-v,0)/2);k.css({top:g.top,
|
27 |
-
left:g.left,visibility:"visible"});F[0].style.width=F[0].style.height="9999px";var p={width:a.w+B+w,height:a.h+A+v,top:e,left:h};if(c){var t=0;b.each(p,function(a){p[a]!==ia[a]&&(t=c)});c=t}ia=p;c||k.css(p);k.dequeue().animate(p,{duration:c||0,complete:function(){d();K=!1;F[0].style.width=a.w+B+w+"px";F[0].style.height=a.h+A+v+"px";a.get("reposition")&&setTimeout(function(){x.bind("resize.cbox",m.position)},1);b.isFunction(f)&&f()},step:d})};m.resize=function(b){if(z){b=b||{};b.width&&(a.w=q(b.width,
|
28 |
-
"x")-B-w);b.innerWidth&&(a.w=q(b.innerWidth,"x"));l.css({width:a.w});b.height&&(a.h=q(b.height,"y")-A-v);b.innerHeight&&(a.h=q(b.innerHeight,"y"));if(!b.innerHeight&&!b.height){var c=l.scrollTop();l.css({height:"auto"});a.h=l.height()}l.css({height:a.h});c&&l.scrollTop(c);m.position("none"===a.get("transition")?0:a.get("speed"))}};m.prep=function(c){if(z){var f="none"===a.get("transition")?0:a.get("speed");l.remove();l=d("div","LoadedContent").append(c);l.hide().appendTo(N.show()).css({width:function(){a.w=
|
29 |
-
a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.get("scrolling")?"auto":"hidden"}).css({height:function(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(u);N.hide();b(e).css({"float":"none"});I(a.get("className"));var g=function(){function c(){!1===b.support.opacity&&k[0].style.removeAttribute("filter")}var d=n.length;if(z){var e=function(){clearTimeout(ha);R.hide();E("cbox_complete");a.get("onComplete")};Y.html(a.get("title")).show();l.show();1<d?("string"===
|
30 |
-
typeof a.get("current")&&aa.html(a.get("current").replace("{current}",p+1).replace("{total}",d)).show(),M[a.get("loop")||p<d-1?"show":"hide"]().html(a.get("next")),L[a.get("loop")||p?"show":"hide"]().html(a.get("previous")),ma(),a.get("preloading")&&b.each([O(-1),O(1)],function(){var a=n[this];var c=new C(a,b.data(a,"colorbox"));(a=c.get("href"))&&ca(c,a)&&(a=da(c,a),c=h.createElement("img"),c.src=a)})):X.hide();if(a.get("iframe")){var g=a.get("createIframe");a.get("scrolling")||(g.scrolling="no");
|
31 |
-
b(g).attr({src:a.get("href"),"class":"cboxIframe"}).one("load",e).appendTo(l);t.one("cbox_purge",function(){g.src="//about:blank"});a.get("fastIframe")&&b(g).trigger("load")}else e();"fade"===a.get("transition")?k.fadeTo(f,1,c):c()}};"fade"===a.get("transition")?k.fadeTo(f,0,function(){m.position(0,g)}):m.position(f,g)}};m.next=function(){!K&&n[1]&&(a.get("loop")||n[p+1])&&(p=O(1),P(n[p]))};m.prev=function(){!K&&n[1]&&(a.get("loop")||p)&&(p=O(-1),P(n[p]))};m.close=function(){z&&!J&&(J=!0,z=!1,E("cbox_cleanup"),
|
32 |
-
a.get("onCleanup"),x.unbind(".cbox"),y.fadeTo(a.get("fadeOut")||0,0),k.stop().fadeTo(a.get("fadeOut")||0,0,function(){k.hide();y.hide();E("cbox_purge");l.remove();setTimeout(function(){J=!1;E("cbox_closed");a.get("onClosed")},1)}))};m.remove=function(){k&&(k.stop(),b.colorbox.close(),k.stop(!1,!0).remove(),y.remove(),J=!1,k=null,b(".cboxElement").removeData("colorbox").removeClass("cboxElement"),b(h).unbind("click.cbox").unbind("keydown.cbox"))};m.element=function(){return b(a.el)};m.settings=S}})(jQuery,
|
33 |
-
document,window);
|
1 |
+
/*
|
2 |
+
Colorbox 1.6.3
|
3 |
+
license: MIT
|
4 |
+
http://www.jacklmoore.com/colorbox
|
5 |
+
*/
|
6 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,h,g){b instanceof String&&(b=String(b));for(var d=b.length,r=0;r<d;r++){var C=b[r];if(h.call(g,C,r,b))return{i:r,v:C}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,h,g){b!=Array.prototype&&b!=Object.prototype&&(b[h]=g.value)};
|
7 |
+
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,h,g,d){if(h){g=$jscomp.global;b=b.split(".");for(d=0;d<b.length-1;d++){var r=b[d];r in g||(g[r]={});g=g[r]}b=b[b.length-1];d=g[b];h=h(d);h!=d&&null!=h&&$jscomp.defineProperty(g,b,{configurable:!0,writable:!0,value:h})}};
|
8 |
+
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,g){return $jscomp.findInternal(this,b,g).v}},"es6","es3");
|
9 |
+
(function(b,h,g){function d(a,f,H){a=h.createElement(a);f&&(a.id="cbox"+f);H&&(a.style.cssText=H);return b(a)}function r(){return g.innerHeight?g.innerHeight:b(g).height()}function C(a,f){f!==Object(f)&&(f={});this.cache={};this.el=a;this.value=function(a){if(void 0===this.cache[a]){var c=b(this.el).attr("data-cbox-"+a);void 0!==c?this.cache[a]=c:void 0!==f[a]?this.cache[a]=f[a]:void 0!==S[a]&&(this.cache[a]=S[a])}return this.cache[a]};this.get=function(a){a=this.value(a);return b.isFunction(a)?a.call(this.el,
|
10 |
+
this):a}}function O(a){var c=n.length;a=(p+a)%c;return 0>a?c+a:a}function q(a,b){return Math.round((/%/.test(a)?("x"===b?x.width():r())/100:1)*parseInt(a,10))}function ca(a,b){return a.get("photo")||a.get("photoRegex").test(b)}function da(a,b){return a.get("retinaUrl")&&1<g.devicePixelRatio?b.replace(a.get("photoRegex"),a.get("retinaSuffix")):b}function ea(a){"contains"in k[0]&&!k[0].contains(a.target)&&a.target!==y[0]&&(a.stopPropagation(),k.focus())}function I(a){I.str!==a&&(k.add(y).removeClass(I.str).addClass(a),
|
11 |
+
I.str=a)}function ja(c){p=0;c&&!1!==c&&"nofollow"!==c?(n=b(".cboxElement").filter(function(){var a=b.data(this,"colorbox");return(new C(this,a)).get("rel")===c}),p=n.index(a.el),-1===p&&(n=n.add(a.el),p=n.length-1)):n=b(a.el)}function E(a){b(h).trigger(a);t.triggerHandler(a)}function P(c){if(!J){var f=b(c).data("colorbox");a=new C(c,f);ja(a.get("rel"));if(!z){z=K=!0;I(a.get("className"));k.css({visibility:"hidden",display:"block",opacity:""});l=d("div","LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden");
|
12 |
+
u.css({width:"",height:""}).append(l);v=T.height()+U.height()+u.outerHeight(!0)-u.height();w=V.width()+W.width()+u.outerWidth(!0)-u.width();A=l.outerHeight(!0);B=l.outerWidth(!0);c=q(a.get("initialWidth"),"x");f=q(a.get("initialHeight"),"y");var H=a.get("maxWidth"),e=a.get("maxHeight");a.w=Math.max((!1!==H?Math.min(c,q(H,"x")):c)-B-w,0);a.h=Math.max((!1!==e?Math.min(f,q(e,"y")):f)-A-v,0);l.css({width:"",height:a.h});m.position();E("cbox_open");a.get("onOpen");X.add(Y).hide();k.focus();a.get("trapFocus")&&
|
13 |
+
h.addEventListener&&(h.addEventListener("focus",ea,!0),t.one("cbox_closed",function(){h.removeEventListener("focus",ea,!0)}));if(a.get("returnFocus"))t.one("cbox_closed",function(){b(a.el).focus()})}c=parseFloat(a.get("opacity"));y.css({opacity:c===c?c:"",cursor:a.get("overlayClose")?"pointer":"",visibility:"visible"}).show();a.get("closeButton")?Q.html(a.get("close")).appendTo(u):Q.appendTo("<div/>");ka()}}function fa(){k||(Z=!1,x=b(g),k=d("div").attr({id:"colorbox","class":!1===b.support.opacity?
|
14 |
+
"cboxIE":"",role:"dialog",tabindex:"-1"}).hide(),y=d("div","Overlay").hide(),R=b([d("div","LoadingOverlay")[0],d("div","LoadingGraphic")[0]]),F=d("div","Wrapper"),u=d("div","Content").append(Y=d("div","Title"),aa=d("div","Current"),L=b('<button type="button"/>').attr({id:"cboxPrevious"}),M=b('<button type="button"/>').attr({id:"cboxNext"}),G=d("button","Slideshow"),R),Q=b('<button type="button"/>').attr({id:"cboxClose"}),F.append(d("div").append(d("div","TopLeft"),T=d("div","TopCenter"),d("div","TopRight")),
|
15 |
+
d("div",!1,"clear:left").append(V=d("div","MiddleLeft"),u,W=d("div","MiddleRight")),d("div",!1,"clear:left").append(d("div","BottomLeft"),U=d("div","BottomCenter"),d("div","BottomRight"))).find("div div").css({"float":"left"}),N=d("div",!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),X=M.add(L).add(aa).add(G));h.body&&!k.parent().length&&b(h.body).append(y,k.append(F,N))}function la(){function c(a){1<a.which||a.shiftKey||a.altKey||a.metaKey||a.ctrlKey||(a.preventDefault(),
|
16 |
+
P(this))}if(k){if(!Z)if(Z=!0,M.click(function(){m.next()}),L.click(function(){m.prev()}),Q.click(function(){m.close()}),y.click(function(){a.get("overlayClose")&&m.close()}),b(h).bind("keydown.cbox",function(b){var c=b.keyCode;z&&a.get("escKey")&&27===c&&(b.preventDefault(),m.close());z&&a.get("arrowKey")&&n[1]&&!b.altKey&&(37===c?(b.preventDefault(),L.click()):39===c&&(b.preventDefault(),M.click()))}),b.isFunction(b.fn.on))b(h).on("click.cbox",".cboxElement",c);else b(".cboxElement").live("click.cbox",
|
17 |
+
c);return!0}return!1}function ka(){var c,f=m.prep,k=++ba;K=!0;e=!1;E("cbox_purge");E("cbox_load");a.get("onLoad");a.h=a.get("height")?q(a.get("height"),"y")-A-v:a.get("innerHeight")&&q(a.get("innerHeight"),"y");a.w=a.get("width")?q(a.get("width"),"x")-B-w:a.get("innerWidth")&&q(a.get("innerWidth"),"x");a.mw=a.w;a.mh=a.h;a.get("maxWidth")&&(a.mw=q(a.get("maxWidth"),"x")-B-w,a.mw=a.w&&a.w<a.mw?a.w:a.mw);a.get("maxHeight")&&(a.mh=q(a.get("maxHeight"),"y")-A-v,a.mh=a.h&&a.h<a.mh?a.h:a.mh);var D=a.get("href");
|
18 |
+
ha=setTimeout(function(){R.show()},100);if(a.get("inline")){var h=b(D);var l=b("<div>").hide().insertBefore(h);t.one("cbox_purge",function(){l.replaceWith(h)});f(h)}else a.get("iframe")?f(" "):a.get("html")?f(a.get("html")):ca(a,D)?(D=da(a,D),e=a.get("createImg"),b(e).addClass("cboxPhoto").bind("error.cbox",function(){f(d("div","Error").html(a.get("imgError")))}).one("load",function(){k===ba&&setTimeout(function(){a.get("retinaImage")&&1<g.devicePixelRatio&&(e.height/=g.devicePixelRatio,e.width/=
|
19 |
+
g.devicePixelRatio);if(a.get("scalePhotos")){c=function(){e.height-=e.height*d;e.width-=e.width*d};if(a.mw&&e.width>a.mw){var d=(e.width-a.mw)/e.width;c()}a.mh&&e.height>a.mh&&(d=(e.height-a.mh)/e.height,c())}a.h&&(e.style.marginTop=Math.max(a.mh-e.height,0)/2+"px");n[1]&&(a.get("loop")||n[p+1])&&(e.style.cursor="pointer",b(e).bind("click.cbox",function(){m.next()}));e.style.width=e.width+"px";e.style.height=e.height+"px";f(e)},1)}),e.src=D):D&&N.load(D,a.get("data"),function(c,e){k===ba&&f("error"===
|
20 |
+
e?d("div","Error").html(a.get("xhrError")):b(this).contents())})}var S={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,
|
21 |
+
slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,rel:function(){return this.rel},href:function(){return b(this).attr("href")},
|
22 |
+
title:function(){return this.title},createImg:function(){var a=new Image,f=b(this).data("cbox-img-attrs");"object"===typeof f&&b.each(f,function(b,c){a[b]=c});return a},createIframe:function(){var a=h.createElement("iframe"),f=b(this).data("cbox-iframe-attrs");"object"===typeof f&&b.each(f,function(b,c){a[b]=c});"frameBorder"in a&&(a.frameBorder=0);"allowTransparency"in a&&(a.allowTransparency="true");a.name=(new Date).getTime();a.allowFullscreen=!0;return a}},y,k,F,u,T,V,W,U,n,x,l,N,R,Y,aa,G,M,L,
|
23 |
+
Q,X,t=b("<a/>"),a,v,w,A,B,p,e,z,K,J,ha,ba=0,ia={},Z,ma=function(){function b(){clearTimeout(l)}function f(){if(a.get("loop")||n[p+1])b(),l=setTimeout(m.next,a.get("slideshowSpeed"))}function d(){G.html(a.get("slideshowStop")).unbind("click.cbox").one("click.cbox",e);t.bind("cbox_complete",f).bind("cbox_load",b);k.removeClass("cboxSlideshow_off").addClass("cboxSlideshow_on")}function e(){b();t.unbind("cbox_complete",f).unbind("cbox_load",b);G.html(a.get("slideshowStart")).unbind("click.cbox").one("click.cbox",
|
24 |
+
function(){m.next();d()});k.removeClass("cboxSlideshow_on").addClass("cboxSlideshow_off")}function h(){g=!1;G.hide();b();t.unbind("cbox_complete",f).unbind("cbox_load",b);k.removeClass("cboxSlideshow_off cboxSlideshow_on")}var g,l;return function(){g?a.get("slideshow")||(t.unbind("cbox_cleanup",h),h()):a.get("slideshow")&&n[1]&&(g=!0,t.one("cbox_cleanup",h),a.get("slideshowAuto")?d():e(),G.show())}}();if(!b.colorbox){b(fa);var m=b.fn.colorbox=b.colorbox=function(a,f){var c=this;a=a||{};b.isFunction(c)&&
|
25 |
+
(c=b("<a/>"),a.open=!0);if(!c[0])return c;fa();la()&&(f&&(a.onComplete=f),c.each(function(){var c=b.data(this,"colorbox")||{};b.data(this,"colorbox",b.extend(c,a))}).addClass("cboxElement"),f=new C(c[0],a),f.get("open")&&P(c[0]));return c};m.position=function(c,f){function d(){T[0].style.width=U[0].style.width=u[0].style.width=parseInt(k[0].style.width,10)-w+"px";u[0].style.height=V[0].style.height=W[0].style.height=parseInt(k[0].style.height,10)-v+"px"}var e=0,h=0,g=k.offset();x.unbind("resize.cbox");
|
26 |
+
k.css({top:-9E4,left:-9E4});var l=x.scrollTop();var n=x.scrollLeft();a.get("fixed")?(g.top-=l,g.left-=n,k.css({position:"fixed"})):(e=l,h=n,k.css({position:"absolute"}));h=!1!==a.get("right")?h+Math.max(x.width()-a.w-B-w-q(a.get("right"),"x"),0):!1!==a.get("left")?h+q(a.get("left"),"x"):h+Math.round(Math.max(x.width()-a.w-B-w,0)/2);e=!1!==a.get("bottom")?e+Math.max(r()-a.h-A-v-q(a.get("bottom"),"y"),0):!1!==a.get("top")?e+q(a.get("top"),"y"):e+Math.round(Math.max(r()-a.h-A-v,0)/2);k.css({top:g.top,
|
27 |
+
left:g.left,visibility:"visible"});F[0].style.width=F[0].style.height="9999px";var p={width:a.w+B+w,height:a.h+A+v,top:e,left:h};if(c){var t=0;b.each(p,function(a){p[a]!==ia[a]&&(t=c)});c=t}ia=p;c||k.css(p);k.dequeue().animate(p,{duration:c||0,complete:function(){d();K=!1;F[0].style.width=a.w+B+w+"px";F[0].style.height=a.h+A+v+"px";a.get("reposition")&&setTimeout(function(){x.bind("resize.cbox",m.position)},1);b.isFunction(f)&&f()},step:d})};m.resize=function(b){if(z){b=b||{};b.width&&(a.w=q(b.width,
|
28 |
+
"x")-B-w);b.innerWidth&&(a.w=q(b.innerWidth,"x"));l.css({width:a.w});b.height&&(a.h=q(b.height,"y")-A-v);b.innerHeight&&(a.h=q(b.innerHeight,"y"));if(!b.innerHeight&&!b.height){var c=l.scrollTop();l.css({height:"auto"});a.h=l.height()}l.css({height:a.h});c&&l.scrollTop(c);m.position("none"===a.get("transition")?0:a.get("speed"))}};m.prep=function(c){if(z){var f="none"===a.get("transition")?0:a.get("speed");l.remove();l=d("div","LoadedContent").append(c);l.hide().appendTo(N.show()).css({width:function(){a.w=
|
29 |
+
a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.get("scrolling")?"auto":"hidden"}).css({height:function(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(u);N.hide();b(e).css({"float":"none"});I(a.get("className"));var g=function(){function c(){!1===b.support.opacity&&k[0].style.removeAttribute("filter")}var d=n.length;if(z){var e=function(){clearTimeout(ha);R.hide();E("cbox_complete");a.get("onComplete")};Y.html(a.get("title")).show();l.show();1<d?("string"===
|
30 |
+
typeof a.get("current")&&aa.html(a.get("current").replace("{current}",p+1).replace("{total}",d)).show(),M[a.get("loop")||p<d-1?"show":"hide"]().html(a.get("next")),L[a.get("loop")||p?"show":"hide"]().html(a.get("previous")),ma(),a.get("preloading")&&b.each([O(-1),O(1)],function(){var a=n[this];var c=new C(a,b.data(a,"colorbox"));(a=c.get("href"))&&ca(c,a)&&(a=da(c,a),c=h.createElement("img"),c.src=a)})):X.hide();if(a.get("iframe")){var g=a.get("createIframe");a.get("scrolling")||(g.scrolling="no");
|
31 |
+
b(g).attr({src:a.get("href"),"class":"cboxIframe"}).one("load",e).appendTo(l);t.one("cbox_purge",function(){g.src="//about:blank"});a.get("fastIframe")&&b(g).trigger("load")}else e();"fade"===a.get("transition")?k.fadeTo(f,1,c):c()}};"fade"===a.get("transition")?k.fadeTo(f,0,function(){m.position(0,g)}):m.position(f,g)}};m.next=function(){!K&&n[1]&&(a.get("loop")||n[p+1])&&(p=O(1),P(n[p]))};m.prev=function(){!K&&n[1]&&(a.get("loop")||p)&&(p=O(-1),P(n[p]))};m.close=function(){z&&!J&&(J=!0,z=!1,E("cbox_cleanup"),
|
32 |
+
a.get("onCleanup"),x.unbind(".cbox"),y.fadeTo(a.get("fadeOut")||0,0),k.stop().fadeTo(a.get("fadeOut")||0,0,function(){k.hide();y.hide();E("cbox_purge");l.remove();setTimeout(function(){J=!1;E("cbox_closed");a.get("onClosed")},1)}))};m.remove=function(){k&&(k.stop(),b.colorbox.close(),k.stop(!1,!0).remove(),y.remove(),J=!1,k=null,b(".cboxElement").removeData("colorbox").removeClass("cboxElement"),b(h).unbind("click.cbox").unbind("keydown.cbox"))};m.element=function(){return b(a.el)};m.settings=S}})(jQuery,
|
33 |
+
document,window);
|
plugin-fw/assets/js/metabox.js
CHANGED
@@ -1,138 +1,138 @@
|
|
1 |
-
/**
|
2 |
-
* This file belongs to the YIT 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 |
-
(function ($) {
|
10 |
-
|
11 |
-
$('.metaboxes-tab').each(function () {
|
12 |
-
$('.tabs-panel', this).hide();
|
13 |
-
|
14 |
-
var active_tab = wpCookies.get('active_metabox_tab');
|
15 |
-
if (active_tab == null) {
|
16 |
-
active_tab = $('ul.metaboxes-tabs li:first-child a', this).attr('href');
|
17 |
-
} else {
|
18 |
-
active_tab = '#' + active_tab;
|
19 |
-
}
|
20 |
-
|
21 |
-
$(active_tab).show();
|
22 |
-
|
23 |
-
$('.metaboxes-tabs a', this).click(function (e) {
|
24 |
-
if ($(this).parent().hasClass('tabs')) {
|
25 |
-
e.preventDefault();
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
|
29 |
-
var t = $(this).attr('href');
|
30 |
-
$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
|
31 |
-
$(this).closest('.metaboxes-tab').find('.tabs-panel').hide();
|
32 |
-
$(t).show();
|
33 |
-
|
34 |
-
return false;
|
35 |
-
});
|
36 |
-
});
|
37 |
-
|
38 |
-
var act_page_option = $('#_active_page_options-container').parent().html();
|
39 |
-
$('#_active_page_options-container').parent().remove();
|
40 |
-
$(act_page_option).insertAfter('#yit-post-setting .handlediv');
|
41 |
-
$(act_page_option).insertAfter('#yit-page-setting .handlediv');
|
42 |
-
|
43 |
-
|
44 |
-
$('#_active_page_options-container').on('click', function(){
|
45 |
-
if( $('#_active_page_options').is(":checked") ){
|
46 |
-
$('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 1 , 'pointer-events' : 'auto' } );
|
47 |
-
}else{
|
48 |
-
$('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 0.5 , 'pointer-events' : 'none' } );
|
49 |
-
}
|
50 |
-
}).click();
|
51 |
-
|
52 |
-
|
53 |
-
//dependencies handler
|
54 |
-
$('.metaboxes-tab [data-dep-target]').each(function(){
|
55 |
-
var t = $(this);
|
56 |
-
|
57 |
-
var field = '#' + t.data('dep-target'),
|
58 |
-
dep = '#' + t.data('dep-id'),
|
59 |
-
value = t.data('dep-value'),
|
60 |
-
type = t.data('dep-type');
|
61 |
-
|
62 |
-
|
63 |
-
dependencies_handler( field, dep, value.toString(), type );
|
64 |
-
|
65 |
-
$(dep).on('change', function(){
|
66 |
-
dependencies_handler( field, dep, value.toString(), type );
|
67 |
-
}).change();
|
68 |
-
});
|
69 |
-
|
70 |
-
//Handle dependencies.
|
71 |
-
function dependencies_handler ( id, deps, values, type ) {
|
72 |
-
var result = true;
|
73 |
-
|
74 |
-
|
75 |
-
//Single dependency
|
76 |
-
if( typeof( deps ) == 'string' ) {
|
77 |
-
if( deps.substr( 0, 6 ) == ':radio' )
|
78 |
-
{deps = deps + ':checked'; }
|
79 |
-
|
80 |
-
var val = $( deps ).val();
|
81 |
-
|
82 |
-
if( $(deps).attr('type') == 'checkbox'){
|
83 |
-
var thisCheck = $(deps);
|
84 |
-
if ( thisCheck.is ( ':checked' ) ) {
|
85 |
-
val = 'yes';
|
86 |
-
}
|
87 |
-
else {
|
88 |
-
val = 'no';
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
values = values.split( ',' );
|
93 |
-
|
94 |
-
for( var i = 0; i < values.length; i++ ) {
|
95 |
-
if( val != values[i] )
|
96 |
-
{ result = false; }
|
97 |
-
else
|
98 |
-
{ result = true; break; }
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
var $current_field = $( id ),
|
103 |
-
$current_container = $( id + '-container' ).parent();
|
104 |
-
|
105 |
-
var types = type.split( '-' ), j;
|
106 |
-
for ( j in types ) {
|
107 |
-
var current_type = types[ j ];
|
108 |
-
|
109 |
-
if ( !result ) {
|
110 |
-
switch ( current_type ) {
|
111 |
-
case 'disable':
|
112 |
-
$current_container.addClass( 'yith-disabled' );
|
113 |
-
$current_field.attr( 'disabled', true );
|
114 |
-
break;
|
115 |
-
case 'hideme':
|
116 |
-
$current_field.hide();
|
117 |
-
break;
|
118 |
-
default:
|
119 |
-
$current_container.hide();
|
120 |
-
}
|
121 |
-
|
122 |
-
} else {
|
123 |
-
switch ( current_type ) {
|
124 |
-
case 'disable':
|
125 |
-
$current_container.removeClass( 'yith-disabled' );
|
126 |
-
$current_field.attr( 'disabled', false );
|
127 |
-
break;
|
128 |
-
case 'hideme':
|
129 |
-
$current_field.show();
|
130 |
-
break;
|
131 |
-
default:
|
132 |
-
$current_container.show();
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
})(jQuery);
|
1 |
+
/**
|
2 |
+
* This file belongs to the YIT 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 |
+
(function ($) {
|
10 |
+
|
11 |
+
$('.metaboxes-tab').each(function () {
|
12 |
+
$('.tabs-panel', this).hide();
|
13 |
+
|
14 |
+
var active_tab = wpCookies.get('active_metabox_tab');
|
15 |
+
if (active_tab == null) {
|
16 |
+
active_tab = $('ul.metaboxes-tabs li:first-child a', this).attr('href');
|
17 |
+
} else {
|
18 |
+
active_tab = '#' + active_tab;
|
19 |
+
}
|
20 |
+
|
21 |
+
$(active_tab).show();
|
22 |
+
|
23 |
+
$('.metaboxes-tabs a', this).click(function (e) {
|
24 |
+
if ($(this).parent().hasClass('tabs')) {
|
25 |
+
e.preventDefault();
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
var t = $(this).attr('href');
|
30 |
+
$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
|
31 |
+
$(this).closest('.metaboxes-tab').find('.tabs-panel').hide();
|
32 |
+
$(t).show();
|
33 |
+
|
34 |
+
return false;
|
35 |
+
});
|
36 |
+
});
|
37 |
+
|
38 |
+
var act_page_option = $('#_active_page_options-container').parent().html();
|
39 |
+
$('#_active_page_options-container').parent().remove();
|
40 |
+
$(act_page_option).insertAfter('#yit-post-setting .handlediv');
|
41 |
+
$(act_page_option).insertAfter('#yit-page-setting .handlediv');
|
42 |
+
|
43 |
+
|
44 |
+
$('#_active_page_options-container').on('click', function(){
|
45 |
+
if( $('#_active_page_options').is(":checked") ){
|
46 |
+
$('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 1 , 'pointer-events' : 'auto' } );
|
47 |
+
}else{
|
48 |
+
$('#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab').css( { 'opacity' : 0.5 , 'pointer-events' : 'none' } );
|
49 |
+
}
|
50 |
+
}).click();
|
51 |
+
|
52 |
+
|
53 |
+
//dependencies handler
|
54 |
+
$('.metaboxes-tab [data-dep-target]').each(function(){
|
55 |
+
var t = $(this);
|
56 |
+
|
57 |
+
var field = '#' + t.data('dep-target'),
|
58 |
+
dep = '#' + t.data('dep-id'),
|
59 |
+
value = t.data('dep-value'),
|
60 |
+
type = t.data('dep-type');
|
61 |
+
|
62 |
+
|
63 |
+
dependencies_handler( field, dep, value.toString(), type );
|
64 |
+
|
65 |
+
$(dep).on('change', function(){
|
66 |
+
dependencies_handler( field, dep, value.toString(), type );
|
67 |
+
}).change();
|
68 |
+
});
|
69 |
+
|
70 |
+
//Handle dependencies.
|
71 |
+
function dependencies_handler ( id, deps, values, type ) {
|
72 |
+
var result = true;
|
73 |
+
|
74 |
+
|
75 |
+
//Single dependency
|
76 |
+
if( typeof( deps ) == 'string' ) {
|
77 |
+
if( deps.substr( 0, 6 ) == ':radio' )
|
78 |
+
{deps = deps + ':checked'; }
|
79 |
+
|
80 |
+
var val = $( deps ).val();
|
81 |
+
|
82 |
+
if( $(deps).attr('type') == 'checkbox'){
|
83 |
+
var thisCheck = $(deps);
|
84 |
+
if ( thisCheck.is ( ':checked' ) ) {
|
85 |
+
val = 'yes';
|
86 |
+
}
|
87 |
+
else {
|
88 |
+
val = 'no';
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
values = values.split( ',' );
|
93 |
+
|
94 |
+
for( var i = 0; i < values.length; i++ ) {
|
95 |
+
if( val != values[i] )
|
96 |
+
{ result = false; }
|
97 |
+
else
|
98 |
+
{ result = true; break; }
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
var $current_field = $( id ),
|
103 |
+
$current_container = $( id + '-container' ).parent();
|
104 |
+
|
105 |
+
var types = type.split( '-' ), j;
|
106 |
+
for ( j in types ) {
|
107 |
+
var current_type = types[ j ];
|
108 |
+
|
109 |
+
if ( !result ) {
|
110 |
+
switch ( current_type ) {
|
111 |
+
case 'disable':
|
112 |
+
$current_container.addClass( 'yith-disabled' );
|
113 |
+
$current_field.attr( 'disabled', true );
|
114 |
+
break;
|
115 |
+
case 'hideme':
|
116 |
+
$current_field.hide();
|
117 |
+
break;
|
118 |
+
default:
|
119 |
+
$current_container.hide();
|
120 |
+
}
|
121 |
+
|
122 |
+
} else {
|
123 |
+
switch ( current_type ) {
|
124 |
+
case 'disable':
|
125 |
+
$current_container.removeClass( 'yith-disabled' );
|
126 |
+
$current_field.attr( 'disabled', false );
|
127 |
+
break;
|
128 |
+
case 'hideme':
|
129 |
+
$current_field.show();
|
130 |
+
break;
|
131 |
+
default:
|
132 |
+
$current_container.show();
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
})(jQuery);
|
plugin-fw/assets/js/metabox.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,c){a instanceof String&&(a=String(a));for(var b=a.length,d=0;d<b;d++){var f=a[d];if(e.call(c,f,d,a))return{i:d,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)};
|
2 |
-
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,c,b){if(e){c=$jscomp.global;a=a.split(".");for(b=0;b<a.length-1;b++){var d=a[b];d in c||(c[d]={});c=c[d]}a=a[a.length-1];b=c[a];e=e(b);e!=b&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
-
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
|
4 |
-
(function(a){function e(b,d,c,e){var f=!0;if("string"==typeof d){":radio"==d.substr(0,6)&&(d+=":checked");var g=a(d).val();"checkbox"==a(d).attr("type")&&(g=a(d).is(":checked")?"yes":"no");c=c.split(",");for(d=0;d<c.length;d++)if(g!=c[d])f=!1;else{f=!0;break}}c=a(b);b=a(b+"-container").parent();e=e.split("-");for(var h in e)if(g=e[h],f)switch(g){case "disable":b.removeClass("yith-disabled");c.attr("disabled",!1);break;case "hideme":c.show();break;default:b.show()}else switch(g){case "disable":b.addClass("yith-disabled");
|
5 |
-
c.attr("disabled",!0);break;case "hideme":c.hide();break;default:b.hide()}}a(".metaboxes-tab").each(function(){a(".tabs-panel",this).hide();var b=wpCookies.get("active_metabox_tab");b=null==b?a("ul.metaboxes-tabs li:first-child a",this).attr("href"):"#"+b;a(b).show();a(".metaboxes-tabs a",this).click(function(b){if(a(this).parent().hasClass("tabs"))b.preventDefault();else return b=a(this).attr("href"),a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),a(this).closest(".metaboxes-tab").find(".tabs-panel").hide(),
|
6 |
-
a(b).show(),!1})});var c=a("#_active_page_options-container").parent().html();a("#_active_page_options-container").parent().remove();a(c).insertAfter("#yit-post-setting .handlediv");a(c).insertAfter("#yit-page-setting .handlediv");a("#_active_page_options-container").on("click",function(){a("#_active_page_options").is(":checked")?a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:1,"pointer-events":"auto"}):a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:.5,
|
7 |
-
"pointer-events":"none"})}).click();a(".metaboxes-tab [data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),f="#"+b.data("dep-id"),h=b.data("dep-value"),k=b.data("dep-type");e(c,f,h.toString(),k);a(f).on("change",function(){e(c,f,h.toString(),k)}).change()})})(jQuery);
|
1 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,c){a instanceof String&&(a=String(a));for(var b=a.length,d=0;d<b;d++){var f=a[d];if(e.call(c,f,d,a))return{i:d,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)};
|
2 |
+
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,c,b){if(e){c=$jscomp.global;a=a.split(".");for(b=0;b<a.length-1;b++){var d=a[b];d in c||(c[d]={});c=c[d]}a=a[a.length-1];b=c[a];e=e(b);e!=b&&null!=e&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
+
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
|
4 |
+
(function(a){function e(b,d,c,e){var f=!0;if("string"==typeof d){":radio"==d.substr(0,6)&&(d+=":checked");var g=a(d).val();"checkbox"==a(d).attr("type")&&(g=a(d).is(":checked")?"yes":"no");c=c.split(",");for(d=0;d<c.length;d++)if(g!=c[d])f=!1;else{f=!0;break}}c=a(b);b=a(b+"-container").parent();e=e.split("-");for(var h in e)if(g=e[h],f)switch(g){case "disable":b.removeClass("yith-disabled");c.attr("disabled",!1);break;case "hideme":c.show();break;default:b.show()}else switch(g){case "disable":b.addClass("yith-disabled");
|
5 |
+
c.attr("disabled",!0);break;case "hideme":c.hide();break;default:b.hide()}}a(".metaboxes-tab").each(function(){a(".tabs-panel",this).hide();var b=wpCookies.get("active_metabox_tab");b=null==b?a("ul.metaboxes-tabs li:first-child a",this).attr("href"):"#"+b;a(b).show();a(".metaboxes-tabs a",this).click(function(b){if(a(this).parent().hasClass("tabs"))b.preventDefault();else return b=a(this).attr("href"),a(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),a(this).closest(".metaboxes-tab").find(".tabs-panel").hide(),
|
6 |
+
a(b).show(),!1})});var c=a("#_active_page_options-container").parent().html();a("#_active_page_options-container").parent().remove();a(c).insertAfter("#yit-post-setting .handlediv");a(c).insertAfter("#yit-page-setting .handlediv");a("#_active_page_options-container").on("click",function(){a("#_active_page_options").is(":checked")?a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:1,"pointer-events":"auto"}):a("#yit-page-setting .inside .metaboxes-tab, #yit-post-setting .inside .metaboxes-tab").css({opacity:.5,
|
7 |
+
"pointer-events":"none"})}).click();a(".metaboxes-tab [data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),f="#"+b.data("dep-id"),h=b.data("dep-value"),k=b.data("dep-type");e(c,f,h.toString(),k);a(f).on("change",function(){e(c,f,h.toString(),k)}).change()})})(jQuery);
|
plugin-fw/assets/js/multisite-updater.js
CHANGED
@@ -1,222 +1,222 @@
|
|
1 |
-
/**
|
2 |
-
* This file belongs to the YIT 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 |
-
(function ( $ ) {
|
10 |
-
|
11 |
-
var plugins_menu_item = $( '#menu-plugins' ),
|
12 |
-
update = plugins_menu_item.find( '.update-plugins' ),
|
13 |
-
count = update.find( ".update-count" ).text(),
|
14 |
-
registered = plugins.registered,
|
15 |
-
activated = plugins.activated;
|
16 |
-
|
17 |
-
if ( count == 0 || count == '' ) {
|
18 |
-
var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
|
19 |
-
count = 0;
|
20 |
-
plugins_menu_item.find( '.wp-menu-name' ).append( update_row );
|
21 |
-
}
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Add the plugin update rows for old plugins
|
25 |
-
*/
|
26 |
-
update_plugins_row( registered, activated, count, plugins );
|
27 |
-
|
28 |
-
/**
|
29 |
-
*
|
30 |
-
* Add the update plugin rows for old plugin
|
31 |
-
*
|
32 |
-
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
33 |
-
*
|
34 |
-
* @param registered Registred plugins
|
35 |
-
* @param activated Activated plugins
|
36 |
-
* @param count Number of old plugins
|
37 |
-
* @param localize Localize strings array
|
38 |
-
*
|
39 |
-
* @return void
|
40 |
-
*/
|
41 |
-
function update_plugins_row( registered, activated, count, localize ) {
|
42 |
-
for ( var init in registered ) {
|
43 |
-
var plugin = registered[ init ];
|
44 |
-
for ( var headers in plugin ) {
|
45 |
-
|
46 |
-
if ( headers == 'slug' || version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '=' ) ) {
|
47 |
-
continue;
|
48 |
-
}
|
49 |
-
|
50 |
-
count = parseInt( count ) + 1;
|
51 |
-
$( ".plugin-count" ).empty().html( count );
|
52 |
-
|
53 |
-
var regex = new RegExp( ' ', 'g' ),
|
54 |
-
info = plugin[ headers ],
|
55 |
-
name = '' + info.Name,
|
56 |
-
id = name.replace( regex, '-' ).trim(),
|
57 |
-
row = '*[data-slug="' + id.toLowerCase() + '"]';
|
58 |
-
|
59 |
-
$( row ).addClass( "update" );
|
60 |
-
|
61 |
-
var html = '<tr class="plugin-update-tr">' +
|
62 |
-
'<td colspan="3" class="plugin-update colspanchange">' +
|
63 |
-
'<div class="update-message notice inline notice-warning notice-alt">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
|
64 |
-
'<a class="thickbox open-plugin-details-modal" href="' + localize.details_url[ init ] + '">' + localize.strings.latest.replace( '%latest%', plugin[ headers ].Latest ) + '</a>';
|
65 |
-
|
66 |
-
if ( typeof activated[ init ] == "undefined" ) {
|
67 |
-
|
68 |
-
html = html +
|
69 |
-
' <em>' + localize.strings.unavailable + '</em>' +
|
70 |
-
localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
|
71 |
-
} else {
|
72 |
-
html = html +
|
73 |
-
'. <a href="' + localize.update_url[ init ] + '">' + localize.strings.update_now + '</a>';
|
74 |
-
}
|
75 |
-
|
76 |
-
if( version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '>' ) ){
|
77 |
-
html = html + localize.strings.version_issue.replace( '%plugin_name%', name )
|
78 |
-
}
|
79 |
-
|
80 |
-
html = html +
|
81 |
-
'</div>' +
|
82 |
-
'</td>' +
|
83 |
-
'</tr>';
|
84 |
-
|
85 |
-
$( html ).insertAfter( row );
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
*
|
92 |
-
* @param v1 Version 1
|
93 |
-
* @param v2 Version 2
|
94 |
-
* @param operator Compare type
|
95 |
-
* @returns bool
|
96 |
-
*
|
97 |
-
* @see php.js library http://phpjs.org/
|
98 |
-
*/
|
99 |
-
function version_compare( v1, v2, operator ) {
|
100 |
-
// discuss at: http://phpjs.org/functions/version_compare/
|
101 |
-
// original by: Philippe Jausions (http://pear.php.net/user/jausions)
|
102 |
-
// original by: Aidan Lister (http://aidanlister.com/)
|
103 |
-
// reimplemented by: Kankrelune (http://www.webfaktory.info/)
|
104 |
-
// improved by: Brett Zamir (http://brett-zamir.me)
|
105 |
-
// improved by: Scott Baker
|
106 |
-
// improved by: Theriault
|
107 |
-
// example 1: version_compare('8.2.5rc', '8.2.5a');
|
108 |
-
// returns 1: 1
|
109 |
-
// example 2: version_compare('8.2.50', '8.2.52', '<');
|
110 |
-
// returns 2: true
|
111 |
-
// example 3: version_compare('5.3.0-dev', '5.3.0');
|
112 |
-
// returns 3: -1
|
113 |
-
// example 4: version_compare('4.1.0.52','4.01.0.51');
|
114 |
-
// returns 4: 1
|
115 |
-
|
116 |
-
this.php_js = this.php_js || {};
|
117 |
-
this.php_js.ENV = this.php_js.ENV || {};
|
118 |
-
// END REDUNDANT
|
119 |
-
// Important: compare must be initialized at 0.
|
120 |
-
var i = 0,
|
121 |
-
x = 0,
|
122 |
-
compare = 0,
|
123 |
-
// vm maps textual PHP versions to negatives so they're less than 0.
|
124 |
-
// PHP currently defines these as CASE-SENSITIVE. It is important to
|
125 |
-
// leave these as negatives so that they can come before numerical versions
|
126 |
-
// and as if no letters were there to begin with.
|
127 |
-
// (1alpha is < 1 and < 1.1 but > 1dev1)
|
128 |
-
// If a non-numerical value can't be mapped to this table, it receives
|
129 |
-
// -7 as its value.
|
130 |
-
vm = {
|
131 |
-
'dev' : -6,
|
132 |
-
'alpha': -5,
|
133 |
-
'a' : -5,
|
134 |
-
'beta' : -4,
|
135 |
-
'b' : -4,
|
136 |
-
'RC' : -3,
|
137 |
-
'rc' : -3,
|
138 |
-
'#' : -2,
|
139 |
-
'p' : 1,
|
140 |
-
'pl' : 1
|
141 |
-
},
|
142 |
-
// This function will be called to prepare each version argument.
|
143 |
-
// It replaces every _, -, and + with a dot.
|
144 |
-
// It surrounds any nonsequence of numbers/dots with dots.
|
145 |
-
// It replaces sequences of dots with a single dot.
|
146 |
-
// version_compare('4..0', '4.0') == 0
|
147 |
-
// Important: A string of 0 length needs to be converted into a value
|
148 |
-
// even less than an unexisting value in vm (-7), hence [-8].
|
149 |
-
// It's also important to not strip spaces because of this.
|
150 |
-
// version_compare('', ' ') == 1
|
151 |
-
prepVersion = function ( v ) {
|
152 |
-
v = ('' + v)
|
153 |
-
.replace( /[_\-+]/g, '.' );
|
154 |
-
v = v.replace( /([^.\d]+)/g, '.$1.' )
|
155 |
-
.replace( /\.{2,}/g, '.' );
|
156 |
-
return (!v.length ? [ -8 ] : v.split( '.' ));
|
157 |
-
};
|
158 |
-
// This converts a version component to a number.
|
159 |
-
// Empty component becomes 0.
|
160 |
-
// Non-numerical component becomes a negative number.
|
161 |
-
// Numerical component becomes itself as an integer.
|
162 |
-
numVersion = function ( v ) {
|
163 |
-
return !v ? 0 : (isNaN( v ) ? vm[ v ] || -7 : parseInt( v, 10 ));
|
164 |
-
};
|
165 |
-
v1 = prepVersion( v1 );
|
166 |
-
v2 = prepVersion( v2 );
|
167 |
-
x = Math.max( v1.length, v2.length );
|
168 |
-
for ( i = 0; i < x; i++ ) {
|
169 |
-
if ( v1[ i ] == v2[ i ] ) {
|
170 |
-
continue;
|
171 |
-
}
|
172 |
-
v1[ i ] = numVersion( v1[ i ] );
|
173 |
-
v2[ i ] = numVersion( v2[ i ] );
|
174 |
-
if ( v1[ i ] < v2[ i ] ) {
|
175 |
-
compare = -1;
|
176 |
-
break;
|
177 |
-
} else if ( v1[ i ] > v2[ i ] ) {
|
178 |
-
compare = 1;
|
179 |
-
break;
|
180 |
-
}
|
181 |
-
}
|
182 |
-
if ( !operator ) {
|
183 |
-
return compare;
|
184 |
-
}
|
185 |
-
|
186 |
-
// Important: operator is CASE-SENSITIVE.
|
187 |
-
// "No operator" seems to be treated as "<."
|
188 |
-
// Any other values seem to make the function return null.
|
189 |
-
switch ( operator ) {
|
190 |
-
case '>':
|
191 |
-
case 'gt':
|
192 |
-
return (compare > 0);
|
193 |
-
case '>=':
|
194 |
-
case 'ge':
|
195 |
-
return (compare >= 0);
|
196 |
-
case '<=':
|
197 |
-
case 'le':
|
198 |
-
return (compare <= 0);
|
199 |
-
case '==':
|
200 |
-
case '=':
|
201 |
-
case 'eq':
|
202 |
-
return (compare === 0);
|
203 |
-
case '<>':
|
204 |
-
case '!=':
|
205 |
-
case 'ne':
|
206 |
-
return (compare !== 0);
|
207 |
-
case '':
|
208 |
-
case '<':
|
209 |
-
case 'lt':
|
210 |
-
return (compare < 0);
|
211 |
-
default:
|
212 |
-
return null;
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
// fix ThickBox issue (width-height) when opening a changelog
|
217 |
-
$( 'body' ).on( 'click', '.yit-changelog-button', function () {
|
218 |
-
$( '#TB_window' ).remove();
|
219 |
-
} );
|
220 |
-
|
221 |
-
|
222 |
-
})( jQuery );
|
1 |
+
/**
|
2 |
+
* This file belongs to the YIT 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 |
+
(function ( $ ) {
|
10 |
+
|
11 |
+
var plugins_menu_item = $( '#menu-plugins' ),
|
12 |
+
update = plugins_menu_item.find( '.update-plugins' ),
|
13 |
+
count = update.find( ".update-count" ).text(),
|
14 |
+
registered = plugins.registered,
|
15 |
+
activated = plugins.activated;
|
16 |
+
|
17 |
+
if ( count == 0 || count == '' ) {
|
18 |
+
var update_row = '<span class="update-plugins"><span class="plugin-count"></span></span>';
|
19 |
+
count = 0;
|
20 |
+
plugins_menu_item.find( '.wp-menu-name' ).append( update_row );
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add the plugin update rows for old plugins
|
25 |
+
*/
|
26 |
+
update_plugins_row( registered, activated, count, plugins );
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* Add the update plugin rows for old plugin
|
31 |
+
*
|
32 |
+
* @author Andrea Grillo <andrea.grillo@yithemes.com>
|
33 |
+
*
|
34 |
+
* @param registered Registred plugins
|
35 |
+
* @param activated Activated plugins
|
36 |
+
* @param count Number of old plugins
|
37 |
+
* @param localize Localize strings array
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
function update_plugins_row( registered, activated, count, localize ) {
|
42 |
+
for ( var init in registered ) {
|
43 |
+
var plugin = registered[ init ];
|
44 |
+
for ( var headers in plugin ) {
|
45 |
+
|
46 |
+
if ( headers == 'slug' || version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '=' ) ) {
|
47 |
+
continue;
|
48 |
+
}
|
49 |
+
|
50 |
+
count = parseInt( count ) + 1;
|
51 |
+
$( ".plugin-count" ).empty().html( count );
|
52 |
+
|
53 |
+
var regex = new RegExp( ' ', 'g' ),
|
54 |
+
info = plugin[ headers ],
|
55 |
+
name = '' + info.Name,
|
56 |
+
id = name.replace( regex, '-' ).trim(),
|
57 |
+
row = '*[data-slug="' + id.toLowerCase() + '"]';
|
58 |
+
|
59 |
+
$( row ).addClass( "update" );
|
60 |
+
|
61 |
+
var html = '<tr class="plugin-update-tr">' +
|
62 |
+
'<td colspan="3" class="plugin-update colspanchange">' +
|
63 |
+
'<div class="update-message notice inline notice-warning notice-alt">' + localize.strings.new_version.replace( '%plugin_name%', name ) +
|
64 |
+
'<a class="thickbox open-plugin-details-modal" href="' + localize.details_url[ init ] + '">' + localize.strings.latest.replace( '%latest%', plugin[ headers ].Latest ) + '</a>';
|
65 |
+
|
66 |
+
if ( typeof activated[ init ] == "undefined" ) {
|
67 |
+
|
68 |
+
html = html +
|
69 |
+
' <em>' + localize.strings.unavailable + '</em>' +
|
70 |
+
localize.strings.activate.replace( '%activate_link%', localize.licence_activation_url ).replace( '%plugin_name%', name );
|
71 |
+
} else {
|
72 |
+
html = html +
|
73 |
+
'. <a href="' + localize.update_url[ init ] + '">' + localize.strings.update_now + '</a>';
|
74 |
+
}
|
75 |
+
|
76 |
+
if( version_compare( plugin[ headers ].Version, plugin[ headers ].Latest, '>' ) ){
|
77 |
+
html = html + localize.strings.version_issue.replace( '%plugin_name%', name )
|
78 |
+
}
|
79 |
+
|
80 |
+
html = html +
|
81 |
+
'</div>' +
|
82 |
+
'</td>' +
|
83 |
+
'</tr>';
|
84 |
+
|
85 |
+
$( html ).insertAfter( row );
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
*
|
92 |
+
* @param v1 Version 1
|
93 |
+
* @param v2 Version 2
|
94 |
+
* @param operator Compare type
|
95 |
+
* @returns bool
|
96 |
+
*
|
97 |
+
* @see php.js library http://phpjs.org/
|
98 |
+
*/
|
99 |
+
function version_compare( v1, v2, operator ) {
|
100 |
+
// discuss at: http://phpjs.org/functions/version_compare/
|
101 |
+
// original by: Philippe Jausions (http://pear.php.net/user/jausions)
|
102 |
+
// original by: Aidan Lister (http://aidanlister.com/)
|
103 |
+
// reimplemented by: Kankrelune (http://www.webfaktory.info/)
|
104 |
+
// improved by: Brett Zamir (http://brett-zamir.me)
|
105 |
+
// improved by: Scott Baker
|
106 |
+
// improved by: Theriault
|
107 |
+
// example 1: version_compare('8.2.5rc', '8.2.5a');
|
108 |
+
// returns 1: 1
|
109 |
+
// example 2: version_compare('8.2.50', '8.2.52', '<');
|
110 |
+
// returns 2: true
|
111 |
+
// example 3: version_compare('5.3.0-dev', '5.3.0');
|
112 |
+
// returns 3: -1
|
113 |
+
// example 4: version_compare('4.1.0.52','4.01.0.51');
|
114 |
+
// returns 4: 1
|
115 |
+
|
116 |
+
this.php_js = this.php_js || {};
|
117 |
+
this.php_js.ENV = this.php_js.ENV || {};
|
118 |
+
// END REDUNDANT
|
119 |
+
// Important: compare must be initialized at 0.
|
120 |
+
var i = 0,
|
121 |
+
x = 0,
|
122 |
+
compare = 0,
|
123 |
+
// vm maps textual PHP versions to negatives so they're less than 0.
|
124 |
+
// PHP currently defines these as CASE-SENSITIVE. It is important to
|
125 |
+
// leave these as negatives so that they can come before numerical versions
|
126 |
+
// and as if no letters were there to begin with.
|
127 |
+
// (1alpha is < 1 and < 1.1 but > 1dev1)
|
128 |
+
// If a non-numerical value can't be mapped to this table, it receives
|
129 |
+
// -7 as its value.
|
130 |
+
vm = {
|
131 |
+
'dev' : -6,
|
132 |
+
'alpha': -5,
|
133 |
+
'a' : -5,
|
134 |
+
'beta' : -4,
|
135 |
+
'b' : -4,
|
136 |
+
'RC' : -3,
|
137 |
+
'rc' : -3,
|
138 |
+
'#' : -2,
|
139 |
+
'p' : 1,
|
140 |
+
'pl' : 1
|
141 |
+
},
|
142 |
+
// This function will be called to prepare each version argument.
|
143 |
+
// It replaces every _, -, and + with a dot.
|
144 |
+
// It surrounds any nonsequence of numbers/dots with dots.
|
145 |
+
// It replaces sequences of dots with a single dot.
|
146 |
+
// version_compare('4..0', '4.0') == 0
|
147 |
+
// Important: A string of 0 length needs to be converted into a value
|
148 |
+
// even less than an unexisting value in vm (-7), hence [-8].
|
149 |
+
// It's also important to not strip spaces because of this.
|
150 |
+
// version_compare('', ' ') == 1
|
151 |
+
prepVersion = function ( v ) {
|
152 |
+
v = ('' + v)
|
153 |
+
.replace( /[_\-+]/g, '.' );
|
154 |
+
v = v.replace( /([^.\d]+)/g, '.$1.' )
|
155 |
+
.replace( /\.{2,}/g, '.' );
|
156 |
+
return (!v.length ? [ -8 ] : v.split( '.' ));
|
157 |
+
};
|
158 |
+
// This converts a version component to a number.
|
159 |
+
// Empty component becomes 0.
|
160 |
+
// Non-numerical component becomes a negative number.
|
161 |
+
// Numerical component becomes itself as an integer.
|
162 |
+
numVersion = function ( v ) {
|
163 |
+
return !v ? 0 : (isNaN( v ) ? vm[ v ] || -7 : parseInt( v, 10 ));
|
164 |
+
};
|
165 |
+
v1 = prepVersion( v1 );
|
166 |
+
v2 = prepVersion( v2 );
|
167 |
+
x = Math.max( v1.length, v2.length );
|
168 |
+
for ( i = 0; i < x; i++ ) {
|
169 |
+
if ( v1[ i ] == v2[ i ] ) {
|
170 |
+
continue;
|
171 |
+
}
|
172 |
+
v1[ i ] = numVersion( v1[ i ] );
|
173 |
+
v2[ i ] = numVersion( v2[ i ] );
|
174 |
+
if ( v1[ i ] < v2[ i ] ) {
|
175 |
+
compare = -1;
|
176 |
+
break;
|
177 |
+
} else if ( v1[ i ] > v2[ i ] ) {
|
178 |
+
compare = 1;
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
if ( !operator ) {
|
183 |
+
return compare;
|
184 |
+
}
|
185 |
+
|
186 |
+
// Important: operator is CASE-SENSITIVE.
|
187 |
+
// "No operator" seems to be treated as "<."
|
188 |
+
// Any other values seem to make the function return null.
|
189 |
+
switch ( operator ) {
|
190 |
+
case '>':
|
191 |
+
case 'gt':
|
192 |
+
return (compare > 0);
|
193 |
+
case '>=':
|
194 |
+
case 'ge':
|
195 |
+
return (compare >= 0);
|
196 |
+
case '<=':
|
197 |
+
case 'le':
|
198 |
+
return (compare <= 0);
|
199 |
+
case '==':
|
200 |
+
case '=':
|
201 |
+
case 'eq':
|
202 |
+
return (compare === 0);
|
203 |
+
case '<>':
|
204 |
+
case '!=':
|
205 |
+
case 'ne':
|
206 |
+
return (compare !== 0);
|
207 |
+
case '':
|
208 |
+
case '<':
|
209 |
+
case 'lt':
|
210 |
+
return (compare < 0);
|
211 |
+
default:
|
212 |
+
return null;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
// fix ThickBox issue (width-height) when opening a changelog
|
217 |
+
$( 'body' ).on( 'click', '.yit-changelog-button', function () {
|
218 |
+
$( '#TB_window' ).remove();
|
219 |
+
} );
|
220 |
+
|
221 |
+
|
222 |
+
})( jQuery );
|
plugin-fw/assets/js/yit-cpt-unlimited.js
CHANGED
@@ -1,80 +1,80 @@
|
|
1 |
-
/**
|
2 |
-
* This file belongs to the YIT 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 |
-
(function($) {
|
11 |
-
"use strict";
|
12 |
-
// Author code here
|
13 |
-
|
14 |
-
// open media box
|
15 |
-
$('.wrap h1, .wrap h2').on( 'click', 'a.multi-uploader', function(event){
|
16 |
-
event.preventDefault();
|
17 |
-
|
18 |
-
var file_frame,
|
19 |
-
button = $(this),
|
20 |
-
selected = false;
|
21 |
-
|
22 |
-
// spinner
|
23 |
-
button.next('span.spinner').css( 'display', 'inline-block' );
|
24 |
-
|
25 |
-
// If the media frame already exists, reopen it.
|
26 |
-
if ( file_frame ) {
|
27 |
-
file_frame.open();
|
28 |
-
return;
|
29 |
-
}
|
30 |
-
|
31 |
-
// Create the media frame.
|
32 |
-
file_frame = wp.media.frames.file_frame = wp.media({
|
33 |
-
title: button.data( 'uploader_title' ),
|
34 |
-
button: {
|
35 |
-
text: button.data( 'uploader_button_text' )
|
36 |
-
},
|
37 |
-
library: {
|
38 |
-
type: 'image'
|
39 |
-
},
|
40 |
-
multiple: true // Set to true to allow multiple files to be selected
|
41 |
-
});
|
42 |
-
|
43 |
-
// When an image is selected, run a callback.
|
44 |
-
file_frame.on( 'select', function() {
|
45 |
-
var selection = file_frame.state().get('selection'),
|
46 |
-
images = [];
|
47 |
-
|
48 |
-
selection.map( function( attachment ) {
|
49 |
-
attachment = attachment.toJSON();
|
50 |
-
|
51 |
-
// Do something with attachment.id and/or attachment.url here
|
52 |
-
images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
|
53 |
-
});
|
54 |
-
console.log( button.data('nonce') );
|
55 |
-
// make AJAX request
|
56 |
-
$.post( ajaxurl, {
|
57 |
-
images: images,
|
58 |
-
post_type: typenow,
|
59 |
-
action: 'yit_cptu_multiuploader',
|
60 |
-
_ajax_nonce: button.data('nonce')
|
61 |
-
}, function( data ){
|
62 |
-
location.reload();
|
63 |
-
});
|
64 |
-
|
65 |
-
button.next('span.spinner').css( 'display', 'inline-block' );
|
66 |
-
|
67 |
-
// flag
|
68 |
-
selected = true;
|
69 |
-
});
|
70 |
-
|
71 |
-
// when close
|
72 |
-
file_frame.on( 'close', function() {
|
73 |
-
if ( ! selected ) button.next('span.spinner').hide();
|
74 |
-
});
|
75 |
-
|
76 |
-
// Finally, open the modal
|
77 |
-
file_frame.open();
|
78 |
-
});
|
79 |
-
|
80 |
})(jQuery);
|
1 |
+
/**
|
2 |
+
* This file belongs to the YIT 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 |
+
(function($) {
|
11 |
+
"use strict";
|
12 |
+
// Author code here
|
13 |
+
|
14 |
+
// open media box
|
15 |
+
$('.wrap h1, .wrap h2').on( 'click', 'a.multi-uploader', function(event){
|
16 |
+
event.preventDefault();
|
17 |
+
|
18 |
+
var file_frame,
|
19 |
+
button = $(this),
|
20 |
+
selected = false;
|
21 |
+
|
22 |
+
// spinner
|
23 |
+
button.next('span.spinner').css( 'display', 'inline-block' );
|
24 |
+
|
25 |
+
// If the media frame already exists, reopen it.
|
26 |
+
if ( file_frame ) {
|
27 |
+
file_frame.open();
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
// Create the media frame.
|
32 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
33 |
+
title: button.data( 'uploader_title' ),
|
34 |
+
button: {
|
35 |
+
text: button.data( 'uploader_button_text' )
|
36 |
+
},
|
37 |
+
library: {
|
38 |
+
type: 'image'
|
39 |
+
},
|
40 |
+
multiple: true // Set to true to allow multiple files to be selected
|
41 |
+
});
|
42 |
+
|
43 |
+
// When an image is selected, run a callback.
|
44 |
+
file_frame.on( 'select', function() {
|
45 |
+
var selection = file_frame.state().get('selection'),
|
46 |
+
images = [];
|
47 |
+
|
48 |
+
selection.map( function( attachment ) {
|
49 |
+
attachment = attachment.toJSON();
|
50 |
+
|
51 |
+
// Do something with attachment.id and/or attachment.url here
|
52 |
+
images.push( { id: attachment.id, url: attachment.url, title: attachment.title } );
|
53 |
+
});
|
54 |
+
console.log( button.data('nonce') );
|
55 |
+
// make AJAX request
|
56 |
+
$.post( ajaxurl, {
|
57 |
+
images: images,
|
58 |
+
post_type: typenow,
|
59 |
+
action: 'yit_cptu_multiuploader',
|
60 |
+
_ajax_nonce: button.data('nonce')
|
61 |
+
}, function( data ){
|
62 |
+
location.reload();
|
63 |
+
});
|
64 |
+
|
65 |
+
button.next('span.spinner').css( 'display', 'inline-block' );
|
66 |
+
|
67 |
+
// flag
|
68 |
+
selected = true;
|
69 |
+
});
|
70 |
+
|
71 |
+
// when close
|
72 |
+
file_frame.on( 'close', function() {
|
73 |
+
if ( ! selected ) button.next('span.spinner').hide();
|
74 |
+
});
|
75 |
+
|
76 |
+
// Finally, open the modal
|
77 |
+
file_frame.open();
|
78 |
+
});
|
79 |
+
|
80 |
})(jQuery);
|
plugin-fw/assets/js/yit-cpt-unlimited.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(function(c){c(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a=c(this),d=!1;a.next("span.spinner").css("display","inline-block");if(!b){var b=wp.media.frames.file_frame=wp.media({title:a.data("uploader_title"),button:{text:a.data("uploader_button_text")},library:{type:"image"},multiple:!0});b.on("select",function(){var e=[];b.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,
|
2 |
action:"yit_cptu_multiuploader",_ajax_nonce:a.data("nonce")},function(a){location.reload()});a.next("span.spinner").css("display","inline-block");d=!0});b.on("close",function(){d||a.next("span.spinner").hide()})}b.open()})})(jQuery);
|
1 |
+
(function(c){c(".wrap h1, .wrap h2").on("click","a.multi-uploader",function(f){f.preventDefault();var a=c(this),d=!1;a.next("span.spinner").css("display","inline-block");if(!b){var b=wp.media.frames.file_frame=wp.media({title:a.data("uploader_title"),button:{text:a.data("uploader_button_text")},library:{type:"image"},multiple:!0});b.on("select",function(){var e=[];b.state().get("selection").map(function(a){a=a.toJSON();e.push({id:a.id,url:a.url,title:a.title})});c.post(ajaxurl,{images:e,post_type:typenow,
|
2 |
action:"yit_cptu_multiuploader",_ajax_nonce:a.data("nonce")},function(a){location.reload()});a.next("span.spinner").css("display","inline-block");d=!0});b.on("close",function(){d||a.next("span.spinner").hide()})}b.open()})})(jQuery);
|
plugin-fw/assets/js/yit-plugin-panel.js
CHANGED
@@ -1,152 +1,152 @@
|
|
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 |
-
jQuery( function ( $ ) {
|
11 |
-
//dependencies handler
|
12 |
-
$( '[data-dep-target]' ).each( function () {
|
13 |
-
var t = $( this );
|
14 |
-
|
15 |
-
var field = '#' + t.data( 'dep-target' ),
|
16 |
-
dep = '#' + t.data( 'dep-id' ),
|
17 |
-
value = t.data( 'dep-value' ),
|
18 |
-
type = t.data( 'dep-type' );
|
19 |
-
|
20 |
-
dependencies_handler( field, dep, value.toString(), type );
|
21 |
-
|
22 |
-
$( dep ).on( 'change', function () {
|
23 |
-
dependencies_handler( field, dep, value.toString(), type );
|
24 |
-
} ).change();
|
25 |
-
} );
|
26 |
-
|
27 |
-
//Handle dependencies.
|
28 |
-
function dependencies_handler( id, deps, values, type ) {
|
29 |
-
var result = true;
|
30 |
-
|
31 |
-
//Single dependency
|
32 |
-
if ( typeof( deps ) == 'string' ) {
|
33 |
-
if ( deps.substr( 0, 6 ) == ':radio' ) {
|
34 |
-
deps = deps + ':checked';
|
35 |
-
}
|
36 |
-
|
37 |
-
var val = $( deps ).val();
|
38 |
-
|
39 |
-
if ( $( deps ).attr( 'type' ) == 'checkbox' ) {
|
40 |
-
var thisCheck = $( deps );
|
41 |
-
if ( thisCheck.is( ':checked' ) ) {
|
42 |
-
val = 'yes';
|
43 |
-
}
|
44 |
-
else {
|
45 |
-
val = 'no';
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
values = values.split( ',' );
|
50 |
-
|
51 |
-
for ( var i = 0; i < values.length; i++ ) {
|
52 |
-
if ( val != values[ i ] ) {
|
53 |
-
result = false;
|
54 |
-
}
|
55 |
-
else {
|
56 |
-
result = true;
|
57 |
-
break;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
var $current_field = $( id ),
|
63 |
-
$current_container = $( id + '-container' ).closest( 'tr' ); // container for YIT Plugin Panel
|
64 |
-
|
65 |
-
if ( $current_container.length < 1 ) {
|
66 |
-
// container for YIT Plugin Panel WooCommerce
|
67 |
-
$current_container = $current_field.closest( '.yith-plugin-fw-panel-wc-row' );
|
68 |
-
}
|
69 |
-
|
70 |
-
var types = type.split( '-' ), j;
|
71 |
-
for ( j in types ) {
|
72 |
-
var current_type = types[ j ];
|
73 |
-
|
74 |
-
if ( !result ) {
|
75 |
-
switch ( current_type ) {
|
76 |
-
case 'disable':
|
77 |
-
$current_container.addClass( 'yith-disabled' );
|
78 |
-
$current_field.attr( 'disabled', true );
|
79 |
-
break;
|
80 |
-
case 'hideme':
|
81 |
-
$current_field.hide();
|
82 |
-
break;
|
83 |
-
default:
|
84 |
-
$current_container.hide();
|
85 |
-
}
|
86 |
-
|
87 |
-
} else {
|
88 |
-
switch ( current_type ) {
|
89 |
-
case 'disable':
|
90 |
-
$current_container.removeClass( 'yith-disabled' );
|
91 |
-
$current_field.attr( 'disabled', false );
|
92 |
-
break;
|
93 |
-
case 'hideme':
|
94 |
-
$current_field.show();
|
95 |
-
break;
|
96 |
-
default:
|
97 |
-
$current_container.show();
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
//connected list
|
104 |
-
$( '.rm_connectedlist' ).each( function () {
|
105 |
-
var ul = $( this ).find( 'ul' );
|
106 |
-
var input = $( this ).find( ':hidden' );
|
107 |
-
var sortable = ul.sortable( {
|
108 |
-
connectWith: ul,
|
109 |
-
update : function ( event, ui ) {
|
110 |
-
var value = {};
|
111 |
-
|
112 |
-
ul.each( function () {
|
113 |
-
var options = {};
|
114 |
-
|
115 |
-
$( this ).children().each( function () {
|
116 |
-
options[ $( this ).data( 'option' ) ] = $( this ).text();
|
117 |
-
} );
|
118 |
-
|
119 |
-
value[ $( this ).data( 'list' ) ] = options;
|
120 |
-
} );
|
121 |
-
|
122 |
-
input.val( (JSON.stringify( value )).replace( /[\\"']/g, '\\$&' ).replace( /\u0000/g, '\\0' ) );
|
123 |
-
}
|
124 |
-
} ).disableSelection();
|
125 |
-
} );
|
126 |
-
|
127 |
-
//google analytics generation
|
128 |
-
$( document ).ready( function () {
|
129 |
-
$( '.google-analytic-generate' ).click( function () {
|
130 |
-
var editor = $( '#' + $( this ).data( 'textarea' ) ).data( 'codemirrorInstance' );
|
131 |
-
var gatc = $( '#' + $( this ).data( 'input' ) ).val();
|
132 |
-
var basename = $( this ).data( 'basename' );
|
133 |
-
|
134 |
-
var text = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";
|
135 |
-
text += "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n";
|
136 |
-
text += "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
|
137 |
-
text += "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";
|
138 |
-
text += "ga('create', '" + gatc + "', '" + basename + "');\n";
|
139 |
-
text += "ga('send', 'pageview');\n";
|
140 |
-
editor.replaceRange(
|
141 |
-
text,
|
142 |
-
editor.getCursor( 'start' ),
|
143 |
-
editor.getCursor( 'end' )
|
144 |
-
)
|
145 |
-
} )
|
146 |
-
} );
|
147 |
-
|
148 |
-
|
149 |
-
// prevents the WC message for changes when leaving the panel page
|
150 |
-
$( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
|
151 |
-
|
152 |
} );
|
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 |
+
jQuery( function ( $ ) {
|
11 |
+
//dependencies handler
|
12 |
+
$( '[data-dep-target]' ).each( function () {
|
13 |
+
var t = $( this );
|
14 |
+
|
15 |
+
var field = '#' + t.data( 'dep-target' ),
|
16 |
+
dep = '#' + t.data( 'dep-id' ),
|
17 |
+
value = t.data( 'dep-value' ),
|
18 |
+
type = t.data( 'dep-type' );
|
19 |
+
|
20 |
+
dependencies_handler( field, dep, value.toString(), type );
|
21 |
+
|
22 |
+
$( dep ).on( 'change', function () {
|
23 |
+
dependencies_handler( field, dep, value.toString(), type );
|
24 |
+
} ).change();
|
25 |
+
} );
|
26 |
+
|
27 |
+
//Handle dependencies.
|
28 |
+
function dependencies_handler( id, deps, values, type ) {
|
29 |
+
var result = true;
|
30 |
+
|
31 |
+
//Single dependency
|
32 |
+
if ( typeof( deps ) == 'string' ) {
|
33 |
+
if ( deps.substr( 0, 6 ) == ':radio' ) {
|
34 |
+
deps = deps + ':checked';
|
35 |
+
}
|
36 |
+
|
37 |
+
var val = $( deps ).val();
|
38 |
+
|
39 |
+
if ( $( deps ).attr( 'type' ) == 'checkbox' ) {
|
40 |
+
var thisCheck = $( deps );
|
41 |
+
if ( thisCheck.is( ':checked' ) ) {
|
42 |
+
val = 'yes';
|
43 |
+
}
|
44 |
+
else {
|
45 |
+
val = 'no';
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
values = values.split( ',' );
|
50 |
+
|
51 |
+
for ( var i = 0; i < values.length; i++ ) {
|
52 |
+
if ( val != values[ i ] ) {
|
53 |
+
result = false;
|
54 |
+
}
|
55 |
+
else {
|
56 |
+
result = true;
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
var $current_field = $( id ),
|
63 |
+
$current_container = $( id + '-container' ).closest( 'tr' ); // container for YIT Plugin Panel
|
64 |
+
|
65 |
+
if ( $current_container.length < 1 ) {
|
66 |
+
// container for YIT Plugin Panel WooCommerce
|
67 |
+
$current_container = $current_field.closest( '.yith-plugin-fw-panel-wc-row' );
|
68 |
+
}
|
69 |
+
|
70 |
+
var types = type.split( '-' ), j;
|
71 |
+
for ( j in types ) {
|
72 |
+
var current_type = types[ j ];
|
73 |
+
|
74 |
+
if ( !result ) {
|
75 |
+
switch ( current_type ) {
|
76 |
+
case 'disable':
|
77 |
+
$current_container.addClass( 'yith-disabled' );
|
78 |
+
$current_field.attr( 'disabled', true );
|
79 |
+
break;
|
80 |
+
case 'hideme':
|
81 |
+
$current_field.hide();
|
82 |
+
break;
|
83 |
+
default:
|
84 |
+
$current_container.hide();
|
85 |
+
}
|
86 |
+
|
87 |
+
} else {
|
88 |
+
switch ( current_type ) {
|
89 |
+
case 'disable':
|
90 |
+
$current_container.removeClass( 'yith-disabled' );
|
91 |
+
$current_field.attr( 'disabled', false );
|
92 |
+
break;
|
93 |
+
case 'hideme':
|
94 |
+
$current_field.show();
|
95 |
+
break;
|
96 |
+
default:
|
97 |
+
$current_container.show();
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
//connected list
|
104 |
+
$( '.rm_connectedlist' ).each( function () {
|
105 |
+
var ul = $( this ).find( 'ul' );
|
106 |
+
var input = $( this ).find( ':hidden' );
|
107 |
+
var sortable = ul.sortable( {
|
108 |
+
connectWith: ul,
|
109 |
+
update : function ( event, ui ) {
|
110 |
+
var value = {};
|
111 |
+
|
112 |
+
ul.each( function () {
|
113 |
+
var options = {};
|
114 |
+
|
115 |
+
$( this ).children().each( function () {
|
116 |
+
options[ $( this ).data( 'option' ) ] = $( this ).text();
|
117 |
+
} );
|
118 |
+
|
119 |
+
value[ $( this ).data( 'list' ) ] = options;
|
120 |
+
} );
|
121 |
+
|
122 |
+
input.val( (JSON.stringify( value )).replace( /[\\"']/g, '\\$&' ).replace( /\u0000/g, '\\0' ) );
|
123 |
+
}
|
124 |
+
} ).disableSelection();
|
125 |
+
} );
|
126 |
+
|
127 |
+
//google analytics generation
|
128 |
+
$( document ).ready( function () {
|
129 |
+
$( '.google-analytic-generate' ).click( function () {
|
130 |
+
var editor = $( '#' + $( this ).data( 'textarea' ) ).data( 'codemirrorInstance' );
|
131 |
+
var gatc = $( '#' + $( this ).data( 'input' ) ).val();
|
132 |
+
var basename = $( this ).data( 'basename' );
|
133 |
+
|
134 |
+
var text = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";
|
135 |
+
text += "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n";
|
136 |
+
text += "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n";
|
137 |
+
text += "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n";
|
138 |
+
text += "ga('create', '" + gatc + "', '" + basename + "');\n";
|
139 |
+
text += "ga('send', 'pageview');\n";
|
140 |
+
editor.replaceRange(
|
141 |
+
text,
|
142 |
+
editor.getCursor( 'start' ),
|
143 |
+
editor.getCursor( 'end' )
|
144 |
+
)
|
145 |
+
} )
|
146 |
+
} );
|
147 |
+
|
148 |
+
|
149 |
+
// prevents the WC message for changes when leaving the panel page
|
150 |
+
$( '.yith-plugin-fw-panel .woo-nav-tab-wrapper' ).removeClass( 'woo-nav-tab-wrapper' ).addClass( 'yith-nav-tab-wrapper' );
|
151 |
+
|
152 |
} );
|
plugin-fw/assets/js/yit-plugin-panel.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var c=a.length,d=0;d<c;d++){var g=a[d];if(e.call(b,g,d,a))return{i:d,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};
|
2 |
-
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,b,c){if(e){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var d=a[c];d in b||(b[d]={});b=b[d]}a=a[a.length-1];c=b[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
-
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
-
jQuery(function(a){function e(b,c,d,e){var f=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var h=a(c).val();"checkbox"==a(c).attr("type")&&(h=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(h!=d[c])f=!1;else{f=!0;break}}d=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=d.closest(".yith-plugin-fw-panel-wc-row"));e=e.split("-");for(var g in e)if(h=e[g],f)switch(h){case "disable":b.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();
|
5 |
-
break;default:b.show()}else switch(h){case "disable":b.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),g=b.data("dep-value"),f=b.data("dep-type");e(c,d,g.toString(),f);a(d).on("change",function(){e(c,d,g.toString(),f)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,
|
6 |
-
update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
|
7 |
-
("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")});
|
1 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,e,b){a instanceof String&&(a=String(a));for(var c=a.length,d=0;d<c;d++){var g=a[d];if(e.call(b,g,d,a))return{i:d,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,b){a!=Array.prototype&&a!=Object.prototype&&(a[e]=b.value)};
|
2 |
+
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,e,b,c){if(e){b=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var d=a[c];d in b||(b[d]={});b=b[d]}a=a[a.length-1];c=b[a];e=e(c);e!=c&&null!=e&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:e})}};
|
3 |
+
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
+
jQuery(function(a){function e(b,c,d,e){var f=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var h=a(c).val();"checkbox"==a(c).attr("type")&&(h=a(c).is(":checked")?"yes":"no");d=d.split(",");for(c=0;c<d.length;c++)if(h!=d[c])f=!1;else{f=!0;break}}d=a(b);b=a(b+"-container").closest("tr");1>b.length&&(b=d.closest(".yith-plugin-fw-panel-wc-row"));e=e.split("-");for(var g in e)if(h=e[g],f)switch(h){case "disable":b.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();
|
5 |
+
break;default:b.show()}else switch(h){case "disable":b.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;default:b.hide()}}a("[data-dep-target]").each(function(){var b=a(this),c="#"+b.data("dep-target"),d="#"+b.data("dep-id"),g=b.data("dep-value"),f=b.data("dep-type");e(c,d,g.toString(),f);a(d).on("change",function(){e(c,d,g.toString(),f)}).change()});a(".rm_connectedlist").each(function(){var b=a(this).find("ul"),c=a(this).find(":hidden");b.sortable({connectWith:b,
|
6 |
+
update:function(d,e){var f={};b.each(function(){var b={};a(this).children().each(function(){b[a(this).data("option")]=a(this).text()});f[a(this).data("list")]=b});c.val(JSON.stringify(f).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});a(document).ready(function(){a(".google-analytic-generate").click(function(){var b=a("#"+a(this).data("textarea")).data("codemirrorInstance"),c=a("#"+a(this).data("input")).val(),d=a(this).data("basename");b.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n"+
|
7 |
+
("ga('create', '"+c+"', '"+d+"');\n")+"ga('send', 'pageview');\n",b.getCursor("start"),b.getCursor("end"))})});a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper")});
|
plugin-fw/assets/js/yit-wp-pointer.js
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
jQuery(document).ready( function($) {
|
2 |
-
var pointers = custom_pointer.pointers[0],
|
3 |
-
options = pointers.options,
|
4 |
-
target = $(pointers.target),
|
5 |
-
pointer_id = pointers.pointer_id;
|
6 |
-
|
7 |
-
$(target).find('.wp-submenu li a').each(function () {
|
8 |
-
|
9 |
-
var t = $(this),
|
10 |
-
href = t.attr('href');
|
11 |
-
|
12 |
-
href = href.replace('admin.php?page=', '');
|
13 |
-
|
14 |
-
if( href == pointer_id ){
|
15 |
-
|
16 |
-
var selected_plugin_row = t.add( target ),
|
17 |
-
top_level_menu = target.find( pointers.target.replace( '#', '.' ) );
|
18 |
-
|
19 |
-
target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
|
20 |
-
|
21 |
-
t.pointer({
|
22 |
-
pointerClass: 'yit-wp-pointer',
|
23 |
-
content : options.content,
|
24 |
-
position: options.position,
|
25 |
-
open : function () {
|
26 |
-
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
27 |
-
top_level_menu.addClass( 'yit-pointer' );
|
28 |
-
},
|
29 |
-
|
30 |
-
|
31 |
-
close : function () {
|
32 |
-
target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
|
33 |
-
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
34 |
-
top_level_menu.removeClass( 'yit-pointer' );
|
35 |
-
|
36 |
-
$.ajax({
|
37 |
-
type : 'POST',
|
38 |
-
url : ajaxurl,
|
39 |
-
data : {
|
40 |
-
"action" : "dismiss-wp-pointer",
|
41 |
-
"pointer": pointer_id
|
42 |
-
},
|
43 |
-
success: function (response) {
|
44 |
-
}
|
45 |
-
});
|
46 |
-
|
47 |
-
}
|
48 |
-
}).pointer('open');
|
49 |
-
} else if( 'yith_default_pointer' == pointer_id ) {
|
50 |
-
|
51 |
-
var selected_plugin_row = t.add( target ),
|
52 |
-
top_level_menu = target.find( pointers.target.replace( '#', '.' )),
|
53 |
-
yit_plugins = $( pointers.target );
|
54 |
-
|
55 |
-
yit_plugins.addClass('wp-has-current-submenu');
|
56 |
-
|
57 |
-
top_level_menu.pointer({
|
58 |
-
pointerClass: 'yit-wp-pointer',
|
59 |
-
content : options.content,
|
60 |
-
position: options.position,
|
61 |
-
|
62 |
-
open : function () {
|
63 |
-
yit_plugins.addClass( 'yit-pointer-selected-row' );
|
64 |
-
},
|
65 |
-
|
66 |
-
close : function () {
|
67 |
-
yit_plugins.removeClass( 'yit-pointer-selected-row wp-has-current-submenu' );
|
68 |
-
|
69 |
-
$.ajax({
|
70 |
-
type : 'POST',
|
71 |
-
url : ajaxurl,
|
72 |
-
data : {
|
73 |
-
"action" : "dismiss-wp-pointer",
|
74 |
-
"pointer": pointer_id
|
75 |
-
},
|
76 |
-
success: function (response) {
|
77 |
-
}
|
78 |
-
});
|
79 |
-
}
|
80 |
-
}).pointer('open');
|
81 |
-
}
|
82 |
-
});
|
83 |
});
|
1 |
+
jQuery(document).ready( function($) {
|
2 |
+
var pointers = custom_pointer.pointers[0],
|
3 |
+
options = pointers.options,
|
4 |
+
target = $(pointers.target),
|
5 |
+
pointer_id = pointers.pointer_id;
|
6 |
+
|
7 |
+
$(target).find('.wp-submenu li a').each(function () {
|
8 |
+
|
9 |
+
var t = $(this),
|
10 |
+
href = t.attr('href');
|
11 |
+
|
12 |
+
href = href.replace('admin.php?page=', '');
|
13 |
+
|
14 |
+
if( href == pointer_id ){
|
15 |
+
|
16 |
+
var selected_plugin_row = t.add( target ),
|
17 |
+
top_level_menu = target.find( pointers.target.replace( '#', '.' ) );
|
18 |
+
|
19 |
+
target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
|
20 |
+
|
21 |
+
t.pointer({
|
22 |
+
pointerClass: 'yit-wp-pointer',
|
23 |
+
content : options.content,
|
24 |
+
position: options.position,
|
25 |
+
open : function () {
|
26 |
+
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
27 |
+
top_level_menu.addClass( 'yit-pointer' );
|
28 |
+
},
|
29 |
+
|
30 |
+
|
31 |
+
close : function () {
|
32 |
+
target.toggleClass('wp-no-current-submenu wp-menu-open wp-has-current-submenu');
|
33 |
+
selected_plugin_row.toggleClass( 'yit-pointer-selected-row' );
|
34 |
+
top_level_menu.removeClass( 'yit-pointer' );
|
35 |
+
|
36 |
+
$.ajax({
|
37 |
+
type : 'POST',
|
38 |
+
url : ajaxurl,
|
39 |
+
data : {
|
40 |
+
"action" : "dismiss-wp-pointer",
|
41 |
+
"pointer": pointer_id
|
42 |
+
},
|
43 |
+
success: function (response) {
|
44 |
+
}
|
45 |
+
});
|
46 |
+
|
47 |
+
}
|
48 |
+
}).pointer('open');
|
49 |
+
} else if( 'yith_default_pointer' == pointer_id ) {
|
50 |
+
|
51 |
+
var selected_plugin_row = t.add( target ),
|
52 |
+
top_level_menu = target.find( pointers.target.replace( '#', '.' )),
|
53 |
+
yit_plugins = $( pointers.target );
|
54 |
+
|
55 |
+
yit_plugins.addClass('wp-has-current-submenu');
|
56 |
+
|
57 |
+
top_level_menu.pointer({
|
58 |
+
pointerClass: 'yit-wp-pointer',
|
59 |
+
content : options.content,
|
60 |
+
position: options.position,
|
61 |
+
|
62 |
+
open : function () {
|
63 |
+
yit_plugins.addClass( 'yit-pointer-selected-row' );
|
64 |
+
},
|
65 |
+
|
66 |
+
close : function () {
|
67 |
+
yit_plugins.removeClass( 'yit-pointer-selected-row wp-has-current-submenu' );
|
68 |
+
|
69 |
+
$.ajax({
|
70 |
+
type : 'POST',
|
71 |
+
url : ajaxurl,
|
72 |
+
data : {
|
73 |
+
"action" : "dismiss-wp-pointer",
|
74 |
+
"pointer": pointer_id
|
75 |
+
},
|
76 |
+
success: function (response) {
|
77 |
+
}
|
78 |
+
});
|
79 |
+
}
|
80 |
+
}).pointer('open');
|
81 |
+
}
|
82 |
+
});
|
83 |
});
|
plugin-fw/assets/js/yit-wp-pointer.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,c,b){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(c.call(b,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};
|
2 |
-
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};
|
3 |
-
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
-
jQuery(document).ready(function(a){var c=custom_pointer.pointers[0],b=c.options,d=a(c.target),e=c.pointer_id;a(d).find(".wp-submenu li a").each(function(){var f=a(this),h=f.attr("href");h=h.replace("admin.php?page=","");if(h==e){var k=f.add(d),g=d.find(c.target.replace("#","."));d.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");f.pointer({pointerClass:"yit-wp-pointer",content:b.content,position:b.position,open:function(){k.toggleClass("yit-pointer-selected-row");g.addClass("yit-pointer")},
|
5 |
-
close:function(){d.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");k.toggleClass("yit-pointer-selected-row");g.removeClass("yit-pointer");a.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}else if("yith_default_pointer"==e){k=f.add(d);g=d.find(c.target.replace("#","."));var l=a(c.target);l.addClass("wp-has-current-submenu");g.pointer({pointerClass:"yit-wp-pointer",content:b.content,position:b.position,open:function(){l.addClass("yit-pointer-selected-row")},
|
6 |
-
close:function(){l.removeClass("yit-pointer-selected-row wp-has-current-submenu");a.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}})});
|
1 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,c,b){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(c.call(b,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)};
|
2 |
+
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,c,b,d){if(c){b=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in b||(b[e]={});b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&$jscomp.defineProperty(b,a,{configurable:!0,writable:!0,value:c})}};
|
3 |
+
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");
|
4 |
+
jQuery(document).ready(function(a){var c=custom_pointer.pointers[0],b=c.options,d=a(c.target),e=c.pointer_id;a(d).find(".wp-submenu li a").each(function(){var f=a(this),h=f.attr("href");h=h.replace("admin.php?page=","");if(h==e){var k=f.add(d),g=d.find(c.target.replace("#","."));d.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");f.pointer({pointerClass:"yit-wp-pointer",content:b.content,position:b.position,open:function(){k.toggleClass("yit-pointer-selected-row");g.addClass("yit-pointer")},
|
5 |
+
close:function(){d.toggleClass("wp-no-current-submenu wp-menu-open wp-has-current-submenu");k.toggleClass("yit-pointer-selected-row");g.removeClass("yit-pointer");a.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}else if("yith_default_pointer"==e){k=f.add(d);g=d.find(c.target.replace("#","."));var l=a(c.target);l.addClass("wp-has-current-submenu");g.pointer({pointerClass:"yit-wp-pointer",content:b.content,position:b.position,open:function(){l.addClass("yit-pointer-selected-row")},
|
6 |
+
close:function(){l.removeClass("yit-pointer-selected-row wp-has-current-submenu");a.ajax({type:"POST",url:ajaxurl,data:{action:"dismiss-wp-pointer",pointer:e},success:function(a){}})}}).pointer("open")}})});
|
plugin-fw/assets/js/yith-colorpicker.min.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
/**!
|
2 |
-
* wp-color-picker-alpha
|
3 |
-
*
|
4 |
-
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
-
* Only run in input and is defined data alpha in true
|
6 |
-
*
|
7 |
-
* Version: 2.1.3
|
8 |
-
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
-
* Licensed under the GPLv2 license or later.
|
10 |
-
*/
|
11 |
-
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
1 |
+
/**!
|
2 |
+
* wp-color-picker-alpha
|
3 |
+
*
|
4 |
+
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
5 |
+
* Only run in input and is defined data alpha in true
|
6 |
+
*
|
7 |
+
* Version: 2.1.3
|
8 |
+
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
+
* Licensed under the GPLv2 license or later.
|
10 |
+
*/
|
11 |
+
!function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
|
plugin-fw/assets/js/yith-enhanced-select-wc-2.6.js
CHANGED
@@ -1,148 +1,148 @@
|
|
1 |
-
/*
|
2 |
-
global yith_framework_enhanced_select_params
|
3 |
-
*/
|
4 |
-
jQuery( document ).ready( function ( $ ) {
|
5 |
-
"use strict";
|
6 |
-
|
7 |
-
$( document.body )
|
8 |
-
.on( 'yith-framework-enhanced-select-init', function () {
|
9 |
-
// Post Search
|
10 |
-
$( ':input.yith-post-search' ).filter( ':not(.enhanced)' ).each( function () {
|
11 |
-
var default_data = {
|
12 |
-
action : 'yith_plugin_fw_json_search_posts',
|
13 |
-
security : yith_framework_enhanced_select_params.search_posts_nonce,
|
14 |
-
post_type: 'post'
|
15 |
-
},
|
16 |
-
current_data = $.extend( default_data, $( this ).data() ),
|
17 |
-
select2_args = {
|
18 |
-
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
19 |
-
placeholder : $( this ).data( 'placeholder' ),
|
20 |
-
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
21 |
-
escapeMarkup : function ( m ) {
|
22 |
-
return m;
|
23 |
-
},
|
24 |
-
ajax : {
|
25 |
-
url : yith_framework_enhanced_select_params.ajax_url,
|
26 |
-
dataType : 'json',
|
27 |
-
quietMillis: 250,
|
28 |
-
data : function ( term ) {
|
29 |
-
current_data.term = term;
|
30 |
-
return current_data;
|
31 |
-
},
|
32 |
-
results : function ( data ) {
|
33 |
-
var terms = [];
|
34 |
-
if ( data ) {
|
35 |
-
$.each( data, function ( id, text ) {
|
36 |
-
terms.push( { id: id, text: text } );
|
37 |
-
} );
|
38 |
-
}
|
39 |
-
return {
|
40 |
-
results: terms
|
41 |
-
};
|
42 |
-
},
|
43 |
-
cache : true
|
44 |
-
}
|
45 |
-
};
|
46 |
-
|
47 |
-
if ( $( this ).data( 'multiple' ) === true ) {
|
48 |
-
select2_args.multiple = true;
|
49 |
-
select2_args.initSelection = function ( element, callback ) {
|
50 |
-
var data = $.parseJSON( element.attr( 'data-selected' ) );
|
51 |
-
var selected = [];
|
52 |
-
|
53 |
-
$( element.val().split( ',' ) ).each( function ( i, val ) {
|
54 |
-
selected.push( {
|
55 |
-
id : val,
|
56 |
-
text: data[ val ]
|
57 |
-
} );
|
58 |
-
} );
|
59 |
-
return callback( selected );
|
60 |
-
};
|
61 |
-
select2_args.formatSelection = function ( data ) {
|
62 |
-
return '<div class="selected-option" data-id="' + data.id + '">' + data.text + '</div>';
|
63 |
-
};
|
64 |
-
} else {
|
65 |
-
select2_args.multiple = false;
|
66 |
-
select2_args.initSelection = function ( element, callback ) {
|
67 |
-
var data = {
|
68 |
-
id : element.val(),
|
69 |
-
text: element.attr( 'data-selected' )
|
70 |
-
};
|
71 |
-
return callback( data );
|
72 |
-
};
|
73 |
-
}
|
74 |
-
|
75 |
-
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
76 |
-
} );
|
77 |
-
|
78 |
-
// Term Search
|
79 |
-
$( ':input.yith-term-search' ).filter( ':not(.enhanced)' ).each( function () {
|
80 |
-
var default_data = {
|
81 |
-
action : 'yith_plugin_fw_json_search_terms',
|
82 |
-
security : yith_framework_enhanced_select_params.search_terms_nonce,
|
83 |
-
taxonomy: 'category'
|
84 |
-
},
|
85 |
-
current_data = $.extend( default_data, $( this ).data() ),
|
86 |
-
select2_args = {
|
87 |
-
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
88 |
-
placeholder : $( this ).data( 'placeholder' ),
|
89 |
-
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
90 |
-
escapeMarkup : function ( m ) {
|
91 |
-
return m;
|
92 |
-
},
|
93 |
-
ajax : {
|
94 |
-
url : yith_framework_enhanced_select_params.ajax_url,
|
95 |
-
dataType : 'json',
|
96 |
-
quietMillis: 250,
|
97 |
-
data : function ( term ) {
|
98 |
-
current_data.term = term;
|
99 |
-
return current_data;
|
100 |
-
},
|
101 |
-
results : function ( data ) {
|
102 |
-
var terms = [];
|
103 |
-
if ( data ) {
|
104 |
-
$.each( data, function ( id, text ) {
|
105 |
-
terms.push( { id: id, text: text } );
|
106 |
-
} );
|
107 |
-
}
|
108 |
-
return {
|
109 |
-
results: terms
|
110 |
-
};
|
111 |
-
},
|
112 |
-
cache : true
|
113 |
-
}
|
114 |
-
};
|
115 |
-
|
116 |
-
if ( $( this ).data( 'multiple' ) === true ) {
|
117 |
-
select2_args.multiple = true;
|
118 |
-
select2_args.initSelection = function ( element, callback ) {
|
119 |
-
var data = $.parseJSON( element.attr( 'data-selected' ) );
|
120 |
-
var selected = [];
|
121 |
-
|
122 |
-
$( element.val().split( ',' ) ).each( function ( i, val ) {
|
123 |
-
selected.push( {
|
124 |
-
id : val,
|
125 |
-
text: data[ val ]
|
126 |
-
} );
|
127 |
-
} );
|
128 |
-
return callback( selected );
|
129 |
-
};
|
130 |
-
select2_args.formatSelection = function ( data ) {
|
131 |
-
return '<div class="selected-option" data-id="' + data.id + '">' + data.text + '</div>';
|
132 |
-
};
|
133 |
-
} else {
|
134 |
-
select2_args.multiple = false;
|
135 |
-
select2_args.initSelection = function ( element, callback ) {
|
136 |
-
var data = {
|
137 |
-
id : element.val(),
|
138 |
-
text: element.attr( 'data-selected' )
|
139 |
-
};
|
140 |
-
return callback( data );
|
141 |
-
};
|
142 |
-
}
|
143 |
-
|
144 |
-
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
145 |
-
} );
|
146 |
-
} ).trigger( 'yith-framework-enhanced-select-init' );
|
147 |
-
|
148 |
} );
|
1 |
+
/*
|
2 |
+
global yith_framework_enhanced_select_params
|
3 |
+
*/
|
4 |
+
jQuery( document ).ready( function ( $ ) {
|
5 |
+
"use strict";
|
6 |
+
|
7 |
+
$( document.body )
|
8 |
+
.on( 'yith-framework-enhanced-select-init', function () {
|
9 |
+
// Post Search
|
10 |
+
$( ':input.yith-post-search' ).filter( ':not(.enhanced)' ).each( function () {
|
11 |
+
var default_data = {
|
12 |
+
action : 'yith_plugin_fw_json_search_posts',
|
13 |
+
security : yith_framework_enhanced_select_params.search_posts_nonce,
|
14 |
+
post_type: 'post'
|
15 |
+
},
|
16 |
+
current_data = $.extend( default_data, $( this ).data() ),
|
17 |
+
select2_args = {
|
18 |
+
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
19 |
+
placeholder : $( this ).data( 'placeholder' ),
|
20 |
+
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
21 |
+
escapeMarkup : function ( m ) {
|
22 |
+
return m;
|
23 |
+
},
|
24 |
+
ajax : {
|
25 |
+
url : yith_framework_enhanced_select_params.ajax_url,
|
26 |
+
dataType : 'json',
|
27 |
+
quietMillis: 250,
|
28 |
+
data : function ( term ) {
|
29 |
+
current_data.term = term;
|
30 |
+
return current_data;
|
31 |
+
},
|
32 |
+
results : function ( data ) {
|
33 |
+
var terms = [];
|
34 |
+
if ( data ) {
|
35 |
+
$.each( data, function ( id, text ) {
|
36 |
+
terms.push( { id: id, text: text } );
|
37 |
+
} );
|
38 |
+
}
|
39 |
+
return {
|
40 |
+
results: terms
|
41 |
+
};
|
42 |
+
},
|
43 |
+
cache : true
|
44 |
+
}
|
45 |
+
};
|
46 |
+
|
47 |
+
if ( $( this ).data( 'multiple' ) === true ) {
|
48 |
+
select2_args.multiple = true;
|
49 |
+
select2_args.initSelection = function ( element, callback ) {
|
50 |
+
var data = $.parseJSON( element.attr( 'data-selected' ) );
|
51 |
+
var selected = [];
|
52 |
+
|
53 |
+
$( element.val().split( ',' ) ).each( function ( i, val ) {
|
54 |
+
selected.push( {
|
55 |
+
id : val,
|
56 |
+
text: data[ val ]
|
57 |
+
} );
|
58 |
+
} );
|
59 |
+
return callback( selected );
|
60 |
+
};
|
61 |
+
select2_args.formatSelection = function ( data ) {
|
62 |
+
return '<div class="selected-option" data-id="' + data.id + '">' + data.text + '</div>';
|
63 |
+
};
|
64 |
+
} else {
|
65 |
+
select2_args.multiple = false;
|
66 |
+
select2_args.initSelection = function ( element, callback ) {
|
67 |
+
var data = {
|
68 |
+
id : element.val(),
|
69 |
+
text: element.attr( 'data-selected' )
|
70 |
+
};
|
71 |
+
return callback( data );
|
72 |
+
};
|
73 |
+
}
|
74 |
+
|
75 |
+
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
76 |
+
} );
|
77 |
+
|
78 |
+
// Term Search
|
79 |
+
$( ':input.yith-term-search' ).filter( ':not(.enhanced)' ).each( function () {
|
80 |
+
var default_data = {
|
81 |
+
action : 'yith_plugin_fw_json_search_terms',
|
82 |
+
security : yith_framework_enhanced_select_params.search_terms_nonce,
|
83 |
+
taxonomy: 'category'
|
84 |
+
},
|
85 |
+
current_data = $.extend( default_data, $( this ).data() ),
|
86 |
+
select2_args = {
|
87 |
+
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
88 |
+
placeholder : $( this ).data( 'placeholder' ),
|
89 |
+
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
90 |
+
escapeMarkup : function ( m ) {
|
91 |
+
return m;
|
92 |
+
},
|
93 |
+
ajax : {
|
94 |
+
url : yith_framework_enhanced_select_params.ajax_url,
|
95 |
+
dataType : 'json',
|
96 |
+
quietMillis: 250,
|
97 |
+
data : function ( term ) {
|
98 |
+
current_data.term = term;
|
99 |
+
return current_data;
|
100 |
+
},
|
101 |
+
results : function ( data ) {
|
102 |
+
var terms = [];
|
103 |
+
if ( data ) {
|
104 |
+
$.each( data, function ( id, text ) {
|
105 |
+
terms.push( { id: id, text: text } );
|
106 |
+
} );
|
107 |
+
}
|
108 |
+
return {
|
109 |
+
results: terms
|
110 |
+
};
|
111 |
+
},
|
112 |
+
cache : true
|
113 |
+
}
|
114 |
+
};
|
115 |
+
|
116 |
+
if ( $( this ).data( 'multiple' ) === true ) {
|
117 |
+
select2_args.multiple = true;
|
118 |
+
select2_args.initSelection = function ( element, callback ) {
|
119 |
+
var data = $.parseJSON( element.attr( 'data-selected' ) );
|
120 |
+
var selected = [];
|
121 |
+
|
122 |
+
$( element.val().split( ',' ) ).each( function ( i, val ) {
|
123 |
+
selected.push( {
|
124 |
+
id : val,
|
125 |
+
text: data[ val ]
|
126 |
+
} );
|
127 |
+
} );
|
128 |
+
return callback( selected );
|
129 |
+
};
|
130 |
+
select2_args.formatSelection = function ( data ) {
|
131 |
+
return '<div class="selected-option" data-id="' + data.id + '">' + data.text + '</div>';
|
132 |
+
};
|
133 |
+
} else {
|
134 |
+
select2_args.multiple = false;
|
135 |
+
select2_args.initSelection = function ( element, callback ) {
|
136 |
+
var data = {
|
137 |
+
id : element.val(),
|
138 |
+
text: element.attr( 'data-selected' )
|
139 |
+
};
|
140 |
+
return callback( data );
|
141 |
+
};
|
142 |
+
}
|
143 |
+
|
144 |
+
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
145 |
+
} );
|
146 |
+
} ).trigger( 'yith-framework-enhanced-select-init' );
|
147 |
+
|
148 |
} );
|
plugin-fw/assets/js/yith-enhanced-select-wc-2.6.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
jQuery(document).ready(function(b){b(document.body).on("yith-framework-enhanced-select-init",function(){b(":input.yith-post-search").filter(":not(.enhanced)").each(function(){var d=b.extend({action:"yith_plugin_fw_json_search_posts",security:yith_framework_enhanced_select_params.search_posts_nonce,post_type:"post"},b(this).data()),c={allowClear:b(this).data("allow_clear")?!0:!1,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):
|
2 |
-
"3",escapeMarkup:function(a){return a},ajax:{url:yith_framework_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){d.term=a;return d},results:function(a){var c=[];a&&b.each(a,function(a,b){c.push({id:a,text:b})});return{results:c}},cache:!0}};!0===b(this).data("multiple")?(c.multiple=!0,c.initSelection=function(a,c){var f=b.parseJSON(a.attr("data-selected")),e=[];b(a.val().split(",")).each(function(a,b){e.push({id:b,text:f[b]})});return c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+
|
3 |
-
a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){a={id:a.val(),text:a.attr("data-selected")};return b(a)});b(this).select2(c).addClass("enhanced")});b(":input.yith-term-search").filter(":not(.enhanced)").each(function(){var d=b.extend({action:"yith_plugin_fw_json_search_terms",security:yith_framework_enhanced_select_params.search_terms_nonce,taxonomy:"category"},b(this).data()),c={allowClear:b(this).data("allow_clear")?!0:!1,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?
|
4 |
-
b(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:yith_framework_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){d.term=a;return d},results:function(a){var c=[];a&&b.each(a,function(a,b){c.push({id:a,text:b})});return{results:c}},cache:!0}};!0===b(this).data("multiple")?(c.multiple=!0,c.initSelection=function(a,c){var d=b.parseJSON(a.attr("data-selected")),e=[];b(a.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})});
|
5 |
-
return c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){a={id:a.val(),text:a.attr("data-selected")};return b(a)});b(this).select2(c).addClass("enhanced")})}).trigger("yith-framework-enhanced-select-init")});
|
1 |
+
jQuery(document).ready(function(b){b(document.body).on("yith-framework-enhanced-select-init",function(){b(":input.yith-post-search").filter(":not(.enhanced)").each(function(){var d=b.extend({action:"yith_plugin_fw_json_search_posts",security:yith_framework_enhanced_select_params.search_posts_nonce,post_type:"post"},b(this).data()),c={allowClear:b(this).data("allow_clear")?!0:!1,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):
|
2 |
+
"3",escapeMarkup:function(a){return a},ajax:{url:yith_framework_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){d.term=a;return d},results:function(a){var c=[];a&&b.each(a,function(a,b){c.push({id:a,text:b})});return{results:c}},cache:!0}};!0===b(this).data("multiple")?(c.multiple=!0,c.initSelection=function(a,c){var f=b.parseJSON(a.attr("data-selected")),e=[];b(a.val().split(",")).each(function(a,b){e.push({id:b,text:f[b]})});return c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+
|
3 |
+
a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){a={id:a.val(),text:a.attr("data-selected")};return b(a)});b(this).select2(c).addClass("enhanced")});b(":input.yith-term-search").filter(":not(.enhanced)").each(function(){var d=b.extend({action:"yith_plugin_fw_json_search_terms",security:yith_framework_enhanced_select_params.search_terms_nonce,taxonomy:"category"},b(this).data()),c={allowClear:b(this).data("allow_clear")?!0:!1,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?
|
4 |
+
b(this).data("minimum_input_length"):"3",escapeMarkup:function(a){return a},ajax:{url:yith_framework_enhanced_select_params.ajax_url,dataType:"json",quietMillis:250,data:function(a){d.term=a;return d},results:function(a){var c=[];a&&b.each(a,function(a,b){c.push({id:a,text:b})});return{results:c}},cache:!0}};!0===b(this).data("multiple")?(c.multiple=!0,c.initSelection=function(a,c){var d=b.parseJSON(a.attr("data-selected")),e=[];b(a.val().split(",")).each(function(a,b){e.push({id:b,text:d[b]})});
|
5 |
+
return c(e)},c.formatSelection=function(a){return'<div class="selected-option" data-id="'+a.id+'">'+a.text+"</div>"}):(c.multiple=!1,c.initSelection=function(a,b){a={id:a.val(),text:a.attr("data-selected")};return b(a)});b(this).select2(c).addClass("enhanced")})}).trigger("yith-framework-enhanced-select-init")});
|
plugin-fw/assets/js/yith-enhanced-select.js
CHANGED
@@ -1,198 +1,198 @@
|
|
1 |
-
/* global yith_framework_enhanced_select_params */
|
2 |
-
|
3 |
-
jQuery( document ).ready( function ( $ ) {
|
4 |
-
"use strict";
|
5 |
-
|
6 |
-
$( document.body )
|
7 |
-
.on( 'yith-framework-enhanced-select-init', function () {
|
8 |
-
// Post Search
|
9 |
-
$( '.yith-post-search' ).filter( ':not(.enhanced)' ).each( function () {
|
10 |
-
var default_data = {
|
11 |
-
action : 'yith_plugin_fw_json_search_posts',
|
12 |
-
security : yith_framework_enhanced_select_params.search_posts_nonce,
|
13 |
-
post_type: 'post'
|
14 |
-
},
|
15 |
-
current_data = $.extend( default_data, $( this ).data() ),
|
16 |
-
select2_args = {
|
17 |
-
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
18 |
-
placeholder : $( this ).data( 'placeholder' ),
|
19 |
-
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
20 |
-
escapeMarkup : function ( m ) {
|
21 |
-
return m;
|
22 |
-
},
|
23 |
-
ajax : {
|
24 |
-
url : ajaxurl,
|
25 |
-
dataType : 'json',
|
26 |
-
quietMillis : 250,
|
27 |
-
data : function ( params ) {
|
28 |
-
var default_data_to_return = {
|
29 |
-
term: params.term
|
30 |
-
};
|
31 |
-
|
32 |
-
return $.extend( default_data_to_return, current_data );
|
33 |
-
},
|
34 |
-
processResults: function ( data ) {
|
35 |
-
var terms = [];
|
36 |
-
if ( data ) {
|
37 |
-
$.each( data, function ( id, text ) {
|
38 |
-
terms.push( { id: id, text: text } );
|
39 |
-
} );
|
40 |
-
}
|
41 |
-
return {
|
42 |
-
results: terms
|
43 |
-
};
|
44 |
-
},
|
45 |
-
cache : true
|
46 |
-
}
|
47 |
-
};
|
48 |
-
|
49 |
-
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
50 |
-
|
51 |
-
if ( $( this ).data( 'sortable' ) ) {
|
52 |
-
var $select = $( this );
|
53 |
-
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
54 |
-
|
55 |
-
$list.sortable( {
|
56 |
-
placeholder : 'ui-state-highlight select2-selection__choice',
|
57 |
-
forcePlaceholderSize: true,
|
58 |
-
items : 'li:not(.select2-search__field)',
|
59 |
-
tolerance : 'pointer',
|
60 |
-
stop : function () {
|
61 |
-
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
62 |
-
var id = $( this ).data( 'data' ).id;
|
63 |
-
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
64 |
-
$select.prepend( option );
|
65 |
-
} );
|
66 |
-
}
|
67 |
-
} );
|
68 |
-
}
|
69 |
-
} );
|
70 |
-
|
71 |
-
// Customer Search
|
72 |
-
$( '.yith-customer-search' ).filter( ':not(.enhanced)' ).each( function () {
|
73 |
-
var default_data = {
|
74 |
-
action : 'woocommerce_json_search_customers',
|
75 |
-
security : yith_framework_enhanced_select_params.search_customers_nonce,
|
76 |
-
},
|
77 |
-
current_data = $.extend( default_data, $( this ).data() ),
|
78 |
-
select2_args = {
|
79 |
-
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
80 |
-
placeholder : $( this ).data( 'placeholder' ),
|
81 |
-
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
82 |
-
escapeMarkup : function ( m ) {
|
83 |
-
return m;
|
84 |
-
},
|
85 |
-
ajax : {
|
86 |
-
url : ajaxurl,
|
87 |
-
dataType : 'json',
|
88 |
-
quietMillis : 250,
|
89 |
-
data : function ( params ) {
|
90 |
-
var default_data_to_return = {
|
91 |
-
term: params.term
|
92 |
-
};
|
93 |
-
|
94 |
-
return $.extend( default_data_to_return, current_data );
|
95 |
-
},
|
96 |
-
processResults: function ( data ) {
|
97 |
-
var terms = [];
|
98 |
-
if ( data ) {
|
99 |
-
$.each( data, function ( id, text ) {
|
100 |
-
terms.push( { id: id, text: text } );
|
101 |
-
} );
|
102 |
-
}
|
103 |
-
return {
|
104 |
-
results: terms
|
105 |
-
};
|
106 |
-
},
|
107 |
-
cache : true
|
108 |
-
}
|
109 |
-
};
|
110 |
-
|
111 |
-
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
112 |
-
|
113 |
-
if ( $( this ).data( 'sortable' ) ) {
|
114 |
-
var $select = $( this );
|
115 |
-
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
116 |
-
|
117 |
-
$list.sortable( {
|
118 |
-
placeholder : 'ui-state-highlight select2-selection__choice',
|
119 |
-
forcePlaceholderSize: true,
|
120 |
-
items : 'li:not(.select2-search__field)',
|
121 |
-
tolerance : 'pointer',
|
122 |
-
stop : function () {
|
123 |
-
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
124 |
-
var id = $( this ).data( 'data' ).id;
|
125 |
-
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
126 |
-
$select.prepend( option );
|
127 |
-
} );
|
128 |
-
}
|
129 |
-
} );
|
130 |
-
}
|
131 |
-
} );
|
132 |
-
|
133 |
-
// TERM SEARCH
|
134 |
-
$( '.yith-term-search' ).filter( ':not(.enhanced)' ).each( function () {
|
135 |
-
var default_data = {
|
136 |
-
action : 'yith_plugin_fw_json_search_terms',
|
137 |
-
security: yith_framework_enhanced_select_params.search_terms_nonce,
|
138 |
-
taxonomy: 'category'
|
139 |
-
},
|
140 |
-
current_data = $.extend( default_data, $( this ).data() ),
|
141 |
-
select2_args = {
|
142 |
-
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
143 |
-
placeholder : $( this ).data( 'placeholder' ),
|
144 |
-
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
145 |
-
escapeMarkup : function ( m ) {
|
146 |
-
return m;
|
147 |
-
},
|
148 |
-
ajax : {
|
149 |
-
url : ajaxurl,
|
150 |
-
dataType : 'json',
|
151 |
-
quietMillis : 250,
|
152 |
-
data : function ( params ) {
|
153 |
-
var default_data_to_return = {
|
154 |
-
term: params.term
|
155 |
-
};
|
156 |
-
|
157 |
-
return $.extend( default_data_to_return, current_data );
|
158 |
-
},
|
159 |
-
processResults: function ( data ) {
|
160 |
-
var terms = [];
|
161 |
-
if ( data ) {
|
162 |
-
$.each( data, function ( id, text ) {
|
163 |
-
terms.push( { id: id, text: text } );
|
164 |
-
} );
|
165 |
-
}
|
166 |
-
return {
|
167 |
-
results: terms
|
168 |
-
};
|
169 |
-
},
|
170 |
-
cache : true
|
171 |
-
}
|
172 |
-
};
|
173 |
-
|
174 |
-
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
175 |
-
|
176 |
-
if ( $( this ).data( 'sortable' ) ) {
|
177 |
-
var $select = $( this );
|
178 |
-
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
179 |
-
|
180 |
-
$list.sortable( {
|
181 |
-
placeholder : 'ui-state-highlight select2-selection__choice',
|
182 |
-
forcePlaceholderSize: true,
|
183 |
-
items : 'li:not(.select2-search__field)',
|
184 |
-
tolerance : 'pointer',
|
185 |
-
stop : function () {
|
186 |
-
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
187 |
-
var id = $( this ).data( 'data' ).id;
|
188 |
-
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
189 |
-
$select.prepend( option );
|
190 |
-
} );
|
191 |
-
}
|
192 |
-
} );
|
193 |
-
}
|
194 |
-
} );
|
195 |
-
|
196 |
-
} ).trigger( 'yith-framework-enhanced-select-init' );
|
197 |
-
|
198 |
} );
|
1 |
+
/* global yith_framework_enhanced_select_params */
|
2 |
+
|
3 |
+
jQuery( document ).ready( function ( $ ) {
|
4 |
+
"use strict";
|
5 |
+
|
6 |
+
$( document.body )
|
7 |
+
.on( 'yith-framework-enhanced-select-init', function () {
|
8 |
+
// Post Search
|
9 |
+
$( '.yith-post-search' ).filter( ':not(.enhanced)' ).each( function () {
|
10 |
+
var default_data = {
|
11 |
+
action : 'yith_plugin_fw_json_search_posts',
|
12 |
+
security : yith_framework_enhanced_select_params.search_posts_nonce,
|
13 |
+
post_type: 'post'
|
14 |
+
},
|
15 |
+
current_data = $.extend( default_data, $( this ).data() ),
|
16 |
+
select2_args = {
|
17 |
+
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
18 |
+
placeholder : $( this ).data( 'placeholder' ),
|
19 |
+
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
20 |
+
escapeMarkup : function ( m ) {
|
21 |
+
return m;
|
22 |
+
},
|
23 |
+
ajax : {
|
24 |
+
url : ajaxurl,
|
25 |
+
dataType : 'json',
|
26 |
+
quietMillis : 250,
|
27 |
+
data : function ( params ) {
|
28 |
+
var default_data_to_return = {
|
29 |
+
term: params.term
|
30 |
+
};
|
31 |
+
|
32 |
+
return $.extend( default_data_to_return, current_data );
|
33 |
+
},
|
34 |
+
processResults: function ( data ) {
|
35 |
+
var terms = [];
|
36 |
+
if ( data ) {
|
37 |
+
$.each( data, function ( id, text ) {
|
38 |
+
terms.push( { id: id, text: text } );
|
39 |
+
} );
|
40 |
+
}
|
41 |
+
return {
|
42 |
+
results: terms
|
43 |
+
};
|
44 |
+
},
|
45 |
+
cache : true
|
46 |
+
}
|
47 |
+
};
|
48 |
+
|
49 |
+
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
50 |
+
|
51 |
+
if ( $( this ).data( 'sortable' ) ) {
|
52 |
+
var $select = $( this );
|
53 |
+
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
54 |
+
|
55 |
+
$list.sortable( {
|
56 |
+
placeholder : 'ui-state-highlight select2-selection__choice',
|
57 |
+
forcePlaceholderSize: true,
|
58 |
+
items : 'li:not(.select2-search__field)',
|
59 |
+
tolerance : 'pointer',
|
60 |
+
stop : function () {
|
61 |
+
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
62 |
+
var id = $( this ).data( 'data' ).id;
|
63 |
+
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
64 |
+
$select.prepend( option );
|
65 |
+
} );
|
66 |
+
}
|
67 |
+
} );
|
68 |
+
}
|
69 |
+
} );
|
70 |
+
|
71 |
+
// Customer Search
|
72 |
+
$( '.yith-customer-search' ).filter( ':not(.enhanced)' ).each( function () {
|
73 |
+
var default_data = {
|
74 |
+
action : 'woocommerce_json_search_customers',
|
75 |
+
security : yith_framework_enhanced_select_params.search_customers_nonce,
|
76 |
+
},
|
77 |
+
current_data = $.extend( default_data, $( this ).data() ),
|
78 |
+
select2_args = {
|
79 |
+
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
80 |
+
placeholder : $( this ).data( 'placeholder' ),
|
81 |
+
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
82 |
+
escapeMarkup : function ( m ) {
|
83 |
+
return m;
|
84 |
+
},
|
85 |
+
ajax : {
|
86 |
+
url : ajaxurl,
|
87 |
+
dataType : 'json',
|
88 |
+
quietMillis : 250,
|
89 |
+
data : function ( params ) {
|
90 |
+
var default_data_to_return = {
|
91 |
+
term: params.term
|
92 |
+
};
|
93 |
+
|
94 |
+
return $.extend( default_data_to_return, current_data );
|
95 |
+
},
|
96 |
+
processResults: function ( data ) {
|
97 |
+
var terms = [];
|
98 |
+
if ( data ) {
|
99 |
+
$.each( data, function ( id, text ) {
|
100 |
+
terms.push( { id: id, text: text } );
|
101 |
+
} );
|
102 |
+
}
|
103 |
+
return {
|
104 |
+
results: terms
|
105 |
+
};
|
106 |
+
},
|
107 |
+
cache : true
|
108 |
+
}
|
109 |
+
};
|
110 |
+
|
111 |
+
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
112 |
+
|
113 |
+
if ( $( this ).data( 'sortable' ) ) {
|
114 |
+
var $select = $( this );
|
115 |
+
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
116 |
+
|
117 |
+
$list.sortable( {
|
118 |
+
placeholder : 'ui-state-highlight select2-selection__choice',
|
119 |
+
forcePlaceholderSize: true,
|
120 |
+
items : 'li:not(.select2-search__field)',
|
121 |
+
tolerance : 'pointer',
|
122 |
+
stop : function () {
|
123 |
+
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
124 |
+
var id = $( this ).data( 'data' ).id;
|
125 |
+
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
126 |
+
$select.prepend( option );
|
127 |
+
} );
|
128 |
+
}
|
129 |
+
} );
|
130 |
+
}
|
131 |
+
} );
|
132 |
+
|
133 |
+
// TERM SEARCH
|
134 |
+
$( '.yith-term-search' ).filter( ':not(.enhanced)' ).each( function () {
|
135 |
+
var default_data = {
|
136 |
+
action : 'yith_plugin_fw_json_search_terms',
|
137 |
+
security: yith_framework_enhanced_select_params.search_terms_nonce,
|
138 |
+
taxonomy: 'category'
|
139 |
+
},
|
140 |
+
current_data = $.extend( default_data, $( this ).data() ),
|
141 |
+
select2_args = {
|
142 |
+
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
|
143 |
+
placeholder : $( this ).data( 'placeholder' ),
|
144 |
+
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
|
145 |
+
escapeMarkup : function ( m ) {
|
146 |
+
return m;
|
147 |
+
},
|
148 |
+
ajax : {
|
149 |
+
url : ajaxurl,
|
150 |
+
dataType : 'json',
|
151 |
+
quietMillis : 250,
|
152 |
+
data : function ( params ) {
|
153 |
+
var default_data_to_return = {
|
154 |
+
term: params.term
|
155 |
+
};
|
156 |
+
|
157 |
+
return $.extend( default_data_to_return, current_data );
|
158 |
+
},
|
159 |
+
processResults: function ( data ) {
|
160 |
+
var terms = [];
|
161 |
+
if ( data ) {
|
162 |
+
$.each( data, function ( id, text ) {
|
163 |
+
terms.push( { id: id, text: text } );
|
164 |
+
} );
|
165 |
+
}
|
166 |
+
return {
|
167 |
+
results: terms
|
168 |
+
};
|
169 |
+
},
|
170 |
+
cache : true
|
171 |
+
}
|
172 |
+
};
|
173 |
+
|
174 |
+
$( this ).select2( select2_args ).addClass( 'enhanced' );
|
175 |
+
|
176 |
+
if ( $( this ).data( 'sortable' ) ) {
|
177 |
+
var $select = $( this );
|
178 |
+
var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
|
179 |
+
|
180 |
+
$list.sortable( {
|
181 |
+
placeholder : 'ui-state-highlight select2-selection__choice',
|
182 |
+
forcePlaceholderSize: true,
|
183 |
+
items : 'li:not(.select2-search__field)',
|
184 |
+
tolerance : 'pointer',
|
185 |
+
stop : function () {
|
186 |
+
$( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function () {
|
187 |
+
var id = $( this ).data( 'data' ).id;
|
188 |
+
var option = $select.find( 'option[value="' + id + '"]' )[ 0 ];
|
189 |
+
$select.prepend( option );
|
190 |
+
} );
|
191 |
+
}
|
192 |
+
} );
|
193 |
+
}
|
194 |
+
} );
|
195 |
+
|
196 |
+
} ).trigger( 'yith-framework-enhanced-select-init' );
|
197 |
+
|
198 |
} );
|
plugin-fw/assets/js/yith-fields.js
CHANGED
@@ -1,706 +1,706 @@
|
|
1 |
-
|
2 |
-
jQuery( function ( $ ) {
|
3 |
-
|
4 |
-
/* global yith_framework_fw_fields*/
|
5 |
-
|
6 |
-
var yith_fields_init = function () {
|
7 |
-
var $datepicker = $( '.yith-plugin-fw-datepicker' ),
|
8 |
-
$colorpicker = $( '.yith-plugin-fw-colorpicker' ),
|
9 |
-
$upload = {
|
10 |
-
imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
|
11 |
-
uploadButtonHandler: '.yith-plugin-fw-upload-button',
|
12 |
-
imgUrlHandler : '.yith-plugin-fw-upload-img-url',
|
13 |
-
resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
|
14 |
-
imgUrl : $( '.yith-plugin-fw-upload-img-url' )
|
15 |
-
},
|
16 |
-
$wpAddMedia = $( '.add_media' ),
|
17 |
-
$imageGallery = {
|
18 |
-
sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
|
19 |
-
buttonHandler: '.yith-plugin-fw .image-gallery-button'
|
20 |
-
},
|
21 |
-
$sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
|
22 |
-
$slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
|
23 |
-
$codemirror = $( '.codemirror' ),
|
24 |
-
$icons = $( '.yit-icons-manager-wrapper' ),
|
25 |
-
$checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
|
26 |
-
|
27 |
-
/* Datepicker */
|
28 |
-
$datepicker.each( function () {
|
29 |
-
var args = $( this ).data();
|
30 |
-
$( this ).datepicker( args );
|
31 |
-
} );
|
32 |
-
|
33 |
-
/* Colorpicker */
|
34 |
-
$colorpicker.wpColorPicker( {
|
35 |
-
palettes: false,
|
36 |
-
width : 200,
|
37 |
-
mode : 'hsl',
|
38 |
-
clear : function () {
|
39 |
-
var input = $( this );
|
40 |
-
input.val( input.data( 'default-color' ) );
|
41 |
-
input.change();
|
42 |
-
}
|
43 |
-
} );
|
44 |
-
|
45 |
-
|
46 |
-
$colorpicker.each( function () {
|
47 |
-
var select_label = $( this ).data( 'variations-label' ),
|
48 |
-
wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
|
49 |
-
wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
|
50 |
-
wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
|
51 |
-
wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
|
52 |
-
|
53 |
-
wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
54 |
-
wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
55 |
-
|
56 |
-
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
57 |
-
var button = $( '<span/>' ).attr( {
|
58 |
-
class: "wp-picker-default-custom"
|
59 |
-
} );
|
60 |
-
wrap1.find( '.wp-picker-default' ).wrap( button );
|
61 |
-
}
|
62 |
-
|
63 |
-
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
64 |
-
var button = $( '<span/>' ).attr( {
|
65 |
-
class: "wp-picker-default-custom"
|
66 |
-
} );
|
67 |
-
wrap2.find( '.wp-picker-default' ).wrap( button );
|
68 |
-
}
|
69 |
-
} );
|
70 |
-
|
71 |
-
|
72 |
-
/* Upload */
|
73 |
-
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
74 |
-
var _custom_media = true;
|
75 |
-
// preview
|
76 |
-
$upload.imgUrl.change( function () {
|
77 |
-
var url = $( this ).val(),
|
78 |
-
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)" ),
|
79 |
-
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
80 |
-
|
81 |
-
if ( preview.length < 1 ) {
|
82 |
-
preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
|
83 |
-
}
|
84 |
-
|
85 |
-
if ( re.test( url ) ) {
|
86 |
-
preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
|
87 |
-
} else {
|
88 |
-
preview.html( '' );
|
89 |
-
}
|
90 |
-
} ).trigger( 'change' );
|
91 |
-
|
92 |
-
$( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
|
93 |
-
e.preventDefault();
|
94 |
-
|
95 |
-
var t = $( this ),
|
96 |
-
custom_uploader,
|
97 |
-
id = t.attr( 'id' ).replace( /-button$/, '' );
|
98 |
-
|
99 |
-
//If the uploader object has already been created, reopen the dialog
|
100 |
-
if ( custom_uploader ) {
|
101 |
-
custom_uploader.open();
|
102 |
-
return;
|
103 |
-
}
|
104 |
-
|
105 |
-
var custom_uploader_states = [
|
106 |
-
// Main states.
|
107 |
-
new wp.media.controller.Library( {
|
108 |
-
library : wp.media.query(),
|
109 |
-
multiple : false,
|
110 |
-
title : 'Choose Image',
|
111 |
-
priority : 20,
|
112 |
-
filterable: 'uploaded'
|
113 |
-
} )
|
114 |
-
];
|
115 |
-
|
116 |
-
// Create the media frame.
|
117 |
-
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
118 |
-
// Set the title of the modal.
|
119 |
-
title : 'Choose Image',
|
120 |
-
library : {
|
121 |
-
type: ''
|
122 |
-
},
|
123 |
-
button : {
|
124 |
-
text: 'Choose Image'
|
125 |
-
},
|
126 |
-
multiple: false,
|
127 |
-
states : custom_uploader_states
|
128 |
-
} );
|
129 |
-
|
130 |
-
//When a file is selected, grab the URL and set it as the text field's value
|
131 |
-
custom_uploader.on( 'select', function () {
|
132 |
-
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
133 |
-
|
134 |
-
$( "#" + id ).val( attachment.url );
|
135 |
-
// Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
|
136 |
-
if ( $( "#" + id + "-yith-attachment-id" ) ) {
|
137 |
-
$( "#" + id + "-yith-attachment-id" ).val( attachment.id );
|
138 |
-
}
|
139 |
-
$upload.imgUrl.trigger( 'change' );
|
140 |
-
} );
|
141 |
-
|
142 |
-
//Open the uploader dialog
|
143 |
-
custom_uploader.open();
|
144 |
-
} );
|
145 |
-
|
146 |
-
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
147 |
-
var t = $( this ),
|
148 |
-
id = t.attr( 'id' ),
|
149 |
-
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
150 |
-
default_value = $( '#' + id ).data( 'default' );
|
151 |
-
|
152 |
-
$( "#" + input_id ).val( default_value );
|
153 |
-
$upload.imgUrl.trigger( 'change' );
|
154 |
-
} );
|
155 |
-
}
|
156 |
-
|
157 |
-
$wpAddMedia.on( 'click', function () {
|
158 |
-
_custom_media = false;
|
159 |
-
} );
|
160 |
-
|
161 |
-
/* Image Gallery */
|
162 |
-
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
163 |
-
$( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
|
164 |
-
var $t = $( this ),
|
165 |
-
$container = $t.closest( '.image-gallery' ),
|
166 |
-
$image_gallery_ids = $container.find( '.image_gallery_ids' ),
|
167 |
-
attachment_ids = $image_gallery_ids.val(),
|
168 |
-
$gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
|
169 |
-
|
170 |
-
// Create the media frame.
|
171 |
-
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
172 |
-
// Set the title of the modal.
|
173 |
-
title : $t.data( 'choose' ),
|
174 |
-
button: {
|
175 |
-
text: $t.data( 'update' )
|
176 |
-
},
|
177 |
-
states: [
|
178 |
-
new wp.media.controller.Library( {
|
179 |
-
title : $t.data( 'choose' ),
|
180 |
-
filterable: 'all',
|
181 |
-
multiple : true
|
182 |
-
} )
|
183 |
-
]
|
184 |
-
} );
|
185 |
-
|
186 |
-
// When an image is selected, run a callback.
|
187 |
-
image_gallery_frame.on( 'select', function () {
|
188 |
-
var selection = image_gallery_frame.state().get( 'selection' );
|
189 |
-
selection.map( function ( attachment ) {
|
190 |
-
attachment = attachment.toJSON();
|
191 |
-
|
192 |
-
if ( attachment.id ) {
|
193 |
-
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
|
194 |
-
$gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
|
195 |
-
}
|
196 |
-
} );
|
197 |
-
|
198 |
-
$image_gallery_ids.val( attachment_ids );
|
199 |
-
} );
|
200 |
-
|
201 |
-
image_gallery_frame.open();
|
202 |
-
|
203 |
-
} );
|
204 |
-
|
205 |
-
// Image ordering
|
206 |
-
$imageGallery.sliderWrapper.each( function () {
|
207 |
-
var $t = $( this );
|
208 |
-
$t.sortable( {
|
209 |
-
items : 'li.image',
|
210 |
-
cursor : 'move',
|
211 |
-
scrollSensitivity : 40,
|
212 |
-
forcePlaceholderSize: true,
|
213 |
-
forceHelperSize : false,
|
214 |
-
helper : 'clone',
|
215 |
-
opacity : 0.65,
|
216 |
-
start : function ( event, ui ) {
|
217 |
-
ui.item.css( 'background-color', '#f6f6f6' );
|
218 |
-
},
|
219 |
-
stop : function ( event, ui ) {
|
220 |
-
ui.item.removeAttr( 'style' );
|
221 |
-
},
|
222 |
-
update : function ( event, ui ) {
|
223 |
-
var attachment_ids = '';
|
224 |
-
|
225 |
-
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
226 |
-
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
227 |
-
attachment_ids = attachment_ids + attachment_id + ',';
|
228 |
-
} );
|
229 |
-
|
230 |
-
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
231 |
-
}
|
232 |
-
} );
|
233 |
-
} );
|
234 |
-
|
235 |
-
// Remove images
|
236 |
-
$imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
|
237 |
-
var $wrapper = $( this ).closest( '.image-gallery' ),
|
238 |
-
$gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
|
239 |
-
$image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
|
240 |
-
attachment_ids = '';
|
241 |
-
|
242 |
-
$( this ).closest( 'li.image' ).remove();
|
243 |
-
|
244 |
-
$gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
245 |
-
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
246 |
-
attachment_ids = attachment_ids + attachment_id + ',';
|
247 |
-
} );
|
248 |
-
|
249 |
-
$image_gallery_ids.val( attachment_ids );
|
250 |
-
} );
|
251 |
-
}
|
252 |
-
|
253 |
-
|
254 |
-
/* Sidebars */
|
255 |
-
$sidebars.each( function () {
|
256 |
-
var $images = $( this ).find( 'img' );
|
257 |
-
$images.on( 'click', function () {
|
258 |
-
var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
|
259 |
-
$left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
|
260 |
-
$right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
|
261 |
-
type = $( this ).data( 'type' );
|
262 |
-
|
263 |
-
$( this ).parent().children( ':radio' ).attr( 'checked', false );
|
264 |
-
$( this ).prev( ':radio' ).attr( 'checked', true );
|
265 |
-
|
266 |
-
if ( typeof type != 'undefined' ) {
|
267 |
-
switch ( type ) {
|
268 |
-
case 'left':
|
269 |
-
$left.show();
|
270 |
-
$right.hide();
|
271 |
-
break;
|
272 |
-
case 'right':
|
273 |
-
$right.show();
|
274 |
-
$left.hide();
|
275 |
-
break;
|
276 |
-
case 'double':
|
277 |
-
$left.show();
|
278 |
-
$right.show();
|
279 |
-
break;
|
280 |
-
default:
|
281 |
-
$left.hide();
|
282 |
-
$right.hide();
|
283 |
-
break;
|
284 |
-
}
|
285 |
-
}
|
286 |
-
} );
|
287 |
-
} );
|
288 |
-
|
289 |
-
/* Slider */
|
290 |
-
$slider.each( function () {
|
291 |
-
var val = $( this ).data( 'val' ),
|
292 |
-
minValue = $( this ).data( 'min' ),
|
293 |
-
maxValue = $( this ).data( 'max' ),
|
294 |
-
step = $( this ).data( 'step' ),
|
295 |
-
labels = $( this ).data( 'labels' );
|
296 |
-
|
297 |
-
$( this ).slider( {
|
298 |
-
value: val,
|
299 |
-
min : minValue,
|
300 |
-
max : maxValue,
|
301 |
-
range: 'min',
|
302 |
-
step : step,
|
303 |
-
|
304 |
-
create: function () {
|
305 |
-
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
306 |
-
},
|
307 |
-
|
308 |
-
|
309 |
-
slide: function ( event, ui ) {
|
310 |
-
$( this ).find( 'input' ).val( ui.value );
|
311 |
-
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
312 |
-
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
313 |
-
}
|
314 |
-
} );
|
315 |
-
} );
|
316 |
-
|
317 |
-
/* codemirror */
|
318 |
-
$codemirror.each( function ( i, v ) {
|
319 |
-
var editor = CodeMirror.fromTextArea( v, {
|
320 |
-
lineNumbers : 1,
|
321 |
-
mode : 'javascript',
|
322 |
-
showCursorWhenSelecting: true
|
323 |
-
} );
|
324 |
-
|
325 |
-
$( v ).data( 'codemirrorInstance', editor );
|
326 |
-
} );
|
327 |
-
|
328 |
-
/* Select All - Deselect All */
|
329 |
-
$( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
|
330 |
-
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
331 |
-
$targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
|
332 |
-
} );
|
333 |
-
|
334 |
-
$( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
|
335 |
-
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
336 |
-
$targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
|
337 |
-
} );
|
338 |
-
|
339 |
-
|
340 |
-
$icons.each( function () {
|
341 |
-
var $container = $( this ),
|
342 |
-
$preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
|
343 |
-
$text = $container.find( '.yit-icons-manager-icon-text' );
|
344 |
-
|
345 |
-
$container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
|
346 |
-
var $target = $( event.target ).closest( 'li' ),
|
347 |
-
font = $target.data( 'font' ),
|
348 |
-
icon = $target.data( 'icon' ),
|
349 |
-
key = $target.data( 'key' ),
|
350 |
-
name = $target.data( 'name' );
|
351 |
-
|
352 |
-
$preview.attr( 'data-font', font );
|
353 |
-
$preview.attr( 'data-icon', icon );
|
354 |
-
$preview.attr( 'data-key', key );
|
355 |
-
$preview.attr( 'data-name', name );
|
356 |
-
|
357 |
-
$text.val( font + ':' + name );
|
358 |
-
|
359 |
-
$container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
|
360 |
-
$target.addClass( 'active' );
|
361 |
-
} );
|
362 |
-
|
363 |
-
$container.on( 'click', '.yit-icons-manager-action-set-default', function () {
|
364 |
-
$container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
|
365 |
-
} );
|
366 |
-
} );
|
367 |
-
|
368 |
-
/** Select Images */
|
369 |
-
$( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
|
370 |
-
var item = $( this ),
|
371 |
-
key = item.data( 'key' ),
|
372 |
-
wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
|
373 |
-
items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
|
374 |
-
select = wrapper.find( 'select' ).first();
|
375 |
-
|
376 |
-
if ( select.length ) {
|
377 |
-
select.val( key );
|
378 |
-
items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
|
379 |
-
item.addClass( 'yith-plugin-fw-select-images__item--selected' );
|
380 |
-
}
|
381 |
-
} );
|
382 |
-
|
383 |
-
$( document.body ).trigger( 'wc-enhanced-select-init' );
|
384 |
-
|
385 |
-
$( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
|
386 |
-
{
|
387 |
-
cursor : 'move',
|
388 |
-
axis : 'y',
|
389 |
-
scrollSensitivity : 40,
|
390 |
-
forcePlaceholderSize: true,
|
391 |
-
helper : 'clone',
|
392 |
-
|
393 |
-
stop: function ( event, ui ) {
|
394 |
-
var keys = jQuery( '.ui-sortable-handle' ),
|
395 |
-
i = 0,
|
396 |
-
array_keys = new Array();
|
397 |
-
for ( i = 0; i < keys.length; i++ ) {
|
398 |
-
array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
|
399 |
-
}
|
400 |
-
if ( array_keys.length > 0 ) {
|
401 |
-
var toggle = $( this ).closest( '.toggle-element' );
|
402 |
-
toggle.saveToggleElement( null, array_keys );
|
403 |
-
}
|
404 |
-
}
|
405 |
-
}
|
406 |
-
);
|
407 |
-
|
408 |
-
$( document.body ).trigger( 'yith-framework-enhanced-select-init' );
|
409 |
-
};
|
410 |
-
|
411 |
-
yith_fields_init();
|
412 |
-
|
413 |
-
/* on-off */
|
414 |
-
$( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
|
415 |
-
var input = $( this ).prev( 'input' ),
|
416 |
-
checked = input.prop( 'checked' );
|
417 |
-
|
418 |
-
if ( checked ) {
|
419 |
-
input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
|
420 |
-
} else {
|
421 |
-
input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
|
422 |
-
}
|
423 |
-
|
424 |
-
input.change();
|
425 |
-
} );
|
426 |
-
|
427 |
-
|
428 |
-
/** Toggle **/
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
//TOGGLE ELEMENT
|
433 |
-
$.fn.saveToggleElement = function ( spinner, array_keys ) {
|
434 |
-
var toggle = $( this ),
|
435 |
-
action = 'yith_plugin_fw_save_toggle_element',
|
436 |
-
formdata = toggle.serializeToggleElement(),
|
437 |
-
wrapper = toggle.find( '.yith-toggle_wrapper' ),
|
438 |
-
id = wrapper.attr( 'id' ),
|
439 |
-
current_tab = $.urlParam( 'tab' );
|
440 |
-
|
441 |
-
formdata.append( 'security', wrapper.data('nonce') );
|
442 |
-
|
443 |
-
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
444 |
-
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
445 |
-
}
|
446 |
-
|
447 |
-
if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
|
448 |
-
action = 'yith_plugin_fw_save_toggle_element_metabox';
|
449 |
-
post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
|
450 |
-
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
451 |
-
url = yith_framework_fw_fields.ajax_url + '?action=' + action + "&post_ID=" + post_id + '&yit_metaboxes_nonce=' + yit_metaboxes_nonce + "&toggle_id=" + id;
|
452 |
-
} else {
|
453 |
-
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
454 |
-
}
|
455 |
-
|
456 |
-
$.ajax( {
|
457 |
-
type : "POST",
|
458 |
-
url : url,
|
459 |
-
data : formdata,
|
460 |
-
contentType: false,
|
461 |
-
processData: false,
|
462 |
-
success : function ( result ) {
|
463 |
-
if ( spinner ) {
|
464 |
-
spinner.removeClass( 'show' );
|
465 |
-
}
|
466 |
-
|
467 |
-
$( document ).trigger( 'yith_save_toggle_element_done', [ result, toggle ] );
|
468 |
-
}
|
469 |
-
} );
|
470 |
-
};
|
471 |
-
|
472 |
-
$.fn.serializeToggleElement = function () {
|
473 |
-
var obj = $( this );
|
474 |
-
/* ADD FILE TO PARAM AJAX */
|
475 |
-
var formData = new FormData();
|
476 |
-
var params = $( obj ).find( ":input" ).serializeArray();
|
477 |
-
|
478 |
-
$.each( params, function ( i, val ) {
|
479 |
-
el_name = val.name;
|
480 |
-
formData.append( val.name, val.value );
|
481 |
-
} );
|
482 |
-
|
483 |
-
return formData;
|
484 |
-
};
|
485 |
-
|
486 |
-
$.fn.formatToggleTitle = function () {
|
487 |
-
var toggle_el = $( this ),
|
488 |
-
fields = toggle_el.find( ':input' ),
|
489 |
-
title = toggle_el.find( 'span.title' ).data( 'title_format' ),
|
490 |
-
subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
|
491 |
-
regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
|
492 |
-
|
493 |
-
if ( typeof title != 'undefined' ) {
|
494 |
-
var res = title.match( regExp );
|
495 |
-
}
|
496 |
-
|
497 |
-
if ( typeof subtitle != 'undefined' ) {
|
498 |
-
var ressub = subtitle.match( regExp );
|
499 |
-
}
|
500 |
-
|
501 |
-
$.each( fields, function ( i, field ) {
|
502 |
-
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
503 |
-
$field_id = $( field ).attr( 'id' );
|
504 |
-
$field_array = $field_id.split( '_' );
|
505 |
-
$field_array.pop();
|
506 |
-
$field_id = $field_array.join( '_' );
|
507 |
-
$field_val = $( field ).val();
|
508 |
-
|
509 |
-
if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
|
510 |
-
title = title.replace( '%%' + $field_id + '%%', $field_val );
|
511 |
-
}
|
512 |
-
if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
|
513 |
-
subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
|
514 |
-
}
|
515 |
-
}
|
516 |
-
} );
|
517 |
-
|
518 |
-
if ( '' !== title ) {
|
519 |
-
toggle_el.find( 'span.title' ).html( title );
|
520 |
-
}
|
521 |
-
|
522 |
-
if ( '' !== subtitle ) {
|
523 |
-
toggle_el.find( '.subtitle' ).html( subtitle );
|
524 |
-
}
|
525 |
-
|
526 |
-
$( document ).trigger( 'yith-toggle-element-item-title', [ toggle_el ] );
|
527 |
-
};
|
528 |
-
|
529 |
-
$.urlParam = function ( name ) {
|
530 |
-
var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
|
531 |
-
.exec( window.location.search );
|
532 |
-
|
533 |
-
return ( results !== null ) ? results[ 1 ] || 0 : false;
|
534 |
-
};
|
535 |
-
|
536 |
-
$( document ).on( 'click', '.yith-toggle-title', function ( event ) {
|
537 |
-
var _toggle = $( event.target ),
|
538 |
-
_section = _toggle.closest( '.yith-toggle-row' ),
|
539 |
-
_content = _section.find( '.yith-toggle-content' );
|
540 |
-
|
541 |
-
if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'yith-icon-drag' ) ) {
|
542 |
-
return false;
|
543 |
-
}
|
544 |
-
|
545 |
-
if ( _section.is( '.yith-toggle-row-opened' ) ) {
|
546 |
-
_content.slideUp( 400 );
|
547 |
-
} else {
|
548 |
-
_content.slideDown( 400 );
|
549 |
-
}
|
550 |
-
_section.toggleClass( 'yith-toggle-row-opened' );
|
551 |
-
} );
|
552 |
-
|
553 |
-
/**Add new box toggle**/
|
554 |
-
$( document ).on( 'click', '.yith-add-box-button', function ( event ) {
|
555 |
-
event.preventDefault();
|
556 |
-
var $this = $( this ),
|
557 |
-
target_id = $this.data( 'box_id' ),
|
558 |
-
closed_label = $this.data('closed_label'),
|
559 |
-
label = $this.data('opened_label'),
|
560 |
-
id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' );
|
561 |
-
template = wp.template( 'yith-toggle-element-add-box-content-' + id );
|
562 |
-
|
563 |
-
if ( '' !== target_id ) {
|
564 |
-
$( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
|
565 |
-
if (closed_label !== '') {
|
566 |
-
if ($this.html() === closed_label) {
|
567 |
-
$this.html(label).removeClass('closed');
|
568 |
-
} else {
|
569 |
-
$this.html(closed_label).addClass('closed');
|
570 |
-
}
|
571 |
-
}
|
572 |
-
|
573 |
-
yith_fields_init();
|
574 |
-
$( document ).trigger( 'yith-add-box-button-toggle', [ $this ] );
|
575 |
-
}
|
576 |
-
} );
|
577 |
-
|
578 |
-
$( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
|
579 |
-
|
580 |
-
event.preventDefault();
|
581 |
-
var add_box = $( this ).parents( '.yith-add-box' ),
|
582 |
-
id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
|
583 |
-
spinner = add_box.find( '.spinner' ),
|
584 |
-
toggle_element = $( this ).parents( '.toggle-element' ),
|
585 |
-
fields = add_box.find( ':input' ),
|
586 |
-
counter = toggle_element.find( '.yith-toggle-row' ).length,
|
587 |
-
hidden_obj = $( '<input type="hidden">' );
|
588 |
-
|
589 |
-
hidden_obj.val( counter );
|
590 |
-
|
591 |
-
$( document ).trigger( 'yith-toggle-change-counter', [ hidden_obj, add_box ] );
|
592 |
-
|
593 |
-
counter = hidden_obj.val();
|
594 |
-
var template = wp.template( 'yith-toggle-element-item-' + id ),
|
595 |
-
toggle_el = $( template( { index: counter } ) );
|
596 |
-
|
597 |
-
spinner.addClass( 'show' );
|
598 |
-
|
599 |
-
$.each( fields, function ( i, field ) {
|
600 |
-
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
601 |
-
|
602 |
-
$field_id = $( field ).attr( 'id' );
|
603 |
-
$field_val = $( field ).val();
|
604 |
-
|
605 |
-
if ( 'radio' == $( field ).attr( 'type' ) ) {
|
606 |
-
$field_id = $field_id.replace( 'new_', '' );
|
607 |
-
$field_id = $field_id.replace( '-' + $field_val, '' );
|
608 |
-
$field_id = $field_id + '_dataindex-' + $field_val;
|
609 |
-
} else {
|
610 |
-
$field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
|
611 |
-
}
|
612 |
-
|
613 |
-
if ( $( field ).is( ':checked' ) ) {
|
614 |
-
$( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
|
615 |
-
}
|
616 |
-
|
617 |
-
if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
|
618 |
-
$( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
|
619 |
-
}
|
620 |
-
|
621 |
-
$( toggle_el ).find( '#' + $field_id ).val( $field_val );
|
622 |
-
|
623 |
-
}
|
624 |
-
|
625 |
-
} );
|
626 |
-
|
627 |
-
$( toggle_el ).formatToggleTitle();
|
628 |
-
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
629 |
-
$( document ).trigger( 'yith-toggle-element-item-before-add', [ add_box, toggle_el, form_is_valid ] );
|
630 |
-
|
631 |
-
var delayInMilliseconds =1000; //1 second
|
632 |
-
setTimeout(function() {
|
633 |
-
if ( form_is_valid.val() === 'yes' ) {
|
634 |
-
$( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
|
635 |
-
$( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
|
636 |
-
$( add_box ).html( '' );
|
637 |
-
$( add_box ).prev('.yith-add-box-button').trigger('click');
|
638 |
-
toggle_element.saveToggleElement();
|
639 |
-
|
640 |
-
var delayInMilliseconds =2000; //1 second
|
641 |
-
setTimeout(function() {
|
642 |
-
$( toggle_element ).find('.highlight').removeClass('highlight');
|
643 |
-
}, delayInMilliseconds);
|
644 |
-
|
645 |
-
|
646 |
-
yith_fields_init();
|
647 |
-
}
|
648 |
-
}, delayInMilliseconds );
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
} );
|
653 |
-
|
654 |
-
$( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
|
655 |
-
event.preventDefault();
|
656 |
-
var toggle = $( this ).closest( '.toggle-element' ),
|
657 |
-
toggle_row = $( this ).closest( '.yith-toggle-row' ),
|
658 |
-
spinner = toggle_row.find( '.spinner' );
|
659 |
-
toggle_row.formatToggleTitle();
|
660 |
-
|
661 |
-
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
662 |
-
$( document ).trigger( 'yith-toggle-element-item-before-update', [ toggle, toggle_row, form_is_valid ] );
|
663 |
-
if ( form_is_valid.val() === 'yes' ) {
|
664 |
-
spinner.addClass( 'show' );
|
665 |
-
toggle.saveToggleElement( spinner );
|
666 |
-
}
|
667 |
-
} );
|
668 |
-
|
669 |
-
//register remove the dome and save the toggle
|
670 |
-
$( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
|
671 |
-
event.preventDefault();
|
672 |
-
var toggle = $( this ).closest( '.toggle-element' ),
|
673 |
-
toggle_row = $( this ).closest( '.yith-toggle-row' );
|
674 |
-
toggle_row.remove();
|
675 |
-
toggle.saveToggleElement();
|
676 |
-
} );
|
677 |
-
|
678 |
-
//register onoff status
|
679 |
-
$( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
|
680 |
-
event.preventDefault();
|
681 |
-
var toggle = $( this ).closest( '.toggle-element' );
|
682 |
-
toggle.saveToggleElement();
|
683 |
-
} );
|
684 |
-
|
685 |
-
// Radio
|
686 |
-
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
687 |
-
$( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
|
688 |
-
} );
|
689 |
-
|
690 |
-
$(document).on('click', '.yith-password-eye', function () {
|
691 |
-
var $this = $(this),
|
692 |
-
inp = $(this).closest('.yith-password-wrapper').find('input');
|
693 |
-
if (inp.attr('type') === "password") {
|
694 |
-
inp.attr('type', 'text');
|
695 |
-
$this.addClass('yith-password-eye-closed');
|
696 |
-
} else {
|
697 |
-
inp.attr('type', 'password');
|
698 |
-
$this.removeClass('yith-password-eye-closed');
|
699 |
-
}
|
700 |
-
});
|
701 |
-
|
702 |
-
$( '.yith-plugin-fw-radio' ).each( function () {
|
703 |
-
$( this ).val( $( this ).attr( 'value' ) );
|
704 |
-
} );
|
705 |
-
|
706 |
} );
|
1 |
+
|
2 |
+
jQuery( function ( $ ) {
|
3 |
+
|
4 |
+
/* global yith_framework_fw_fields*/
|
5 |
+
|
6 |
+
var yith_fields_init = function () {
|
7 |
+
var $datepicker = $( '.yith-plugin-fw-datepicker' ),
|
8 |
+
$colorpicker = $( '.yith-plugin-fw-colorpicker' ),
|
9 |
+
$upload = {
|
10 |
+
imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
|
11 |
+
uploadButtonHandler: '.yith-plugin-fw-upload-button',
|
12 |
+
imgUrlHandler : '.yith-plugin-fw-upload-img-url',
|
13 |
+
resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
|
14 |
+
imgUrl : $( '.yith-plugin-fw-upload-img-url' )
|
15 |
+
},
|
16 |
+
$wpAddMedia = $( '.add_media' ),
|
17 |
+
$imageGallery = {
|
18 |
+
sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
|
19 |
+
buttonHandler: '.yith-plugin-fw .image-gallery-button'
|
20 |
+
},
|
21 |
+
$sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
|
22 |
+
$slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
|
23 |
+
$codemirror = $( '.codemirror' ),
|
24 |
+
$icons = $( '.yit-icons-manager-wrapper' ),
|
25 |
+
$checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
|
26 |
+
|
27 |
+
/* Datepicker */
|
28 |
+
$datepicker.each( function () {
|
29 |
+
var args = $( this ).data();
|
30 |
+
$( this ).datepicker( args );
|
31 |
+
} );
|
32 |
+
|
33 |
+
/* Colorpicker */
|
34 |
+
$colorpicker.wpColorPicker( {
|
35 |
+
palettes: false,
|
36 |
+
width : 200,
|
37 |
+
mode : 'hsl',
|
38 |
+
clear : function () {
|
39 |
+
var input = $( this );
|
40 |
+
input.val( input.data( 'default-color' ) );
|
41 |
+
input.change();
|
42 |
+
}
|
43 |
+
} );
|
44 |
+
|
45 |
+
|
46 |
+
$colorpicker.each( function () {
|
47 |
+
var select_label = $( this ).data( 'variations-label' ),
|
48 |
+
wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
|
49 |
+
wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
|
50 |
+
wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
|
51 |
+
wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
|
52 |
+
|
53 |
+
wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
54 |
+
wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
|
55 |
+
|
56 |
+
if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
|
57 |
+
var button = $( '<span/>' ).attr( {
|
58 |
+
class: "wp-picker-default-custom"
|
59 |
+
} );
|
60 |
+
wrap1.find( '.wp-picker-default' ).wrap( button );
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
|
64 |
+
var button = $( '<span/>' ).attr( {
|
65 |
+
class: "wp-picker-default-custom"
|
66 |
+
} );
|
67 |
+
wrap2.find( '.wp-picker-default' ).wrap( button );
|
68 |
+
}
|
69 |
+
} );
|
70 |
+
|
71 |
+
|
72 |
+
/* Upload */
|
73 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
74 |
+
var _custom_media = true;
|
75 |
+
// preview
|
76 |
+
$upload.imgUrl.change( function () {
|
77 |
+
var url = $( this ).val(),
|
78 |
+
re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)" ),
|
79 |
+
preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
|
80 |
+
|
81 |
+
if ( preview.length < 1 ) {
|
82 |
+
preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( re.test( url ) ) {
|
86 |
+
preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
|
87 |
+
} else {
|
88 |
+
preview.html( '' );
|
89 |
+
}
|
90 |
+
} ).trigger( 'change' );
|
91 |
+
|
92 |
+
$( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
|
93 |
+
e.preventDefault();
|
94 |
+
|
95 |
+
var t = $( this ),
|
96 |
+
custom_uploader,
|
97 |
+
id = t.attr( 'id' ).replace( /-button$/, '' );
|
98 |
+
|
99 |
+
//If the uploader object has already been created, reopen the dialog
|
100 |
+
if ( custom_uploader ) {
|
101 |
+
custom_uploader.open();
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
|
105 |
+
var custom_uploader_states = [
|
106 |
+
// Main states.
|
107 |
+
new wp.media.controller.Library( {
|
108 |
+
library : wp.media.query(),
|
109 |
+
multiple : false,
|
110 |
+
title : 'Choose Image',
|
111 |
+
priority : 20,
|
112 |
+
filterable: 'uploaded'
|
113 |
+
} )
|
114 |
+
];
|
115 |
+
|
116 |
+
// Create the media frame.
|
117 |
+
custom_uploader = wp.media.frames.downloadable_file = wp.media( {
|
118 |
+
// Set the title of the modal.
|
119 |
+
title : 'Choose Image',
|
120 |
+
library : {
|
121 |
+
type: ''
|
122 |
+
},
|
123 |
+
button : {
|
124 |
+
text: 'Choose Image'
|
125 |
+
},
|
126 |
+
multiple: false,
|
127 |
+
states : custom_uploader_states
|
128 |
+
} );
|
129 |
+
|
130 |
+
//When a file is selected, grab the URL and set it as the text field's value
|
131 |
+
custom_uploader.on( 'select', function () {
|
132 |
+
var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
|
133 |
+
|
134 |
+
$( "#" + id ).val( attachment.url );
|
135 |
+
// Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
|
136 |
+
if ( $( "#" + id + "-yith-attachment-id" ) ) {
|
137 |
+
$( "#" + id + "-yith-attachment-id" ).val( attachment.id );
|
138 |
+
}
|
139 |
+
$upload.imgUrl.trigger( 'change' );
|
140 |
+
} );
|
141 |
+
|
142 |
+
//Open the uploader dialog
|
143 |
+
custom_uploader.open();
|
144 |
+
} );
|
145 |
+
|
146 |
+
$( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
|
147 |
+
var t = $( this ),
|
148 |
+
id = t.attr( 'id' ),
|
149 |
+
input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
|
150 |
+
default_value = $( '#' + id ).data( 'default' );
|
151 |
+
|
152 |
+
$( "#" + input_id ).val( default_value );
|
153 |
+
$upload.imgUrl.trigger( 'change' );
|
154 |
+
} );
|
155 |
+
}
|
156 |
+
|
157 |
+
$wpAddMedia.on( 'click', function () {
|
158 |
+
_custom_media = false;
|
159 |
+
} );
|
160 |
+
|
161 |
+
/* Image Gallery */
|
162 |
+
if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
|
163 |
+
$( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
|
164 |
+
var $t = $( this ),
|
165 |
+
$container = $t.closest( '.image-gallery' ),
|
166 |
+
$image_gallery_ids = $container.find( '.image_gallery_ids' ),
|
167 |
+
attachment_ids = $image_gallery_ids.val(),
|
168 |
+
$gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
|
169 |
+
|
170 |
+
// Create the media frame.
|
171 |
+
var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
|
172 |
+
// Set the title of the modal.
|
173 |
+
title : $t.data( 'choose' ),
|
174 |
+
button: {
|
175 |
+
text: $t.data( 'update' )
|
176 |
+
},
|
177 |
+
states: [
|
178 |
+
new wp.media.controller.Library( {
|
179 |
+
title : $t.data( 'choose' ),
|
180 |
+
filterable: 'all',
|
181 |
+
multiple : true
|
182 |
+
} )
|
183 |
+
]
|
184 |
+
} );
|
185 |
+
|
186 |
+
// When an image is selected, run a callback.
|
187 |
+
image_gallery_frame.on( 'select', function () {
|
188 |
+
var selection = image_gallery_frame.state().get( 'selection' );
|
189 |
+
selection.map( function ( attachment ) {
|
190 |
+
attachment = attachment.toJSON();
|
191 |
+
|
192 |
+
if ( attachment.id ) {
|
193 |
+
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
|
194 |
+
$gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
|
195 |
+
}
|
196 |
+
} );
|
197 |
+
|
198 |
+
$image_gallery_ids.val( attachment_ids );
|
199 |
+
} );
|
200 |
+
|
201 |
+
image_gallery_frame.open();
|
202 |
+
|
203 |
+
} );
|
204 |
+
|
205 |
+
// Image ordering
|
206 |
+
$imageGallery.sliderWrapper.each( function () {
|
207 |
+
var $t = $( this );
|
208 |
+
$t.sortable( {
|
209 |
+
items : 'li.image',
|
210 |
+
cursor : 'move',
|
211 |
+
scrollSensitivity : 40,
|
212 |
+
forcePlaceholderSize: true,
|
213 |
+
forceHelperSize : false,
|
214 |
+
helper : 'clone',
|
215 |
+
opacity : 0.65,
|
216 |
+
start : function ( event, ui ) {
|
217 |
+
ui.item.css( 'background-color', '#f6f6f6' );
|
218 |
+
},
|
219 |
+
stop : function ( event, ui ) {
|
220 |
+
ui.item.removeAttr( 'style' );
|
221 |
+
},
|
222 |
+
update : function ( event, ui ) {
|
223 |
+
var attachment_ids = '';
|
224 |
+
|
225 |
+
$t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
226 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
227 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
228 |
+
} );
|
229 |
+
|
230 |
+
$t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
|
231 |
+
}
|
232 |
+
} );
|
233 |
+
} );
|
234 |
+
|
235 |
+
// Remove images
|
236 |
+
$imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
|
237 |
+
var $wrapper = $( this ).closest( '.image-gallery' ),
|
238 |
+
$gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
|
239 |
+
$image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
|
240 |
+
attachment_ids = '';
|
241 |
+
|
242 |
+
$( this ).closest( 'li.image' ).remove();
|
243 |
+
|
244 |
+
$gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
|
245 |
+
var attachment_id = $( this ).attr( 'data-attachment_id' );
|
246 |
+
attachment_ids = attachment_ids + attachment_id + ',';
|
247 |
+
} );
|
248 |
+
|
249 |
+
$image_gallery_ids.val( attachment_ids );
|
250 |
+
} );
|
251 |
+
}
|
252 |
+
|
253 |
+
|
254 |
+
/* Sidebars */
|
255 |
+
$sidebars.each( function () {
|
256 |
+
var $images = $( this ).find( 'img' );
|
257 |
+
$images.on( 'click', function () {
|
258 |
+
var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
|
259 |
+
$left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
|
260 |
+
$right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
|
261 |
+
type = $( this ).data( 'type' );
|
262 |
+
|
263 |
+
$( this ).parent().children( ':radio' ).attr( 'checked', false );
|
264 |
+
$( this ).prev( ':radio' ).attr( 'checked', true );
|
265 |
+
|
266 |
+
if ( typeof type != 'undefined' ) {
|
267 |
+
switch ( type ) {
|
268 |
+
case 'left':
|
269 |
+
$left.show();
|
270 |
+
$right.hide();
|
271 |
+
break;
|
272 |
+
case 'right':
|
273 |
+
$right.show();
|
274 |
+
$left.hide();
|
275 |
+
break;
|
276 |
+
case 'double':
|
277 |
+
$left.show();
|
278 |
+
$right.show();
|
279 |
+
break;
|
280 |
+
default:
|
281 |
+
$left.hide();
|
282 |
+
$right.hide();
|
283 |
+
break;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
} );
|
287 |
+
} );
|
288 |
+
|
289 |
+
/* Slider */
|
290 |
+
$slider.each( function () {
|
291 |
+
var val = $( this ).data( 'val' ),
|
292 |
+
minValue = $( this ).data( 'min' ),
|
293 |
+
maxValue = $( this ).data( 'max' ),
|
294 |
+
step = $( this ).data( 'step' ),
|
295 |
+
labels = $( this ).data( 'labels' );
|
296 |
+
|
297 |
+
$( this ).slider( {
|
298 |
+
value: val,
|
299 |
+
min : minValue,
|
300 |
+
max : maxValue,
|
301 |
+
range: 'min',
|
302 |
+
step : step,
|
303 |
+
|
304 |
+
create: function () {
|
305 |
+
$( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
|
306 |
+
},
|
307 |
+
|
308 |
+
|
309 |
+
slide: function ( event, ui ) {
|
310 |
+
$( this ).find( 'input' ).val( ui.value );
|
311 |
+
$( this ).find( '.ui-slider-handle' ).text( ui.value );
|
312 |
+
$( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
|
313 |
+
}
|
314 |
+
} );
|
315 |
+
} );
|
316 |
+
|
317 |
+
/* codemirror */
|
318 |
+
$codemirror.each( function ( i, v ) {
|
319 |
+
var editor = CodeMirror.fromTextArea( v, {
|
320 |
+
lineNumbers : 1,
|
321 |
+
mode : 'javascript',
|
322 |
+
showCursorWhenSelecting: true
|
323 |
+
} );
|
324 |
+
|
325 |
+
$( v ).data( 'codemirrorInstance', editor );
|
326 |
+
} );
|
327 |
+
|
328 |
+
/* Select All - Deselect All */
|
329 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
|
330 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
331 |
+
$targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
|
332 |
+
} );
|
333 |
+
|
334 |
+
$( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
|
335 |
+
var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
|
336 |
+
$targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
|
337 |
+
} );
|
338 |
+
|
339 |
+
|
340 |
+
$icons.each( function () {
|
341 |
+
var $container = $( this ),
|
342 |
+
$preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
|
343 |
+
$text = $container.find( '.yit-icons-manager-icon-text' );
|
344 |
+
|
345 |
+
$container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
|
346 |
+
var $target = $( event.target ).closest( 'li' ),
|
347 |
+
font = $target.data( 'font' ),
|
348 |
+
icon = $target.data( 'icon' ),
|
349 |
+
key = $target.data( 'key' ),
|
350 |
+
name = $target.data( 'name' );
|
351 |
+
|
352 |
+
$preview.attr( 'data-font', font );
|
353 |
+
$preview.attr( 'data-icon', icon );
|
354 |
+
$preview.attr( 'data-key', key );
|
355 |
+
$preview.attr( 'data-name', name );
|
356 |
+
|
357 |
+
$text.val( font + ':' + name );
|
358 |
+
|
359 |
+
$container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
|
360 |
+
$target.addClass( 'active' );
|
361 |
+
} );
|
362 |
+
|
363 |
+
$container.on( 'click', '.yit-icons-manager-action-set-default', function () {
|
364 |
+
$container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
|
365 |
+
} );
|
366 |
+
} );
|
367 |
+
|
368 |
+
/** Select Images */
|
369 |
+
$( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
|
370 |
+
var item = $( this ),
|
371 |
+
key = item.data( 'key' ),
|
372 |
+
wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
|
373 |
+
items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
|
374 |
+
select = wrapper.find( 'select' ).first();
|
375 |
+
|
376 |
+
if ( select.length ) {
|
377 |
+
select.val( key );
|
378 |
+
items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
|
379 |
+
item.addClass( 'yith-plugin-fw-select-images__item--selected' );
|
380 |
+
}
|
381 |
+
} );
|
382 |
+
|
383 |
+
$( document.body ).trigger( 'wc-enhanced-select-init' );
|
384 |
+
|
385 |
+
$( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
|
386 |
+
{
|
387 |
+
cursor : 'move',
|
388 |
+
axis : 'y',
|
389 |
+
scrollSensitivity : 40,
|
390 |
+
forcePlaceholderSize: true,
|
391 |
+
helper : 'clone',
|
392 |
+
|
393 |
+
stop: function ( event, ui ) {
|
394 |
+
var keys = jQuery( '.ui-sortable-handle' ),
|
395 |
+
i = 0,
|
396 |
+
array_keys = new Array();
|
397 |
+
for ( i = 0; i < keys.length; i++ ) {
|
398 |
+
array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
|
399 |
+
}
|
400 |
+
if ( array_keys.length > 0 ) {
|
401 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
402 |
+
toggle.saveToggleElement( null, array_keys );
|
403 |
+
}
|
404 |
+
}
|
405 |
+
}
|
406 |
+
);
|
407 |
+
|
408 |
+
$( document.body ).trigger( 'yith-framework-enhanced-select-init' );
|
409 |
+
};
|
410 |
+
|
411 |
+
yith_fields_init();
|
412 |
+
|
413 |
+
/* on-off */
|
414 |
+
$( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
|
415 |
+
var input = $( this ).prev( 'input' ),
|
416 |
+
checked = input.prop( 'checked' );
|
417 |
+
|
418 |
+
if ( checked ) {
|
419 |
+
input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
|
420 |
+
} else {
|
421 |
+
input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
|
422 |
+
}
|
423 |
+
|
424 |
+
input.change();
|
425 |
+
} );
|
426 |
+
|
427 |
+
|
428 |
+
/** Toggle **/
|
429 |
+
|
430 |
+
|
431 |
+
|
432 |
+
//TOGGLE ELEMENT
|
433 |
+
$.fn.saveToggleElement = function ( spinner, array_keys ) {
|
434 |
+
var toggle = $( this ),
|
435 |
+
action = 'yith_plugin_fw_save_toggle_element',
|
436 |
+
formdata = toggle.serializeToggleElement(),
|
437 |
+
wrapper = toggle.find( '.yith-toggle_wrapper' ),
|
438 |
+
id = wrapper.attr( 'id' ),
|
439 |
+
current_tab = $.urlParam( 'tab' );
|
440 |
+
|
441 |
+
formdata.append( 'security', wrapper.data('nonce') );
|
442 |
+
|
443 |
+
if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
|
444 |
+
formdata.append( 'yith_toggle_elements_order_keys', array_keys );
|
445 |
+
}
|
446 |
+
|
447 |
+
if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
|
448 |
+
action = 'yith_plugin_fw_save_toggle_element_metabox';
|
449 |
+
post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
|
450 |
+
yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
|
451 |
+
url = yith_framework_fw_fields.ajax_url + '?action=' + action + "&post_ID=" + post_id + '&yit_metaboxes_nonce=' + yit_metaboxes_nonce + "&toggle_id=" + id;
|
452 |
+
} else {
|
453 |
+
url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
|
454 |
+
}
|
455 |
+
|
456 |
+
$.ajax( {
|
457 |
+
type : "POST",
|
458 |
+
url : url,
|
459 |
+
data : formdata,
|
460 |
+
contentType: false,
|
461 |
+
processData: false,
|
462 |
+
success : function ( result ) {
|
463 |
+
if ( spinner ) {
|
464 |
+
spinner.removeClass( 'show' );
|
465 |
+
}
|
466 |
+
|
467 |
+
$( document ).trigger( 'yith_save_toggle_element_done', [ result, toggle ] );
|
468 |
+
}
|
469 |
+
} );
|
470 |
+
};
|
471 |
+
|
472 |
+
$.fn.serializeToggleElement = function () {
|
473 |
+
var obj = $( this );
|
474 |
+
/* ADD FILE TO PARAM AJAX */
|
475 |
+
var formData = new FormData();
|
476 |
+
var params = $( obj ).find( ":input" ).serializeArray();
|
477 |
+
|
478 |
+
$.each( params, function ( i, val ) {
|
479 |
+
el_name = val.name;
|
480 |
+
formData.append( val.name, val.value );
|
481 |
+
} );
|
482 |
+
|
483 |
+
return formData;
|
484 |
+
};
|
485 |
+
|
486 |
+
$.fn.formatToggleTitle = function () {
|
487 |
+
var toggle_el = $( this ),
|
488 |
+
fields = toggle_el.find( ':input' ),
|
489 |
+
title = toggle_el.find( 'span.title' ).data( 'title_format' ),
|
490 |
+
subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
|
491 |
+
regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
|
492 |
+
|
493 |
+
if ( typeof title != 'undefined' ) {
|
494 |
+
var res = title.match( regExp );
|
495 |
+
}
|
496 |
+
|
497 |
+
if ( typeof subtitle != 'undefined' ) {
|
498 |
+
var ressub = subtitle.match( regExp );
|
499 |
+
}
|
500 |
+
|
501 |
+
$.each( fields, function ( i, field ) {
|
502 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
503 |
+
$field_id = $( field ).attr( 'id' );
|
504 |
+
$field_array = $field_id.split( '_' );
|
505 |
+
$field_array.pop();
|
506 |
+
$field_id = $field_array.join( '_' );
|
507 |
+
$field_val = $( field ).val();
|
508 |
+
|
509 |
+
if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
|
510 |
+
title = title.replace( '%%' + $field_id + '%%', $field_val );
|
511 |
+
}
|
512 |
+
if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
|
513 |
+
subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
|
514 |
+
}
|
515 |
+
}
|
516 |
+
} );
|
517 |
+
|
518 |
+
if ( '' !== title ) {
|
519 |
+
toggle_el.find( 'span.title' ).html( title );
|
520 |
+
}
|
521 |
+
|
522 |
+
if ( '' !== subtitle ) {
|
523 |
+
toggle_el.find( '.subtitle' ).html( subtitle );
|
524 |
+
}
|
525 |
+
|
526 |
+
$( document ).trigger( 'yith-toggle-element-item-title', [ toggle_el ] );
|
527 |
+
};
|
528 |
+
|
529 |
+
$.urlParam = function ( name ) {
|
530 |
+
var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
|
531 |
+
.exec( window.location.search );
|
532 |
+
|
533 |
+
return ( results !== null ) ? results[ 1 ] || 0 : false;
|
534 |
+
};
|
535 |
+
|
536 |
+
$( document ).on( 'click', '.yith-toggle-title', function ( event ) {
|
537 |
+
var _toggle = $( event.target ),
|
538 |
+
_section = _toggle.closest( '.yith-toggle-row' ),
|
539 |
+
_content = _section.find( '.yith-toggle-content' );
|
540 |
+
|
541 |
+
if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'yith-icon-drag' ) ) {
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
|
545 |
+
if ( _section.is( '.yith-toggle-row-opened' ) ) {
|
546 |
+
_content.slideUp( 400 );
|
547 |
+
} else {
|
548 |
+
_content.slideDown( 400 );
|
549 |
+
}
|
550 |
+
_section.toggleClass( 'yith-toggle-row-opened' );
|
551 |
+
} );
|
552 |
+
|
553 |
+
/**Add new box toggle**/
|
554 |
+
$( document ).on( 'click', '.yith-add-box-button', function ( event ) {
|
555 |
+
event.preventDefault();
|
556 |
+
var $this = $( this ),
|
557 |
+
target_id = $this.data( 'box_id' ),
|
558 |
+
closed_label = $this.data('closed_label'),
|
559 |
+
label = $this.data('opened_label'),
|
560 |
+
id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' );
|
561 |
+
template = wp.template( 'yith-toggle-element-add-box-content-' + id );
|
562 |
+
|
563 |
+
if ( '' !== target_id ) {
|
564 |
+
$( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
|
565 |
+
if (closed_label !== '') {
|
566 |
+
if ($this.html() === closed_label) {
|
567 |
+
$this.html(label).removeClass('closed');
|
568 |
+
} else {
|
569 |
+
$this.html(closed_label).addClass('closed');
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
yith_fields_init();
|
574 |
+
$( document ).trigger( 'yith-add-box-button-toggle', [ $this ] );
|
575 |
+
}
|
576 |
+
} );
|
577 |
+
|
578 |
+
$( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
|
579 |
+
|
580 |
+
event.preventDefault();
|
581 |
+
var add_box = $( this ).parents( '.yith-add-box' ),
|
582 |
+
id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
|
583 |
+
spinner = add_box.find( '.spinner' ),
|
584 |
+
toggle_element = $( this ).parents( '.toggle-element' ),
|
585 |
+
fields = add_box.find( ':input' ),
|
586 |
+
counter = toggle_element.find( '.yith-toggle-row' ).length,
|
587 |
+
hidden_obj = $( '<input type="hidden">' );
|
588 |
+
|
589 |
+
hidden_obj.val( counter );
|
590 |
+
|
591 |
+
$( document ).trigger( 'yith-toggle-change-counter', [ hidden_obj, add_box ] );
|
592 |
+
|
593 |
+
counter = hidden_obj.val();
|
594 |
+
var template = wp.template( 'yith-toggle-element-item-' + id ),
|
595 |
+
toggle_el = $( template( { index: counter } ) );
|
596 |
+
|
597 |
+
spinner.addClass( 'show' );
|
598 |
+
|
599 |
+
$.each( fields, function ( i, field ) {
|
600 |
+
if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
|
601 |
+
|
602 |
+
$field_id = $( field ).attr( 'id' );
|
603 |
+
$field_val = $( field ).val();
|
604 |
+
|
605 |
+
if ( 'radio' == $( field ).attr( 'type' ) ) {
|
606 |
+
$field_id = $field_id.replace( 'new_', '' );
|
607 |
+
$field_id = $field_id.replace( '-' + $field_val, '' );
|
608 |
+
$field_id = $field_id + '_dataindex-' + $field_val;
|
609 |
+
} else {
|
610 |
+
$field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
|
611 |
+
}
|
612 |
+
|
613 |
+
if ( $( field ).is( ':checked' ) ) {
|
614 |
+
$( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
|
615 |
+
}
|
616 |
+
|
617 |
+
if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
|
618 |
+
$( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
|
619 |
+
}
|
620 |
+
|
621 |
+
$( toggle_el ).find( '#' + $field_id ).val( $field_val );
|
622 |
+
|
623 |
+
}
|
624 |
+
|
625 |
+
} );
|
626 |
+
|
627 |
+
$( toggle_el ).formatToggleTitle();
|
628 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
629 |
+
$( document ).trigger( 'yith-toggle-element-item-before-add', [ add_box, toggle_el, form_is_valid ] );
|
630 |
+
|
631 |
+
var delayInMilliseconds =1000; //1 second
|
632 |
+
setTimeout(function() {
|
633 |
+
if ( form_is_valid.val() === 'yes' ) {
|
634 |
+
$( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
|
635 |
+
$( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
|
636 |
+
$( add_box ).html( '' );
|
637 |
+
$( add_box ).prev('.yith-add-box-button').trigger('click');
|
638 |
+
toggle_element.saveToggleElement();
|
639 |
+
|
640 |
+
var delayInMilliseconds =2000; //1 second
|
641 |
+
setTimeout(function() {
|
642 |
+
$( toggle_element ).find('.highlight').removeClass('highlight');
|
643 |
+
}, delayInMilliseconds);
|
644 |
+
|
645 |
+
|
646 |
+
yith_fields_init();
|
647 |
+
}
|
648 |
+
}, delayInMilliseconds );
|
649 |
+
|
650 |
+
|
651 |
+
|
652 |
+
} );
|
653 |
+
|
654 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
|
655 |
+
event.preventDefault();
|
656 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
657 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' ),
|
658 |
+
spinner = toggle_row.find( '.spinner' );
|
659 |
+
toggle_row.formatToggleTitle();
|
660 |
+
|
661 |
+
var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
|
662 |
+
$( document ).trigger( 'yith-toggle-element-item-before-update', [ toggle, toggle_row, form_is_valid ] );
|
663 |
+
if ( form_is_valid.val() === 'yes' ) {
|
664 |
+
spinner.addClass( 'show' );
|
665 |
+
toggle.saveToggleElement( spinner );
|
666 |
+
}
|
667 |
+
} );
|
668 |
+
|
669 |
+
//register remove the dome and save the toggle
|
670 |
+
$( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
|
671 |
+
event.preventDefault();
|
672 |
+
var toggle = $( this ).closest( '.toggle-element' ),
|
673 |
+
toggle_row = $( this ).closest( '.yith-toggle-row' );
|
674 |
+
toggle_row.remove();
|
675 |
+
toggle.saveToggleElement();
|
676 |
+
} );
|
677 |
+
|
678 |
+
//register onoff status
|
679 |
+
$( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
|
680 |
+
event.preventDefault();
|
681 |
+
var toggle = $( this ).closest( '.toggle-element' );
|
682 |
+
toggle.saveToggleElement();
|
683 |
+
} );
|
684 |
+
|
685 |
+
// Radio
|
686 |
+
$( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
|
687 |
+
$( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
|
688 |
+
} );
|
689 |
+
|
690 |
+
$(document).on('click', '.yith-password-eye', function () {
|
691 |
+
var $this = $(this),
|
692 |
+
inp = $(this).closest('.yith-password-wrapper').find('input');
|
693 |
+
if (inp.attr('type') === "password") {
|
694 |
+
inp.attr('type', 'text');
|
695 |
+
$this.addClass('yith-password-eye-closed');
|
696 |
+
} else {
|
697 |
+
inp.attr('type', 'password');
|
698 |
+
$this.removeClass('yith-password-eye-closed');
|
699 |
+
}
|
700 |
+
});
|
701 |
+
|
702 |
+
$( '.yith-plugin-fw-radio' ).each( function () {
|
703 |
+
$( this ).val( $( this ).attr( 'value' ) );
|
704 |
+
} );
|
705 |
+
|
706 |
} );
|
plugin-fw/assets/js/yith-fields.min.js
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
jQuery(function(a){var r=function(){var b=a(".yith-plugin-fw-datepicker"),c=a(".yith-plugin-fw-colorpicker"),d=a(".yith-plugin-fw-upload-img-url"),f=a(".add_media"),h=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),g=a(".yith-plugin-fw-sidebar-layout"),l=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),m=a(".codemirror"),n=a(".yit-icons-manager-wrapper");a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();a(this).datepicker(b)});c.wpColorPicker({palettes:!1,
|
2 |
-
width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});c.each(function(){var b=a(this).data("variations-label"),e=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),p=a(this).closest(".yith-single-colorpicker"),q=e.find(".wp-picker-input-wrap"),c=p.find(".wp-picker-input-wrap");q.length&&e.find("a.wp-color-result").attr("title",b);p.length&&p.find("a.wp-color-result").attr("title",b);q.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),
|
3 |
-
q.find(".wp-picker-default").wrap(b));c.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),c.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(d.change(function(){var b=a(this).val(),e=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>e.length&&(e=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&:/~+#-_.]*.(gif|jpg|jpeg|png|ico)/.test(b)?
|
4 |
-
e.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):e.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var e=a(this).attr("id").replace(/-button$/,"");if(!k){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var k=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,
|
5 |
-
states:b});k.on("select",function(){var b=k.state().get("selection").first().toJSON();a("#"+e).val(b.url);a("#"+e+"-yith-attachment-id")&&a("#"+e+"-yith-attachment-id").val(b.id);d.trigger("change")})}k.open()}),a(document).on("click",".yith-plugin-fw-upload-button-reset",function(b){var e=a(this);b=e.attr("id");e=e.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+e).val(b);d.trigger("change")}));f.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&
|
6 |
-
(a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var e=a(this);b=e.closest(".i
|
|
|
|
|
|
|
|
|
|
|
|