Max Mega Menu - Version 2.1

Version Description

[14/03/2016] =

  • New Feature: Drag and drop designer for the mobile toggle bar
  • Fix: WPML Language switcher flags
  • New Feature: Export menu theme in PHP format (for inclusion in a functions.php file)
  • Change: Remove CSS Enqueue via admin-ajax.php option due to slow performance
Download this release

Release Info

Developer megamenu
Plugin Icon 128x128 Max Mega Menu
Version 2.1
Comparing to
See all releases

Version 2.1

Files changed (53) hide show
  1. classes/menu-item-manager.class.php +750 -0
  2. classes/nav-menus.class.php +455 -0
  3. classes/scssc.inc.php +4443 -0
  4. classes/settings.class.php +3441 -0
  5. classes/style-manager.class.php +1018 -0
  6. classes/toggle-blocks.class.php +642 -0
  7. classes/walker.class.php +163 -0
  8. classes/widget-manager.class.php +1017 -0
  9. classes/widget.class.php +116 -0
  10. css/admin/global.css +25 -0
  11. css/admin/menus.css +999 -0
  12. css/admin/settings.css +603 -0
  13. css/megamenu.scss +690 -0
  14. css/mixin.scss +42 -0
  15. css/reset.scss +59 -0
  16. css/toggle-blocks.scss +64 -0
  17. font/maxmegamenu.eot +0 -0
  18. font/maxmegamenu.svg +12 -0
  19. font/maxmegamenu.ttf +0 -0
  20. font/maxmegamenu.woff +0 -0
  21. js/admin.js +598 -0
  22. js/codemirror/codemirror.css +301 -0
  23. js/codemirror/codemirror.js +13 -0
  24. js/colorbox/colorbox.css +86 -0
  25. js/colorbox/images/border.png +0 -0
  26. js/colorbox/images/controls.png +0 -0
  27. js/colorbox/images/ie6/borderBottomCenter.png +0 -0
  28. js/colorbox/images/ie6/borderBottomLeft.png +0 -0
  29. js/colorbox/images/ie6/borderBottomRight.png +0 -0
  30. js/colorbox/images/ie6/borderMiddleLeft.png +0 -0
  31. js/colorbox/images/ie6/borderMiddleRight.png +0 -0
  32. js/colorbox/images/ie6/borderTopCenter.png +0 -0
  33. js/colorbox/images/ie6/borderTopLeft.png +0 -0
  34. js/colorbox/images/ie6/borderTopRight.png +0 -0
  35. js/colorbox/images/loading.gif +0 -0
  36. js/colorbox/images/loading_background.png +0 -0
  37. js/colorbox/images/overlay.png +0 -0
  38. js/colorbox/jquery.colorbox-min.js +1061 -0
  39. js/maxmegamenu.js +264 -0
  40. js/select2/select2.css +702 -0
  41. js/select2/select2.min.js +23 -0
  42. js/settings.js +105 -0
  43. js/spectrum/spectrum.css +446 -0
  44. js/spectrum/spectrum.js +2109 -0
  45. js/toggledesigner.js +153 -0
  46. languages/megamenu-de_DE.mo +0 -0
  47. languages/megamenu-de_DE.po +1122 -0
  48. languages/megamenu-fr_FR.mo +0 -0
  49. languages/megamenu-fr_FR.po +1580 -0
  50. languages/megamenu-it_IT.mo +0 -0
  51. languages/megamenu-it_IT.po +1039 -0
  52. languages/megamenu.mo +0 -0
  53. languages/megamenu.po +1020 -0
classes/menu-item-manager.class.php ADDED
@@ -0,0 +1,750 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists('Mega_Menu_Menu_Item_Manager') ) :
8
+
9
+ /**
10
+ *
11
+ * @since 1.4
12
+ */
13
+ class Mega_Menu_Menu_Item_Manager {
14
+
15
+ var $menu_id = 0;
16
+
17
+ var $menu_item_id = 0;
18
+
19
+ var $menu_item_depth = 0;
20
+
21
+ var $menu_item_meta = array();
22
+
23
+
24
+ /**
25
+ * Constructor
26
+ *
27
+ * @since 1.4
28
+ */
29
+ public function __construct() {
30
+
31
+ add_action( 'wp_ajax_mm_get_lightbox_html', array( $this, 'ajax_get_lightbox_html' ) );
32
+ add_action( 'wp_ajax_mm_save_menu_item_settings', array( $this, 'ajax_save_menu_item_settings') );
33
+
34
+ add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab'), 10, 5 );
35
+ add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab'), 10, 5 );
36
+ add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab'), 10, 5 );
37
+
38
+ }
39
+
40
+
41
+ /**
42
+ * Set up the class
43
+ *
44
+ * @since 1.4
45
+ */
46
+ private function init() {
47
+
48
+ if ( isset( $_POST['menu_item_id'] ) ) {
49
+
50
+ $this->menu_item_id = absint( $_POST['menu_item_id'] );
51
+
52
+ $saved_settings = array_filter( (array) get_post_meta( $this->menu_item_id, '_megamenu', true ) );
53
+
54
+ $this->menu_item_meta = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings );
55
+
56
+ }
57
+
58
+ if ( isset( $_POST['menu_item_depth'] ) ) {
59
+
60
+ $this->menu_item_depth = absint( $_POST['menu_item_depth'] );
61
+
62
+ }
63
+
64
+ if ( isset( $_POST['menu_id'] ) ) {
65
+
66
+ $this->menu_id = absint( $_POST['menu_id'] );
67
+
68
+ }
69
+
70
+ }
71
+
72
+
73
+ /**
74
+ * Save custom menu item fields.
75
+ *
76
+ * @since 1.4
77
+ */
78
+ public static function ajax_save_menu_item_settings() {
79
+
80
+ check_ajax_referer( 'megamenu_edit' );
81
+
82
+ $submitted_settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array();
83
+
84
+ $menu_item_id = absint( $_POST['menu_item_id'] );
85
+
86
+ if ( $menu_item_id > 0 && is_array( $submitted_settings ) ) {
87
+
88
+ // only check the checkbox values if the general settings form was submitted
89
+ if ( isset( $_POST['tab'] ) && $_POST['tab'] == 'general_settings' ) {
90
+
91
+ // Hide Text checkbox is unchecked
92
+ if ( ! isset( $submitted_settings['hide_text'] ) ) {
93
+
94
+ $submitted_settings['hide_text'] = 'false';
95
+
96
+ }
97
+
98
+ // Disable Link checkbox is unchecked
99
+ if ( ! isset( $submitted_settings['disable_link'] ) ) {
100
+
101
+ $submitted_settings['disable_link'] = 'false';
102
+
103
+ }
104
+
105
+ // Disable arrow checkbox is unchecked
106
+ if ( ! isset ( $submitted_settings['hide_arrow'] ) ) {
107
+
108
+ $submitted_settings['hide_arrow'] = 'false';
109
+
110
+ }
111
+
112
+ // Hide on mobile checkbox is unchecked
113
+ if ( ! isset ( $submitted_settings['hide_on_mobile'] ) ) {
114
+
115
+ $submitted_settings['hide_on_mobile'] = 'false';
116
+
117
+ }
118
+
119
+ // Hide on mobile checkbox is unchecked
120
+ if ( ! isset ( $submitted_settings['hide_sub_menu_on_mobile'] ) ) {
121
+
122
+ $submitted_settings['hide_sub_menu_on_mobile'] = 'false';
123
+
124
+ }
125
+
126
+ // Hide on desktop checkbox is unchecked
127
+ if ( ! isset ( $submitted_settings['hide_on_desktop'] ) ) {
128
+
129
+ $submitted_settings['hide_on_desktop'] = 'false';
130
+
131
+ }
132
+
133
+ }
134
+
135
+ $submitted_settings = apply_filters( "megamenu_menu_item_submitted_settings", $submitted_settings, $menu_item_id );
136
+
137
+ $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true);
138
+
139
+ if ( is_array( $existing_settings ) ) {
140
+
141
+ $submitted_settings = array_merge( $existing_settings, $submitted_settings );
142
+
143
+ }
144
+
145
+ update_post_meta( $menu_item_id, '_megamenu', $submitted_settings );
146
+
147
+ do_action( "megamenu_save_menu_item_settings", $menu_item_id );
148
+
149
+ }
150
+
151
+ if ( isset( $_POST['clear_cache'] ) ) {
152
+
153
+ do_action("megamenu_delete_cache");
154
+
155
+ }
156
+
157
+ if ( ob_get_contents() ) ob_clean(); // remove any warnings or output from other plugins which may corrupt the response
158
+
159
+ wp_send_json_success();
160
+
161
+ }
162
+
163
+
164
+ /**
165
+ * Return the HTML to display in the Lightbox
166
+ *
167
+ * @since 1.4
168
+ * @return string
169
+ */
170
+ public function ajax_get_lightbox_html() {
171
+
172
+ check_ajax_referer( 'megamenu_edit' );
173
+
174
+ $this->init();
175
+
176
+ $tabs = array();
177
+
178
+ $tabs = apply_filters( "megamenu_tabs", $tabs, $this->menu_item_id, $this->menu_id, $this->menu_item_depth, $this->menu_item_meta );
179
+
180
+ if ( ob_get_contents() ) ob_clean(); // remove any warnings or output from other plugins which may corrupt the response
181
+
182
+ wp_send_json_success( json_encode( $tabs ) );
183
+ }
184
+
185
+
186
+ /**
187
+ * Return the HTML to display in the 'Mega Menu' tab
188
+ *
189
+ * @since 1.7
190
+ * @return string
191
+ */
192
+ public function add_mega_menu_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) {
193
+
194
+ if ( $menu_item_depth > 0 ) {
195
+ $tabs['mega_menu'] = array(
196
+ 'title' => __('Sub Menu', 'megamenu'),
197
+ 'content' => '<em>' . __( "Mega Menus can only be created on top level menu items.", "megamenu" ) . '</em>'
198
+ );
199
+
200
+ return $tabs;
201
+ }
202
+
203
+ $widget_manager = new Mega_Menu_Widget_Manager();
204
+
205
+ $all_widgets = $widget_manager->get_available_widgets();
206
+
207
+ $return = "<label for='mm_enable_mega_menu'>" . __("Sub menu display mode", "megamenu") . "</label>";
208
+ $return .= "<select id='mm_enable_mega_menu' name='settings[type]'>";
209
+ $return .= " <option value='flyout'>" . __("Flyout Menu", "megamenu") . "</option>";
210
+ $return .= " <option id='megamenu' value='megamenu' " . selected( $menu_item_meta['type'], 'megamenu', false ) . ">" . __("Mega Menu", "megamenu") . "</option>";
211
+ $return .= "</select>";
212
+
213
+
214
+ $return .= "<select id='mm_number_of_columns' name='settings[panel_columns]'>";
215
+ $return .= " <option value='1' " . selected( $menu_item_meta['panel_columns'], 1, false ) . ">1 " . __("column", "megamenu") . "</option>";
216
+ $return .= " <option value='2' " . selected( $menu_item_meta['panel_columns'], 2, false ) . ">2 " . __("columns", "megamenu") . "</option>";
217
+ $return .= " <option value='3' " . selected( $menu_item_meta['panel_columns'], 3, false ) . ">3 " . __("columns", "megamenu") . "</option>";
218
+ $return .= " <option value='4' " . selected( $menu_item_meta['panel_columns'], 4, false ) . ">4 " . __("columns", "megamenu") . "</option>";
219
+ $return .= " <option value='5' " . selected( $menu_item_meta['panel_columns'], 5, false ) . ">5 " . __("columns", "megamenu") . "</option>";
220
+ $return .= " <option value='6' " . selected( $menu_item_meta['panel_columns'], 6, false ) . ">6 " . __("columns", "megamenu") . "</option>";
221
+ $return .= " <option value='7' " . selected( $menu_item_meta['panel_columns'], 7, false ) . ">7 " . __("columns", "megamenu") . "</option>";
222
+ $return .= " <option value='8' " . selected( $menu_item_meta['panel_columns'], 8, false ) . ">8 " . __("columns", "megamenu") . "</option>";
223
+ $return .= "</select>";
224
+
225
+ $return .= "<select id='mm_widget_selector'>";
226
+ $return .= " <option value='disabled'>" . __("Select a Widget to add to the panel", "megamenu") . "</option>";
227
+
228
+ foreach ( $all_widgets as $widget ) {
229
+ $return .= "<option value='" . $widget['value'] . "'>" . $widget['text'] . "</option>";
230
+ }
231
+
232
+ $return .= "</select>";
233
+
234
+ $class = $menu_item_meta['type'] == 'megamenu' ? 'enabled' : 'disabled';
235
+
236
+ $return .= "<div id='widgets' class='{$class}' data-columns='{$this->menu_item_meta['panel_columns']}'>";
237
+
238
+ $items = $widget_manager->get_widgets_and_menu_items_for_menu_id( $menu_item_id, $this->menu_id );
239
+
240
+ if ( count ( $items ) ) {
241
+
242
+ foreach ( $items as $item ) {
243
+ $return .= '<div class="widget" title="' . esc_attr( $item['title'] ) . '" id="' . esc_attr( $item['id'] ) . '" data-columns="' . esc_attr( $item['columns'] ) . '" data-type="' . esc_attr( $item['type'] ) . '" data-id="' . esc_attr( $item['id'] ) . '">';
244
+ $return .= ' <div class="widget-top">';
245
+ $return .= ' <div class="widget-title-action">';
246
+ $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __("Contract", "megamenu") ) . '"></a>';
247
+ $return .= ' <span class="widget-cols"><span class="widget-num-cols">' . $item['columns'] . '</span><span class="widget-of">/</span><span class="widget-total-cols">' . $menu_item_meta['panel_columns'] . '</span></span>';
248
+ $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __("Expand", "megamenu") ) . '"></a>';
249
+ $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __("Edit", "megamenu") ) . '"></a>';
250
+ $return .= ' </div>';
251
+ $return .= ' <div class="widget-title">';
252
+ $return .= ' <h4>' . esc_html( $item['title'] ) . '</h4>';
253
+ $return .= ' </div>';
254
+ $return .= ' </div>';
255
+ $return .= ' <div class="widget-inner"></div>';
256
+ $return .= '</div>';
257
+ }
258
+
259
+ } else {
260
+ $return .= "<p class='no_widgets'>" . __("No widgets found. Add a widget to this area using the Widget Selector (top right)") . "</p>";
261
+ }
262
+
263
+ $return .= "</div>";
264
+
265
+ $tabs['mega_menu'] = array(
266
+ 'title' => __('Mega Menu', 'megamenu'),
267
+ 'content' => $return
268
+ );
269
+
270
+ return $tabs;
271
+ }
272
+
273
+
274
+ /**
275
+ * Return the HTML to display in the 'General Settings' tab
276
+ *
277
+ * @since 1.7
278
+ * @return string
279
+ */
280
+ public function add_general_settings_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) {
281
+
282
+ $return = '<form>';
283
+ $return .= ' <input type="hidden" name="menu_item_id" value="' . $menu_item_id . '" />';
284
+ $return .= ' <input type="hidden" name="action" value="mm_save_menu_item_settings" />';
285
+ $return .= ' <input type="hidden" name="_wpnonce" value="' . wp_create_nonce('megamenu_edit') . '" />';
286
+ $return .= ' <input type="hidden" name="tab" value="general_settings" />';
287
+ $return .= ' <h4 class="first">' . __("Menu Item Settings", "megamenu") . '</h4>';
288
+ $return .= ' <table>';
289
+ $return .= ' <tr>';
290
+ $return .= ' <td class="mega-name">';
291
+ $return .= __("Hide Text", "megamenu");
292
+ $return .= ' </td>';
293
+ $return .= ' <td class="mega-value">';
294
+
295
+ if ( $this->menu_item_depth == 0 ) {
296
+ $return .= '<input type="checkbox" name="settings[hide_text]" value="true" ' . checked( $menu_item_meta['hide_text'], 'true', false ) . ' />';
297
+ } else {
298
+ $return .= '<em>' . __("Option only available for top level menu items", "megamenu") . '</em>';
299
+ }
300
+
301
+ $return .= ' </td>';
302
+ $return .= ' </tr>';
303
+ $return .= ' <tr>';
304
+ $return .= ' <td class="mega-name">';
305
+ $return .= __("Hide Arrow", "megamenu");
306
+ $return .= ' </td>';
307
+ $return .= ' <td class="mega-value">';
308
+ $return .= ' <input type="checkbox" name="settings[hide_arrow]" value="true" ' . checked( $menu_item_meta['hide_arrow'], 'true', false ) . ' />';
309
+ $return .= ' </td>';
310
+ $return .= ' </tr>';
311
+ $return .= ' <tr>';
312
+ $return .= ' <td class="mega-name">';
313
+ $return .= __("Disable Link", "megamenu");
314
+ $return .= ' </td>';
315
+ $return .= ' <td class="mega-value">';
316
+ $return .= ' <input type="checkbox" name="settings[disable_link]" value="true" ' . checked( $menu_item_meta['disable_link'], 'true', false ) . ' />';
317
+ $return .= ' </td>';
318
+ $return .= ' </tr>';
319
+ $return .= ' <tr>';
320
+ $return .= ' <td class="mega-name">';
321
+ $return .= __("Hide Item on Mobile", "megamenu");
322
+ $return .= ' </td>';
323
+ $return .= ' <td class="mega-value">';
324
+ $return .= ' <input type="checkbox" name="settings[hide_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_on_mobile'], 'true', false ) . ' />';
325
+ $return .= ' </td>';
326
+ $return .= ' </tr>';
327
+ $return .= ' <tr>';
328
+ $return .= ' <td class="mega-name">';
329
+ $return .= __("Hide Item on Desktop", "megamenu");
330
+ $return .= ' </td>';
331
+ $return .= ' <td class="mega-value">';
332
+ $return .= ' <input type="checkbox" name="settings[hide_on_desktop]" value="true" ' . checked( $menu_item_meta['hide_on_desktop'], 'true', false ) . ' />';
333
+ $return .= ' </td>';
334
+ $return .= ' </tr>';
335
+ $return .= ' <tr>';
336
+ $return .= ' <td class="mega-name">';
337
+ $return .= __("Menu Item Align", "megamenu");
338
+ $return .= ' </td>';
339
+ $return .= ' <td class="mega-value">';
340
+
341
+ if ( $menu_item_depth == 0 ) {
342
+ $return .= ' <select name="settings[item_align]">';
343
+ $return .= ' <option value="left" ' . selected( $menu_item_meta['item_align'], 'left', false ) . '>' . __("Left", "megamenu") . '</option>';
344
+ $return .= ' <option value="right" ' . selected( $menu_item_meta['item_align'], 'right', false ) . '>' . __("Right", "megamenu") . '</option>';
345
+ $return .= ' </select>';
346
+ $return .= ' <div class="mega-description">';
347
+ $return .= __("Right aligned items will appear in reverse order on the right hand side of the menu bar", "megamenu");
348
+ $return .= ' </div>';
349
+ } else {
350
+ $return .= '<em>' . __("Option only available for top level menu items", "megamenu") . '</em>';
351
+ }
352
+
353
+ $return .= ' </td>';
354
+ $return .= ' </tr>';
355
+ $return .= ' </table>';
356
+
357
+ $return .= ' <h4>' . __("Sub Menu Settings", "megamenu") . '</h4>';
358
+
359
+ $return .= ' <table>';
360
+ $return .= ' <tr>';
361
+ $return .= ' <td class="mega-name">';
362
+ $return .= __("Sub Menu Align", "megamenu");
363
+ $return .= ' </td>';
364
+ $return .= ' <td class="mega-value">';
365
+
366
+ if ( $menu_item_depth == 0 ) {
367
+ $return .= ' <select name="settings[align]">';
368
+ $return .= ' <option value="bottom-left" ' . selected( $menu_item_meta['align'], 'bottom-left', false ) . '>' . __("Left edge of Parent", "megamenu") . '</option>';
369
+ $return .= ' <option value="bottom-right" ' . selected( $menu_item_meta['align'], 'bottom-right', false ) . '>' . __("Right edge of Parent", "megamenu") . '</option>';
370
+ $return .= ' </select>';
371
+ $return .= ' <div class="mega-description">';
372
+ $return .= __("Right aligned flyout menus will expand to the left", "megamenu");
373
+ $return .= ' </div>';
374
+ } else {
375
+ $return .= '<em>' . __("Option only available for top level menu items", "megamenu") . '</em>';
376
+ }
377
+
378
+ $return .= ' </td>';
379
+ $return .= ' </tr>';
380
+ $return .= ' <tr>';
381
+ $return .= ' <td class="mega-name">';
382
+ $return .= __("Hide Sub Menu on Mobile", "megamenu");
383
+ $return .= ' </td>';
384
+ $return .= ' <td class="mega-value">';
385
+ $return .= ' <input type="checkbox" name="settings[hide_sub_menu_on_mobile]" value="true" ' . checked( $menu_item_meta['hide_sub_menu_on_mobile'], 'true', false ) . ' />';
386
+ $return .= ' </td>';
387
+ $return .= ' </tr>';
388
+ $return .= ' </table>';
389
+ $return .= get_submit_button();
390
+ $return .= '</form>';
391
+
392
+ $tabs['general_settings'] = array(
393
+ 'title' => __('Settings', 'megamenu'),
394
+ 'content' => $return
395
+ );
396
+
397
+ return $tabs;
398
+
399
+ }
400
+
401
+
402
+ /**
403
+ * Return the HTML to display in the 'menu icon' tab
404
+ *
405
+ * @since 1.7
406
+ * @return string
407
+ */
408
+ public function add_icon_tab( $tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta ) {
409
+
410
+ $icon_tabs = array(
411
+ 'dashicons' => array(
412
+ 'title' => __("Dashicons", "megamenu"),
413
+ 'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen("dash") ) === "dash" || $menu_item_meta['icon'] == 'disabled' ),
414
+ 'content' => $this->dashicon_selector()
415
+ ),
416
+ 'fontawesome' => array(
417
+ 'title' => __("Font Awesome", "megamenu"),
418
+ 'active' => false,
419
+ 'content' => str_replace( "{link}", "<a href='https://www.maxmegamenu.com/upgrade/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Get access to over 400 Font Awesome Icons with {link}", "megamenu") )
420
+ ),
421
+ 'genericons' => array(
422
+ 'title' => __("Genericons", "megamenu"),
423
+ 'active' => false,
424
+ 'content' => str_replace( "{link}", "<a href='https://www.maxmegamenu.com/upgrade/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Choose from over 100 genericons with {link}", "megamenu") )
425
+ ),
426
+ 'custom' => array(
427
+ 'title' => __("Custom Icon", "megamenu"),
428
+ 'active' => false,
429
+ 'content' => str_replace( "{link}", "<a href='https://www.maxmegamenu.com/upgrade/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Select icons from your media library with {link}", "megamenu") )
430
+ ),
431
+ );
432
+
433
+ $icon_tabs = apply_filters( "megamenu_icon_tabs", $icon_tabs, $menu_item_id, $menu_id, $menu_item_depth, $menu_item_meta );
434
+
435
+ $return = ' <h4 class="first">' . __("Menu Item Icon", "megamenu") . '</h4>';
436
+ $return .= "<ul class='mm_tabs horizontal'>";
437
+
438
+ foreach ( $icon_tabs as $id => $icon_tab ) {
439
+
440
+ $active = $icon_tab['active'] || count( $icon_tabs ) === 1 ? "active" : "";
441
+
442
+ $return .= "<li rel='mm_tab_{$id}' class='{$active}'>";
443
+ $return .= esc_html( $icon_tab['title'] );
444
+ $return .= "</li>";
445
+
446
+ }
447
+
448
+ $return .= "</ul>";
449
+
450
+ foreach ($icon_tabs as $id => $icon_tab) {
451
+
452
+ $display = $icon_tab['active'] ? "block" : "none";
453
+
454
+ $return .= "<div class='mm_tab_{$id}' style='display: {$display}'>";
455
+ $return .= " <form class='icon_selector'>";
456
+ $return .= " <input type='hidden' name='_wpnonce' value='" . wp_create_nonce('megamenu_edit') . "' />";
457
+ $return .= " <input type='hidden' name='menu_item_id' value='{$menu_item_id}' />";
458
+ $return .= " <input type='hidden' name='action' value='mm_save_menu_item_settings' />";
459
+ $return .= $icon_tab['content'];
460
+ $return .= " </form>";
461
+ $return .= "</div>";
462
+
463
+ }
464
+
465
+ $tabs['menu_icon'] = array(
466
+ 'title' => __('Icon', 'megamenu'),
467
+ 'content' => $return
468
+ );
469
+
470
+ return $tabs;
471
+
472
+ }
473
+
474
+ /**
475
+ * Return the form to select a dashicon
476
+ *
477
+ * @since 1.5.2
478
+ */
479
+ private function dashicon_selector() {
480
+
481
+ $return = "<div class='disabled'><input id='disabled' class='radio' type='radio' rel='disabled' name='settings[icon]' value='disabled' " . checked( $this->menu_item_meta['icon'], 'disabled', false ) . " />";
482
+ $return .= "<label for='disabled'></label></div>";
483
+
484
+ foreach ( $this->all_icons() as $code => $class ) {
485
+
486
+ $bits = explode( "-", $code );
487
+ $code = "&#x" . $bits[1] . "";
488
+ $type = $bits[0];
489
+
490
+ $return .= "<div class='{$type}'>";
491
+ $return .= " <input class='radio' id='{$class}' type='radio' rel='{$code}' name='settings[icon]' value='{$class}' " . checked( $this->menu_item_meta['icon'], $class, false ) . " />";
492
+ $return .= " <label rel='{$code}' for='{$class}'></label>";
493
+ $return .= "</div>";
494
+
495
+ }
496
+
497
+ return $return;
498
+ }
499
+
500
+
501
+ /**
502
+ * List of all available DashIcon classes.
503
+ *
504
+ * @since 1.0
505
+ * @return array - Sorted list of icon classes
506
+ */
507
+ public function all_icons() {
508
+
509
+ $icons = array(
510
+ 'dash-f333' => 'dashicons-menu',
511
+ 'dash-f319' => 'dashicons-admin-site',
512
+ 'dash-f226' => 'dashicons-dashboard',
513
+ 'dash-f109' => 'dashicons-admin-post',
514
+ 'dash-f104' => 'dashicons-admin-media',
515
+ 'dash-f103' => 'dashicons-admin-links',
516
+ 'dash-f105' => 'dashicons-admin-page',
517
+ 'dash-f101' => 'dashicons-admin-comments',
518
+ 'dash-f100' => 'dashicons-admin-appearance',
519
+ 'dash-f106' => 'dashicons-admin-plugins',
520
+ 'dash-f110' => 'dashicons-admin-users',
521
+ 'dash-f107' => 'dashicons-admin-tools',
522
+ 'dash-f108' => 'dashicons-admin-settings',
523
+ 'dash-f112' => 'dashicons-admin-network',
524
+ 'dash-f102' => 'dashicons-admin-home',
525
+ 'dash-f111' => 'dashicons-admin-generic',
526
+ 'dash-f148' => 'dashicons-admin-collapse',
527
+ 'dash-f536' => 'dashicons-filter',
528
+ 'dash-f540' => 'dashicons-admin-customizer',
529
+ 'dash-f541' => 'dashicons-admin-multisite',
530
+ 'dash-f119' => 'dashicons-welcome-write-blog',
531
+ 'dash-f133' => 'dashicons-welcome-add-page',
532
+ 'dash-f115' => 'dashicons-welcome-view-site',
533
+ 'dash-f116' => 'dashicons-welcome-widgets-menus',
534
+ 'dash-f117' => 'dashicons-welcome-comments',
535
+ 'dash-f118' => 'dashicons-welcome-learn-more',
536
+ 'dash-f123' => 'dashicons-format-aside',
537
+ 'dash-f128' => 'dashicons-format-image',
538
+ 'dash-f161' => 'dashicons-format-gallery',
539
+ 'dash-f126' => 'dashicons-format-video',
540
+ 'dash-f130' => 'dashicons-format-status',
541
+ 'dash-f122' => 'dashicons-format-quote',
542
+ 'dash-f125' => 'dashicons-format-chat',
543
+ 'dash-f127' => 'dashicons-format-audio',
544
+ 'dash-f306' => 'dashicons-camera',
545
+ 'dash-f232' => 'dashicons-images-alt',
546
+ 'dash-f233' => 'dashicons-images-alt2',
547
+ 'dash-f234' => 'dashicons-video-alt',
548
+ 'dash-f235' => 'dashicons-video-alt2',
549
+ 'dash-f236' => 'dashicons-video-alt3',
550
+ 'dash-f501' => 'dashicons-media-archive',
551
+ 'dash-f500' => 'dashicons-media-audio',
552
+ 'dash-f499' => 'dashicons-media-code',
553
+ 'dash-f498' => 'dashicons-media-default',
554
+ 'dash-f497' => 'dashicons-media-document',
555
+ 'dash-f496' => 'dashicons-media-interactive',
556
+ 'dash-f495' => 'dashicons-media-spreadsheet',
557
+ 'dash-f491' => 'dashicons-media-text',
558
+ 'dash-f490' => 'dashicons-media-video',
559
+ 'dash-f492' => 'dashicons-playlist-audio',
560
+ 'dash-f493' => 'dashicons-playlist-video',
561
+ 'dash-f522' => 'dashicons-controls-play',
562
+ 'dash-f523' => 'dashicons-controls-pause',
563
+ 'dash-f519' => 'dashicons-controls-forward',
564
+ 'dash-f517' => 'dashicons-controls-skipforward',
565
+ 'dash-f518' => 'dashicons-controls-back',
566
+ 'dash-f516' => 'dashicons-controls-skipback',
567
+ 'dash-f515' => 'dashicons-controls-repeat',
568
+ 'dash-f521' => 'dashicons-controls-volumeon',
569
+ 'dash-f520' => 'dashicons-controls-volumeoff',
570
+ 'dash-f165' => 'dashicons-image-crop',
571
+ 'dash-f531' => 'dashicons-image-rotate',
572
+ 'dash-f166' => 'dashicons-image-rotate-left',
573
+ 'dash-f167' => 'dashicons-image-rotate-right',
574
+ 'dash-f168' => 'dashicons-image-flip-vertical',
575
+ 'dash-f169' => 'dashicons-image-flip-horizontal',
576
+ 'dash-f533' => 'dashicons-image-filter',
577
+ 'dash-f171' => 'dashicons-undo',
578
+ 'dash-f172' => 'dashicons-redo',
579
+ 'dash-f200' => 'dashicons-editor-bold',
580
+ 'dash-f201' => 'dashicons-editor-italic',
581
+ 'dash-f203' => 'dashicons-editor-ul',
582
+ 'dash-f204' => 'dashicons-editor-ol',
583
+ 'dash-f205' => 'dashicons-editor-quote',
584
+ 'dash-f206' => 'dashicons-editor-alignleft',
585
+ 'dash-f207' => 'dashicons-editor-aligncenter',
586
+ 'dash-f208' => 'dashicons-editor-alignright',
587
+ 'dash-f209' => 'dashicons-editor-insertmore',
588
+ 'dash-f210' => 'dashicons-editor-spellcheck',
589
+ 'dash-f211' => 'dashicons-editor-expand',
590
+ 'dash-f506' => 'dashicons-editor-contract',
591
+ 'dash-f212' => 'dashicons-editor-kitchensink',
592
+ 'dash-f213' => 'dashicons-editor-underline',
593
+ 'dash-f214' => 'dashicons-editor-justify',
594
+ 'dash-f215' => 'dashicons-editor-textcolor',
595
+ 'dash-f216' => 'dashicons-editor-paste-word',
596
+ 'dash-f217' => 'dashicons-editor-paste-text',
597
+ 'dash-f218' => 'dashicons-editor-removeformatting',
598
+ 'dash-f219' => 'dashicons-editor-video',
599
+ 'dash-f220' => 'dashicons-editor-customchar',
600
+ 'dash-f221' => 'dashicons-editor-outdent',
601
+ 'dash-f222' => 'dashicons-editor-indent',
602
+ 'dash-f223' => 'dashicons-editor-help',
603
+ 'dash-f224' => 'dashicons-editor-strikethrough',
604
+ 'dash-f225' => 'dashicons-editor-unlink',
605
+ 'dash-f320' => 'dashicons-editor-rtl',
606
+ 'dash-f474' => 'dashicons-editor-break',
607
+ 'dash-f475' => 'dashicons-editor-code',
608
+ 'dash-f476' => 'dashicons-editor-paragraph',
609
+ 'dash-f535' => 'dashicons-editor-table',
610
+ 'dash-f135' => 'dashicons-align-left',
611
+ 'dash-f136' => 'dashicons-align-right',
612
+ 'dash-f134' => 'dashicons-align-center',
613
+ 'dash-f138' => 'dashicons-align-none',
614
+ 'dash-f160' => 'dashicons-lock',
615
+ 'dash-f528' => 'dashicons-unlock',
616
+ 'dash-f145' => 'dashicons-calendar',
617
+ 'dash-f508' => 'dashicons-calendar-alt',
618
+ 'dash-f177' => 'dashicons-visibility',
619
+ 'dash-f530' => 'dashicons-hidden',
620
+ 'dash-f173' => 'dashicons-post-status',
621
+ 'dash-f464' => 'dashicons-edit',
622
+ 'dash-f182' => 'dashicons-trash',
623
+ 'dash-f537' => 'dashicons-sticky',
624
+ 'dash-f504' => 'dashicons-external',
625
+ 'dash-f142' => 'dashicons-arrow-up',
626
+ 'dash-f140' => 'dashicons-arrow-down',
627
+ 'dash-f139' => 'dashicons-arrow-right',
628
+ 'dash-f141' => 'dashicons-arrow-left',
629
+ 'dash-f342' => 'dashicons-arrow-up-alt',
630
+ 'dash-f346' => 'dashicons-arrow-down-alt',
631
+ 'dash-f344' => 'dashicons-arrow-right-alt',
632
+ 'dash-f340' => 'dashicons-arrow-left-alt',
633
+ 'dash-f343' => 'dashicons-arrow-up-alt2',
634
+ 'dash-f347' => 'dashicons-arrow-down-alt2',
635
+ 'dash-f345' => 'dashicons-arrow-right-alt2',
636
+ 'dash-f341' => 'dashicons-arrow-left-alt2',
637
+ 'dash-f156' => 'dashicons-sort',
638
+ 'dash-f229' => 'dashicons-leftright',
639
+ 'dash-f503' => 'dashicons-randomize',
640
+ 'dash-f163' => 'dashicons-list-view',
641
+ 'dash-f164' => 'dashicons-exerpt-view',
642
+ 'dash-f509' => 'dashicons-grid-view',
643
+ 'dash-f237' => 'dashicons-share',
644
+ 'dash-f240' => 'dashicons-share-alt',
645
+ 'dash-f242' => 'dashicons-share-alt2',
646
+ 'dash-f301' => 'dashicons-twitter',
647
+ 'dash-f303' => 'dashicons-rss',
648
+ 'dash-f465' => 'dashicons-email',
649
+ 'dash-f466' => 'dashicons-email-alt',
650
+ 'dash-f304' => 'dashicons-facebook',
651
+ 'dash-f305' => 'dashicons-facebook-alt',
652
+ 'dash-f462' => 'dashicons-googleplus',
653
+ 'dash-f325' => 'dashicons-networking',
654
+ 'dash-f308' => 'dashicons-hammer',
655
+ 'dash-f309' => 'dashicons-art',
656
+ 'dash-f310' => 'dashicons-migrate',
657
+ 'dash-f311' => 'dashicons-performance',
658
+ 'dash-f483' => 'dashicons-universal-access',
659
+ 'dash-f507' => 'dashicons-universal-access-alt',
660
+ 'dash-f486' => 'dashicons-tickets',
661
+ 'dash-f484' => 'dashicons-nametag',
662
+ 'dash-f481' => 'dashicons-clipboard',
663
+ 'dash-f487' => 'dashicons-heart',
664
+ 'dash-f488' => 'dashicons-megaphone',
665
+ 'dash-f489' => 'dashicons-schedule',
666
+ 'dash-f120' => 'dashicons-wordpress',
667
+ 'dash-f324' => 'dashicons-wordpress-alt',
668
+ 'dash-f157' => 'dashicons-pressthis',
669
+ 'dash-f463' => 'dashicons-update',
670
+ 'dash-f180' => 'dashicons-screenoptions',
671
+ 'dash-f348' => 'dashicons-info',
672
+ 'dash-f174' => 'dashicons-cart',
673
+ 'dash-f175' => 'dashicons-feedback',
674
+ 'dash-f176' => 'dashicons-cloud',
675
+ 'dash-f326' => 'dashicons-translation',
676
+ 'dash-f323' => 'dashicons-tag',
677
+ 'dash-f318' => 'dashicons-category',
678
+ 'dash-f480' => 'dashicons-archive',
679
+ 'dash-f479' => 'dashicons-tagcloud',
680
+ 'dash-f478' => 'dashicons-text',
681
+ 'dash-f147' => 'dashicons-yes',
682
+ 'dash-f158' => 'dashicons-no',
683
+ 'dash-f335' => 'dashicons-no-alt',
684
+ 'dash-f132' => 'dashicons-plus',
685
+ 'dash-f502' => 'dashicons-plus-alt',
686
+ 'dash-f460' => 'dashicons-minus',
687
+ 'dash-f153' => 'dashicons-dismiss',
688
+ 'dash-f159' => 'dashicons-marker',
689
+ 'dash-f155' => 'dashicons-star-filled',
690
+ 'dash-f459' => 'dashicons-star-half',
691
+ 'dash-f154' => 'dashicons-star-empty',
692
+ 'dash-f227' => 'dashicons-flag',
693
+ 'dash-f534' => 'dashicons-warning',
694
+ 'dash-f230' => 'dashicons-location',
695
+ 'dash-f231' => 'dashicons-location-alt',
696
+ 'dash-f178' => 'dashicons-vault',
697
+ 'dash-f332' => 'dashicons-shield',
698
+ 'dash-f334' => 'dashicons-shield-alt',
699
+ 'dash-f468' => 'dashicons-sos',
700
+ 'dash-f179' => 'dashicons-search',
701
+ 'dash-f181' => 'dashicons-slides',
702
+ 'dash-f183' => 'dashicons-analytics',
703
+ 'dash-f184' => 'dashicons-chart-pie',
704
+ 'dash-f185' => 'dashicons-chart-bar',
705
+ 'dash-f238' => 'dashicons-chart-line',
706
+ 'dash-f239' => 'dashicons-chart-area',
707
+ 'dash-f307' => 'dashicons-groups',
708
+ 'dash-f338' => 'dashicons-businessman',
709
+ 'dash-f336' => 'dashicons-id',
710
+ 'dash-f337' => 'dashicons-id-alt',
711
+ 'dash-f312' => 'dashicons-products',
712
+ 'dash-f313' => 'dashicons-awards',
713
+ 'dash-f314' => 'dashicons-forms',
714
+ 'dash-f473' => 'dashicons-testimonial',
715
+ 'dash-f322' => 'dashicons-portfolio',
716
+ 'dash-f330' => 'dashicons-book',
717
+ 'dash-f331' => 'dashicons-book-alt',
718
+ 'dash-f316' => 'dashicons-download',
719
+ 'dash-f317' => 'dashicons-upload',
720
+ 'dash-f321' => 'dashicons-backup',
721
+ 'dash-f469' => 'dashicons-clock',
722
+ 'dash-f339' => 'dashicons-lightbulb',
723
+ 'dash-f482' => 'dashicons-microphone',
724
+ 'dash-f472' => 'dashicons-desktop',
725
+ 'dash-f471' => 'dashicons-tablet',
726
+ 'dash-f470' => 'dashicons-smartphone',
727
+ 'dash-f525' => 'dashicons-phone',
728
+ 'dash-f510' => 'dashicons-index-card',
729
+ 'dash-f511' => 'dashicons-carrot',
730
+ 'dash-f512' => 'dashicons-building',
731
+ 'dash-f513' => 'dashicons-store',
732
+ 'dash-f514' => 'dashicons-album',
733
+ 'dash-f527' => 'dashicons-palmtree',
734
+ 'dash-f524' => 'dashicons-tickets-alt',
735
+ 'dash-f526' => 'dashicons-money',
736
+ 'dash-f328' => 'dashicons-smiley',
737
+ 'dash-f529' => 'dashicons-thumbs-up',
738
+ 'dash-f542' => 'dashicons-thumbs-down',
739
+ 'dash-f538' => 'dashicons-layout'
740
+ );
741
+
742
+ $icons = apply_filters( "megamenu_dashicons", $icons );
743
+
744
+ ksort( $icons );
745
+
746
+ return $icons;
747
+ }
748
+ }
749
+
750
+ endif;
classes/nav-menus.class.php ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists( 'Mega_Menu_Nav_Menus' ) ) :
8
+ /**
9
+ * Handles all admin related functionality.
10
+ */
11
+ class Mega_Menu_Nav_Menus {
12
+
13
+ /**
14
+ * Return the default settings for each menu item
15
+ *
16
+ * @since 1.5
17
+ */
18
+ public static function get_menu_item_defaults() {
19
+
20
+ $defaults = array(
21
+ 'type' => 'flyout',
22
+ 'align' => 'bottom-left',
23
+ 'icon' => 'disabled',
24
+ 'hide_text' => 'false',
25
+ 'disable_link' => 'false',
26
+ 'hide_on_mobile' => 'false',
27
+ 'hide_on_desktop' => 'false',
28
+ 'hide_sub_menu_on_mobile' => 'false',
29
+ 'hide_arrow' => 'false',
30
+ 'item_align' => 'left',
31
+ 'panel_columns' => 6, // total number of columns displayed in the panel
32
+ 'mega_menu_columns' => 1, // for sub menu items, how many columns to span in the panel,
33
+ 'mega_menu_order' => 0
34
+ );
35
+
36
+ return apply_filters( "megamenu_menu_item_defaults", $defaults );
37
+
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ *
43
+ * @since 1.0
44
+ */
45
+ public function __construct() {
46
+
47
+ add_action( 'admin_init', array( $this, 'register_nav_meta_box' ), 9 );
48
+ add_action( 'megamenu_nav_menus_scripts', array( $this, 'enqueue_menu_page_scripts' ), 9 );
49
+ add_action( 'megamenu_save_settings', array($this, 'save') );
50
+ add_filter( 'hidden_meta_boxes', array( $this, 'show_mega_menu_metabox' ) );
51
+
52
+ if ( function_exists( 'siteorigin_panels_admin_enqueue_scripts' ) ) {
53
+ add_action( 'admin_print_scripts-nav-menus.php', array( $this, 'siteorigin_panels_admin_enqueue_scripts') );
54
+ }
55
+
56
+ if ( function_exists( 'siteorigin_panels_admin_enqueue_styles' ) ) {
57
+ add_action( 'admin_print_styles-nav-menus.php', array( $this, 'siteorigin_panels_admin_enqueue_styles') );
58
+ }
59
+
60
+ }
61
+
62
+
63
+ /**
64
+ * Enqueue Page Builder scripts (https://wordpress.org/plugins/siteorigin-panels/)
65
+ * @since 1.9
66
+ */
67
+ public function siteorigin_panels_admin_enqueue_scripts() {
68
+ siteorigin_panels_admin_enqueue_scripts('', true);
69
+ }
70
+
71
+
72
+ /**
73
+ * Enqueue Page Builder styles (https://wordpress.org/plugins/siteorigin-panels/)
74
+ * @since 1.9
75
+ */
76
+ public function siteorigin_panels_admin_enqueue_styles() {
77
+ siteorigin_panels_admin_enqueue_styles('', true);
78
+ }
79
+
80
+
81
+ /**
82
+ * By default the mega menu meta box is hidden - show it.
83
+ *
84
+ * @since 1.0
85
+ * @param array $hidden
86
+ * @return array
87
+ */
88
+ public function show_mega_menu_metabox( $hidden ) {
89
+
90
+ if ( is_array( $hidden ) && count( $hidden ) > 0 ) {
91
+ foreach ( $hidden as $key => $value ) {
92
+ if ( $value == 'mega_menu_meta_box' ) {
93
+ unset( $hidden[$key] );
94
+ }
95
+ }
96
+ }
97
+
98
+ return $hidden;
99
+ }
100
+
101
+
102
+ /**
103
+ * Adds the meta box container
104
+ *
105
+ * @since 1.0
106
+ */
107
+ public function register_nav_meta_box() {
108
+ global $pagenow;
109
+
110
+ if ( 'nav-menus.php' == $pagenow ) {
111
+
112
+ if ( isset( $_GET['mmm_get_started'] ) && ( ! isset( $_POST ) || ! count( $_POST ) ) ) {
113
+ $class = 'mega_menu_meta_box mmm_get_started';
114
+ } else {
115
+ $class = 'mega_menu_meta_box';
116
+ }
117
+
118
+ add_meta_box(
119
+ $class,
120
+ __("Max Mega Menu Settings", "megamenu"),
121
+ array( $this, 'metabox_contents' ),
122
+ 'nav-menus',
123
+ 'side',
124
+ 'high'
125
+ );
126
+
127
+ }
128
+
129
+ }
130
+
131
+
132
+ /**
133
+ * Enqueue required CSS and JS for Mega Menu
134
+ *
135
+ * @since 1.0
136
+ */
137
+ public function enqueue_menu_page_scripts($hook) {
138
+
139
+ if( 'nav-menus.php' != $hook )
140
+ return;
141
+
142
+ // http://wordpress.org/plugins/image-widget/
143
+ if ( class_exists( 'Tribe_Image_Widget' ) ) {
144
+ $image_widget = new Tribe_Image_Widget;
145
+ $image_widget->admin_setup();
146
+ }
147
+
148
+ // Compatibility fix for SlideDeck Pro
149
+ wp_deregister_script('codemirror');
150
+ wp_deregister_style('codemirror');
151
+
152
+ // Compatibility fix for Pinboard Theme
153
+ wp_deregister_script('colorbox');
154
+ wp_deregister_style('colorbox');
155
+
156
+ // Compatibility fix for AGP Font Awesome Collection
157
+ wp_deregister_script('colorbox-js');
158
+ wp_deregister_style('colorbox-css');
159
+
160
+ wp_enqueue_style( 'colorbox', MEGAMENU_BASE_URL . 'js/colorbox/colorbox.css', false, MEGAMENU_VERSION );
161
+ wp_enqueue_style( 'mega-menu', MEGAMENU_BASE_URL . 'css/admin/menus.css', false, MEGAMENU_VERSION );
162
+
163
+ wp_enqueue_script( 'mega-menu', MEGAMENU_BASE_URL . 'js/admin.js', array(
164
+ 'jquery',
165
+ 'jquery-ui-core',
166
+ 'jquery-ui-sortable',
167
+ 'jquery-ui-accordion'),
168
+ MEGAMENU_VERSION );
169
+
170
+ wp_enqueue_script( 'colorbox', MEGAMENU_BASE_URL . 'js/colorbox/jquery.colorbox-min.js', array( 'jquery' ), MEGAMENU_VERSION );
171
+
172
+ wp_localize_script( 'mega-menu', 'megamenu',
173
+ array(
174
+ 'debug_launched' => __("Launched for Menu ID", "megamenu"),
175
+ 'get_started' => __("Use these settings to enable Max Mega Menu", "megamenu"),
176
+ 'launch_lightbox' => __("Mega Menu", "megamenu"),
177
+ 'is_disabled_error' => __("Please enable Max Mega Menu using the settings on the left of this page.", "megamenu"),
178
+ 'saving' => __("Saving", "megamenu"),
179
+ 'nonce' => wp_create_nonce('megamenu_edit'),
180
+ 'nonce_check_failed' => __("Oops. Something went wrong. Please reload the page.", "megamenu")
181
+ )
182
+ );
183
+
184
+ do_action("megamenu_enqueue_admin_scripts");
185
+
186
+ }
187
+
188
+ /**
189
+ * Show the Meta Menu settings
190
+ *
191
+ * @since 1.0
192
+ */
193
+ public function metabox_contents() {
194
+
195
+ $menu_id = $this->get_selected_menu_id();
196
+
197
+ do_action("megamenu_save_settings");
198
+
199
+ $this->print_enable_megamenu_options( $menu_id );
200
+
201
+ }
202
+
203
+
204
+ /**
205
+ * Save the mega menu settings (submitted from Menus Page Meta Box)
206
+ *
207
+ * @since 1.0
208
+ */
209
+ public function save() {
210
+
211
+ if ( isset( $_POST['menu'] ) && $_POST['menu'] > 0 && is_nav_menu( $_POST['menu'] ) && isset( $_POST['megamenu_meta'] ) ) {
212
+
213
+ $submitted_settings = $_POST['megamenu_meta'];
214
+
215
+ if ( ! get_option( 'megamenu_settings' ) ) {
216
+
217
+ add_option( 'megamenu_settings', $submitted_settings );
218
+
219
+ } else {
220
+
221
+ $existing_settings = get_option( 'megamenu_settings' );
222
+
223
+ $new_settings = array_merge( $existing_settings, $submitted_settings );
224
+
225
+ update_option( 'megamenu_settings', $new_settings );
226
+
227
+ }
228
+
229
+ do_action( "megamenu_after_save_settings" );
230
+
231
+ do_action( "megamenu_delete_cache" );
232
+
233
+ }
234
+
235
+ }
236
+
237
+
238
+ /**
239
+ * Print the custom Meta Box settings
240
+ *
241
+ * @param int $menu_id
242
+ * @since 1.0
243
+ */
244
+ public function print_enable_megamenu_options( $menu_id ) {
245
+
246
+ $tagged_menu_locations = $this->get_tagged_theme_locations_for_menu_id( $menu_id );
247
+ $theme_locations = get_registered_nav_menus();
248
+
249
+ $saved_settings = get_option( 'megamenu_settings' );
250
+
251
+ if ( ! count( $theme_locations ) ) {
252
+
253
+ $link = '<a href="https://www.maxmegamenu.com/documentation/getting-started/max-mega-menu-widget/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro" target="_blank">' . __("here", "megamenu") . '</a>';
254
+
255
+ echo "<p>" . __("This theme does not register any menu locations.", "megamenu") . "</p>";
256
+ echo "<p>" . __("You will need to create a new menu location and use the Max Mega Menu widget or shortcode to display the menu on your site.", "megamenu") . "</p>";
257
+ echo "<p>" . str_replace( "{link}", $link, __("Click {link} for instructions.", "megamenu") ) . "</p>";
258
+
259
+ } else if ( ! count ( $tagged_menu_locations ) ) {
260
+
261
+ echo "<p>" . __("Please assign this menu to a theme location to enable the Mega Menu settings.", "megamenu") . "</p>";
262
+
263
+ } else { ?>
264
+
265
+ <?php if ( count( $tagged_menu_locations ) == 1 ) : ?>
266
+
267
+ <?php
268
+
269
+ $locations = array_keys( $tagged_menu_locations );
270
+ $location = $locations[0];
271
+
272
+ if (isset( $tagged_menu_locations[ $location ] ) ) {
273
+ $this->settings_table( $location, $saved_settings );
274
+ }
275
+
276
+ ?>
277
+
278
+ <?php else: ?>
279
+
280
+ <div id='megamenu_accordion'>
281
+
282
+ <?php foreach ( $theme_locations as $location => $name ) : ?>
283
+
284
+ <?php if ( isset( $tagged_menu_locations[ $location ] ) ): ?>
285
+
286
+ <h3 class='theme_settings'><?php echo esc_html( $name ); ?></h3>
287
+
288
+ <div class='accordion_content' style='display: none;'>
289
+ <?php $this->settings_table( $location, $saved_settings ); ?>
290
+ </div>
291
+
292
+ <?php endif; ?>
293
+
294
+ <?php endforeach;?>
295
+ </div>
296
+
297
+ <?php endif; ?>
298
+
299
+ <?php
300
+
301
+ submit_button( __( 'Save' ), 'max-mega-menu-save button-primary alignright');
302
+
303
+ }
304
+
305
+ }
306
+
307
+ /**
308
+ * Print the list of Mega Menu settings
309
+ *
310
+ * @since 1.0
311
+ */
312
+ public function settings_table( $location, $settings ) {
313
+ ?>
314
+ <table>
315
+ <tr>
316
+ <td><?php _e("Enable", "megamenu") ?></td>
317
+ <td>
318
+ <input type='checkbox' class='megamenu_enabled' name='megamenu_meta[<?php echo $location ?>][enabled]' value='1' <?php checked( isset( $settings[$location]['enabled'] ) ); ?> />
319
+ </td>
320
+ </tr>
321
+ <tr>
322
+ <td><?php _e("Event", "megamenu") ?></td>
323
+ <td>
324
+ <select name='megamenu_meta[<?php echo $location ?>][event]'>
325
+ <option value='hover' <?php selected( isset( $settings[$location]['event'] ) && $settings[$location]['event'] == 'hover'); ?>><?php _e("Hover", "megamenu"); ?></option>
326
+ <option value='click' <?php selected( isset( $settings[$location]['event'] ) && $settings[$location]['event'] == 'click'); ?>><?php _e("Click", "megamenu"); ?></option>
327
+ </select>
328
+ </td>
329
+ </tr>
330
+ <tr>
331
+ <td><?php _e("Effect", "megamenu") ?></td>
332
+ <td>
333
+ <select name='megamenu_meta[<?php echo $location ?>][effect]'>
334
+ <?php
335
+
336
+ $selected = isset( $settings[$location]['effect'] ) ? $settings[$location]['effect'] : 'disabled';
337
+
338
+ $options = apply_filters("megamenu_effects", array(
339
+ "disabled" => array(
340
+ 'label' => __("None", "megamenu"),
341
+ 'selected' => $selected == 'disabled',
342
+ ),
343
+ "fade" => array(
344
+ 'label' => __("Fade", "megamenu"),
345
+ 'selected' => $selected == 'fade',
346
+ ),
347
+ "slide" => array(
348
+ 'label' => __("Slide", "megamenu"),
349
+ 'selected' => $selected == 'slide',
350
+ )
351
+ ), $selected );
352
+
353
+ foreach ( $options as $key => $value ) {
354
+ ?><option value='<?php echo $key ?>' <?php selected( $value['selected'] ); ?>><?php echo $value['label'] ?></option><?php
355
+ }
356
+
357
+ ?>
358
+ </select>
359
+ </td>
360
+ </tr>
361
+ <tr>
362
+ <td><?php _e("Theme", "megamenu"); ?></td>
363
+ <td>
364
+
365
+ <select name='megamenu_meta[<?php echo $location ?>][theme]'>
366
+ <?php
367
+ $style_manager = new Mega_Menu_Style_Manager();
368
+ $themes = $style_manager->get_themes();
369
+ $selected_theme = isset( $settings[$location]['theme'] ) ? $settings[$location]['theme'] : 'default';
370
+
371
+ foreach ( $themes as $key => $theme ) {
372
+ echo "<option value='{$key}' " . selected( $selected_theme, $key ) . ">{$theme['title']}</option>";
373
+ }
374
+ ?>
375
+ </select>
376
+ </td>
377
+ </tr>
378
+
379
+ <?php do_action( 'megamenu_settings_table', $location, $settings ); ?>
380
+ </table>
381
+ <?php
382
+ }
383
+
384
+
385
+ /**
386
+ * Return the locations that a specific menu ID has been tagged to.
387
+ *
388
+ * @param $menu_id int
389
+ * @return array
390
+ */
391
+ public function get_tagged_theme_locations_for_menu_id( $menu_id ) {
392
+
393
+ $locations = array();
394
+
395
+ $nav_menu_locations = get_nav_menu_locations();
396
+
397
+ foreach ( get_registered_nav_menus() as $id => $name ) {
398
+
399
+ if ( isset( $nav_menu_locations[ $id ] ) && $nav_menu_locations[$id] == $menu_id )
400
+ $locations[$id] = $name;
401
+
402
+ }
403
+
404
+ return $locations;
405
+ }
406
+
407
+ /**
408
+ * Get the current menu ID.
409
+ *
410
+ * Most of this taken from wp-admin/nav-menus.php (no built in functions to do this)
411
+ *
412
+ * @since 1.0
413
+ * @return int
414
+ */
415
+ public function get_selected_menu_id() {
416
+
417
+ $nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
418
+
419
+ $menu_count = count( $nav_menus );
420
+
421
+ $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
422
+
423
+ $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
424
+
425
+ // If we have one theme location, and zero menus, we take them right into editing their first menu
426
+ $page_count = wp_count_posts( 'page' );
427
+ $one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
428
+
429
+ // Get recently edited nav menu
430
+ $recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
431
+ if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
432
+ $recently_edited = $nav_menu_selected_id;
433
+
434
+ // Use $recently_edited if none are selected
435
+ if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
436
+ $nav_menu_selected_id = $recently_edited;
437
+
438
+ // On deletion of menu, if another menu exists, show it
439
+ if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
440
+ $nav_menu_selected_id = $nav_menus[0]->term_id;
441
+
442
+ // Set $nav_menu_selected_id to 0 if no menus
443
+ if ( $one_theme_location_no_menus ) {
444
+ $nav_menu_selected_id = 0;
445
+ } elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
446
+ // if we have no selection yet, and we have menus, set to the first one in the list
447
+ $nav_menu_selected_id = $nav_menus[0]->term_id;
448
+ }
449
+
450
+ return $nav_menu_selected_id;
451
+
452
+ }
453
+ }
454
+
455
+ endif;
classes/scssc.inc.php ADDED
@@ -0,0 +1,4443 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SCSS compiler written in PHP
4
+ *
5
+ * @copyright 2012-2013 Leaf Corcoran
6
+ *
7
+ * @license http://opensource.org/licenses/gpl-license GPL-3.0
8
+ * @license http://opensource.org/licenses/MIT MIT
9
+ *
10
+ * @link http://leafo.net/scssphp
11
+ */
12
+
13
+ /**
14
+ * The scss compiler and parser.
15
+ *
16
+ * Converting SCSS to CSS is a three stage process. The incoming file is parsed
17
+ * by `scssc_parser` into a syntax tree, then it is compiled into another tree
18
+ * representing the CSS structure by `scssc`. The CSS tree is fed into a
19
+ * formatter, like `scssc_formatter` which then outputs CSS as a string.
20
+ *
21
+ * During the first compile, all values are *reduced*, which means that their
22
+ * types are brought to the lowest form before being dump as strings. This
23
+ * handles math equations, variable dereferences, and the like.
24
+ *
25
+ * The `parse` function of `scssc` is the entry point.
26
+ *
27
+ * In summary:
28
+ *
29
+ * The `scssc` class creates an instance of the parser, feeds it SCSS code,
30
+ * then transforms the resulting tree to a CSS tree. This class also holds the
31
+ * evaluation context, such as all available mixins and variables at any given
32
+ * time.
33
+ *
34
+ * The `scssc_parser` class is only concerned with parsing its input.
35
+ *
36
+ * The `scssc_formatter` takes a CSS tree, and dumps it to a formatted string,
37
+ * handling things like indentation.
38
+ */
39
+
40
+ if (!class_exists("scssc")) :
41
+ /**
42
+ * SCSS compiler
43
+ *
44
+ * @author Leaf Corcoran <leafot@gmail.com>
45
+ */
46
+ class scssc {
47
+ static public $VERSION = "v0.0.10";
48
+
49
+ static protected $operatorNames = array(
50
+ '+' => "add",
51
+ '-' => "sub",
52
+ '*' => "mul",
53
+ '/' => "div",
54
+ '%' => "mod",
55
+
56
+ '==' => "eq",
57
+ '!=' => "neq",
58
+ '<' => "lt",
59
+ '>' => "gt",
60
+
61
+ '<=' => "lte",
62
+ '>=' => "gte",
63
+ );
64
+
65
+ static protected $namespaces = array(
66
+ "special" => "%",
67
+ "mixin" => "@",
68
+ "function" => "^",
69
+ );
70
+
71
+ static protected $unitTable = array(
72
+ "in" => array(
73
+ "in" => 1,
74
+ "pt" => 72,
75
+ "pc" => 6,
76
+ "cm" => 2.54,
77
+ "mm" => 25.4,
78
+ "px" => 96,
79
+ )
80
+ );
81
+
82
+ static public $true = array("keyword", "true");
83
+ static public $false = array("keyword", "false");
84
+ static public $null = array("null");
85
+
86
+ static public $defaultValue = array("keyword", "");
87
+ static public $selfSelector = array("self");
88
+
89
+ protected $importPaths = array("");
90
+ protected $importCache = array();
91
+
92
+ protected $userFunctions = array();
93
+
94
+ protected $numberPrecision = 5;
95
+
96
+ protected $formatter = "scss_formatter_nested";
97
+
98
+ public function compile($code, $name=null) {
99
+ $this->indentLevel = -1;
100
+ $this->commentsSeen = array();
101
+ $this->extends = array();
102
+ $this->extendsMap = array();
103
+
104
+ $locale = setlocale(LC_NUMERIC, 0);
105
+ setlocale(LC_NUMERIC, "C");
106
+
107
+ $this->parsedFiles = array();
108
+ $this->parser = new scss_parser($name);
109
+ $tree = $this->parser->parse($code);
110
+
111
+ $this->formatter = new $this->formatter();
112
+
113
+ $this->env = null;
114
+ $this->scope = null;
115
+
116
+ $this->compileRoot($tree);
117
+
118
+ $out = $this->formatter->format($this->scope);
119
+
120
+ setlocale(LC_NUMERIC, $locale);
121
+ return $out;
122
+ }
123
+
124
+ protected function isSelfExtend($target, $origin) {
125
+ foreach ($origin as $sel) {
126
+ if (in_array($target, $sel)) {
127
+ return true;
128
+ }
129
+ }
130
+
131
+ return false;
132
+ }
133
+
134
+ protected function pushExtends($target, $origin) {
135
+ if ($this->isSelfExtend($target, $origin)) {
136
+ return;
137
+ }
138
+
139
+ $i = count($this->extends);
140
+ $this->extends[] = array($target, $origin);
141
+
142
+ foreach ($target as $part) {
143
+ if (isset($this->extendsMap[$part])) {
144
+ $this->extendsMap[$part][] = $i;
145
+ } else {
146
+ $this->extendsMap[$part] = array($i);
147
+ }
148
+ }
149
+ }
150
+
151
+ protected function makeOutputBlock($type, $selectors = null) {
152
+ $out = new stdClass;
153
+ $out->type = $type;
154
+ $out->lines = array();
155
+ $out->children = array();
156
+ $out->parent = $this->scope;
157
+ $out->selectors = $selectors;
158
+ $out->depth = $this->env->depth;
159
+
160
+ return $out;
161
+ }
162
+
163
+ protected function matchExtendsSingle($single, &$outOrigin) {
164
+ $counts = array();
165
+ foreach ($single as $part) {
166
+ if (!is_string($part)) return false; // hmm
167
+
168
+ if (isset($this->extendsMap[$part])) {
169
+ foreach ($this->extendsMap[$part] as $idx) {
170
+ $counts[$idx] =
171
+ isset($counts[$idx]) ? $counts[$idx] + 1 : 1;
172
+ }
173
+ }
174
+ }
175
+
176
+ $outOrigin = array();
177
+ $found = false;
178
+
179
+ foreach ($counts as $idx => $count) {
180
+ list($target, $origin) = $this->extends[$idx];
181
+
182
+ // check count
183
+ if ($count != count($target)) continue;
184
+
185
+ // check if target is subset of single
186
+ if (array_diff(array_intersect($single, $target), $target)) continue;
187
+
188
+ $rem = array_diff($single, $target);
189
+
190
+ foreach ($origin as $j => $new) {
191
+ // prevent infinite loop when target extends itself
192
+ foreach ($new as $new_selector) {
193
+ if (!array_diff($single, $new_selector)) {
194
+ continue 2;
195
+ }
196
+ }
197
+
198
+ $origin[$j][count($origin[$j]) - 1] = $this->combineSelectorSingle(end($new), $rem);
199
+ }
200
+
201
+ $outOrigin = array_merge($outOrigin, $origin);
202
+
203
+ $found = true;
204
+ }
205
+
206
+ return $found;
207
+ }
208
+
209
+ protected function combineSelectorSingle($base, $other) {
210
+ $tag = null;
211
+ $out = array();
212
+
213
+ foreach (array($base, $other) as $single) {
214
+ foreach ($single as $part) {
215
+ if (preg_match('/^[^\[.#:]/', $part)) {
216
+ $tag = $part;
217
+ } else {
218
+ $out[] = $part;
219
+ }
220
+ }
221
+ }
222
+
223
+ if ($tag) {
224
+ array_unshift($out, $tag);
225
+ }
226
+
227
+ return $out;
228
+ }
229
+
230
+ protected function matchExtends($selector, &$out, $from = 0, $initial=true) {
231
+ foreach ($selector as $i => $part) {
232
+ if ($i < $from) continue;
233
+
234
+ if ($this->matchExtendsSingle($part, $origin)) {
235
+ $before = array_slice($selector, 0, $i);
236
+ $after = array_slice($selector, $i + 1);
237
+
238
+ foreach ($origin as $new) {
239
+ $k = 0;
240
+
241
+ // remove shared parts
242
+ if ($initial) {
243
+ foreach ($before as $k => $val) {
244
+ if (!isset($new[$k]) || $val != $new[$k]) {
245
+ break;
246
+ }
247
+ }
248
+ }
249
+
250
+ $result = array_merge(
251
+ $before,
252
+ $k > 0 ? array_slice($new, $k) : $new,
253
+ $after);
254
+
255
+
256
+ if ($result == $selector) continue;
257
+ $out[] = $result;
258
+
259
+ // recursively check for more matches
260
+ $this->matchExtends($result, $out, $i, false);
261
+
262
+ // selector sequence merging
263
+ if (!empty($before) && count($new) > 1) {
264
+ $result2 = array_merge(
265
+ array_slice($new, 0, -1),
266
+ $k > 0 ? array_slice($before, $k) : $before,
267
+ array_slice($new, -1),
268
+ $after);
269
+
270
+ $out[] = $result2;
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+
277
+ protected function flattenSelectors($block, $parentKey = null) {
278
+ if ($block->selectors) {
279
+ $selectors = array();
280
+ foreach ($block->selectors as $s) {
281
+ $selectors[] = $s;
282
+ if (!is_array($s)) continue;
283
+ // check extends
284
+ if (!empty($this->extendsMap)) {
285
+ $this->matchExtends($s, $selectors);
286
+ }
287
+ }
288
+
289
+ $block->selectors = array();
290
+ $placeholderSelector = false;
291
+ foreach ($selectors as $selector) {
292
+ if ($this->hasSelectorPlaceholder($selector)) {
293
+ $placeholderSelector = true;
294
+ continue;
295
+ }
296
+ $block->selectors[] = $this->compileSelector($selector);
297
+ }
298
+
299
+ if ($placeholderSelector && 0 == count($block->selectors) && null !== $parentKey) {
300
+ unset($block->parent->children[$parentKey]);
301
+ return;
302
+ }
303
+ }
304
+
305
+ foreach ($block->children as $key => $child) {
306
+ $this->flattenSelectors($child, $key);
307
+ }
308
+ }
309
+
310
+ protected function compileRoot($rootBlock) {
311
+ $this->pushEnv($rootBlock);
312
+ $this->scope = $this->makeOutputBlock("root");
313
+
314
+ $this->compileChildren($rootBlock->children, $this->scope);
315
+ $this->flattenSelectors($this->scope);
316
+
317
+ $this->popEnv();
318
+ }
319
+
320
+ protected function compileMedia($media) {
321
+ $this->pushEnv($media);
322
+
323
+ $mediaQuery = $this->compileMediaQuery($this->multiplyMedia($this->env));
324
+
325
+ if (!empty($mediaQuery)) {
326
+
327
+ $this->scope = $this->makeOutputBlock("media", array($mediaQuery));
328
+
329
+ $parentScope = $this->mediaParent($this->scope);
330
+
331
+ $parentScope->children[] = $this->scope;
332
+
333
+ // top level properties in a media cause it to be wrapped
334
+ $needsWrap = false;
335
+ foreach ($media->children as $child) {
336
+ $type = $child[0];
337
+ if ($type !== 'block' && $type !== 'media' && $type !== 'directive') {
338
+ $needsWrap = true;
339
+ break;
340
+ }
341
+ }
342
+
343
+ if ($needsWrap) {
344
+ $wrapped = (object)array(
345
+ "selectors" => array(),
346
+ "children" => $media->children
347
+ );
348
+ $media->children = array(array("block", $wrapped));
349
+ }
350
+
351
+ $this->compileChildren($media->children, $this->scope);
352
+
353
+ $this->scope = $this->scope->parent;
354
+ }
355
+
356
+ $this->popEnv();
357
+ }
358
+
359
+ protected function mediaParent($scope) {
360
+ while (!empty($scope->parent)) {
361
+ if (!empty($scope->type) && $scope->type != "media") {
362
+ break;
363
+ }
364
+ $scope = $scope->parent;
365
+ }
366
+
367
+ return $scope;
368
+ }
369
+
370
+ // TODO refactor compileNestedBlock and compileMedia into same thing
371
+ protected function compileNestedBlock($block, $selectors) {
372
+ $this->pushEnv($block);
373
+
374
+ $this->scope = $this->makeOutputBlock($block->type, $selectors);
375
+ $this->scope->parent->children[] = $this->scope;
376
+ $this->compileChildren($block->children, $this->scope);
377
+
378
+ $this->scope = $this->scope->parent;
379
+ $this->popEnv();
380
+ }
381
+
382
+ /**
383
+ * Recursively compiles a block.
384
+ *
385
+ * A block is analogous to a CSS block in most cases. A single SCSS document
386
+ * is encapsulated in a block when parsed, but it does not have parent tags
387
+ * so all of its children appear on the root level when compiled.
388
+ *
389
+ * Blocks are made up of selectors and children.
390
+ *
391
+ * The children of a block are just all the blocks that are defined within.
392
+ *
393
+ * Compiling the block involves pushing a fresh environment on the stack,
394
+ * and iterating through the props, compiling each one.
395
+ *
396
+ * @see scss::compileChild()
397
+ *
398
+ * @param \StdClass $block
399
+ */
400
+ protected function compileBlock($block) {
401
+ $env = $this->pushEnv($block);
402
+
403
+ $env->selectors =
404
+ array_map(array($this, "evalSelector"), $block->selectors);
405
+
406
+ $out = $this->makeOutputBlock(null, $this->multiplySelectors($env));
407
+ $this->scope->children[] = $out;
408
+ $this->compileChildren($block->children, $out);
409
+
410
+ $this->popEnv();
411
+ }
412
+
413
+ // joins together .classes and #ids
414
+ protected function flattenSelectorSingle($single) {
415
+ $joined = array();
416
+ foreach ($single as $part) {
417
+ if (empty($joined) ||
418
+ !is_string($part) ||
419
+ preg_match('/[\[.:#%]/', $part))
420
+ {
421
+ $joined[] = $part;
422
+ continue;
423
+ }
424
+
425
+ if (is_array(end($joined))) {
426
+ $joined[] = $part;
427
+ } else {
428
+ $joined[count($joined) - 1] .= $part;
429
+ }
430
+ }
431
+
432
+ return $joined;
433
+ }
434
+
435
+ // replaces all the interpolates
436
+ protected function evalSelector($selector) {
437
+ return array_map(array($this, "evalSelectorPart"), $selector);
438
+ }
439
+
440
+ protected function evalSelectorPart($piece) {
441
+ foreach ($piece as &$p) {
442
+ if (!is_array($p)) continue;
443
+
444
+ switch ($p[0]) {
445
+ case "interpolate":
446
+ $p = $this->compileValue($p);
447
+ break;
448
+ case "string":
449
+ $p = $this->compileValue($p);
450
+ break;
451
+ }
452
+ }
453
+
454
+ return $this->flattenSelectorSingle($piece);
455
+ }
456
+
457
+ // compiles to string
458
+ // self(&) should have been replaced by now
459
+ protected function compileSelector($selector) {
460
+ if (!is_array($selector)) return $selector; // media and the like
461
+
462
+ return implode(" ", array_map(
463
+ array($this, "compileSelectorPart"), $selector));
464
+ }
465
+
466
+ protected function compileSelectorPart($piece) {
467
+ foreach ($piece as &$p) {
468
+ if (!is_array($p)) continue;
469
+
470
+ switch ($p[0]) {
471
+ case "self":
472
+ $p = "&";
473
+ break;
474
+ default:
475
+ $p = $this->compileValue($p);
476
+ break;
477
+ }
478
+ }
479
+
480
+ return implode($piece);
481
+ }
482
+
483
+ protected function hasSelectorPlaceholder($selector)
484
+ {
485
+ if (!is_array($selector)) return false;
486
+
487
+ foreach ($selector as $parts) {
488
+ foreach ($parts as $part) {
489
+ if ('%' == $part[0]) {
490
+ return true;
491
+ }
492
+ }
493
+ }
494
+
495
+ return false;
496
+ }
497
+
498
+ protected function compileChildren($stms, $out) {
499
+ foreach ($stms as $stm) {
500
+ $ret = $this->compileChild($stm, $out);
501
+ if (isset($ret)) return $ret;
502
+ }
503
+ }
504
+
505
+ protected function compileMediaQuery($queryList) {
506
+ $out = "@media";
507
+ $first = true;
508
+ foreach ($queryList as $query){
509
+ $type = null;
510
+ $parts = array();
511
+ foreach ($query as $q) {
512
+ switch ($q[0]) {
513
+ case "mediaType":
514
+ if ($type) {
515
+ $type = $this->mergeMediaTypes($type, array_map(array($this, "compileValue"), array_slice($q, 1)));
516
+ if (empty($type)) { // merge failed
517
+ return null;
518
+ }
519
+ } else {
520
+ $type = array_map(array($this, "compileValue"), array_slice($q, 1));
521
+ }
522
+ break;
523
+ case "mediaExp":
524
+ if (isset($q[2])) {
525
+ $parts[] = "(". $this->compileValue($q[1]) . $this->formatter->assignSeparator . $this->compileValue($q[2]) . ")";
526
+ } else {
527
+ $parts[] = "(" . $this->compileValue($q[1]) . ")";
528
+ }
529
+ break;
530
+ }
531
+ }
532
+ if ($type) {
533
+ array_unshift($parts, implode(' ', array_filter($type)));
534
+ }
535
+ if (!empty($parts)) {
536
+ if ($first) {
537
+ $first = false;
538
+ $out .= " ";
539
+ } else {
540
+ $out .= $this->formatter->tagSeparator;
541
+ }
542
+ $out .= implode(" and ", $parts);
543
+ }
544
+ }
545
+ return $out;
546
+ }
547
+
548
+ protected function mergeMediaTypes($type1, $type2) {
549
+ if (empty($type1)) {
550
+ return $type2;
551
+ }
552
+ if (empty($type2)) {
553
+ return $type1;
554
+ }
555
+ $m1 = '';
556
+ $t1 = '';
557
+ if (count($type1) > 1) {
558
+ $m1= strtolower($type1[0]);
559
+ $t1= strtolower($type1[1]);
560
+ } else {
561
+ $t1 = strtolower($type1[0]);
562
+ }
563
+ $m2 = '';
564
+ $t2 = '';
565
+ if (count($type2) > 1) {
566
+ $m2 = strtolower($type2[0]);
567
+ $t2 = strtolower($type2[1]);
568
+ } else {
569
+ $t2 = strtolower($type2[0]);
570
+ }
571
+ if (($m1 == 'not') ^ ($m2 == 'not')) {
572
+ if ($t1 == $t2) {
573
+ return null;
574
+ }
575
+ return array(
576
+ $m1 == 'not' ? $m2 : $m1,
577
+ $m1 == 'not' ? $t2 : $t1
578
+ );
579
+ } elseif ($m1 == 'not' && $m2 == 'not') {
580
+ # CSS has no way of representing "neither screen nor print"
581
+ if ($t1 != $t2) {
582
+ return null;
583
+ }
584
+ return array('not', $t1);
585
+ } elseif ($t1 != $t2) {
586
+ return null;
587
+ } else { // t1 == t2, neither m1 nor m2 are "not"
588
+ return array(empty($m1)? $m2 : $m1, $t1);
589
+ }
590
+ }
591
+
592
+ // returns true if the value was something that could be imported
593
+ protected function compileImport($rawPath, $out) {
594
+ if ($rawPath[0] == "string") {
595
+ $path = $this->compileStringContent($rawPath);
596
+ if ($path = $this->findImport($path)) {
597
+ $this->importFile($path, $out);
598
+ return true;
599
+ }
600
+ return false;
601
+ }
602
+ if ($rawPath[0] == "list") {
603
+ // handle a list of strings
604
+ if (count($rawPath[2]) == 0) return false;
605
+ foreach ($rawPath[2] as $path) {
606
+ if ($path[0] != "string") return false;
607
+ }
608
+
609
+ foreach ($rawPath[2] as $path) {
610
+ $this->compileImport($path, $out);
611
+ }
612
+
613
+ return true;
614
+ }
615
+
616
+ return false;
617
+ }
618
+
619
+ // return a value to halt execution
620
+ protected function compileChild($child, $out) {
621
+ $this->sourcePos = isset($child[-1]) ? $child[-1] : -1;
622
+ $this->sourceParser = isset($child[-2]) ? $child[-2] : $this->parser;
623
+
624
+ switch ($child[0]) {
625
+ case "import":
626
+ list(,$rawPath) = $child;
627
+ $rawPath = $this->reduce($rawPath);
628
+ if (!$this->compileImport($rawPath, $out)) {
629
+ $out->lines[] = "@import " . $this->compileValue($rawPath) . ";";
630
+ }
631
+ break;
632
+ case "directive":
633
+ list(, $directive) = $child;
634
+ $s = "@" . $directive->name;
635
+ if (!empty($directive->value)) {
636
+ $s .= " " . $this->compileValue($directive->value);
637
+ }
638
+ $this->compileNestedBlock($directive, array($s));
639
+ break;
640
+ case "media":
641
+ $this->compileMedia($child[1]);
642
+ break;
643
+ case "block":
644
+ $this->compileBlock($child[1]);
645
+ break;
646
+ case "charset":
647
+ $out->lines[] = "@charset ".$this->compileValue($child[1]).";";
648
+ break;
649
+ case "assign":
650
+ list(,$name, $value) = $child;
651
+ if ($name[0] == "var") {
652
+ $isDefault = !empty($child[3]);
653
+
654
+ if ($isDefault) {
655
+ $existingValue = $this->get($name[1], true);
656
+ $shouldSet = $existingValue === true || $existingValue == self::$null;
657
+ }
658
+
659
+ if (!$isDefault || $shouldSet) {
660
+ $this->set($name[1], $this->reduce($value));
661
+ }
662
+ break;
663
+ }
664
+
665
+ // if the value reduces to null from something else then
666
+ // the property should be discarded
667
+ if ($value[0] != "null") {
668
+ $value = $this->reduce($value);
669
+ if ($value[0] == "null") {
670
+ break;
671
+ }
672
+ }
673
+
674
+ $compiledValue = $this->compileValue($value);
675
+ $out->lines[] = $this->formatter->property(
676
+ $this->compileValue($name),
677
+ $compiledValue);
678
+ break;
679
+ case "comment":
680
+ $out->lines[] = $child[1];
681
+ break;
682
+ case "mixin":
683
+ case "function":
684
+ list(,$block) = $child;
685
+ $this->set(self::$namespaces[$block->type] . $block->name, $block);
686
+ break;
687
+ case "extend":
688
+ list(, $selectors) = $child;
689
+ foreach ($selectors as $sel) {
690
+ // only use the first one
691
+ $sel = current($this->evalSelector($sel));
692
+ $this->pushExtends($sel, $out->selectors);
693
+ }
694
+ break;
695
+ case "if":
696
+ list(, $if) = $child;
697
+ if ($this->isTruthy($this->reduce($if->cond, true))) {
698
+ return $this->compileChildren($if->children, $out);
699
+ } else {
700
+ foreach ($if->cases as $case) {
701
+ if ($case->type == "else" ||
702
+ $case->type == "elseif" && $this->isTruthy($this->reduce($case->cond)))
703
+ {
704
+ return $this->compileChildren($case->children, $out);
705
+ }
706
+ }
707
+ }
708
+ break;
709
+ case "return":
710
+ return $this->reduce($child[1], true);
711
+ case "each":
712
+ list(,$each) = $child;
713
+ $list = $this->coerceList($this->reduce($each->list));
714
+ foreach ($list[2] as $item) {
715
+ $this->pushEnv();
716
+ $this->set($each->var, $item);
717
+ // TODO: allow return from here
718
+ $this->compileChildren($each->children, $out);
719
+ $this->popEnv();
720
+ }
721
+ break;
722
+ case "while":
723
+ list(,$while) = $child;
724
+ while ($this->isTruthy($this->reduce($while->cond, true))) {
725
+ $ret = $this->compileChildren($while->children, $out);
726
+ if ($ret) return $ret;
727
+ }
728
+ break;
729
+ case "for":
730
+ list(,$for) = $child;
731
+ $start = $this->reduce($for->start, true);
732
+ $start = $start[1];
733
+ $end = $this->reduce($for->end, true);
734
+ $end = $end[1];
735
+ $d = $start < $end ? 1 : -1;
736
+
737
+ while (true) {
738
+ if ((!$for->until && $start - $d == $end) ||
739
+ ($for->until && $start == $end))
740
+ {
741
+ break;
742
+ }
743
+
744
+ $this->set($for->var, array("number", $start, ""));
745
+ $start += $d;
746
+
747
+ $ret = $this->compileChildren($for->children, $out);
748
+ if ($ret) return $ret;
749
+ }
750
+
751
+ break;
752
+ case "nestedprop":
753
+ list(,$prop) = $child;
754
+ $prefixed = array();
755
+ $prefix = $this->compileValue($prop->prefix) . "-";
756
+ foreach ($prop->children as $child) {
757
+ if ($child[0] == "assign") {
758
+ array_unshift($child[1][2], $prefix);
759
+ }
760
+ if ($child[0] == "nestedprop") {
761
+ array_unshift($child[1]->prefix[2], $prefix);
762
+ }
763
+ $prefixed[] = $child;
764
+ }
765
+ $this->compileChildren($prefixed, $out);
766
+ break;
767
+ case "include": // including a mixin
768
+ list(,$name, $argValues, $content) = $child;
769
+ $mixin = $this->get(self::$namespaces["mixin"] . $name, false);
770
+ if (!$mixin) {
771
+ $this->throwError("Undefined mixin $name");
772
+ }
773
+
774
+ $callingScope = $this->env;
775
+
776
+ // push scope, apply args
777
+ $this->pushEnv();
778
+ if ($this->env->depth > 0) {
779
+ $this->env->depth--;
780
+ }
781
+
782
+ if (isset($content)) {
783
+ $content->scope = $callingScope;
784
+ $this->setRaw(self::$namespaces["special"] . "content", $content);
785
+ }
786
+
787
+ if (isset($mixin->args)) {
788
+ $this->applyArguments($mixin->args, $argValues);
789
+ }
790
+
791
+ foreach ($mixin->children as $child) {
792
+ $this->compileChild($child, $out);
793
+ }
794
+
795
+ $this->popEnv();
796
+
797
+ break;
798
+ case "mixin_content":
799
+ $content = $this->get(self::$namespaces["special"] . "content");
800
+ if (!isset($content)) {
801
+ $this->throwError("Expected @content inside of mixin");
802
+ }
803
+
804
+ $strongTypes = array('include', 'block', 'for', 'while');
805
+ foreach ($content->children as $child) {
806
+ $this->storeEnv = (in_array($child[0], $strongTypes))
807
+ ? null
808
+ : $content->scope;
809
+
810
+ $this->compileChild($child, $out);
811
+ }
812
+
813
+ unset($this->storeEnv);
814
+ break;
815
+ case "debug":
816
+ list(,$value, $pos) = $child;
817
+ $line = $this->parser->getLineNo($pos);
818
+ $value = $this->compileValue($this->reduce($value, true));
819
+ fwrite(STDERR, "Line $line DEBUG: $value\n");
820
+ break;
821
+ default:
822
+ $this->throwError("unknown child type: $child[0]");
823
+ }
824
+ }
825
+
826
+ protected function expToString($exp) {
827
+ list(, $op, $left, $right, $inParens, $whiteLeft, $whiteRight) = $exp;
828
+ $content = array($this->reduce($left));
829
+ if ($whiteLeft) $content[] = " ";
830
+ $content[] = $op;
831
+ if ($whiteRight) $content[] = " ";
832
+ $content[] = $this->reduce($right);
833
+ return array("string", "", $content);
834
+ }
835
+
836
+ protected function isTruthy($value) {
837
+ return $value != self::$false && $value != self::$null;
838
+ }
839
+
840
+ // should $value cause its operand to eval
841
+ protected function shouldEval($value) {
842
+ switch ($value[0]) {
843
+ case "exp":
844
+ if ($value[1] == "/") {
845
+ return $this->shouldEval($value[2], $value[3]);
846
+ }
847
+ case "var":
848
+ case "fncall":
849
+ return true;
850
+ }
851
+ return false;
852
+ }
853
+
854
+ protected function reduce($value, $inExp = false) {
855
+ list($type) = $value;
856
+ switch ($type) {
857
+ case "exp":
858
+ list(, $op, $left, $right, $inParens) = $value;
859
+ $opName = isset(self::$operatorNames[$op]) ? self::$operatorNames[$op] : $op;
860
+
861
+ $inExp = $inExp || $this->shouldEval($left) || $this->shouldEval($right);
862
+
863
+ $left = $this->reduce($left, true);
864
+ $right = $this->reduce($right, true);
865
+
866
+ // only do division in special cases
867
+ if ($opName == "div" && !$inParens && !$inExp) {
868
+ if ($left[0] != "color" && $right[0] != "color") {
869
+ return $this->expToString($value);
870
+ }
871
+ }
872
+
873
+ $left = $this->coerceForExpression($left);
874
+ $right = $this->coerceForExpression($right);
875
+
876
+ $ltype = $left[0];
877
+ $rtype = $right[0];
878
+
879
+ // this tries:
880
+ // 1. op_[op name]_[left type]_[right type]
881
+ // 2. op_[left type]_[right type] (passing the op as first arg
882
+ // 3. op_[op name]
883
+ $fn = "op_${opName}_${ltype}_${rtype}";
884
+ if (is_callable(array($this, $fn)) ||
885
+ (($fn = "op_${ltype}_${rtype}") &&
886
+ is_callable(array($this, $fn)) &&
887
+ $passOp = true) ||
888
+ (($fn = "op_${opName}") &&
889
+ is_callable(array($this, $fn)) &&
890
+ $genOp = true))
891
+ {
892
+ $unitChange = false;
893
+ if (!isset($genOp) &&
894
+ $left[0] == "number" && $right[0] == "number")
895
+ {
896
+ if ($opName == "mod" && $right[2] != "") {
897
+ $this->throwError("Cannot modulo by a number with units: $right[1]$right[2].");
898
+ }
899
+
900
+ $unitChange = true;
901
+ $emptyUnit = $left[2] == "" || $right[2] == "";
902
+ $targetUnit = "" != $left[2] ? $left[2] : $right[2];
903
+
904
+ if ($opName != "mul") {
905
+ $left[2] = "" != $left[2] ? $left[2] : $targetUnit;
906
+ $right[2] = "" != $right[2] ? $right[2] : $targetUnit;
907
+ }
908
+
909
+ if ($opName != "mod") {
910
+ $left = $this->normalizeNumber($left);
911
+ $right = $this->normalizeNumber($right);
912
+ }
913
+
914
+ if ($opName == "div" && !$emptyUnit && $left[2] == $right[2]) {
915
+ $targetUnit = "";
916
+ }
917
+
918
+ if ($opName == "mul") {
919
+ $left[2] = "" != $left[2] ? $left[2] : $right[2];
920
+ $right[2] = "" != $right[2] ? $right[2] : $left[2];
921
+ } elseif ($opName == "div" && $left[2] == $right[2]) {
922
+ $left[2] = "";
923
+ $right[2] = "";
924
+ }
925
+ }
926
+
927
+ $shouldEval = $inParens || $inExp;
928
+ if (isset($passOp)) {
929
+ $out = $this->$fn($op, $left, $right, $shouldEval);
930
+ } else {
931
+ $out = $this->$fn($left, $right, $shouldEval);
932
+ }
933
+
934
+ if (isset($out)) {
935
+ if ($unitChange && $out[0] == "number") {
936
+ $out = $this->coerceUnit($out, $targetUnit);
937
+ }
938
+ return $out;
939
+ }
940
+ }
941
+
942
+ return $this->expToString($value);
943
+ case "unary":
944
+ list(, $op, $exp, $inParens) = $value;
945
+ $inExp = $inExp || $this->shouldEval($exp);
946
+
947
+ $exp = $this->reduce($exp);
948
+ if ($exp[0] == "number") {
949
+ switch ($op) {
950
+ case "+":
951
+ return $exp;
952
+ case "-":
953
+ $exp[1] *= -1;
954
+ return $exp;
955
+ }
956
+ }
957
+
958
+ if ($op == "not") {
959
+ if ($inExp || $inParens) {
960
+ if ($exp == self::$false) {
961
+ return self::$true;
962
+ } else {
963
+ return self::$false;
964
+ }
965
+ } else {
966
+ $op = $op . " ";
967
+ }
968
+ }
969
+
970
+ return array("string", "", array($op, $exp));
971
+ case "var":
972
+ list(, $name) = $value;
973
+ return $this->reduce($this->get($name));
974
+ case "list":
975
+ foreach ($value[2] as &$item) {
976
+ $item = $this->reduce($item);
977
+ }
978
+ return $value;
979
+ case "string":
980
+ foreach ($value[2] as &$item) {
981
+ if (is_array($item)) {
982
+ $item = $this->reduce($item);
983
+ }
984
+ }
985
+ return $value;
986
+ case "interpolate":
987
+ $value[1] = $this->reduce($value[1]);
988
+ return $value;
989
+ case "fncall":
990
+ list(,$name, $argValues) = $value;
991
+
992
+ // user defined function?
993
+ $func = $this->get(self::$namespaces["function"] . $name, false);
994
+ if ($func) {
995
+ $this->pushEnv();
996
+
997
+ // set the args
998
+ if (isset($func->args)) {
999
+ $this->applyArguments($func->args, $argValues);
1000
+ }
1001
+
1002
+ // throw away lines and children
1003
+ $tmp = (object)array(
1004
+ "lines" => array(),
1005
+ "children" => array()
1006
+ );
1007
+ $ret = $this->compileChildren($func->children, $tmp);
1008
+ $this->popEnv();
1009
+
1010
+ return !isset($ret) ? self::$defaultValue : $ret;
1011
+ }
1012
+
1013
+ // built in function
1014
+ if ($this->callBuiltin($name, $argValues, $returnValue)) {
1015
+ return $returnValue;
1016
+ }
1017
+
1018
+ // need to flatten the arguments into a list
1019
+ $listArgs = array();
1020
+ foreach ((array)$argValues as $arg) {
1021
+ if (empty($arg[0])) {
1022
+ $listArgs[] = $this->reduce($arg[1]);
1023
+ }
1024
+ }
1025
+ return array("function", $name, array("list", ",", $listArgs));
1026
+ default:
1027
+ return $value;
1028
+ }
1029
+ }
1030
+
1031
+ public function normalizeValue($value) {
1032
+ $value = $this->coerceForExpression($this->reduce($value));
1033
+ list($type) = $value;
1034
+
1035
+ switch ($type) {
1036
+ case "list":
1037
+ $value = $this->extractInterpolation($value);
1038
+ if ($value[0] != "list") {
1039
+ return array("keyword", $this->compileValue($value));
1040
+ }
1041
+ foreach ($value[2] as $key => $item) {
1042
+ $value[2][$key] = $this->normalizeValue($item);
1043
+ }
1044
+ return $value;
1045
+ case "number":
1046
+ return $this->normalizeNumber($value);
1047
+ default:
1048
+ return $value;
1049
+ }
1050
+ }
1051
+
1052
+ // just does physical lengths for now
1053
+ protected function normalizeNumber($number) {
1054
+ list(, $value, $unit) = $number;
1055
+ if (isset(self::$unitTable["in"][$unit])) {
1056
+ $conv = self::$unitTable["in"][$unit];
1057
+ return array("number", $value / $conv, "in");
1058
+ }
1059
+ return $number;
1060
+ }
1061
+
1062
+ // $number should be normalized
1063
+ protected function coerceUnit($number, $unit) {
1064
+ list(, $value, $baseUnit) = $number;
1065
+ if (isset(self::$unitTable[$baseUnit][$unit])) {
1066
+ $value = $value * self::$unitTable[$baseUnit][$unit];
1067
+ }
1068
+
1069
+ return array("number", $value, $unit);
1070
+ }
1071
+
1072
+ protected function op_add_number_number($left, $right) {
1073
+ return array("number", $left[1] + $right[1], $left[2]);
1074
+ }
1075
+
1076
+ protected function op_mul_number_number($left, $right) {
1077
+ return array("number", $left[1] * $right[1], $left[2]);
1078
+ }
1079
+
1080
+ protected function op_sub_number_number($left, $right) {
1081
+ return array("number", $left[1] - $right[1], $left[2]);
1082
+ }
1083
+
1084
+ protected function op_div_number_number($left, $right) {
1085
+ return array("number", $left[1] / $right[1], $left[2]);
1086
+ }
1087
+
1088
+ protected function op_mod_number_number($left, $right) {
1089
+ return array("number", $left[1] % $right[1], $left[2]);
1090
+ }
1091
+
1092
+ // adding strings
1093
+ protected function op_add($left, $right) {
1094
+ if ($strLeft = $this->coerceString($left)) {
1095
+ if ($right[0] == "string") {
1096
+ $right[1] = "";
1097
+ }
1098
+ $strLeft[2][] = $right;
1099
+ return $strLeft;
1100
+ }
1101
+
1102
+ if ($strRight = $this->coerceString($right)) {
1103
+ if ($left[0] == "string") {
1104
+ $left[1] = "";
1105
+ }
1106
+ array_unshift($strRight[2], $left);
1107
+ return $strRight;
1108
+ }
1109
+ }
1110
+
1111
+ protected function op_and($left, $right, $shouldEval) {
1112
+ if (!$shouldEval) return;
1113
+ if ($left != self::$false) return $right;
1114
+ return $left;
1115
+ }
1116
+
1117
+ protected function op_or($left, $right, $shouldEval) {
1118
+ if (!$shouldEval) return;
1119
+ if ($left != self::$false) return $left;
1120
+ return $right;
1121
+ }
1122
+
1123
+ protected function op_color_color($op, $left, $right) {
1124
+ $out = array('color');
1125
+ foreach (range(1, 3) as $i) {
1126
+ $lval = isset($left[$i]) ? $left[$i] : 0;
1127
+ $rval = isset($right[$i]) ? $right[$i] : 0;
1128
+ switch ($op) {
1129
+ case '+':
1130
+ $out[] = $lval + $rval;
1131
+ break;
1132
+ case '-':
1133
+ $out[] = $lval - $rval;
1134
+ break;
1135
+ case '*':
1136
+ $out[] = $lval * $rval;
1137
+ break;
1138
+ case '%':
1139
+ $out[] = $lval % $rval;
1140
+ break;
1141
+ case '/':
1142
+ if ($rval == 0) {
1143
+ $this->throwError("color: Can't divide by zero");
1144
+ }
1145
+ $out[] = $lval / $rval;
1146
+ break;
1147
+ case "==":
1148
+ return $this->op_eq($left, $right);
1149
+ case "!=":
1150
+ return $this->op_neq($left, $right);
1151
+ default:
1152
+ $this->throwError("color: unknown op $op");
1153
+ }
1154
+ }
1155
+
1156
+ if (isset($left[4])) $out[4] = $left[4];
1157
+ elseif (isset($right[4])) $out[4] = $right[4];
1158
+
1159
+ return $this->fixColor($out);
1160
+ }
1161
+
1162
+ protected function op_color_number($op, $left, $right) {
1163
+ $value = $right[1];
1164
+ return $this->op_color_color($op, $left,
1165
+ array("color", $value, $value, $value));
1166
+ }
1167
+
1168
+ protected function op_number_color($op, $left, $right) {
1169
+ $value = $left[1];
1170
+ return $this->op_color_color($op,
1171
+ array("color", $value, $value, $value), $right);
1172
+ }
1173
+
1174
+ protected function op_eq($left, $right) {
1175
+ if (($lStr = $this->coerceString($left)) && ($rStr = $this->coerceString($right))) {
1176
+ $lStr[1] = "";
1177
+ $rStr[1] = "";
1178
+ return $this->toBool($this->compileValue($lStr) == $this->compileValue($rStr));
1179
+ }
1180
+
1181
+ return $this->toBool($left == $right);
1182
+ }
1183
+
1184
+ protected function op_neq($left, $right) {
1185
+ return $this->toBool($left != $right);
1186
+ }
1187
+
1188
+ protected function op_gte_number_number($left, $right) {
1189
+ return $this->toBool($left[1] >= $right[1]);
1190
+ }
1191
+
1192
+ protected function op_gt_number_number($left, $right) {
1193
+ return $this->toBool($left[1] > $right[1]);
1194
+ }
1195
+
1196
+ protected function op_lte_number_number($left, $right) {
1197
+ return $this->toBool($left[1] <= $right[1]);
1198
+ }
1199
+
1200
+ protected function op_lt_number_number($left, $right) {
1201
+ return $this->toBool($left[1] < $right[1]);
1202
+ }
1203
+
1204
+ public function toBool($thing) {
1205
+ return $thing ? self::$true : self::$false;
1206
+ }
1207
+
1208
+ /**
1209
+ * Compiles a primitive value into a CSS property value.
1210
+ *
1211
+ * Values in scssphp are typed by being wrapped in arrays, their format is
1212
+ * typically:
1213
+ *
1214
+ * array(type, contents [, additional_contents]*)
1215
+ *
1216
+ * The input is expected to be reduced. This function will not work on
1217
+ * things like expressions and variables.
1218
+ *
1219
+ * @param array $value
1220
+ */
1221
+ protected function compileValue($value) {
1222
+ $value = $this->reduce($value);
1223
+
1224
+ list($type) = $value;
1225
+ switch ($type) {
1226
+ case "keyword":
1227
+ return $value[1];
1228
+ case "color":
1229
+ // [1] - red component (either number for a %)
1230
+ // [2] - green component
1231
+ // [3] - blue component
1232
+ // [4] - optional alpha component
1233
+ list(, $r, $g, $b) = $value;
1234
+
1235
+ $r = round($r);
1236
+ $g = round($g);
1237
+ $b = round($b);
1238
+
1239
+ if (count($value) == 5 && $value[4] != 1) { // rgba
1240
+ return 'rgba('.$r.', '.$g.', '.$b.', '.$value[4].')';
1241
+ }
1242
+
1243
+ $h = sprintf("#%02x%02x%02x", $r, $g, $b);
1244
+
1245
+ // Converting hex color to short notation (e.g. #003399 to #039)
1246
+ if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) {
1247
+ $h = '#' . $h[1] . $h[3] . $h[5];
1248
+ }
1249
+
1250
+ return $h;
1251
+ case "number":
1252
+ return round($value[1], $this->numberPrecision) . $value[2];
1253
+ case "string":
1254
+ return $value[1] . $this->compileStringContent($value) . $value[1];
1255
+ case "function":
1256
+ $args = !empty($value[2]) ? $this->compileValue($value[2]) : "";
1257
+ return "$value[1]($args)";
1258
+ case "list":
1259
+ $value = $this->extractInterpolation($value);
1260
+ if ($value[0] != "list") return $this->compileValue($value);
1261
+
1262
+ list(, $delim, $items) = $value;
1263
+
1264
+ $filtered = array();
1265
+ foreach ($items as $item) {
1266
+ if ($item[0] == "null") continue;
1267
+ $filtered[] = $this->compileValue($item);
1268
+ }
1269
+
1270
+ return implode("$delim ", $filtered);
1271
+ case "interpolated": # node created by extractInterpolation
1272
+ list(, $interpolate, $left, $right) = $value;
1273
+ list(,, $whiteLeft, $whiteRight) = $interpolate;
1274
+
1275
+ $left = count($left[2]) > 0 ?
1276
+ $this->compileValue($left).$whiteLeft : "";
1277
+
1278
+ $right = count($right[2]) > 0 ?
1279
+ $whiteRight.$this->compileValue($right) : "";
1280
+
1281
+ return $left.$this->compileValue($interpolate).$right;
1282
+
1283
+ case "interpolate": # raw parse node
1284
+ list(, $exp) = $value;
1285
+
1286
+ // strip quotes if it's a string
1287
+ $reduced = $this->reduce($exp);
1288
+ switch ($reduced[0]) {
1289
+ case "string":
1290
+ $reduced = array("keyword",
1291
+ $this->compileStringContent($reduced));
1292
+ break;
1293
+ case "null":
1294
+ $reduced = array("keyword", "");
1295
+ }
1296
+
1297
+ return $this->compileValue($reduced);
1298
+ case "null":
1299
+ return "null";
1300
+ default:
1301
+ $this->throwError("unknown value type: $type");
1302
+ }
1303
+ }
1304
+
1305
+ protected function compileStringContent($string) {
1306
+ $parts = array();
1307
+ foreach ($string[2] as $part) {
1308
+ if (is_array($part)) {
1309
+ $parts[] = $this->compileValue($part);
1310
+ } else {
1311
+ $parts[] = $part;
1312
+ }
1313
+ }
1314
+
1315
+ return implode($parts);
1316
+ }
1317
+
1318
+ // doesn't need to be recursive, compileValue will handle that
1319
+ protected function extractInterpolation($list) {
1320
+ $items = $list[2];
1321
+ foreach ($items as $i => $item) {
1322
+ if ($item[0] == "interpolate") {
1323
+ $before = array("list", $list[1], array_slice($items, 0, $i));
1324
+ $after = array("list", $list[1], array_slice($items, $i + 1));
1325
+ return array("interpolated", $item, $before, $after);
1326
+ }
1327
+ }
1328
+ return $list;
1329
+ }
1330
+
1331
+ // find the final set of selectors
1332
+ protected function multiplySelectors($env) {
1333
+ $envs = array();
1334
+ while (null !== $env) {
1335
+ if (!empty($env->selectors)) {
1336
+ $envs[] = $env;
1337
+ }
1338
+ $env = $env->parent;
1339
+ };
1340
+
1341
+ $selectors = array();
1342
+ $parentSelectors = array(array());
1343
+ while ($env = array_pop($envs)) {
1344
+ $selectors = array();
1345
+ foreach ($env->selectors as $selector) {
1346
+ foreach ($parentSelectors as $parent) {
1347
+ $selectors[] = $this->joinSelectors($parent, $selector);
1348
+ }
1349
+ }
1350
+ $parentSelectors = $selectors;
1351
+ }
1352
+
1353
+ return $selectors;
1354
+ }
1355
+
1356
+ // looks for & to replace, or append parent before child
1357
+ protected function joinSelectors($parent, $child) {
1358
+ $setSelf = false;
1359
+ $out = array();
1360
+ foreach ($child as $part) {
1361
+ $newPart = array();
1362
+ foreach ($part as $p) {
1363
+ if ($p == self::$selfSelector) {
1364
+ $setSelf = true;
1365
+ foreach ($parent as $i => $parentPart) {
1366
+ if ($i > 0) {
1367
+ $out[] = $newPart;
1368
+ $newPart = array();
1369
+ }
1370
+
1371
+ foreach ($parentPart as $pp) {
1372
+ $newPart[] = $pp;
1373
+ }
1374
+ }
1375
+ } else {
1376
+ $newPart[] = $p;
1377
+ }
1378
+ }
1379
+
1380
+ $out[] = $newPart;
1381
+ }
1382
+
1383
+ return $setSelf ? $out : array_merge($parent, $child);
1384
+ }
1385
+
1386
+ protected function multiplyMedia($env, $childQueries = null) {
1387
+ if (!isset($env) ||
1388
+ !empty($env->block->type) && $env->block->type != "media")
1389
+ {
1390
+ return $childQueries;
1391
+ }
1392
+
1393
+ // plain old block, skip
1394
+ if (empty($env->block->type)) {
1395
+ return $this->multiplyMedia($env->parent, $childQueries);
1396
+ }
1397
+
1398
+ $parentQueries = $env->block->queryList;
1399
+ if ($childQueries == null) {
1400
+ $childQueries = $parentQueries;
1401
+ } else {
1402
+ $originalQueries = $childQueries;
1403
+ $childQueries = array();
1404
+
1405
+ foreach ($parentQueries as $parentQuery){
1406
+ foreach ($originalQueries as $childQuery) {
1407
+ $childQueries []= array_merge($parentQuery, $childQuery);
1408
+ }
1409
+ }
1410
+ }
1411
+
1412
+ return $this->multiplyMedia($env->parent, $childQueries);
1413
+ }
1414
+
1415
+ // convert something to list
1416
+ protected function coerceList($item, $delim = ",") {
1417
+ if (isset($item) && $item[0] == "list") {
1418
+ return $item;
1419
+ }
1420
+
1421
+ return array("list", $delim, !isset($item) ? array(): array($item));
1422
+ }
1423
+
1424
+ protected function applyArguments($argDef, $argValues) {
1425
+ $hasVariable = false;
1426
+ $args = array();
1427
+ foreach ($argDef as $i => $arg) {
1428
+ list($name, $default, $isVariable) = $argDef[$i];
1429
+ $args[$name] = array($i, $name, $default, $isVariable);
1430
+ $hasVariable |= $isVariable;
1431
+ }
1432
+
1433
+ $keywordArgs = array();
1434
+ $deferredKeywordArgs = array();
1435
+ $remaining = array();
1436
+ // assign the keyword args
1437
+ foreach ((array) $argValues as $arg) {
1438
+ if (!empty($arg[0])) {
1439
+ if (!isset($args[$arg[0][1]])) {
1440
+ if ($hasVariable) {
1441
+ $deferredKeywordArgs[$arg[0][1]] = $arg[1];
1442
+ } else {
1443
+ $this->throwError("Mixin or function doesn't have an argument named $%s.", $arg[0][1]);
1444
+ }
1445
+ } elseif ($args[$arg[0][1]][0] < count($remaining)) {
1446
+ $this->throwError("The argument $%s was passed both by position and by name.", $arg[0][1]);
1447
+ } else {
1448
+ $keywordArgs[$arg[0][1]] = $arg[1];
1449
+ }
1450
+ } elseif (count($keywordArgs)) {
1451
+ $this->throwError('Positional arguments must come before keyword arguments.');
1452
+ } elseif ($arg[2] == true) {
1453
+ $val = $this->reduce($arg[1], true);
1454
+ if ($val[0] == "list") {
1455
+ foreach ($val[2] as $name => $item) {
1456
+ if (!is_numeric($name)) {
1457
+ $keywordArgs[$name] = $item;
1458
+ } else {
1459
+ $remaining[] = $item;
1460
+ }
1461
+ }
1462
+ } else {
1463
+ $remaining[] = $val;
1464
+ }
1465
+ } else {
1466
+ $remaining[] = $arg[1];
1467
+ }
1468
+ }
1469
+
1470
+ foreach ($args as $arg) {
1471
+ list($i, $name, $default, $isVariable) = $arg;
1472
+ if ($isVariable) {
1473
+ $val = array("list", ",", array());
1474
+ for ($count = count($remaining); $i < $count; $i++) {
1475
+ $val[2][] = $remaining[$i];
1476
+ }
1477
+ foreach ($deferredKeywordArgs as $itemName => $item) {
1478
+ $val[2][$itemName] = $item;
1479
+ }
1480
+ } elseif (isset($remaining[$i])) {
1481
+ $val = $remaining[$i];
1482
+ } elseif (isset($keywordArgs[$name])) {
1483
+ $val = $keywordArgs[$name];
1484
+ } elseif (!empty($default)) {
1485
+ $val = $default;
1486
+ } else {
1487
+ $this->throwError("Missing argument $name");
1488
+ }
1489
+
1490
+ $this->set($name, $this->reduce($val, true), true);
1491
+ }
1492
+ }
1493
+
1494
+ protected function pushEnv($block=null) {
1495
+ $env = new stdClass;
1496
+ $env->parent = $this->env;
1497
+ $env->store = array();
1498
+ $env->block = $block;
1499
+ $env->depth = isset($this->env->depth) ? $this->env->depth + 1 : 0;
1500
+
1501
+ $this->env = $env;
1502
+ return $env;
1503
+ }
1504
+
1505
+ protected function normalizeName($name) {
1506
+ return str_replace("-", "_", $name);
1507
+ }
1508
+
1509
+ protected function getStoreEnv() {
1510
+ return isset($this->storeEnv) ? $this->storeEnv : $this->env;
1511
+ }
1512
+
1513
+ protected function set($name, $value, $shadow=false) {
1514
+ $name = $this->normalizeName($name);
1515
+
1516
+ if ($shadow) {
1517
+ $this->setRaw($name, $value);
1518
+ } else {
1519
+ $this->setExisting($name, $value);
1520
+ }
1521
+ }
1522
+
1523
+ protected function setExisting($name, $value, $env = null) {
1524
+ if (!isset($env)) $env = $this->getStoreEnv();
1525
+
1526
+ if (isset($env->store[$name]) || !isset($env->parent)) {
1527
+ $env->store[$name] = $value;
1528
+ } else {
1529
+ $this->setExisting($name, $value, $env->parent);
1530
+ }
1531
+ }
1532
+
1533
+ protected function setRaw($name, $value) {
1534
+ $env = $this->getStoreEnv();
1535
+ $env->store[$name] = $value;
1536
+ }
1537
+
1538
+ public function get($name, $defaultValue = null, $env = null) {
1539
+ $name = $this->normalizeName($name);
1540
+
1541
+ if (!isset($env)) $env = $this->getStoreEnv();
1542
+ if (!isset($defaultValue)) $defaultValue = self::$defaultValue;
1543
+
1544
+ if (isset($env->store[$name])) {
1545
+ return $env->store[$name];
1546
+ } elseif (isset($env->parent)) {
1547
+ return $this->get($name, $defaultValue, $env->parent);
1548
+ }
1549
+
1550
+ return $defaultValue; // found nothing
1551
+ }
1552
+
1553
+ protected function popEnv() {
1554
+ $env = $this->env;
1555
+ $this->env = $this->env->parent;
1556
+ return $env;
1557
+ }
1558
+
1559
+ public function getParsedFiles() {
1560
+ return $this->parsedFiles;
1561
+ }
1562
+
1563
+ public function addImportPath($path) {
1564
+ $this->importPaths[] = $path;
1565
+ }
1566
+
1567
+ public function setImportPaths($path) {
1568
+ $this->importPaths = (array)$path;
1569
+ }
1570
+
1571
+ public function setNumberPrecision($numberPrecision) {
1572
+ $this->numberPrecision = $numberPrecision;
1573
+ }
1574
+
1575
+ public function setFormatter($formatterName) {
1576
+ $this->formatter = $formatterName;
1577
+ }
1578
+
1579
+ public function registerFunction($name, $func) {
1580
+ $this->userFunctions[$this->normalizeName($name)] = $func;
1581
+ }
1582
+
1583
+ public function unregisterFunction($name) {
1584
+ unset($this->userFunctions[$this->normalizeName($name)]);
1585
+ }
1586
+
1587
+ protected function importFile($path, $out) {
1588
+ // see if tree is cached
1589
+ $realPath = realpath($path);
1590
+ if (isset($this->importCache[$realPath])) {
1591
+ $tree = $this->importCache[$realPath];
1592
+ } else {
1593
+ $code = file_get_contents($path);
1594
+ $parser = new scss_parser($path, false);
1595
+ $tree = $parser->parse($code);
1596
+ $this->parsedFiles[] = $path;
1597
+
1598
+ $this->importCache[$realPath] = $tree;
1599
+ }
1600
+
1601
+ $pi = pathinfo($path);
1602
+ array_unshift($this->importPaths, $pi['dirname']);
1603
+ $this->compileChildren($tree->children, $out);
1604
+ array_shift($this->importPaths);
1605
+ }
1606
+
1607
+ // results the file path for an import url if it exists
1608
+ public function findImport($url) {
1609
+ $urls = array();
1610
+
1611
+ // for "normal" scss imports (ignore vanilla css and external requests)
1612
+ //if (!preg_match('/\.css|^http:\/\/$/', $url)) {
1613
+ // try both normal and the _partial filename
1614
+ $urls = array($url, preg_replace('/[^\/]+$/', '_\0', $url));
1615
+ //}
1616
+
1617
+ foreach ($this->importPaths as $dir) {
1618
+ if (is_string($dir)) {
1619
+ // check urls for normal import paths
1620
+ foreach ($urls as $full) {
1621
+ $full = $dir .
1622
+ (!empty($dir) && substr($dir, -1) != '/' ? '/' : '') .
1623
+ $full;
1624
+
1625
+ if ($this->fileExists($file = $full.'.scss') ||
1626
+ $this->fileExists($file = $full))
1627
+ {
1628
+ return $file;
1629
+ }
1630
+ }
1631
+ } else {
1632
+ // check custom callback for import path
1633
+ $file = call_user_func($dir,$url,$this);
1634
+ if ($file !== null) {
1635
+ return $file;
1636
+ }
1637
+ }
1638
+ }
1639
+
1640
+ return null;
1641
+ }
1642
+
1643
+ protected function fileExists($name) {
1644
+ return is_file($name);
1645
+ }
1646
+
1647
+ protected function callBuiltin($name, $args, &$returnValue) {
1648
+ // try a lib function
1649
+ $name = $this->normalizeName($name);
1650
+ $libName = "lib_".$name;
1651
+ $f = array($this, $libName);
1652
+ if (is_callable($f)) {
1653
+ $prototype = isset(self::$$libName) ? self::$$libName : null;
1654
+ $sorted = $this->sortArgs($prototype, $args);
1655
+ foreach ($sorted as &$val) {
1656
+ $val = $this->reduce($val, true);
1657
+ }
1658
+ $returnValue = call_user_func($f, $sorted, $this);
1659
+ } elseif (isset($this->userFunctions[$name])) {
1660
+ // see if we can find a user function
1661
+ $fn = $this->userFunctions[$name];
1662
+
1663
+ foreach ($args as &$val) {
1664
+ $val = $this->reduce($val[1], true);
1665
+ }
1666
+
1667
+ $returnValue = call_user_func($fn, $args, $this);
1668
+ }
1669
+
1670
+ if (isset($returnValue)) {
1671
+ // coerce a php value into a scss one
1672
+ if (is_numeric($returnValue)) {
1673
+ $returnValue = array('number', $returnValue, "");
1674
+ } elseif (is_bool($returnValue)) {
1675
+ $returnValue = $returnValue ? self::$true : self::$false;
1676
+ } elseif (!is_array($returnValue)) {
1677
+ $returnValue = array('keyword', $returnValue);
1678
+ }
1679
+
1680
+ return true;
1681
+ }
1682
+
1683
+ return false;
1684
+ }
1685
+
1686
+ // sorts any keyword arguments
1687
+ // TODO: merge with apply arguments
1688
+ protected function sortArgs($prototype, $args) {
1689
+ $keyArgs = array();
1690
+ $posArgs = array();
1691
+
1692
+ foreach ($args as $arg) {
1693
+ list($key, $value) = $arg;
1694
+ $key = $key[1];
1695
+ if (empty($key)) {
1696
+ $posArgs[] = $value;
1697
+ } else {
1698
+ $keyArgs[$key] = $value;
1699
+ }
1700
+ }
1701
+
1702
+ if (!isset($prototype)) return $posArgs;
1703
+
1704
+ $finalArgs = array();
1705
+ foreach ($prototype as $i => $names) {
1706
+ if (isset($posArgs[$i])) {
1707
+ $finalArgs[] = $posArgs[$i];
1708
+ continue;
1709
+ }
1710
+
1711
+ $set = false;
1712
+ foreach ((array)$names as $name) {
1713
+ if (isset($keyArgs[$name])) {
1714
+ $finalArgs[] = $keyArgs[$name];
1715
+ $set = true;
1716
+ break;
1717
+ }
1718
+ }
1719
+
1720
+ if (!$set) {
1721
+ $finalArgs[] = null;
1722
+ }
1723
+ }
1724
+
1725
+ return $finalArgs;
1726
+ }
1727
+
1728
+ protected function coerceForExpression($value) {
1729
+ if ($color = $this->coerceColor($value)) {
1730
+ return $color;
1731
+ }
1732
+
1733
+ return $value;
1734
+ }
1735
+
1736
+ protected function coerceColor($value) {
1737
+ switch ($value[0]) {
1738
+ case "color": return $value;
1739
+ case "keyword":
1740
+ $name = $value[1];
1741
+ if (isset(self::$cssColors[$name])) {
1742
+ $rgba = explode(',', self::$cssColors[$name]);
1743
+ return isset($rgba[3])
1744
+ ? array('color', (int) $rgba[0], (int) $rgba[1], (int) $rgba[2], (int) $rgba[3])
1745
+ : array('color', (int) $rgba[0], (int) $rgba[1], (int) $rgba[2]);
1746
+ }
1747
+ return null;
1748
+ }
1749
+
1750
+ return null;
1751
+ }
1752
+
1753
+ protected function coerceString($value) {
1754
+ switch ($value[0]) {
1755
+ case "string":
1756
+ return $value;
1757
+ case "keyword":
1758
+ return array("string", "", array($value[1]));
1759
+ }
1760
+ return null;
1761
+ }
1762
+
1763
+ public function assertList($value) {
1764
+ if ($value[0] != "list")
1765
+ $this->throwError("expecting list");
1766
+ return $value;
1767
+ }
1768
+
1769
+ public function assertColor($value) {
1770
+ if ($color = $this->coerceColor($value)) return $color;
1771
+ $this->throwError("expecting color");
1772
+ }
1773
+
1774
+ public function assertNumber($value) {
1775
+ if ($value[0] != "number")
1776
+ $this->throwError("expecting number");
1777
+ return $value[1];
1778
+ }
1779
+
1780
+ protected function coercePercent($value) {
1781
+ if ($value[0] == "number") {
1782
+ if ($value[2] == "%") {
1783
+ return $value[1] / 100;
1784
+ }
1785
+ return $value[1];
1786
+ }
1787
+ return 0;
1788
+ }
1789
+
1790
+ // make sure a color's components don't go out of bounds
1791
+ protected function fixColor($c) {
1792
+ foreach (range(1, 3) as $i) {
1793
+ if ($c[$i] < 0) $c[$i] = 0;
1794
+ if ($c[$i] > 255) $c[$i] = 255;
1795
+ }
1796
+
1797
+ return $c;
1798
+ }
1799
+
1800
+ public function toHSL($red, $green, $blue) {
1801
+ $min = min($red, $green, $blue);
1802
+ $max = max($red, $green, $blue);
1803
+
1804
+ $l = $min + $max;
1805
+
1806
+ if ($min == $max) {
1807
+ $s = $h = 0;
1808
+ } else {
1809
+ $d = $max - $min;
1810
+
1811
+ if ($l < 255)
1812
+ $s = $d / $l;
1813
+ else
1814
+ $s = $d / (510 - $l);
1815
+
1816
+ if ($red == $max)
1817
+ $h = 60 * ($green - $blue) / $d;
1818
+ elseif ($green == $max)
1819
+ $h = 60 * ($blue - $red) / $d + 120;
1820
+ elseif ($blue == $max)
1821
+ $h = 60 * ($red - $green) / $d + 240;
1822
+ }
1823
+
1824
+ return array('hsl', fmod($h, 360), $s * 100, $l / 5.1);
1825
+ }
1826
+
1827
+ public function hueToRGB($m1, $m2, $h) {
1828
+ if ($h < 0)
1829
+ $h += 1;
1830
+ elseif ($h > 1)
1831
+ $h -= 1;
1832
+
1833
+ if ($h * 6 < 1)
1834
+ return $m1 + ($m2 - $m1) * $h * 6;
1835
+
1836
+ if ($h * 2 < 1)
1837
+ return $m2;
1838
+
1839
+ if ($h * 3 < 2)
1840
+ return $m1 + ($m2 - $m1) * (2/3 - $h) * 6;
1841
+
1842
+ return $m1;
1843
+ }
1844
+
1845
+ // H from 0 to 360, S and L from 0 to 100
1846
+ public function toRGB($hue, $saturation, $lightness) {
1847
+ if ($hue < 0) {
1848
+ $hue += 360;
1849
+ }
1850
+
1851
+ $h = $hue / 360;
1852
+ $s = min(100, max(0, $saturation)) / 100;
1853
+ $l = min(100, max(0, $lightness)) / 100;
1854
+
1855
+ $m2 = $l <= 0.5 ? $l * ($s + 1) : $l + $s - $l * $s;
1856
+ $m1 = $l * 2 - $m2;
1857
+
1858
+ $r = $this->hueToRGB($m1, $m2, $h + 1/3) * 255;
1859
+ $g = $this->hueToRGB($m1, $m2, $h) * 255;
1860
+ $b = $this->hueToRGB($m1, $m2, $h - 1/3) * 255;
1861
+
1862
+ $out = array('color', $r, $g, $b);
1863
+ return $out;
1864
+ }
1865
+
1866
+ // Built in functions
1867
+
1868
+ protected static $lib_if = array("condition", "if-true", "if-false");
1869
+ protected function lib_if($args) {
1870
+ list($cond,$t, $f) = $args;
1871
+ if (!$this->isTruthy($cond)) return $f;
1872
+ return $t;
1873
+ }
1874
+
1875
+ protected static $lib_index = array("list", "value");
1876
+ protected function lib_index($args) {
1877
+ list($list, $value) = $args;
1878
+ $list = $this->assertList($list);
1879
+
1880
+ $values = array();
1881
+ foreach ($list[2] as $item) {
1882
+ $values[] = $this->normalizeValue($item);
1883
+ }
1884
+ $key = array_search($this->normalizeValue($value), $values);
1885
+
1886
+ return false === $key ? false : $key + 1;
1887
+ }
1888
+
1889
+ protected static $lib_rgb = array("red", "green", "blue");
1890
+ protected function lib_rgb($args) {
1891
+ list($r,$g,$b) = $args;
1892
+ return array("color", $r[1], $g[1], $b[1]);
1893
+ }
1894
+
1895
+ protected static $lib_rgba = array(
1896
+ array("red", "color"),
1897
+ "green", "blue", "alpha");
1898
+ protected function lib_rgba($args) {
1899
+ if ($color = $this->coerceColor($args[0])) {
1900
+ $num = !isset($args[1]) ? $args[3] : $args[1];
1901
+ $alpha = $this->assertNumber($num);
1902
+ $color[4] = $alpha;
1903
+ return $color;
1904
+ }
1905
+
1906
+ list($r,$g,$b, $a) = $args;
1907
+ return array("color", $r[1], $g[1], $b[1], $a[1]);
1908
+ }
1909
+
1910
+ // helper function for adjust_color, change_color, and scale_color
1911
+ protected function alter_color($args, $fn) {
1912
+ $color = $this->assertColor($args[0]);
1913
+
1914
+ foreach (array(1,2,3,7) as $i) {
1915
+ if (isset($args[$i])) {
1916
+ $val = $this->assertNumber($args[$i]);
1917
+ $ii = $i == 7 ? 4 : $i; // alpha
1918
+ $color[$ii] =
1919
+ $this->$fn(isset($color[$ii]) ? $color[$ii] : 0, $val, $i);
1920
+ }
1921
+ }
1922
+
1923
+ if (isset($args[4]) || isset($args[5]) || isset($args[6])) {
1924
+ $hsl = $this->toHSL($color[1], $color[2], $color[3]);
1925
+ foreach (array(4,5,6) as $i) {
1926
+ if (isset($args[$i])) {
1927
+ $val = $this->assertNumber($args[$i]);
1928
+ $hsl[$i - 3] = $this->$fn($hsl[$i - 3], $val, $i);
1929
+ }
1930
+ }
1931
+
1932
+ $rgb = $this->toRGB($hsl[1], $hsl[2], $hsl[3]);
1933
+ if (isset($color[4])) $rgb[4] = $color[4];
1934
+ $color = $rgb;
1935
+ }
1936
+
1937
+ return $color;
1938
+ }
1939
+
1940
+ protected static $lib_adjust_color = array(
1941
+ "color", "red", "green", "blue",
1942
+ "hue", "saturation", "lightness", "alpha"
1943
+ );
1944
+ protected function adjust_color_helper($base, $alter, $i) {
1945
+ return $base += $alter;
1946
+ }
1947
+ protected function lib_adjust_color($args) {
1948
+ return $this->alter_color($args, "adjust_color_helper");
1949
+ }
1950
+
1951
+ protected static $lib_change_color = array(
1952
+ "color", "red", "green", "blue",
1953
+ "hue", "saturation", "lightness", "alpha"
1954
+ );
1955
+ protected function change_color_helper($base, $alter, $i) {
1956
+ return $alter;
1957
+ }
1958
+ protected function lib_change_color($args) {
1959
+ return $this->alter_color($args, "change_color_helper");
1960
+ }
1961
+
1962
+ protected static $lib_scale_color = array(
1963
+ "color", "red", "green", "blue",
1964
+ "hue", "saturation", "lightness", "alpha"
1965
+ );
1966
+ protected function scale_color_helper($base, $scale, $i) {
1967
+ // 1,2,3 - rgb
1968
+ // 4, 5, 6 - hsl
1969
+ // 7 - a
1970
+ switch ($i) {
1971
+ case 1:
1972
+ case 2:
1973
+ case 3:
1974
+ $max = 255; break;
1975
+ case 4:
1976
+ $max = 360; break;
1977
+ case 7:
1978
+ $max = 1; break;
1979
+ default:
1980
+ $max = 100;
1981
+ }
1982
+
1983
+ $scale = $scale / 100;
1984
+ if ($scale < 0) {
1985
+ return $base * $scale + $base;
1986
+ } else {
1987
+ return ($max - $base) * $scale + $base;
1988
+ }
1989
+ }
1990
+ protected function lib_scale_color($args) {
1991
+ return $this->alter_color($args, "scale_color_helper");
1992
+ }
1993
+
1994
+ protected static $lib_ie_hex_str = array("color");
1995
+ protected function lib_ie_hex_str($args) {
1996
+ $color = $this->coerceColor($args[0]);
1997
+ $color[4] = isset($color[4]) ? round(255*$color[4]) : 255;
1998
+
1999
+ return sprintf('#%02X%02X%02X%02X', $color[4], $color[1], $color[2], $color[3]);
2000
+ }
2001
+
2002
+ protected static $lib_red = array("color");
2003
+ protected function lib_red($args) {
2004
+ $color = $this->coerceColor($args[0]);
2005
+ return $color[1];
2006
+ }
2007
+
2008
+ protected static $lib_green = array("color");
2009
+ protected function lib_green($args) {
2010
+ $color = $this->coerceColor($args[0]);
2011
+ return $color[2];
2012
+ }
2013
+
2014
+ protected static $lib_blue = array("color");
2015
+ protected function lib_blue($args) {
2016
+ $color = $this->coerceColor($args[0]);
2017
+ return $color[3];
2018
+ }
2019
+
2020
+ protected static $lib_alpha = array("color");
2021
+ protected function lib_alpha($args) {
2022
+ if ($color = $this->coerceColor($args[0])) {
2023
+ return isset($color[4]) ? $color[4] : 1;
2024
+ }
2025
+
2026
+ // this might be the IE function, so return value unchanged
2027
+ return null;
2028
+ }
2029
+
2030
+ protected static $lib_opacity = array("color");
2031
+ protected function lib_opacity($args) {
2032
+ $value = $args[0];
2033
+ if ($value[0] === 'number') return null;
2034
+ return $this->lib_alpha($args);
2035
+ }
2036
+
2037
+ // mix two colors
2038
+ protected static $lib_mix = array("color-1", "color-2", "weight");
2039
+ protected function lib_mix($args) {
2040
+ list($first, $second, $weight) = $args;
2041
+ $first = $this->assertColor($first);
2042
+ $second = $this->assertColor($second);
2043
+
2044
+ if (!isset($weight)) {
2045
+ $weight = 0.5;
2046
+ } else {
2047
+ $weight = $this->coercePercent($weight);
2048
+ }
2049
+
2050
+ $firstAlpha = isset($first[4]) ? $first[4] : 1;
2051
+ $secondAlpha = isset($second[4]) ? $second[4] : 1;
2052
+
2053
+ $w = $weight * 2 - 1;
2054
+ $a = $firstAlpha - $secondAlpha;
2055
+
2056
+ $w1 = (($w * $a == -1 ? $w : ($w + $a)/(1 + $w * $a)) + 1) / 2.0;
2057
+ $w2 = 1.0 - $w1;
2058
+
2059
+ $new = array('color',
2060
+ $w1 * $first[1] + $w2 * $second[1],
2061
+ $w1 * $first[2] + $w2 * $second[2],
2062
+ $w1 * $first[3] + $w2 * $second[3],
2063
+ );
2064
+
2065
+ if ($firstAlpha != 1.0 || $secondAlpha != 1.0) {
2066
+ $new[] = $firstAlpha * $weight + $secondAlpha * ($weight - 1);
2067
+ }
2068
+
2069
+ return $this->fixColor($new);
2070
+ }
2071
+
2072
+ protected static $lib_hsl = array("hue", "saturation", "lightness");
2073
+ protected function lib_hsl($args) {
2074
+ list($h, $s, $l) = $args;
2075
+ return $this->toRGB($h[1], $s[1], $l[1]);
2076
+ }
2077
+
2078
+ protected static $lib_hsla = array("hue", "saturation",
2079
+ "lightness", "alpha");
2080
+ protected function lib_hsla($args) {
2081
+ list($h, $s, $l, $a) = $args;
2082
+ $color = $this->toRGB($h[1], $s[1], $l[1]);
2083
+ $color[4] = $a[1];
2084
+ return $color;
2085
+ }
2086
+
2087
+ protected static $lib_hue = array("color");
2088
+ protected function lib_hue($args) {
2089
+ $color = $this->assertColor($args[0]);
2090
+ $hsl = $this->toHSL($color[1], $color[2], $color[3]);
2091
+ return array("number", $hsl[1], "deg");
2092
+ }
2093
+
2094
+ protected static $lib_saturation = array("color");
2095
+ protected function lib_saturation($args) {
2096
+ $color = $this->assertColor($args[0]);
2097
+ $hsl = $this->toHSL($color[1], $color[2], $color[3]);
2098
+ return array("number", $hsl[2], "%");
2099
+ }
2100
+
2101
+ protected static $lib_lightness = array("color");
2102
+ protected function lib_lightness($args) {
2103
+ $color = $this->assertColor($args[0]);
2104
+ $hsl = $this->toHSL($color[1], $color[2], $color[3]);
2105
+ return array("number", $hsl[3], "%");
2106
+ }
2107
+
2108
+ protected function adjustHsl($color, $idx, $amount) {
2109
+ $hsl = $this->toHSL($color[1], $color[2], $color[3]);
2110
+ $hsl[$idx] += $amount;
2111
+ $out = $this->toRGB($hsl[1], $hsl[2], $hsl[3]);
2112
+ if (isset($color[4])) $out[4] = $color[4];
2113
+ return $out;
2114
+ }
2115
+
2116
+ protected static $lib_adjust_hue = array("color", "degrees");
2117
+ protected function lib_adjust_hue($args) {
2118
+ $color = $this->assertColor($args[0]);
2119
+ $degrees = $this->assertNumber($args[1]);
2120
+ return $this->adjustHsl($color, 1, $degrees);
2121
+ }
2122
+
2123
+ protected static $lib_lighten = array("color", "amount");
2124
+ protected function lib_lighten($args) {
2125
+ $color = $this->assertColor($args[0]);
2126
+ $amount = 100*$this->coercePercent($args[1]);
2127
+ return $this->adjustHsl($color, 3, $amount);
2128
+ }
2129
+
2130
+ protected static $lib_darken = array("color", "amount");
2131
+ protected function lib_darken($args) {
2132
+ $color = $this->assertColor($args[0]);
2133
+ $amount = 100*$this->coercePercent($args[1]);
2134
+ return $this->adjustHsl($color, 3, -$amount);
2135
+ }
2136
+
2137
+ protected static $lib_saturate = array("color", "amount");
2138
+ protected function lib_saturate($args) {
2139
+ $value = $args[0];
2140
+ if ($value[0] === 'number') return null;
2141
+ $color = $this->assertColor($value);
2142
+ $amount = 100*$this->coercePercent($args[1]);
2143
+ return $this->adjustHsl($color, 2, $amount);
2144
+ }
2145
+
2146
+ protected static $lib_desaturate = array("color", "amount");
2147
+ protected function lib_desaturate($args) {
2148
+ $color = $this->assertColor($args[0]);
2149
+ $amount = 100*$this->coercePercent($args[1]);
2150
+ return $this->adjustHsl($color, 2, -$amount);
2151
+ }
2152
+
2153
+ protected static $lib_grayscale = array("color");
2154
+ protected function lib_grayscale($args) {
2155
+ $value = $args[0];
2156
+ if ($value[0] === 'number') return null;
2157
+ return $this->adjustHsl($this->assertColor($value), 2, -100);
2158
+ }
2159
+
2160
+ protected static $lib_complement = array("color");
2161
+ protected function lib_complement($args) {
2162
+ return $this->adjustHsl($this->assertColor($args[0]), 1, 180);
2163
+ }
2164
+
2165
+ protected static $lib_invert = array("color");
2166
+ protected function lib_invert($args) {
2167
+ $value = $args[0];
2168
+ if ($value[0] === 'number') return null;
2169
+ $color = $this->assertColor($value);
2170
+ $color[1] = 255 - $color[1];
2171
+ $color[2] = 255 - $color[2];
2172
+ $color[3] = 255 - $color[3];
2173
+ return $color;
2174
+ }
2175
+
2176
+ // increases opacity by amount
2177
+ protected static $lib_opacify = array("color", "amount");
2178
+ protected function lib_opacify($args) {
2179
+ $color = $this->assertColor($args[0]);
2180
+ $amount = $this->coercePercent($args[1]);
2181
+
2182
+ $color[4] = (isset($color[4]) ? $color[4] : 1) + $amount;
2183
+ $color[4] = min(1, max(0, $color[4]));
2184
+ return $color;
2185
+ }
2186
+
2187
+ protected static $lib_fade_in = array("color", "amount");
2188
+ protected function lib_fade_in($args) {
2189
+ return $this->lib_opacify($args);
2190
+ }
2191
+
2192
+ // decreases opacity by amount
2193
+ protected static $lib_transparentize = array("color", "amount");
2194
+ protected function lib_transparentize($args) {
2195
+ $color = $this->assertColor($args[0]);
2196
+ $amount = $this->coercePercent($args[1]);
2197
+
2198
+ $color[4] = (isset($color[4]) ? $color[4] : 1) - $amount;
2199
+ $color[4] = min(1, max(0, $color[4]));
2200
+ return $color;
2201
+ }
2202
+
2203
+ protected static $lib_fade_out = array("color", "amount");
2204
+ protected function lib_fade_out($args) {
2205
+ return $this->lib_transparentize($args);
2206
+ }
2207
+
2208
+ protected static $lib_unquote = array("string");
2209
+ protected function lib_unquote($args) {
2210
+ $str = $args[0];
2211
+ if ($str[0] == "string") $str[1] = "";
2212
+ return $str;
2213
+ }
2214
+
2215
+ protected static $lib_quote = array("string");
2216
+ protected function lib_quote($args) {
2217
+ $value = $args[0];
2218
+ if ($value[0] == "string" && !empty($value[1]))
2219
+ return $value;
2220
+ return array("string", '"', array($value));
2221
+ }
2222
+
2223
+ protected static $lib_percentage = array("value");
2224
+ protected function lib_percentage($args) {
2225
+ return array("number",
2226
+ $this->coercePercent($args[0]) * 100,
2227
+ "%");
2228
+ }
2229
+
2230
+ protected static $lib_round = array("value");
2231
+ protected function lib_round($args) {
2232
+ $num = $args[0];
2233
+ $num[1] = round($num[1]);
2234
+ return $num;
2235
+ }
2236
+
2237
+ protected static $lib_floor = array("value");
2238
+ protected function lib_floor($args) {
2239
+ $num = $args[0];
2240
+ $num[1] = floor($num[1]);
2241
+ return $num;
2242
+ }
2243
+
2244
+ protected static $lib_ceil = array("value");
2245
+ protected function lib_ceil($args) {
2246
+ $num = $args[0];
2247
+ $num[1] = ceil($num[1]);
2248
+ return $num;
2249
+ }
2250
+
2251
+ protected static $lib_abs = array("value");
2252
+ protected function lib_abs($args) {
2253
+ $num = $args[0];
2254
+ $num[1] = abs($num[1]);
2255
+ return $num;
2256
+ }
2257
+
2258
+ protected function lib_min($args) {
2259
+ $numbers = $this->getNormalizedNumbers($args);
2260
+ $min = null;
2261
+ foreach ($numbers as $key => $number) {
2262
+ if (null === $min || $number[1] <= $min[1]) {
2263
+ $min = array($key, $number[1]);
2264
+ }
2265
+ }
2266
+
2267
+ return $args[$min[0]];
2268
+ }
2269
+
2270
+ protected function lib_max($args) {
2271
+ $numbers = $this->getNormalizedNumbers($args);
2272
+ $max = null;
2273
+ foreach ($numbers as $key => $number) {
2274
+ if (null === $max || $number[1] >= $max[1]) {
2275
+ $max = array($key, $number[1]);
2276
+ }
2277
+ }
2278
+
2279
+ return $args[$max[0]];
2280
+ }
2281
+
2282
+ protected function getNormalizedNumbers($args) {
2283
+ $unit = null;
2284
+ $originalUnit = null;
2285
+ $numbers = array();
2286
+ foreach ($args as $key => $item) {
2287
+ if ('number' != $item[0]) {
2288
+ $this->throwError("%s is not a number", $item[0]);
2289
+ }
2290
+ $number = $this->normalizeNumber($item);
2291
+
2292
+ if (null === $unit) {
2293
+ $unit = $number[2];
2294
+ $originalUnit = $item[2];
2295
+ } elseif ($unit !== $number[2]) {
2296
+ $this->throwError('Incompatible units: "%s" and "%s".', $originalUnit, $item[2]);
2297
+ }
2298
+
2299
+ $numbers[$key] = $number;
2300
+ }
2301
+
2302
+ return $numbers;
2303
+ }
2304
+
2305
+ protected static $lib_length = array("list");
2306
+ protected function lib_length($args) {
2307
+ $list = $this->coerceList($args[0]);
2308
+ return count($list[2]);
2309
+ }
2310
+
2311
+ protected static $lib_nth = array("list", "n");
2312
+ protected function lib_nth($args) {
2313
+ $list = $this->coerceList($args[0]);
2314
+ $n = $this->assertNumber($args[1]) - 1;
2315
+ return isset($list[2][$n]) ? $list[2][$n] : self::$defaultValue;
2316
+ }
2317
+
2318
+ protected function listSeparatorForJoin($list1, $sep) {
2319
+ if (!isset($sep)) return $list1[1];
2320
+ switch ($this->compileValue($sep)) {
2321
+ case "comma":
2322
+ return ",";
2323
+ case "space":
2324
+ return "";
2325
+ default:
2326
+ return $list1[1];
2327
+ }
2328
+ }
2329
+
2330
+ protected static $lib_join = array("list1", "list2", "separator");
2331
+ protected function lib_join($args) {
2332
+ list($list1, $list2, $sep) = $args;
2333
+ $list1 = $this->coerceList($list1, " ");
2334
+ $list2 = $this->coerceList($list2, " ");
2335
+ $sep = $this->listSeparatorForJoin($list1, $sep);
2336
+ return array("list", $sep, array_merge($list1[2], $list2[2]));
2337
+ }
2338
+
2339
+ protected static $lib_append = array("list", "val", "separator");
2340
+ protected function lib_append($args) {
2341
+ list($list1, $value, $sep) = $args;
2342
+ $list1 = $this->coerceList($list1, " ");
2343
+ $sep = $this->listSeparatorForJoin($list1, $sep);
2344
+ return array("list", $sep, array_merge($list1[2], array($value)));
2345
+ }
2346
+
2347
+ protected function lib_zip($args) {
2348
+ foreach ($args as $arg) {
2349
+ $this->assertList($arg);
2350
+ }
2351
+
2352
+ $lists = array();
2353
+ $firstList = array_shift($args);
2354
+ foreach ($firstList[2] as $key => $item) {
2355
+ $list = array("list", "", array($item));
2356
+ foreach ($args as $arg) {
2357
+ if (isset($arg[2][$key])) {
2358
+ $list[2][] = $arg[2][$key];
2359
+ } else {
2360
+ break 2;
2361
+ }
2362
+ }
2363
+ $lists[] = $list;
2364
+ }
2365
+
2366
+ return array("list", ",", $lists);
2367
+ }
2368
+
2369
+ protected static $lib_type_of = array("value");
2370
+ protected function lib_type_of($args) {
2371
+ $value = $args[0];
2372
+ switch ($value[0]) {
2373
+ case "keyword":
2374
+ if ($value == self::$true || $value == self::$false) {
2375
+ return "bool";
2376
+ }
2377
+
2378
+ if ($this->coerceColor($value)) {
2379
+ return "color";
2380
+ }
2381
+
2382
+ return "string";
2383
+ default:
2384
+ return $value[0];
2385
+ }
2386
+ }
2387
+
2388
+ protected static $lib_unit = array("number");
2389
+ protected function lib_unit($args) {
2390
+ $num = $args[0];
2391
+ if ($num[0] == "number") {
2392
+ return array("string", '"', array($num[2]));
2393
+ }
2394
+ return "";
2395
+ }
2396
+
2397
+ protected static $lib_unitless = array("number");
2398
+ protected function lib_unitless($args) {
2399
+ $value = $args[0];
2400
+ return $value[0] == "number" && empty($value[2]);
2401
+ }
2402
+
2403
+ protected static $lib_comparable = array("number-1", "number-2");
2404
+ protected function lib_comparable($args) {
2405
+ list($number1, $number2) = $args;
2406
+ if (!isset($number1[0]) || $number1[0] != "number" || !isset($number2[0]) || $number2[0] != "number") {
2407
+ $this->throwError('Invalid argument(s) for "comparable"');
2408
+ }
2409
+
2410
+ $number1 = $this->normalizeNumber($number1);
2411
+ $number2 = $this->normalizeNumber($number2);
2412
+
2413
+ return $number1[2] == $number2[2] || $number1[2] == "" || $number2[2] == "";
2414
+ }
2415
+
2416
+ /**
2417
+ * Workaround IE7's content counter bug.
2418
+ *
2419
+ * @param array $args
2420
+ */
2421
+ protected function lib_counter($args) {
2422
+ $list = array_map(array($this, 'compileValue'), $args);
2423
+ return array('string', '', array('counter(' . implode(',', $list) . ')'));
2424
+ }
2425
+
2426
+ public function throwError($msg = null) {
2427
+ if (func_num_args() > 1) {
2428
+ $msg = call_user_func_array("sprintf", func_get_args());
2429
+ }
2430
+
2431
+ if ($this->sourcePos >= 0 && isset($this->sourceParser)) {
2432
+ $this->sourceParser->throwParseError($msg, $this->sourcePos);
2433
+ }
2434
+
2435
+ throw new Exception($msg);
2436
+ }
2437
+
2438
+ /**
2439
+ * CSS Colors
2440
+ *
2441
+ * @see http://www.w3.org/TR/css3-color
2442
+ */
2443
+ static protected $cssColors = array(
2444
+ 'aliceblue' => '240,248,255',
2445
+ 'antiquewhite' => '250,235,215',
2446
+ 'aqua' => '0,255,255',
2447
+ 'aquamarine' => '127,255,212',
2448
+ 'azure' => '240,255,255',
2449
+ 'beige' => '245,245,220',
2450
+ 'bisque' => '255,228,196',
2451
+ 'black' => '0,0,0',
2452
+ 'blanchedalmond' => '255,235,205',
2453
+ 'blue' => '0,0,255',
2454
+ 'blueviolet' => '138,43,226',
2455
+ 'brown' => '165,42,42',
2456
+ 'burlywood' => '222,184,135',
2457
+ 'cadetblue' => '95,158,160',
2458
+ 'chartreuse' => '127,255,0',
2459
+ 'chocolate' => '210,105,30',
2460
+ 'coral' => '255,127,80',
2461
+ 'cornflowerblue' => '100,149,237',
2462
+ 'cornsilk' => '255,248,220',
2463
+ 'crimson' => '220,20,60',
2464
+ 'cyan' => '0,255,255',
2465
+ 'darkblue' => '0,0,139',
2466
+ 'darkcyan' => '0,139,139',
2467
+ 'darkgoldenrod' => '184,134,11',
2468
+ 'darkgray' => '169,169,169',
2469
+ 'darkgreen' => '0,100,0',
2470
+ 'darkgrey' => '169,169,169',
2471
+ 'darkkhaki' => '189,183,107',
2472
+ 'darkmagenta' => '139,0,139',
2473
+ 'darkolivegreen' => '85,107,47',
2474
+ 'darkorange' => '255,140,0',
2475
+ 'darkorchid' => '153,50,204',
2476
+ 'darkred' => '139,0,0',
2477
+ 'darksalmon' => '233,150,122',
2478
+ 'darkseagreen' => '143,188,143',
2479
+ 'darkslateblue' => '72,61,139',
2480
+ 'darkslategray' => '47,79,79',
2481
+ 'darkslategrey' => '47,79,79',
2482
+ 'darkturquoise' => '0,206,209',
2483
+ 'darkviolet' => '148,0,211',
2484
+ 'deeppink' => '255,20,147',
2485
+ 'deepskyblue' => '0,191,255',
2486
+ 'dimgray' => '105,105,105',
2487
+ 'dimgrey' => '105,105,105',
2488
+ 'dodgerblue' => '30,144,255',
2489
+ 'firebrick' => '178,34,34',
2490
+ 'floralwhite' => '255,250,240',
2491
+ 'forestgreen' => '34,139,34',
2492
+ 'fuchsia' => '255,0,255',
2493
+ 'gainsboro' => '220,220,220',
2494
+ 'ghostwhite' => '248,248,255',
2495
+ 'gold' => '255,215,0',
2496
+ 'goldenrod' => '218,165,32',
2497
+ 'gray' => '128,128,128',
2498
+ 'green' => '0,128,0',
2499
+ 'greenyellow' => '173,255,47',
2500
+ 'grey' => '128,128,128',
2501
+ 'honeydew' => '240,255,240',
2502
+ 'hotpink' => '255,105,180',
2503
+ 'indianred' => '205,92,92',
2504
+ 'indigo' => '75,0,130',
2505
+ 'ivory' => '255,255,240',
2506
+ 'khaki' => '240,230,140',
2507
+ 'lavender' => '230,230,250',
2508
+ 'lavenderblush' => '255,240,245',
2509
+ 'lawngreen' => '124,252,0',
2510
+ 'lemonchiffon' => '255,250,205',
2511
+ 'lightblue' => '173,216,230',
2512
+ 'lightcoral' => '240,128,128',
2513
+ 'lightcyan' => '224,255,255',
2514
+ 'lightgoldenrodyellow' => '250,250,210',
2515
+ 'lightgray' => '211,211,211',
2516
+ 'lightgreen' => '144,238,144',
2517
+ 'lightgrey' => '211,211,211',
2518
+ 'lightpink' => '255,182,193',
2519
+ 'lightsalmon' => '255,160,122',
2520
+ 'lightseagreen' => '32,178,170',
2521
+ 'lightskyblue' => '135,206,250',
2522
+ 'lightslategray' => '119,136,153',
2523
+ 'lightslategrey' => '119,136,153',
2524
+ 'lightsteelblue' => '176,196,222',
2525
+ 'lightyellow' => '255,255,224',
2526
+ 'lime' => '0,255,0',
2527
+ 'limegreen' => '50,205,50',
2528
+ 'linen' => '250,240,230',
2529
+ 'magenta' => '255,0,255',
2530
+ 'maroon' => '128,0,0',
2531
+ 'mediumaquamarine' => '102,205,170',
2532
+ 'mediumblue' => '0,0,205',
2533
+ 'mediumorchid' => '186,85,211',
2534
+ 'mediumpurple' => '147,112,219',
2535
+ 'mediumseagreen' => '60,179,113',
2536
+ 'mediumslateblue' => '123,104,238',
2537
+ 'mediumspringgreen' => '0,250,154',
2538
+ 'mediumturquoise' => '72,209,204',
2539
+ 'mediumvioletred' => '199,21,133',
2540
+ 'midnightblue' => '25,25,112',
2541
+ 'mintcream' => '245,255,250',
2542
+ 'mistyrose' => '255,228,225',
2543
+ 'moccasin' => '255,228,181',
2544
+ 'navajowhite' => '255,222,173',
2545
+ 'navy' => '0,0,128',
2546
+ 'oldlace' => '253,245,230',
2547
+ 'olive' => '128,128,0',
2548
+ 'olivedrab' => '107,142,35',
2549
+ 'orange' => '255,165,0',
2550
+ 'orangered' => '255,69,0',
2551
+ 'orchid' => '218,112,214',
2552
+ 'palegoldenrod' => '238,232,170',
2553
+ 'palegreen' => '152,251,152',
2554
+ 'paleturquoise' => '175,238,238',
2555
+ 'palevioletred' => '219,112,147',
2556
+ 'papayawhip' => '255,239,213',
2557
+ 'peachpuff' => '255,218,185',
2558
+ 'peru' => '205,133,63',
2559
+ 'pink' => '255,192,203',
2560
+ 'plum' => '221,160,221',
2561
+ 'powderblue' => '176,224,230',
2562
+ 'purple' => '128,0,128',
2563
+ 'red' => '255,0,0',
2564
+ 'rosybrown' => '188,143,143',
2565
+ 'royalblue' => '65,105,225',
2566
+ 'saddlebrown' => '139,69,19',
2567
+ 'salmon' => '250,128,114',
2568
+ 'sandybrown' => '244,164,96',
2569
+ 'seagreen' => '46,139,87',
2570
+ 'seashell' => '255,245,238',
2571
+ 'sienna' => '160,82,45',
2572
+ 'silver' => '192,192,192',
2573
+ 'skyblue' => '135,206,235',
2574
+ 'slateblue' => '106,90,205',
2575
+ 'slategray' => '112,128,144',
2576
+ 'slategrey' => '112,128,144',
2577
+ 'snow' => '255,250,250',
2578
+ 'springgreen' => '0,255,127',
2579
+ 'steelblue' => '70,130,180',
2580
+ 'tan' => '210,180,140',
2581
+ 'teal' => '0,128,128',
2582
+ 'thistle' => '216,191,216',
2583
+ 'tomato' => '255,99,71',
2584
+ 'transparent' => '0,0,0,0',
2585
+ 'turquoise' => '64,224,208',
2586
+ 'violet' => '238,130,238',
2587
+ 'wheat' => '245,222,179',
2588
+ 'white' => '255,255,255',
2589
+ 'whitesmoke' => '245,245,245',
2590
+ 'yellow' => '255,255,0',
2591
+ 'yellowgreen' => '154,205,50'
2592
+ );
2593
+ }
2594
+
2595
+ /**
2596
+ * SCSS parser
2597
+ *
2598
+ * @author Leaf Corcoran <leafot@gmail.com>
2599
+ */
2600
+ class scss_parser {
2601
+ static protected $precedence = array(
2602
+ "or" => 0,
2603
+ "and" => 1,
2604
+
2605
+ '==' => 2,
2606
+ '!=' => 2,
2607
+ '<=' => 2,
2608
+ '>=' => 2,
2609
+ '=' => 2,
2610
+ '<' => 3,
2611
+ '>' => 2,
2612
+
2613
+ '+' => 3,
2614
+ '-' => 3,
2615
+ '*' => 4,
2616
+ '/' => 4,
2617
+ '%' => 4,
2618
+ );
2619
+
2620
+ static protected $operators = array("+", "-", "*", "/", "%",
2621
+ "==", "!=", "<=", ">=", "<", ">", "and", "or");
2622
+
2623
+ static protected $operatorStr;
2624
+ static protected $whitePattern;
2625
+ static protected $commentMulti;
2626
+
2627
+ static protected $commentSingle = "//";
2628
+ static protected $commentMultiLeft = "/*";
2629
+ static protected $commentMultiRight = "*/";
2630
+
2631
+ public function __construct($sourceName = null, $rootParser = true) {
2632
+ $this->sourceName = $sourceName;
2633
+ $this->rootParser = $rootParser;
2634
+
2635
+ if (empty(self::$operatorStr)) {
2636
+ self::$operatorStr = $this->makeOperatorStr(self::$operators);
2637
+
2638
+ $commentSingle = $this->preg_quote(self::$commentSingle);
2639
+ $commentMultiLeft = $this->preg_quote(self::$commentMultiLeft);
2640
+ $commentMultiRight = $this->preg_quote(self::$commentMultiRight);
2641
+ self::$commentMulti = $commentMultiLeft.'.*?'.$commentMultiRight;
2642
+ self::$whitePattern = '/'.$commentSingle.'[^\n]*\s*|('.self::$commentMulti.')\s*|\s+/Ais';
2643
+ }
2644
+ }
2645
+
2646
+ static protected function makeOperatorStr($operators) {
2647
+ return '('.implode('|', array_map(array('scss_parser','preg_quote'),
2648
+ $operators)).')';
2649
+ }
2650
+
2651
+ public function parse($buffer) {
2652
+ $this->count = 0;
2653
+ $this->env = null;
2654
+ $this->inParens = false;
2655
+ $this->pushBlock(null); // root block
2656
+ $this->eatWhiteDefault = true;
2657
+ $this->insertComments = true;
2658
+
2659
+ $this->buffer = $buffer;
2660
+
2661
+ $this->whitespace();
2662
+ while (false !== $this->parseChunk());
2663
+
2664
+ if ($this->count != strlen($this->buffer))
2665
+ $this->throwParseError();
2666
+
2667
+ if (!empty($this->env->parent)) {
2668
+ $this->throwParseError("unclosed block");
2669
+ }
2670
+
2671
+ $this->env->isRoot = true;
2672
+ return $this->env;
2673
+ }
2674
+
2675
+ /**
2676
+ * Parse a single chunk off the head of the buffer and append it to the
2677
+ * current parse environment.
2678
+ *
2679
+ * Returns false when the buffer is empty, or when there is an error.
2680
+ *
2681
+ * This function is called repeatedly until the entire document is
2682
+ * parsed.
2683
+ *
2684
+ * This parser is most similar to a recursive descent parser. Single
2685
+ * functions represent discrete grammatical rules for the language, and
2686
+ * they are able to capture the text that represents those rules.
2687
+ *
2688
+ * Consider the function scssc::keyword(). (All parse functions are
2689
+ * structured the same.)
2690
+ *
2691
+ * The function takes a single reference argument. When calling the
2692
+ * function it will attempt to match a keyword on the head of the buffer.
2693
+ * If it is successful, it will place the keyword in the referenced
2694
+ * argument, advance the position in the buffer, and return true. If it
2695
+ * fails then it won't advance the buffer and it will return false.
2696
+ *
2697
+ * All of these parse functions are powered by scssc::match(), which behaves
2698
+ * the same way, but takes a literal regular expression. Sometimes it is
2699
+ * more convenient to use match instead of creating a new function.
2700
+ *
2701
+ * Because of the format of the functions, to parse an entire string of
2702
+ * grammatical rules, you can chain them together using &&.
2703
+ *
2704
+ * But, if some of the rules in the chain succeed before one fails, then
2705
+ * the buffer position will be left at an invalid state. In order to
2706
+ * avoid this, scssc::seek() is used to remember and set buffer positions.
2707
+ *
2708
+ * Before parsing a chain, use $s = $this->seek() to remember the current
2709
+ * position into $s. Then if a chain fails, use $this->seek($s) to
2710
+ * go back where we started.
2711
+ *
2712
+ * @return boolean
2713
+ */
2714
+ protected function parseChunk() {
2715
+ $s = $this->seek();
2716
+
2717
+ // the directives
2718
+ if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
2719
+ if ($this->literal("@media") && $this->mediaQueryList($mediaQueryList) && $this->literal("{")) {
2720
+ $media = $this->pushSpecialBlock("media");
2721
+ $media->queryList = $mediaQueryList[2];
2722
+ return true;
2723
+ } else {
2724
+ $this->seek($s);
2725
+ }
2726
+
2727
+ if ($this->literal("@mixin") &&
2728
+ $this->keyword($mixinName) &&
2729
+ ($this->argumentDef($args) || true) &&
2730
+ $this->literal("{"))
2731
+ {
2732
+ $mixin = $this->pushSpecialBlock("mixin");
2733
+ $mixin->name = $mixinName;
2734
+ $mixin->args = $args;
2735
+ return true;
2736
+ } else {
2737
+ $this->seek($s);
2738
+ }
2739
+
2740
+ if ($this->literal("@include") &&
2741
+ $this->keyword($mixinName) &&
2742
+ ($this->literal("(") &&
2743
+ ($this->argValues($argValues) || true) &&
2744
+ $this->literal(")") || true) &&
2745
+ ($this->end() ||
2746
+ $this->literal("{") && $hasBlock = true))
2747
+ {
2748
+ $child = array("include",
2749
+ $mixinName, isset($argValues) ? $argValues : null, null);
2750
+
2751
+ if (!empty($hasBlock)) {
2752
+ $include = $this->pushSpecialBlock("include");
2753
+ $include->child = $child;
2754
+ } else {
2755
+ $this->append($child, $s);
2756
+ }
2757
+
2758
+ return true;
2759
+ } else {
2760
+ $this->seek($s);
2761
+ }
2762
+
2763
+ if ($this->literal("@import") &&
2764
+ $this->valueList($importPath) &&
2765
+ $this->end())
2766
+ {
2767
+ $this->append(array("import", $importPath), $s);
2768
+ return true;
2769
+ } else {
2770
+ $this->seek($s);
2771
+ }
2772
+
2773
+ if ($this->literal("@extend") &&
2774
+ $this->selectors($selector) &&
2775
+ $this->end())
2776
+ {
2777
+ $this->append(array("extend", $selector), $s);
2778
+ return true;
2779
+ } else {
2780
+ $this->seek($s);
2781
+ }
2782
+
2783
+ if ($this->literal("@function") &&
2784
+ $this->keyword($fnName) &&
2785
+ $this->argumentDef($args) &&
2786
+ $this->literal("{"))
2787
+ {
2788
+ $func = $this->pushSpecialBlock("function");
2789
+ $func->name = $fnName;
2790
+ $func->args = $args;
2791
+ return true;
2792
+ } else {
2793
+ $this->seek($s);
2794
+ }
2795
+
2796
+ if ($this->literal("@return") && $this->valueList($retVal) && $this->end()) {
2797
+ $this->append(array("return", $retVal), $s);
2798
+ return true;
2799
+ } else {
2800
+ $this->seek($s);
2801
+ }
2802
+
2803
+ if ($this->literal("@each") &&
2804
+ $this->variable($varName) &&
2805
+ $this->literal("in") &&
2806
+ $this->valueList($list) &&
2807
+ $this->literal("{"))
2808
+ {
2809
+ $each = $this->pushSpecialBlock("each");
2810
+ $each->var = $varName[1];
2811
+ $each->list = $list;
2812
+ return true;
2813
+ } else {
2814
+ $this->seek($s);
2815
+ }
2816
+
2817
+ if ($this->literal("@while") &&
2818
+ $this->expression($cond) &&
2819
+ $this->literal("{"))
2820
+ {
2821
+ $while = $this->pushSpecialBlock("while");
2822
+ $while->cond = $cond;
2823
+ return true;
2824
+ } else {
2825
+ $this->seek($s);
2826
+ }
2827
+
2828
+ if ($this->literal("@for") &&
2829
+ $this->variable($varName) &&
2830
+ $this->literal("from") &&
2831
+ $this->expression($start) &&
2832
+ ($this->literal("through") ||
2833
+ ($forUntil = true && $this->literal("to"))) &&
2834
+ $this->expression($end) &&
2835
+ $this->literal("{"))
2836
+ {
2837
+ $for = $this->pushSpecialBlock("for");
2838
+ $for->var = $varName[1];
2839
+ $for->start = $start;
2840
+ $for->end = $end;
2841
+ $for->until = isset($forUntil);
2842
+ return true;
2843
+ } else {
2844
+ $this->seek($s);
2845
+ }
2846
+
2847
+ if ($this->literal("@if") && $this->valueList($cond) && $this->literal("{")) {
2848
+ $if = $this->pushSpecialBlock("if");
2849
+ $if->cond = $cond;
2850
+ $if->cases = array();
2851
+ return true;
2852
+ } else {
2853
+ $this->seek($s);
2854
+ }
2855
+
2856
+ if (($this->literal("@debug") || $this->literal("@warn")) &&
2857
+ $this->valueList($value) &&
2858
+ $this->end()) {
2859
+ $this->append(array("debug", $value, $s), $s);
2860
+ return true;
2861
+ } else {
2862
+ $this->seek($s);
2863
+ }
2864
+
2865
+ if ($this->literal("@content") && $this->end()) {
2866
+ $this->append(array("mixin_content"), $s);
2867
+ return true;
2868
+ } else {
2869
+ $this->seek($s);
2870
+ }
2871
+
2872
+ $last = $this->last();
2873
+ if (isset($last) && $last[0] == "if") {
2874
+ list(, $if) = $last;
2875
+ if ($this->literal("@else")) {
2876
+ if ($this->literal("{")) {
2877
+ $else = $this->pushSpecialBlock("else");
2878
+ } elseif ($this->literal("if") && $this->valueList($cond) && $this->literal("{")) {
2879
+ $else = $this->pushSpecialBlock("elseif");
2880
+ $else->cond = $cond;
2881
+ }
2882
+
2883
+ if (isset($else)) {
2884
+ $else->dontAppend = true;
2885
+ $if->cases[] = $else;
2886
+ return true;
2887
+ }
2888
+ }
2889
+
2890
+ $this->seek($s);
2891
+ }
2892
+
2893
+ if ($this->literal("@charset") &&
2894
+ $this->valueList($charset) && $this->end())
2895
+ {
2896
+ $this->append(array("charset", $charset), $s);
2897
+ return true;
2898
+ } else {
2899
+ $this->seek($s);
2900
+ }
2901
+
2902
+ // doesn't match built in directive, do generic one
2903
+ if ($this->literal("@", false) && $this->keyword($dirName) &&
2904
+ ($this->openString("{", $dirValue) || true) &&
2905
+ $this->literal("{"))
2906
+ {
2907
+ $directive = $this->pushSpecialBlock("directive");
2908
+ $directive->name = $dirName;
2909
+ if (isset($dirValue)) $directive->value = $dirValue;
2910
+ return true;
2911
+ }
2912
+
2913
+ $this->seek($s);
2914
+ return false;
2915
+ }
2916
+
2917
+ // property shortcut
2918
+ // captures most properties before having to parse a selector
2919
+ if ($this->keyword($name, false) &&
2920
+ $this->literal(": ") &&
2921
+ $this->valueList($value) &&
2922
+ $this->end())
2923
+ {
2924
+ $name = array("string", "", array($name));
2925
+ $this->append(array("assign", $name, $value), $s);
2926
+ return true;
2927
+ } else {
2928
+ $this->seek($s);
2929
+ }
2930
+
2931
+ // variable assigns
2932
+ if ($this->variable($name) &&
2933
+ $this->literal(":") &&
2934
+ $this->valueList($value) && $this->end())
2935
+ {
2936
+ // check for !default
2937
+ $defaultVar = $value[0] == "list" && $this->stripDefault($value);
2938
+ $this->append(array("assign", $name, $value, $defaultVar), $s);
2939
+ return true;
2940
+ } else {
2941
+ $this->seek($s);
2942
+ }
2943
+
2944
+ // misc
2945
+ if ($this->literal("-->")) {
2946
+ return true;
2947
+ }
2948
+
2949
+ // opening css block
2950
+ $oldComments = $this->insertComments;
2951
+ $this->insertComments = false;
2952
+ if ($this->selectors($selectors) && $this->literal("{")) {
2953
+ $this->pushBlock($selectors);
2954
+ $this->insertComments = $oldComments;
2955
+ return true;
2956
+ } else {
2957
+ $this->seek($s);
2958
+ }
2959
+ $this->insertComments = $oldComments;
2960
+
2961
+ // property assign, or nested assign
2962
+ if ($this->propertyName($name) && $this->literal(":")) {
2963
+ $foundSomething = false;
2964
+ if ($this->valueList($value)) {
2965
+ $this->append(array("assign", $name, $value), $s);
2966
+ $foundSomething = true;
2967
+ }
2968
+
2969
+ if ($this->literal("{")) {
2970
+ $propBlock = $this->pushSpecialBlock("nestedprop");
2971
+ $propBlock->prefix = $name;
2972
+ $foundSomething = true;
2973
+ } elseif ($foundSomething) {
2974
+ $foundSomething = $this->end();
2975
+ }
2976
+
2977
+ if ($foundSomething) {
2978
+ return true;
2979
+ }
2980
+
2981
+ $this->seek($s);
2982
+ } else {
2983
+ $this->seek($s);
2984
+ }
2985
+
2986
+ // closing a block
2987
+ if ($this->literal("}")) {
2988
+ $block = $this->popBlock();
2989
+ if (isset($block->type) && $block->type == "include") {
2990
+ $include = $block->child;
2991
+ unset($block->child);
2992
+ $include[3] = $block;
2993
+ $this->append($include, $s);
2994
+ } elseif (empty($block->dontAppend)) {
2995
+ $type = isset($block->type) ? $block->type : "block";
2996
+ $this->append(array($type, $block), $s);
2997
+ }
2998
+ return true;
2999
+ }
3000
+
3001
+ // extra stuff
3002
+ if ($this->literal(";") ||
3003
+ $this->literal("<!--"))
3004
+ {
3005
+ return true;
3006
+ }
3007
+
3008
+ return false;
3009
+ }
3010
+
3011
+ protected function stripDefault(&$value) {
3012
+ $def = end($value[2]);
3013
+ if ($def[0] == "keyword" && $def[1] == "!default") {
3014
+ array_pop($value[2]);
3015
+ $value = $this->flattenList($value);
3016
+ return true;
3017
+ }
3018
+
3019
+ if ($def[0] == "list") {
3020
+ return $this->stripDefault($value[2][count($value[2]) - 1]);
3021
+ }
3022
+
3023
+ return false;
3024
+ }
3025
+
3026
+ protected function literal($what, $eatWhitespace = null) {
3027
+ if (!isset($eatWhitespace)) $eatWhitespace = $this->eatWhiteDefault;
3028
+
3029
+ // shortcut on single letter
3030
+ if (!isset($what[1]) && isset($this->buffer[$this->count])) {
3031
+ if ($this->buffer[$this->count] == $what) {
3032
+ if (!$eatWhitespace) {
3033
+ $this->count++;
3034
+ return true;
3035
+ }
3036
+ // goes below...
3037
+ } else {
3038
+ return false;
3039
+ }
3040
+ }
3041
+
3042
+ return $this->match($this->preg_quote($what), $m, $eatWhitespace);
3043
+ }
3044
+
3045
+ // tree builders
3046
+
3047
+ protected function pushBlock($selectors) {
3048
+ $b = new stdClass;
3049
+ $b->parent = $this->env; // not sure if we need this yet
3050
+
3051
+ $b->selectors = $selectors;
3052
+ $b->children = array();
3053
+
3054
+ $this->env = $b;
3055
+ return $b;
3056
+ }
3057
+
3058
+ protected function pushSpecialBlock($type) {
3059
+ $block = $this->pushBlock(null);
3060
+ $block->type = $type;
3061
+ return $block;
3062
+ }
3063
+
3064
+ protected function popBlock() {
3065
+ if (empty($this->env->parent)) {
3066
+ $this->throwParseError("unexpected }");
3067
+ }
3068
+
3069
+ $old = $this->env;
3070
+ $this->env = $this->env->parent;
3071
+ unset($old->parent);
3072
+ return $old;
3073
+ }
3074
+
3075
+ protected function append($statement, $pos=null) {
3076
+ if ($pos !== null) {
3077
+ $statement[-1] = $pos;
3078
+ if (!$this->rootParser) $statement[-2] = $this;
3079
+ }
3080
+ $this->env->children[] = $statement;
3081
+ }
3082
+
3083
+ // last child that was appended
3084
+ protected function last() {
3085
+ $i = count($this->env->children) - 1;
3086
+ if (isset($this->env->children[$i]))
3087
+ return $this->env->children[$i];
3088
+ }
3089
+
3090
+ // high level parsers (they return parts of ast)
3091
+
3092
+ protected function mediaQueryList(&$out) {
3093
+ return $this->genericList($out, "mediaQuery", ",", false);
3094
+ }
3095
+
3096
+ protected function mediaQuery(&$out) {
3097
+ $s = $this->seek();
3098
+
3099
+ $expressions = null;
3100
+ $parts = array();
3101
+
3102
+ if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) && $this->mixedKeyword($mediaType)) {
3103
+ $prop = array("mediaType");
3104
+ if (isset($only)) $prop[] = array("keyword", "only");
3105
+ if (isset($not)) $prop[] = array("keyword", "not");
3106
+ $media = array("list", "", array());
3107
+ foreach ((array)$mediaType as $type) {
3108
+ if (is_array($type)) {
3109
+ $media[2][] = $type;
3110
+ } else {
3111
+ $media[2][] = array("keyword", $type);
3112
+ }
3113
+ }
3114
+ $prop[] = $media;
3115
+ $parts[] = $prop;
3116
+ }
3117
+
3118
+ if (empty($parts) || $this->literal("and")) {
3119
+ $this->genericList($expressions, "mediaExpression", "and", false);
3120
+ if (is_array($expressions)) $parts = array_merge($parts, $expressions[2]);
3121
+ }
3122
+
3123
+ $out = $parts;
3124
+ return true;
3125
+ }
3126
+
3127
+ protected function mediaExpression(&$out) {
3128
+ $s = $this->seek();
3129
+ $value = null;
3130
+ if ($this->literal("(") &&
3131
+ $this->expression($feature) &&
3132
+ ($this->literal(":") && $this->expression($value) || true) &&
3133
+ $this->literal(")"))
3134
+ {
3135
+ $out = array("mediaExp", $feature);
3136
+ if ($value) $out[] = $value;
3137
+ return true;
3138
+ }
3139
+
3140
+ $this->seek($s);
3141
+ return false;
3142
+ }
3143
+
3144
+ protected function argValues(&$out) {
3145
+ if ($this->genericList($list, "argValue", ",", false)) {
3146
+ $out = $list[2];
3147
+ return true;
3148
+ }
3149
+ return false;
3150
+ }
3151
+
3152
+ protected function argValue(&$out) {
3153
+ $s = $this->seek();
3154
+
3155
+ $keyword = null;
3156
+ if (!$this->variable($keyword) || !$this->literal(":")) {
3157
+ $this->seek($s);
3158
+ $keyword = null;
3159
+ }
3160
+
3161
+ if ($this->genericList($value, "expression")) {
3162
+ $out = array($keyword, $value, false);
3163
+ $s = $this->seek();
3164
+ if ($this->literal("...")) {
3165
+ $out[2] = true;
3166
+ } else {
3167
+ $this->seek($s);
3168
+ }
3169
+ return true;
3170
+ }
3171
+
3172
+ return false;
3173
+ }
3174
+
3175
+
3176
+ protected function valueList(&$out) {
3177
+ return $this->genericList($out, "spaceList", ",");
3178
+ }
3179
+
3180
+ protected function spaceList(&$out) {
3181
+ return $this->genericList($out, "expression");
3182
+ }
3183
+
3184
+ protected function genericList(&$out, $parseItem, $delim="", $flatten=true) {
3185
+ $s = $this->seek();
3186
+ $items = array();
3187
+ while ($this->$parseItem($value)) {
3188
+ $items[] = $value;
3189
+ if ($delim) {
3190
+ if (!$this->literal($delim)) break;
3191
+ }
3192
+ }
3193
+
3194
+ if (count($items) == 0) {
3195
+ $this->seek($s);
3196
+ return false;
3197
+ }
3198
+
3199
+ if ($flatten && count($items) == 1) {
3200
+ $out = $items[0];
3201
+ } else {
3202
+ $out = array("list", $delim, $items);
3203
+ }
3204
+
3205
+ return true;
3206
+ }
3207
+
3208
+ protected function expression(&$out) {
3209
+ $s = $this->seek();
3210
+
3211
+ if ($this->literal("(")) {
3212
+ if ($this->literal(")")) {
3213
+ $out = array("list", "", array());
3214
+ return true;
3215
+ }
3216
+
3217
+ if ($this->valueList($out) && $this->literal(')') && $out[0] == "list") {
3218
+ return true;
3219
+ }
3220
+
3221
+ $this->seek($s);
3222
+ }
3223
+
3224
+ if ($this->value($lhs)) {
3225
+ $out = $this->expHelper($lhs, 0);
3226
+ return true;
3227
+ }
3228
+
3229
+ return false;
3230
+ }
3231
+
3232
+ protected function expHelper($lhs, $minP) {
3233
+ $opstr = self::$operatorStr;
3234
+
3235
+ $ss = $this->seek();
3236
+ $whiteBefore = isset($this->buffer[$this->count - 1]) &&
3237
+ ctype_space($this->buffer[$this->count - 1]);
3238
+ while ($this->match($opstr, $m) && self::$precedence[$m[1]] >= $minP) {
3239
+ $whiteAfter = isset($this->buffer[$this->count - 1]) &&
3240
+ ctype_space($this->buffer[$this->count - 1]);
3241
+
3242
+ $op = $m[1];
3243
+
3244
+ // don't turn negative numbers into expressions
3245
+ if ($op == "-" && $whiteBefore) {
3246
+ if (!$whiteAfter) break;
3247
+ }
3248
+
3249
+ if (!$this->value($rhs)) break;
3250
+
3251
+ // peek and see if rhs belongs to next operator
3252
+ if ($this->peek($opstr, $next) && self::$precedence[$next[1]] > self::$precedence[$op]) {
3253
+ $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]);
3254
+ }
3255
+
3256
+ $lhs = array("exp", $op, $lhs, $rhs, $this->inParens, $whiteBefore, $whiteAfter);
3257
+ $ss = $this->seek();
3258
+ $whiteBefore = isset($this->buffer[$this->count - 1]) &&
3259
+ ctype_space($this->buffer[$this->count - 1]);
3260
+ }
3261
+
3262
+ $this->seek($ss);
3263
+ return $lhs;
3264
+ }
3265
+
3266
+ protected function value(&$out) {
3267
+ $s = $this->seek();
3268
+
3269
+ if ($this->literal("not", false) && $this->whitespace() && $this->value($inner)) {
3270
+ $out = array("unary", "not", $inner, $this->inParens);
3271
+ return true;
3272
+ } else {
3273
+ $this->seek($s);
3274
+ }
3275
+
3276
+ if ($this->literal("+") && $this->value($inner)) {
3277
+ $out = array("unary", "+", $inner, $this->inParens);
3278
+ return true;
3279
+ } else {
3280
+ $this->seek($s);
3281
+ }
3282
+
3283
+ // negation
3284
+ if ($this->literal("-", false) &&
3285
+ ($this->variable($inner) ||
3286
+ $this->unit($inner) ||
3287
+ $this->parenValue($inner)))
3288
+ {
3289
+ $out = array("unary", "-", $inner, $this->inParens);
3290
+ return true;
3291
+ } else {
3292
+ $this->seek($s);
3293
+ }
3294
+
3295
+ if ($this->parenValue($out)) return true;
3296
+ if ($this->interpolation($out)) return true;
3297
+ if ($this->variable($out)) return true;
3298
+ if ($this->color($out)) return true;
3299
+ if ($this->unit($out)) return true;
3300
+ if ($this->string($out)) return true;
3301
+ if ($this->func($out)) return true;
3302
+ if ($this->progid($out)) return true;
3303
+
3304
+ if ($this->keyword($keyword)) {
3305
+ if ($keyword == "null") {
3306
+ $out = array("null");
3307
+ } else {
3308
+ $out = array("keyword", $keyword);
3309
+ }
3310
+ return true;
3311
+ }
3312
+
3313
+ return false;
3314
+ }
3315
+
3316
+ // value wrappen in parentheses
3317
+ protected function parenValue(&$out) {
3318
+ $s = $this->seek();
3319
+
3320
+ $inParens = $this->inParens;
3321
+ if ($this->literal("(") &&
3322
+ ($this->inParens = true) && $this->expression($exp) &&
3323
+ $this->literal(")"))
3324
+ {
3325
+ $out = $exp;
3326
+ $this->inParens = $inParens;
3327
+ return true;
3328
+ } else {
3329
+ $this->inParens = $inParens;
3330
+ $this->seek($s);
3331
+ }
3332
+
3333
+ return false;
3334
+ }
3335
+
3336
+ protected function progid(&$out) {
3337
+ $s = $this->seek();
3338
+ if ($this->literal("progid:", false) &&
3339
+ $this->openString("(", $fn) &&
3340
+ $this->literal("("))
3341
+ {
3342
+ $this->openString(")", $args, "(");
3343
+ if ($this->literal(")")) {
3344
+ $out = array("string", "", array(
3345
+ "progid:", $fn, "(", $args, ")"
3346
+ ));
3347
+ return true;
3348
+ }
3349
+ }
3350
+
3351
+ $this->seek($s);
3352
+ return false;
3353
+ }
3354
+
3355
+ protected function func(&$func) {
3356
+ $s = $this->seek();
3357
+
3358
+ if ($this->keyword($name, false) &&
3359
+ $this->literal("("))
3360
+ {
3361
+ if ($name == "alpha" && $this->argumentList($args)) {
3362
+ $func = array("function", $name, array("string", "", $args));
3363
+ return true;
3364
+ }
3365
+
3366
+ if ($name != "expression" && !preg_match("/^(-[a-z]+-)?calc$/", $name)) {
3367
+ $ss = $this->seek();
3368
+ if ($this->argValues($args) && $this->literal(")")) {
3369
+ $func = array("fncall", $name, $args);
3370
+ return true;
3371
+ }
3372
+ $this->seek($ss);
3373
+ }
3374
+
3375
+ if (($this->openString(")", $str, "(") || true ) &&
3376
+ $this->literal(")"))
3377
+ {
3378
+ $args = array();
3379
+ if (!empty($str)) {
3380
+ $args[] = array(null, array("string", "", array($str)));
3381
+ }
3382
+
3383
+ $func = array("fncall", $name, $args);
3384
+ return true;
3385
+ }
3386
+ }
3387
+
3388
+ $this->seek($s);
3389
+ return false;
3390
+ }
3391
+
3392
+ protected function argumentList(&$out) {
3393
+ $s = $this->seek();
3394
+ $this->literal("(");
3395
+
3396
+ $args = array();
3397
+ while ($this->keyword($var)) {
3398
+ $ss = $this->seek();
3399
+
3400
+ if ($this->literal("=") && $this->expression($exp)) {
3401
+ $args[] = array("string", "", array($var."="));
3402
+ $arg = $exp;
3403
+ } else {
3404
+ break;
3405
+ }
3406
+
3407
+ $args[] = $arg;
3408
+
3409
+ if (!$this->literal(",")) break;
3410
+
3411
+ $args[] = array("string", "", array(", "));
3412
+ }
3413
+
3414
+ if (!$this->literal(")") || !count($args)) {
3415
+ $this->seek($s);
3416
+ return false;
3417
+ }
3418
+
3419
+ $out = $args;
3420
+ return true;
3421
+ }
3422
+
3423
+ protected function argumentDef(&$out) {
3424
+ $s = $this->seek();
3425
+ $this->literal("(");
3426
+
3427
+ $args = array();
3428
+ while ($this->variable($var)) {
3429
+ $arg = array($var[1], null, false);
3430
+
3431
+ $ss = $this->seek();
3432
+ if ($this->literal(":") && $this->genericList($defaultVal, "expression")) {
3433
+ $arg[1] = $defaultVal;
3434
+ } else {
3435
+ $this->seek($ss);
3436
+ }
3437
+
3438
+ $ss = $this->seek();
3439
+ if ($this->literal("...")) {
3440
+ $sss = $this->seek();
3441
+ if (!$this->literal(")")) {
3442
+ $this->throwParseError("... has to be after the final argument");
3443
+ }
3444
+ $arg[2] = true;
3445
+ $this->seek($sss);
3446
+ } else {
3447
+ $this->seek($ss);
3448
+ }
3449
+
3450
+ $args[] = $arg;
3451
+ if (!$this->literal(",")) break;
3452
+ }
3453
+
3454
+ if (!$this->literal(")")) {
3455
+ $this->seek($s);
3456
+ return false;
3457
+ }
3458
+
3459
+ $out = $args;
3460
+ return true;
3461
+ }
3462
+
3463
+ protected function color(&$out) {
3464
+ $color = array('color');
3465
+
3466
+ if ($this->match('(#([0-9a-f]{6})|#([0-9a-f]{3}))', $m)) {
3467
+ if (isset($m[3])) {
3468
+ $num = $m[3];
3469
+ $width = 16;
3470
+ } else {
3471
+ $num = $m[2];
3472
+ $width = 256;
3473
+ }
3474
+
3475
+ $num = hexdec($num);
3476
+ foreach (array(3,2,1) as $i) {
3477
+ $t = $num % $width;
3478
+ $num /= $width;
3479
+
3480
+ $color[$i] = $t * (256/$width) + $t * floor(16/$width);
3481
+ }
3482
+
3483
+ $out = $color;
3484
+ return true;
3485
+ }
3486
+
3487
+ return false;
3488
+ }
3489
+
3490
+ protected function unit(&$unit) {
3491
+ if ($this->match('([0-9]*(\.)?[0-9]+)([%a-zA-Z]+)?', $m)) {
3492
+ $unit = array("number", $m[1], empty($m[3]) ? "" : $m[3]);
3493
+ return true;
3494
+ }
3495
+ return false;
3496
+ }
3497
+
3498
+ protected function string(&$out) {
3499
+ $s = $this->seek();
3500
+ if ($this->literal('"', false)) {
3501
+ $delim = '"';
3502
+ } elseif ($this->literal("'", false)) {
3503
+ $delim = "'";
3504
+ } else {
3505
+ return false;
3506
+ }
3507
+
3508
+ $content = array();
3509
+ $oldWhite = $this->eatWhiteDefault;
3510
+ $this->eatWhiteDefault = false;
3511
+
3512
+ while ($this->matchString($m, $delim)) {
3513
+ $content[] = $m[1];
3514
+ if ($m[2] == "#{") {
3515
+ $this->count -= strlen($m[2]);
3516
+ if ($this->interpolation($inter, false)) {
3517
+ $content[] = $inter;
3518
+ } else {
3519
+ $this->count += strlen($m[2]);
3520
+ $content[] = "#{"; // ignore it
3521
+ }
3522
+ } elseif ($m[2] == '\\') {
3523
+ $content[] = $m[2];
3524
+ if ($this->literal($delim, false)) {
3525
+ $content[] = $delim;
3526
+ }
3527
+ } else {
3528
+ $this->count -= strlen($delim);
3529
+ break; // delim
3530
+ }
3531
+ }
3532
+
3533
+ $this->eatWhiteDefault = $oldWhite;
3534
+
3535
+ if ($this->literal($delim)) {
3536
+ $out = array("string", $delim, $content);
3537
+ return true;
3538
+ }
3539
+
3540
+ $this->seek($s);
3541
+ return false;
3542
+ }
3543
+
3544
+ protected function mixedKeyword(&$out) {
3545
+ $s = $this->seek();
3546
+
3547
+ $parts = array();
3548
+
3549
+ $oldWhite = $this->eatWhiteDefault;
3550
+ $this->eatWhiteDefault = false;
3551
+
3552
+ while (true) {
3553
+ if ($this->keyword($key)) {
3554
+ $parts[] = $key;
3555
+ continue;
3556
+ }
3557
+
3558
+ if ($this->interpolation($inter)) {
3559
+ $parts[] = $inter;
3560
+ continue;
3561
+ }
3562
+
3563
+ break;
3564
+ }
3565
+
3566
+ $this->eatWhiteDefault = $oldWhite;
3567
+
3568
+ if (count($parts) == 0) return false;
3569
+
3570
+ if ($this->eatWhiteDefault) {
3571
+ $this->whitespace();
3572
+ }
3573
+
3574
+ $out = $parts;
3575
+ return true;
3576
+ }
3577
+
3578
+ // an unbounded string stopped by $end
3579
+ protected function openString($end, &$out, $nestingOpen=null) {
3580
+ $oldWhite = $this->eatWhiteDefault;
3581
+ $this->eatWhiteDefault = false;
3582
+
3583
+ $stop = array("'", '"', "#{", $end);
3584
+ $stop = array_map(array($this, "preg_quote"), $stop);
3585
+ $stop[] = self::$commentMulti;
3586
+
3587
+ $patt = '(.*?)('.implode("|", $stop).')';
3588
+
3589
+ $nestingLevel = 0;
3590
+
3591
+ $content = array();
3592
+ while ($this->match($patt, $m, false)) {
3593
+ if (isset($m[1]) && $m[1] !== '') {
3594
+ $content[] = $m[1];
3595
+ if ($nestingOpen) {
3596
+ $nestingLevel += substr_count($m[1], $nestingOpen);
3597
+ }
3598
+ }
3599
+
3600
+ $tok = $m[2];
3601
+
3602
+ $this->count-= strlen($tok);
3603
+ if ($tok == $end) {
3604
+ if ($nestingLevel == 0) {
3605
+ break;
3606
+ } else {
3607
+ $nestingLevel--;
3608
+ }
3609
+ }
3610
+
3611
+ if (($tok == "'" || $tok == '"') && $this->string($str)) {
3612
+ $content[] = $str;
3613
+ continue;
3614
+ }
3615
+
3616
+ if ($tok == "#{" && $this->interpolation($inter)) {
3617
+ $content[] = $inter;
3618
+ continue;
3619
+ }
3620
+
3621
+ $content[] = $tok;
3622
+ $this->count+= strlen($tok);
3623
+ }
3624
+
3625
+ $this->eatWhiteDefault = $oldWhite;
3626
+
3627
+ if (count($content) == 0) return false;
3628
+
3629
+ // trim the end
3630
+ if (is_string(end($content))) {
3631
+ $content[count($content) - 1] = rtrim(end($content));
3632
+ }
3633
+
3634
+ $out = array("string", "", $content);
3635
+ return true;
3636
+ }
3637
+
3638
+ // $lookWhite: save information about whitespace before and after
3639
+ protected function interpolation(&$out, $lookWhite=true) {
3640
+ $oldWhite = $this->eatWhiteDefault;
3641
+ $this->eatWhiteDefault = true;
3642
+
3643
+ $s = $this->seek();
3644
+ if ($this->literal("#{") && $this->valueList($value) && $this->literal("}", false)) {
3645
+
3646
+ // TODO: don't error if out of bounds
3647
+
3648
+ if ($lookWhite) {
3649
+ $left = preg_match('/\s/', $this->buffer[$s - 1]) ? " " : "";
3650
+ $right = preg_match('/\s/', $this->buffer[$this->count]) ? " ": "";
3651
+ } else {
3652
+ $left = $right = false;
3653
+ }
3654
+
3655
+ $out = array("interpolate", $value, $left, $right);
3656
+ $this->eatWhiteDefault = $oldWhite;
3657
+ if ($this->eatWhiteDefault) $this->whitespace();
3658
+ return true;
3659
+ }
3660
+
3661
+ $this->seek($s);
3662
+ $this->eatWhiteDefault = $oldWhite;
3663
+ return false;
3664
+ }
3665
+
3666
+ // low level parsers
3667
+
3668
+ // returns an array of parts or a string
3669
+ protected function propertyName(&$out) {
3670
+ $s = $this->seek();
3671
+ $parts = array();
3672
+
3673
+ $oldWhite = $this->eatWhiteDefault;
3674
+ $this->eatWhiteDefault = false;
3675
+
3676
+ while (true) {
3677
+ if ($this->interpolation($inter)) {
3678
+ $parts[] = $inter;
3679
+ } elseif ($this->keyword($text)) {
3680
+ $parts[] = $text;
3681
+ } elseif (count($parts) == 0 && $this->match('[:.#]', $m, false)) {
3682
+ // css hacks
3683
+ $parts[] = $m[0];
3684
+ } else {
3685
+ break;
3686
+ }
3687
+ }
3688
+
3689
+ $this->eatWhiteDefault = $oldWhite;
3690
+ if (count($parts) == 0) return false;
3691
+
3692
+ // match comment hack
3693
+ if (preg_match(self::$whitePattern,
3694
+ $this->buffer, $m, null, $this->count))
3695
+ {
3696
+ if (!empty($m[0])) {
3697
+ $parts[] = $m[0];
3698
+ $this->count += strlen($m[0]);
3699
+ }
3700
+ }
3701
+
3702
+ $this->whitespace(); // get any extra whitespace
3703
+
3704
+ $out = array("string", "", $parts);
3705
+ return true;
3706
+ }
3707
+
3708
+ // comma separated list of selectors
3709
+ protected function selectors(&$out) {
3710
+ $s = $this->seek();
3711
+ $selectors = array();
3712
+ while ($this->selector($sel)) {
3713
+ $selectors[] = $sel;
3714
+ if (!$this->literal(",")) break;
3715
+ while ($this->literal(",")); // ignore extra
3716
+ }
3717
+
3718
+ if (count($selectors) == 0) {
3719
+ $this->seek($s);
3720
+ return false;
3721
+ }
3722
+
3723
+ $out = $selectors;
3724
+ return true;
3725
+ }
3726
+
3727
+ // whitespace separated list of selectorSingle
3728
+ protected function selector(&$out) {
3729
+ $selector = array();
3730
+
3731
+ while (true) {
3732
+ if ($this->match('[>+~]+', $m)) {
3733
+ $selector[] = array($m[0]);
3734
+ } elseif ($this->selectorSingle($part)) {
3735
+ $selector[] = $part;
3736
+ $this->whitespace();
3737
+ } elseif ($this->match('\/[^\/]+\/', $m)) {
3738
+ $selector[] = array($m[0]);
3739
+ } else {
3740
+ break;
3741
+ }
3742
+
3743
+ }
3744
+
3745
+ if (count($selector) == 0) {
3746
+ return false;
3747
+ }
3748
+
3749
+ $out = $selector;
3750
+ return true;
3751
+ }
3752
+
3753
+ // the parts that make up
3754
+ // div[yes=no]#something.hello.world:nth-child(-2n+1)%placeholder
3755
+ protected function selectorSingle(&$out) {
3756
+ $oldWhite = $this->eatWhiteDefault;
3757
+ $this->eatWhiteDefault = false;
3758
+
3759
+ $parts = array();
3760
+
3761
+ if ($this->literal("*", false)) {
3762
+ $parts[] = "*";
3763
+ }
3764
+
3765
+ while (true) {
3766
+ // see if we can stop early
3767
+ if ($this->match("\s*[{,]", $m)) {
3768
+ $this->count--;
3769
+ break;
3770
+ }
3771
+
3772
+ $s = $this->seek();
3773
+ // self
3774
+ if ($this->literal("&", false)) {
3775
+ $parts[] = scssc::$selfSelector;
3776
+ continue;
3777
+ }
3778
+
3779
+ if ($this->literal(".", false)) {
3780
+ $parts[] = ".";
3781
+ continue;
3782
+ }
3783
+
3784
+ if ($this->literal("|", false)) {
3785
+ $parts[] = "|";
3786
+ continue;
3787
+ }
3788
+
3789
+ // for keyframes
3790
+ if ($this->unit($unit)) {
3791
+ $parts[] = $unit;
3792
+ continue;
3793
+ }
3794
+
3795
+ if ($this->keyword($name)) {
3796
+ $parts[] = $name;
3797
+ continue;
3798
+ }
3799
+
3800
+ if ($this->interpolation($inter)) {
3801
+ $parts[] = $inter;
3802
+ continue;
3803
+ }
3804
+
3805
+ if ($this->literal('%', false) && $this->placeholder($placeholder)) {
3806
+ $parts[] = '%';
3807
+ $parts[] = $placeholder;
3808
+ continue;
3809
+ }
3810
+
3811
+ if ($this->literal("#", false)) {
3812
+ $parts[] = "#";
3813
+ continue;
3814
+ }
3815
+
3816
+ // a pseudo selector
3817
+ if ($this->match("::?", $m) && $this->mixedKeyword($nameParts)) {
3818
+ $parts[] = $m[0];
3819
+ foreach ($nameParts as $sub) {
3820
+ $parts[] = $sub;
3821
+ }
3822
+
3823
+ $ss = $this->seek();
3824
+ if ($this->literal("(") &&
3825
+ ($this->openString(")", $str, "(") || true ) &&
3826
+ $this->literal(")"))
3827
+ {
3828
+ $parts[] = "(";
3829
+ if (!empty($str)) $parts[] = $str;
3830
+ $parts[] = ")";
3831
+ } else {
3832
+ $this->seek($ss);
3833
+ }
3834
+
3835
+ continue;
3836
+ } else {
3837
+ $this->seek($s);
3838
+ }
3839
+
3840
+ // attribute selector
3841
+ // TODO: replace with open string?
3842
+ if ($this->literal("[", false)) {
3843
+ $attrParts = array("[");
3844
+ // keyword, string, operator
3845
+ while (true) {
3846
+ if ($this->literal("]", false)) {
3847
+ $this->count--;
3848
+ break; // get out early
3849
+ }
3850
+
3851
+ if ($this->match('\s+', $m)) {
3852
+ $attrParts[] = " ";
3853
+ continue;
3854
+ }
3855
+ if ($this->string($str)) {
3856
+ $attrParts[] = $str;
3857
+ continue;
3858
+ }
3859
+
3860
+ if ($this->keyword($word)) {
3861
+ $attrParts[] = $word;
3862
+ continue;
3863
+ }
3864
+
3865
+ if ($this->interpolation($inter, false)) {
3866
+ $attrParts[] = $inter;
3867
+ continue;
3868
+ }
3869
+
3870
+ // operator, handles attr namespace too
3871
+ if ($this->match('[|-~\$\*\^=]+', $m)) {
3872
+ $attrParts[] = $m[0];
3873
+ continue;
3874
+ }
3875
+
3876
+ break;
3877
+ }
3878
+
3879
+ if ($this->literal("]", false)) {
3880
+ $attrParts[] = "]";
3881
+ foreach ($attrParts as $part) {
3882
+ $parts[] = $part;
3883
+ }
3884
+ continue;
3885
+ }
3886
+ $this->seek($s);
3887
+ // should just break here?
3888
+ }
3889
+
3890
+ break;
3891
+ }
3892
+
3893
+ $this->eatWhiteDefault = $oldWhite;
3894
+
3895
+ if (count($parts) == 0) return false;
3896
+
3897
+ $out = $parts;
3898
+ return true;
3899
+ }
3900
+
3901
+ protected function variable(&$out) {
3902
+ $s = $this->seek();
3903
+ if ($this->literal("$", false) && $this->keyword($name)) {
3904
+ $out = array("var", $name);
3905
+ return true;
3906
+ }
3907
+ $this->seek($s);
3908
+ return false;
3909
+ }
3910
+
3911
+ protected function keyword(&$word, $eatWhitespace = null) {
3912
+ if ($this->match('([\w_\-\*!"\'\\\\][\w\-_"\'\\\\]*)',
3913
+ $m, $eatWhitespace))
3914
+ {
3915
+ $word = $m[1];
3916
+ return true;
3917
+ }
3918
+ return false;
3919
+ }
3920
+
3921
+ protected function placeholder(&$placeholder) {
3922
+ if ($this->match('([\w\-_]+)', $m)) {
3923
+ $placeholder = $m[1];
3924
+ return true;
3925
+ }
3926
+ return false;
3927
+ }
3928
+
3929
+ // consume an end of statement delimiter
3930
+ protected function end() {
3931
+ if ($this->literal(';')) {
3932
+ return true;
3933
+ } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') {
3934
+ // if there is end of file or a closing block next then we don't need a ;
3935
+ return true;
3936
+ }
3937
+ return false;
3938
+ }
3939
+
3940
+ // advance counter to next occurrence of $what
3941
+ // $until - don't include $what in advance
3942
+ // $allowNewline, if string, will be used as valid char set
3943
+ protected function to($what, &$out, $until = false, $allowNewline = false) {
3944
+ if (is_string($allowNewline)) {
3945
+ $validChars = $allowNewline;
3946
+ } else {
3947
+ $validChars = $allowNewline ? "." : "[^\n]";
3948
+ }
3949
+ if (!$this->match('('.$validChars.'*?)'.$this->preg_quote($what), $m, !$until)) return false;
3950
+ if ($until) $this->count -= strlen($what); // give back $what
3951
+ $out = $m[1];
3952
+ return true;
3953
+ }
3954
+
3955
+ public function throwParseError($msg = "parse error", $count = null) {
3956
+ $count = !isset($count) ? $this->count : $count;
3957
+
3958
+ $line = $this->getLineNo($count);
3959
+
3960
+ if (!empty($this->sourceName)) {
3961
+ $loc = "$this->sourceName on line $line";
3962
+ } else {
3963
+ $loc = "line: $line";
3964
+ }
3965
+
3966
+ if ($this->peek("(.*?)(\n|$)", $m, $count)) {
3967
+ throw new Exception("$msg: failed at `$m[1]` $loc");
3968
+ } else {
3969
+ throw new Exception("$msg: $loc");
3970
+ }
3971
+ }
3972
+
3973
+ public function getLineNo($pos) {
3974
+ return 1 + substr_count(substr($this->buffer, 0, $pos), "\n");
3975
+ }
3976
+
3977
+ /**
3978
+ * Match string looking for either ending delim, escape, or string interpolation
3979
+ *
3980
+ * {@internal This is a workaround for preg_match's 250K string match limit. }}
3981
+ *
3982
+ * @param array $m Matches (passed by reference)
3983
+ * @param string $delim Delimeter
3984
+ *
3985
+ * @return boolean True if match; false otherwise
3986
+ */
3987
+ protected function matchString(&$m, $delim) {
3988
+ $token = null;
3989
+
3990
+ $end = strpos($this->buffer, "\n", $this->count);
3991
+ if ($end === false || $this->buffer[$end - 1] == '\\' || $this->buffer[$end - 2] == '\\' && $this->buffer[$end - 1] == "\r") {
3992
+ $end = strlen($this->buffer);
3993
+ }
3994
+
3995
+ // look for either ending delim, escape, or string interpolation
3996
+ foreach (array('#{', '\\', $delim) as $lookahead) {
3997
+ $pos = strpos($this->buffer, $lookahead, $this->count);
3998
+ if ($pos !== false && $pos < $end) {
3999
+ $end = $pos;
4000
+ $token = $lookahead;
4001
+ }
4002
+ }
4003
+
4004
+ if (!isset($token)) {
4005
+ return false;
4006
+ }
4007
+
4008
+ $match = substr($this->buffer, $this->count, $end - $this->count);
4009
+ $m = array(
4010
+ $match . $token,
4011
+ $match,
4012
+ $token
4013
+ );
4014
+ $this->count = $end + strlen($token);
4015
+
4016
+ return true;
4017
+ }
4018
+
4019
+ // try to match something on head of buffer
4020
+ protected function match($regex, &$out, $eatWhitespace = null) {
4021
+ if (!isset($eatWhitespace)) $eatWhitespace = $this->eatWhiteDefault;
4022
+
4023
+ $r = '/'.$regex.'/Ais';
4024
+ if (preg_match($r, $this->buffer, $out, null, $this->count)) {
4025
+ $this->count += strlen($out[0]);
4026
+ if ($eatWhitespace) $this->whitespace();
4027
+ return true;
4028
+ }
4029
+ return false;
4030
+ }
4031
+
4032
+ // match some whitespace
4033
+ protected function whitespace() {
4034
+ $gotWhite = false;
4035
+ while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) {
4036
+ if ($this->insertComments) {
4037
+ if (isset($m[1]) && empty($this->commentsSeen[$this->count])) {
4038
+ $this->append(array("comment", $m[1]));
4039
+ $this->commentsSeen[$this->count] = true;
4040
+ }
4041
+ }
4042
+ $this->count += strlen($m[0]);
4043
+ $gotWhite = true;
4044
+ }
4045
+ return $gotWhite;
4046
+ }
4047
+
4048
+ protected function peek($regex, &$out, $from=null) {
4049
+ if (!isset($from)) $from = $this->count;
4050
+
4051
+ $r = '/'.$regex.'/Ais';
4052
+ $result = preg_match($r, $this->buffer, $out, null, $from);
4053
+
4054
+ return $result;
4055
+ }
4056
+
4057
+ protected function seek($where = null) {
4058
+ if ($where === null) return $this->count;
4059
+ else $this->count = $where;
4060
+ return true;
4061
+ }
4062
+
4063
+ static function preg_quote($what) {
4064
+ return preg_quote($what, '/');
4065
+ }
4066
+
4067
+ protected function show() {
4068
+ if ($this->peek("(.*?)(\n|$)", $m, $this->count)) {
4069
+ return $m[1];
4070
+ }
4071
+ return "";
4072
+ }
4073
+
4074
+ // turn list of length 1 into value type
4075
+ protected function flattenList($value) {
4076
+ if ($value[0] == "list" && count($value[2]) == 1) {
4077
+ return $this->flattenList($value[2][0]);
4078
+ }
4079
+ return $value;
4080
+ }
4081
+ }
4082
+
4083
+ /**
4084
+ * SCSS base formatter
4085
+ *
4086
+ * @author Leaf Corcoran <leafot@gmail.com>
4087
+ */
4088
+ class scss_formatter {
4089
+ public $indentChar = " ";
4090
+
4091
+ public $break = "\n";
4092
+ public $open = " {";
4093
+ public $close = "}";
4094
+ public $tagSeparator = ", ";
4095
+ public $assignSeparator = ": ";
4096
+
4097
+ public function __construct() {
4098
+ $this->indentLevel = 0;
4099
+ }
4100
+
4101
+ public function indentStr($n = 0) {
4102
+ return str_repeat($this->indentChar, max($this->indentLevel + $n, 0));
4103
+ }
4104
+
4105
+ public function property($name, $value) {
4106
+ return $name . $this->assignSeparator . $value . ";";
4107
+ }
4108
+
4109
+ protected function block($block) {
4110
+ if (empty($block->lines) && empty($block->children)) return;
4111
+
4112
+ $inner = $pre = $this->indentStr();
4113
+
4114
+ if (!empty($block->selectors)) {
4115
+ echo $pre .
4116
+ implode($this->tagSeparator, $block->selectors) .
4117
+ $this->open . $this->break;
4118
+ $this->indentLevel++;
4119
+ $inner = $this->indentStr();
4120
+ }
4121
+
4122
+ if (!empty($block->lines)) {
4123
+ $glue = $this->break.$inner;
4124
+ echo $inner . implode($glue, $block->lines);
4125
+ if (!empty($block->children)) {
4126
+ echo $this->break;
4127
+ }
4128
+ }
4129
+
4130
+ foreach ($block->children as $child) {
4131
+ $this->block($child);
4132
+ }
4133
+
4134
+ if (!empty($block->selectors)) {
4135
+ $this->indentLevel--;
4136
+ if (empty($block->children)) echo $this->break;
4137
+ echo $pre . $this->close . $this->break;
4138
+ }
4139
+ }
4140
+
4141
+ public function format($block) {
4142
+ ob_start();
4143
+ $this->block($block);
4144
+ $out = ob_get_clean();
4145
+
4146
+ return $out;
4147
+ }
4148
+ }
4149
+
4150
+ /**
4151
+ * SCSS nested formatter
4152
+ *
4153
+ * @author Leaf Corcoran <leafot@gmail.com>
4154
+ */
4155
+ class scss_formatter_nested extends scss_formatter {
4156
+ public $close = " }";
4157
+
4158
+ // adjust the depths of all children, depth first
4159
+ public function adjustAllChildren($block) {
4160
+ // flatten empty nested blocks
4161
+ $children = array();
4162
+ foreach ($block->children as $i => $child) {
4163
+ if (empty($child->lines) && empty($child->children)) {
4164
+ if (isset($block->children[$i + 1])) {
4165
+ $block->children[$i + 1]->depth = $child->depth;
4166
+ }
4167
+ continue;
4168
+ }
4169
+ $children[] = $child;
4170
+ }
4171
+
4172
+ $count = count($children);
4173
+ for ($i = 0; $i < $count; $i++) {
4174
+ $depth = $children[$i]->depth;
4175
+ $j = $i + 1;
4176
+ if (isset($children[$j]) && $depth < $children[$j]->depth) {
4177
+ $childDepth = $children[$j]->depth;
4178
+ for (; $j < $count; $j++) {
4179
+ if ($depth < $children[$j]->depth && $childDepth >= $children[$j]->depth) {
4180
+ $children[$j]->depth = $depth + 1;
4181
+ }
4182
+ }
4183
+ }
4184
+ }
4185
+
4186
+ $block->children = $children;
4187
+
4188
+ // make relative to parent
4189
+ foreach ($block->children as $child) {
4190
+ $this->adjustAllChildren($child);
4191
+ $child->depth = $child->depth - $block->depth;
4192
+ }
4193
+ }
4194
+
4195
+ protected function block($block) {
4196
+ if ($block->type == "root") {
4197
+ $this->adjustAllChildren($block);
4198
+ }
4199
+
4200
+ $inner = $pre = $this->indentStr($block->depth - 1);
4201
+ if (!empty($block->selectors)) {
4202
+ echo $pre .
4203
+ implode($this->tagSeparator, $block->selectors) .
4204
+ $this->open . $this->break;
4205
+ $this->indentLevel++;
4206
+ $inner = $this->indentStr($block->depth - 1);
4207
+ }
4208
+
4209
+ if (!empty($block->lines)) {
4210
+ $glue = $this->break.$inner;
4211
+ echo $inner . implode($glue, $block->lines);
4212
+ if (!empty($block->children)) echo $this->break;
4213
+ }
4214
+
4215
+ foreach ($block->children as $i => $child) {
4216
+ // echo "*** block: ".$block->depth." child: ".$child->depth."\n";
4217
+ $this->block($child);
4218
+ if ($i < count($block->children) - 1) {
4219
+ echo $this->break;
4220
+
4221
+ if (isset($block->children[$i + 1])) {
4222
+ $next = $block->children[$i + 1];
4223
+ if ($next->depth == max($block->depth, 1) && $child->depth >= $next->depth) {
4224
+ echo $this->break;
4225
+ }
4226
+ }
4227
+ }
4228
+ }
4229
+
4230
+ if (!empty($block->selectors)) {
4231
+ $this->indentLevel--;
4232
+ echo $this->close;
4233
+ }
4234
+
4235
+ if ($block->type == "root") {
4236
+ echo $this->break;
4237
+ }
4238
+ }
4239
+ }
4240
+
4241
+ /**
4242
+ * SCSS compressed formatter
4243
+ *
4244
+ * @author Leaf Corcoran <leafot@gmail.com>
4245
+ */
4246
+ class scss_formatter_compressed extends scss_formatter {
4247
+ public $open = "{";
4248
+ public $tagSeparator = ",";
4249
+ public $assignSeparator = ":";
4250
+ public $break = "";
4251
+
4252
+ public function indentStr($n = 0) {
4253
+ return "";
4254
+ }
4255
+ }
4256
+
4257
+ /**
4258
+ * SCSS server
4259
+ *
4260
+ * @author Leaf Corcoran <leafot@gmail.com>
4261
+ */
4262
+ class scss_server {
4263
+ /**
4264
+ * Join path components
4265
+ *
4266
+ * @param string $left Path component, left of the directory separator
4267
+ * @param string $right Path component, right of the directory separator
4268
+ *
4269
+ * @return string
4270
+ */
4271
+ protected function join($left, $right) {
4272
+ return rtrim($left, '/\\') . DIRECTORY_SEPARATOR . ltrim($right, '/\\');
4273
+ }
4274
+
4275
+ /**
4276
+ * Get name of requested .scss file
4277
+ *
4278
+ * @return string|null
4279
+ */
4280
+ protected function inputName() {
4281
+ switch (true) {
4282
+ case isset($_GET['p']):
4283
+ return $_GET['p'];
4284
+ case isset($_SERVER['PATH_INFO']):
4285
+ return $_SERVER['PATH_INFO'];
4286
+ case isset($_SERVER['DOCUMENT_URI']):
4287
+ return substr($_SERVER['DOCUMENT_URI'], strlen($_SERVER['SCRIPT_NAME']));
4288
+ }
4289
+ }
4290
+
4291
+ /**
4292
+ * Get path to requested .scss file
4293
+ *
4294
+ * @return string
4295
+ */
4296
+ protected function findInput() {
4297
+ if (($input = $this->inputName())
4298
+ && strpos($input, '..') === false
4299
+ && substr($input, -5) === '.scss'
4300
+ ) {
4301
+ $name = $this->join($this->dir, $input);
4302
+
4303
+ if (is_file($name) && is_readable($name)) {
4304
+ return $name;
4305
+ }
4306
+ }
4307
+
4308
+ return false;
4309
+ }
4310
+
4311
+ /**
4312
+ * Get path to cached .css file
4313
+ *
4314
+ * @return string
4315
+ */
4316
+ protected function cacheName($fname) {
4317
+ return $this->join($this->cacheDir, md5($fname) . '.css');
4318
+ }
4319
+
4320
+ /**
4321
+ * Get path to cached imports
4322
+ *
4323
+ * @return string
4324
+ */
4325
+ protected function importsCacheName($out) {
4326
+ return $out . '.imports';
4327
+ }
4328
+
4329
+ /**
4330
+ * Determine whether .scss file needs to be re-compiled.
4331
+ *
4332
+ * @param string $in Input path
4333
+ * @param string $out Output path
4334
+ *
4335
+ * @return boolean True if compile required.
4336
+ */
4337
+ protected function needsCompile($in, $out) {
4338
+ if (!is_file($out)) return true;
4339
+
4340
+ $mtime = filemtime($out);
4341
+ if (filemtime($in) > $mtime) return true;
4342
+
4343
+ // look for modified imports
4344
+ $icache = $this->importsCacheName($out);
4345
+ if (is_readable($icache)) {
4346
+ $imports = unserialize(file_get_contents($icache));
4347
+ foreach ($imports as $import) {
4348
+ if (filemtime($import) > $mtime) return true;
4349
+ }
4350
+ }
4351
+ return false;
4352
+ }
4353
+
4354
+ /**
4355
+ * Compile .scss file
4356
+ *
4357
+ * @param string $in Input path (.scss)
4358
+ * @param string $out Output path (.css)
4359
+ *
4360
+ * @return string
4361
+ */
4362
+ protected function compile($in, $out) {
4363
+ $start = microtime(true);
4364
+ $css = $this->scss->compile(file_get_contents($in), $in);
4365
+ $elapsed = round((microtime(true) - $start), 4);
4366
+
4367
+ $v = scssc::$VERSION;
4368
+ $t = date('r');
4369
+ $css = "/* compiled by scssphp $v on $t (${elapsed}s) */\n\n" . $css;
4370
+
4371
+ file_put_contents($out, $css);
4372
+ file_put_contents($this->importsCacheName($out),
4373
+ serialize($this->scss->getParsedFiles()));
4374
+ return $css;
4375
+ }
4376
+
4377
+ /**
4378
+ * Compile requested scss and serve css. Outputs HTTP response.
4379
+ *
4380
+ * @param string $salt Prefix a string to the filename for creating the cache name hash
4381
+ */
4382
+ public function serve($salt = '') {
4383
+ if ($input = $this->findInput()) {
4384
+ $output = $this->cacheName($salt . $input);
4385
+ header('Content-type: text/css');
4386
+
4387
+ if ($this->needsCompile($input, $output)) {
4388
+ try {
4389
+ echo $this->compile($input, $output);
4390
+ } catch (Exception $e) {
4391
+ header('HTTP/1.1 500 Internal Server Error');
4392
+ echo 'Parse error: ' . $e->getMessage() . "\n";
4393
+ }
4394
+ } else {
4395
+ header('X-SCSS-Cache: true');
4396
+ echo file_get_contents($output);
4397
+ }
4398
+
4399
+ return;
4400
+ }
4401
+
4402
+ header('HTTP/1.0 404 Not Found');
4403
+ header('Content-type: text');
4404
+ $v = scssc::$VERSION;
4405
+ echo "/* INPUT NOT FOUND scss $v */\n";
4406
+ }
4407
+
4408
+ /**
4409
+ * Constructor
4410
+ *
4411
+ * @param string $dir Root directory to .scss files
4412
+ * @param string $cacheDir Cache directory
4413
+ * @param \scssc|null $scss SCSS compiler instance
4414
+ */
4415
+ public function __construct($dir, $cacheDir=null, $scss=null) {
4416
+ $this->dir = $dir;
4417
+
4418
+ if (!isset($cacheDir)) {
4419
+ $cacheDir = $this->join($dir, 'scss_cache');
4420
+ }
4421
+
4422
+ $this->cacheDir = $cacheDir;
4423
+ if (!is_dir($this->cacheDir)) mkdir($this->cacheDir, 0755, true);
4424
+
4425
+ if (!isset($scss)) {
4426
+ $scss = new scssc();
4427
+ $scss->setImportPaths($this->dir);
4428
+ }
4429
+ $this->scss = $scss;
4430
+ }
4431
+
4432
+ /**
4433
+ * Helper method to serve compiled scss
4434
+ *
4435
+ * @param string $path Root path
4436
+ */
4437
+ static public function serveFrom($path) {
4438
+ $server = new self($path);
4439
+ $server->serve();
4440
+ }
4441
+ }
4442
+
4443
+ endif;
classes/settings.class.php ADDED
@@ -0,0 +1,3441 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists( 'Mega_Menu_Settings' ) ) :
8
+
9
+ /**
10
+ * Handles all admin related functionality.
11
+ */
12
+ class Mega_Menu_Settings {
13
+
14
+
15
+ /**
16
+ * All themes (default and custom)
17
+ */
18
+ var $themes = array();
19
+
20
+
21
+ /**
22
+ * Active theme
23
+ */
24
+ var $active_theme = array();
25
+
26
+
27
+ /**
28
+ * Active theme ID
29
+ */
30
+ var $id = "";
31
+
32
+
33
+ /**
34
+ * Constructor
35
+ *
36
+ * @since 1.0
37
+ */
38
+ public function __construct() {
39
+
40
+ add_action( 'admin_post_megamenu_save_theme', array( $this, 'save_theme') );
41
+ add_action( 'admin_post_megamenu_add_theme', array( $this, 'create_theme') );
42
+ add_action( 'admin_post_megamenu_delete_theme', array( $this, 'delete_theme') );
43
+ add_action( 'admin_post_megamenu_revert_theme', array( $this, 'revert_theme') );
44
+ add_action( 'admin_post_megamenu_import_theme', array( $this, 'import_theme') );
45
+ add_action( 'admin_post_megamenu_duplicate_theme', array( $this, 'duplicate_theme') );
46
+
47
+ add_action( 'admin_post_megamenu_add_menu_location', array( $this, 'add_menu_location') );
48
+ add_action( 'admin_post_megamenu_delete_menu_location', array( $this, 'delete_menu_location') );
49
+
50
+ add_action( 'admin_post_megamenu_save_settings', array( $this, 'save_settings') );
51
+ add_action( 'admin_post_megamenu_clear_css_cache', array( $this, 'tools_clear_css_cache') );
52
+ add_action( 'admin_post_megamenu_delete_data', array( $this, 'delete_data') );
53
+
54
+ add_action( 'megamenu_page_theme_editor', array( $this, 'theme_editor_page'));
55
+ add_action( 'megamenu_page_tools', array( $this, 'tools_page'));
56
+ add_action( 'megamenu_page_general_settings', array( $this, 'general_settings_page'));
57
+
58
+ add_action( 'admin_menu', array( $this, 'megamenu_themes_page') );
59
+ add_action( 'megamenu_admin_scripts', array( $this, 'enqueue_scripts' ) );
60
+
61
+ }
62
+
63
+ /**
64
+ *
65
+ * @since 1.4
66
+ */
67
+ public function init() {
68
+
69
+ if ( class_exists( "Mega_Menu_Style_Manager" ) ) {
70
+
71
+ $style_manager = new Mega_Menu_Style_Manager();
72
+
73
+ $this->themes = $style_manager->get_themes();
74
+ $this->id = isset( $_GET['theme'] ) ? $_GET['theme'] : 'default';
75
+ $this->active_theme = $this->themes[$this->id];
76
+
77
+ }
78
+
79
+ }
80
+
81
+ /**
82
+ * Save changes to an exiting theme.
83
+ *
84
+ * @since 1.0
85
+ */
86
+ public function save_theme() {
87
+
88
+ check_admin_referer( 'megamenu_save_theme' );
89
+
90
+ $theme = esc_attr( $_POST['theme_id'] );
91
+
92
+ $saved_themes = get_site_option( "megamenu_themes" );
93
+
94
+ if ( isset( $saved_themes[ $theme ] ) ) {
95
+ unset( $saved_themes[ $theme ] );
96
+ }
97
+
98
+ $submitted_settings = $_POST['settings'];
99
+
100
+ if ( isset( $_POST['checkboxes'] ) ) {
101
+
102
+ foreach ( $_POST['checkboxes'] as $checkbox => $value ) {
103
+
104
+ if ( isset( $submitted_settings[ $checkbox ] ) ) {
105
+
106
+ $submitted_settings[ $checkbox ] = 'on';
107
+
108
+ } else {
109
+
110
+ $submitted_settings[ $checkbox ] = 'off';
111
+
112
+ }
113
+
114
+ }
115
+
116
+ }
117
+
118
+ if ( isset( $submitted_settings['toggle_blocks'] ) ) {
119
+ unset( $submitted_settings['toggle_blocks'] );
120
+ }
121
+
122
+ $saved_themes[ $theme ] = array_map( 'esc_attr', $submitted_settings );
123
+
124
+ update_site_option( "megamenu_themes", $saved_themes );
125
+
126
+ do_action("megamenu_after_theme_save");
127
+
128
+ do_action("megamenu_delete_cache");
129
+
130
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&saved=true" ) );
131
+
132
+ }
133
+
134
+
135
+ /**
136
+ * Add a new menu location.
137
+ *
138
+ * @since 1.8
139
+ */
140
+ public function add_menu_location() {
141
+
142
+ check_admin_referer( 'megamenu_add_menu_location' );
143
+
144
+ $locations = get_option( 'megamenu_locations' );
145
+
146
+ $next_id = $this->get_next_menu_location_id();
147
+
148
+ $new_menu_location_id = "max_mega_menu_" . $next_id;
149
+
150
+ $locations[$new_menu_location_id] = "Max Mega Menu Location " . $next_id;
151
+
152
+ update_option( 'megamenu_locations', $locations );
153
+
154
+ do_action("megamenu_after_add_menu_location");
155
+
156
+ $this->redirect( admin_url( 'admin.php?page=maxmegamenu&add_location=true' ) );
157
+
158
+ }
159
+
160
+
161
+ /**
162
+ * Delete a menu location.
163
+ *
164
+ * @since 1.8
165
+ */
166
+ public function delete_menu_location() {
167
+
168
+ check_admin_referer( 'megamenu_delete_menu_location' );
169
+
170
+ $locations = get_option( 'megamenu_locations' );
171
+
172
+ $location_to_delete = esc_attr( $_GET['location'] );
173
+
174
+ if ( isset( $locations[ $location_to_delete ] ) ) {
175
+ unset( $locations[ $location_to_delete ] );
176
+ update_option( 'megamenu_locations', $locations );
177
+ }
178
+
179
+ do_action("megamenu_after_delete_menu_location");
180
+
181
+ do_action("megamenu_delete_cache");
182
+
183
+ $this->redirect( admin_url( 'admin.php?page=maxmegamenu&delete_location=true' ) );
184
+
185
+ }
186
+
187
+ /**
188
+ * Clear the CSS cache.
189
+ *
190
+ * @since 1.5
191
+ */
192
+ public function tools_clear_css_cache() {
193
+
194
+ check_admin_referer( 'megamenu_clear_css_cache' );
195
+
196
+ do_action( 'megamenu_delete_cache' );
197
+
198
+ $this->redirect( admin_url( 'admin.php?page=maxmegamenu_tools&clear_css_cache=true' ) );
199
+
200
+ }
201
+
202
+
203
+ /**
204
+ * Deletes all Max Mega Menu data from the database
205
+ *
206
+ * @since 1.5
207
+ */
208
+ public function delete_data() {
209
+
210
+ check_admin_referer( 'megamenu_delete_data' );
211
+
212
+ do_action("megamenu_delete_cache");
213
+
214
+ // delete menu settings
215
+ delete_option("megamenu_settings");
216
+
217
+ // delete menu locations
218
+ delete_option("megamenu_locations");
219
+
220
+ // delete all widgets assigned to menus
221
+ $widget_manager = new Mega_Menu_Widget_Manager();
222
+
223
+ if ( $mega_menu_widgets = $widget_manager->get_mega_menu_sidebar_widgets() ) {
224
+
225
+ foreach ( $mega_menu_widgets as $widget_id ) {
226
+
227
+ $widget_manager->delete_widget( $widget_id );
228
+
229
+ }
230
+
231
+ }
232
+
233
+ // delete all mega menu metadata stored against menu items
234
+ delete_metadata( 'post', 0, '_megamenu', '', true );
235
+
236
+ // clear cache
237
+ delete_transient( "megamenu_css" );
238
+
239
+ // delete custom themes
240
+ delete_site_option( "megamenu_themes" );
241
+
242
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_tools&delete_data=true" ) );
243
+
244
+ }
245
+
246
+ /**
247
+ * Save menu general settings.
248
+ *
249
+ * @since 1.0
250
+ */
251
+ public function save_settings() {
252
+
253
+ check_admin_referer( 'megamenu_save_settings' );
254
+
255
+ $submitted_settings = apply_filters( "megamenu_submitted_settings", $_POST['settings'] );
256
+
257
+ $existing_settings = get_option( 'megamenu_settings' );
258
+
259
+ $new_settings = array_merge( (array)$existing_settings, $submitted_settings );
260
+
261
+ update_option( 'megamenu_settings', $new_settings );
262
+
263
+ // update location description
264
+ if ( isset( $_POST['location'] ) && is_array( $_POST['location'] ) ) {
265
+
266
+ $locations = get_option('megamenu_locations');
267
+
268
+ $new_locations = array_merge( (array)$locations, $_POST['location'] );
269
+
270
+ update_option( 'megamenu_locations', $new_locations );
271
+ }
272
+
273
+ do_action("megamenu_after_save_general_settings");
274
+
275
+ do_action("megamenu_delete_cache");
276
+
277
+ $url = isset( $_POST['_wp_http_referer'] ) ? $_POST['_wp_http_referer'] : admin_url( "admin.php?page=maxmegamenu&saved=true" );
278
+
279
+ $this->redirect( $url );
280
+
281
+ }
282
+
283
+
284
+ /**
285
+ * Duplicate an existing theme.
286
+ *
287
+ * @since 1.8
288
+ */
289
+ public function import_theme() {
290
+
291
+ check_admin_referer( 'megamenu_import_theme' );
292
+
293
+ $this->init();
294
+
295
+ $import = json_decode( stripslashes( $_POST['data'] ), true );
296
+
297
+ if ( is_array( $import ) ) {
298
+
299
+ $saved_themes = get_site_option( "megamenu_themes" );
300
+
301
+ $next_id = $this->get_next_theme_id();
302
+
303
+ $import['title'] = $import['title'] . " " . __('(Imported)', 'megamenu');
304
+
305
+ $new_theme_id = "custom_theme_" . $next_id;
306
+
307
+ $saved_themes[ $new_theme_id ] = $import;
308
+
309
+ update_site_option( "megamenu_themes", $saved_themes );
310
+
311
+ do_action("megamenu_after_theme_import");
312
+
313
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_tools&theme_imported=true") );
314
+
315
+ } else {
316
+
317
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_tools&theme_imported=false") );
318
+
319
+ }
320
+
321
+
322
+ }
323
+
324
+ /**
325
+ * Duplicate an existing theme.
326
+ *
327
+ * @since 1.0
328
+ */
329
+ public function duplicate_theme() {
330
+
331
+ check_admin_referer( 'megamenu_duplicate_theme' );
332
+
333
+ $this->init();
334
+
335
+ $theme = esc_attr( $_GET['theme_id'] );
336
+
337
+ $copy = $this->themes[$theme];
338
+
339
+ $saved_themes = get_site_option( "megamenu_themes" );
340
+
341
+ $next_id = $this->get_next_theme_id();
342
+
343
+ $copy['title'] = $copy['title'] . " " . __('Copy', 'megamenu');
344
+
345
+ $new_theme_id = "custom_theme_" . $next_id;
346
+
347
+ $saved_themes[ $new_theme_id ] = $copy;
348
+
349
+ update_site_option( "megamenu_themes", $saved_themes );
350
+
351
+ do_action("megamenu_after_theme_duplicate");
352
+
353
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&duplicated=true") );
354
+
355
+ }
356
+
357
+
358
+ /**
359
+ * Delete a theme
360
+ *
361
+ * @since 1.0
362
+ */
363
+ public function delete_theme() {
364
+
365
+ check_admin_referer( 'megamenu_delete_theme' );
366
+
367
+ $theme = esc_attr( $_GET['theme_id'] );
368
+
369
+ if ( $this->theme_is_being_used_by_location( $theme ) ) {
370
+
371
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&deleted=false") );
372
+ return;
373
+ }
374
+
375
+ $saved_themes = get_site_option( "megamenu_themes" );
376
+
377
+ if ( isset( $saved_themes[$theme] ) ) {
378
+ unset( $saved_themes[$theme] );
379
+ }
380
+
381
+ update_site_option( "megamenu_themes", $saved_themes );
382
+
383
+ do_action("megamenu_after_theme_delete");
384
+
385
+ do_action("megamenu_delete_cache");
386
+
387
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme=default&deleted=true") );
388
+
389
+ }
390
+
391
+
392
+ /**
393
+ * Revert a theme (only available for default themes, you can't revert a custom theme)
394
+ *
395
+ * @since 1.0
396
+ */
397
+ public function revert_theme() {
398
+
399
+ check_admin_referer( 'megamenu_revert_theme' );
400
+
401
+ $theme = esc_attr( $_GET['theme_id'] );
402
+
403
+ $saved_themes = get_site_option( "megamenu_themes" );
404
+
405
+ if ( isset( $saved_themes[$theme] ) ) {
406
+ unset( $saved_themes[$theme] );
407
+ }
408
+
409
+ update_site_option( "megamenu_themes", $saved_themes );
410
+
411
+ do_action("megamenu_after_theme_revert");
412
+
413
+ do_action("megamenu_delete_cache");
414
+
415
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$theme}&reverted=true") );
416
+
417
+ }
418
+
419
+
420
+ /**
421
+ * Create a new custom theme
422
+ *
423
+ * @since 1.0
424
+ */
425
+ public function create_theme() {
426
+
427
+ check_admin_referer( 'megamenu_create_theme' );
428
+
429
+ $this->init();
430
+
431
+ $saved_themes = get_site_option( "megamenu_themes" );
432
+
433
+ $next_id = $this->get_next_theme_id();
434
+
435
+ $new_theme_id = "custom_theme_" . $next_id;
436
+
437
+ $new_theme = $this->themes['default'];
438
+
439
+ $new_theme['title'] = "Custom {$next_id}";
440
+
441
+ $saved_themes[$new_theme_id] = $new_theme;
442
+
443
+ update_site_option( "megamenu_themes", $saved_themes );
444
+
445
+ do_action("megamenu_after_theme_create");
446
+
447
+ $this->redirect( admin_url( "admin.php?page=maxmegamenu_theme_editor&theme={$new_theme_id}&created=true") );
448
+
449
+ }
450
+
451
+
452
+ /**
453
+ * Redirect and exit
454
+ *
455
+ * @since 1.8
456
+ */
457
+ public function redirect( $url ) {
458
+
459
+ wp_redirect( $url );
460
+ exit;
461
+
462
+ }
463
+
464
+
465
+ /**
466
+ * Returns the next available menu location ID
467
+ *
468
+ * @since 1.0
469
+ */
470
+ public function get_next_menu_location_id() {
471
+
472
+ $last_id = 0;
473
+
474
+ if ( $locations = get_option( "megamenu_locations" ) ) {
475
+
476
+ foreach ( $locations as $key => $value ) {
477
+
478
+ if ( strpos( $key, 'max_mega_menu_' ) !== FALSE ) {
479
+
480
+ $parts = explode( "_", $key );
481
+ $menu_id = end( $parts );
482
+
483
+ if ($menu_id > $last_id) {
484
+ $last_id = $menu_id;
485
+ }
486
+
487
+ }
488
+
489
+ }
490
+
491
+ }
492
+
493
+ $next_id = $last_id + 1;
494
+
495
+ return $next_id;
496
+ }
497
+
498
+ /**
499
+ * Returns the next available custom theme ID
500
+ *
501
+ * @since 1.0
502
+ */
503
+ public function get_next_theme_id() {
504
+
505
+ $last_id = 0;
506
+
507
+ if ( $saved_themes = get_site_option( "megamenu_themes" ) ) {
508
+
509
+ foreach ( $saved_themes as $key => $value ) {
510
+
511
+ if ( strpos( $key, 'custom_theme' ) !== FALSE ) {
512
+
513
+ $parts = explode( "_", $key );
514
+ $theme_id = end( $parts );
515
+
516
+ if ($theme_id > $last_id) {
517
+ $last_id = $theme_id;
518
+ }
519
+
520
+ }
521
+
522
+ }
523
+
524
+ }
525
+
526
+ $next_id = $last_id + 1;
527
+
528
+ return $next_id;
529
+ }
530
+
531
+
532
+ /**
533
+ * Checks to see if a certain theme is in use.
534
+ *
535
+ * @since 1.0
536
+ * @param string $theme
537
+ */
538
+ public function theme_is_being_used_by_location( $theme ) {
539
+ $settings = get_option( "megamenu_settings" );
540
+
541
+ if ( ! $settings ) {
542
+ return false;
543
+ }
544
+
545
+ $locations = get_nav_menu_locations();
546
+
547
+ $menus = get_registered_nav_menus();
548
+
549
+
550
+ $theme_in_use_locations = array();
551
+
552
+ if ( count( $locations ) ) {
553
+
554
+ foreach ( $locations as $location => $menu_id ) {
555
+
556
+ if ( has_nav_menu( $location ) && isset( $settings[ $location ]['theme'] ) && $settings[ $location ]['theme'] == $theme ) {
557
+ $theme_in_use_locations[] = isset( $menus[ $location ] ) ? $menus[ $location ] : $location;
558
+ }
559
+
560
+ }
561
+
562
+ if ( count( $theme_in_use_locations ) ) {
563
+ return $theme_in_use_locations;
564
+ }
565
+
566
+ }
567
+
568
+ return false;
569
+ }
570
+
571
+
572
+ /**
573
+ * Adds the "Menu Themes" menu item and page.
574
+ *
575
+ * @since 1.0
576
+ */
577
+ public function megamenu_themes_page() {
578
+
579
+ $page = add_menu_page( __('Max Mega Menu', 'megamenu'), __('Mega Menu', 'megamenu'), 'edit_theme_options', 'maxmegamenu', array($this, 'page') );
580
+
581
+
582
+ $tabs = apply_filters("megamenu_menu_tabs", array(
583
+ 'general_settings' => __("General Settings", "megamenu"),
584
+ 'theme_editor' => __("Menu Themes", "megamenu"),
585
+ 'tools' => __("Tools", "megamenu")
586
+ ));
587
+
588
+ foreach ( $tabs as $key => $title ) {
589
+ if ( $key == 'general_settings') {
590
+ add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, 'edit_theme_options', 'maxmegamenu', array($this, 'page') );
591
+ } else {
592
+ add_submenu_page( 'maxmegamenu', __('Max Mega Menu', 'megamenu') . ' - ' . $title, $title, 'edit_theme_options', 'maxmegamenu_' . $key, array($this, 'page') );
593
+ }
594
+ }
595
+
596
+ }
597
+
598
+
599
+ /**
600
+ * Content for 'Settings' tab
601
+ *
602
+ * @since 1.4
603
+ */
604
+ public function general_settings_page( $saved_settings ) {
605
+
606
+ $all_locations = get_registered_nav_menus();
607
+ $locations = array();
608
+
609
+ if ( count( $all_locations ) ) {
610
+
611
+ $megamenu_locations = array();
612
+
613
+ // reorder locations so custom MMM locations are listed at the bottom
614
+ foreach ( $all_locations as $location => $val ) {
615
+
616
+ if ( strpos( $location, 'max_mega_menu_' ) === FALSE ) {
617
+ $locations[$location] = $val;
618
+ } else {
619
+ $megamenu_locations[$location] = $val;
620
+ }
621
+
622
+ }
623
+
624
+ $locations = array_merge( $locations, $megamenu_locations );
625
+ }
626
+
627
+ $css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs';
628
+ $mobile_second_click = isset( $saved_settings['second_click'] ) ? $saved_settings['second_click'] : 'close';
629
+ $mobile_behaviour = isset( $saved_settings['mobile_behaviour'] ) ? $saved_settings['mobile_behaviour'] : 'standard';
630
+
631
+
632
+ ?>
633
+
634
+ <div class='menu_settings'>
635
+
636
+ <form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
637
+ <input type="hidden" name="action" value="megamenu_save_settings" />
638
+ <?php wp_nonce_field( 'megamenu_save_settings' ); ?>
639
+
640
+ <h3 class='first'><?php _e("General Settings", "megamenu"); ?></h3>
641
+
642
+ <table>
643
+ <tr>
644
+ <td class='mega-name'>
645
+ <?php _e("Click Event Behaviour", "megamenu"); ?>
646
+ <div class='mega-description'>
647
+ <?php _e("Define what should happen when the event is set to 'click'. This also applies to mobiles.", "megamenu"); ?>
648
+ </div>
649
+ </td>
650
+ <td class='mega-value'>
651
+ <select name='settings[second_click]'>
652
+ <option value='close' <?php echo selected( $mobile_second_click == 'close'); ?>><?php _e("First click will open a sub menu, second click will close the sub menu.", "megamenu"); ?></option>
653
+ <option value='go' <?php echo selected( $mobile_second_click == 'go'); ?>><?php _e("First click will open a sub menu, second click will follow the link.", "megamenu"); ?></option>
654
+ <select>
655
+ <div class='mega-description'>
656
+ </div>
657
+ </td>
658
+ </tr>
659
+ <tr>
660
+ <td class='mega-name'>
661
+ <?php _e("Mobile Menu Behaviour", "megamenu"); ?>
662
+ <div class='mega-description'>
663
+ <?php _e("Define the sub menu toggle behaviour for the mobile menu.", "megamenu"); ?>
664
+ </div>
665
+ </td>
666
+ <td class='mega-value'>
667
+ <select name='settings[mobile_behaviour]'>
668
+ <option value='standard' <?php echo selected( $mobile_behaviour == 'standard'); ?>><?php _e("Standard - Open sub menus will remain open until closed by the user.", "megamenu"); ?></option>
669
+ <option value='accordion' <?php echo selected( $mobile_behaviour == 'accordion'); ?>><?php _e("Accordion - Open sub menus will automatically close when another one is opened.", "megamenu"); ?></option>
670
+ <select>
671
+ <div class='mega-description'>
672
+ </div>
673
+ </td>
674
+ </tr>
675
+ <tr>
676
+ <td class='mega-name'>
677
+ <?php _e("CSS Output", "megamenu"); ?>
678
+ <div class='mega-description'>
679
+ </div>
680
+ </td>
681
+ <td class='mega-value'>
682
+ <select name='settings[css]' id='mega_css'>
683
+ <option value='fs' <?php echo selected( $css == 'fs'); ?>><?php _e("Save to filesystem", "megamenu"); ?></option>
684
+ <option value='head' <?php echo selected( $css == 'head'); ?>><?php _e("Output in &lt;head&gt;", "megamenu"); ?></option>
685
+ <option value='disabled' <?php echo selected( $css == 'disabled'); ?>><?php _e("Don't output CSS", "megamenu"); ?></option>
686
+ <select>
687
+ <div class='mega-description'>
688
+ <div class='fs' style='display: <?php echo $css == 'fs' ? 'block' : 'none' ?>'><?php _e("CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued from there.", "megamenu"); ?></div>
689
+ <div class='head' style='display: <?php echo $css == 'head' ? 'block' : 'none' ?>'><?php _e("CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; of the page.", "megamenu"); ?></div>
690
+ <div class='disabled' style='display: <?php echo $css == 'disabled' ? 'block' : 'none' ?>'><?php _e("CSS will not be output, you must enqueue the CSS for the menu manually.", "megamenu"); ?></div>
691
+ </div>
692
+ </td>
693
+ </tr>
694
+ </table>
695
+
696
+ <h3 class='first'><?php _e("Menu Locations", "megamenu"); ?></h3>
697
+
698
+ <table>
699
+ <tr>
700
+ <td class='mega-name'>
701
+ <?php _e("Registered Menu Locations", "megamenu"); ?>
702
+ <div class='mega-description'><?php _e("An overview of the menu locations supported by your theme. You can enable Max Mega Menu and adjust the settings for a specific menu location by going to Appearance > Menus."); ?></div>
703
+ </td>
704
+ <td class='mega-value'>
705
+ <p>
706
+ <?php
707
+ $none = __("Your theme does not natively support menus, but you can add a new menu location using Max Mega Menu and display the menu using the Max Mega Menu widget or shortcode.", "megamenu");
708
+ $one = __("Your theme supports one menu.", "megamenu");
709
+ $some = __("Your theme supports {number} menus.", "megamenu");
710
+
711
+ if ( ! count($locations)) {
712
+ echo $none;
713
+ } else if ( count($locations) == 1) {
714
+ echo $one;
715
+ } else {
716
+ echo str_replace( "{number}", count( $locations ), $some );
717
+ }
718
+
719
+ $add_location_url = esc_url( add_query_arg(
720
+ array(
721
+ 'action'=>'megamenu_add_menu_location'
722
+ ),
723
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_add_menu_location' )
724
+ ) );
725
+ echo " <a href='{$add_location_url}'>" . __("Add another menu location.") . "</a>";
726
+
727
+ ?>
728
+ </p>
729
+
730
+ <?php
731
+
732
+ if ( count ( $locations ) ) {
733
+
734
+ echo "<div class='accordion-container'>";
735
+ echo "<ul class='outer-border'>";
736
+
737
+ foreach ( $locations as $location => $description ) {
738
+
739
+ $menu_id = $this->get_menu_id_for_location( $location );
740
+
741
+ $is_custom_location = strpos( $location, 'max_mega_menu_' ) !== FALSE;
742
+
743
+ ?>
744
+
745
+
746
+ <li class='control-section accordion-section mega-location'>
747
+ <h4 class='accordion-section-title hndle'>
748
+
749
+ <?php echo $description ?>
750
+
751
+ <?php
752
+
753
+ echo "<div class='mega-assigned-menu'>";
754
+ echo __("Menu", "megamenu") . ": ";
755
+
756
+ if ($menu_id) {
757
+ echo "<a href='" . admin_url("nav-menus.php?action=edit&menu={$menu_id}") . "'>" . $this->get_menu_name_for_location( $location ) . "</a>";
758
+ } else {
759
+ echo "<a href='" . admin_url('nav-menus.php?action=locations') . "'>" . __("Assign a menu", "megamenu") . "</a>";
760
+ }
761
+
762
+ echo "</div>";
763
+ ?>
764
+
765
+ </h4>
766
+ <div class='accordion-section-content'>
767
+
768
+ <table>
769
+ <?php if ( $is_custom_location ) : ?>
770
+ <tr>
771
+ <td class='mega-name'>
772
+ <?php _e("Location Description", "megamenu"); ?>
773
+ <div class='mega-description'><?php _e("Change the name of the location.", "megamenu"); ?></div>
774
+ </td>
775
+ <td class='mega-value wide'>
776
+ <input type='text' name='location[<?php echo $location ?>]' value='<?php echo $description; ?>' />
777
+ </td>
778
+ </tr>
779
+ <?php endif; ?>
780
+ </table>
781
+
782
+ <h5><?php _e("Menu Display Options", "megamenu"); ?></h5>
783
+
784
+ <?php if ( ! $is_custom_location ) : ?>
785
+ <p><?php _e("These options are for advanced users only. Your theme should already include the code required to display this menu on your site."); ?>
786
+ <?php endif; ?>
787
+
788
+ <table>
789
+ <tr>
790
+ <td class='mega-name'>
791
+ <?php _e("PHP Function", "megamenu"); ?>
792
+ <div class='mega-description'><?php _e("For use in a theme template (usually header.php)", "megamenu"); ?></div>
793
+ </td>
794
+ <td class='mega-value'>
795
+ <textarea>&lt;?php wp_nav_menu( array( 'theme_location' => '<?php echo $location ?>' ) ); ?&gt;</textarea>
796
+ </td>
797
+ </tr>
798
+ <tr>
799
+ <td class='mega-name'>
800
+ <?php _e("Shortcode", "megamenu"); ?>
801
+ <div class='mega-description'><?php _e("For use in a post or page.", "megamenu"); ?></div>
802
+ </td>
803
+ <td class='mega-value'>
804
+ <textarea>[maxmegamenu location=<?php echo $location ?>]</textarea>
805
+ </td>
806
+ </tr>
807
+ <tr>
808
+ <td class='mega-name'>
809
+ <?php _e("Widget", "megamenu"); ?>
810
+ <div class='mega-description'><?php _e("For use in a widget area.", "megamenu"); ?></div>
811
+ </td>
812
+ <td class='mega-value'>
813
+ <?php _e("Add the 'Max Mega Menu' widget to a widget area.", "megamenu") ?>
814
+ </td>
815
+ </tr>
816
+ </table>
817
+
818
+
819
+ <?php
820
+
821
+ if ( $is_custom_location ) {
822
+
823
+ $delete_location_url = esc_url( add_query_arg(
824
+ array(
825
+ 'action' => 'megamenu_delete_menu_location',
826
+ 'location' => $location
827
+ ),
828
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_delete_menu_location' )
829
+ ) );
830
+
831
+ echo "<a class='confirm mega-delete button button-secondary' href='{$delete_location_url}'>" . __("Delete location") . "</a>";
832
+
833
+ }
834
+
835
+ ?>
836
+
837
+ </div>
838
+ </li>
839
+ <?php
840
+ }
841
+
842
+ echo "</div>";
843
+ echo "</div>";
844
+
845
+ }?>
846
+
847
+ </td>
848
+ </tr>
849
+ </table>
850
+
851
+
852
+
853
+ <?php do_action( "megamenu_general_settings", $saved_settings ); ?>
854
+
855
+ <?php
856
+
857
+ submit_button();
858
+
859
+ ?>
860
+ </form>
861
+ </div>
862
+
863
+ <?php
864
+ }
865
+
866
+
867
+ /**
868
+ * Returns the menu ID for a specified menu location, defaults to 0
869
+ *
870
+ * @since 1.8
871
+ * @param string $location
872
+ */
873
+ private function get_menu_id_for_location( $location ) {
874
+
875
+ $locations = get_nav_menu_locations();
876
+
877
+ $id = isset( $locations[ $location ] ) ? $locations[ $location ] : 0;
878
+
879
+ return $id;
880
+
881
+ }
882
+
883
+ /**
884
+ * Returns the menu name for a specified menu location
885
+ *
886
+ * @since 1.8
887
+ * @param string $location
888
+ */
889
+ private function get_menu_name_for_location( $location ) {
890
+
891
+ $id = $this->get_menu_id_for_location( $location );
892
+
893
+ $menus = wp_get_nav_menus();
894
+
895
+ foreach ( $menus as $menu ) {
896
+ if ( $menu->term_id == $id ) {
897
+ return $menu->name;
898
+ }
899
+ }
900
+
901
+ return false;
902
+ }
903
+
904
+
905
+ /**
906
+ * Content for 'Tools' tab
907
+ *
908
+ * @since 1.4
909
+ */
910
+ public function tools_page( $saved_settings ) {
911
+
912
+ ?>
913
+
914
+ <div class='menu_settings'>
915
+
916
+ <h3 class='first'><?php _e("Tools", "megamenu"); ?></h3>
917
+
918
+ <table>
919
+ <tr>
920
+ <td class='mega-name'>
921
+ <?php _e("Cache", "megamenu"); ?>
922
+ <div class='mega-description'><?php _e("Use this tool to clear the CSS cache.", "megamenu"); ?></div>
923
+ </td>
924
+ <td class='mega-value'>
925
+ <form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
926
+ <?php wp_nonce_field( 'megamenu_clear_css_cache' ); ?>
927
+ <input type="hidden" name="action" value="megamenu_clear_css_cache" />
928
+
929
+ <input type='submit' class='button button-secondary' value='<?php _e("Clear CSS Cache", "megamenu"); ?>' />
930
+ </form>
931
+ </td>
932
+ </tr>
933
+ <tr>
934
+ <td class='mega-name'>
935
+ <?php _e("Plugin Data", "megamenu"); ?>
936
+ <div class='mega-description'><?php _e("Delete all saved Max Mega Menu plugin data from the database. Use with caution!", "megamenu"); ?></div>
937
+ </td>
938
+ <td class='mega-value'>
939
+ <form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
940
+ <?php wp_nonce_field( 'megamenu_delete_data' ); ?>
941
+ <input type="hidden" name="action" value="megamenu_delete_data" />
942
+
943
+ <input type='submit' class='button button-secondary confirm' value='<?php _e("Delete Data", "megamenu"); ?>' />
944
+ </form>
945
+ </td>
946
+ </tr>
947
+ <tr>
948
+ <td class='mega-name'>
949
+ <?php _e("Export Theme", "megamenu"); ?>
950
+ <div class='mega-description'><?php _e("Export a menu theme", "megamenu"); ?></div>
951
+ </td>
952
+ <td class='mega-value'>
953
+ <form method="post" action="<?php admin_url( "admin.php?page=maxmegamenu&tab=tools") ?>">
954
+
955
+ <?php
956
+
957
+ if ( isset( $_POST['theme_export'] ) ) {
958
+
959
+ $style_manager = new Mega_Menu_Style_Manager();
960
+
961
+ $default_theme = $style_manager->get_default_theme();
962
+
963
+ $theme_to_export = $_POST['theme_export'];
964
+
965
+ if ( isset( $this->themes[ $theme_to_export ] ) ) {
966
+
967
+ $theme_to_export = $this->themes[ $theme_to_export ];
968
+
969
+ $diff = array();
970
+
971
+ foreach ( $default_theme as $key => $value ) {
972
+ if ( isset( $theme_to_export[$key] ) && $theme_to_export[$key] != $value) {
973
+ $diff[$key] = $theme_to_export[$key];
974
+ }
975
+ }
976
+ if ( isset( $_POST['json'] ) ) {
977
+
978
+ echo "<p>" . __("Log into the site you wish to import the theme to. Go to Mega Menu > Tools and paste this into the 'Import Theme' text area:") . "</p>";
979
+
980
+ echo "<textarea>" . htmlentities( json_encode( $diff ) ) . "</textarea>";
981
+
982
+ } else {
983
+ $key = strtolower( str_replace(" ", "_", $theme_to_export['title'] ) );
984
+
985
+ $key .= "_" . time();
986
+
987
+ echo "<p>" . __("Paste this code into your themes functions.php file:") . "</p>";
988
+
989
+ echo '<textarea>';
990
+ echo 'function megamenu_add_theme_' . $key . '($themes) {';
991
+ echo "\n" . ' $themes["' . $key .'"] = array(';
992
+
993
+ foreach ($diff as $theme_key => $value) {
994
+ echo "\n '" . $theme_key . "' => '" . $value . "',";
995
+ }
996
+
997
+ echo "\n" . ' );';
998
+ echo "\n" . ' return $themes;';
999
+ echo "\n" . '}';
1000
+ echo "\n" . 'add_filter("megamenu_themes", "megamenu_add_theme_' . $key . '");';
1001
+ echo '</textarea>';
1002
+
1003
+ }
1004
+
1005
+ }
1006
+ } else {
1007
+
1008
+ echo "<select name='theme_export'>";
1009
+ foreach ( $this->themes as $id => $theme ) {
1010
+ echo "<option value='{$id}'>{$theme['title']}</option>";
1011
+ }
1012
+ echo "</select>";
1013
+
1014
+ echo "<h4>" . __("Export Format", "megamenu") . "</h4>";
1015
+ echo "<input value='json' type='radio' name='format'>" . __("JSON - I want to import this theme into another site I'm developing") . "<br />";
1016
+ echo "<input value='php' type='radio' name='format'>" . __("PHP - I want to distribute this Menu Theme in a WordPress Theme I'm developing") . "<br />";
1017
+
1018
+ echo "<input type='submit' name='export' class='button button-secondary' value='" . __("Export Theme", "megamenu") . "' />";
1019
+
1020
+ }
1021
+
1022
+ ?>
1023
+ </form>
1024
+ </td>
1025
+ </tr>
1026
+ <tr>
1027
+ <td class='mega-name'>
1028
+ <?php _e("Import Theme", "megamenu"); ?>
1029
+ <div class='mega-description'><?php _e("Import a menu theme", "megamenu"); ?></div>
1030
+ </td>
1031
+ <td class='mega-value'>
1032
+ <form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
1033
+ <?php wp_nonce_field( 'megamenu_import_theme' ); ?>
1034
+ <input type="hidden" name="action" value="megamenu_import_theme" />
1035
+ <textarea name='data'></textarea>
1036
+ <input type='submit' class='button button-secondary' value='<?php _e("Import Theme", "megamenu"); ?>' />
1037
+ </form>
1038
+ </td>
1039
+ </tr>
1040
+ </table>
1041
+ </div>
1042
+
1043
+ <?php
1044
+ }
1045
+
1046
+
1047
+ /**
1048
+ * Main settings page wrapper.
1049
+ *
1050
+ * @since 1.4
1051
+ */
1052
+ public function page() {
1053
+
1054
+ $tab = isset( $_GET['page'] ) ? substr( $_GET['page'], 12 ) : false;
1055
+
1056
+ // backwards compatibility
1057
+ if ( isset ( $_GET['tab'] ) ) {
1058
+ $tab = $_GET['tab'];
1059
+ }
1060
+
1061
+ if ( ! $tab ) {
1062
+ $tab = 'general_settings';
1063
+ }
1064
+
1065
+ $header_links = apply_filters( "megamenu_header_links", array(
1066
+ 'homepage' => array(
1067
+ 'url' => 'https://www.maxmegamenu.com/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro',
1068
+ 'target' => '_mmmpro',
1069
+ 'text' => __("Homepage", "megamenu"),
1070
+ 'class' => ''
1071
+ ),
1072
+ 'documentation' => array(
1073
+ 'url' => 'https://www.maxmegamenu.com/documentation/getting-started/installation/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro',
1074
+ 'text' => __("Documentation", "megamenu"),
1075
+ 'target' => '_mmmpro',
1076
+ 'class' => ''
1077
+ )
1078
+ ) );
1079
+
1080
+ if ( ! is_plugin_active('megamenu-pro/megamenu-pro.php') ) {
1081
+ $header_links['pro'] = array(
1082
+ 'url' => 'https://www.maxmegamenu.com/upgrade/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro',
1083
+ 'target' => '_mmmpro',
1084
+ 'text' => __("Upgrade to Pro - $19", "megamenu"),
1085
+ 'class' => 'mega-highlight'
1086
+ );
1087
+ }
1088
+
1089
+ $versions = apply_filters( "megamenu_versions", array(
1090
+ 'core' => array(
1091
+ 'version' => MEGAMENU_VERSION,
1092
+ 'text' => __("Core version", "megamenu")
1093
+ ),
1094
+ 'pro' => array(
1095
+ 'version' => "<a href='https://www.maxmegamenu.com/upgrade/?utm_source=free&amp;utm_medium=link&amp;utm_campaign=pro' target='_mmmpro'>not installed</a>",
1096
+ 'text' => __("Pro extension", "megamenu")
1097
+ )
1098
+ ) );
1099
+
1100
+ ?>
1101
+
1102
+ <div class='megamenu_outer_wrap'>
1103
+ <div class='megamenu_header_top'>
1104
+ <ul>
1105
+ <?php
1106
+ foreach ( $header_links as $id => $data ) {
1107
+ echo "<li class='{$data['class']}'><a href='{$data['url']}' target='{$data['target']}'>{$data['text']}";
1108
+ echo "</a>";
1109
+ echo "</li>";
1110
+ }
1111
+ ?>
1112
+ </ul>
1113
+ </div>
1114
+ <div class='megamenu_header'>
1115
+ <div class='megamenu_header_left'>
1116
+ <h2><?php _e("Max Mega Menu", "megamenu"); ?></h2>
1117
+ <div class='version'>
1118
+ <?php
1119
+
1120
+ $total = count( $versions );
1121
+ $count = 0;
1122
+ $separator = ' - ';
1123
+
1124
+ foreach ( $versions as $id => $data ) {
1125
+ echo $data['text'] . ": <b>" . $data['version'] . "</b>";
1126
+
1127
+ $count = $count + 1;
1128
+
1129
+ if ( $total > 0 && $count != $total ) {
1130
+ echo $separator;
1131
+ }
1132
+ }
1133
+ ?>
1134
+ </div>
1135
+ </div>
1136
+ </div>
1137
+ <div class='megamenu_wrap'>
1138
+ <div class='megamenu_right'>
1139
+ <?php $this->print_messages(); ?>
1140
+
1141
+ <?php
1142
+
1143
+ $saved_settings = get_option("megamenu_settings");
1144
+
1145
+ if ( has_action( "megamenu_page_{$tab}" ) ) {
1146
+ do_action( "megamenu_page_{$tab}", $saved_settings );
1147
+ } else {
1148
+ do_action( "megamenu_page_general_settings", $saved_settings );
1149
+ }
1150
+
1151
+ ?>
1152
+ </div>
1153
+ </div>
1154
+
1155
+ <div class='megamenu_left'>
1156
+ <ul>
1157
+ <?php
1158
+
1159
+ $tabs = apply_filters("megamenu_menu_tabs", array(
1160
+ 'general_settings' => __("General Settings", "megamenu"),
1161
+ 'theme_editor' => __("Menu Themes", "megamenu"),
1162
+ 'tools' => __("Tools", "megamenu")
1163
+ ));
1164
+
1165
+ foreach ( $tabs as $key => $title ) {
1166
+ $class = $tab == $key ? 'active' : '';
1167
+
1168
+
1169
+ if ( $key == 'general_settings' ) {
1170
+ $args = array( 'page' => 'maxmegamenu' );
1171
+ } else {
1172
+ $args = array( 'page' => 'maxmegamenu_' . $key );
1173
+ }
1174
+
1175
+ $url = esc_url( add_query_arg( $args, admin_url("admin.php") ) );
1176
+
1177
+ echo "<li><a class='{$class}' href='{$url}'>{$title}</a></li>";
1178
+ }
1179
+
1180
+ ?>
1181
+ </ul>
1182
+ </div>
1183
+
1184
+ </div>
1185
+
1186
+ <?php
1187
+ }
1188
+
1189
+
1190
+ /**
1191
+ * Display messages to the user
1192
+ *
1193
+ * @since 1.0
1194
+ */
1195
+ public function print_messages() {
1196
+
1197
+ $this->init();
1198
+
1199
+ $style_manager = new Mega_Menu_Style_Manager();
1200
+
1201
+ $menu_id = 0;
1202
+
1203
+ $menus = get_registered_nav_menus();
1204
+
1205
+ if ( count( $menus ) ) {
1206
+
1207
+ $locations = get_nav_menu_locations();
1208
+
1209
+ foreach ($menus as $location => $description ) {
1210
+
1211
+ if ( isset( $locations[ $location ] ) ) {
1212
+
1213
+ $menu_id = $locations[ $location ];
1214
+ continue;
1215
+
1216
+ }
1217
+
1218
+ }
1219
+
1220
+ }
1221
+
1222
+ $test = $style_manager->generate_css_for_location( 'test', $this->active_theme, $menu_id );
1223
+
1224
+ if ( is_wp_error( $test ) ) {
1225
+ echo "<p class='fail'>" . $test->get_error_message() . "</p>";
1226
+ }
1227
+
1228
+ if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'false' ) {
1229
+ echo "<p class='fail'>" . __("Failed to delete theme. The theme is in use by a menu.", "megamenu") . "</p>";
1230
+ }
1231
+
1232
+ if ( isset( $_GET['clear_css_cache'] ) && $_GET['clear_css_cache'] == 'true' ) {
1233
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("CSS cache cleared", "megamenu") . "</p>";
1234
+ }
1235
+
1236
+ if ( isset( $_GET['delete_data'] ) && $_GET['delete_data'] == 'true' ) {
1237
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("All plugin data removed", "megamenu") . "</p>";
1238
+ }
1239
+
1240
+ if ( isset( $_GET['deleted'] ) && $_GET['deleted'] == 'true' ) {
1241
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Theme Deleted", "megamenu") . "</p>";
1242
+ }
1243
+
1244
+ if ( isset( $_GET['duplicated'] ) ) {
1245
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Theme Duplicated", "megamenu") . "</p>";
1246
+ }
1247
+
1248
+ if ( isset( $_GET['saved'] ) ) {
1249
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Changes Saved", "megamenu") . "</p>";
1250
+ }
1251
+
1252
+ if ( isset( $_GET['reverted'] ) ) {
1253
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Theme Reverted", "megamenu") . "</p>";
1254
+ }
1255
+
1256
+ if ( isset( $_GET['created'] ) ) {
1257
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("New Theme Created", "megamenu") . "</p>";
1258
+ }
1259
+
1260
+ if ( isset( $_GET['add_location'] ) ) {
1261
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("New Menu Location Created", "megamenu") . "</p>";
1262
+ }
1263
+
1264
+ if ( isset( $_GET['delete_location'] ) ) {
1265
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Menu Location Deleted", "megamenu") . "</p>";
1266
+ }
1267
+
1268
+ if ( isset( $_GET['theme_imported'] ) && $_GET['theme_imported'] == 'true' ) {
1269
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Theme Imported", "megamenu") . "</p>";
1270
+ }
1271
+
1272
+ if ( isset( $_GET['theme_imported'] ) && $_GET['theme_imported'] == 'false' ) {
1273
+ echo "<p class='fail'>" . __("Theme Import Failed", "megamenu") . "</p>";
1274
+ }
1275
+
1276
+ if ( isset( $_POST['theme_export'] ) ) {
1277
+ echo "<p class='success'><i class='dashicons dashicons-yes'></i>" . __("Theme Exported", "megamenu") . "</p>";
1278
+ }
1279
+
1280
+ do_action("megamenu_print_messages");
1281
+
1282
+ }
1283
+
1284
+
1285
+ /**
1286
+ * Lists the available themes
1287
+ *
1288
+ * @since 1.0
1289
+ */
1290
+ public function theme_selector() {
1291
+
1292
+ $list_items = "<select id='theme_selector'>";
1293
+
1294
+ foreach ( $this->themes as $id => $theme ) {
1295
+
1296
+ $locations = $this->theme_is_being_used_by_location( $id );
1297
+
1298
+ $selected = $id == $this->id ? 'selected=selected' : '';
1299
+
1300
+ $list_items .= "<option {$selected} value='" . admin_url("admin.php?page=maxmegamenu_theme_editor&theme={$id}") . "'>";
1301
+ $list_items .= $theme['title'];
1302
+
1303
+ if ( is_array( $locations ) ) {
1304
+ $list_items .= " (" . implode( ", ", $locations ) . ")";
1305
+ }
1306
+
1307
+ $list_items .= "</option>";
1308
+ }
1309
+
1310
+ return $list_items .= "</select>";
1311
+
1312
+ }
1313
+
1314
+ /**
1315
+ * Checks to see if a given string contains any of the provided search terms
1316
+ *
1317
+ * @param srgin $key
1318
+ * @param array $needles
1319
+ * @since 1.0
1320
+ */
1321
+ private function string_contains( $key, $needles ) {
1322
+
1323
+ foreach ( $needles as $needle ) {
1324
+
1325
+ if ( strpos( $key, $needle ) !== FALSE ) {
1326
+ return true;
1327
+ }
1328
+ }
1329
+
1330
+ return false;
1331
+
1332
+ }
1333
+
1334
+
1335
+ /**
1336
+ * Displays the theme editor form.
1337
+ *
1338
+ * @since 1.0
1339
+ */
1340
+ public function theme_editor_page( $saved_settings ) {
1341
+
1342
+ $this->init();
1343
+
1344
+ $create_url = esc_url( add_query_arg(
1345
+ array(
1346
+ 'action'=>'megamenu_add_theme'
1347
+ ),
1348
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_create_theme' )
1349
+ ) );
1350
+
1351
+ $duplicate_url = esc_url( add_query_arg(
1352
+ array(
1353
+ 'action'=>'megamenu_duplicate_theme',
1354
+ 'theme_id' => $this->id
1355
+ ),
1356
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_duplicate_theme' )
1357
+ ) );
1358
+
1359
+ $delete_url = esc_url( add_query_arg(
1360
+ array(
1361
+ 'action'=>'megamenu_delete_theme',
1362
+ 'theme_id' => $this->id
1363
+ ),
1364
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_delete_theme' )
1365
+ ) );
1366
+
1367
+ $revert_url = esc_url( add_query_arg(
1368
+ array(
1369
+ 'action'=>'megamenu_revert_theme',
1370
+ 'theme_id' => $this->id
1371
+ ),
1372
+ wp_nonce_url( admin_url("admin-post.php"), 'megamenu_revert_theme' )
1373
+ ) );
1374
+
1375
+ ?>
1376
+
1377
+ <div class='menu_settings'>
1378
+
1379
+ <div class='theme_selector'>
1380
+ <?php _e("Select theme to edit", "megamenu"); ?> <?php echo $this->theme_selector(); ?> <?php _e("or", "megamenu"); ?>
1381
+ <a href='<?php echo $create_url ?>'><?php _e("create a new theme", "megamenu"); ?></a> <?php _e("or", "megamenu"); ?>
1382
+ <a href='<?php echo $duplicate_url ?>'><?php _e("duplicate this theme", "megamenu"); ?></a>
1383
+ </div>
1384
+
1385
+ <h3 class='editing_theme'><?php echo __("Editing theme", "megamenu") . ": " . $this->active_theme['title']; ?></h3>
1386
+
1387
+ <form action="<?php echo admin_url('admin-post.php'); ?>" method="post" class="theme_editor">
1388
+ <input type="hidden" name="theme_id" value="<?php echo $this->id; ?>" />
1389
+ <input type="hidden" name="action" value="megamenu_save_theme" />
1390
+ <?php wp_nonce_field( 'megamenu_save_theme' ); ?>
1391
+
1392
+ <?php
1393
+
1394
+ $settings = apply_filters( 'megamenu_theme_editor_settings', array(
1395
+
1396
+ 'general' => array(
1397
+ 'title' => __( "General Theme Settings", "megamenu" ),
1398
+ 'settings' => array(
1399
+ 'title' => array(
1400
+ 'priority' => 10,
1401
+ 'title' => __( "Theme Title", "megamenu" ),
1402
+ 'description' => __( "", "megamenu" ),
1403
+ 'settings' => array(
1404
+ array(
1405
+ 'title' => __( "", "megamenu" ),
1406
+ 'type' => 'freetext',
1407
+ 'key' => 'title'
1408
+ )
1409
+ )
1410
+ ),
1411
+ 'arrow' => array(
1412
+ 'priority' => 20,
1413
+ 'title' => __( "Arrow", "megamenu" ),
1414
+ 'description' => __( "Select the arrow styles.", "megamenu" ),
1415
+ 'settings' => array(
1416
+ array(
1417
+ 'title' => __( "Up", "megamenu" ),
1418
+ 'type' => 'arrow',
1419
+ 'key' => 'arrow_up'
1420
+ ),
1421
+ array(
1422
+ 'title' => __( "Down", "megamenu" ),
1423
+ 'type' => 'arrow',
1424
+ 'key' => 'arrow_down'
1425
+ ),
1426
+ array(
1427
+ 'title' => __( "Left", "megamenu" ),
1428
+ 'type' => 'arrow',
1429
+ 'key' => 'arrow_left'
1430
+ ),
1431
+ array(
1432
+ 'title' => __( "Right", "megamenu" ),
1433
+ 'type' => 'arrow',
1434
+ 'key' => 'arrow_right'
1435
+ )
1436
+ )
1437
+ ),
1438
+ 'line_height' => array(
1439
+ 'priority' => 30,
1440
+ 'title' => __( "Line Height", "megamenu" ),
1441
+ 'description' => __( "Set the general line height to use in the panel contents.", "megamenu" ),
1442
+ 'settings' => array(
1443
+ array(
1444
+ 'title' => __( "", "megamenu" ),
1445
+ 'type' => 'freetext',
1446
+ 'key' => 'line_height'
1447
+ )
1448
+ )
1449
+ ),
1450
+ 'z_index' => array(
1451
+ 'priority' => 40,
1452
+ 'title' => __( "Z Index", "megamenu" ),
1453
+ 'description' => __( "Set the z-index to ensure the panels appear ontop of other content.", "megamenu" ),
1454
+ 'settings' => array(
1455
+ array(
1456
+ 'title' => __( "", "megamenu" ),
1457
+ 'type' => 'freetext',
1458
+ 'key' => 'z_index',
1459
+ 'validation' => 'int'
1460
+ )
1461
+ )
1462
+ ),
1463
+ 'shadow' => array(
1464
+ 'priority' => 50,
1465
+ 'title' => __( "Shadow", "megamenu" ),
1466
+ 'description' => __( "Apply a shadow to mega and flyout menus.", "megamenu" ),
1467
+ 'settings' => array(
1468
+ array(
1469
+ 'title' => __( "Enabled", "megamenu" ),
1470
+ 'type' => 'checkbox',
1471
+ 'key' => 'shadow'
1472
+ ),
1473
+ array(
1474
+ 'title' => __( "Horizontal", "megamenu" ),
1475
+ 'type' => 'freetext',
1476
+ 'key' => 'shadow_horizontal',
1477
+ 'validation' => 'px'
1478
+ ),
1479
+ array(
1480
+ 'title' => __( "Vertical", "megamenu" ),
1481
+ 'type' => 'freetext',
1482
+ 'key' => 'shadow_vertical',
1483
+ 'validation' => 'px'
1484
+ ),
1485
+ array(
1486
+ 'title' => __( "Blur", "megamenu" ),
1487
+ 'type' => 'freetext',
1488
+ 'key' => 'shadow_blur',
1489
+ 'validation' => 'px'
1490
+ ),
1491
+ array(
1492
+ 'title' => __( "Spread", "megamenu" ),
1493
+ 'type' => 'freetext',
1494
+ 'key' => 'shadow_spread',
1495
+ 'validation' => 'px'
1496
+ ),
1497
+ array(
1498
+ 'title' => __( "Color", "megamenu" ),
1499
+ 'type' => 'color',
1500
+ 'key' => 'shadow_color'
1501
+ )
1502
+ )
1503
+ ),
1504
+ 'transitions' => array(
1505
+ 'priority' => 60,
1506
+ 'title' => __( "Hover Transitions", "megamenu" ),
1507
+ 'description' => __( "Apply hover transitions to menu items. Note: Transitions will not apply to gradient backgrounds.", "megamenu" ),
1508
+ 'settings' => array(
1509
+ array(
1510
+ 'title' => __( "Enabled", "megamenu" ),
1511
+ 'type' => 'checkbox',
1512
+ 'key' => 'transitions'
1513
+ )
1514
+ )
1515
+ ),
1516
+ 'resets' => array(
1517
+ 'priority' => 70,
1518
+ 'title' => __( "Reset Widget Styling", "megamenu" ),
1519
+ 'description' => __( "Reset the styling of widgets within the mega menu?", "megamenu" ),
1520
+ 'settings' => array(
1521
+ array(
1522
+ 'title' => __( "Enabled", "megamenu" ),
1523
+ 'type' => 'checkbox',
1524
+ 'key' => 'resets'
1525
+ )
1526
+ )
1527
+ )
1528
+ )
1529
+ ),
1530
+ 'menu_bar' => array(
1531
+ 'title' => __( "Menu Bar", "megamenu" ),
1532
+ 'settings' => array(
1533
+ 'menu_background' => array(
1534
+ 'priority' => 10,
1535
+ 'title' => __( "Menu Background", "megamenu" ),
1536
+ 'description' => __( "The background color for the main menu bar. Set each value to transparent for a 'button' style menu.", "megamenu" ),
1537
+ 'settings' => array(
1538
+ array(
1539
+ 'title' => __( "From", "megamenu" ),
1540
+ 'type' => 'color',
1541
+ 'key' => 'container_background_from'
1542
+ ),
1543
+ array(
1544
+ 'title' => __( "To", "megamenu" ),
1545
+ 'type' => 'color',
1546
+ 'key' => 'container_background_to'
1547
+ )
1548
+ )
1549
+ ),
1550
+ 'menu_padding' => array(
1551
+ 'priority' => 20,
1552
+ 'title' => __( "Menu Padding", "megamenu" ),
1553
+ 'description' => __( "Padding for the main menu bar.", "megamenu" ),
1554
+ 'settings' => array(
1555
+ array(
1556
+ 'title' => __( "Top", "megamenu" ),
1557
+ 'type' => 'freetext',
1558
+ 'key' => 'container_padding_top',
1559
+ 'validation' => 'px'
1560
+ ),
1561
+ array(
1562
+ 'title' => __( "Right", "megamenu" ),
1563
+ 'type' => 'freetext',
1564
+ 'key' => 'container_padding_right',
1565
+ 'validation' => 'px'
1566
+ ),
1567
+ array(
1568
+ 'title' => __( "Bottom", "megamenu" ),
1569
+ 'type' => 'freetext',
1570
+ 'key' => 'container_padding_bottom',
1571
+ 'validation' => 'px'
1572
+ ),
1573
+ array(
1574
+ 'title' => __( "Left", "megamenu" ),
1575
+ 'type' => 'freetext',
1576
+ 'key' => 'container_padding_left',
1577
+ 'validation' => 'px'
1578
+ )
1579
+ )
1580
+ ),
1581
+ 'menu_border_radius' => array(
1582
+ 'priority' => 30,
1583
+ 'title' => __( "Menu Border Radius", "megamenu" ),
1584
+ 'description' => __( "Set a border radius on the main menu bar.", "megamenu" ),
1585
+ 'settings' => array(
1586
+ array(
1587
+ 'title' => __( "Top Left", "megamenu" ),
1588
+ 'type' => 'freetext',
1589
+ 'key' => 'container_border_radius_top_left',
1590
+ 'validation' => 'px'
1591
+ ),
1592
+ array(
1593
+ 'title' => __( "Top Right", "megamenu" ),
1594
+ 'type' => 'freetext',
1595
+ 'key' => 'container_border_radius_top_right',
1596
+ 'validation' => 'px'
1597
+ ),
1598
+ array(
1599
+ 'title' => __( "Bottom Right", "megamenu" ),
1600
+ 'type' => 'freetext',
1601
+ 'key' => 'container_border_radius_bottom_right',
1602
+ 'validation' => 'px'
1603
+ ),
1604
+ array(
1605
+ 'title' => __( "Bottom Left", "megamenu" ),
1606
+ 'type' => 'freetext',
1607
+ 'key' => 'container_border_radius_bottom_left',
1608
+ 'validation' => 'px'
1609
+ )
1610
+ )
1611
+ ),
1612
+ 'menu_item_align' => array(
1613
+ 'priority' => 40,
1614
+ 'title' => __( "Menu Items Align", "megamenu" ),
1615
+ 'description' => __( "Align <i>all</i> menu items to the left (default), centrally or to the right.", "megamenu" ),
1616
+ 'info' => array( __( "This option will apply to all menu items. To align an individual menu item to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'.", "megamenu" ) ),
1617
+ 'settings' => array(
1618
+ array(
1619
+ 'title' => __( "", "megamenu" ),
1620
+ 'type' => 'align',
1621
+ 'key' => 'menu_item_align'
1622
+ )
1623
+ )
1624
+ ),
1625
+ 'top_level_menu_items' => array(
1626
+ 'priority' => 50,
1627
+ 'title' => __( "Top Level Menu Items", "megamenu" ),
1628
+ 'description' => '',
1629
+ ),
1630
+ 'menu_item_background' => array(
1631
+ 'priority' => 60,
1632
+ 'title' => __( "Menu Item Background", "megamenu" ),
1633
+ 'description' => __( "The background color for each top level menu item. Tip: Set these values to transparent if you've already set a background color on the menu bar.", "megamenu" ),
1634
+ 'settings' => array(
1635
+ array(
1636
+ 'title' => __( "From", "megamenu" ),
1637
+ 'type' => 'color',
1638
+ 'key' => 'menu_item_background_from'
1639
+ ),
1640
+ array(
1641
+ 'title' => __( "To", "megamenu" ),
1642
+ 'type' => 'color',
1643
+ 'key' => 'menu_item_background_to'
1644
+ )
1645
+ )
1646
+ ),
1647
+ 'menu_item_background_hover' => array(
1648
+ 'priority' => 70,
1649
+ 'title' => __( "Menu Item Background (Hover)", "megamenu" ),
1650
+ 'description' => __( "The background color for a top level menu item (on hover).", "megamenu" ),
1651
+ 'settings' => array(
1652
+ array(
1653
+ 'title' => __( "From", "megamenu" ),
1654
+ 'type' => 'color',
1655
+ 'key' => 'menu_item_background_hover_from'
1656
+ ),
1657
+ array(
1658
+ 'title' => __( "To", "megamenu" ),
1659
+ 'type' => 'color',
1660
+ 'key' => 'menu_item_background_hover_to'
1661
+ )
1662
+ )
1663
+ ),
1664
+ 'menu_item_spacing' => array(
1665
+ 'priority' => 80,
1666
+ 'title' => __( "Menu Item Spacing", "megamenu" ),
1667
+ 'description' => __( "Define the size of the gap between each top level menu item.", "megamenu" ),
1668
+ 'settings' => array(
1669
+ array(
1670
+ 'title' => __( "", "megamenu" ),
1671
+ 'type' => 'freetext',
1672
+ 'key' => 'menu_item_spacing',
1673
+ 'validation' => 'px'
1674
+ )
1675
+ )
1676
+ ),
1677
+ 'menu_item_height' => array(
1678
+ 'priority' => 90,
1679
+ 'title' => __( "Menu Item Height", "megamenu" ),
1680
+ 'description' => __( "Define the height of each top level menu item. This value, plus the container top and bottom padding values define the overall height of the menu bar.", "megamenu" ),
1681
+ 'settings' => array(
1682
+ array(
1683
+ 'title' => __( "", "megamenu" ),
1684
+ 'type' => 'freetext',
1685
+ 'key' => 'menu_item_link_height',
1686
+ 'validation' => 'px'
1687
+ )
1688
+ )
1689
+ ),
1690
+ 'menu_item_font' => array(
1691
+ 'priority' => 100,
1692
+ 'title' => __( "Font", "megamenu" ),
1693
+ 'description' => __( "The font to use for each top level menu item.", "megamenu" ),
1694
+ 'settings' => array(
1695
+ array(
1696
+ 'title' => __( "Color", "megamenu" ),
1697
+ 'type' => 'color',
1698
+ 'key' => 'menu_item_link_color'
1699
+ ),
1700
+ array(
1701
+ 'title' => __( "Size", "megamenu" ),
1702
+ 'type' => 'freetext',
1703
+ 'key' => 'menu_item_link_font_size',
1704
+ 'validation' => 'px'
1705
+ ),
1706
+ array(
1707
+ 'title' => __( "Family", "megamenu" ),
1708
+ 'type' => 'font',
1709
+ 'key' => 'menu_item_link_font'
1710
+ ),
1711
+ array(
1712
+ 'title' => __( "Transform", "megamenu" ),
1713
+ 'type' => 'transform',
1714
+ 'key' => 'menu_item_link_text_transform'
1715
+ ),
1716
+ array(
1717
+ 'title' => __( "Weight", "megamenu" ),
1718
+ 'type' => 'weight',
1719
+ 'key' => 'menu_item_link_weight'
1720
+ ),
1721
+ array(
1722
+ 'title' => __( "Decoration", "megamenu" ),
1723
+ 'type' => 'decoration',
1724
+ 'key' => 'menu_item_link_text_decoration'
1725
+ ),
1726
+ )
1727
+ ),
1728
+ 'menu_item_font_hover' => array(
1729
+ 'priority' => 110,
1730
+ 'title' => __( "Font (Hover)", "megamenu" ),
1731
+ 'description' => __( "Set the font to use for each top level menu item (on hover).", "megamenu" ),
1732
+ 'settings' => array(
1733
+ array(
1734
+ 'title' => __( "Color", "megamenu" ),
1735
+ 'type' => 'color',
1736
+ 'key' => 'menu_item_link_color_hover'
1737
+ ),
1738
+ array(
1739
+ 'title' => __( "Weight", "megamenu" ),
1740
+ 'type' => 'weight',
1741
+ 'key' => 'menu_item_link_weight_hover'
1742
+ ),
1743
+ array(
1744
+ 'title' => __( "Decoration", "megamenu" ),
1745
+ 'type' => 'decoration',
1746
+ 'key' => 'menu_item_link_text_decoration_hover'
1747
+ ),
1748
+ )
1749
+ ),
1750
+ 'menu_item_padding' => array(
1751
+ 'priority' => 120,
1752
+ 'title' => __( "Menu Item Padding", "megamenu" ),
1753
+ 'description' => __( "Set the padding for each top level menu item.", "megamenu" ),
1754
+ 'settings' => array(
1755
+ array(
1756
+ 'title' => __( "Top", "megamenu" ),
1757
+ 'type' => 'freetext',
1758
+ 'key' => 'menu_item_link_padding_top',
1759
+ 'validation' => 'px'
1760
+ ),
1761
+ array(
1762
+ 'title' => __( "Right", "megamenu" ),
1763
+ 'type' => 'freetext',
1764
+ 'key' => 'menu_item_link_padding_right',
1765
+ 'validation' => 'px'
1766
+ ),
1767
+ array(
1768
+ 'title' => __( "Bottom", "megamenu" ),
1769
+ 'type' => 'freetext',
1770
+ 'key' => 'menu_item_link_padding_bottom',
1771
+ 'validation' => 'px'
1772
+ ),
1773
+ array(
1774
+ 'title' => __( "Left", "megamenu" ),
1775
+ 'type' => 'freetext',
1776
+ 'key' => 'menu_item_link_padding_left',
1777
+ 'validation' => 'px'
1778
+ )
1779
+ )
1780
+ ),
1781
+ 'menu_item_border' => array(
1782
+ 'priority' => 130,
1783
+ 'title' => __( "Menu Item Border", "megamenu" ),
1784
+ 'description' => __( "Set the border to display on each top level menu item.", "megamenu" ),
1785
+ 'settings' => array(
1786
+ array(
1787
+ 'title' => __( "Color", "megamenu" ),
1788
+ 'type' => 'color',
1789
+ 'key' => 'menu_item_border_color'
1790
+ ),
1791
+ array(
1792
+ 'title' => __( "Top", "megamenu" ),
1793
+ 'type' => 'freetext',
1794
+ 'key' => 'menu_item_border_top',
1795
+ 'validation' => 'px'
1796
+ ),
1797
+ array(
1798
+ 'title' => __( "Right", "megamenu" ),
1799
+ 'type' => 'freetext',
1800
+ 'key' => 'menu_item_border_right',
1801
+ 'validation' => 'px'
1802
+ ),
1803
+ array(
1804
+ 'title' => __( "Bottom", "megamenu" ),
1805
+ 'type' => 'freetext',
1806
+ 'key' => 'menu_item_border_bottom',
1807
+ 'validation' => 'px'
1808
+ ),
1809
+ array(
1810
+ 'title' => __( "Left", "megamenu" ),
1811
+ 'type' => 'freetext',
1812
+ 'key' => 'menu_item_border_left',
1813
+ 'validation' => 'px'
1814
+ )
1815
+ )
1816
+ ),
1817
+ 'menu_item_border_hover' => array(
1818
+ 'priority' => 140,
1819
+ 'title' => __( "Menu Item Border (Hover)", "megamenu" ),
1820
+ 'description' => __( "Set the hover border color.", "megamenu" ),
1821
+ 'settings' => array(
1822
+ array(
1823
+ 'title' => __( "Color", "megamenu" ),
1824
+ 'type' => 'color',
1825
+ 'key' => 'menu_item_border_color_hover'
1826
+ )
1827
+ )
1828
+ ),
1829
+ 'menu_item_border_radius' => array(
1830
+ 'priority' => 150,
1831
+ 'title' => __( "Menu Item Border Radius", "megamenu" ),
1832
+ 'description' => __( "Set rounded corners for each top level menu item.", "megamenu" ),
1833
+ 'settings' => array(
1834
+ array(
1835
+ 'title' => __( "Top Left", "megamenu" ),
1836
+ 'type' => 'freetext',
1837
+ 'key' => 'menu_item_link_border_radius_top_left',
1838
+ 'validation' => 'px'
1839
+ ),
1840
+ array(
1841
+ 'title' => __( "Top Right", "megamenu" ),
1842
+ 'type' => 'freetext',
1843
+ 'key' => 'menu_item_link_border_radius_top_right',
1844
+ 'validation' => 'px'
1845
+ ),
1846
+ array(
1847
+ 'title' => __( "Bottom Right", "megamenu" ),
1848
+ 'type' => 'freetext',
1849
+ 'key' => 'menu_item_link_border_radius_bottom_right',
1850
+ 'validation' => 'px'
1851
+ ),
1852
+ array(
1853
+ 'title' => __( "Bottom Left", "megamenu" ),
1854
+ 'type' => 'freetext',
1855
+ 'key' => 'menu_item_link_border_radius_bottom_left',
1856
+ 'validation' => 'px'
1857
+ )
1858
+ )
1859
+ ),
1860
+ 'menu_item_divider' => array(
1861
+ 'priority' => 160,
1862
+ 'title' => __( "Menu Item Divider", "megamenu" ),
1863
+ 'description' => __( "Show a small divider bar between each menu item.", "megamenu" ),
1864
+ 'settings' => array(
1865
+ array(
1866
+ 'title' => __( "Enabled", "megamenu" ),
1867
+ 'type' => 'checkbox',
1868
+ 'key' => 'menu_item_divider'
1869
+ ),
1870
+ array(
1871
+ 'title' => __( "Color", "megamenu" ),
1872
+ 'type' => 'color',
1873
+ 'key' => 'menu_item_divider_color'
1874
+ ),
1875
+ array(
1876
+ 'title' => __( "Glow Opacity", "megamenu" ),
1877
+ 'type' => 'freetext',
1878
+ 'key' => 'menu_item_divider_glow_opacity',
1879
+ 'validation' => 'float'
1880
+ )
1881
+ )
1882
+ ),
1883
+ 'menu_item_highlight' => array(
1884
+ 'priority' => 170,
1885
+ 'title' => __( "Highlight Current Item", "megamenu" ),
1886
+ 'description' => __( "Apply the 'hover' styling to current menu items.", "megamenu" ),
1887
+ 'settings' => array(
1888
+ array(
1889
+ 'title' => __( "Enabled", "megamenu" ),
1890
+ 'type' => 'checkbox',
1891
+ 'key' => 'menu_item_highlight_current'
1892
+ )
1893
+ )
1894
+ )
1895
+ )
1896
+ ),
1897
+ 'mega_panels' => array(
1898
+ 'title' => __( "Mega Menus", "megamenu" ),
1899
+ 'settings' => array(
1900
+ 'panel_background' => array(
1901
+ 'priority' => 10,
1902
+ 'title' => __( "Panel Background", "megamenu" ),
1903
+ 'description' => __( "Set a background color for a whole panel.", "megamenu" ),
1904
+ 'settings' => array(
1905
+ array(
1906
+ 'title' => __( "From", "megamenu" ),
1907
+ 'type' => 'color',
1908
+ 'key' => 'panel_background_from'
1909
+ ),
1910
+ array(
1911
+ 'title' => __( "To", "megamenu" ),
1912
+ 'type' => 'color',
1913
+ 'key' => 'panel_background_to'
1914
+ )
1915
+ )
1916
+ ),
1917
+ 'panel_width' => array(
1918
+ 'priority' => 20,
1919
+ 'title' => __( "Panel Width", "megamenu" ),
1920
+ 'description' => __( "Mega Panel width.", "megamenu" ),
1921
+ 'info' => array(
1922
+ __("A 100% wide panel will only ever be as wide as the menu itself. For a fixed panel width set this to a pixel value.", "megamenu"),
1923
+ __("Advanced: Enter a jQuery selector to synchronize the width and position of the sub menu with existing page element (e.g. body, #container, .page).", "megamenu")
1924
+ ),
1925
+ 'settings' => array(
1926
+ array(
1927
+ 'title' => __( "Outer Width", "megamenu" ),
1928
+ 'type' => 'freetext',
1929
+ 'key' => 'panel_width'
1930
+ ),
1931
+ array(
1932
+ 'title' => __( "Inner Width", "megamenu" ),
1933
+ 'type' => 'freetext',
1934
+ 'key' => 'panel_inner_width'
1935
+ )
1936
+ )
1937
+ ),
1938
+ 'panel_padding' => array(
1939
+ 'priority' => 30,
1940
+ 'title' => __( "Panel Padding", "megamenu" ),
1941
+ 'description' => __( "Set the padding for the whole panel. Set these values 0px if you wish your panel content to go edge-to-edge.", "megamenu" ),
1942
+ 'settings' => array(
1943
+ array(
1944
+ 'title' => __( "Top", "megamenu" ),
1945
+ 'type' => 'freetext',
1946
+ 'key' => 'panel_padding_top',
1947
+ 'validation' => 'px'
1948
+ ),
1949
+ array(
1950
+ 'title' => __( "Right", "megamenu" ),
1951
+ 'type' => 'freetext',
1952
+ 'key' => 'panel_padding_right',
1953
+ 'validation' => 'px'
1954
+ ),
1955
+ array(
1956
+ 'title' => __( "Bottom", "megamenu" ),
1957
+ 'type' => 'freetext',
1958
+ 'key' => 'panel_padding_bottom',
1959
+ 'validation' => 'px'
1960
+ ),
1961
+ array(
1962
+ 'title' => __( "Left", "megamenu" ),
1963
+ 'type' => 'freetext',
1964
+ 'key' => 'panel_padding_left',
1965
+ 'validation' => 'px'
1966
+ )
1967
+ )
1968
+ ),
1969
+ 'panel_border' => array(
1970
+ 'priority' => 40,
1971
+ 'title' => __( "Panel Border", "megamenu" ),
1972
+ 'description' => __( "Set the border to display on the Mega Panel.", "megamenu" ),
1973
+ 'settings' => array(
1974
+ array(
1975
+ 'title' => __( "Color", "megamenu" ),
1976
+ 'type' => 'color',
1977
+ 'key' => 'panel_border_color'
1978
+ ),
1979
+ array(
1980
+ 'title' => __( "Top", "megamenu" ),
1981
+ 'type' => 'freetext',
1982
+ 'key' => 'panel_border_top',
1983
+ 'validation' => 'px'
1984
+ ),
1985
+ array(
1986
+ 'title' => __( "Right", "megamenu" ),
1987
+ 'type' => 'freetext',
1988
+ 'key' => 'panel_border_right',
1989
+ 'validation' => 'px'
1990
+ ),
1991
+ array(
1992
+ 'title' => __( "Bottom", "megamenu" ),
1993
+ 'type' => 'freetext',
1994
+ 'key' => 'panel_border_bottom',
1995
+ 'validation' => 'px'
1996
+ ),
1997
+ array(
1998
+ 'title' => __( "Left", "megamenu" ),
1999
+ 'type' => 'freetext',
2000
+ 'key' => 'panel_border_left',
2001
+ 'validation' => 'px'
2002
+ )
2003
+ )
2004
+ ),
2005
+ 'panel_border_radius' => array(
2006
+ 'priority' => 50,
2007
+ 'title' => __( "Panel Border Radius", "megamenu" ),
2008
+ 'description' => __( "Set rounded corners for the panel.", "megamenu" ),
2009
+ 'settings' => array(
2010
+ array(
2011
+ 'title' => __( "Top Left", "megamenu" ),
2012
+ 'type' => 'freetext',
2013
+ 'key' => 'panel_border_radius_top_left',
2014
+ 'validation' => 'px'
2015
+ ),
2016
+ array(
2017
+ 'title' => __( "Top Right", "megamenu" ),
2018
+ 'type' => 'freetext',
2019
+ 'key' => 'panel_border_radius_top_right',
2020
+ 'validation' => 'px'
2021
+ ),
2022
+ array(
2023
+ 'title' => __( "Bottom Right", "megamenu" ),
2024
+ 'type' => 'freetext',
2025
+ 'key' => 'panel_border_radius_bottom_right',
2026
+ 'validation' => 'px'
2027
+ ),
2028
+ array(
2029
+ 'title' => __( "Bottom Left", "megamenu" ),
2030
+ 'type' => 'freetext',
2031
+ 'key' => 'panel_border_radius_bottom_left',
2032
+ 'validation' => 'px'
2033
+ )
2034
+ )
2035
+ ),
2036
+ 'widget_padding' => array(
2037
+ 'priority' => 60,
2038
+ 'title' => __( "Widget Padding", "megamenu" ),
2039
+ 'description' => __( "Use this to define the spacing between each widget in the panel.", "megamenu" ),
2040
+ 'settings' => array(
2041
+ array(
2042
+ 'title' => __( "Top", "megamenu" ),
2043
+ 'type' => 'freetext',
2044
+ 'key' => 'panel_widget_padding_top',
2045
+ 'validation' => 'px'
2046
+ ),
2047
+ array(
2048
+ 'title' => __( "Right", "megamenu" ),
2049
+ 'type' => 'freetext',
2050
+ 'key' => 'panel_widget_padding_right',
2051
+ 'validation' => 'px'
2052
+ ),
2053
+ array(
2054
+ 'title' => __( "Bottom", "megamenu" ),
2055
+ 'type' => 'freetext',
2056
+ 'key' => 'panel_widget_padding_bottom',
2057
+ 'validation' => 'px'
2058
+ ),
2059
+ array(
2060
+ 'title' => __( "Left", "megamenu" ),
2061
+ 'type' => 'freetext',
2062
+ 'key' => 'panel_widget_padding_left',
2063
+ 'validation' => 'px'
2064
+ )
2065
+ )
2066
+ ),
2067
+ 'widget_heading_font' => array(
2068
+ 'priority' => 70,
2069
+ 'title' => __( "Widget Heading Font", "megamenu" ),
2070
+ 'description' => __( "Set the font to use Widget headers in the mega menu. Tip: set this to the same style as the Second Level Menu Item Header font to keep your styling consistent.", "megamenu" ),
2071
+ 'settings' => array(
2072
+ array(
2073
+ 'title' => __( "Color", "megamenu" ),
2074
+ 'type' => 'color',
2075
+ 'key' => 'panel_header_color'
2076
+ ),
2077
+ array(
2078
+ 'title' => __( "Size", "megamenu" ),
2079
+ 'type' => 'freetext',
2080
+ 'key' => 'panel_header_font_size',
2081
+ 'validation' => 'px'
2082
+ ),
2083
+ array(
2084
+ 'title' => __( "Family", "megamenu" ),
2085
+ 'type' => 'font',
2086
+ 'key' => 'panel_header_font'
2087
+ ),
2088
+ array(
2089
+ 'title' => __( "Transform", "megamenu" ),
2090
+ 'type' => 'transform',
2091
+ 'key' => 'panel_header_text_transform'
2092
+ ),
2093
+ array(
2094
+ 'title' => __( "Weight", "megamenu" ),
2095
+ 'type' => 'weight',
2096
+ 'key' => 'panel_header_font_weight'
2097
+ ),
2098
+ array(
2099
+ 'title' => __( "Decoration", "megamenu" ),
2100
+ 'type' => 'decoration',
2101
+ 'key' => 'panel_header_text_decoration'
2102
+ ),
2103
+ )
2104
+ ),
2105
+ 'widget_content_font' => array(
2106
+ 'priority' => 80,
2107
+ 'title' => __( "Widget Content Font", "megamenu" ),
2108
+ 'description' => __( "Set the font to use for panel contents.", "megamenu" ),
2109
+ 'settings' => array(
2110
+ array(
2111
+ 'title' => __( "Color", "megamenu" ),
2112
+ 'type' => 'color',
2113
+ 'key' => 'panel_font_color'
2114
+ ),
2115
+ array(
2116
+ 'title' => __( "Size", "megamenu" ),
2117
+ 'type' => 'freetext',
2118
+ 'key' => 'panel_font_size',
2119
+ 'validation' => 'px'
2120
+ ),
2121
+ array(
2122
+ 'title' => __( "Family", "megamenu" ),
2123
+ 'type' => 'font',
2124
+ 'key' => 'panel_font_family'
2125
+ )
2126
+ )
2127
+ ),
2128
+ 'widget_heading_padding' => array(
2129
+ 'priority' => 90,
2130
+ 'title' => __( "Widget Heading Padding", "megamenu" ),
2131
+ 'description' => __( "Set the padding for the widget headings.", "megamenu" ),
2132
+ 'settings' => array(
2133
+ array(
2134
+ 'title' => __( "Top", "megamenu" ),
2135
+ 'type' => 'freetext',
2136
+ 'key' => 'panel_header_padding_top',
2137
+ 'validation' => 'px'
2138
+ ),
2139
+ array(
2140
+ 'title' => __( "Right", "megamenu" ),
2141
+ 'type' => 'freetext',
2142
+ 'key' => 'panel_header_padding_right',
2143
+ 'validation' => 'px'
2144
+ ),
2145
+ array(
2146
+ 'title' => __( "Bottom", "megamenu" ),
2147
+ 'type' => 'freetext',
2148
+ 'key' => 'panel_header_padding_bottom',
2149
+ 'validation' => 'px'
2150
+ ),
2151
+ array(
2152
+ 'title' => __( "Left", "megamenu" ),
2153
+ 'type' => 'freetext',
2154
+ 'key' => 'panel_header_padding_left',
2155
+ 'validation' => 'px'
2156
+ )
2157
+ )
2158
+ ),
2159
+ 'widget_heading_margin' => array(
2160
+ 'priority' => 100,
2161
+ 'title' => __( "Widget Heading Margin", "megamenu" ),
2162
+ 'description' => __( "Set the margin for the widget headings.", "megamenu" ),
2163
+ 'settings' => array(
2164
+ array(
2165
+ 'title' => __( "Top", "megamenu" ),
2166
+ 'type' => 'freetext',
2167
+ 'key' => 'panel_header_margin_top',
2168
+ 'validation' => 'px'
2169
+ ),
2170
+ array(
2171
+ 'title' => __( "Right", "megamenu" ),
2172
+ 'type' => 'freetext',
2173
+ 'key' => 'panel_header_margin_right',
2174
+ 'validation' => 'px'
2175
+ ),
2176
+ array(
2177
+ 'title' => __( "Bottom", "megamenu" ),
2178
+ 'type' => 'freetext',
2179
+ 'key' => 'panel_header_margin_bottom',
2180
+ 'validation' => 'px'
2181
+ ),
2182
+ array(
2183
+ 'title' => __( "Left", "megamenu" ),
2184
+ 'type' => 'freetext',
2185
+ 'key' => 'panel_header_margin_left',
2186
+ 'validation' => 'px'
2187
+ )
2188
+ )
2189
+ ),
2190
+ 'widget_header_border' => array(
2191
+ 'priority' => 110,
2192
+ 'title' => __( "Widget Header Border", "megamenu" ),
2193
+ 'description' => __( "Set the border for the widget headings.", "megamenu" ),
2194
+ 'settings' => array(
2195
+ array(
2196
+ 'title' => __( "Color", "megamenu" ),
2197
+ 'type' => 'color',
2198
+ 'key' => 'panel_header_border_color'
2199
+ ),
2200
+ array(
2201
+ 'title' => __( "Top", "megamenu" ),
2202
+ 'type' => 'freetext',
2203
+ 'key' => 'panel_header_border_top',
2204
+ 'validation' => 'px'
2205
+ ),
2206
+ array(
2207
+ 'title' => __( "Right", "megamenu" ),
2208
+ 'type' => 'freetext',
2209
+ 'key' => 'panel_header_border_right',
2210
+ 'validation' => 'px'
2211
+ ),
2212
+ array(
2213
+ 'title' => __( "Bottom", "megamenu" ),
2214
+ 'type' => 'freetext',
2215
+ 'key' => 'panel_header_border_bottom',
2216
+ 'validation' => 'px'
2217
+ ),
2218
+ array(
2219
+ 'title' => __( "Left", "megamenu" ),
2220
+ 'type' => 'freetext',
2221
+ 'key' => 'panel_header_border_left',
2222
+ 'validation' => 'px'
2223
+ )
2224
+ )
2225
+ ),
2226
+ 'second_level_menu_items' => array(
2227
+ 'priority' => 120,
2228
+ 'title' => __( "Second Level Menu Items", "megamenu" ),
2229
+ 'description' => '',
2230
+ ),
2231
+ 'second_level_font' => array(
2232
+ 'priority' => 130,
2233
+ 'title' => __( "Font", "megamenu" ),
2234
+ 'description' => __( "Set the font for second level menu items when they're displayed in a Mega Menu.", "megamenu" ),
2235
+ 'settings' => array(
2236
+ array(
2237
+ 'title' => __( "Color", "megamenu" ),
2238
+ 'type' => 'color',
2239
+ 'key' => 'panel_second_level_font_color'
2240
+ ),
2241
+ array(
2242
+ 'title' => __( "Size", "megamenu" ),
2243
+ 'type' => 'freetext',
2244
+ 'key' => 'panel_second_level_font_size',
2245
+ 'validation' => 'px'
2246
+ ),
2247
+ array(
2248
+ 'title' => __( "Family", "megamenu" ),
2249
+ 'type' => 'font',
2250
+ 'key' => 'panel_second_level_font'
2251
+ ),
2252
+ array(
2253
+ 'title' => __( "Transform", "megamenu" ),
2254
+ 'type' => 'transform',
2255
+ 'key' => 'panel_second_level_text_transform'
2256
+ ),
2257
+ array(
2258
+ 'title' => __( "Weight", "megamenu" ),
2259
+ 'type' => 'weight',
2260
+ 'key' => 'panel_second_level_font_weight'
2261
+ ),
2262
+ array(
2263
+ 'title' => __( "Decoration", "megamenu" ),
2264
+ 'type' => 'decoration',
2265
+ 'key' => 'panel_second_level_text_decoration'
2266
+ ),
2267
+ )
2268
+ ),
2269
+ 'second_level_font_hover' => array(
2270
+ 'priority' => 140,
2271
+ 'title' => __( "Font (Hover)", "megamenu" ),
2272
+ 'description' => __( "Set the font style on hover.", "megamenu" ),
2273
+ 'settings' => array(
2274
+ array(
2275
+ 'title' => __( "Color", "megamenu" ),
2276
+ 'type' => 'color',
2277
+ 'key' => 'panel_second_level_font_color_hover'
2278
+ ),
2279
+ array(
2280
+ 'title' => __( "Weight", "megamenu" ),
2281
+ 'type' => 'weight',
2282
+ 'key' => 'panel_second_level_font_weight_hover'
2283
+ ),
2284
+ array(
2285
+ 'title' => __( "Decoration", "megamenu" ),
2286
+ 'type' => 'decoration',
2287
+ 'key' => 'panel_second_level_text_decoration_hover'
2288
+ ),
2289
+ )
2290
+ ),
2291
+ 'second_level_background_hover' => array(
2292
+ 'priority' => 150,
2293
+ 'title' => __( "Background (Hover)", "megamenu" ),
2294
+ 'description' => __( "Set the background hover color for second level menu items.", "megamenu" ),
2295
+ 'settings' => array(
2296
+ array(
2297
+ 'title' => __( "From", "megamenu" ),
2298
+ 'type' => 'color',
2299
+ 'key' => 'panel_second_level_background_hover_from'
2300
+ ),
2301
+ array(
2302
+ 'title' => __( "To", "megamenu" ),
2303
+ 'type' => 'color',
2304
+ 'key' => 'panel_second_level_background_hover_to'
2305
+ )
2306
+ )
2307
+ ),
2308
+ 'second_level_padding' => array(
2309
+ 'priority' => 160,
2310
+ 'title' => __( "Padding", "megamenu" ),
2311
+ 'description' => __( "Set the padding for the second level menu items.", "megamenu" ),
2312
+ 'settings' => array(
2313
+ array(
2314
+ 'title' => __( "Top", "megamenu" ),
2315
+ 'type' => 'freetext',
2316
+ 'key' => 'panel_second_level_padding_top',
2317
+ 'validation' => 'px'
2318
+ ),
2319
+ array(
2320
+ 'title' => __( "Right", "megamenu" ),
2321
+ 'type' => 'freetext',
2322
+ 'key' => 'panel_second_level_padding_right',
2323
+ 'validation' => 'px'
2324
+ ),
2325
+ array(
2326
+ 'title' => __( "Bottom", "megamenu" ),
2327
+ 'type' => 'freetext',
2328
+ 'key' => 'panel_second_level_padding_bottom',
2329
+ 'validation' => 'px'
2330
+ ),
2331
+ array(
2332
+ 'title' => __( "Left", "megamenu" ),
2333
+ 'type' => 'freetext',
2334
+ 'key' => 'panel_second_level_padding_left',
2335
+ 'validation' => 'px'
2336
+ )
2337
+ )
2338
+ ),
2339
+ 'second_level_margin' => array(
2340
+ 'priority' => 170,
2341
+ 'title' => __( "Margin", "megamenu" ),
2342
+ 'description' => __( "Set the margin for the second level menu items.", "megamenu" ),
2343
+ 'settings' => array(
2344
+ array(
2345
+ 'title' => __( "Top", "megamenu" ),
2346
+ 'type' => 'freetext',
2347
+ 'key' => 'panel_second_level_margin_top',
2348
+ 'validation' => 'px'
2349
+ ),
2350
+ array(
2351
+ 'title' => __( "Right", "megamenu" ),
2352
+ 'type' => 'freetext',
2353
+ 'key' => 'panel_second_level_margin_right',
2354
+ 'validation' => 'px'
2355
+ ),
2356
+ array(
2357
+ 'title' => __( "Bottom", "megamenu" ),
2358
+ 'type' => 'freetext',
2359
+ 'key' => 'panel_second_level_margin_bottom',
2360
+ 'validation' => 'px'
2361
+ ),
2362
+ array(
2363
+ 'title' => __( "Left", "megamenu" ),
2364
+ 'type' => 'freetext',
2365
+ 'key' => 'panel_second_level_margin_left',
2366
+ 'validation' => 'px'
2367
+ )
2368
+ )
2369
+ ),
2370
+ 'second_level_border' => array(
2371
+ 'priority' => 180,
2372
+ 'title' => __( "Border", "megamenu" ),
2373
+ 'description' => __( "Set the border for the second level menu items.", "megamenu" ),
2374
+ 'settings' => array(
2375
+ array(
2376
+ 'title' => __( "Color", "megamenu" ),
2377
+ 'type' => 'color',
2378
+ 'key' => 'panel_second_level_border_color'
2379
+ ),
2380
+ array(
2381
+ 'title' => __( "Top", "megamenu" ),
2382
+ 'type' => 'freetext',
2383
+ 'key' => 'panel_second_level_border_top',
2384
+ 'validation' => 'px'
2385
+ ),
2386
+ array(
2387
+ 'title' => __( "Right", "megamenu" ),
2388
+ 'type' => 'freetext',
2389
+ 'key' => 'panel_second_level_border_right',
2390
+ 'validation' => 'px'
2391
+ ),
2392
+ array(
2393
+ 'title' => __( "Bottom", "megamenu" ),
2394
+ 'type' => 'freetext',
2395
+ 'key' => 'panel_second_level_border_bottom',
2396
+ 'validation' => 'px'
2397
+ ),
2398
+ array(
2399
+ 'title' => __( "Left", "megamenu" ),
2400
+ 'type' => 'freetext',
2401
+ 'key' => 'panel_second_level_border_left',
2402
+ 'validation' => 'px'
2403
+ )
2404
+ )
2405
+ ),
2406
+ 'third_level_menu_items' => array(
2407
+ 'priority' => 190,
2408
+ 'title' => __( "Third Level Menu Items", "megamenu" ),
2409
+ 'description' => '',
2410
+ ),
2411
+ 'third_level_font' => array(
2412
+ 'priority' => 200,
2413
+ 'title' => __( "Font", "megamenu" ),
2414
+ 'description' => __( "Set the font for third level menu items when they're displayed in a Mega Menu.", "megamenu" ),
2415
+ 'settings' => array(
2416
+ array(
2417
+ 'title' => __( "Color", "megamenu" ),
2418
+ 'type' => 'color',
2419
+ 'key' => 'panel_third_level_font_color'
2420
+ ),
2421
+ array(
2422
+ 'title' => __( "Size", "megamenu" ),
2423
+ 'type' => 'freetext',
2424
+ 'key' => 'panel_third_level_font_size',
2425
+ 'validation' => 'px'
2426
+ ),
2427
+ array(
2428
+ 'title' => __( "Family", "megamenu" ),
2429
+ 'type' => 'font',
2430
+ 'key' => 'panel_third_level_font'
2431
+ ),
2432
+ array(
2433
+ 'title' => __( "Transform", "megamenu" ),
2434
+ 'type' => 'transform',
2435
+ 'key' => 'panel_third_level_text_transform'
2436
+ ),
2437
+ array(
2438
+ 'title' => __( "Weight", "megamenu" ),
2439
+ 'type' => 'weight',
2440
+ 'key' => 'panel_third_level_font_weight'
2441
+ ),
2442
+ array(
2443
+ 'title' => __( "Decoration", "megamenu" ),
2444
+ 'type' => 'decoration',
2445
+ 'key' => 'panel_third_level_text_decoration'
2446
+ ),
2447
+ )
2448
+ ),
2449
+ 'third_level_font_hover' => array(
2450
+ 'priority' => 210,
2451
+ 'title' => __( "Font (Hover)", "megamenu" ),
2452
+ 'description' => __( "Set the font style on hover.", "megamenu" ),
2453
+ 'settings' => array(
2454
+ array(
2455
+ 'title' => __( "Color", "megamenu" ),
2456
+ 'type' => 'color',
2457
+ 'key' => 'panel_third_level_font_color_hover'
2458
+ ),
2459
+ array(
2460
+ 'title' => __( "Weight", "megamenu" ),
2461
+ 'type' => 'weight',
2462
+ 'key' => 'panel_third_level_font_weight_hover'
2463
+ ),
2464
+ array(
2465
+ 'title' => __( "Decoration", "megamenu" ),
2466
+ 'type' => 'decoration',
2467
+ 'key' => 'panel_third_level_text_decoration_hover'
2468
+ ),
2469
+ )
2470
+ ),
2471
+ 'third_level_background_hover' => array(
2472
+ 'priority' => 220,
2473
+ 'title' => __( "Background (Hover)", "megamenu" ),
2474
+ 'description' => __( "Set the background hover color for third level menu items.", "megamenu" ),
2475
+ 'settings' => array(
2476
+ array(
2477
+ 'title' => __( "From", "megamenu" ),
2478
+ 'type' => 'color',
2479
+ 'key' => 'panel_third_level_background_hover_from'
2480
+ ),
2481
+ array(
2482
+ 'title' => __( "To", "megamenu" ),
2483
+ 'type' => 'color',
2484
+ 'key' => 'panel_third_level_background_hover_to'
2485
+ )
2486
+ )
2487
+ ),
2488
+ 'third_level_padding' => array(
2489
+ 'priority' => 230,
2490
+ 'title' => __( "Padding", "megamenu" ),
2491
+ 'description' => __( "Set the padding for the third level menu items.", "megamenu" ),
2492
+ 'settings' => array(
2493
+ array(
2494
+ 'title' => __( "Top", "megamenu" ),
2495
+ 'type' => 'freetext',
2496
+ 'key' => 'panel_third_level_padding_top',
2497
+ 'validation' => 'px'
2498
+ ),
2499
+ array(
2500
+ 'title' => __( "Right", "megamenu" ),
2501
+ 'type' => 'freetext',
2502
+ 'key' => 'panel_third_level_padding_right',
2503
+ 'validation' => 'px'
2504
+ ),
2505
+ array(
2506
+ 'title' => __( "Bottom", "megamenu" ),
2507
+ 'type' => 'freetext',
2508
+ 'key' => 'panel_third_level_padding_bottom',
2509
+ 'validation' => 'px'
2510
+ ),
2511
+ array(
2512
+ 'title' => __( "Left", "megamenu" ),
2513
+ 'type' => 'freetext',
2514
+ 'key' => 'panel_third_level_padding_left',
2515
+ 'validation' => 'px'
2516
+ )
2517
+ )
2518
+ )
2519
+ )
2520
+ ),
2521
+ 'flyout_menus' => array(
2522
+ 'title' => __( "Flyout Menus", "megamenu"),
2523
+ 'settings' => array(
2524
+ 'flyout_menu_background' => array(
2525
+ 'priority' => 10,
2526
+ 'title' => __( "Menu Background", "megamenu" ),
2527
+ 'description' => __( "Set the background color for the flyout menu.", "megamenu" ),
2528
+ 'settings' => array(
2529
+ array(
2530
+ 'title' => __( "From", "megamenu" ),
2531
+ 'type' => 'color',
2532
+ 'key' => 'flyout_menu_background_from'
2533
+ ),
2534
+ array(
2535
+ 'title' => __( "To", "megamenu" ),
2536
+ 'type' => 'color',
2537
+ 'key' => 'flyout_menu_background_to'
2538
+ )
2539
+ )
2540
+ ),
2541
+ 'flyout_menu_width' => array(
2542
+ 'priority' => 20,
2543
+ 'title' => __( "Menu Width", "megamenu" ),
2544
+ 'description' => __( "The width of each flyout menu. This must be a fixed pixel value.", "megamenu" ),
2545
+ 'info' => array( __( "Set this value to the width of your longest menu item title to stop menu items wrapping onto 2 lines.", "megamenu" ) ),
2546
+ 'settings' => array(
2547
+ array(
2548
+ 'title' => __( "", "megamenu" ),
2549
+ 'type' => 'freetext',
2550
+ 'key' => 'flyout_width',
2551
+ 'validation' => 'px'
2552
+ )
2553
+ )
2554
+ ),
2555
+ 'flyout_menu_padding' => array(
2556
+ 'priority' => 30,
2557
+ 'title' => __( "Menu Padding", "megamenu" ),
2558
+ 'description' => __( "Set the padding for the whole flyout menu.", "megamenu" ),
2559
+ 'info' => array( __( "Only suitable for single level flyout menus. If you're using multi level flyout menus set these values to 0px.", "megamenu" ) ),
2560
+ 'settings' => array(
2561
+ array(
2562
+ 'title' => __( "Top", "megamenu" ),
2563
+ 'type' => 'freetext',
2564
+ 'key' => 'flyout_padding_top',
2565
+ 'validation' => 'px'
2566
+ ),
2567
+ array(
2568
+ 'title' => __( "Right", "megamenu" ),
2569
+ 'type' => 'freetext',
2570
+ 'key' => 'flyout_padding_right',
2571
+ 'validation' => 'px'
2572
+ ),
2573
+ array(
2574
+ 'title' => __( "Bottom", "megamenu" ),
2575
+ 'type' => 'freetext',
2576
+ 'key' => 'flyout_padding_bottom',
2577
+ 'validation' => 'px'
2578
+ ),
2579
+ array(
2580
+ 'title' => __( "Left", "megamenu" ),
2581
+ 'type' => 'freetext',
2582
+ 'key' => 'flyout_padding_left',
2583
+ 'validation' => 'px'
2584
+ )
2585
+ )
2586
+ ),
2587
+ 'flyout_menu_border' => array(
2588
+ 'priority' => 40,
2589
+ 'title' => __( "Menu Border", "megamenu" ),
2590
+ 'description' => __( "Set the border for the flyout menu.", "megamenu" ),
2591
+ 'settings' => array(
2592
+ array(
2593
+ 'title' => __( "Color", "megamenu" ),
2594
+ 'type' => 'color',
2595
+ 'key' => 'flyout_border_color'
2596
+ ),
2597
+ array(
2598
+ 'title' => __( "Top", "megamenu" ),
2599
+ 'type' => 'freetext',
2600
+ 'key' => 'flyout_border_top',
2601
+ 'validation' => 'px'
2602
+ ),
2603
+ array(
2604
+ 'title' => __( "Right", "megamenu" ),
2605
+ 'type' => 'freetext',
2606
+ 'key' => 'flyout_border_right',
2607
+ 'validation' => 'px'
2608
+ ),
2609
+ array(
2610
+ 'title' => __( "Bottom", "megamenu" ),
2611
+ 'type' => 'freetext',
2612
+ 'key' => 'flyout_border_bottom',
2613
+ 'validation' => 'px'
2614
+ ),
2615
+ array(
2616
+ 'title' => __( "Left", "megamenu" ),
2617
+ 'type' => 'freetext',
2618
+ 'key' => 'flyout_border_left',
2619
+ 'validation' => 'px'
2620
+ )
2621
+ )
2622
+ ),
2623
+ 'flyout_menu_border_radius' => array(
2624
+ 'priority' => 50,
2625
+ 'title' => __( "Menu Border Radius", "megamenu" ),
2626
+ 'description' => __( "Set rounded corners for flyout menus. Rounded corners will be applied to all flyout menu levels.", "megamenu" ),
2627
+ 'settings' => array(
2628
+ array(
2629
+ 'title' => __( "Top Left", "megamenu" ),
2630
+ 'type' => 'freetext',
2631
+ 'key' => 'flyout_border_radius_top_left',
2632
+ 'validation' => 'px'
2633
+ ),
2634
+ array(
2635
+ 'title' => __( "Top Right", "megamenu" ),
2636
+ 'type' => 'freetext',
2637
+ 'key' => 'flyout_border_radius_top_right',
2638
+ 'validation' => 'px'
2639
+ ),
2640
+ array(
2641
+ 'title' => __( "Bottom Right", "megamenu" ),
2642
+ 'type' => 'freetext',
2643
+ 'key' => 'flyout_border_radius_bottom_right',
2644
+ 'validation' => 'px'
2645
+ ),
2646
+ array(
2647
+ 'title' => __( "Bottom Left", "megamenu" ),
2648
+ 'type' => 'freetext',
2649
+ 'key' => 'flyout_border_radius_bottom_left',
2650
+ 'validation' => 'px'
2651
+ )
2652
+ )
2653
+ ),
2654
+ 'flyout_menu_item_background' => array(
2655
+ 'priority' => 60,
2656
+ 'title' => __( "Item Background", "megamenu" ),
2657
+ 'description' => __( "Set the background color for a flyout menu item.", "megamenu" ),
2658
+ 'settings' => array(
2659
+ array(
2660
+ 'title' => __( "From", "megamenu" ),
2661
+ 'type' => 'color',
2662
+ 'key' => 'flyout_background_from'
2663
+ ),
2664
+ array(
2665
+ 'title' => __( "To", "megamenu" ),
2666
+ 'type' => 'color',
2667
+ 'key' => 'flyout_background_to'
2668
+ )
2669
+ )
2670
+ ),
2671
+ 'flyout_menu_item_background_hover' => array(
2672
+ 'priority' => 70,
2673
+ 'title' => __( "Item Background (Hover)", "megamenu" ),
2674
+ 'description' => __( "Set the background color for a flyout menu item (on hover).", "megamenu" ),
2675
+ 'settings' => array(
2676
+ array(
2677
+ 'title' => __( "From", "megamenu" ),
2678
+ 'type' => 'color',
2679
+ 'key' => 'flyout_background_hover_from'
2680
+ ),
2681
+ array(
2682
+ 'title' => __( "To", "megamenu" ),
2683
+ 'type' => 'color',
2684
+ 'key' => 'flyout_background_hover_to'
2685
+ )
2686
+ )
2687
+ ),
2688
+ 'flyout_menu_item_height' => array(
2689
+ 'priority' => 80,
2690
+ 'title' => __( "Item Height", "megamenu" ),
2691
+ 'description' => __( "The height of each flyout menu item.", "megamenu" ),
2692
+ 'settings' => array(
2693
+ array(
2694
+ 'title' => __( "", "megamenu" ),
2695
+ 'type' => 'freetext',
2696
+ 'key' => 'flyout_link_height',
2697
+ 'validation' => 'px'
2698
+ )
2699
+ )
2700
+ ),
2701
+ 'flyout_menu_item_padding' => array(
2702
+ 'priority' => 90,
2703
+ 'title' => __( "Item Padding", "megamenu" ),
2704
+ 'description' => __( "Set the padding for each flyout menu item.", "megamenu" ),
2705
+ 'settings' => array(
2706
+ array(
2707
+ 'title' => __( "Top", "megamenu" ),
2708
+ 'type' => 'freetext',
2709
+ 'key' => 'flyout_link_padding_top',
2710
+ 'validation' => 'px'
2711
+ ),
2712
+ array(
2713
+ 'title' => __( "Right", "megamenu" ),
2714
+ 'type' => 'freetext',
2715
+ 'key' => 'flyout_link_padding_right',
2716
+ 'validation' => 'px'
2717
+ ),
2718
+ array(
2719
+ 'title' => __( "Bottom", "megamenu" ),
2720
+ 'type' => 'freetext',
2721
+ 'key' => 'flyout_link_padding_bottom',
2722
+ 'validation' => 'px'
2723
+ ),
2724
+ array(
2725
+ 'title' => __( "Left", "megamenu" ),
2726
+ 'type' => 'freetext',
2727
+ 'key' => 'flyout_link_padding_left',
2728
+ 'validation' => 'px'
2729
+ )
2730
+ )
2731
+ ),
2732
+ 'flyout_menu_item_font' => array(
2733
+ 'priority' => 100,
2734
+ 'title' => __( "Item Font", "megamenu" ),
2735
+ 'description' => __( "Set the font for the flyout menu items.", "megamenu" ),
2736
+ 'settings' => array(
2737
+ array(
2738
+ 'title' => __( "Color", "megamenu" ),
2739
+ 'type' => 'color',
2740
+ 'key' => 'flyout_link_color'
2741
+ ),
2742
+ array(
2743
+ 'title' => __( "Size", "megamenu" ),
2744
+ 'type' => 'freetext',
2745
+ 'key' => 'flyout_link_size',
2746
+ 'validation' => 'px'
2747
+ ),
2748
+ array(
2749
+ 'title' => __( "Family", "megamenu" ),
2750
+ 'type' => 'font',
2751
+ 'key' => 'flyout_link_family'
2752
+ ),
2753
+ array(
2754
+ 'title' => __( "Transform", "megamenu" ),
2755
+ 'type' => 'transform',
2756
+ 'key' => 'flyout_link_text_transform'
2757
+ ),
2758
+ array(
2759
+ 'title' => __( "Weight", "megamenu" ),
2760
+ 'type' => 'weight',
2761
+ 'key' => 'flyout_link_weight'
2762
+ ),
2763
+ array(
2764
+ 'title' => __( "Decoration", "megamenu" ),
2765
+ 'type' => 'decoration',
2766
+ 'key' => 'flyout_link_text_decoration'
2767
+ ),
2768
+ )
2769
+ ),
2770
+ 'flyout_menu_item_font_hover' => array(
2771
+ 'priority' => 110,
2772
+ 'title' => __( "Item Font (Hover)", "megamenu" ),
2773
+ 'description' => __( "Set the font for the flyout menu items.", "megamenu" ),
2774
+ 'settings' => array(
2775
+ array(
2776
+ 'title' => __( "Color", "megamenu" ),
2777
+ 'type' => 'color',
2778
+ 'key' => 'flyout_link_color_hover'
2779
+ ),
2780
+ array(
2781
+ 'title' => __( "Weight", "megamenu" ),
2782
+ 'type' => 'weight',
2783
+ 'key' => 'flyout_link_weight_hover'
2784
+ ),
2785
+ array(
2786
+ 'title' => __( "Decoration", "megamenu" ),
2787
+ 'type' => 'decoration',
2788
+ 'key' => 'flyout_link_text_decoration_hover'
2789
+ ),
2790
+ )
2791
+ ),
2792
+ 'flyout_menu_item_divider' => array(
2793
+ 'priority' => 120,
2794
+ 'title' => __( "Item Divider", "megamenu" ),
2795
+ 'description' => __( "Show a line divider below each menu item.", "megamenu" ),
2796
+ 'settings' => array(
2797
+ array(
2798
+ 'title' => __( "Enabled", "megamenu" ),
2799
+ 'type' => 'checkbox',
2800
+ 'key' => 'flyout_menu_item_divider'
2801
+ ),
2802
+ array(
2803
+ 'title' => __( "Color", "megamenu" ),
2804
+ 'type' => 'color',
2805
+ 'key' => 'flyout_menu_item_divider_color'
2806
+ )
2807
+ )
2808
+ ),
2809
+ )
2810
+ ),
2811
+ 'mobile_menu' => array(
2812
+ 'title' => __( "Mobile Menu", "megamenu" ),
2813
+ 'settings' => array(
2814
+ 'responsive_breakpoint' => array(
2815
+ 'priority' => 10,
2816
+ 'title' => __( "Responsive Breakpoint", "megamenu" ),
2817
+ 'description' => __( "Set the width at which the menu turns into a mobile menu. Set to 0px to disable responsive menu.", "megamenu" ),
2818
+ 'settings' => array(
2819
+ array(
2820
+ 'title' => __( "", "megamenu" ),
2821
+ 'type' => 'freetext',
2822
+ 'key' => 'responsive_breakpoint',
2823
+ 'validation' => 'px'
2824
+ )
2825
+ ),
2826
+ ),
2827
+ /**'responsive_text' => array(
2828
+ 'title' => __( "Toggle Bar Text", "megamenu" ),
2829
+ 'description' => __( "Text to display next to the mobile toggle icon.", "megamenu" ),
2830
+ 'settings' => array(
2831
+ array(
2832
+ 'title' => __( "", "megamenu" ),
2833
+ 'type' => 'freetext',
2834
+ 'key' => 'responsive_text'
2835
+ )
2836
+ )
2837
+ ),**/
2838
+ /**'toggle_font' => array(
2839
+ 'title' => __( "Toggle Bar Text Color", "megamenu" ),
2840
+ 'description' => __( "Set the font color for the toggle bar.", "megamenu" ),
2841
+ 'settings' => array(
2842
+ array(
2843
+ 'title' => __( "", "megamenu" ),
2844
+ 'type' => 'color',
2845
+ 'key' => 'toggle_font_color'
2846
+ )
2847
+ )
2848
+ ),**/
2849
+ 'toggle_bar_background' => array(
2850
+ 'priority' => 20,
2851
+ 'title' => __( "Toggle Bar Background", "megamenu" ),
2852
+ 'description' => __( "Set the background color for the mobile menu toggle bar.", "megamenu" ),
2853
+ 'settings' => array(
2854
+ array(
2855
+ 'title' => __( "From", "megamenu" ),
2856
+ 'type' => 'color',
2857
+ 'key' => 'toggle_background_from'
2858
+ ),
2859
+ array(
2860
+ 'title' => __( "To", "megamenu" ),
2861
+ 'type' => 'color',
2862
+ 'key' => 'toggle_background_to'
2863
+ )
2864
+ )
2865
+ ),
2866
+ 'mobile_columns' => array(
2867
+ 'priority' => 30,
2868
+ 'title' => __( "Mega Menu Columns", "megamenu" ),
2869
+ 'description' => __( "Number of columns to display widgets/second level menu items in.", "megamenu" ),
2870
+ 'settings' => array(
2871
+ array(
2872
+ 'title' => __( "", "megamenu" ),
2873
+ 'type' => 'mobile_columns',
2874
+ 'key' => 'mobile_columns'
2875
+ )
2876
+ )
2877
+ ),
2878
+ 'mobile_menu_item_height' => array(
2879
+ 'priority' => 40,
2880
+ 'title' => __( "Menu Item Height", "megamenu" ),
2881
+ 'description' => __( "Height of each top level item in the mobile menu.", "megamenu" ),
2882
+ 'settings' => array(
2883
+ array(
2884
+ 'title' => __( "", "megamenu" ),
2885
+ 'type' => 'freetext',
2886
+ 'key' => 'mobile_menu_item_height'
2887
+ )
2888
+ )
2889
+ )
2890
+ )
2891
+ ),
2892
+ 'custom_styling' => array(
2893
+ 'title' => __( "Custom Styling", "megamenu"),
2894
+ 'settings' => array(
2895
+ 'custom_styling' => array(
2896
+ 'priority' => 40,
2897
+ 'title' => __( "CSS Editor", "megamenu" ),
2898
+ 'description' => __( "Define any custom CSS you wish to add to menus using this theme. You can use standard CSS or SCSS.", "megamenu"),
2899
+ 'settings' => array(
2900
+ array(
2901
+ 'title' => __( "", "megamenu" ),
2902
+ 'type' => 'textarea',
2903
+ 'key' => 'custom_css'
2904
+ )
2905
+ )
2906
+ )
2907
+ )
2908
+ )
2909
+ ) );
2910
+
2911
+ echo "<div class='accordion-container'>";
2912
+ echo "<ul class='outer-border'>";
2913
+
2914
+ foreach ( $settings as $section_id => $section ) {
2915
+
2916
+ echo " <li class='control-section accordion-section open mega-{$section_id}'>";
2917
+ echo " <h4 class='accordion-section-title hndle'>".$section['title'] . "</h4>";
2918
+ echo " <div class='accordion-section-content '>";
2919
+ echo " <table class='{$section_id}'>";
2920
+
2921
+ // order the fields by priority
2922
+ uasort( $section['settings'], array( $this, "compare_elems" ) );
2923
+
2924
+ foreach ( $section['settings'] as $group_id => $group ) {
2925
+
2926
+ echo "<tr class='mega-{$group_id}'>";
2927
+
2928
+ if ( isset( $group['settings'] ) ) {
2929
+
2930
+ echo "<td class='mega-name'>" . $group['title'] . "<div class='mega-description'>" . $group['description'] . "</div></td>";
2931
+ echo "<td class='mega-value'>";
2932
+
2933
+ foreach ( $group['settings'] as $setting_id => $setting ) {
2934
+
2935
+ if ( isset( $setting['validation'] ) ) {
2936
+ echo "<label class='mega-{$setting['key']}' data-validation='{$setting['validation']}'>";
2937
+ } else {
2938
+ echo "<label class='mega-{$setting['key']}'>";
2939
+ }
2940
+ echo "<span class='mega-short-desc'>{$setting['title']}</span>";
2941
+
2942
+ switch ( $setting['type'] ) {
2943
+ case "freetext":
2944
+ $this->print_theme_freetext_option( $setting['key'] );
2945
+ break;
2946
+ case "textarea":
2947
+ $this->print_theme_textarea_option( $setting['key'] );
2948
+ break;
2949
+ case "align":
2950
+ $this->print_theme_align_option( $setting['key'] );
2951
+ break;
2952
+ case "checkbox":
2953
+ $this->print_theme_checkbox_option( $setting['key'] );
2954
+ break;
2955
+ case "arrow":
2956
+ $this->print_theme_arrow_option( $setting['key'] );
2957
+ break;
2958
+ case "color":
2959
+ $this->print_theme_color_option( $setting['key'] );
2960
+ break;
2961
+ case "weight":
2962
+ $this->print_theme_weight_option( $setting['key'] );
2963
+ break;
2964
+ case "font":
2965
+ $this->print_theme_font_option( $setting['key'] );
2966
+ break;
2967
+ case "transform":
2968
+ $this->print_theme_transform_option( $setting['key'] );
2969
+ break;
2970
+ case "decoration":
2971
+ $this->print_theme_text_decoration_option( $setting['key'] );
2972
+ break;
2973
+ case "mobile_columns":
2974
+ $this->print_theme_mobile_columns_option( $setting['key'] );
2975
+ break;
2976
+ default:
2977
+ do_action("megamenu_print_theme_option_{$setting['type']}", $setting['key'], $this->id );
2978
+ break;
2979
+ }
2980
+
2981
+ echo "</label>";
2982
+
2983
+ }
2984
+
2985
+ if ( isset( $group['info'] ) ) {
2986
+ foreach ( $group['info'] as $paragraph ) {
2987
+ echo "<div class='mega-info'>{$paragraph}</div>";
2988
+ }
2989
+ }
2990
+
2991
+ foreach ( $group['settings'] as $setting_id => $setting ) {
2992
+ if ( isset( $setting['validation'] ) ) {
2993
+
2994
+ echo "<div class='mega-validation-message mega-validation-message-{$setting['key']}'>";
2995
+
2996
+ if ( $setting['validation'] == 'int' ) {
2997
+ $message = __("Enter a whole number (e.g. 1, 5, 100, 999)");
2998
+ }
2999
+
3000
+ if ( $setting['validation'] == 'px' ) {
3001
+ $message = __("Enter a value including a unit (e.g. 10px, 10rem, 10%)");
3002
+ }
3003
+
3004
+ if ( $setting['validation'] == 'float' ) {
3005
+ $message = __("Enter a valid number (e.g. 0.1, 1, 10, 999)");
3006
+ }
3007
+
3008
+ if ( strlen( $setting['title'] ) ) {
3009
+ echo $setting['title'] . ": " . $message;
3010
+ } else {
3011
+ echo $message;
3012
+ }
3013
+
3014
+ echo "</div>";
3015
+ }
3016
+ }
3017
+
3018
+ echo "</td>";
3019
+ } else {
3020
+ echo "<td colspan='2'><h5>{$group['title']}</h5></td>";
3021
+ }
3022
+
3023
+ echo "</tr>";
3024
+
3025
+ }
3026
+
3027
+ echo "</table>";
3028
+ echo "</div>";
3029
+ echo "</li>";
3030
+
3031
+ }
3032
+
3033
+ ?>
3034
+ </ul>
3035
+ </div>
3036
+
3037
+ <div class='megamenu_submit'>
3038
+ <div class='mega_left'>
3039
+ <?php submit_button(); ?>
3040
+ </div>
3041
+ <div class='mega_right'>
3042
+ <?php if ( $this->string_contains( $this->id, array("custom") ) ) : ?>
3043
+ <a class='delete confirm' href='<?php echo $delete_url; ?>'><?php _e("Delete Theme", "megamenu"); ?></a>
3044
+ <?php else : ?>
3045
+ <a class='revert confirm' href='<?php echo $revert_url; ?>'><?php _e("Revert Theme", "megamenu"); ?></a>
3046
+ <?php endif; ?>
3047
+ </div>
3048
+ </div>
3049
+ </form>
3050
+ </div>
3051
+
3052
+ <?php
3053
+
3054
+ }
3055
+
3056
+
3057
+ /**
3058
+ * Compare array values
3059
+ *
3060
+ * @param array $elem1
3061
+ * @param array $elem2
3062
+ * @return bool
3063
+ * @since 2.1
3064
+ */
3065
+ private function compare_elems( $elem1, $elem2 ) {
3066
+
3067
+ return $elem1['priority'] > $elem2['priority'];
3068
+
3069
+ }
3070
+
3071
+
3072
+ /**
3073
+ * Print a select dropdown with left, center and right options
3074
+ *
3075
+ * @since 1.6.1
3076
+ * @param string $key
3077
+ * @param string $value
3078
+ */
3079
+ public function print_theme_align_option( $key ) {
3080
+
3081
+ $value = $this->active_theme[$key];
3082
+
3083
+ ?>
3084
+
3085
+ <select name='settings[<?php echo $key ?>]'>
3086
+ <option value='left' <?php selected( $value, 'left' ); ?>><?php _e("Left", "megamenu") ?></option>
3087
+ <option value='center' <?php selected( $value, 'center' ); ?>><?php _e("Center", "megamenu") ?></option>
3088
+ <option value='right' <?php selected( $value, 'right' ); ?>><?php _e("Right", "megamenu") ?></option>
3089
+ </select>
3090
+
3091
+ <?php
3092
+ }
3093
+
3094
+
3095
+ /**
3096
+ * Print a select dropdown with 1 and 2 options
3097
+ *
3098
+ * @since 1.2.0
3099
+ * @param string $key
3100
+ * @param string $value
3101
+ */
3102
+ public function print_theme_mobile_columns_option( $key ) {
3103
+
3104
+ $value = $this->active_theme[$key];
3105
+
3106
+ ?>
3107
+
3108
+ <select name='settings[<?php echo $key ?>]'>
3109
+ <option value='1' <?php selected( $value, '1' ); ?>><?php _e("1 Column", "megamenu") ?></option>
3110
+ <option value='2' <?php selected( $value, '2' ); ?>><?php _e("2 Columns", "megamenu") ?></option>
3111
+ </select>
3112
+
3113
+ <?php
3114
+ }
3115
+
3116
+
3117
+ /**
3118
+ * Print a select dropdown with text decoration options
3119
+ *
3120
+ * @since 1.6.1
3121
+ * @param string $key
3122
+ * @param string $value
3123
+ */
3124
+ public function print_theme_text_decoration_option( $key ) {
3125
+
3126
+ $value = $this->active_theme[$key];
3127
+
3128
+ ?>
3129
+
3130
+ <select name='settings[<?php echo $key ?>]'>
3131
+ <option value='none' <?php selected( $value, 'none' ); ?>><?php _e("None", "megamenu") ?></option>
3132
+ <option value='underline' <?php selected( $value, 'underline' ); ?>><?php _e("Underline", "megamenu") ?></option>
3133
+ </select>
3134
+
3135
+ <?php
3136
+ }
3137
+
3138
+
3139
+ /**
3140
+ * Print a checkbox option
3141
+ *
3142
+ * @since 1.6.1
3143
+ * @param string $key
3144
+ * @param string $value
3145
+ */
3146
+ public function print_theme_checkbox_option( $key ) {
3147
+
3148
+ $value = $this->active_theme[$key];
3149
+
3150
+ ?>
3151
+
3152
+ <input type='hidden' name='checkboxes[<?php echo $key ?>]' />
3153
+ <input type='checkbox' name='settings[<?php echo $key ?>]' <?php checked( $value, 'on' ); ?> />
3154
+
3155
+ <?php
3156
+ }
3157
+
3158
+
3159
+ /**
3160
+ * Print an arrow dropdown selection box
3161
+ *
3162
+ * @since 1.0
3163
+ * @param string $key
3164
+ * @param string $value
3165
+ */
3166
+ public function print_theme_arrow_option( $key ) {
3167
+
3168
+ $value = $this->active_theme[$key];
3169
+
3170
+ $arrow_icons = $this->arrow_icons();
3171
+
3172
+ ?>
3173
+ <select class='icon_dropdown' name='settings[<?php echo $key ?>]'>
3174
+ <?php
3175
+
3176
+ echo "<option value='disabled'>" . __("Disabled", "megamenu") . "</option>";
3177
+
3178
+ foreach ($arrow_icons as $code => $class) {
3179
+ $name = str_replace('dashicons-', '', $class);
3180
+ $name = ucwords(str_replace(array('-','arrow'), ' ', $name));
3181
+ echo "<option data-class='{$class}' value='{$code}' " . selected( $value, $code, false ) . ">" . $name . "</option>";
3182
+ }
3183
+
3184
+ ?>
3185
+ </select>
3186
+
3187
+ <?php
3188
+ }
3189
+
3190
+
3191
+
3192
+ /**
3193
+ * Print a colorpicker
3194
+ *
3195
+ * @since 1.0
3196
+ * @param string $key
3197
+ * @param string $value
3198
+ */
3199
+ public function print_theme_color_option( $key ) {
3200
+
3201
+ $value = $this->active_theme[$key];
3202
+
3203
+ if ( $value == 'transparent' ) {
3204
+ $value = 'rgba(0,0,0,0)';
3205
+ }
3206
+
3207
+ if ( $value == 'rgba(0,0,0,0)' ) {
3208
+ $value_text = 'transparent';
3209
+ } else {
3210
+ $value_text = $value;
3211
+ }
3212
+
3213
+ echo "<div class='mm-picker-container'>";
3214
+ echo " <input type='text' class='mm_colorpicker' name='settings[$key]' value='{$value}' />";
3215
+ echo " <div class='chosen-color'>{$value_text}</div>";
3216
+ echo "</div>";
3217
+
3218
+ }
3219
+
3220
+
3221
+ /**
3222
+ * Print a font weight selector
3223
+ *
3224
+ * @since 1.0
3225
+ * @param string $key
3226
+ * @param string $value
3227
+ */
3228
+ public function print_theme_weight_option( $key ) {
3229
+
3230
+ $value = $this->active_theme[$key];
3231
+
3232
+ $options = apply_filters( "megamenu_font_weights", array(
3233
+ 'inherit' => __("Theme Default", "megamenu"),
3234
+ '300' => __("Light (300)", "megamenu"),
3235
+ 'normal' => __("Normal (400)", "megamenu"),
3236
+ 'bold' => __("Bold (700)", "megamenu"),
3237
+ ) );
3238
+
3239
+ /**
3240
+ * '100' => __("Thin (100)", "megamenu"),
3241
+ * '200' => __("Extra Light (200)", "megamenu"),
3242
+ * '300' => __("Light (300)", "megamenu"),
3243
+ * 'normal' => __("Normal (400)", "megamenu"),
3244
+ * '500' => __("Medium (500)", "megamenu"),
3245
+ * '600' => __("Semi Bold (600)", "megamenu"),
3246
+ * 'bold' => __("Bold (700)", "megamenu"),
3247
+ * '800' => __("Extra Bold (800)", "megamenu"),
3248
+ * '900' => __("Black (900)", "megamenu")
3249
+ */
3250
+
3251
+ echo "<select name='settings[$key]'>";
3252
+
3253
+ foreach ( $options as $weight => $name ) {
3254
+ echo "<option value='{$weight}' " . selected( $value, $weight, true ) . ">{$name}</option>";
3255
+ }
3256
+
3257
+ echo "</select>";
3258
+
3259
+ }
3260
+
3261
+
3262
+ /**
3263
+ * Print a font transform selector
3264
+ *
3265
+ * @since 1.0
3266
+ * @param string $key
3267
+ * @param string $value
3268
+ */
3269
+ public function print_theme_transform_option( $key ) {
3270
+
3271
+ $value = $this->active_theme[$key];
3272
+
3273
+ echo "<select name='settings[$key]'>";
3274
+ echo " <option value='none' " . selected( $value, 'none', true) . ">" . __("Normal", "megamenu") . "</option>";
3275
+ echo " <option value='capitalize'" . selected( $value, 'capitalize', true) . ">" . __("Capitalize", "megamenu") . "</option>";
3276
+ echo " <option value='uppercase'" . selected( $value, 'uppercase', true) . ">" . __("Uppercase", "megamenu") . "</option>";
3277
+ echo " <option value='lowercase'" . selected( $value, 'lowercase', true) . ">" . __("Lowercase", "megamenu") . "</option>";
3278
+ echo "</select>";
3279
+
3280
+ }
3281
+
3282
+
3283
+ /**
3284
+ * Print a textarea
3285
+ *
3286
+ * @since 1.0
3287
+ * @param string $key
3288
+ * @param string $value
3289
+ */
3290
+ public function print_theme_textarea_option( $key ) {
3291
+
3292
+ $value = $this->active_theme[$key];
3293
+ ?>
3294
+
3295
+ <textarea id='codemirror' name='settings[<?php echo $key ?>]'><?php echo stripslashes( $value ) ?></textarea>
3296
+
3297
+ <p><b><?php _e("Custom Styling Tips", "megamenu"); ?></b></p>
3298
+ <ul class='custom_styling_tips'>
3299
+ <li><code>#{$wrap}</code> <?php _e("converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-primary", "megamenu"); ?></li>
3300
+ <li><code>#{$menu}</code> <?php _e("converts to the ID selector of the menu, e.g. ul#mega-menu-primary", "megamenu"); ?></li>
3301
+ <li><?php _e("Use @import rules to import CSS from other plugins or your theme directory, e.g:"); ?>
3302
+ <br /><br /><code>#{$wrap} #{$menu} {<br />&nbsp;&nbsp;&nbsp;&nbsp;@import "shortcodes-ultimate/assets/css/box-shortcodes.css";<br />}</code></li>
3303
+ </ul>
3304
+
3305
+ <?php
3306
+
3307
+ }
3308
+
3309
+
3310
+ /**
3311
+ * Print a font selector
3312
+ *
3313
+ * @since 1.0
3314
+ * @param string $key
3315
+ * @param string $value
3316
+ */
3317
+ public function print_theme_font_option( $key ) {
3318
+
3319
+ $value = $this->active_theme[$key];
3320
+
3321
+ echo "<select name='settings[$key]'>";
3322
+
3323
+ echo "<option value='inherit'>" . __("Theme Default", "megamenu") . "</option>";
3324
+
3325
+ foreach ( $this->fonts() as $font ) {
3326
+ $parts = explode(",", $font);
3327
+ $font_name = trim($parts[0]);
3328
+ echo "<option value=\"{$font}\" " . selected( $font, $value ) . ">{$font_name}</option>";
3329
+ }
3330
+
3331
+ echo "</select>";
3332
+ }
3333
+
3334
+
3335
+ /**
3336
+ * Print a text input
3337
+ *
3338
+ * @since 1.0
3339
+ * @param string $key
3340
+ * @param string $value
3341
+ */
3342
+ public function print_theme_freetext_option( $key ) {
3343
+
3344
+ $value = $this->active_theme[$key];
3345
+
3346
+ echo "<input class='mega-setting-{$key}' type='text' name='settings[$key]' value='{$value}' />";
3347
+
3348
+ }
3349
+
3350
+
3351
+ /**
3352
+ * Returns a list of available fonts.
3353
+ *
3354
+ * @since 1.0
3355
+ */
3356
+ public function fonts() {
3357
+
3358
+ $fonts = array(
3359
+ "Georgia, serif",
3360
+ "Palatino Linotype, Book Antiqua, Palatino, serif",
3361
+ "Times New Roman, Times, serif",
3362
+ "Arial, Helvetica, sans-serif",
3363
+ "Arial Black, Gadget, sans-serif",
3364
+ "Comic Sans MS, cursive, sans-serif",
3365
+ "Impact, Charcoal, sans-serif",
3366
+ "Lucida Sans Unicode, Lucida Grande, sans-serif",
3367
+ "Tahoma, Geneva, sans-serif",
3368
+ "Trebuchet MS, Helvetica, sans-serif",
3369
+ "Verdana, Geneva, sans-serif",
3370
+ "Courier New, Courier, monospace",
3371
+ "Lucida Console, Monaco, monospace"
3372
+ );
3373
+
3374
+ $fonts = apply_filters( "megamenu_fonts", $fonts );
3375
+
3376
+ return $fonts;
3377
+
3378
+ }
3379
+
3380
+
3381
+ /**
3382
+ * List of all available arrow DashIcon classes.
3383
+ *
3384
+ * @since 1.0
3385
+ * @return array - Sorted list of icon classes
3386
+ */
3387
+ private function arrow_icons() {
3388
+
3389
+ $icons = array(
3390
+ 'dash-f142' => 'dashicons-arrow-up',
3391
+ 'dash-f140' => 'dashicons-arrow-down',
3392
+ 'dash-f141' => 'dashicons-arrow-left',
3393
+ 'dash-f139' => 'dashicons-arrow-right',
3394
+ 'dash-f342' => 'dashicons-arrow-up-alt',
3395
+ 'dash-f346' => 'dashicons-arrow-down-alt',
3396
+ 'dash-f340' => 'dashicons-arrow-left-alt',
3397
+ 'dash-f344' => 'dashicons-arrow-right-alt',
3398
+ 'dash-f343' => 'dashicons-arrow-up-alt2',
3399
+ 'dash-f347' => 'dashicons-arrow-down-alt2',
3400
+ 'dash-f341' => 'dashicons-arrow-left-alt2',
3401
+ 'dash-f345' => 'dashicons-arrow-right-alt2'
3402
+ );
3403
+
3404
+ $icons = apply_filters( "megamenu_arrow_icons", $icons );
3405
+
3406
+ return $icons;
3407
+
3408
+ }
3409
+
3410
+
3411
+
3412
+ /**
3413
+ * Enqueue nav-menus.php scripts
3414
+ *
3415
+ * @since 1.8.3
3416
+ */
3417
+ public function enqueue_scripts() {
3418
+ wp_enqueue_script('accordion');
3419
+
3420
+ wp_enqueue_style( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.css', false, MEGAMENU_VERSION );
3421
+ wp_enqueue_style( 'mega-menu-settings', MEGAMENU_BASE_URL . 'css/admin/settings.css', false, MEGAMENU_VERSION );
3422
+ wp_enqueue_style( 'codemirror', MEGAMENU_BASE_URL . 'js/codemirror/codemirror.css', false, MEGAMENU_VERSION );
3423
+ wp_enqueue_style( 'select2', MEGAMENU_BASE_URL . 'js/select2/select2.css', false, MEGAMENU_VERSION );
3424
+
3425
+
3426
+ wp_enqueue_script( 'spectrum', MEGAMENU_BASE_URL . 'js/spectrum/spectrum.js', array( 'jquery' ), MEGAMENU_VERSION );
3427
+ wp_enqueue_script( 'codemirror', MEGAMENU_BASE_URL . 'js/codemirror/codemirror.js', array(), MEGAMENU_VERSION );
3428
+ wp_enqueue_script( 'mega-menu-select2', MEGAMENU_BASE_URL . 'js/select2/select2.min.js', array(), MEGAMENU_VERSION );
3429
+ wp_enqueue_script( 'mega-menu-theme-editor', MEGAMENU_BASE_URL . 'js/settings.js', array( 'jquery', 'spectrum', 'codemirror' ), MEGAMENU_VERSION );
3430
+
3431
+ wp_localize_script( 'mega-menu-theme-editor', 'megamenu_settings',
3432
+ array(
3433
+ 'confirm' => __("Are you sure?", "megamenu")
3434
+ )
3435
+ );
3436
+
3437
+ }
3438
+
3439
+ }
3440
+
3441
+ endif;
classes/style-manager.class.php ADDED
@@ -0,0 +1,1018 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists( 'Mega_Menu_Style_Manager' ) ) :
8
+
9
+ /**
10
+ *
11
+ */
12
+ final class Mega_Menu_Style_Manager {
13
+
14
+ /**
15
+ *
16
+ */
17
+ var $settings = array();
18
+
19
+
20
+ /**
21
+ * Constructor
22
+ *
23
+ * @since 1.0
24
+ */
25
+ public function __construct() {
26
+
27
+ $this->settings = get_option( "megamenu_settings" );
28
+
29
+ }
30
+
31
+
32
+ /**
33
+ * Setup actions
34
+ *
35
+ * @since 1.0
36
+ */
37
+ public function setup_actions() {
38
+
39
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
40
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 999 );
41
+ add_action( 'wp_head', array( $this, 'head_css' ), 9999 );
42
+
43
+ add_action( 'megamenu_delete_cache', array( $this, 'delete_cache' ) );
44
+ add_action( 'after_switch_theme', array( $this, 'delete_cache') );
45
+
46
+ // PolyLang
47
+ if ( function_exists( 'pll_current_language' ) ) {
48
+ add_filter( 'megamenu_css_transient_key', array( $this, 'polylang_transient_key') );
49
+ add_filter( 'megamenu_css_filename', array( $this, 'polylang_css_filename') );
50
+ add_action( 'megamenu_after_delete_cache', array( $this, 'polylang_delete_cache') );
51
+ } else if ( defined( 'ICL_LANGUAGE_CODE' ) ) { // WPML
52
+ add_filter( 'megamenu_css_transient_key', array( $this, 'wpml_transient_key') );
53
+ add_filter( 'megamenu_css_filename', array( $this, 'wpml_css_filename') );
54
+ add_action( 'megamenu_after_delete_cache', array( $this, 'wpml_delete_cache') );
55
+ }
56
+
57
+
58
+ }
59
+
60
+
61
+ /**
62
+ *
63
+ */
64
+ public function get_default_theme() {
65
+ return array(
66
+ 'title' => __("Default", "megamenu"),
67
+ 'container_background_from' => '#222',
68
+ 'container_background_to' => '#222',
69
+ 'container_padding_left' => '0px',
70
+ 'container_padding_right' => '0px',
71
+ 'container_padding_top' => '0px',
72
+ 'container_padding_bottom' => '0px',
73
+ 'container_border_radius_top_left' => '0px',
74
+ 'container_border_radius_top_right' => '0px',
75
+ 'container_border_radius_bottom_left' => '0px',
76
+ 'container_border_radius_bottom_right' => '0px',
77
+ 'arrow_up' => 'dash-f142',
78
+ 'arrow_down' => 'dash-f140',
79
+ 'arrow_left' => 'dash-f141',
80
+ 'arrow_right' => 'dash-f139',
81
+ 'font_size' => '14px', // deprecated
82
+ 'font_color' => '#666', // deprecated
83
+ 'font_family' => 'inherit', // deprecated
84
+ 'menu_item_align' => 'left',
85
+ 'menu_item_background_from' => 'transparent',
86
+ 'menu_item_background_to' => 'transparent',
87
+ 'menu_item_background_hover_from' => '#333',
88
+ 'menu_item_background_hover_to' => '#333',
89
+ 'menu_item_spacing' => '0px',
90
+ 'menu_item_link_font' => 'inherit',
91
+ 'menu_item_link_font_size' => '14px',
92
+ 'menu_item_link_height' => '40px',
93
+ 'menu_item_link_color' => '#ffffff',
94
+ 'menu_item_link_weight' => 'normal',
95
+ 'menu_item_link_text_transform' => 'normal',
96
+ 'menu_item_link_text_decoration' => 'none',
97
+ 'menu_item_link_color_hover' => '#ffffff',
98
+ 'menu_item_link_weight_hover' => 'normal',
99
+ 'menu_item_link_text_decoration_hover' => 'none',
100
+ 'menu_item_link_padding_left' => '10px',
101
+ 'menu_item_link_padding_right' => '10px',
102
+ 'menu_item_link_padding_top' => '0px',
103
+ 'menu_item_link_padding_bottom' => '0px',
104
+ 'menu_item_link_border_radius_top_left' => '0px',
105
+ 'menu_item_link_border_radius_top_right' => '0px',
106
+ 'menu_item_link_border_radius_bottom_left' => '0px',
107
+ 'menu_item_link_border_radius_bottom_right' => '0px',
108
+ 'menu_item_border_color' => '#fff',
109
+ 'menu_item_border_left' => '0px',
110
+ 'menu_item_border_right' => '0px',
111
+ 'menu_item_border_top' => '0px',
112
+ 'menu_item_border_bottom' => '0px',
113
+ 'menu_item_border_color_hover' => '#fff',
114
+ 'menu_item_highlight_current' => 'off',
115
+ 'menu_item_divider' => 'off',
116
+ 'menu_item_divider_color' => 'rgba(255, 255, 255, 0.1)',
117
+ 'menu_item_divider_glow_opacity' => '0.1',
118
+ 'panel_background_from' => '#f1f1f1',
119
+ 'panel_background_to' => '#f1f1f1',
120
+ 'panel_width' => '100%',
121
+ 'panel_inner_width' => '100%',
122
+ 'panel_border_color' => '#fff',
123
+ 'panel_border_left' => '0px',
124
+ 'panel_border_right' => '0px',
125
+ 'panel_border_top' => '0px',
126
+ 'panel_border_bottom' => '0px',
127
+ 'panel_border_radius_top_left' => '0px',
128
+ 'panel_border_radius_top_right' => '0px',
129
+ 'panel_border_radius_bottom_left' => '0px',
130
+ 'panel_border_radius_bottom_right' => '0px',
131
+ 'panel_header_color' => '#555',
132
+ 'panel_header_text_transform' => 'uppercase',
133
+ 'panel_header_font' => 'inherit',
134
+ 'panel_header_font_size' => '16px',
135
+ 'panel_header_font_weight' => 'bold',
136
+ 'panel_header_text_decoration' => 'none',
137
+ 'panel_header_padding_top' => '0px',
138
+ 'panel_header_padding_right' => '0px',
139
+ 'panel_header_padding_bottom' => '5px',
140
+ 'panel_header_padding_left' => '0px',
141
+ 'panel_header_margin_top' => '0px',
142
+ 'panel_header_margin_right' => '0px',
143
+ 'panel_header_margin_bottom' => '0px',
144
+ 'panel_header_margin_left' => '0px',
145
+ 'panel_header_border_color' => 'panel_header_color',
146
+ 'panel_header_border_left' => '0px',
147
+ 'panel_header_border_right' => '0px',
148
+ 'panel_header_border_top' => '0px',
149
+ 'panel_header_border_bottom' => '0px',
150
+ 'panel_padding_left' => '0px',
151
+ 'panel_padding_right' => '0px',
152
+ 'panel_padding_top' => '0px',
153
+ 'panel_padding_bottom' => '0px',
154
+ 'panel_widget_padding_left' => '15px',
155
+ 'panel_widget_padding_right' => '15px',
156
+ 'panel_widget_padding_top' => '15px',
157
+ 'panel_widget_padding_bottom' => '15px',
158
+ 'panel_font_size' => 'font_size',
159
+ 'panel_font_color' => 'font_color',
160
+ 'panel_font_family' => 'font_family',
161
+ 'panel_second_level_font_color' => 'panel_header_color',
162
+ 'panel_second_level_font_color_hover' => 'panel_header_color',
163
+ 'panel_second_level_text_transform' => 'panel_header_text_transform',
164
+ 'panel_second_level_font' => 'panel_header_font',
165
+ 'panel_second_level_font_size' => 'panel_header_font_size',
166
+ 'panel_second_level_font_weight' => 'panel_header_font_weight',
167
+ 'panel_second_level_font_weight_hover' => 'panel_header_font_weight',
168
+ 'panel_second_level_text_decoration' => 'panel_header_text_decoration',
169
+ 'panel_second_level_text_decoration_hover' => 'panel_header_text_decoration',
170
+ 'panel_second_level_background_hover_from' => 'transparent',
171
+ 'panel_second_level_background_hover_to' => 'transparent',
172
+ 'panel_second_level_padding_left' => '0px',
173
+ 'panel_second_level_padding_right' => '0px',
174
+ 'panel_second_level_padding_top' => '0px',
175
+ 'panel_second_level_padding_bottom' => '0px',
176
+ 'panel_second_level_margin_left' => '0px',
177
+ 'panel_second_level_margin_right' => '0px',
178
+ 'panel_second_level_margin_top' => '0px',
179
+ 'panel_second_level_margin_bottom' => '0px',
180
+ 'panel_second_level_border_color' => 'panel_header_color',
181
+ 'panel_second_level_border_left' => '0px',
182
+ 'panel_second_level_border_right' => '0px',
183
+ 'panel_second_level_border_top' => '0px',
184
+ 'panel_second_level_border_bottom' => '0px',
185
+ 'panel_third_level_font_color' => 'panel_font_color',
186
+ 'panel_third_level_font_color_hover' => 'panel_font_color',
187
+ 'panel_third_level_text_transform' => 'none',
188
+ 'panel_third_level_font' => 'panel_font_family',
189
+ 'panel_third_level_font_size' => 'panel_font_size',
190
+ 'panel_third_level_font_weight' => 'normal',
191
+ 'panel_third_level_font_weight_hover' => 'normal',
192
+ 'panel_third_level_text_decoration' => 'none',
193
+ 'panel_third_level_text_decoration_hover' => 'none',
194
+ 'panel_third_level_background_hover_from' => 'transparent',
195
+ 'panel_third_level_background_hover_to' => 'transparent',
196
+ 'panel_third_level_padding_left' => '0px',
197
+ 'panel_third_level_padding_right' => '0px',
198
+ 'panel_third_level_padding_top' => '0px',
199
+ 'panel_third_level_padding_bottom' => '0px',
200
+ 'flyout_width' => '150px',
201
+ 'flyout_menu_background_from' => '#f1f1f1',
202
+ 'flyout_menu_background_to' => '#f1f1f1',
203
+ 'flyout_border_color' => '#ffffff',
204
+ 'flyout_border_left' => '0px',
205
+ 'flyout_border_right' => '0px',
206
+ 'flyout_border_top' => '0px',
207
+ 'flyout_border_bottom' => '0px',
208
+ 'flyout_border_radius_top_left' => '0px',
209
+ 'flyout_border_radius_top_right' => '0px',
210
+ 'flyout_border_radius_bottom_left' => '0px',
211
+ 'flyout_border_radius_bottom_right' => '0px',
212
+ 'flyout_menu_item_divider' => 'off',
213
+ 'flyout_menu_item_divider_color' => 'rgba(255, 255, 255, 0.1)',
214
+ 'flyout_padding_top' => '0px',
215
+ 'flyout_padding_right' => '0px',
216
+ 'flyout_padding_bottom' => '0px',
217
+ 'flyout_padding_left' => '0px',
218
+ 'flyout_link_padding_left' => '10px',
219
+ 'flyout_link_padding_right' => '10px',
220
+ 'flyout_link_padding_top' => '0px',
221
+ 'flyout_link_padding_bottom' => '0px',
222
+ 'flyout_link_weight' => 'normal',
223
+ 'flyout_link_weight_hover' => 'normal',
224
+ 'flyout_link_height' => '35px',
225
+ 'flyout_link_text_decoration' => 'none',
226
+ 'flyout_link_text_decoration_hover' => 'none',
227
+ 'flyout_background_from' => '#f1f1f1',
228
+ 'flyout_background_to' => '#f1f1f1',
229
+ 'flyout_background_hover_from' => '#dddddd',
230
+ 'flyout_background_hover_to' => '#dddddd',
231
+ 'flyout_link_size' => 'font_size',
232
+ 'flyout_link_color' => 'font_color',
233
+ 'flyout_link_color_hover' => 'font_color',
234
+ 'flyout_link_family' => 'font_family',
235
+ 'flyout_link_text_transform' => 'normal',
236
+ 'responsive_breakpoint' => '600px',
237
+ 'responsive_text' => 'MENU', // deprecated
238
+ 'line_height' => '1.7',
239
+ 'z_index' => '999',
240
+ 'shadow' => 'off',
241
+ 'shadow_horizontal' => '0px',
242
+ 'shadow_vertical' => '0px',
243
+ 'shadow_blur' => '5px',
244
+ 'shadow_spread' => '0px',
245
+ 'shadow_color' => 'rgba(0, 0, 0, 0.1)',
246
+ 'transitions' => 'off',
247
+ 'resets' => 'on',
248
+ 'mobile_columns' => '2',
249
+ 'toggle_background_from' => 'container_background_from',
250
+ 'toggle_background_to' => 'container_background_to',
251
+ 'toggle_font_color' => 'menu_item_link_color', // deprecated
252
+ 'mobile_menu_item_height' => '40px',
253
+ 'custom_css' => '
254
+ #{$wrap} #{$menu} {
255
+ /** Custom styles should be added below this line **/
256
+ }
257
+ #{$wrap} {
258
+ clear: both;
259
+ }'
260
+ );
261
+ }
262
+
263
+
264
+ /**
265
+ *
266
+ * @since 1.0
267
+ */
268
+ public function default_themes() {
269
+
270
+ $themes['default'] = $this->get_default_theme();
271
+
272
+ return apply_filters( "megamenu_themes", $themes );
273
+ }
274
+
275
+
276
+ /**
277
+ * Merge the saved themes (from options table) into array of complete themes
278
+ *
279
+ * @since 2.1
280
+ */
281
+ private function merge_in_saved_themes( $all_themes ) {
282
+
283
+ if ( $saved_themes = get_site_option( "megamenu_themes" ) ) {
284
+
285
+ foreach ( $saved_themes as $key => $settings ) {
286
+
287
+ if ( isset( $all_themes[ $key ] ) ) {
288
+ // merge modifications to default themes
289
+ $all_themes[ $key ] = array_merge( $all_themes[ $key ], $saved_themes[ $key ] );
290
+ } else {
291
+ // add in new themes
292
+ $all_themes[ $key ] = $settings;
293
+ }
294
+
295
+ }
296
+ }
297
+
298
+ return $all_themes;
299
+
300
+ }
301
+
302
+
303
+ /**
304
+ * Populate all themes with all keys from the default theme
305
+ *
306
+ * @since 2.1
307
+ */
308
+ private function ensure_all_themes_have_all_default_theme_settings( $all_themes ) {
309
+
310
+ $default_theme = $this->get_default_theme();
311
+
312
+ $themes = array();
313
+
314
+ foreach ( $all_themes as $theme_id => $theme ) {
315
+ $themes[ $theme_id ] = array_merge( $default_theme, $theme );
316
+ }
317
+
318
+ return $themes;
319
+ }
320
+
321
+
322
+ /**
323
+ * For backwards compatibility, copy old settings into new values
324
+ *
325
+ * @since 2.1
326
+ */
327
+ private function process_theme_replacements( $all_themes ) {
328
+
329
+ foreach ( $all_themes as $key => $settings ) {
330
+
331
+ // process replacements
332
+ foreach ( $settings as $var => $val ) {
333
+
334
+ if ( ! is_array( $val ) && isset( $all_themes[$key][$val] ) ) {
335
+
336
+ $all_themes[$key][$var] = $all_themes[$key][$val];
337
+
338
+ }
339
+
340
+ }
341
+
342
+ }
343
+
344
+ return $all_themes;
345
+ }
346
+
347
+
348
+ /**
349
+ * Return a filtered list of themes
350
+ *
351
+ * @since 1.0
352
+ * @return array
353
+ */
354
+ public function get_themes() {
355
+
356
+ $default_themes = $this->default_themes();
357
+
358
+ $all_themes = $this->merge_in_saved_themes( $default_themes );
359
+
360
+ $all_themes = $this->ensure_all_themes_have_all_default_theme_settings( $all_themes );
361
+
362
+ $all_themes = $this->process_theme_replacements( $all_themes );
363
+
364
+ uasort( $all_themes, array( $this, 'sort_by_title' ) );
365
+
366
+ return $all_themes;
367
+
368
+ }
369
+
370
+
371
+ /**
372
+ * Sorts a 2d array by the 'title' key
373
+ *
374
+ * @since 1.0
375
+ * @param array $a
376
+ * @param array $b
377
+ */
378
+ private function sort_by_title( $a, $b ) {
379
+
380
+ return strcmp( $a['title'], $b['title'] );
381
+
382
+ }
383
+
384
+
385
+ /**
386
+ *
387
+ * @since 1.3.1
388
+ */
389
+ private function is_debug_mode() {
390
+
391
+ return ( defined( 'MEGAMENU_DEBUG' ) && MEGAMENU_DEBUG === true ) || isset( $_GET['nocache'] );
392
+
393
+ }
394
+
395
+
396
+ /**
397
+ * Return the menu CSS for use in inline CSS block. Use the cache if possible.
398
+ *
399
+ * @since 1.3.1
400
+ */
401
+ public function get_css() {
402
+
403
+ if ( ( $css = $this->get_cached_css() ) && ! $this->is_debug_mode() ) {
404
+
405
+ return $css;
406
+
407
+ } else {
408
+
409
+ return $this->generate_css();
410
+
411
+ }
412
+
413
+ }
414
+
415
+
416
+ /**
417
+ * Generate and cache the CSS for our menus.
418
+ * The CSS is compiled by scssphp using the file located in /css/megamenu.scss
419
+ *
420
+ * @since 1.0
421
+ * @return string
422
+ * @param boolean $debug_mode (prints error messages to the CSS when enabled)
423
+ */
424
+ public function generate_css() {
425
+
426
+ // the settings may have changed since the class was instantiated,
427
+ // reset them here
428
+ $this->settings = get_option( "megamenu_settings" );
429
+
430
+ if ( ! $this->settings ) {
431
+ return "/** CSS Generation Failed. No menu settings found **/";
432
+ }
433
+
434
+ $css = "";
435
+
436
+ foreach ( $this->settings as $location => $settings ) {
437
+
438
+ if ( isset( $settings['enabled'] ) && has_nav_menu( $location ) ) {
439
+
440
+ $theme = $this->get_theme_settings_for_location( $location );
441
+ $menu_id = $this->get_menu_id_for_location( $location );
442
+
443
+ $compiled_css = $this->generate_css_for_location( $location, $theme, $menu_id );
444
+
445
+ if ( ! is_wp_error( $compiled_css ) ) {
446
+
447
+ $css .= $compiled_css;
448
+
449
+ }
450
+
451
+ }
452
+
453
+ }
454
+
455
+ if ( strlen( $css ) ) {
456
+
457
+ $css .= "/** " . date('l jS \of F Y h:i:s A') . " **/";
458
+
459
+ $this->set_cached_css( $css );
460
+
461
+ if ( $this->get_css_output_method() == 'fs' ) {
462
+ $this->save_to_filesystem( $css );
463
+ }
464
+
465
+ }
466
+
467
+ return $css;
468
+ }
469
+
470
+
471
+ /**
472
+ *
473
+ * @since 1.6.1
474
+ */
475
+ private function save_to_filesystem( $css ) {
476
+ global $wp_filesystem;
477
+
478
+ if ( ! $wp_filesystem ) {
479
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
480
+ }
481
+
482
+ $upload_dir = wp_upload_dir();
483
+ $filename = $this->get_css_filename();
484
+ $dir = trailingslashit( $upload_dir['basedir'] ) . 'maxmegamenu/';
485
+
486
+ WP_Filesystem( false, $upload_dir['basedir'], true );
487
+ $wp_filesystem->mkdir( $dir );
488
+
489
+ if ( ! $wp_filesystem->put_contents( $dir . $filename, $css ) ) {
490
+
491
+ // File write failed.
492
+ // Update CSS output option to 'head' to stop us from attempting to regenerate the CSS on every request.
493
+ $settings = get_option( 'megamenu_settings' );
494
+ $settings['css'] = 'head';
495
+ update_option( 'megamenu_settings', $settings );
496
+
497
+ }
498
+
499
+ }
500
+
501
+
502
+ /**
503
+ * Return the path to the megamenu.scss file, look for custom files before
504
+ * loading the core version.
505
+ *
506
+ * @since 1.0
507
+ * @return string
508
+ */
509
+ private function load_scss_file() {
510
+
511
+ $scss = file_get_contents( MEGAMENU_PATH . trailingslashit('css') . 'mixin.scss' );
512
+ $scss .= file_get_contents( MEGAMENU_PATH . trailingslashit('css') . 'reset.scss' );
513
+
514
+ $locations = apply_filters( "megamenu_scss_locations", array(
515
+ trailingslashit( get_stylesheet_directory() ) . trailingslashit("megamenu") . 'megamenu.scss', // child theme
516
+ trailingslashit( get_template_directory() ) . trailingslashit("megamenu") . 'megamenu.scss', // parent theme
517
+ MEGAMENU_PATH . trailingslashit('css') . 'megamenu.scss' // default
518
+ ));
519
+
520
+ foreach ( $locations as $path ) {
521
+
522
+ if ( file_exists( $path ) ) {
523
+
524
+ $scss .= file_get_contents( $path );
525
+
526
+ }
527
+
528
+ }
529
+
530
+ return apply_filters( "megamenu_load_scss_file_contents", $scss);
531
+
532
+ }
533
+
534
+ /**
535
+ * Compiles raw SCSS into CSS for a particular menu location.
536
+ *
537
+ * @since 1.3
538
+ * @return mixed
539
+ * @param array $settings
540
+ * @param string $location
541
+ */
542
+ public function generate_css_for_location( $location, $theme, $menu_id ) {
543
+
544
+ $scssc = new scssc();
545
+ $scssc->setFormatter( 'scss_formatter' );
546
+
547
+ $import_paths = apply_filters('megamenu_scss_import_paths', array(
548
+ trailingslashit( get_stylesheet_directory() ) . trailingslashit("megamenu"),
549
+ trailingslashit( get_stylesheet_directory() ),
550
+ trailingslashit( get_template_directory() ) . trailingslashit("megamenu"),
551
+ trailingslashit( get_template_directory() ),
552
+ trailingslashit( WP_PLUGIN_DIR )
553
+ ));
554
+
555
+ foreach ( $import_paths as $path ) {
556
+ $scssc->addImportPath( $path );
557
+ }
558
+
559
+ try {
560
+ return $scssc->compile( $this->get_complete_scss_for_location( $location, $theme, $menu_id ) );
561
+ }
562
+ catch ( Exception $e ) {
563
+ $message = __("Warning: CSS compilation failed. Please check your changes or revert the theme.", "megamenu");
564
+
565
+ return new WP_Error( 'scss_compile_fail', $message . "<br /><br />" . $e->getMessage() );
566
+ }
567
+
568
+ }
569
+
570
+
571
+ /**
572
+ * Generates a SCSS string which includes the variables for a menu theme,
573
+ * for a particular menu location.
574
+ *
575
+ * @since 1.3
576
+ * @return string
577
+ * @param string $theme
578
+ * @param string $location
579
+ * @param int $menu_id
580
+ */
581
+ private function get_complete_scss_for_location( $location, $theme, $menu_id ) {
582
+
583
+ $sanitized_location = str_replace( apply_filters("megamenu_location_replacements", array("-", " ") ), "-", $location );
584
+
585
+ $wrap_selector = apply_filters( "megamenu_scss_wrap_selector", "#mega-menu-wrap-{$sanitized_location}", $menu_id, $location );
586
+ $menu_selector = apply_filters( "megamenu_scss_menu_selector", "#mega-menu-{$sanitized_location}", $menu_id, $location );
587
+
588
+ $vars['wrap'] = "'$wrap_selector'";
589
+ $vars['menu'] = "'$menu_selector'";
590
+ $vars['menu_id'] = "'$menu_id'";
591
+
592
+ foreach( $theme as $name => $value ) {
593
+
594
+ if ( in_array( $name, array( 'arrow_up', 'arrow_down', 'arrow_left', 'arrow_right' ) ) ) {
595
+
596
+ $parts = explode( '-', $value );
597
+ $code = end( $parts );
598
+
599
+ $arrow_icon = $code == 'disabled' ? "''" : "'\\" . $code . "'";
600
+
601
+ $vars[$name] = $arrow_icon;
602
+
603
+ continue;
604
+ }
605
+
606
+ if ( in_array( $name, array( 'responsive_text' ) ) ) {
607
+
608
+ if ( strlen( $value ) ) {
609
+ $vars[$name] = "'" . do_shortcode( $value ) . "'";
610
+ } else {
611
+ $vars[$name] = "''";
612
+ }
613
+
614
+ continue;
615
+ }
616
+
617
+ if ( in_array( $name, array( 'panel_width', 'panel_inner_width' ) ) ) {
618
+
619
+ if ( preg_match('/^\d/', $value) !== 1 ) { // doesn't start with number (jQuery selector)
620
+ $vars[$name] = '100%';
621
+
622
+ continue;
623
+ }
624
+
625
+ }
626
+
627
+ if ( $name != 'custom_css' ) {
628
+ $vars[$name] = $value;
629
+ }
630
+
631
+ }
632
+
633
+ // Non-standard characters in the title will break CSS compilation, unset it here as it's not needed.
634
+ if ( isset( $vars['title'] ) ) {
635
+ unset( $vars['title'] );
636
+ }
637
+
638
+ $vars = apply_filters( "megamenu_scss_variables", $vars, $location, $theme, $menu_id, $this->get_theme_id_for_location($location) );
639
+
640
+ $scss = "";
641
+
642
+ foreach ($vars as $name => $value) {
643
+ $scss .= "$" . $name . ": " . $value . ";\n";
644
+ }
645
+
646
+ $scss .= $this->load_scss_file();
647
+
648
+ $scss .= stripslashes( html_entity_decode( $theme['custom_css'] ) );
649
+
650
+ return apply_filters( "megamenu_scss", $scss, $location, $theme, $menu_id );
651
+
652
+ }
653
+
654
+
655
+ /**
656
+ * Returns the menu ID for a specified menu location, defaults to 0
657
+ *
658
+ * @since 1.3
659
+ */
660
+ private function get_menu_id_for_location( $location ) {
661
+
662
+ $locations = get_nav_menu_locations();
663
+
664
+ $menu_id = isset( $locations[ $location ] ) ? $locations[ $location ] : 0;
665
+
666
+ return $menu_id;
667
+
668
+ }
669
+
670
+
671
+ /**
672
+ * Returns the theme ID for a specified menu location, defaults to 'default'
673
+ *
674
+ * @since 2.1
675
+ */
676
+ private function get_theme_id_for_location( $location ) {
677
+
678
+ $settings = $this->settings;
679
+
680
+ $theme_id = isset( $settings[ $location ]['theme'] ) ? $settings[ $location ]['theme'] : 'default';
681
+
682
+ return $theme_id;
683
+
684
+ }
685
+
686
+
687
+ /**
688
+ * Returns the theme settings for a specified location. Defaults to the default theme.
689
+ *
690
+ * @since 1.3
691
+ */
692
+ private function get_theme_settings_for_location( $location ) {
693
+
694
+ $theme_id = $this->get_theme_id_for_location( $location );
695
+
696
+ $all_themes = $this->get_themes();
697
+
698
+ $theme_settings = isset( $all_themes[ $theme_id ] ) ? $all_themes[ $theme_id ] : $all_themes[ 'default' ];
699
+
700
+ return $theme_settings;
701
+
702
+ }
703
+
704
+
705
+ /**
706
+ * Enqueue public CSS and JS files required by Mega Menu
707
+ *
708
+ * @since 1.0
709
+ */
710
+ public function enqueue_styles() {
711
+
712
+ $this->enqueue_fs_style();
713
+
714
+ wp_enqueue_style( 'dashicons' );
715
+
716
+ do_action( 'megamenu_enqueue_public_scripts' );
717
+
718
+ }
719
+
720
+ /**
721
+ * Enqueue public CSS and JS files required by Mega Menu
722
+ *
723
+ * @since 1.0
724
+ */
725
+ public function enqueue_scripts() {
726
+
727
+ wp_enqueue_script( 'hoverIntent' );
728
+ wp_enqueue_script( 'megamenu', MEGAMENU_BASE_URL . "js/maxmegamenu.js", array('jquery', 'hoverIntent'), MEGAMENU_VERSION, true );
729
+
730
+ $params = apply_filters("megamenu_javascript_localisation",
731
+ array(
732
+ "effect" => array(
733
+ "fade" => array(
734
+ "in" => array(
735
+ "animate" => array("opacity" => "show"),
736
+ "css" => array("display" => "none")
737
+ ),
738
+ "out" => array(
739
+ "animate" => array("opacity" => "hide")
740
+ ),
741
+ "speed" => "fast"
742
+ ),
743
+ "slide" => array(
744
+ "in" => array(
745
+ "animate" => array("height" => "show"),
746
+ "css" => array("display" => "none")
747
+ ),
748
+ "out" => array(
749
+ "animate" => array("height" => "hide")
750
+ ),
751
+ "speed" => "fast"
752
+ )
753
+ ),
754
+ "timeout" => 300,
755
+ "interval" => 100
756
+ )
757
+ );
758
+
759
+ wp_localize_script( 'megamenu', 'megamenu', $params );
760
+
761
+ }
762
+
763
+
764
+ /**
765
+ * Enqueue the stylesheet held on the filesystem.
766
+ *
767
+ * @since 1.6.1
768
+ */
769
+ private function enqueue_fs_style() {
770
+
771
+ $upload_dir = wp_upload_dir();
772
+
773
+ $filename = $this->get_css_filename();
774
+
775
+ $filepath = trailingslashit( $upload_dir['basedir'] ) . 'maxmegamenu/' . $filename;
776
+
777
+ if ( ! is_file( $filepath ) || $this->is_debug_mode()) {
778
+ // regenerate the CSS and save to filesystem
779
+ $this->generate_css();
780
+
781
+ }
782
+
783
+ // file should now exist
784
+ if ( is_file( $filepath ) ) {
785
+
786
+ $css_url = trailingslashit( $upload_dir['baseurl'] ) . 'maxmegamenu/' . $filename;
787
+
788
+ $protocol = is_ssl() ? 'https://' : 'http://';
789
+
790
+ // ensure we're using the correct protocol
791
+ $css_url = str_replace( array( "http://", "https://" ), $protocol, $css_url );
792
+
793
+ wp_enqueue_style( 'megamenu', $css_url, false, substr( md5( filemtime( $filepath ) ), 0, 6 ) );
794
+
795
+ }
796
+
797
+ }
798
+
799
+
800
+ /**
801
+ *
802
+ * @since 1.6.1
803
+ */
804
+ private function set_cached_css( $css ) {
805
+
806
+ set_transient( $this->get_transient_key(), $css, 0 );
807
+ set_transient( 'megamenu_css_version', MEGAMENU_VERSION, 0 );
808
+
809
+ }
810
+
811
+
812
+ /**
813
+ * Return the cached css if it exists
814
+ *
815
+ * @since 1.9
816
+ * @return mixed
817
+ */
818
+ private function get_cached_css() {
819
+
820
+ return get_transient( $this->get_transient_key() );
821
+
822
+ }
823
+
824
+
825
+ /**
826
+ * Delete the cached CSS
827
+ *
828
+ * @since 1.9
829
+ * @return mixed
830
+ */
831
+ public function delete_cache() {
832
+ global $wp_filesystem;
833
+
834
+ if ( ! $wp_filesystem ) {
835
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
836
+ }
837
+
838
+ $upload_dir = wp_upload_dir();
839
+ $filename = $this->get_css_filename();
840
+ $dir = trailingslashit( $upload_dir['basedir'] ) . 'maxmegamenu/';
841
+
842
+ WP_Filesystem( false, $upload_dir['basedir'], true );
843
+ $wp_filesystem->rmdir( $dir, true );
844
+
845
+ delete_transient( $this->get_transient_key() );
846
+
847
+ $this->generate_css();
848
+
849
+ do_action( "megamenu_after_delete_cache" );
850
+
851
+ return true;
852
+
853
+ }
854
+
855
+
856
+ /**
857
+ * Return the key to use for the CSS transient
858
+ *
859
+ * @since 1.9
860
+ * @return string
861
+ */
862
+ private function get_transient_key() {
863
+
864
+ return apply_filters( 'megamenu_css_transient_key', 'megamenu_css' );
865
+
866
+ }
867
+
868
+
869
+ /**
870
+ * Return the filename to use for the stylesheet, ensuring the filename is unique
871
+ * for multi site setups
872
+ *
873
+ * @since 1.6.1
874
+ */
875
+ private function get_css_filename() {
876
+
877
+ return apply_filters( "megamenu_css_filename", 'style' ) . '.css';
878
+
879
+ }
880
+
881
+
882
+ /**
883
+ * Return the CSS output method, default to filesystem
884
+ *
885
+ * @return string
886
+ */
887
+ private function get_css_output_method() {
888
+
889
+ return isset( $this->settings['css'] ) ? $this->settings['css'] : 'fs';
890
+
891
+ }
892
+
893
+
894
+ /**
895
+ * Print CSS to <head>
896
+ *
897
+ * @since 1.3.1
898
+ */
899
+ public function head_css() {
900
+
901
+ $upload_dir = wp_upload_dir();
902
+
903
+ $filename = $this->get_css_filename();
904
+
905
+ $filepath = trailingslashit( $upload_dir['basedir'] ) . 'maxmegamenu/' . $filename;
906
+
907
+ if ( ! is_file( $filepath ) ) {
908
+
909
+ $css = $this->get_css();
910
+
911
+ echo '<style type="text/css">' . str_replace( array( " ", "\n" ), '', $css ) . "</style>\n";
912
+
913
+ }
914
+
915
+ }
916
+
917
+
918
+ /**
919
+ * Delete language specific transients created when PolyLang is installed
920
+ *
921
+ * @since 1.9
922
+ */
923
+ public function polylang_delete_cache() {
924
+ global $polylang;
925
+
926
+ foreach ( $polylang->model->get_languages_list() as $term ) {
927
+ delete_transient( apply_filters( 'megamenu_css_transient_key', 'megamenu_css_' . strtolower( $term->locale ) ) );
928
+ }
929
+ }
930
+
931
+
932
+ /**
933
+ * Modify the CSS transient key to make it unique to the current language
934
+ *
935
+ * @since 1.9
936
+ * @return string
937
+ */
938
+ public function polylang_transient_key( $key ) {
939
+
940
+ $locale = strtolower( pll_current_language('locale') );
941
+
942
+ if ( strlen( $locale ) ) {
943
+ $key .= $locale;
944
+ }
945
+
946
+ return $key;
947
+
948
+ }
949
+
950
+
951
+ /**
952
+ * Modify the CSS filename to make it unique to the current language
953
+ *
954
+ * @since 1.9
955
+ * @return string
956
+ */
957
+ public function polylang_css_filename( $filename ) {
958
+
959
+ $locale = strtolower( pll_current_language('locale') );
960
+
961
+ if ( strlen( $locale ) ) {
962
+ $filename .= "_" . $locale;
963
+ }
964
+
965
+ return $filename;
966
+
967
+ }
968
+
969
+
970
+ /**
971
+ * Delete language specific transients created when WPML is installed
972
+ *
973
+ * @since 1.9
974
+ */
975
+ public function wpml_delete_cache() {
976
+
977
+ $languages = icl_get_languages('skip_missing=N');
978
+
979
+ foreach ( $languages as $language ) {
980
+ delete_transient( apply_filters( 'megamenu_css_transient_key', 'megamenu_css_' . $language['language_code'] ) );
981
+ }
982
+
983
+ }
984
+
985
+
986
+ /**
987
+ * Modify the CSS transient key to make it unique to the current language
988
+ *
989
+ * @since 1.9
990
+ * @return string
991
+ */
992
+ public function wpml_transient_key( $key ) {
993
+
994
+ $key .= "_" . ICL_LANGUAGE_CODE;
995
+
996
+ return $key;
997
+
998
+ }
999
+
1000
+
1001
+ /**
1002
+ * Modify the CSS filename to make it unique to the current language
1003
+ *
1004
+ * @since 1.9
1005
+ * @return string
1006
+ */
1007
+ public function wpml_css_filename( $filename ) {
1008
+
1009
+ $filename .= "_" . ICL_LANGUAGE_CODE;
1010
+
1011
+ return $filename;
1012
+
1013
+ }
1014
+
1015
+
1016
+ }
1017
+
1018
+ endif;
classes/toggle-blocks.class.php ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists('Mega_Menu_Toggle_Blocks') ) :
8
+
9
+ /**
10
+ * Mobile Toggle Blocks
11
+ */
12
+ class Mega_Menu_Toggle_Blocks {
13
+
14
+ /**
15
+ * Constructor
16
+ *
17
+ * @since 2.1
18
+ */
19
+ public function __construct() {
20
+
21
+ add_filter( 'megamenu_scss_variables', array( $this, 'add_menu_toggle_block_vars_to_scss'), 10, 5 );
22
+ add_filter( 'megamenu_scss_variables', array( $this, 'add_spacer_block_vars_to_scss'), 10, 5 );
23
+ add_filter( 'megamenu_load_scss_file_contents', array( $this, 'append_scss'), 10 );
24
+ add_filter( 'megamenu_toggle_bar_content', array( $this, 'output_public_toggle_blocks' ), 10, 4 );
25
+
26
+ add_action( 'wp_ajax_mm_get_toggle_block_menu_toggle', array( $this, 'output_menu_toggle_block_html' ) );
27
+ add_action( 'megamenu_output_admin_toggle_block_menu_toggle', array( $this, 'output_menu_toggle_block_html'), 10, 2 );
28
+ add_action( 'wp_ajax_mm_get_toggle_block_spacer', array( $this, 'output_spacer_block_html' ) );
29
+ add_action( 'megamenu_output_admin_toggle_block_spacer', array( $this, 'output_spacer_block_html'), 10, 2 );
30
+
31
+ add_action( 'megamenu_after_theme_revert', array($this, 'revert_toggle_blocks') );
32
+ add_action( 'megamenu_after_theme_save', array( $this, 'save_toggle_blocks' ) );
33
+
34
+ add_action( 'megamenu_admin_scripts', array( $this, 'enqueue_scripts' ) );
35
+ add_action( 'megamenu_print_theme_option_toggle_blocks', array( $this, 'print_theme_toggle_bar_designer_option'), 10, 2);
36
+
37
+ add_filter( 'megamenu_theme_editor_settings', array( $this, 'add_toggle_designer_to_theme_editor'), 10 );
38
+
39
+ }
40
+
41
+
42
+ /**
43
+ * Return the saved toggle blocks for a specified theme
44
+ *
45
+ * @param string $theme_id
46
+ * @since 2.1
47
+ * @return array
48
+ */
49
+ private function get_toggle_blocks_for_theme( $theme_id ) {
50
+
51
+ $blocks = get_site_option( "megamenu_toggle_blocks" );
52
+
53
+ if ( isset( $blocks[ $theme_id ] ) ) {
54
+ return $blocks[ $theme_id ];
55
+ }
56
+
57
+ // backwards compatibility
58
+ // default to right aligned menu toggle using existing theme settings
59
+ $blocks[1] = $this->get_default_menu_toggle_block();
60
+
61
+ return $blocks;
62
+
63
+ }
64
+
65
+
66
+ /**
67
+ * Return default menu toggle block settings
68
+ *
69
+ * @since 2.1
70
+ * @return array
71
+ */
72
+ private function get_default_menu_toggle_block() {
73
+
74
+ $style_manager = new Mega_Menu_Style_Manager();
75
+
76
+ $themes = $style_manager->get_themes();
77
+
78
+ $menu_theme = isset( $themes[ $theme_id ] ) ? $themes[ $theme_id ] : $themes['default'];
79
+
80
+ $defaults = array(
81
+ 'type' => 'menu_toggle',
82
+ 'align' => 'right',
83
+ 'closed_text' => isset($menu_theme['responsive_text']) ? $menu_theme['responsive_text'] : "MENU",
84
+ 'open_text' => isset($menu_theme['responsive_text']) ? $menu_theme['responsive_text'] : "MENU",
85
+ 'closed_icon' => 'dash-f333',
86
+ 'open_icon' => 'dash-f153',
87
+ 'icon_position' => 'after',
88
+ 'text_color' => isset($menu_theme['toggle_font_color']) ? $menu_theme['toggle_font_color'] : '#fff',
89
+ 'icon_color' => isset($menu_theme['toggle_font_color']) ? $menu_theme['toggle_font_color'] : '#fff'
90
+ );
91
+
92
+ return $defaults;
93
+ }
94
+
95
+
96
+ /**
97
+ * Get the HTML output for the toggle blocks
98
+ *
99
+ * @since 2.1
100
+ * @param string $content
101
+ * @param string $nav_menu
102
+ * @param array $args
103
+ * @param string $theme_id
104
+ * @return string
105
+ */
106
+ public function output_public_toggle_blocks( $content, $nav_menu, $args, $theme_id ) {
107
+
108
+ $toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
109
+
110
+ $blocks_html = "";
111
+
112
+ if ( is_array( $toggle_blocks ) ) {
113
+ foreach ( $toggle_blocks as $block_id => $block ) {
114
+
115
+ if ( isset( $block['type'] ) ) {
116
+ $class = "mega-" . str_replace("_", "-", $block['type']) . "-block";
117
+ } else {
118
+ $class = "";
119
+ }
120
+
121
+ if ( isset( $block['align'] ) ) {
122
+ $align = "mega-toggle-block-" . $block['align'];
123
+ } else {
124
+ $align = "mega-toggle-block-left";
125
+ }
126
+
127
+ $blocks_html .= "<div class='mega-toggle-block {$class} {$align}' id='mega-toggle-block-{$block_id}'>";
128
+ $blocks_html .= apply_filters("megamenu_output_public_toggle_block_{$block['type']}", "", $block);
129
+ $blocks_html .= "</div>";
130
+ }
131
+ }
132
+
133
+ $content .= $blocks_html;
134
+
135
+ return $content;
136
+
137
+ }
138
+
139
+
140
+ /**
141
+ * Save the toggle blocks when the theme is saved
142
+ *
143
+ * @since 2.1
144
+ */
145
+ public function save_toggle_blocks() {
146
+
147
+ $theme = esc_attr( $_POST['theme_id'] );
148
+
149
+ $saved_blocks = get_site_option( "megamenu_toggle_blocks" );
150
+
151
+ if ( isset( $saved_blocks[ $theme ] ) ) {
152
+ unset( $saved_blocks[ $theme ] );
153
+ }
154
+
155
+ $submitted_settings = $_POST['toggle_blocks'];
156
+
157
+ $saved_blocks[ $theme ] = $submitted_settings;
158
+
159
+ update_site_option( "megamenu_toggle_blocks", $saved_blocks );
160
+
161
+ }
162
+
163
+
164
+ /**
165
+ * Revert the toggle blocks when a theme is reverted
166
+ *
167
+ * @since 2.1
168
+ */
169
+ public function revert_toggle_blocks() {
170
+
171
+ $theme = esc_attr( $_POST['theme_id'] );
172
+
173
+ $saved_toggle_blocks = get_site_option( "megamenu_toggle_blocks" );
174
+
175
+ if ( isset( $saved_toggle_blocks[$theme] ) ) {
176
+ unset( $saved_toggle_blocks[$theme] );
177
+ }
178
+
179
+ update_site_option( "megamenu_toggle_blocks", $saved_themes );
180
+ }
181
+
182
+
183
+ /**
184
+ * Add the toggle bar designer to the theme editor
185
+ *
186
+ * @since 2.1
187
+ * @return array
188
+ */
189
+ public function add_toggle_designer_to_theme_editor( $settings ) {
190
+
191
+ $settings['mobile_menu']['settings']['toggle_blocks'] = array(
192
+ 'priority' => 5,
193
+ 'title' => __( "Toggle Bar Designer", "megamenu" ),
194
+ 'description' => __( "Configure the contents of the mobile toggle bar", "megamenu" ),
195
+ 'settings' => array(
196
+ array(
197
+ 'title' => __( "", "megamenu" ),
198
+ 'type' => 'toggle_blocks',
199
+ 'key' => 'toggle_blocks'
200
+ )
201
+ ),
202
+ );
203
+
204
+ return $settings;
205
+ }
206
+
207
+
208
+ /**
209
+ * Enqueue nav-menus.php scripts
210
+ *
211
+ * @since 2.1
212
+ */
213
+ public function enqueue_scripts() {
214
+
215
+ wp_enqueue_script( 'mega-menu-toggle-bar-designer', MEGAMENU_BASE_URL . 'js/toggledesigner.js', array( 'jquery', 'jquery-ui-core', 'jquery-ui-sortable' ), MEGAMENU_VERSION );
216
+
217
+ wp_localize_script( 'mega-menu-toggle-bar-designer', 'megamenu',
218
+ array(
219
+ 'nonce' => wp_create_nonce('megamenu_edit')
220
+ )
221
+ );
222
+
223
+ }
224
+
225
+
226
+ /**
227
+ * Append the logo SCSS to the main SCSS file
228
+ *
229
+ * @since 2.1
230
+ * @param string $scss
231
+ * @param string
232
+ */
233
+ public function append_scss( $scss ) {
234
+
235
+ $path = MEGAMENU_PATH . 'css/toggle-blocks.scss';
236
+
237
+ $contents = file_get_contents( $path );
238
+
239
+ return $scss . $contents;
240
+
241
+ }
242
+
243
+
244
+ /**
245
+ * Create a new variable containing the toggle blocks to be used by the SCSS file
246
+ *
247
+ * @param array $vars
248
+ * @param string $location
249
+ * @param string $theme
250
+ * @param int $menu_id
251
+ * @param string $theme_id
252
+ * @return array - all custom SCSS vars
253
+ * @since 2.1
254
+ */
255
+ public function add_menu_toggle_block_vars_to_scss( $vars, $location, $theme, $menu_id, $theme_id ) {
256
+
257
+ $toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
258
+
259
+ $menu_toggle_blocks = array();
260
+
261
+ if ( is_array( $toggle_blocks ) ) {
262
+
263
+ foreach( $toggle_blocks as $index => $settings ) {
264
+
265
+ if ( isset( $settings['type'] ) && $settings['type'] == 'menu_toggle' ) {
266
+
267
+ $styles = array(
268
+ 'id' => $index,
269
+ 'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
270
+ 'closed_text' => isset($settings['closed_text']) ? "'" . $settings['closed_text'] . "'" : "'MENU'",
271
+ 'open_text' => isset($settings['open_text']) ? "'" . $settings['open_text'] . "'" : "''",
272
+ 'closed_icon' => isset($settings['closed_icon']) && $settings['closed_icon'] != 'disabled' ? "'\\" . end( explode( '-', $settings['closed_icon'] ) ) . "'" : "''",
273
+ 'open_icon' => isset($settings['open_icon']) && $settings['open_icon'] != 'disabled' ? "'\\" . end( explode( '-', $settings['open_icon'] ) ) . "'" : "''",
274
+ 'text_color' => isset($settings['text_color']) ? $settings['text_color'] : '#fff',
275
+ 'icon_color' => isset($settings['icon_color']) ? $settings['icon_color'] : '#fff',
276
+ 'icon_position' => isset($settings['icon_position']) ? "'" . $settings['icon_position'] . "'" : 'after'
277
+ );
278
+
279
+ $menu_toggle_blocks[ $index ] = $styles;
280
+ }
281
+
282
+ }
283
+ }
284
+
285
+ //$menu_toggle_blocks(
286
+ // (123, red, 150px),
287
+ // (456, green, null),
288
+ // (789, blue, 90%),());
289
+ if ( count( $menu_toggle_blocks ) ) {
290
+
291
+ $list = "(";
292
+
293
+ foreach ( $menu_toggle_blocks as $id => $vals ) {
294
+ $list .= "(" . implode( ",", $vals ) . "),";
295
+ }
296
+
297
+ // Always add an empty list item to meke sure there are always at least 2 items in the list
298
+ // Lists with a single item are not treated the same way by SASS
299
+ $list .= "());";
300
+
301
+ $vars['menu_toggle_blocks'] = $list;
302
+
303
+ } else {
304
+
305
+ $vars['menu_toggle_blocks'] = "()";
306
+
307
+ }
308
+
309
+ return $vars;
310
+ }
311
+
312
+ /**
313
+ * Create a new variable containing the spacer blocks to be used by the SCSS file
314
+ *
315
+ * @param array $vars
316
+ * @param string $location
317
+ * @param string $theme
318
+ * @param int $menu_id
319
+ * @param string $theme_id
320
+ * @return array - all custom SCSS vars
321
+ * @since 2.1
322
+ */
323
+ public function add_spacer_block_vars_to_scss( $vars, $location, $theme, $menu_id, $theme_id ) {
324
+
325
+ $toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
326
+
327
+ $menu_toggle_blocks = array();
328
+
329
+ if ( is_array( $toggle_blocks ) ) {
330
+
331
+ foreach( $toggle_blocks as $index => $settings ) {
332
+
333
+ if ( isset( $settings['type'] ) && $settings['type'] == 'spacer' ) {
334
+
335
+ $styles = array(
336
+ 'id' => $index,
337
+ 'align' => isset($settings['align']) ? "'" . $settings['align'] . "'" : "'right'",
338
+ 'width' => isset($settings['width']) ? "'" . $settings['width'] . "'" : '0px',
339
+ );
340
+
341
+ $spacer_blocks[ $index ] = $styles;
342
+ }
343
+
344
+ }
345
+ }
346
+
347
+ //$menu_toggle_blocks(
348
+ // (123, red, 150px),
349
+ // (456, green, null),
350
+ // (789, blue, 90%),());
351
+ if ( count( $spacer_blocks ) ) {
352
+
353
+ $list = "(";
354
+
355
+ foreach ( $spacer_blocks as $id => $vals ) {
356
+ $list .= "(" . implode( ",", $vals ) . "),";
357
+ }
358
+
359
+ // Always add an empty list item to meke sure there are always at least 2 items in the list
360
+ // Lists with a single item are not treated the same way by SASS
361
+ $list .= "());";
362
+
363
+ $vars['spacer_blocks'] = $list;
364
+
365
+ } else {
366
+
367
+ $vars['spacer_blocks'] = "()";
368
+
369
+ }
370
+
371
+ return $vars;
372
+
373
+ }
374
+
375
+
376
+ /**
377
+ * Print the toggle bar designer option
378
+ *
379
+ * @since 2.1
380
+ * @param string $key
381
+ * @param string $theme_id
382
+ */
383
+ public function print_theme_toggle_bar_designer_option( $key, $theme_id ) {
384
+
385
+ $toggle_blocks = $this->get_toggle_blocks_for_theme( $theme_id );
386
+
387
+ $block_types = apply_filters("megamenu_registered_toggle_blocks", array(
388
+ 'title' => __("Add block to toggle bar", "megamenu"),
389
+ 'menu_toggle' => __("Menu Toggle", "megamenu"),
390
+ 'spacer' => __("Spacer", "megamenu")
391
+ ));
392
+
393
+ ?>
394
+
395
+ <select id='toggle-block-selector'>
396
+ <?php foreach( $block_types as $block_id => $block_name ) : ?>
397
+ <option value='<?php echo $block_id; ?>'><?php echo $block_name ?></option>
398
+ <?php endforeach; ?>
399
+ </select>
400
+
401
+ <div class='toggle-bar-designer'>
402
+ <div class='mega-blocks'>
403
+ <div class='mega-left'>
404
+ <?php
405
+
406
+ if ( is_array( $toggle_blocks ) ) {
407
+ foreach( $toggle_blocks as $block_id => $settings ) {
408
+ if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'left' || ! isset( $settings['align'] ) ) {
409
+ do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
410
+ }
411
+ }
412
+ }
413
+
414
+ ?>
415
+ </div>
416
+ <div class='mega-center'>
417
+ <?php
418
+
419
+ if ( is_array( $toggle_blocks ) ) {
420
+ foreach( $toggle_blocks as $block_id => $settings ) {
421
+ if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'center' ) {
422
+ do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
423
+ }
424
+ }
425
+ }
426
+
427
+ ?>
428
+ </div>
429
+ <div class='mega-right'>
430
+ <?php
431
+
432
+ if ( is_array( $toggle_blocks ) ) {
433
+ foreach( $toggle_blocks as $block_id => $settings ) {
434
+ if ( is_int( $block_id ) && is_array( $settings ) && isset( $settings['align'] ) && $settings['align'] == 'right' ) {
435
+ do_action( "megamenu_output_admin_toggle_block_{$settings['type']}", $block_id, $settings );
436
+ }
437
+ }
438
+ }
439
+
440
+ ?>
441
+ </div>
442
+
443
+ </div>
444
+ </div>
445
+
446
+ <?php
447
+ }
448
+
449
+
450
+ /**
451
+ * Output the HTML for the "Spacer" toggle block settings
452
+ *
453
+ * @since 2.1
454
+ * @param int $block_id
455
+ * @param array $settings
456
+ */
457
+ public function output_spacer_block_html( $block_id, $settings = array() ) {
458
+
459
+ if ( empty( $settings ) ) {
460
+ $block_id = "0";
461
+ }
462
+
463
+ $defaults = array(
464
+ 'align' => 'right',
465
+ 'width' => '0px'
466
+ );
467
+
468
+ $settings = array_merge( $defaults, $settings );
469
+
470
+ ?>
471
+
472
+ <div class='block'>
473
+ <div class='block-title'><span title='<?php _e("Spacer", "megamenu"); ?>' class="dashicons dashicons-leftright"></span></div>
474
+ <div class='block-settings'>
475
+ <h3><?php _e("Spacer Settings", "megamenu") ?></h3>
476
+ <input type='hidden' class='type' name='toggle_blocks[<?php echo $block_id; ?>][type]' value='spacer' />
477
+ <input type='hidden' class='align' name='toggle_blocks[<?php echo $block_id; ?>][align]' value='<?php echo $settings['align'] ?>'>
478
+ <label>
479
+ <?php _e("Width", "megamenu") ?><input type='text' class='closed_text' name='toggle_blocks[<?php echo $block_id; ?>][width]' value='<?php echo $settings['width'] ?>' />
480
+ </label>
481
+ <a class='mega-delete'><?php _e("Delete", "megamenu"); ?></a>
482
+ </div>
483
+ </div>
484
+
485
+ <?php
486
+ }
487
+
488
+
489
+ /**
490
+ * Output the HTML for the "Menu Toggle" block settings
491
+ *
492
+ * @since 2.1
493
+ * @param int $block_id
494
+ * @param array $settings
495
+ */
496
+ public function output_menu_toggle_block_html( $block_id, $settings = array() ) {
497
+
498
+ if ( empty( $settings ) ) {
499
+ $block_id = "0";
500
+ }
501
+
502
+ $defaults = $this->get_default_menu_toggle_block();
503
+
504
+ $settings = array_merge( $defaults, $settings );
505
+
506
+ ?>
507
+
508
+ <div class='block'>
509
+ <div class='block-title'><span title='<?php _e("Menu Toggle", "megamenu"); ?>' class="dashicons dashicons-menu"></span></div>
510
+ <div class='block-settings'>
511
+ <h3><?php _e("Menu Toggle Settings", "megamenu") ?></h3>
512
+ <input type='hidden' class='type' name='toggle_blocks[<?php echo $block_id; ?>][type]' value='menu_toggle' />
513
+ <input type='hidden' class='align' name='toggle_blocks[<?php echo $block_id; ?>][align]' value='<?php echo $settings['align'] ?>'>
514
+ <label>
515
+ <?php _e("Closed Text", "megamenu") ?><input type='text' class='closed_text' name='toggle_blocks[<?php echo $block_id; ?>][closed_text]' value='<?php echo $settings['closed_text'] ?>' />
516
+ </label>
517
+ <label>
518
+ <?php _e("Open Text", "megamenu") ?><input type='text' class='open_text' name='toggle_blocks[<?php echo $block_id; ?>][open_text]' value='<?php echo $settings['open_text'] ?>' />
519
+ </label>
520
+ <label>
521
+ <?php _e("Closed Icon", "megamenu") ?>
522
+ <?php $this->print_toggle_icon_option( 'closed_icon', $block_id, $settings['closed_icon'] ); ?>
523
+ </label>
524
+ <label>
525
+ <?php _e("Open Icon", "megamenu") ?>
526
+ <?php $this->print_toggle_icon_option( 'open_icon', $block_id, $settings['open_icon'] ); ?>
527
+ </label>
528
+ <label>
529
+ <?php _e("Text Color", "megamenu") ?>
530
+ <?php $this->print_toggle_color_option( 'text_color', $block_id, $settings['text_color'] ); ?>
531
+ </label>
532
+ <label>
533
+ <?php _e("Icon Color", "megamenu") ?>
534
+ <?php $this->print_toggle_color_option( 'icon_color', $block_id, $settings['icon_color'] ); ?>
535
+ </label>
536
+ <label>
537
+ <?php _e("Icon Position", "megamenu") ?><select name='toggle_blocks[<?php echo $block_id; ?>][icon_position]'>
538
+ <option value='before' <?php selected( $settings['icon_position'], "before" ) ?> ><?php _e("Before", "megamenu") ?></option>
539
+ <option value='after' <?php selected( $settings['icon_position'], "after" ) ?> ><?php _e("After", "megamenu") ?></option>
540
+ </select>
541
+ </label>
542
+ <a class='mega-delete'><?php _e("Delete", "megamenu"); ?></a>
543
+ </div>
544
+ </div>
545
+
546
+ <?php
547
+ }
548
+
549
+
550
+ /**
551
+ * Print a toggle icon selection box
552
+ *
553
+ * @since 2.1
554
+ * @param string $key
555
+ * @param int $block_id
556
+ * @param string $value
557
+ */
558
+ public function print_toggle_icon_option( $key, $block_id, $value ) {
559
+
560
+ $all_icons = $this->toggle_icons();
561
+
562
+ ?>
563
+ <select class='icon_dropdown' name='toggle_blocks[<?php echo $block_id ?>][<?php echo $key ?>]'>
564
+ <?php
565
+
566
+ echo "<option value='disabled'>" . __("Disabled", "megamenu") . "</option>";
567
+
568
+ foreach ($all_icons as $code => $class) {
569
+ $name = str_replace('dashicons-', '', $class);
570
+ $name = ucwords(str_replace(array('-','arrow'), ' ', $name));
571
+ echo "<option data-class='{$class}' value='{$code}'" . selected( $value, $code, false ) . ">" . $name . "</option>";
572
+ }
573
+
574
+ ?>
575
+ </select>
576
+
577
+ <?php
578
+ }
579
+
580
+
581
+ /**
582
+ * Print a color picker
583
+ *
584
+ * @since 2.1
585
+ * @param string $key
586
+ * @param int $block_id
587
+ * @param string $value
588
+ */
589
+ public function print_toggle_color_option( $key, $block_id, $value ) {
590
+
591
+ if ( $value == 'transparent' ) {
592
+ $value = 'rgba(0,0,0,0)';
593
+ }
594
+
595
+ if ( $value == 'rgba(0,0,0,0)' ) {
596
+ $value_text = 'transparent';
597
+ } else {
598
+ $value_text = $value;
599
+ }
600
+
601
+ echo "<div class='mm-picker-container'>";
602
+ echo " <input type='text' class='mm_colorpicker' name='toggle_blocks[{$block_id}][{$key}]' value='{$value}' />";
603
+ echo " <div class='chosen-color'>{$value_text}</div>";
604
+ echo "</div>";
605
+
606
+ }
607
+
608
+
609
+ /**
610
+ * List of all available toggle DashIcon classes.
611
+ *
612
+ * @since 2.1
613
+ * @return array - Sorted list of toggle classes
614
+ */
615
+ private function toggle_icons() {
616
+
617
+ $icons = array(
618
+ 'dash-f333' => 'dashicons-menu',
619
+ 'dash-f214' => 'dashicons-editor-justify',
620
+ 'dash-f158' => 'dashicons-no',
621
+ 'dash-f335' => 'dashicons-no-alt',
622
+ 'dash-f132' => 'dashicons-plus',
623
+ 'dash-f502' => 'dashicons-plus-alt',
624
+ 'dash-f460' => 'dashicons-minus',
625
+ 'dash-f153' => 'dashicons-dismiss',
626
+ 'dash-f142' => 'dashicons-arrow-up',
627
+ 'dash-f140' => 'dashicons-arrow-down',
628
+ 'dash-f342' => 'dashicons-arrow-up-alt',
629
+ 'dash-f346' => 'dashicons-arrow-down-alt',
630
+ 'dash-f343' => 'dashicons-arrow-up-alt2',
631
+ 'dash-f347' => 'dashicons-arrow-down-alt2',
632
+ );
633
+
634
+ $icons = apply_filters( "megamenu_toggle_icons", $icons );
635
+
636
+ return $icons;
637
+
638
+ }
639
+
640
+ }
641
+
642
+ endif;
classes/walker.class.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if( ! class_exists( 'Mega_Menu_Walker' ) ) :
8
+
9
+ /**
10
+ * @package WordPress
11
+ * @since 1.0.0
12
+ * @uses Walker
13
+ */
14
+ class Mega_Menu_Walker extends Walker_Nav_Menu {
15
+
16
+ /**
17
+ * Starts the list before the elements are added.
18
+ *
19
+ * @see Walker::start_lvl()
20
+ *
21
+ * @since 1.0
22
+ *
23
+ * @param string $output Passed by reference. Used to append additional content.
24
+ * @param int $depth Depth of menu item. Used for padding.
25
+ * @param array $args An array of arguments. @see wp_nav_menu()
26
+ */
27
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
28
+
29
+ $indent = str_repeat("\t", $depth);
30
+
31
+ $output .= "\n$indent<ul class=\"mega-sub-menu\">\n";
32
+ }
33
+
34
+ /**
35
+ * Ends the list of after the elements are added.
36
+ *
37
+ * @see Walker::end_lvl()
38
+ *
39
+ * @since 1.0
40
+ *
41
+ * @param string $output Passed by reference. Used to append additional content.
42
+ * @param int $depth Depth of menu item. Used for padding.
43
+ * @param array $args An array of arguments. @see wp_nav_menu()
44
+ */
45
+ function end_lvl( &$output, $depth = 0, $args = array() ) {
46
+ $indent = str_repeat("\t", $depth);
47
+ $output .= "$indent</ul>\n";
48
+ }
49
+
50
+ /**
51
+ * Custom walker. Add the widgets into the menu.
52
+ *
53
+ * @see Walker::start_el()
54
+ *
55
+ * @since 1.0
56
+ *
57
+ * @param string $output Passed by reference. Used to append additional content.
58
+ * @param object $item Menu item data object.
59
+ * @param int $depth Depth of menu item. Used for padding.
60
+ * @param array $args An array of arguments. @see wp_nav_menu()
61
+ * @param int $id Current item ID.
62
+ */
63
+ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
64
+
65
+ $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
66
+
67
+ if ( property_exists( $item, 'megamenu_settings' ) ) {
68
+ $settings = $item->megamenu_settings;
69
+ } else {
70
+ $settings = Mega_Menu_Nav_Menus::get_menu_item_defaults();
71
+ }
72
+
73
+ // Item Class
74
+ $classes = empty( $item->classes ) ? array() : (array) $item->classes;
75
+
76
+ $classes[] = 'menu-item-' . $item->ID;
77
+
78
+ $class = join( ' ', apply_filters( 'megamenu_nav_menu_css_class', array_filter( $classes ), $item, $args ) );
79
+
80
+ // strip widget classes back to how they're intended to be output
81
+ $class = str_replace( "mega-menu-widget-class-", "", $class );
82
+
83
+ // Item ID
84
+ $id = esc_attr( apply_filters( 'megamenu_nav_menu_item_id', "mega-menu-item-{$item->ID}", $item, $args ) );
85
+
86
+ $output .= "<li class='{$class}' id='{$id}'>";
87
+
88
+ // output the widgets
89
+ if ( $item->type == 'widget' && $item->content ) {
90
+
91
+ $item_output = $item->content;
92
+
93
+ } else {
94
+
95
+ $atts = array();
96
+
97
+ $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
98
+ $atts['target'] = ! empty( $item->target ) ? $item->target : '';
99
+ $atts['class'] = '';
100
+ $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
101
+
102
+ if ( $settings['disable_link'] != 'true') {
103
+ $atts['href'] = ! empty( $item->url ) ? $item->url : '';
104
+ }
105
+
106
+ if ( isset( $settings['icon']) && $settings['icon'] != 'disabled' ) {
107
+ $atts['class'] = $settings['icon'];
108
+ }
109
+
110
+ $atts = apply_filters( 'megamenu_nav_menu_link_attributes', $atts, $item, $args );
111
+
112
+ if ( strlen( $atts['class'] ) ) {
113
+ $atts['class'] = $atts['class'] . ' mega-menu-link';
114
+ } else {
115
+ $atts['class'] = 'mega-menu-link';
116
+ }
117
+
118
+ $attributes = '';
119
+
120
+ foreach ( $atts as $attr => $value ) {
121
+
122
+ if ( ! empty( $value ) ) {
123
+ $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
124
+ $attributes .= ' ' . $attr . '="' . $value . '"';
125
+ }
126
+
127
+ }
128
+
129
+ $item_output = $args->before;
130
+ $item_output .= '<a'. $attributes .'>';
131
+
132
+ if ( $settings['hide_text'] == 'true' && $depth == 0 ) {
133
+ /** This filter is documented in wp-includes/post-template.php */
134
+ } else {
135
+ $item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
136
+ }
137
+
138
+ $item_output .= '</a>';
139
+ $item_output .= $args->after;
140
+
141
+ }
142
+
143
+ $output .= apply_filters( 'megamenu_walker_nav_menu_start_el', $item_output, $item, $depth, $args );
144
+ }
145
+
146
+ /**
147
+ * Ends the element output, if needed.
148
+ *
149
+ * @see Walker::end_el()
150
+ *
151
+ * @since 1.7
152
+ *
153
+ * @param string $output Passed by reference. Used to append additional content.
154
+ * @param object $item Page data object. Not used.
155
+ * @param int $depth Depth of page. Not Used.
156
+ * @param array $args An array of arguments. @see wp_nav_menu()
157
+ */
158
+ public function end_el( &$output, $item, $depth = 0, $args = array() ) {
159
+ $output .= "</li>"; // remove new line to remove the 4px gap between menu items
160
+ }
161
+ }
162
+
163
+ endif;
classes/widget-manager.class.php ADDED
@@ -0,0 +1,1017 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists('Mega_Menu_Widget_Manager') ) :
8
+
9
+ /**
10
+ * Processes AJAX requests from the Mega Menu panel editor.
11
+ * Also registers our widget sidebar.
12
+ *
13
+ * There is very little in WordPress core to help with listing, editing, saving,
14
+ * deleting widgets etc so this class implements that functionality.
15
+ */
16
+ class Mega_Menu_Widget_Manager {
17
+
18
+ /**
19
+ * Constructor
20
+ *
21
+ * @since 1.0
22
+ */
23
+ public function __construct() {
24
+
25
+ add_action( 'init', array( $this, 'register_sidebar' ) );
26
+
27
+ add_action( 'wp_ajax_mm_edit_widget', array( $this, 'ajax_show_widget_form' ) );
28
+ add_action( 'wp_ajax_mm_save_widget', array( $this, 'ajax_save_widget' ) );
29
+ add_action( 'wp_ajax_mm_update_widget_columns', array( $this, 'ajax_update_widget_columns' ) );
30
+ add_action( 'wp_ajax_mm_update_menu_item_columns', array( $this, 'ajax_update_menu_item_columns' ) );
31
+ add_action( 'wp_ajax_mm_delete_widget', array( $this, 'ajax_delete_widget' ) );
32
+ add_action( 'wp_ajax_mm_add_widget', array( $this, 'ajax_add_widget' ) );
33
+ add_action( 'wp_ajax_mm_reorder_items', array( $this, 'ajax_reorder_items' ) );
34
+
35
+ add_filter( 'widget_update_callback', array( $this, 'persist_mega_menu_widget_settings'), 10, 4 );
36
+
37
+ add_action( 'megamenu_after_widget_add', array( $this, 'clear_caches' ) );
38
+ add_action( 'megamenu_after_widget_save', array( $this, 'clear_caches' ) );
39
+ add_action( 'megamenu_after_widget_delete', array( $this, 'clear_caches' ) );
40
+
41
+ }
42
+
43
+
44
+ /**
45
+ * Depending on how a widget has been written, it may not necessarily base the new widget settings on
46
+ * a copy the old settings. If this is the case, the mega menu data will be lost. This function
47
+ * checks to make sure widgets persist the mega menu data when they're saved.
48
+ *
49
+ * @since 1.0
50
+ */
51
+ public function persist_mega_menu_widget_settings( $instance, $new_instance, $old_instance, $that ) {
52
+
53
+ if ( isset( $old_instance["mega_menu_columns"] ) && ! isset( $new_instance["mega_menu_columns"] ) ) {
54
+ $instance["mega_menu_columns"] = $old_instance["mega_menu_columns"];
55
+ }
56
+
57
+ if ( isset( $old_instance["mega_menu_order"] ) && ! isset( $new_instance["mega_menu_order"] ) ) {
58
+ $instance["mega_menu_order"] = $old_instance["mega_menu_order"];
59
+ }
60
+
61
+ if ( isset( $old_instance["mega_menu_parent_menu_id"] ) && ! isset( $new_instance["mega_menu_parent_menu_id"] ) ) {
62
+ $instance["mega_menu_parent_menu_id"] = $old_instance["mega_menu_parent_menu_id"];
63
+ }
64
+
65
+ return $instance;
66
+ }
67
+
68
+
69
+ /**
70
+ * Create our own widget area to store all mega menu widgets.
71
+ * All widgets from all menus are stored here, they are filtered later
72
+ * to ensure the correct widgets show under the correct menu item.
73
+ *
74
+ * @since 1.0
75
+ */
76
+ public function register_sidebar() {
77
+
78
+ register_sidebar(
79
+ array(
80
+ 'id' => 'mega-menu',
81
+ 'name' => __("Mega Menu Widgets", "megamenu"),
82
+ 'description' => __("Do not manually edit this area.", "megamenu")
83
+ )
84
+ );
85
+ }
86
+
87
+
88
+ /**
89
+ * Display a widget settings form
90
+ *
91
+ * @since 1.0
92
+ */
93
+ public function ajax_show_widget_form() {
94
+
95
+ check_ajax_referer( 'megamenu_edit' );
96
+
97
+ $widget_id = sanitize_text_field( $_POST['widget_id'] );
98
+
99
+ if ( ob_get_contents() ) ob_clean(); // remove any warnings or output from other plugins which may corrupt the response
100
+
101
+ wp_die( trim( $this->show_widget_form( $widget_id ) ) );
102
+
103
+ }
104
+
105
+
106
+ /**
107
+ * Save a widget
108
+ *
109
+ * @since 1.0
110
+ */
111
+ public function ajax_save_widget() {
112
+
113
+ $widget_id = sanitize_text_field( $_POST['widget_id'] );
114
+ $id_base = sanitize_text_field( $_POST['id_base'] );
115
+
116
+ check_ajax_referer( 'megamenu_save_widget_' . $widget_id );
117
+
118
+ $saved = $this->save_widget( $id_base );
119
+
120
+ if ( $saved ) {
121
+ $this->send_json_success( sprintf( __("Saved %s", "megamenu"), $id_base ) );
122
+ } else {
123
+ $this->send_json_error( sprintf( __("Failed to save %s", "megamenu"), $id_base ) );
124
+ }
125
+
126
+ }
127
+
128
+
129
+ /**
130
+ * Update the number of mega columns for a widget
131
+ *
132
+ * @since 1.0
133
+ */
134
+ public function ajax_update_widget_columns() {
135
+
136
+ check_ajax_referer( 'megamenu_edit' );
137
+
138
+ $widget_id = sanitize_text_field( $_POST['id'] );
139
+ $columns = absint( $_POST['columns'] );
140
+
141
+ $updated = $this->update_widget_columns( $widget_id, $columns );
142
+
143
+ if ( $updated ) {
144
+ $this->send_json_success( sprintf( __( "Updated %s (new columns: %d)", "megamenu"), $widget_id, $columns ) );
145
+ } else {
146
+ $this->send_json_error( sprintf( __( "Failed to update %s", "megamenu"), $widget_id ) );
147
+ }
148
+
149
+ }
150
+
151
+
152
+ /**
153
+ * Update the number of mega columns for a widget
154
+ *
155
+ * @since 1.0
156
+ */
157
+ public function ajax_update_menu_item_columns() {
158
+
159
+ check_ajax_referer( 'megamenu_edit' );
160
+
161
+ $id = absint( $_POST['id'] );
162
+ $columns = absint( $_POST['columns'] );
163
+
164
+ $updated = $this->update_menu_item_columns( $id, $columns );
165
+
166
+ if ( $updated ) {
167
+ $this->send_json_success( sprintf( __( "Updated %s (new columns: %d)", "megamenu"), $id, $columns ) );
168
+ } else {
169
+ $this->send_json_error( sprintf( __( "Failed to update %s", "megamenu"), $id ) );
170
+ }
171
+
172
+ }
173
+
174
+
175
+ /**
176
+ * Add a widget to the panel
177
+ *
178
+ * @since 1.0
179
+ */
180
+ public function ajax_add_widget() {
181
+
182
+ check_ajax_referer( 'megamenu_edit' );
183
+
184
+ $id_base = sanitize_text_field( $_POST['id_base'] );
185
+ $menu_item_id = absint( $_POST['menu_item_id'] );
186
+ $title = sanitize_text_field( $_POST['title'] );
187
+
188
+ $added = $this->add_widget( $id_base, $menu_item_id, $title );
189
+
190
+ if ( $added ) {
191
+ $this->send_json_success( $added );
192
+ } else {
193
+ $this->send_json_error( sprintf( __("Failed to add %s to %d", "megamenu"), $id_base, $menu_item_id ) );
194
+ }
195
+
196
+ }
197
+
198
+
199
+ /**
200
+ * Deletes a widget
201
+ *
202
+ * @since 1.0
203
+ */
204
+ public function ajax_delete_widget() {
205
+
206
+ check_ajax_referer( 'megamenu_edit' );
207
+
208
+ $widget_id = sanitize_text_field( $_POST['widget_id'] );
209
+
210
+ $deleted = $this->delete_widget( $widget_id );
211
+
212
+ if ( $deleted ) {
213
+ $this->send_json_success( sprintf( __( "Deleted %s", "megamenu"), $widget_id ) );
214
+ } else {
215
+ $this->send_json_error( sprintf( __( "Failed to delete %s", "megamenu"), $widget_id ) );
216
+ }
217
+
218
+ }
219
+
220
+
221
+ /**
222
+ * Moves a widget to a new position
223
+ *
224
+ * @since 1.0
225
+ */
226
+ public function ajax_reorder_items() {
227
+
228
+ check_ajax_referer( 'megamenu_edit' );
229
+
230
+ $items = isset( $_POST['items'] ) ? $_POST['items'] : false;
231
+
232
+ $saved = false;
233
+
234
+ if ( $items ) {
235
+ $moved = $this->reorder_items( $items );
236
+ }
237
+
238
+ if ( $moved ) {
239
+ $this->send_json_success( sprintf( __( "Moved (%s)", "megamenu"), json_encode( $items ) ) );
240
+ } else {
241
+ $this->send_json_error( sprintf( __( "Didn't move items", "megamenu"), json_encode( $items ) ) );
242
+ }
243
+
244
+ }
245
+
246
+
247
+ /**
248
+ * Returns an object representing all widgets registered in WordPress
249
+ *
250
+ * @since 1.0
251
+ */
252
+ public function get_available_widgets() {
253
+ global $wp_widget_factory;
254
+
255
+ $widgets = array();
256
+
257
+ foreach( $wp_widget_factory->widgets as $widget ) {
258
+
259
+ $disabled_widgets = array('maxmegamenu');
260
+
261
+ $disabled_widgets = apply_filters( "megamenu_incompatible_widgets", $disabled_widgets );
262
+
263
+ if ( ! in_array( $widget->id_base, $disabled_widgets ) ) {
264
+
265
+ $widgets[] = array(
266
+ 'text' => $widget->name,
267
+ 'value' => $widget->id_base
268
+ );
269
+
270
+ }
271
+
272
+ }
273
+
274
+ uasort( $widgets, array( $this, 'sort_by_text' ) );
275
+
276
+ return $widgets;
277
+
278
+ }
279
+
280
+
281
+ /**
282
+ * Sorts a 2d array by the 'text' key
283
+ *
284
+ * @since 1.2
285
+ * @param array $a
286
+ * @param array $b
287
+ */
288
+ function sort_by_text( $a, $b ) {
289
+ return strcmp( $a['text'], $b['text'] );
290
+ }
291
+
292
+
293
+ /**
294
+ * Sorts a 2d array by the 'order' key
295
+ *
296
+ * @since 2.0
297
+ * @param array $a
298
+ * @param array $b
299
+ */
300
+ function sort_by_order( $a, $b ) {
301
+
302
+ if ($a['order'] == $b['order']) {
303
+ return 1;
304
+ }
305
+ return ($a['order'] < $b['order']) ? -1 : 1;
306
+
307
+ }
308
+
309
+
310
+ /**
311
+ * Returns an array of immediate child menu items for the current item
312
+ *
313
+ * @since 1.5
314
+ * @return array
315
+ */
316
+ private function get_second_level_menu_items( $parent_menu_item_id, $menu_id ) {
317
+
318
+ $items = array();
319
+
320
+ // check we're using a valid menu ID
321
+ if ( ! is_nav_menu( $menu_id ) ) {
322
+ return $items;
323
+ }
324
+
325
+ $menu = wp_get_nav_menu_items( $menu_id );
326
+
327
+ if ( count( $menu ) ) {
328
+
329
+ foreach ( $menu as $item ) {
330
+
331
+ // find the child menu items
332
+ if ( $item->menu_item_parent == $parent_menu_item_id ) {
333
+
334
+ $saved_settings = array_filter( (array) get_post_meta( $item->ID, '_megamenu', true ) );
335
+
336
+ $settings = array_merge( Mega_Menu_Nav_Menus::get_menu_item_defaults(), $saved_settings );
337
+
338
+ $items[ $item->ID ] = array(
339
+ 'id' => $item->ID,
340
+ 'type' => 'menu_item',
341
+ 'title' => $item->title,
342
+ 'columns' => $settings['mega_menu_columns'],
343
+ 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0
344
+ );
345
+
346
+ }
347
+
348
+ }
349
+
350
+ }
351
+
352
+ return $items;
353
+ }
354
+
355
+ /**
356
+ * Returns an array of all widgets belonging to a specified menu item ID.
357
+ *
358
+ * @since 1.0
359
+ * @param int $menu_item_id
360
+ */
361
+ public function get_widgets_for_menu_id( $parent_menu_item_id, $menu_id ) {
362
+
363
+ $widgets = array();
364
+
365
+ if ( $mega_menu_widgets = $this->get_mega_menu_sidebar_widgets() ) {
366
+
367
+ foreach ( $mega_menu_widgets as $widget_id ) {
368
+
369
+ $settings = $this->get_settings_for_widget_id( $widget_id );
370
+
371
+ if ( isset( $settings['mega_menu_parent_menu_id'] ) && $settings['mega_menu_parent_menu_id'] == $parent_menu_item_id ) {
372
+
373
+ $name = $this->get_name_for_widget_id( $widget_id );
374
+
375
+ $widgets[ $widget_id ] = array(
376
+ 'id' => $widget_id,
377
+ 'type' => 'widget',
378
+ 'title' => $name,
379
+ 'columns' => $settings['mega_menu_columns'],
380
+ 'order' => isset( $settings['mega_menu_order'][ $parent_menu_item_id ] ) ? $settings['mega_menu_order'][ $parent_menu_item_id ] : 0
381
+ );
382
+
383
+ }
384
+
385
+ }
386
+
387
+ }
388
+
389
+ return $widgets;
390
+
391
+ }
392
+
393
+
394
+ /**
395
+ * Returns an array of widgets and second level menu items for a specified parent menu item.
396
+ * Used to display the widgets/menu items in the mega menu builder.
397
+ *
398
+ * @since 2.0
399
+ * @param int $parent_menu_item_id
400
+ * @param int $menu_id
401
+ * @return array
402
+ */
403
+ public function get_widgets_and_menu_items_for_menu_id( $parent_menu_item_id, $menu_id ) {
404
+
405
+ $menu_items = $this->get_second_level_menu_items( $parent_menu_item_id, $menu_id );
406
+ $widgets = $this->get_widgets_for_menu_id( $parent_menu_item_id, $menu_id );
407
+
408
+ $items = array_merge( $menu_items, $widgets );
409
+
410
+ $parent_settings = get_post_meta( $parent_menu_item_id, '_megamenu', true );
411
+
412
+ $ordering = isset( $parent_settings['submenu_ordering'] ) ? $parent_settings['submenu_ordering'] : 'natural';
413
+
414
+ if ( $ordering == 'forced' ) {
415
+
416
+ uasort( $items, array( $this, 'sort_by_order' ) );
417
+
418
+ $new_items = $items;
419
+ $end_items = array();
420
+
421
+ foreach ( $items as $key => $value ) {
422
+ if ( $value['order'] == 0 ) {
423
+ unset( $new_items[$key] );
424
+ $end_items[] = $value;
425
+ }
426
+ }
427
+
428
+ $items = array_merge( $new_items, $end_items );
429
+
430
+ }
431
+
432
+ return $items;
433
+ }
434
+
435
+
436
+ /**
437
+ * Returns the widget data as stored in the options table
438
+ *
439
+ * @since 1.8.1
440
+ * @param string $widget_id
441
+ */
442
+ public function get_settings_for_widget_id( $widget_id ) {
443
+
444
+ $id_base = $this->get_id_base_for_widget_id( $widget_id );
445
+
446
+ if ( ! $id_base ) {
447
+ return false;
448
+ }
449
+
450
+ $widget_number = $this->get_widget_number_for_widget_id( $widget_id );
451
+
452
+ $current_widgets = get_option( 'widget_' . $id_base );
453
+
454
+ return $current_widgets[ $widget_number ];
455
+
456
+ }
457
+
458
+
459
+ /**
460
+ * Returns the widget ID (number)
461
+ *
462
+ * @since 1.0
463
+ * @param string $widget_id - id_base-ID (eg meta-3)
464
+ * @return int
465
+ */
466
+ public function get_widget_number_for_widget_id( $widget_id ) {
467
+
468
+ $parts = explode( "-", $widget_id );
469
+
470
+ return absint( end( $parts ) );
471
+
472
+ }
473
+
474
+
475
+ /**
476
+ * Returns the name/title of a Widget
477
+ *
478
+ * @since 1.0
479
+ * @param $widget_id - id_base-ID (eg meta-3)
480
+ */
481
+ public function get_name_for_widget_id( $widget_id ) {
482
+ global $wp_registered_widgets;
483
+
484
+ $registered_widget = $wp_registered_widgets[$widget_id];
485
+
486
+ return $registered_widget['name'];
487
+
488
+ }
489
+
490
+
491
+ /**
492
+ * Returns the id_base value for a Widget ID
493
+ *
494
+ * @since 1.0
495
+ */
496
+ public function get_id_base_for_widget_id( $widget_id ) {
497
+ global $wp_registered_widget_controls;
498
+
499
+ if ( ! isset( $wp_registered_widget_controls[ $widget_id ] ) ) {
500
+ return false;
501
+ }
502
+
503
+ $control = $wp_registered_widget_controls[ $widget_id ];
504
+
505
+ $id_base = isset( $control['id_base'] ) ? $control['id_base'] : $control['id'];
506
+
507
+ return $id_base;
508
+
509
+ }
510
+
511
+
512
+ /**
513
+ * Returns the HTML for a single widget instance.
514
+ *
515
+ * @since 1.0
516
+ * @param string widget_id Something like meta-3
517
+ */
518
+ public function show_widget( $id ) {
519
+ global $wp_registered_widgets;
520
+
521
+ $params = array_merge(
522
+ array( array_merge( array( 'widget_id' => $id, 'widget_name' => $wp_registered_widgets[$id]['name'] ) ) ),
523
+ (array) $wp_registered_widgets[$id]['params']
524
+ );
525
+
526
+ $params[0]['before_title'] = apply_filters( "megamenu_before_widget_title", '<h4 class="mega-block-title">', $wp_registered_widgets[$id] );
527
+ $params[0]['after_title'] = apply_filters( "megamenu_after_widget_title", '</h4>', $wp_registered_widgets[$id] );
528
+ $params[0]['before_widget'] = apply_filters( "megamenu_before_widget", "", $wp_registered_widgets[$id] );
529
+ $params[0]['after_widget'] = apply_filters( "megamenu_after_widget", "", $wp_registered_widgets[$id] );
530
+
531
+ $callback = $wp_registered_widgets[$id]['callback'];
532
+
533
+ if ( is_callable( $callback ) ) {
534
+ ob_start();
535
+ call_user_func_array( $callback, $params );
536
+ return ob_get_clean();
537
+ }
538
+
539
+ }
540
+
541
+
542
+ /**
543
+ * Returns the class name for a widget instance.
544
+ *
545
+ * @since 1.8.1
546
+ * @param string widget_id Something like meta-3
547
+ */
548
+ public function get_widget_class( $id ) {
549
+ global $wp_registered_widgets;
550
+
551
+ if ( isset ( $wp_registered_widgets[$id]['classname'] ) ) {
552
+ return $wp_registered_widgets[$id]['classname'];
553
+ }
554
+
555
+ return "";
556
+ }
557
+
558
+
559
+ /**
560
+ * Shows the widget edit form for the specified widget.
561
+ *
562
+ * @since 1.0
563
+ * @param $widget_id - id_base-ID (eg meta-3)
564
+ */
565
+ public function show_widget_form( $widget_id ) {
566
+ global $wp_registered_widget_controls;
567
+
568
+ $control = $wp_registered_widget_controls[ $widget_id ];
569
+
570
+ $id_base = $this->get_id_base_for_widget_id( $widget_id );
571
+
572
+ $widget_number = $this->get_widget_number_for_widget_id( $widget_id );
573
+
574
+ $nonce = wp_create_nonce('megamenu_save_widget_' . $widget_id);
575
+
576
+ ?>
577
+
578
+ <div class='widget-content'>
579
+ <form method='post'>
580
+ <input type="hidden" name="widget-id" class="widget-id" value="<?php echo $widget_id ?>" />
581
+ <input type='hidden' name='action' value='mm_save_widget' />
582
+ <input type='hidden' name='id_base' value='<?php echo $id_base; ?>' />
583
+ <input type='hidden' name='widget_id' value='<?php echo $widget_id ?>' />
584
+ <input type='hidden' name='_wpnonce' value='<?php echo $nonce ?>' />
585
+
586
+ <?php
587
+ if ( is_callable( $control['callback'] ) ) {
588
+ call_user_func_array( $control['callback'], $control['params'] );
589
+ }
590
+ ?>
591
+
592
+ <div class='widget-controls'>
593
+ <a class='delete' href='#delete'><?php _e("Delete", "megamenu"); ?></a> |
594
+ <a class='close' href='#close'><?php _e("Close", "megamenu"); ?></a>
595
+ </div>
596
+
597
+ <?php
598
+ submit_button( __( 'Save' ), 'button-primary alignright', 'savewidget', false );
599
+ ?>
600
+ </form>
601
+ </div>
602
+
603
+ <?php
604
+ }
605
+
606
+
607
+ /**
608
+ * Saves a widget. Calls the update callback on the widget.
609
+ * The callback inspects the post values and updates all widget instances which match the base ID.
610
+ *
611
+ * @since 1.0
612
+ * @param string $id_base - e.g. 'meta'
613
+ * @return bool
614
+ */
615
+ public function save_widget( $id_base ) {
616
+ global $wp_registered_widget_updates;
617
+
618
+ $control = $wp_registered_widget_updates[$id_base];
619
+
620
+ if ( is_callable( $control['callback'] ) ) {
621
+
622
+ call_user_func_array( $control['callback'], $control['params'] );
623
+
624
+ do_action( "megamenu_after_widget_save" );
625
+
626
+ return true;
627
+ }
628
+
629
+ return false;
630
+
631
+ }
632
+
633
+
634
+ /**
635
+ * Adds a widget to WordPress. First creates a new widget instance, then
636
+ * adds the widget instance to the mega menu widget sidebar area.
637
+ *
638
+ * @since 1.0
639
+ * @param string $id_base
640
+ * @param int $menu_item_id
641
+ * @param string $title
642
+ */
643
+ public function add_widget( $id_base, $menu_item_id, $title ) {
644
+
645
+ require_once( ABSPATH . 'wp-admin/includes/widgets.php' );
646
+
647
+ $next_id = next_widget_id_number( $id_base );
648
+
649
+ $this->add_widget_instance( $id_base, $next_id, $menu_item_id );
650
+
651
+ $widget_id = $this->add_widget_to_sidebar( $id_base, $next_id );
652
+
653
+ $return = '<div class="widget" title="' . esc_attr( $title ) . '" data-columns="2" id="' . $widget_id . '" data-type="widget" data-id="' . $widget_id . '">';
654
+ $return .= ' <div class="widget-top">';
655
+ $return .= ' <div class="widget-title-action">';
656
+ $return .= ' <a class="widget-option widget-contract" title="' . esc_attr( __("Contract", "megamenu") ) . '"></a>';
657
+ $return .= ' <span class="widget-cols"><span class="widget-num-cols">2</span><span class="widget-of">/</span><span class="widget-total-cols">X</span></span>';
658
+ $return .= ' <a class="widget-option widget-expand" title="' . esc_attr( __("Expand", "megamenu") ) . '"></a>';
659
+ $return .= ' <a class="widget-option widget-action" title="' . esc_attr( __("Edit", "megamenu") ) . '"></a>';
660
+ $return .= ' </div>';
661
+ $return .= ' <div class="widget-title">';
662
+ $return .= ' <h4>' . esc_html( $title ) . '</h4>';
663
+ $return .= ' </div>';
664
+ $return .= ' </div>';
665
+ $return .= ' <div class="widget-inner"></div>';
666
+ $return .= '</div>';
667
+
668
+ return $return;
669
+
670
+ }
671
+
672
+
673
+ /**
674
+ * Adds a new widget instance of the specified base ID to the database.
675
+ *
676
+ * @since 1.0
677
+ * @param string $id_base
678
+ * @param int $next_id
679
+ * @param int $menu_item_id
680
+ */
681
+ private function add_widget_instance( $id_base, $next_id, $menu_item_id ) {
682
+
683
+ $current_widgets = get_option( 'widget_' . $id_base );
684
+
685
+ $current_widgets[ $next_id ] = array(
686
+ "mega_menu_columns" => 2,
687
+ "mega_menu_parent_menu_id" => $menu_item_id
688
+ );
689
+
690
+ update_option( 'widget_' . $id_base, $current_widgets );
691
+
692
+ }
693
+
694
+ /**
695
+ * Removes a widget instance from the database
696
+ *
697
+ * @since 1.0
698
+ * @param string $widget_id e.g. meta-3
699
+ * @return bool. True if widget has been deleted.
700
+ */
701
+ private function remove_widget_instance( $widget_id ) {
702
+
703
+ $id_base = $this->get_id_base_for_widget_id( $widget_id );
704
+ $widget_number = $this->get_widget_number_for_widget_id( $widget_id );
705
+
706
+ // add blank widget
707
+ $current_widgets = get_option( 'widget_' . $id_base );
708
+
709
+ if ( isset( $current_widgets[ $widget_number ] ) ) {
710
+
711
+ unset( $current_widgets[ $widget_number ] );
712
+
713
+ update_option( 'widget_' . $id_base, $current_widgets );
714
+
715
+ return true;
716
+
717
+ }
718
+
719
+ return false;
720
+
721
+ }
722
+
723
+
724
+ /**
725
+ * Updates the number of mega columns for a specified widget.
726
+ *
727
+ * @since 1.0
728
+ * @param string $widget_id
729
+ * @param int $columns
730
+ */
731
+ public function update_widget_columns( $widget_id, $columns ) {
732
+
733
+ $id_base = $this->get_id_base_for_widget_id( $widget_id );
734
+
735
+ $widget_number = $this->get_widget_number_for_widget_id( $widget_id );
736
+
737
+ $current_widgets = get_option( 'widget_' . $id_base );
738
+
739
+ $current_widgets[ $widget_number ]["mega_menu_columns"] = absint( $columns) ;
740
+
741
+ update_option( 'widget_' . $id_base, $current_widgets );
742
+
743
+ do_action( "megamenu_after_widget_save" );
744
+
745
+ return true;
746
+
747
+ }
748
+
749
+
750
+ /**
751
+ * Updates the number of mega columns for a specified widget.
752
+ *
753
+ * @since 1.10
754
+ * @param string $menu_item_id
755
+ * @param int $columns
756
+ */
757
+ public function update_menu_item_columns( $menu_item_id, $columns ) {
758
+
759
+ $settings = get_post_meta( $menu_item_id, '_megamenu', true);
760
+
761
+ $settings['mega_menu_columns'] = absint( $columns );
762
+
763
+ update_post_meta( $menu_item_id, '_megamenu', $settings );
764
+
765
+ return true;
766
+
767
+ }
768
+
769
+
770
+ /**
771
+ * Updates the order of a specified widget.
772
+ *
773
+ * @since 1.10
774
+ * @param string $widget_id
775
+ * @param int $columns
776
+ */
777
+ public function update_widget_order( $widget_id, $order, $parent_menu_item_id ) {
778
+
779
+ $id_base = $this->get_id_base_for_widget_id( $widget_id );
780
+
781
+ $widget_number = $this->get_widget_number_for_widget_id( $widget_id );
782
+
783
+ $current_widgets = get_option( 'widget_' . $id_base );
784
+
785
+ $current_widgets[ $widget_number ]["mega_menu_order"] = array( $parent_menu_item_id => absint( $order ) );
786
+
787
+ update_option( 'widget_' . $id_base, $current_widgets );
788
+
789
+ return true;
790
+
791
+ }
792
+
793
+
794
+ /**
795
+ * Updates the order of a specified menu item.
796
+ *
797
+ * @since 1.10
798
+ * @param string $menu_item_id
799
+ * @param int $order
800
+ */
801
+ public function update_menu_item_order( $menu_item_id, $order, $parent_menu_item_id ) {
802
+
803
+ $submitted_settings['mega_menu_order'] = array( $parent_menu_item_id => absint( $order ) );
804
+
805
+ $existing_settings = get_post_meta( $menu_item_id, '_megamenu', true);
806
+
807
+ if ( is_array( $existing_settings ) ) {
808
+
809
+ $submitted_settings = array_merge( $existing_settings, $submitted_settings );
810
+
811
+ }
812
+
813
+ update_post_meta( $menu_item_id, '_megamenu', $submitted_settings );
814
+
815
+ return true;
816
+
817
+ }
818
+
819
+
820
+ /**
821
+ * Deletes a widget from WordPress
822
+ *
823
+ * @since 1.0
824
+ * @param string $widget_id e.g. meta-3
825
+ */
826
+ public function delete_widget( $widget_id ) {
827
+
828
+ $this->remove_widget_from_sidebar( $widget_id );
829
+ $this->remove_widget_instance( $widget_id );
830
+
831
+ do_action( "megamenu_after_widget_delete" );
832
+
833
+ return true;
834
+
835
+ }
836
+
837
+
838
+ /**
839
+ * Moves a widget from one position to another.
840
+ *
841
+ * @since 1.10
842
+ * @param array $items
843
+ * @return string $widget_id. The widget that has been moved.
844
+ */
845
+ public function reorder_items( $items ) {
846
+
847
+ foreach ( $items as $item ) {
848
+
849
+ if ( $item['parent_menu_item'] ) {
850
+
851
+ $submitted_settings = array( 'submenu_ordering' => 'forced' );
852
+
853
+ $existing_settings = get_post_meta( $item['parent_menu_item'], '_megamenu', true );
854
+
855
+ if ( is_array( $existing_settings ) ) {
856
+
857
+ $submitted_settings = array_merge( $existing_settings, $submitted_settings );
858
+
859
+ }
860
+
861
+ update_post_meta( $item['parent_menu_item'], '_megamenu', $submitted_settings );
862
+ }
863
+
864
+ if ( $item['type'] == 'widget' ) {
865
+
866
+ $this->update_widget_order( $item['id'], $item['order'], $item['parent_menu_item'] );
867
+
868
+ }
869
+
870
+ if ( $item['type'] == 'menu_item' ) {
871
+
872
+ $this->update_menu_item_order( $item['id'], $item['order'], $item['parent_menu_item'] );
873
+
874
+ }
875
+
876
+ }
877
+
878
+ return true;
879
+
880
+ }
881
+
882
+
883
+ /**
884
+ * Adds a widget to the Mega Menu widget sidebar
885
+ *
886
+ * @since 1.0
887
+ */
888
+ private function add_widget_to_sidebar( $id_base, $next_id ) {
889
+
890
+ $widget_id = $id_base . '-' . $next_id;
891
+
892
+ $sidebar_widgets = $this->get_mega_menu_sidebar_widgets();
893
+
894
+ $sidebar_widgets[] = $widget_id;
895
+
896
+ $this->set_mega_menu_sidebar_widgets($sidebar_widgets);
897
+
898
+ do_action( "megamenu_after_widget_add" );
899
+
900
+ return $widget_id;
901
+
902
+ }
903
+
904
+
905
+ /**
906
+ * Removes a widget from the Mega Menu widget sidebar
907
+ *
908
+ * @since 1.0
909
+ * @return string The widget that was removed
910
+ */
911
+ private function remove_widget_from_sidebar($widget_id) {
912
+
913
+ $widgets = $this->get_mega_menu_sidebar_widgets();
914
+
915
+ $new_mega_menu_widgets = array();
916
+
917
+ foreach ( $widgets as $widget ) {
918
+
919
+ if ( $widget != $widget_id )
920
+ $new_mega_menu_widgets[] = $widget;
921
+
922
+ }
923
+
924
+ $this->set_mega_menu_sidebar_widgets($new_mega_menu_widgets);
925
+
926
+ return $widget_id;
927
+
928
+ }
929
+
930
+
931
+ /**
932
+ * Returns an unfiltered array of all widgets in our sidebar
933
+ *
934
+ * @since 1.0
935
+ * @return array
936
+ */
937
+ public function get_mega_menu_sidebar_widgets() {
938
+
939
+ $sidebar_widgets = wp_get_sidebars_widgets();
940
+
941
+ if ( ! isset( $sidebar_widgets[ 'mega-menu'] ) ) {
942
+ return false;
943
+ }
944
+
945
+ return $sidebar_widgets[ 'mega-menu' ];
946
+
947
+ }
948
+
949
+
950
+ /**
951
+ * Sets the sidebar widgets
952
+ *
953
+ * @since 1.0
954
+ */
955
+ private function set_mega_menu_sidebar_widgets( $widgets ) {
956
+
957
+ $sidebar_widgets = wp_get_sidebars_widgets();
958
+
959
+ $sidebar_widgets[ 'mega-menu' ] = $widgets;
960
+
961
+ wp_set_sidebars_widgets( $sidebar_widgets );
962
+
963
+ }
964
+
965
+
966
+ /**
967
+ * Clear the cache when the Mega Menu is updated.
968
+ *
969
+ * @since 1.0
970
+ */
971
+ public function clear_caches() {
972
+
973
+ // https://wordpress.org/plugins/widget-output-cache/
974
+ if ( function_exists( 'menu_output_cache_bump' ) ) {
975
+ menu_output_cache_bump();
976
+ }
977
+
978
+ // https://wordpress.org/plugins/widget-output-cache/
979
+ if ( function_exists( 'widget_output_cache_bump' ) ) {
980
+ widget_output_cache_bump();
981
+ }
982
+
983
+ }
984
+
985
+
986
+ /**
987
+ * Send JSON response.
988
+ *
989
+ * Remove any warnings or output from other plugins which may corrupt the response
990
+ *
991
+ * @param string $json
992
+ * @since 1.8
993
+ */
994
+ public function send_json_success( $json ) {
995
+ if ( ob_get_contents() ) ob_clean();
996
+
997
+ wp_send_json_success( $json );
998
+ }
999
+
1000
+
1001
+ /**
1002
+ * Send JSON response.
1003
+ *
1004
+ * Remove any warnings or output from other plugins which may corrupt the response
1005
+ *
1006
+ * @param string $json
1007
+ * @since 1.8
1008
+ */
1009
+ public function send_json_error( $json ) {
1010
+ if ( ob_get_contents() ) ob_clean();
1011
+
1012
+ wp_send_json_error( $json );
1013
+ }
1014
+
1015
+ }
1016
+
1017
+ endif;
classes/widget.class.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit; // disable direct access
5
+ }
6
+
7
+ if ( ! class_exists('Mega_Menu_Widget') ) :
8
+
9
+ /**
10
+ * Outputs a registered menu location using wp_nav_menu
11
+ */
12
+ class Mega_Menu_Widget extends WP_Widget {
13
+
14
+ /**
15
+ * Register widget with WordPress.
16
+ */
17
+ public function __construct() {
18
+ parent::__construct(
19
+ 'maxmegamenu', // Base ID
20
+ 'Max Mega Menu', // Name
21
+ array( 'description' => __( 'Outputs a menu for a selected theme location.', 'megamenu' ) ) // Args
22
+ );
23
+ }
24
+
25
+ /**
26
+ * Front-end display of widget.
27
+ *
28
+ * @since 1.7.4
29
+ * @see WP_Widget::widget()
30
+ * @param array $args Widget arguments.
31
+ * @param array $instance Saved values from database.
32
+ */
33
+ public function widget( $args, $instance ) {
34
+ extract( $args );
35
+
36
+ if ( isset( $instance['location'] ) ) {
37
+ $location = $instance['location'];
38
+
39
+ $title = apply_filters( 'widget_title', $instance['title'] );
40
+
41
+ echo $before_widget;
42
+
43
+ if ( ! empty( $title ) ) {
44
+ echo $before_title . $title . $after_title;
45
+ }
46
+
47
+ if ( has_nav_menu( $location ) ) {
48
+ wp_nav_menu( array( 'theme_location' => $location ) );
49
+ }
50
+
51
+ echo $after_widget;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Sanitize widget form values as they are saved.
57
+ *
58
+ * @since 1.7.4
59
+ * @see WP_Widget::update()
60
+ * @param array $new_instance Values just sent to be saved.
61
+ * @param array $old_instance Previously saved values from database.
62
+ * @return array Updated safe values to be saved.
63
+ */
64
+ public function update( $new_instance, $old_instance ) {
65
+ $instance = array();
66
+ $instance['location'] = strip_tags( $new_instance['location'] );
67
+ $instance['title'] = strip_tags( $new_instance['title'] );
68
+
69
+ return $instance;
70
+ }
71
+
72
+ /**
73
+ * Back-end widget form.
74
+ *
75
+ * @since 1.7.4
76
+ * @see WP_Widget::form()
77
+ * @param array $instance Previously saved values from database.
78
+ */
79
+ public function form( $instance ) {
80
+
81
+ $selected_location = 0;
82
+ $title = "";
83
+ $locations = get_registered_nav_menus();
84
+
85
+ if ( isset( $instance['location'] ) ) {
86
+ $selected_location = $instance['location'];
87
+ }
88
+
89
+ if ( isset( $instance['title'] ) ) {
90
+ $title = $instance['title'];
91
+ }
92
+
93
+ ?>
94
+ <p>
95
+ <?php if ( $locations ) { ?>
96
+ <p>
97
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'megamenu' ); ?></label>
98
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
99
+ </p>
100
+ <label for="<?php echo $this->get_field_id( 'location' ); ?>"><?php _e( 'Menu Location:', 'megamenu' ); ?></label>
101
+ <select id="<?php echo $this->get_field_id( 'location' ); ?>" name="<?php echo $this->get_field_name( 'location' ); ?>">
102
+ <?php
103
+ foreach ( $locations as $location => $description ) {
104
+ echo "<option value='{$location}'" . selected($location, $selected_location) . ">{$description}</option>";
105
+ }
106
+ ?>
107
+ </select>
108
+ <?php } else {
109
+ _e( 'No menu locations found', 'megamenu' );
110
+ } ?>
111
+ </p>
112
+ <?php
113
+ }
114
+ }
115
+
116
+ endif;
css/admin/global.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @font-face {
2
+ font-family: 'maxmegamenu';
3
+ src: url('../../font/maxmegamenu.eot?86003086');
4
+ src: url('../../font/maxmegamenu.eot?86003086#iefix') format('embedded-opentype'),
5
+ url('../../font/maxmegamenu.woff?86003086') format('woff'),
6
+ url('../../font/maxmegamenu.ttf?86003086') format('truetype'),
7
+ url('../../font/maxmegamenu.svg?86003086#maxmegamenu') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ #adminmenu .toplevel_page_maxmegamenu div.wp-menu-image:before {
13
+ content: "\e800" !important;
14
+ font-family: "maxmegamenu" !important;
15
+ font-style: normal !important;
16
+ font-weight: normal !important;
17
+ font-variant: normal !important;
18
+ text-transform: none !important;
19
+ speak: none;
20
+ font-size: 20px;
21
+ line-height: 1.3;
22
+ margin-top: -3px;
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale;
25
+ }
css/admin/menus.css ADDED
@@ -0,0 +1,999 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #cboxContent {
2
+ padding: 0;
3
+ -webkit-user-select: none;
4
+ -moz-user-select: none;
5
+ -ms-user-select: none;
6
+ user-select: none;
7
+ }
8
+
9
+
10
+ #cboxClose {
11
+ text-indent: 0;
12
+ background: none;
13
+ width: auto;
14
+ height: auto;
15
+ color: white;
16
+ right: -28px;
17
+ top: 2px;
18
+ }
19
+
20
+ #cboxClose:before {
21
+ content: "\f335";
22
+ font: normal 24px/29px 'dashicons';
23
+ }
24
+ #cboxClose:hover {
25
+ color: #0074a2;
26
+ }
27
+
28
+ #cboxContent .mm_tabs.horizontal li {
29
+ float: left;
30
+ margin-right: 10px;
31
+ cursor: pointer;
32
+ padding: 3px 5px;
33
+ font-size: 0.9em;
34
+ color: #999;
35
+ transition: all 0.05s linear;
36
+ }
37
+
38
+ #cboxContent .mm_tabs.horizontal li:hover,
39
+ #cboxContent .mm_tabs.horizontal li.active {
40
+ background: #2ea2cc;
41
+ color: white;
42
+ }
43
+
44
+ #cboxContent .mm_tabs.horizontal {
45
+ width: 100%;
46
+ float: left;
47
+ margin-top: 0;
48
+ }
49
+
50
+ #cboxContent .mm_header_container {
51
+ float: left;
52
+ width: 100%;
53
+ border-bottom: 1px solid #eeeeee;
54
+ }
55
+
56
+ #cboxContent .mm_title {
57
+ padding: 0 20px;
58
+ background: white;
59
+ font-size: 1.3em;
60
+ line-height: 75px;
61
+ float: left;
62
+ }
63
+
64
+
65
+ #cboxContent .mm_tab_container .mm_tab {
66
+ text-decoration: none;
67
+ color: #333;
68
+ width: 100%;
69
+ display: block;
70
+ padding: 10px 0px 10px 20px;
71
+ box-sizing: border-box;
72
+ outline: 0;
73
+ position: relative;
74
+ transition: all 0.05s linear;
75
+ font-size: 12px;
76
+ }
77
+
78
+ #cboxContent .mm_tab_container .mm_tab.active {
79
+ color: #333;
80
+ color: white;
81
+ }
82
+
83
+ #cboxContent .mm_tab_container .mm_tab:hover {
84
+ background: #dfdfdf;
85
+ }
86
+
87
+ #cboxContent .mm_tab_container .mm_tab.active {
88
+ background: #2ea2cc;
89
+ }
90
+
91
+ #cboxContent .mm_tab_container .mm_tab.active:after {
92
+ right: 0;
93
+ border: solid 5px transparent;
94
+ content: " ";
95
+ height: 0;
96
+ width: 0;
97
+ position: absolute;
98
+ pointer-events: none;
99
+ border-right-color: white;
100
+ top: 50%;
101
+ margin-top: -5px;
102
+ }
103
+
104
+ #cboxContent .mm_tab_container {
105
+ width: 20%;
106
+ float: left;
107
+ position: relative;
108
+ height: 424px;
109
+ background: white;
110
+ -webkit-box-shadow: inset -10px 0px 7px -12px rgba(0,0,0,0.2);
111
+ -moz-box-shadow: inset -10px 0px 7px -12px rgba(0,0,0,0.2);
112
+ box-shadow: inset -10px 0px 7px -12px rgba(0,0,0,0.2);
113
+ }
114
+ #cboxContent .mm_content_container {
115
+ padding: 20px;
116
+ float: right;
117
+ height: 424px;
118
+ width: 80%;
119
+ overflow: auto;
120
+ box-sizing: border-box;
121
+
122
+ }
123
+
124
+ #cboxContent .mega_menu #widgets .no_widgets {
125
+ font-size: 0.9em;
126
+ margin-left: 10px;
127
+ font-style: italic;
128
+ margin-top: 10px;
129
+ clear: both;
130
+ color: #999;
131
+ float: left;
132
+ }
133
+
134
+ #cboxContent label[for='mm_enable_mega_menu'] {
135
+ font-size: 12px;
136
+ }
137
+ #cboxContent .mega_menu #mm_enable_mega_menu {
138
+ margin-bottom: 0;
139
+ font-size: 0.9em;
140
+ margin-left: 5px;
141
+ }
142
+ #cboxContent .mega_menu #mm_widget_selector {
143
+ margin-bottom: 0;
144
+ font-size: 0.9em;
145
+ float: right;
146
+ margin-right: 5px;
147
+ margin-top: 5px;
148
+ margin-bottom: 5px;
149
+ }
150
+ #cboxContent .mega_menu #mm_number_of_columns {
151
+ font-size: 0.9em;
152
+ float: right;
153
+ margin-top: 5px;
154
+ margin-right: 10px;
155
+ margin-bottom: 5px;
156
+ }
157
+
158
+ #cboxContent .mega_menu .ui-sortable-helper {
159
+ display: block;
160
+ }
161
+
162
+ #cboxContent .mega_menu .drop-area {
163
+ display: inline-block;
164
+ border: 1px solid #eeeeee;
165
+ float: left;
166
+ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
167
+ -moz-box-sizing: border-box; /* Firefox, other Gecko */
168
+ box-sizing: border-box; /* Opera/IE 8+ */
169
+ }
170
+
171
+ #cboxContent .mega_menu #widgets {
172
+ float: left;
173
+ background: #FAFAFA;
174
+ border: 1px solid #DFDFDF;
175
+ width: 760px;
176
+ position: relative;
177
+ margin-top: 15px;
178
+ padding: 5px;
179
+ float: left;
180
+ width: 100%;
181
+ box-sizing: border-box;
182
+ min-height: 200px;
183
+ }
184
+
185
+
186
+ #cboxContent .mega_menu .mm_header {
187
+ float: right;
188
+ }
189
+
190
+ #cboxContent .mega_menu .widget {
191
+ -webkit-transition: width 0.3s ease;
192
+ -moz-transition: width 0.3s ease;
193
+ -o-transition: width 0.3s ease;
194
+ -ms-transition: width 0.3s ease;
195
+ transition: width 0.3s ease;
196
+ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
197
+ -moz-box-sizing: border-box; /* Firefox, other Gecko */
198
+ box-sizing: border-box; /* Opera/IE 8+ */
199
+ width: 160px;
200
+ margin: 0;
201
+ color: #333;
202
+ font-size: 12px;
203
+ display: inline-block;
204
+ float: left;
205
+ border: 5px solid transparent;
206
+ }
207
+
208
+ #cboxContent .mega_menu .widget.open {
209
+ z-index: 999;
210
+ }
211
+
212
+ #cboxContent .mega_menu .widget:hover .widget-top,
213
+ #cboxContent .mega_menu .widget:hover .widget-inner,
214
+ #cboxContent .mega_menu .widget.open .widget-top,
215
+ #cboxContent .mega_menu .widget.open .widget-inner {
216
+ border: 1px solid #555;
217
+ }
218
+
219
+ #cboxContent .mega_menu .widget-top {
220
+ border: 0;
221
+ -webkit-box-shadow: 0 0 0;
222
+ box-shadow: 0 0 0;
223
+ border: 1px solid #999;
224
+ padding: 0 10px;
225
+ background: white;
226
+ }
227
+
228
+ #cboxContent .mega_menu .widget.open .widget-top {
229
+ cursor: move;
230
+ z-index: 1001;
231
+ position: relative;
232
+ border-bottom: 0;
233
+ }
234
+ #cboxContent .mega_menu .widget.sub_menu .widget-top {
235
+ cursor: default;
236
+ }
237
+
238
+ #cboxContent .mega_menu .widget.open .widget-inner {
239
+ position: absolute;
240
+ z-index: 1000;
241
+ border: 1px solid #dfdfdf;
242
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
243
+ box-shadow: 0 1px 1px rgba(0,0,0,.04);
244
+ margin-top: -1px;
245
+ background: white;
246
+ min-width: 240px;
247
+ border: 1px solid #999;
248
+ box-sizing: border-box;
249
+ }
250
+
251
+
252
+ #cboxContent .mega_menu .widget-title {
253
+ display: inline-block;
254
+ }
255
+
256
+ #cboxContent .mega_menu .widget-title h4 {
257
+ float: left;
258
+ margin: 0;
259
+ padding: 0;
260
+ overflow: hidden;
261
+ white-space: nowrap;
262
+ border-bottom: 0;
263
+ font-size: 1em;
264
+ text-overflow: ellipsis;
265
+ line-height: 40px;
266
+ }
267
+
268
+ #cboxContent .mega_menu .widget[data-type='menu_item'] .widget-title h4:before {
269
+ color: #333;
270
+ font: normal 16px/1 'dashicons';
271
+ speak: none;
272
+ -webkit-font-smoothing: antialiased;
273
+ -moz-osx-font-smoothing: grayscale;
274
+ vertical-align: top;
275
+ margin-right: 2px;
276
+ content: "\f333";
277
+ vertical-align: middle;
278
+ top: -1px;
279
+ position: relative;
280
+ }
281
+
282
+ #cboxContent .mega_menu .widget-title h4:after {
283
+ color: #d54e21;
284
+ display: none;
285
+ font: normal 20px/1 'dashicons';
286
+ speak: none;
287
+ -webkit-font-smoothing: antialiased;
288
+ -moz-osx-font-smoothing: grayscale;
289
+ vertical-align: top;
290
+ margin-left: 5px;
291
+ content: '\f463';
292
+ -webkit-animation: rotation 2s infinite linear;
293
+ animation: rotation 2s infinite linear;
294
+ vertical-align: middle;
295
+ }
296
+
297
+ #cboxContent .mega_menu .widget-title h4.loading:after {
298
+ display: inline-block;
299
+ }
300
+
301
+ #cboxContent .mega_menu .widget-controls {
302
+ float: left;
303
+ }
304
+
305
+ #cboxContent .mega_menu .widget-controls .delete:hover {
306
+ text-decoration: none;
307
+ color: red;
308
+ }
309
+
310
+ #cboxContent .mega_menu .widget-inner form {
311
+ padding: 0 15px 15px 15px;
312
+ margin-bottom: 30px;
313
+ }
314
+ #cboxContent .mega_menu .widget-inner {
315
+ display: none;
316
+ float: left;
317
+ width: 100%;
318
+ background: white;
319
+ }
320
+
321
+ #cboxContent .mega_menu .widget.open .widget-inner {
322
+ display: block;
323
+ }
324
+
325
+ #cboxContent .mega_menu .widget-inner p,
326
+ #cboxContent .mega_menu .widget-inner select,
327
+ #cboxContent .mega_menu .widget-inner input {
328
+ font-size: 12px;
329
+ }
330
+
331
+
332
+ #cboxContent .mega_menu .widget-title-action {
333
+ padding: 0;
334
+ float: right;
335
+ position: relative;
336
+ opacity: 0.6;
337
+ font-weight: normal;
338
+ }
339
+
340
+ #cboxContent .mega_menu .widget:hover .widget-title-action {
341
+ opacity: 1;
342
+ }
343
+
344
+ #cboxContent .mega_menu .widget-title-action a {
345
+ display: inline-block;
346
+ line-height: 40px;
347
+ }
348
+
349
+ #cboxContent .mega_menu #widgets .widget[data-type='menu_item'] .widget-action {
350
+ display: none;
351
+ }
352
+
353
+ #cboxContent .mega_menu .widget-option {
354
+ right: 0;
355
+ border: 0;
356
+ background: 0 0;
357
+ font: 400 16px/1 dashicons;
358
+ speak: none;
359
+ display: block;
360
+ padding: 0;
361
+ text-indent: 0;
362
+ text-align: center;
363
+ position: relative;
364
+ -webkit-font-smoothing: antialiased;
365
+ -moz-osx-font-smoothing: grayscale;
366
+ text-decoration: none!important;
367
+ color: #999;
368
+ }
369
+
370
+ #cboxContent .mega_menu .widget-cols {
371
+ line-height: 40px;
372
+ vertical-align: top;
373
+ display: inline-block;
374
+ color: #999;
375
+ font-size: 11px;
376
+ vertical-align: bottom;
377
+ }
378
+
379
+ #cboxContent .mega_menu .widget-option:hover {
380
+ color: #333;
381
+ cursor: pointer;
382
+ }
383
+
384
+ #cboxContent .mega_menu h5 {
385
+ margin: 10px 0 0 10px;
386
+ text-transform: uppercase;
387
+ float: left;
388
+ }
389
+ #cboxContent .mega_menu .widget-option::after {
390
+ padding: 0;
391
+ font: 400 14px/40px dashicons;
392
+ display: inline;
393
+ }
394
+ #cboxContent .mega_menu .widget-expand::after {
395
+ content: '\f345';
396
+ }
397
+
398
+ #cboxContent .mega_menu .widget-contract::after {
399
+ content: '\f341';
400
+ }
401
+
402
+ #cboxContent .mega_menu .widget-action::after {
403
+ content: '\f107';
404
+ margin: 0;
405
+ }
406
+
407
+ #cboxContent .mega_menu .widget.open .widget-action::after {
408
+ content: '\f142';
409
+ }
410
+
411
+ #cboxContent .mega_menu .widget-option.disabled:hover {
412
+ color: #999;
413
+ }
414
+
415
+ #cboxContent .mega_menu #widgets .widget {
416
+ width: 100%;
417
+ }
418
+
419
+
420
+ #cboxContent .mega_menu #widgets[data-columns='1'] .widget[data-columns='1'] {
421
+ width: 100%;
422
+ }
423
+
424
+
425
+
426
+ #cboxContent .mega_menu #widgets[data-columns='2'] .widget[data-columns='1'] {
427
+ width: 50%;
428
+ }
429
+ #cboxContent .mega_menu #widgets[data-columns='2'] .widget[data-columns='2'] {
430
+ width: 100%;
431
+ }
432
+
433
+
434
+ #cboxContent .mega_menu #widgets[data-columns='3'] .widget[data-columns='1'] {
435
+ width: 33.3%;
436
+ }
437
+ #cboxContent .mega_menu #widgets[data-columns='3'] .widget[data-columns='2'] {
438
+ width: 66.6%;
439
+ }
440
+ #cboxContent .mega_menu #widgets[data-columns='3'] .widget[data-columns='3'] {
441
+ width: 100%;
442
+ }
443
+
444
+
445
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='1'] {
446
+ width: 25%;
447
+ }
448
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='2'] {
449
+ width: 50%;
450
+ }
451
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='3'] {
452
+ width: 75%;
453
+ }
454
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='4'] {
455
+ width: 100%;
456
+ }
457
+
458
+
459
+
460
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='1'] {
461
+ width: 20%;
462
+ }
463
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='2'] {
464
+ width: 40%;
465
+ }
466
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='3'] {
467
+ width: 60%;
468
+ }
469
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='4'] {
470
+ width: 80%;
471
+ }
472
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='5'] {
473
+ width: 100%;
474
+ }
475
+
476
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='1'] {
477
+ width: 16.6%;
478
+ }
479
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='2'] {
480
+ width: 33.3%;
481
+ }
482
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='3'] {
483
+ width: 50%;
484
+ }
485
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='4'] {
486
+ width: 66.6%;
487
+ }
488
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='5'] {
489
+ width: 83.3%;
490
+ }
491
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='6'] {
492
+ width: 100%;
493
+ }
494
+
495
+
496
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='1'] {
497
+ width: 14.28%;
498
+ }
499
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='2'] {
500
+ width: 28.57%;
501
+ }
502
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='3'] {
503
+ width: 42.85%;
504
+ }
505
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='4'] {
506
+ width: 57.14%;
507
+ }
508
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='5'] {
509
+ width: 71.42%;
510
+ }
511
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='6'] {
512
+ width: 85.71%;
513
+ }
514
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='7'] {
515
+ width: 100%;
516
+ }
517
+
518
+
519
+
520
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='1'] {
521
+ width: 12.5%;
522
+ }
523
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='2'] {
524
+ width: 25%;
525
+ }
526
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='3'] {
527
+ width: 37.5%;
528
+ }
529
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='4'] {
530
+ width: 50%;
531
+ }
532
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='5'] {
533
+ width: 62.5%;
534
+ }
535
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='6'] {
536
+ width: 75%;
537
+ }
538
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='7'] {
539
+ width: 87.5%;
540
+ }
541
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='8'] {
542
+ width: 100%;
543
+ }
544
+
545
+
546
+ #cboxContent .mega_menu #widgets .widget h4 {
547
+ max-width: 700px;
548
+ }
549
+
550
+ #cboxContent .mega_menu #widgets[data-columns='2'] .widget[data-columns='1'] h4 {
551
+ max-width: 280px;
552
+ }
553
+
554
+ #cboxContent .mega_menu #widgets[data-columns='3'] .widget[data-columns='1'] h4 {
555
+ max-width: 165px;
556
+ }
557
+ #cboxContent .mega_menu #widgets[data-columns='3'] .widget[data-columns='2'] h4 {
558
+ max-width: 430px;
559
+ }
560
+
561
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='1'] h4 {
562
+ max-width: 105px;
563
+ }
564
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='2'] h4 {
565
+ max-width: 280px;
566
+ }
567
+ #cboxContent .mega_menu #widgets[data-columns='4'] .widget[data-columns='3'] h4 {
568
+ max-width: 500px;
569
+ }
570
+
571
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='1'] h4 {
572
+ max-width: 65px;
573
+ }
574
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='2'] h4 {
575
+ max-width: 220px;
576
+ }
577
+ #cboxContent .mega_menu #widgets[data-columns='5'] .widget[data-columns='3'] h4 {
578
+ max-width: 380px;
579
+ }
580
+
581
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='1'] h4 {
582
+ max-width: 40px;
583
+ }
584
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='2'] h4 {
585
+ max-width: 170px;
586
+ }
587
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='3'] h4 {
588
+ max-width: 300px;
589
+ }
590
+ #cboxContent .mega_menu #widgets[data-columns='6'] .widget[data-columns='4'] h4 {
591
+ max-width: 430px;
592
+ }
593
+
594
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='1'] h4 {
595
+ max-width: 24px;
596
+ }
597
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='2'] h4 {
598
+ max-width: 130px;
599
+ }
600
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='3'] h4 {
601
+ max-width: 240px;
602
+ }
603
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='4'] h4 {
604
+ max-width: 350px;
605
+ }
606
+ #cboxContent .mega_menu #widgets[data-columns='7'] .widget[data-columns='5'] h4 {
607
+ max-width: 480px;
608
+ }
609
+
610
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='1'] h4 {
611
+ max-width: 8px;
612
+ }
613
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='2'] h4 {
614
+ max-width: 100px;
615
+ }
616
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='3'] h4 {
617
+ max-width: 200px;
618
+ }
619
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='4'] h4 {
620
+ max-width: 300px;
621
+ }
622
+ #cboxContent .mega_menu #widgets[data-columns='8'] .widget[data-columns='5'] h4 {
623
+ max-width: 400px;
624
+ }
625
+
626
+
627
+ #cboxContent .mega_menu .widget textarea {
628
+ max-height: 100px;
629
+ }
630
+
631
+ #cboxContent .menu_icon .icon_selector > div {
632
+ float: left;
633
+ padding: 0 19px 19px 0;
634
+ width: 24px;
635
+ height: 24px;
636
+ }
637
+
638
+ #cboxContent .menu_icon .icon_selector label {
639
+ float: left;
640
+ display: block;
641
+ width: 24px;
642
+ height: 24px;
643
+ }
644
+
645
+ #cboxContent .menu_icon .icon_selector input.radio:empty {
646
+ margin-left: -9999px;
647
+ }
648
+
649
+ #cboxContent .menu_icon .icon_selector input.radio:empty ~ label {
650
+ position: relative;
651
+ cursor: pointer;
652
+ -webkit-user-select: none;
653
+ -moz-user-select: none;
654
+ -ms-user-select: none;
655
+ user-select: none;
656
+ }
657
+ #cboxContent .menu_icon .icon_selector .dash label:before {
658
+ font: 400 24px/1 dashicons;
659
+ }
660
+ #cboxContent .menu_icon .icon_selector label:before {
661
+ width: 24px;
662
+ height: 24px;
663
+ display: inline-block;
664
+ content: attr(rel);
665
+ border: 1px solid #dfdfdf;
666
+ padding: 6px;
667
+ background: #FAFAFA;
668
+ color: #999;
669
+
670
+ }
671
+ #cboxContent .menu_icon .icon_selector input.radio:not(:checked) ~ label:before {
672
+
673
+ }
674
+
675
+ #cboxContent .menu_icon .icon_selector input.radio:checked ~ label:before,
676
+ #cboxContent .menu_icon .icon_selector input.radio:hover:checked ~ label:before {
677
+ border: 1px solid #0074a2;
678
+ color: #0074a2;
679
+ background: white;
680
+
681
+ }
682
+
683
+ #cboxContent .menu_icon .icon_selector input.radio:hover ~ label:before {
684
+ color: #0074a2;
685
+ }
686
+
687
+ #cboxContent .menu_icon .icon_selector input.radio:checked ~ label {
688
+ color: #999;
689
+ }
690
+
691
+ #cboxContent table td {
692
+ padding-bottom: 10px;
693
+ }
694
+ #cboxContent h4.first {
695
+ margin: 0em 0 0.7em 0;
696
+ }
697
+ #cboxContent h4 {
698
+ clear: both;
699
+ border-bottom: 1px solid #bfbfbf;
700
+ padding: 0 0 10px 0;
701
+ font-size: 1em;
702
+ margin: 1.33em 0 0.7em 0;
703
+ }
704
+ #cboxContent table td.mega-name {
705
+ width: 27%;
706
+ line-height: 2em;
707
+ padding-right: 30px;
708
+ vertical-align: top;
709
+ font-size: 12px;
710
+ }
711
+ #cboxContent table td.mega-value {
712
+ font-size: 12px;
713
+ }
714
+ #cboxContent table td.mega-value select {
715
+ font-size: 0.9em;
716
+ }
717
+ #cboxContent table td.mega-name .mega-description,
718
+ #cboxContent table td.mega-value .mega-description {
719
+ font-size: 0.9em;
720
+ color: #999;
721
+ line-height: 1.5em;
722
+ }
723
+
724
+ #cboxContent table td.mega-value .mega-description {
725
+ text-indent: 2px;
726
+ margin-top: 5px;
727
+ }
728
+ #cboxContent table input {
729
+ width: 70px;
730
+ margin-right: 20px;
731
+ }
732
+ #cboxContent table label {
733
+ font-size: 0.9em;
734
+ }
735
+ #cboxContent table input[type=checkbox] {
736
+ width: 16px;
737
+ height: 16px;
738
+ margin-right: 10px;
739
+ vertical-align: middle;
740
+ }
741
+ #cboxContent table {
742
+ width: 100%;
743
+ border-collapse: collapse;
744
+ }
745
+ #cboxContent .mega_menu #widgets.disabled {
746
+ opacity: 0.5;
747
+ }
748
+
749
+ #cboxContent .mega_menu #widgets.disabled:after {
750
+ background: #ccc;
751
+ display: block;
752
+ position: absolute;
753
+ top: 0;
754
+ left: 0;
755
+ height: 100%;
756
+ width: 100%;
757
+ content: "";
758
+ opacity: 0.3;
759
+
760
+ }
761
+
762
+
763
+ /**
764
+ * NAV MENUS
765
+ */
766
+ /** TRIBE IMAGE WIDGET **/
767
+ .uploader input.button {
768
+ width: 100%;
769
+ height: 34px;
770
+ line-height: 33px;
771
+ margin-top: 15px;
772
+ }
773
+ .tribe_preview .aligncenter {
774
+ display: block;
775
+ margin-left: auto !important;
776
+ margin-right: auto !important;
777
+ }
778
+ .tribe_preview {
779
+ overflow: hidden;
780
+ max-height: 300px;
781
+ }
782
+ .tribe_preview img {
783
+ margin: 10px 0;
784
+ height: auto;
785
+ max-width: 100%;
786
+ }
787
+ /** END TRIBE IMAGE WIDGET **/
788
+
789
+ .megamenu_enabled .mm_launch {
790
+ background: #2ea2cc;
791
+ border-color: #0074a2;
792
+ }
793
+ .mm_launch {
794
+ margin-left: 10px;
795
+ font-size: 0.8em;
796
+ cursor: pointer;
797
+ color: white;
798
+ display: inline-block;
799
+ width: auto;
800
+ font-weight: normal;
801
+ height: auto;
802
+ background: #999;
803
+ border-color: #333;
804
+ border-width: 1px;
805
+ padding: 0 5px;
806
+ border-radius: 3px;
807
+ opacity: 0;
808
+ -webkit-transition: all 0.3s ease;
809
+ -moz-transition: all 0.3s ease;
810
+ -o-transition: all 0.3s ease;
811
+ -ms-transition: all 0.3s ease;
812
+ transition: all 0.3s ease;
813
+ }
814
+
815
+ .mm_launch:before {
816
+ font-family: dashicons;
817
+ content: "\f111";
818
+ font-size: 10px;
819
+ margin-right: 2px;
820
+ display: inline-block;
821
+ vertical-align: bottom;
822
+ }
823
+
824
+ .menu-item-bar .menu-item-handle:hover .mm_launch {
825
+ opacity: 1;
826
+ }
827
+ .menu-item-bar .dashicons-admin-generic:before {
828
+ font-size: 1.2em;
829
+ margin-right: 1px;
830
+ height: auto;
831
+ }
832
+ .mega_menu_meta_box.mmm_get_started:before {
833
+ content: attr(data-get-started);
834
+ padding: 10px;
835
+ display: block;
836
+ background: green;
837
+ color: white;
838
+ }
839
+ .mega_menu_meta_box.mmm_get_started h3 {
840
+ border-left: 1px solid green;
841
+ border-right: 1px solid green;
842
+ }
843
+ .mega_menu_meta_box.mmm_get_started .accordion-section-content {
844
+ border-left: 1px solid green;
845
+ border-right: 1px solid green;
846
+ border-bottom: 1px solid green;
847
+ }
848
+ .mega_menu_meta_box div#megamenu_accordion h3 {
849
+ padding: 0 0 10px 0;
850
+ margin: 0;
851
+ cursor: pointer;
852
+ outline: none;
853
+ float: left;
854
+ width: 100%;
855
+ color: #999;
856
+ font-size: 14px;
857
+ font-weight: normal;
858
+ }
859
+
860
+ .mega_menu_meta_box div#megamenu_accordion h3.ui-state-active,
861
+ .mega_menu_meta_box div#megamenu_accordion h3:hover {
862
+ color: #333;
863
+ }
864
+
865
+ .mega_menu_meta_box div#megamenu_accordion h3:hover::before {
866
+ color: black;
867
+ }
868
+
869
+ .mega_menu_meta_box div#megamenu_accordion th::before,
870
+ .mega_menu_meta_box div#megamenu_accordion h3::before {
871
+ right: 0;
872
+ content: '\f139';
873
+ border: 0;
874
+ background: 0 0;
875
+ font: 400 20px/1 dashicons;
876
+ speak: none;
877
+ float: left;
878
+ padding: 0;
879
+ text-indent: 0;
880
+ text-align: center;
881
+ position: relative;
882
+ -webkit-font-smoothing: antialiased;
883
+ -moz-osx-font-smoothing: grayscale;
884
+ text-decoration: none!important;
885
+ margin-right: 6px;
886
+ }
887
+
888
+ .mega_menu_meta_box div#megamenu_accordion h3.ui-state-active::before {
889
+ content: '\f140';
890
+ }
891
+
892
+ .mega_menu_meta_box div.accordion_content {
893
+ padding-bottom: 20px;
894
+ float: left;
895
+ width: 100%;
896
+ }
897
+ .mega_menu_meta_box div table {
898
+ font-size: 0.9em;
899
+ width: 100%;
900
+ margin-bottom: 5px;
901
+ }
902
+
903
+ .mega_menu_meta_box div table select {
904
+ font-size: 0.9em;
905
+ max-width: 120px;
906
+ }
907
+
908
+ .mega_menu_meta_box div table tr {
909
+ height: 29px;
910
+ vertical-align: middle;
911
+ }
912
+
913
+ .mega_menu_meta_box div table th {
914
+ border-bottom: 1px solid #bfbfbf;
915
+ font-size: 1.1em;
916
+ }
917
+
918
+ .mega_menu_meta_box div table td:nth-child(1) {
919
+ padding-left: 5px;
920
+ }
921
+
922
+ .mega_menu_meta_box div table td:nth-child(2) {
923
+ text-align: right;
924
+ min-width: 150px;
925
+ }
926
+
927
+ .mega_menu_meta_box th::before {
928
+ content: '\f100';
929
+ }
930
+
931
+ .mega_menu_meta_box th.settings::before {
932
+ content: '\f111';
933
+ }
934
+
935
+ .mega_menu_meta_box p.submit {
936
+ float: left;
937
+ text-align: right;
938
+ width: 100%;
939
+ margin: 0 0 15px 0;
940
+ padding: 0;
941
+ }
942
+
943
+ #nav-menu-meta .mega_menu_meta_box .accordion-section-content {
944
+ padding: 0 10px;
945
+ }
946
+
947
+ .menu-item-handle .item-title {
948
+ margin-right: 0;
949
+ }
950
+
951
+ .mm_saving {
952
+ font-size: 12px;
953
+ text-align: right;
954
+ padding: 0 20px;
955
+ display: none;
956
+ line-height: 75px;
957
+ text-transform: uppercase;
958
+ color: white;
959
+ font-size: 11px;
960
+ font-weight: bold;
961
+ float: right;
962
+ background: #2ea2cc;
963
+ }
964
+
965
+ .mm_saving:before {
966
+ color: white;
967
+ display: inline-block;
968
+ font: normal 20px/75px 'dashicons';
969
+ speak: none;
970
+ -webkit-font-smoothing: antialiased;
971
+ -moz-osx-font-smoothing: grayscale;
972
+ vertical-align: top;
973
+ margin-right: 5px;
974
+ content: '\f463';
975
+ -webkit-animation: rotation 2s infinite linear;
976
+ animation: rotation 2s infinite linear;
977
+ }
978
+
979
+ @-webkit-keyframes rotation {
980
+ 0% {
981
+ -webkit-transform: rotate(0deg);
982
+ transform: rotate(0deg);
983
+ }
984
+ 100% {
985
+ -webkit-transform: rotate(359deg);
986
+ transform: rotate(359deg);
987
+ }
988
+ }
989
+
990
+ @keyframes rotation {
991
+ 0% {
992
+ -webkit-transform: rotate(0deg);
993
+ transform: rotate(0deg);
994
+ }
995
+ 100% {
996
+ -webkit-transform: rotate(359deg);
997
+ transform: rotate(359deg);
998
+ }
999
+ }
css/admin/settings.css ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .toplevel_page_maxmegamenu .notice,
3
+ .toplevel_page_maxmegamenu div.updated,
4
+ .toplevel_page_maxmegamenu div.error {
5
+ margin-left: 0;
6
+ }
7
+ .megamenu_outer_wrap .megamenu_wrap {
8
+ width: 100%;
9
+ float: left;
10
+ }
11
+ .megamenu_outer_wrap .megamenu_left {
12
+ float: left;
13
+ width: 190px;
14
+ margin-left: -100%;
15
+ }
16
+
17
+ .megamenu_outer_wrap .megamenu_left ul li a:hover,
18
+ .megamenu_outer_wrap .megamenu_left ul li a.active {
19
+ border-left: 2px solid #0074a2;
20
+ color: #0074a2;
21
+ }
22
+ .megamenu_outer_wrap *:focus {
23
+ box-shadow: 0 0 0;
24
+ }
25
+ .megamenu_outer_wrap .megamenu_left ul li a {
26
+ text-decoration: none;
27
+ color: #333;
28
+ width: 100%;
29
+ display: block;
30
+ padding: 5px 0px 5px 17px;
31
+ box-sizing: border-box;
32
+ border-left: 2px solid white;
33
+ outline: 0;
34
+ }
35
+
36
+
37
+ .megamenu_outer_wrap .megamenu_left ul li.error {
38
+ border-left: 3px solid #dd3d36;
39
+ }
40
+ .megamenu_outer_wrap .megamenu_left ul li.mega_active {
41
+ font-weight: bold;
42
+ }
43
+ .megamenu_outer_wrap .megamenu_left ul li.mega_active a:after {
44
+ right: 0;
45
+ content: '\f139';
46
+ border: 0;
47
+ background: 0 0;
48
+ font: 400 20px/1 dashicons;
49
+ speak: none;
50
+ float: right;
51
+ padding: 0;
52
+ text-indent: 0;
53
+ text-align: center;
54
+ position: relative;
55
+ -webkit-font-smoothing: antialiased;
56
+ -moz-osx-font-smoothing: grayscale;
57
+ text-decoration: none!important;
58
+ margin-right: 0;
59
+ }
60
+
61
+ .megamenu_outer_wrap .megamenu_right {
62
+ margin-left: 190px;
63
+ padding: 20px;
64
+ box-sizing: border-box;
65
+ border-left: 1px solid #f1f1f1;
66
+ min-height: 400px;
67
+ }
68
+ .megamenu_outer_wrap .megamenu_right h3 {
69
+ clear: both;
70
+ font-size: 1.1em;
71
+ margin: 17px 0;
72
+ }
73
+ .megamenu_outer_wrap .megamenu_right h3.first {
74
+ margin-top: 0;
75
+ }
76
+ .mega-menu_page_maxmegamenu_tools .menu_settings h3,
77
+ .toplevel_page_maxmegamenu .menu_settings h3 {
78
+ border-bottom: 1px solid #CAC4C4;
79
+ padding: 0 0 10px 0;
80
+ }
81
+ .megamenu_outer_wrap .megamenu_right h3 span {
82
+ margin-right: 10px;
83
+ }
84
+ .megamenu_outer_wrap .megamenu_right h5 {
85
+ clear: both;
86
+ font-size: 1.1em;
87
+ margin: 15px 0 0px 0;
88
+ padding: 0;
89
+ }
90
+ .megamenu_outer_wrap .megamenu_right ul.bullets {
91
+ list-style-type: disc;
92
+ margin-left: 30px;
93
+ }
94
+ .megamenu_outer_wrap a {
95
+ text-decoration: none;
96
+ }
97
+ .megamenu_outer_wrap .theme_selector {
98
+ margin-bottom: 20px;
99
+ }
100
+ .megamenu_outer_wrap h3 {
101
+ margin: 0 0 40px 0;
102
+ }
103
+ .megamenu_outer_wrap .megamenu_right .menu_settings .duplicate {
104
+ margin-left: 15px;
105
+ }
106
+ .megamenu_outer_wrap {
107
+ padding: 20px 20px 0 0;
108
+ }
109
+ .megamenu_outer_wrap .megamenu_submit {
110
+ margin-bottom: 40px;
111
+ padding-top: 35px;
112
+ }
113
+ .megamenu_outer_wrap .megamenu_submit .mega_left,
114
+ .megamenu_outer_wrap .megamenu_submit .mega_right {
115
+ float: left;
116
+ width: 50%;
117
+ }
118
+ .megamenu_outer_wrap .megamenu_submit p {
119
+ margin: 0;
120
+ padding: 0;
121
+ }
122
+ .megamenu_outer_wrap .megamenu_submit .mega_right {
123
+ text-align: right;
124
+ }
125
+ .megamenu_outer_wrap .megamenu_submit .mega_right a {
126
+ color: #a00;
127
+ }
128
+ .megamenu_outer_wrap .megamenu_header {
129
+ background: white;
130
+ padding: 10px 17px;
131
+ border-bottom: 1px solid #f1f1f1;
132
+ float: left;
133
+ width: 100%;
134
+ box-sizing: border-box;
135
+ }
136
+
137
+ .megamenu_outer_wrap .megamenu_header .version {
138
+ font-style: italic;
139
+ color: #888;
140
+ margin-bottom: 15px;
141
+ }
142
+
143
+
144
+ .megamenu_outer_wrap .megamenu_header_top {
145
+ font-size: 0.9em;
146
+ display: block;
147
+ width: 100%;
148
+ height: 30px;
149
+ line-height: 30px;
150
+ margin-bottom: 10px;
151
+ box-sizing: border-box;
152
+ }
153
+ .megamenu_outer_wrap .megamenu_header_top ul {
154
+ margin: 0;
155
+ float: right;
156
+ position: relative;
157
+ }
158
+ .megamenu_outer_wrap .megamenu_header_top ul li {
159
+ display: inline-block;
160
+ margin: 0 0 0 10px;
161
+ line-height: 30px;
162
+ }
163
+ .megamenu_outer_wrap .megamenu_header_top ul li.mega-highlight {
164
+ background: #00b7bf;
165
+ border-radius: 5px;
166
+ }
167
+ .megamenu_outer_wrap .megamenu_header_top ul li.mega-highlight a {
168
+ color: white;
169
+ line-height: 30px;
170
+ padding: 0 10px;
171
+ }
172
+ .megamenu_outer_wrap .megamenu_wrap {
173
+ background: white;
174
+ }
175
+ .megamenu_outer_wrap .megamenu_right .nav-tab-active {
176
+ background: white;
177
+ }
178
+ .megamenu_outer_wrap .megamenu_right .menu_settings tr:first-child td {
179
+ border-top: 0;
180
+ }
181
+ .megamenu_outer_wrap .megamenu_right .menu_settings th {
182
+ text-align: left;
183
+ }
184
+ .megamenu_outer_wrap .megamenu_right .menu_settings td {
185
+ padding-bottom: 25px;
186
+ padding-top: 10px;
187
+ border-top: 1px solid #efefef;
188
+ }
189
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name {
190
+ width: 27%;
191
+ line-height: 2em;
192
+ padding-right: 30px;
193
+ vertical-align: top;
194
+ }
195
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value {
196
+ padding-top: 10px;
197
+ }
198
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name .mega-description,
199
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-description {
200
+ font-size: 0.9em;
201
+ color: #aaa;
202
+ line-height: 1.5em;
203
+ }
204
+
205
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-info {
206
+ clear: both;
207
+ margin-top: 15px;
208
+ display: block;
209
+ float: left;
210
+ font-size: 0.9em;
211
+ color: #aaa;
212
+ line-height: 20px;
213
+ width: 100%;
214
+ }
215
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-info:before {
216
+ font: 400 20px/1 dashicons;
217
+ content: "\f348";
218
+ speak: none;
219
+ padding: 0;
220
+ margin-right: 6px;
221
+ display: inline-block;
222
+ vertical-align: top;
223
+ -webkit-font-smoothing: antialiased;
224
+ -moz-osx-font-smoothing: grayscale;
225
+ }
226
+ .megamenu_outer_wrap .megamenu_right .menu_settings td .mega-custom_css {
227
+ width: 100%;
228
+ margin-bottom: 0;
229
+ }
230
+ .megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-description {
231
+ margin-top: 5px;
232
+ }
233
+
234
+ .megamenu_outer_wrap .megamenu_right .menu_settings table textarea,
235
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[type=text],
236
+ .megamenu_outer_wrap .megamenu_right .menu_settings table select {
237
+ font-size: 0.9em;
238
+ height: 28px;
239
+ line-height: 28px;
240
+ vertical-align: top;
241
+ }
242
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[type=number] {
243
+ height: auto;
244
+ line-height: 1.2em;
245
+ }
246
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[name=export] {
247
+ margin-top: 20px;
248
+ }
249
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input.mega-setting-title {
250
+ width: 100px;
251
+ }
252
+
253
+ .megamenu_outer_wrap .megamenu_right textarea {
254
+ width: 100%;
255
+ height: 150px;
256
+ font-family: monospace;
257
+ line-height: 1.5em;
258
+ font-size: 0.8em;
259
+ }
260
+
261
+ .megamenu_outer_wrap .megamenu_right .menu_settings table textarea {
262
+ width: 100%;
263
+ height: 150px;
264
+ font-family: monospace;
265
+ line-height: 1.5em;
266
+ }
267
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .CodeMirror {
268
+ height: 150px;
269
+ border: 1px solid #aaa;
270
+ }
271
+
272
+ .megamenu_outer_wrap .megamenu_right .menu_settings table ul.custom_styling_tips {
273
+ list-style-type: disc;
274
+ list-style-position: inside;
275
+ }
276
+ .megamenu_outer_wrap .megamenu_right .menu_settings table ul.custom_styling_tips code {
277
+ margin: 10px 0 0 0;
278
+ font-size: 0.9em;
279
+ }
280
+ .megamenu_outer_wrap .megamenu_right .menu_settings table label.mega-error input {
281
+ border: 1px solid red;
282
+ background: #FFDDDD;
283
+ }
284
+
285
+ .megamenu_outer_wrap .megamenu_right .menu_settings table label.mega-toggle_blocks {
286
+ width: 100%;
287
+ cursor: auto;
288
+ }
289
+
290
+
291
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block {
292
+ position: relative;
293
+ display: inline-block;
294
+ vertical-align: top;
295
+ margin: 0 5px 0 0;
296
+ }
297
+
298
+ .megamenu_outer_wrap .select2-container-sm .select2-choice>.select2-chosen {
299
+ line-height: 28px;
300
+ margin-right: 0px;
301
+ }
302
+ .megamenu_outer_wrap .tpx-select2-container .select2-choice .select2-arrow:before {
303
+ font: 400 17px/26px dashicons;
304
+ }
305
+
306
+ .mega-menu_page_maxmegamenu_theme_editor .tpx-select2-drop {
307
+ box-shadow: 0 0 0;
308
+ }
309
+ .megamenu_outer_wrap .select2-container-sm .select2-choice .select2-arrow {
310
+ display: none;
311
+ }
312
+ .mega-menu_page_maxmegamenu_theme_editor .select2-results li:first-child {
313
+ float: none;
314
+ }
315
+ .mega-menu_page_maxmegamenu_theme_editor .select2-results li:first-child i {
316
+ display: none;
317
+ }
318
+ .mega-menu_page_maxmegamenu_theme_editor .select2-results li {
319
+ float: left;
320
+ }
321
+ .megamenu_outer_wrap .select2-container-sm .select2-choice {
322
+ padding: 0 5px 0 5px;
323
+ height: 28px;
324
+ color: #B5B5B5;
325
+ }
326
+
327
+ .megamenu_outer_wrap .icon_dropdown .select2-chosen i:before {
328
+ line-height: 28px;
329
+ font-size: 16px;
330
+ color: #333;
331
+ }
332
+
333
+
334
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-left,
335
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-center,
336
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-right {
337
+ box-sizing: border-box;
338
+ border: 1px solid #ccc;
339
+ background: #f7f7f7;
340
+ width: 33%;
341
+ height: 60px;
342
+ padding: 10px;
343
+ margin-top: 15px;
344
+ float: left;
345
+ }
346
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-left {
347
+ border-right: 0px;
348
+ }
349
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-center {
350
+ border-left: 1px dashed #ccc;
351
+ border-right: 1px dashed #ccc;
352
+ text-align: center;
353
+ }
354
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-right {
355
+ border-left: 0px;
356
+ }
357
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-right .block {
358
+ float: right;
359
+ margin: 0 0 0 5px;
360
+ }
361
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block.mega-open .block-title {
362
+ border-bottom: 1px solid white;
363
+ border-radius: 3px 3px 0 0;
364
+ }
365
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block .block-title {
366
+ padding: 0 10px;
367
+ display: inline-block;
368
+ height: 35px;
369
+ line-height: 35px;
370
+ background: white;
371
+ color: #555;
372
+ cursor: move;
373
+ border: 1px solid #ccc;
374
+ position: relative;
375
+ z-index: 2;
376
+ border-radius: 3px;
377
+ }
378
+
379
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block .block-title .dashicons {
380
+ line-height: 35px;
381
+ cursor: pointer;
382
+ font-size: 20px;
383
+ }
384
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block .block-settings {
385
+ padding: 10px;
386
+ display: none;
387
+ width: 200px;
388
+ vertical-align: top;
389
+ background: white;
390
+ text-align: left;
391
+ color: #ccc;
392
+ position: absolute;
393
+ left: 0px;
394
+ top: 36px;
395
+ z-index: 1;
396
+ border: 1px solid #ccc;
397
+ }
398
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .mega-right .block .block-settings {
399
+ left: auto;
400
+ right: 0;
401
+ }
402
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .mega-blocks .block h3 {
403
+ margin-top: 5px;
404
+ border-bottom: 1px solid #ccc;
405
+ padding-bottom: 10px;
406
+ }
407
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .block-settings label {
408
+ width: 100%;
409
+ clear: both;
410
+ color: #333;
411
+ font-size: 1em;
412
+ }
413
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .block-settings label input,
414
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .block-settings label select,
415
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .block-settings label input,
416
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .block-settings label .icon_dropdown {
417
+ float: right;
418
+ font-size: 0.9em;
419
+ }
420
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .toggle-left {
421
+ border-right: 1px dashed #ccc;
422
+ }
423
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .toggle-bar-designer .toggle-right {
424
+ border-left: 0px solid #ccc;
425
+ text-align: right;
426
+
427
+ }
428
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[type=text] {
429
+ width: 70px;
430
+ }
431
+ .megamenu_outer_wrap .megamenu_right .menu_settings table label {
432
+ font-size: 0.9em;
433
+ float: left;
434
+ margin-right: 10px;
435
+ margin-bottom: 10px;
436
+ }
437
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .mega-validation-message {
438
+ display: none;
439
+ clear: both;
440
+ font-size: 0.8em;
441
+ color: red;
442
+ }
443
+ .megamenu_outer_wrap .megamenu_right .menu_settings table label span.mega-short-desc {
444
+ font-size: 0.8em;
445
+ text-transform: uppercase;
446
+ color: #aaa;
447
+ display: block;
448
+ margin: 0 0 2px 1px;
449
+ }
450
+ .megamenu_outer_wrap .megamenu_right .menu_settings table .wide input[type=text] {
451
+ width: 300px;
452
+ }
453
+
454
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[type=submit] {
455
+ width: auto;
456
+ }
457
+ .megamenu_outer_wrap .megamenu_right .menu_settings table input[type=checkbox] {
458
+ width: 16px;
459
+ height: 16px;
460
+ vertical-align: middle;
461
+ }
462
+ .megamenu_outer_wrap .megamenu_right .menu_settings table {
463
+ width: 100%;
464
+ border-collapse: collapse;
465
+ }
466
+ .megamenu_outer_wrap .megamenu_right .menu_settings .accordion-container h4 {
467
+ margin: 0;
468
+ }
469
+ .megamenu_outer_wrap .megamenu_right .menu_settings .accordion-container {
470
+ border: 1px solid #dfdfdf;
471
+ }
472
+
473
+ .megamenu_outer_wrap .megamenu_right .menu_settings .accordion-container .accordion-section-content {
474
+ padding-left: 10px;
475
+ padding-right: 10px;
476
+ }
477
+
478
+ .megamenu_outer_wrap .megamenu_right .menu_settings .row h5 {
479
+ margin: 0;
480
+ font-weight: normal;
481
+ float: left;
482
+ width: 250px;
483
+ font-size: 1em;
484
+ }
485
+
486
+ .megamenu_outer_wrap .megamenu_right .fail {
487
+ border: 1px solid #aaa;
488
+ border-left: 4px solid #dd3d36;
489
+ background: #fff;
490
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
491
+ padding: 7px 0 7px 15px;
492
+ margin: 0 0 20px 0;
493
+ }
494
+ .megamenu_outer_wrap .megamenu_wrap .success {
495
+ border: 1px solid #aaa;
496
+ border-left: 4px solid #7ad03a;
497
+ background: #fff;
498
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
499
+ padding: 7px 0 7px 7px;
500
+ margin: 0 0 20px 0;
501
+ }
502
+ .megamenu_outer_wrap .megamenu_wrap .success .dashicons {
503
+ color: #7ad03a;
504
+ margin-right: 7px;
505
+ }
506
+ .megamenu_outer_wrap .megamenu_right .menu_settings select.icon_dropdown {
507
+ margin-right: 0;
508
+ }
509
+ .select2-drop {
510
+ min-width: 150px;
511
+ }
512
+ .select2-results .select2-result-label {
513
+ font-size: 0.9em;
514
+ }
515
+ .megamenu_outer_wrap .megamenu_right .menu_settings h3.editing_theme {
516
+ margin: 0px 0 30px 0;
517
+ }
518
+
519
+ .megamenu_outer_wrap .mm-picker-container .sp-replacer {
520
+ margin: 0;
521
+ float: left;
522
+ }
523
+
524
+ .megamenu_outer_wrap .mm-picker-container .sp-replacer .sp-preview {
525
+ border: 0;
526
+ height: 26px;
527
+ width: 26px;
528
+ margin: 0;
529
+ }
530
+ .megamenu_outer_wrap .mm-picker-container input.mm_colorpicker {
531
+ float: left;
532
+ border: 0;
533
+ height: 23px;
534
+ box-shadow: 0 0 0;
535
+ margin: 0;
536
+ }
537
+
538
+
539
+
540
+ .megamenu_outer_wrap .mm-picker-container {
541
+ border-radius: 3px;
542
+ box-shadow: 0 1px 0 rgba(0,0,0,.08);
543
+ border: 1px solid #ccc;
544
+ font-size: 0.9em;
545
+ margin-right: 10px;
546
+ float: left;
547
+ }
548
+
549
+ .megamenu_outer_wrap .block .mm-picker-container {
550
+ float: right;
551
+ margin-right: 0;
552
+ }
553
+
554
+ .megamenu_outer_wrap .mm-picker-container div.chosen-color {
555
+ background: #f7f7f7;
556
+ -webkit-border-radius: 0 2px 2px 0;
557
+ border-radius: 0 2px 2px 0;
558
+ border-left: 1px solid #ccc;
559
+ color: #555;
560
+ font-size: 11px;
561
+ line-height: 26px;
562
+ padding: 0 6px;
563
+ text-align: center;
564
+ -webkit-box-shadow: inset 0 1px 0 #fff;
565
+ box-shadow: inset 0 1px 0 #fff;
566
+ float: left;
567
+ cursor: default;
568
+ }
569
+ .megamenu_outer_wrap .megamenu_right .mega-location .mega-assigned-menu:before {
570
+ font: 400 20px/21px dashicons;
571
+ content: "\f142";
572
+ speak: none;
573
+ padding: 0;
574
+ display: inline-block;
575
+ vertical-align: top;
576
+ -webkit-font-smoothing: antialiased;
577
+ -moz-osx-font-smoothing: grayscale;
578
+ }
579
+ .megamenu_outer_wrap .mega-delete {
580
+ margin-bottom: 15px;
581
+ cursor: pointer;
582
+ }
583
+ .megamenu_outer_wrap .megamenu_right .mega-location .mega-assigned-menu:before {
584
+ content: "\f333";
585
+ font-size: 16px;
586
+ margin-right: 2px;
587
+ }
588
+ .megamenu_outer_wrap .megamenu_right .mega-location .mega-assigned-menu {
589
+ float: right;
590
+ text-transform: uppercase;
591
+ font-weight: bold;
592
+ opacity: 0.7;
593
+ margin-right: 28px;
594
+ font-size: 0.8em;
595
+ }
596
+ .megamenu_outer_wrap .megamenu_right .menu_settings .mega-location table textarea {
597
+ height: 30px;
598
+ }
599
+ .megamenu_outer_wrap .megamenu_right .mega-location .accordion-section-content {
600
+ width: 100%;
601
+ box-sizing: border-box;
602
+ }
603
+
css/megamenu.scss ADDED
@@ -0,0 +1,690 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ---------------- DO NOT EDIT THIS FILE DIRECTLY ---------------
2
+ // Copy this file to the wp-content/themes/YOUR_THEME/megamenu/megamenu.scss
3
+ //
4
+ // Important Note: Re-save your menu in WordPress after copying this
5
+ // file in order to regenerate the cached CSS.
6
+ //
7
+ // Developer Tips
8
+ // -- Set "define("MEGAMENU_DEBUG", true);" in wp-config.php to disable CSS cache
9
+ // -- Add &nocache to the CSS URL to regenerate cache
10
+
11
+ #{$wrap},
12
+ #{$wrap} #{$menu},
13
+ #{$wrap} #{$menu} ul.mega-sub-menu,
14
+ #{$wrap} #{$menu} li.mega-menu-item,
15
+ #{$wrap} #{$menu} a.mega-menu-link {
16
+ -moz-transition: none;
17
+ -o-transition: none;
18
+ -webkit-transition: none;
19
+ transition: none;
20
+ @include border-radius(0, 0, 0, 0);
21
+ @include box-shadow(none);
22
+ background: none;
23
+ border: 0;
24
+ bottom: auto;
25
+ box-sizing: border-box;
26
+ clip: auto;
27
+ color: $panel_font_color;
28
+ display: block;
29
+ float: none;
30
+ font-family: $panel_font_family;
31
+ font-size: $panel_font_size;
32
+ height: auto;
33
+ left: auto;
34
+ line-height: $line_height;
35
+ list-style-type: none;
36
+ margin: 0;
37
+ min-height: 0;
38
+ opacity: 1;
39
+ outline: none;
40
+ overflow: visible;
41
+ padding: 0;
42
+ position: relative;
43
+ right: auto;
44
+ text-align: left;
45
+ text-decoration: none;
46
+ text-transform: none;
47
+ top: auto;
48
+ vertical-align: baseline;
49
+ visibility: inherit;
50
+ width: auto;
51
+
52
+ &:before,
53
+ &:after {
54
+ display: none;
55
+ }
56
+ }
57
+
58
+ #{$wrap} {
59
+ @include background($container_background_from, $container_background_to);
60
+ @include border-radius($container_border_radius_top_left, $container_border_radius_top_right, $container_border_radius_bottom_right, $container_border_radius_bottom_left);
61
+
62
+ #{$menu} {
63
+ visibility: visible;
64
+ text-align: $menu_item_align;
65
+ padding: $container_padding_top $container_padding_right $container_padding_bottom $container_padding_left;
66
+
67
+ a.mega-menu-link {
68
+ display: inline;
69
+
70
+ @if $transitions == 'on' {
71
+ -webkit-transition: background 200ms linear, color 200ms linear;
72
+ -moz-transition: background 200ms linear, color 200ms linear;
73
+ -o-transition: background 200ms linear, color 200ms linear;
74
+ transition: background 200ms linear, color 200ms linear;
75
+ }
76
+ }
77
+
78
+ p {
79
+ margin-bottom: 10px;
80
+ }
81
+
82
+ input,
83
+ img {
84
+ max-width: 100%;
85
+ }
86
+
87
+ li.mega-menu-item > ul.mega-sub-menu {
88
+ display: block;
89
+ visibility: hidden;
90
+ opacity: 1;
91
+ }
92
+
93
+ &.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
94
+ &.mega-no-js li.mega-menu-item:focus > ul.mega-sub-menu,
95
+ li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu,
96
+ li.mega-menu-item.mega-menu-megamenu.mega-toggle-on ul.mega-sub-menu {
97
+ visibility: visible;
98
+ }
99
+
100
+ li.mega-menu-item a[class^='dashicons']:before {
101
+ font-family: dashicons;
102
+ }
103
+
104
+ li.mega-disable-link > a.mega-menu-link {
105
+ cursor: default;
106
+ }
107
+
108
+ li.mega-menu-item a.mega-menu-link:before {
109
+ display: inline-block;
110
+ font: inherit;
111
+ font-family: dashicons;
112
+ position: static;
113
+ margin: 0 6px 0 0px;
114
+ vertical-align: top;
115
+ -webkit-font-smoothing: antialiased;
116
+ -moz-osx-font-smoothing: grayscale;
117
+ color: inherit;
118
+ }
119
+
120
+ li.mega-menu-item.mega-hide-text a.mega-menu-link:before {
121
+ margin: 0;
122
+ }
123
+
124
+ li.mega-align-bottom-left {
125
+ > ul.mega-sub-menu {
126
+
127
+ }
128
+
129
+ &.mega-toggle-on > a.mega-menu-link {
130
+ @include border-radius($menu_item_link_border_radius_top_left, $menu_item_link_border_radius_top_right, 0, 0);
131
+ }
132
+ }
133
+
134
+ li.mega-align-bottom-right {
135
+ > ul.mega-sub-menu {
136
+ right: 0;
137
+ }
138
+
139
+ &.mega-toggle-on > a.mega-menu-link {
140
+ @include border-radius($menu_item_link_border_radius_top_left, $menu_item_link_border_radius_top_right, 0, 0);
141
+ }
142
+ }
143
+
144
+ @if unit($panel_width) == '%' {
145
+ > li.mega-menu-megamenu.mega-menu-item {
146
+ position: static;
147
+ }
148
+ }
149
+
150
+ // top level items
151
+ > li.mega-menu-item {
152
+
153
+ margin: 0 $menu_item_spacing 0 0;
154
+ display: inline-block;
155
+ height: auto;
156
+
157
+ @if $menu_item_divider == 'on' {
158
+ border-left: 1px solid $menu_item_divider_color;
159
+ -webkit-box-shadow: inset 1px 0 0 0 rgba(255,255,255,$menu_item_divider_glow_opacity);
160
+ -moz-box-shadow: inset 1px 0 0 0 rgba(255,255,255,$menu_item_divider_glow_opacity);
161
+ box-shadow: inset 1px 0 0 0 rgba(255,255,255,$menu_item_divider_glow_opacity);
162
+
163
+ /* Hide divider on first menu item */
164
+ &:first-of-type {
165
+ border-left: 0;
166
+ -webkit-box-shadow: none;
167
+ -moz-box-shadow: none;
168
+ box-shadow: none;
169
+ }
170
+ }
171
+
172
+ &.mega-item-align-right {
173
+ float: right;
174
+ margin: 0 0 0 $menu_item_spacing;
175
+ }
176
+
177
+ &.mega-toggle-on > a.mega-menu-link,
178
+ > a.mega-menu-link:hover,
179
+ > a.mega-menu-link:focus {
180
+ @include background($menu_item_background_hover_from, $menu_item_background_hover_to);
181
+ color: $menu_item_link_color_hover;
182
+ font-weight: $menu_item_link_weight_hover;
183
+ text-decoration: $menu_item_link_text_decoration_hover;
184
+ border-color: $menu_item_border_color_hover;
185
+ }
186
+
187
+ @if $menu_item_highlight_current == 'on' {
188
+
189
+ &.mega-current-menu-item,
190
+ &.mega-current-menu-ancestor {
191
+ > a.mega-menu-link {
192
+ @include background($menu_item_background_hover_from, $menu_item_background_hover_to);
193
+ color: $menu_item_link_color_hover;
194
+ font-weight: $menu_item_link_weight_hover;
195
+ text-decoration: $menu_item_link_text_decoration_hover;
196
+ }
197
+ }
198
+
199
+ }
200
+
201
+ > a.mega-menu-link {
202
+ border-top: $menu_item_border_top solid $menu_item_border_color;
203
+ border-left: $menu_item_border_left solid $menu_item_border_color;
204
+ border-right: $menu_item_border_right solid $menu_item_border_color;
205
+ border-bottom: $menu_item_border_bottom solid $menu_item_border_color;
206
+ outline: none;
207
+ text-decoration: none;
208
+ padding: $menu_item_link_padding_top $menu_item_link_padding_right $menu_item_link_padding_bottom $menu_item_link_padding_left;
209
+ line-height: $menu_item_link_height;
210
+ font-weight: $menu_item_link_weight;
211
+ height: $menu_item_link_height;
212
+ vertical-align: baseline;
213
+ text-align: left;
214
+ width: auto;
215
+ display: block;
216
+ color: $menu_item_link_color;
217
+ text-transform: $menu_item_link_text_transform;
218
+ text-decoration: $menu_item_link_text_decoration;
219
+ @include background($menu_item_background_from, $menu_item_background_to);
220
+ @include border-radius($menu_item_link_border_radius_top_left, $menu_item_link_border_radius_top_right, $menu_item_link_border_radius_bottom_right, $menu_item_link_border_radius_bottom_left);
221
+ font-family: $menu_item_link_font;
222
+ font-size: $menu_item_link_font_size;
223
+ cursor: pointer;
224
+ }
225
+
226
+ @include mobile {
227
+ display: list-item;
228
+ margin: 0;
229
+ clear: both;
230
+ border: 0;
231
+
232
+ &.mega-item-align-right {
233
+ float: none;
234
+ }
235
+
236
+ > a.mega-menu-link {
237
+ @include border-radius(0 0 0 0);
238
+ border: 0;
239
+ margin: 0;
240
+ line-height: $mobile_menu_item_height;
241
+ height: $mobile_menu_item_height;
242
+ padding: 0 10px;
243
+ }
244
+
245
+ }
246
+
247
+ }
248
+
249
+ // sub menu items (megamenu)
250
+
251
+ > li.mega-menu-megamenu > ul.mega-sub-menu {
252
+ z-index: $z_index;
253
+ @include border-radius($panel_border_radius_top_left, $panel_border_radius_top_right, $panel_border_radius_bottom_right, $panel_border_radius_bottom_left);
254
+ @include background($panel_background_from, $panel_background_to);
255
+ padding: $panel_padding_top $panel_padding_right $panel_padding_bottom $panel_padding_left;
256
+ position: absolute;
257
+ width: $panel_width;
258
+ border-top: $panel_border_top solid $panel_border_color;
259
+ border-left: $panel_border_left solid $panel_border_color;
260
+ border-right: $panel_border_right solid $panel_border_color;
261
+ border-bottom: $panel_border_bottom solid $panel_border_color;
262
+
263
+ @if unit($panel_width) == '%' {
264
+ left: 0;
265
+ }
266
+
267
+ @if unit($panel_inner_width) == '%' and $panel_inner_width < 100% {
268
+ padding-left: (100 - $panel_inner_width) / 2;
269
+ padding-right: (100 - $panel_inner_width) / 2;
270
+ }
271
+
272
+ @if $shadow == 'on' {
273
+ @include box-shadow($shadow_horizontal $shadow_vertical $shadow_blur $shadow_spread $shadow_color);
274
+ }
275
+
276
+ @include mobile {
277
+ float: left;
278
+ position: static;
279
+ width: 100% !important;
280
+ }
281
+
282
+ @for $of from 1 through 8 {
283
+
284
+ @for $cols from 1 through $of {
285
+
286
+ > li.mega-menu-columns-#{$cols}-of-#{$of} {
287
+ width: (100% / $of) * $cols;
288
+ }
289
+
290
+ }
291
+ }
292
+
293
+
294
+ > li.mega-menu-item ul.mega-sub-menu {
295
+ clear: both;
296
+
297
+ li.mega-menu-item ul.mega-sub-menu {
298
+ margin-left: 10px;
299
+
300
+ li.mega-menu-item ul.mega-sub-menu {
301
+ margin-left: 20px;
302
+ }
303
+ }
304
+ }
305
+
306
+ > li.mega-menu-item {
307
+ color: $panel_font_color;
308
+ font-family: $panel_font_family;
309
+ font-size: $panel_font_size;
310
+ display: block;
311
+ float: left;
312
+ clear: none;
313
+ padding: $panel_widget_padding_top $panel_widget_padding_right $panel_widget_padding_bottom $panel_widget_padding_left;
314
+ vertical-align: top;
315
+
316
+ &.mega-menu-clear {
317
+ clear: left;
318
+ }
319
+
320
+ /* Widget titles */
321
+ h4.mega-block-title {
322
+ color: $panel_header_color;
323
+ font-family: $panel_header_font;
324
+ font-size: $panel_header_font_size;
325
+ text-transform: $panel_header_text_transform;
326
+ text-decoration: $panel_header_text_decoration;
327
+ font-weight: $panel_header_font_weight;
328
+ margin: $panel_header_margin_top $panel_header_margin_right $panel_header_margin_bottom $panel_header_margin_left;
329
+ padding: $panel_header_padding_top $panel_header_padding_right $panel_header_padding_bottom $panel_header_padding_left;
330
+ vertical-align: top;
331
+ display: block;
332
+ border-top: $panel_header_border_top solid $panel_header_border_color;
333
+ border-left: $panel_header_border_left solid $panel_header_border_color;
334
+ border-right: $panel_header_border_right solid $panel_header_border_color;
335
+ border-bottom: $panel_header_border_bottom solid $panel_header_border_color;
336
+ }
337
+
338
+ /* Second level menu item */
339
+ > a.mega-menu-link {
340
+ color: $panel_second_level_font_color;
341
+ font-family: $panel_second_level_font;
342
+ font-size: $panel_second_level_font_size;
343
+ text-transform: $panel_second_level_text_transform;
344
+ text-decoration: $panel_second_level_text_decoration;
345
+ font-weight: $panel_second_level_font_weight;
346
+ margin: $panel_second_level_margin_top $panel_second_level_margin_right $panel_second_level_margin_bottom $panel_second_level_margin_left;
347
+ padding: $panel_second_level_padding_top $panel_second_level_padding_right $panel_second_level_padding_bottom $panel_second_level_padding_left;
348
+ vertical-align: top;
349
+ display: block;
350
+ border-top: $panel_second_level_border_top solid $panel_second_level_border_color;
351
+ border-left: $panel_second_level_border_left solid $panel_second_level_border_color;
352
+ border-right: $panel_second_level_border_right solid $panel_second_level_border_color;
353
+ border-bottom: $panel_second_level_border_bottom solid $panel_second_level_border_color;
354
+ }
355
+
356
+ /* Second level menu item hover */
357
+ > a.mega-menu-link:hover,
358
+ > a.mega-menu-link:focus {
359
+ color: $panel_second_level_font_color_hover;
360
+ font-weight: $panel_second_level_font_weight_hover;
361
+ text-decoration: $panel_second_level_text_decoration_hover;
362
+ @include background($panel_second_level_background_hover_from, $panel_second_level_background_hover_to);
363
+ }
364
+
365
+ /* Third level menu item */
366
+ li.mega-menu-item > a.mega-menu-link {
367
+ color: $panel_third_level_font_color;
368
+ font-family: $panel_third_level_font;
369
+ font-size: $panel_third_level_font_size;
370
+ text-transform: $panel_third_level_text_transform;
371
+ text-decoration: $panel_third_level_text_decoration;
372
+ font-weight: $panel_third_level_font_weight;
373
+ margin: 0;
374
+ padding: $panel_third_level_padding_top $panel_third_level_padding_right $panel_third_level_padding_bottom $panel_third_level_padding_left;
375
+ vertical-align: top;
376
+ display: block;
377
+ }
378
+
379
+ /* Third level menu item hover */
380
+ li.mega-menu-item > a.mega-menu-link:hover,
381
+ li.mega-menu-item > a.mega-menu-link:focus {
382
+ color: $panel_third_level_font_color_hover;
383
+ font-weight: $panel_third_level_font_weight_hover;
384
+ text-decoration: $panel_third_level_text_decoration_hover;
385
+ @include background($panel_third_level_background_hover_from, $panel_third_level_background_hover_to);
386
+ }
387
+ }
388
+
389
+ @include mobile {
390
+ border: 0;
391
+ padding: 10px;
392
+ @include border-radius(0,0,0,0);
393
+
394
+ @if $mobile_columns == 2 {
395
+ > li.mega-menu-item {
396
+ width: 50%;
397
+ }
398
+
399
+ > li:nth-child(odd) {
400
+ clear: left;
401
+ }
402
+ } @else {
403
+ > li.mega-menu-item {
404
+ width: 100%;
405
+ clear: both;
406
+ }
407
+ }
408
+ }
409
+ }
410
+
411
+ // sub menu items (flyout)
412
+
413
+ > li.mega-menu-flyout ul.mega-sub-menu {
414
+ z-index: $z_index;
415
+ position: absolute;
416
+ width: $flyout_width;
417
+ border-top: $flyout_border_top solid $flyout_border_color;
418
+ border-left: $flyout_border_left solid $flyout_border_color;
419
+ border-right: $flyout_border_right solid $flyout_border_color;
420
+ border-bottom: $flyout_border_bottom solid $flyout_border_color;
421
+ padding: $flyout_padding_top $flyout_padding_right $flyout_padding_bottom $flyout_padding_left;
422
+ @include background($flyout_menu_background_from, $flyout_menu_background_to);
423
+
424
+ @if $shadow == 'on' {
425
+ @include box-shadow($shadow_horizontal $shadow_vertical $shadow_blur $shadow_spread $shadow_color);
426
+ }
427
+
428
+ @include mobile {
429
+ float: left;
430
+ position: static;
431
+ width: 100% !important;
432
+ padding: 0;
433
+ border: 0;
434
+ }
435
+
436
+ li.mega-menu-item {
437
+
438
+ @if $flyout_menu_item_divider == 'on' {
439
+ border-bottom: 1px solid $flyout_menu_item_divider_color;
440
+
441
+ /* Hide divider on last menu item */
442
+ &:last-child {
443
+ border-bottom: 0;
444
+ -webkit-box-shadow: none;
445
+ -moz-box-shadow: none;
446
+ box-shadow: none;
447
+ }
448
+ }
449
+
450
+ @include mobile {
451
+ clear: both;
452
+ }
453
+
454
+ a.mega-menu-link {
455
+ display: block;
456
+ @include background($flyout_background_from, $flyout_background_to);
457
+ color: $flyout_link_color;
458
+ font-family: $flyout_link_family;
459
+ font-size: $flyout_link_size;
460
+ font-weight: $flyout_link_weight;
461
+ padding: $flyout_link_padding_top $flyout_link_padding_right $flyout_link_padding_bottom $flyout_link_padding_left;
462
+ line-height: $flyout_link_height;
463
+ text-decoration: $flyout_link_text_decoration;
464
+ text-transform: $flyout_link_text_transform;
465
+ vertical-align: baseline;
466
+ }
467
+
468
+ &:first-child a.mega-menu-link {
469
+ border-top-left-radius: $flyout_border_radius_top_left;
470
+ border-top-right-radius: $flyout_border_radius_top_right;
471
+
472
+ @include mobile {
473
+ border-top-left-radius: 0;
474
+ border-top-right-radius: 0;
475
+ }
476
+ }
477
+
478
+ &:last-child a.mega-menu-link {
479
+ border-bottom-right-radius: $flyout_border_radius_bottom_right;
480
+ border-bottom-left-radius: $flyout_border_radius_bottom_left;
481
+
482
+ @include mobile {
483
+ border-bottom-right-radius: 0;
484
+ border-bottom-left-radius: 0;
485
+ }
486
+ }
487
+
488
+ a.mega-menu-link:hover,
489
+ a.mega-menu-link:focus {
490
+ @include background($flyout_background_hover_from, $flyout_background_hover_to);
491
+ font-weight: $flyout_link_weight_hover;
492
+ text-decoration: $flyout_link_text_decoration_hover;
493
+ color: $flyout_link_color_hover;
494
+ }
495
+
496
+ ul.mega-sub-menu {
497
+ position: absolute;
498
+ left: 100%;
499
+ top: 0;
500
+ }
501
+
502
+ @include mobile {
503
+ ul.mega-sub-menu {
504
+ position: static;
505
+ left: 0;
506
+ width: 100%;
507
+
508
+ a.mega-menu-link {
509
+ padding-left: 20px;
510
+ }
511
+ }
512
+ }
513
+ }
514
+ }
515
+
516
+ // arrows
517
+ li.mega-menu-flyout.mega-menu-item-has-children,
518
+ li.mega-menu-flyout li.mega-menu-item-has-children,
519
+ > li.mega-menu-item-has-children {
520
+
521
+ > a.mega-menu-link:after {
522
+ content: $arrow_down;
523
+ display: inline-block;
524
+ font: inherit;
525
+ font-family: dashicons;
526
+ margin: 0 0 0 6px;
527
+ vertical-align: top;
528
+ -webkit-font-smoothing: antialiased;
529
+ -moz-osx-font-smoothing: grayscale;
530
+ -webkit-transform: rotate(0);
531
+ -moz-transform: rotate(0);
532
+ -ms-transform: rotate(0);
533
+ -o-transform: rotate(0);
534
+ transform: rotate(0);
535
+ color: inherit;
536
+ }
537
+
538
+ @include mobile {
539
+ a.mega-menu-link:after {
540
+ float: right;
541
+ }
542
+
543
+ &.mega-toggle-on > a.mega-menu-link:after {
544
+ content: $arrow_up;
545
+ }
546
+
547
+ &.mega-hide-sub-menu-on-mobile > a.mega-menu-link:after {
548
+ display: none;
549
+ }
550
+ }
551
+ }
552
+
553
+ // arrows
554
+ li.mega-menu-flyout.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
555
+ li.mega-menu-flyout li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
556
+ > li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after {
557
+ display: none;
558
+ }
559
+
560
+
561
+ li.mega-menu-item li.mega-menu-item-has-children > a.mega-menu-link:after {
562
+ content: $arrow_right;
563
+ float: right;
564
+ margin: 0;
565
+
566
+ @include mobile {
567
+ content: $arrow_down;
568
+ }
569
+ }
570
+
571
+ li.mega-menu-flyout.mega-align-bottom-right {
572
+
573
+ li.mega-menu-item a.mega-menu-link {
574
+ text-align: right;
575
+
576
+ @include mobile {
577
+ text-align: left;
578
+ }
579
+ }
580
+
581
+ li.mega-menu-item a.mega-menu-link:before {
582
+ float: right;
583
+ margin: 0 0 0 6px;
584
+
585
+ @include mobile {
586
+ float: left;
587
+ margin: 0 6px 0 0;
588
+ }
589
+ }
590
+
591
+ li.mega-menu-item-has-children > a.mega-menu-link:after {
592
+ content: $arrow_left;
593
+ float: left;
594
+ margin: 0;
595
+
596
+ @include mobile {
597
+ content: $arrow_down;
598
+ float: right;
599
+ }
600
+ }
601
+
602
+ ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu {
603
+ left: -100%;
604
+ top: 0;
605
+ }
606
+ }
607
+
608
+ // polylang Language Switcher
609
+ li[class^='mega-lang-item'] > a.mega-menu-link > img {
610
+ display: inline;
611
+ }
612
+
613
+ // WPML Flags
614
+ a.mega-menu-link > img.iclflag {
615
+ display: inline;
616
+ margin-right: 8px;
617
+ }
618
+
619
+ @include mobile {
620
+ li.mega-menu-item.mega-hide-on-mobile,
621
+ > li.mega-menu-megamenu > ul.mega-sub-menu > li.mega-menu-item.mega-hide-on-mobile {
622
+ display: none;
623
+ }
624
+ }
625
+
626
+ @include desktop {
627
+ li.mega-menu-item.mega-hide-on-desktop,
628
+ > li.mega-menu-megamenu > ul.mega-sub-menu > li.mega-menu-item.mega-hide-on-desktop {
629
+ display: none;
630
+ }
631
+ }
632
+
633
+ }
634
+
635
+ // responsive toggle hamburger
636
+ .mega-menu-toggle {
637
+ display: none;
638
+ z-index: 1;
639
+ cursor: pointer;
640
+ @include background($toggle_background_from, $toggle_background_to);
641
+ @include border-radius(2px, 2px, 2px, 2px);
642
+ line-height: 40px;
643
+ height: 40px;
644
+ text-align: center;
645
+
646
+ @include mobile {
647
+ display: block;
648
+ }
649
+
650
+ .mega-toggle-block {
651
+ text-align: left;
652
+ display: inline-block;
653
+ padding: 0 10px;
654
+ height: 100%;
655
+ }
656
+
657
+ .mega-toggle-block-left {
658
+ float: left;
659
+ }
660
+
661
+ .mega-toggle-block-center {
662
+ float: none;
663
+ }
664
+
665
+ .mega-toggle-block-right {
666
+ float: right;
667
+ }
668
+
669
+ @include mobile {
670
+ + #{$menu} {
671
+ display: none;
672
+
673
+ li.mega-menu-item > ul.mega-sub-menu {
674
+ display: none;
675
+ visibility: visible;
676
+ opacity: 1;
677
+ }
678
+
679
+ li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu,
680
+ li.mega-menu-item.mega-menu-megamenu.mega-toggle-on ul.mega-sub-menu {
681
+ display: block;
682
+ }
683
+ }
684
+
685
+ &.mega-menu-open + #{$menu} {
686
+ display: block;
687
+ }
688
+ }
689
+ }
690
+ }
css/mixin.scss ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @mixin border-radius($topleft: 0, $topright: 0, $bottomright: 0, $bottomleft: 0) {
2
+ -webkit-border-radius: $topleft $topright $bottomright $bottomleft;
3
+ -moz-border-radius: $topleft $topright $bottomright $bottomleft;
4
+ -ms-border-radius: $topleft $topright $bottomright $bottomleft;
5
+ -o-border-radius: $topleft $topright $bottomright $bottomleft;
6
+ border-radius: $topleft $topright $bottomright $bottomleft;
7
+ }
8
+
9
+ @mixin box-shadow($value) {
10
+ -webkit-box-shadow: $value;
11
+ -moz-box-shadow: $value;
12
+ -ms-box-shadow: $value;
13
+ -o-box-shadow: $value;
14
+ box-shadow: $value;
15
+ }
16
+
17
+ @mixin background($from, $to) {
18
+ @if $to == $from {
19
+ background: $to;
20
+ } @else {
21
+ background: $to;
22
+ background: -webkit-gradient(linear, left top, left bottom, from($from), to($to));
23
+ background: -moz-linear-gradient(top, $from, $to);
24
+ background: -ms-linear-gradient(top, $from, $to);
25
+ background: -o-linear-gradient(top, $from, $to);
26
+ background: linear-gradient(to bottom, $from, $to);
27
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie_hex_str($from)}', endColorstr='#{ie_hex_str($to)}');
28
+ }
29
+ }
30
+
31
+ @mixin mobile {
32
+ @media only screen and (max-width : $responsive_breakpoint) {
33
+ @content;
34
+ }
35
+ }
36
+
37
+ @mixin desktop {
38
+ @media only screen and (min-width : $responsive_breakpoint + 1) {
39
+ @content;
40
+ }
41
+ }
42
+
css/reset.scss ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @if $resets == 'on' {
2
+ #{$wrap} #{$menu} ul,
3
+ #{$wrap} #{$menu} li,
4
+ #{$wrap} #{$menu} p,
5
+ #{$wrap} #{$menu} img,
6
+ #{$wrap} #{$menu} div,
7
+ #{$wrap} #{$menu} a {
8
+ color: $panel_font_color;
9
+ font-family: $panel_font_family;
10
+ font-size: $panel_font_size;
11
+ background: none;
12
+ border: 0;
13
+ @include border-radius(0, 0, 0, 0);
14
+ margin: 0;
15
+ opacity: 1;
16
+ padding: 0;
17
+ position: relative;
18
+ right: auto;
19
+ top: auto;
20
+ bottom: auto;
21
+ left: auto;
22
+ text-align: left;
23
+ text-transform: none;
24
+ vertical-align: baseline;
25
+ @include box-shadow(none);
26
+ list-style-type: none;
27
+ line-height: $line_height;
28
+ box-sizing: border-box;
29
+ float: none;
30
+ overflow: visible;
31
+ display: block;
32
+ min-height: 0;
33
+ -webkit-transition: none;
34
+ -moz-transition: none;
35
+ -o-transition: none;
36
+ transition: none;
37
+ text-decoration: none;
38
+ width: auto;
39
+ clip: auto;
40
+ height: auto;
41
+ outline: none;
42
+ visibility: inherit;
43
+
44
+ &:before,
45
+ &:after {
46
+ display: none;
47
+ }
48
+ }
49
+
50
+ #{$wrap} #{$menu} table,
51
+ #{$wrap} #{$menu} td,
52
+ #{$wrap} #{$menu} tr,
53
+ #{$wrap} #{$menu} th {
54
+ border: 0;
55
+ margin: 0;
56
+ padding: 0;
57
+ background: none;
58
+ }
59
+ }
css/toggle-blocks.scss ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #{$wrap} .mega-menu-toggle {
2
+
3
+ /** Menu Toggle Blocks **/
4
+ @each $item in $menu_toggle_blocks {
5
+ $id: nth($item, 1);
6
+ $align: nth($item, 2);
7
+ $closed_text: nth($item, 3);
8
+ $open_text: nth($item, 4);
9
+ $closed_icon: nth($item, 5);
10
+ $open_icon: nth($item, 6);
11
+ $text_color: nth($item, 7);
12
+ $icon_color: nth($item, 8);
13
+ $icon_position: nth($item, 9);
14
+
15
+ @if type-of($id) == number {
16
+
17
+ #mega-toggle-block-#{$id}:before {
18
+ content: $closed_icon;
19
+ font-family: 'dashicons';
20
+ font-size: 24px;
21
+ margin: 0 0 0 5px;
22
+ color: $icon_color;
23
+ }
24
+
25
+ &.mega-menu-open #mega-toggle-block-#{$id}:before {
26
+ content: $open_icon;
27
+ }
28
+
29
+ #mega-toggle-block-#{$id}:after {
30
+ content: $closed_text;
31
+ color: $text_color;
32
+ float: left;
33
+
34
+ @if $icon_position == before {
35
+ float: right;
36
+ }
37
+ }
38
+
39
+ &.mega-menu-open #mega-toggle-block-#{$id}:after {
40
+ content: $open_text;
41
+ }
42
+ }
43
+
44
+ }
45
+
46
+ /** Spacer Toggle Blocks **/
47
+ @each $item in $spacer_toggle_blocks {
48
+
49
+ $id: nth($item, 1);
50
+ $type: nth($item, 2);
51
+ $align: nth($item, 3);
52
+ $width: nth($item, 4);
53
+
54
+ @if $type == spacer and type-of($id) == number {
55
+
56
+ #mega-toggle-block-#{$id} {
57
+ width: $width;
58
+ }
59
+
60
+ }
61
+
62
+ }
63
+
64
+ }
font/maxmegamenu.eot ADDED
Binary file
font/maxmegamenu.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Copyright (C) 2015 by original authors @ fontello.com</metadata>
5
+ <defs>
6
+ <font id="maxmegamenu" horiz-adv-x="1000" >
7
+ <font-face font-family="maxmegamenu" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
8
+ <missing-glyph horiz-adv-x="1000" />
9
+ <glyph glyph-name="logo-best" unicode="&#xe800;" d="m392 850l1 0c1-1 1-1 2-2 31-23 63-44 95-65 89-61 178-121 267-181 9-6 18-12 27-18l0-1c-13-8-26-17-39-25-117-79-234-157-351-235-2 0-4-1-6 0-89 60-179 120-269 180-40 27-79 54-119 80l0 1c16 11 32 22 48 33 111 74 221 149 331 224 5 3 9 5 13 9l0 0z m-392-386c70-46 140-93 211-139 60-40 120-80 181-119 130 86 261 172 392 258l0-355c-6-4-12-7-17-11-34-22-67-44-101-67 0 10 0 19 0 29 0 69 0 139 0 208-88-58-176-116-264-174-3-2-6-4-10-6-1-1-1 0-2 0-91 60-182 120-273 180 0-79 0-158 0-237-39 26-78 52-117 78l0 355 0 0z m236-392c52-35 104-69 156-103 52 34 104 69 156 103 0-30 0-60 0-90 0-9 0-19 1-28-53-35-105-69-157-104-50 33-100 66-150 99-2 2-6 3-6 5 0 39 0 79 0 118l0 0z" horiz-adv-x="784" />
10
+ </font>
11
+ </defs>
12
+ </svg>
font/maxmegamenu.ttf ADDED
Binary file
font/maxmegamenu.woff ADDED
Binary file
js/admin.js ADDED
@@ -0,0 +1,598 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global console,ajaxurl,$,jQuery*/
2
+
3
+ /**
4
+ * Mega Menu jQuery Plugin
5
+ */
6
+ (function ($) {
7
+ "use strict";
8
+
9
+ $.fn.megaMenu = function (options) {
10
+
11
+ var panel = $("<div />");
12
+
13
+ panel.settings = options;
14
+
15
+ panel.log = function (message) {
16
+ if (window.console && console.log) {
17
+ console.log(message.data);
18
+ }
19
+
20
+ if (message.success !== true) {
21
+ alert(message.data);
22
+ }
23
+ };
24
+
25
+
26
+ panel.init = function () {
27
+
28
+ panel.log({success: true, data: megamenu.debug_launched + " " + panel.settings.menu_item_id});
29
+
30
+ $.colorbox({
31
+ html: "",
32
+ initialWidth: '1000',
33
+ scrolling: true,
34
+ fixed: true,
35
+ top: '10%',
36
+ initialHeight: '472',
37
+ maxHeight: '500'
38
+ });
39
+
40
+ $.ajax({
41
+ type: 'POST',
42
+ url: ajaxurl,
43
+ data: {
44
+ action: "mm_get_lightbox_html",
45
+ _wpnonce: megamenu.nonce,
46
+ menu_item_id: panel.settings.menu_item_id,
47
+ menu_item_depth: panel.settings.menu_item_depth,
48
+ menu_id: panel.settings.menu_id
49
+ },
50
+ cache: false,
51
+ beforeSend: function() {
52
+ $('#cboxLoadedContent').empty();
53
+ $('#cboxClose').empty();
54
+ $('#cboxLoadingGraphic').show();
55
+ },
56
+ complete: function() {
57
+ $('#cboxLoadingGraphic').hide();
58
+ $('#cboxLoadingOverlay').remove();
59
+ },
60
+ success: function(response) {
61
+ var json = $.parseJSON(response.data);
62
+
63
+ var header_container = $("<div />").addClass("mm_header_container");
64
+
65
+ var title = $("<div />").addClass("mm_title").html(panel.settings.menu_item_title);
66
+
67
+ var saving = $("<div class='mm_saving '>" + megamenu.saving + "</div>");
68
+
69
+ header_container.append(title).append(saving);
70
+
71
+ var tabs_container = $("<div class='mm_tab_container' />");
72
+
73
+ var content_container = $("<div class='mm_content_container' />");
74
+
75
+ $.each(json, function(idx, obj) {
76
+
77
+ var content = $("<div />").addClass('mm_content').addClass(idx).html(this.content).hide();
78
+
79
+ // bind save button action
80
+ content.find('form').on("submit", function (e) {
81
+
82
+ start_saving();
83
+
84
+ e.preventDefault();
85
+
86
+ var data = $(this).serialize();
87
+
88
+ $.post(ajaxurl, data, function (submit_response) {
89
+
90
+ end_saving();
91
+
92
+ panel.log(submit_response);
93
+ });
94
+
95
+ });
96
+
97
+ if (idx == 'menu_icon') {
98
+
99
+ var form = content.find('form');
100
+
101
+ // bind save button action
102
+ form.on("change", function (e) {
103
+
104
+ start_saving();
105
+
106
+ e.preventDefault();
107
+
108
+ $("input", form).not(e.target).removeAttr('checked');
109
+
110
+ var data = $(this).serialize();
111
+
112
+ $.post(ajaxurl, data, function (submit_response) {
113
+
114
+ end_saving();
115
+
116
+ panel.log(submit_response);
117
+ });
118
+
119
+ });
120
+ }
121
+
122
+ if (idx == 'general_settings') {
123
+
124
+ }
125
+
126
+ if (idx == 'mega_menu') {
127
+
128
+ var submenu_type = content.find('#mm_enable_mega_menu');
129
+
130
+ submenu_type.on('change', function() {
131
+
132
+ if ( $(this).val() == 'megamenu' ) {
133
+ $("#widgets").removeClass('disabled');
134
+ } else {
135
+ $("#widgets").addClass('disabled');
136
+ }
137
+
138
+ start_saving();
139
+
140
+ var postdata = {
141
+ action: "mm_save_menu_item_settings",
142
+ settings: { type: $(this).val() },
143
+ menu_item_id: panel.settings.menu_item_id,
144
+ _wpnonce: megamenu.nonce
145
+ };
146
+
147
+
148
+
149
+ $.post(ajaxurl, postdata, function (select_response) {
150
+
151
+ end_saving();
152
+
153
+ panel.log(select_response);
154
+ });
155
+
156
+ });
157
+
158
+ var number_of_columns = content.find('#mm_number_of_columns');
159
+
160
+ number_of_columns.on('change', function() {
161
+
162
+ content.find("#widgets").attr('data-columns', $(this).val());
163
+
164
+ content.find(".widget-total-cols").html($(this).val());
165
+
166
+ start_saving();
167
+
168
+ var postdata = {
169
+ action: "mm_save_menu_item_settings",
170
+ settings: { panel_columns: $(this).val() },
171
+ menu_item_id: panel.settings.menu_item_id,
172
+ _wpnonce: megamenu.nonce
173
+ };
174
+
175
+ $.post(ajaxurl, postdata, function (select_response) {
176
+
177
+ end_saving();
178
+
179
+ panel.log(select_response);
180
+ });
181
+
182
+ });
183
+
184
+ var widget_area = content.find('#widgets');
185
+
186
+ widget_area.bind("reorder_widgets", function () {
187
+
188
+ start_saving();
189
+
190
+ var items = [];
191
+
192
+ $(".widget").each(function() {
193
+ items.push({
194
+ 'type' : $(this).attr('data-type'),
195
+ 'order' : $(this).index() + 1,
196
+ 'id' : $(this).attr('data-id'),
197
+ 'parent_menu_item' : panel.settings.menu_item_id
198
+ });
199
+ });
200
+
201
+ $.post(ajaxurl, {
202
+ action: "mm_reorder_items",
203
+ items: items,
204
+ _wpnonce: megamenu.nonce
205
+ }, function (move_response) {
206
+ end_saving();
207
+ panel.log(move_response);
208
+ });
209
+ });
210
+
211
+ widget_area.sortable({
212
+ forcePlaceholderSize: true,
213
+ items : '.widget:not(.sub_menu)',
214
+ placeholder: "drop-area",
215
+ start: function (event, ui) {
216
+ $(".widget").removeClass("open");
217
+ ui.item.data('start_pos', ui.item.index());
218
+ },
219
+ stop: function (event, ui) {
220
+ // clean up
221
+ ui.item.removeAttr('style');
222
+
223
+ var start_pos = ui.item.data('start_pos');
224
+
225
+ if (start_pos !== ui.item.index()) {
226
+ widget_area.trigger("reorder_widgets");
227
+ }
228
+ }
229
+ });
230
+
231
+
232
+ var widget_selector = content.find('#mm_widget_selector');
233
+
234
+ widget_selector.on('change', function() {
235
+
236
+ var selector = $(this);
237
+
238
+ if (selector.val() != 'disabled') {
239
+
240
+ start_saving();
241
+
242
+ var postdata = {
243
+ action: "mm_add_widget",
244
+ id_base: selector.val(),
245
+ menu_item_id: panel.settings.menu_item_id,
246
+ title: selector.find('option:selected').text(),
247
+ _wpnonce: megamenu.nonce
248
+ };
249
+
250
+ $.post(ajaxurl, postdata, function (response) {
251
+
252
+ $(".no_widgets").hide();
253
+
254
+ var widget = $(response.data);
255
+
256
+ var number_of_columns = content.find('#mm_number_of_columns').val();
257
+
258
+ widget.find(".widget-total-cols").html(number_of_columns);
259
+
260
+ add_events_to_widget(widget);
261
+
262
+ $("#widgets").append(widget);
263
+
264
+ widget_area.trigger("reorder_widgets");
265
+
266
+ end_saving();
267
+
268
+ // reset the dropdown
269
+ selector.val('disabled');
270
+
271
+ });
272
+
273
+ }
274
+
275
+ });
276
+
277
+
278
+ $('.widget', widget_area).each(function() {
279
+ add_events_to_widget($(this));
280
+ });
281
+
282
+ }
283
+
284
+ var tab = $("<div />").addClass('mm_tab').addClass(idx).html(this.title).css('cursor', 'pointer').on('click', function() {
285
+ $(".mm_content").hide();
286
+ $(".mm_tab").removeClass('active');
287
+ $(this).addClass('active');
288
+ content.show();
289
+ });
290
+
291
+ if ( ( panel.settings.menu_item_depth == 0 && idx == 'mega_menu' ) ||
292
+ ( panel.settings.menu_item_depth > 0 && idx == 'general_settings' ) ) {
293
+ content.show();
294
+ tab.addClass('active');
295
+ }
296
+
297
+ tabs_container.append(tab);
298
+ content_container.append(content);
299
+ });
300
+
301
+ $('#cboxLoadedContent').addClass('depth-' + panel.settings.menu_item_depth).append(header_container).append(tabs_container).append(content_container);
302
+ $('#cboxLoadedContent').css({'width': '100%', 'height': '100%', 'display':'block'});
303
+ $('#cboxLoadedContent').trigger('megamenu_content_loaded');
304
+
305
+ }
306
+ });
307
+
308
+ };
309
+
310
+ var start_saving = function() {
311
+ $('.mm_saving').show();
312
+ }
313
+
314
+ var end_saving = function() {
315
+ $('.mm_saving').fadeOut('fast');
316
+ }
317
+
318
+ var add_events_to_widget = function (widget) {
319
+
320
+ var widget_title = widget.find(".widget-title h4");
321
+ var expand = widget.find(".widget-expand");
322
+ var contract = widget.find(".widget-contract");
323
+ var edit = widget.find(".widget-action");
324
+ var widget_inner = widget.find(".widget-inner");
325
+ var id = widget.attr("data-id");
326
+ var type = widget.attr('data-type');
327
+
328
+ expand.on("click", function () {
329
+
330
+ var cols = parseInt(widget.attr("data-columns"), 10);
331
+ var maxcols = parseInt($("#mm_number_of_columns").val(), 10);
332
+
333
+ if (cols < maxcols) {
334
+ cols = cols + 1;
335
+
336
+ widget.attr("data-columns", cols);
337
+
338
+ $('.widget-num-cols', widget).html(cols);
339
+
340
+ start_saving();
341
+
342
+ if (type == 'widget') {
343
+
344
+ $.post(ajaxurl, {
345
+ action: "mm_update_widget_columns",
346
+ id: id,
347
+ columns: cols,
348
+ _wpnonce: megamenu.nonce
349
+ }, function (expand_response) {
350
+ end_saving();
351
+ panel.log(expand_response);
352
+ });
353
+
354
+ }
355
+
356
+ if (type == 'menu_item' ) {
357
+
358
+ $.post(ajaxurl, {
359
+ action: "mm_update_menu_item_columns",
360
+ id: id,
361
+ columns: cols,
362
+ _wpnonce: megamenu.nonce
363
+ }, function (contract_response) {
364
+ end_saving();
365
+ panel.log(contract_response);
366
+ });
367
+
368
+ }
369
+
370
+ }
371
+
372
+ });
373
+
374
+ contract.on("click", function () {
375
+
376
+ var cols = parseInt(widget.attr("data-columns"), 10);
377
+
378
+ // account for widgets that have say 8 columns but the panel is only 6 wide
379
+ var maxcols = parseInt($("#mm_number_of_columns").val(), 10);
380
+
381
+ if (cols > maxcols) {
382
+ cols = maxcols;
383
+ }
384
+
385
+ if (cols > 1) {
386
+ cols = cols - 1;
387
+ widget.attr("data-columns", cols);
388
+
389
+ $('.widget-num-cols', widget).html(cols);
390
+ } else {
391
+ return;
392
+ }
393
+
394
+ start_saving();
395
+
396
+ if (type == 'widget') {
397
+
398
+ $.post(ajaxurl, {
399
+ action: "mm_update_widget_columns",
400
+ id: id,
401
+ columns: cols,
402
+ _wpnonce: megamenu.nonce
403
+ }, function (contract_response) {
404
+ end_saving();
405
+ panel.log(contract_response);
406
+ });
407
+
408
+ }
409
+
410
+ if (type == 'menu_item') {
411
+
412
+ $.post(ajaxurl, {
413
+ action: "mm_update_menu_item_columns",
414
+ id: id,
415
+ columns: cols,
416
+ _wpnonce: megamenu.nonce
417
+ }, function (contract_response) {
418
+ end_saving();
419
+ panel.log(contract_response);
420
+ });
421
+
422
+ }
423
+
424
+ });
425
+
426
+
427
+ edit.on("click", function () {
428
+
429
+ if (! widget.hasClass("open") && ! widget.data("loaded")) {
430
+
431
+ widget_title.addClass('loading');
432
+
433
+ // retrieve the widget settings form
434
+ $.post(ajaxurl, {
435
+ action: "mm_edit_widget",
436
+ widget_id: id,
437
+ _wpnonce: megamenu.nonce
438
+ }, function (response) {
439
+
440
+ var $response = $(response);
441
+ var $form = $response.find('form');
442
+
443
+ // bind delete button action
444
+ $(".delete", $form).on("click", function (e) {
445
+ e.preventDefault();
446
+
447
+ var data = {
448
+ action: "mm_delete_widget",
449
+ widget_id: id,
450
+ _wpnonce: megamenu.nonce
451
+ };
452
+
453
+ $.post(ajaxurl, data, function (delete_response) {
454
+ widget.remove();
455
+ panel.log(delete_response);
456
+ });
457
+
458
+ });
459
+
460
+ // bind close button action
461
+ $(".close", $form).on("click", function (e) {
462
+ e.preventDefault();
463
+
464
+ widget.toggleClass("open");
465
+ });
466
+
467
+ // bind save button action
468
+ $form.on("submit", function (e) {
469
+ e.preventDefault();
470
+
471
+ var data = $(this).serialize();
472
+
473
+ start_saving();
474
+
475
+ $.post(ajaxurl, data, function (submit_response) {
476
+ end_saving();
477
+ panel.log(submit_response);
478
+ });
479
+
480
+ });
481
+
482
+ widget_inner.html($response);
483
+
484
+ widget.data("loaded", true).toggleClass("open");
485
+
486
+ widget_title.removeClass('loading');
487
+
488
+ // Init Black Studio TinyMCE
489
+ if ( widget.is( '[id*=black-studio-tinymce]' ) ) {
490
+ bstw( widget ).deactivate().activate();
491
+ }
492
+
493
+ });
494
+
495
+ } else {
496
+ widget.toggleClass("open");
497
+ }
498
+
499
+ // close all other widgets
500
+ $(".widget").not(widget).removeClass("open");
501
+
502
+ });
503
+
504
+ return widget;
505
+ };
506
+
507
+ panel.init();
508
+
509
+ };
510
+
511
+ }(jQuery));
512
+
513
+ /**
514
+ *
515
+ */
516
+ jQuery(function ($) {
517
+ "use strict";
518
+
519
+ $(".megamenu_launch").live("click", function (e) {
520
+ e.preventDefault();
521
+
522
+ $(this).megaMenu();
523
+ });
524
+
525
+ $('#megamenu_accordion').accordion({
526
+ heightStyle: "content",
527
+ collapsible: true,
528
+ active: false,
529
+ animate: 200
530
+ });
531
+
532
+ var apply_megamenu_enabled_class = function() {
533
+ if ( $('input.megamenu_enabled:checked') && $('input.megamenu_enabled:checked').length ) {
534
+ $('body').addClass('megamenu_enabled');
535
+ } else {
536
+ $('body').removeClass('megamenu_enabled');
537
+ }
538
+ }
539
+
540
+ $('input.megamenu_enabled').on('change', function() {
541
+ apply_megamenu_enabled_class();
542
+ });
543
+
544
+ apply_megamenu_enabled_class();
545
+
546
+ $('.mega_menu_meta_box.mmm_get_started').attr('data-get-started', megamenu.get_started);
547
+
548
+ $('#menu-to-edit li.menu-item').each(function() {
549
+
550
+ var menu_item = $(this);
551
+ var menu_id = $('input#menu').val();
552
+ var title = menu_item.find('.menu-item-title').text();
553
+
554
+ // fix for Jupiter theme
555
+ if ( ! title ) {
556
+ title = menu_item.find('.item-title').text();
557
+ }
558
+
559
+ var id = parseInt(menu_item.attr('id').match(/[0-9]+/)[0], 10);
560
+
561
+ var button = $("<span>").addClass("mm_launch")
562
+ .html(megamenu.launch_lightbox)
563
+ .on('click', function(e) {
564
+ e.preventDefault();
565
+
566
+ if ( ! $('body').hasClass('megamenu_enabled') ) {
567
+ alert(megamenu.is_disabled_error);
568
+ return;
569
+ }
570
+
571
+ var depth = menu_item.attr('class').match(/\menu-item-depth-(\d+)\b/)[1];
572
+
573
+ $(this).megaMenu({
574
+ menu_item_id: id,
575
+ menu_item_title: title,
576
+ menu_item_depth: depth,
577
+ menu_id: menu_id
578
+ });
579
+ });
580
+
581
+ $('.item-title', menu_item).append(button);
582
+ });
583
+
584
+ $(".mm_tabs li").live('click', function() {
585
+ var tab = $(this);
586
+ var tab_id = $(this).attr('rel');
587
+
588
+ tab.addClass('active');
589
+ tab.siblings().removeClass('active');
590
+ tab.parent().siblings().not('h4').hide();
591
+ tab.parent().siblings("." + tab_id).show();
592
+ });
593
+
594
+ // Polylang Fix - stop Language Switcher item being added every time the MMM settings are saved
595
+ $(".max-mega-menu-save").on('click', function() {
596
+ $(".nav-menu-meta").find('input[value="#pll_switcher"]').val("");
597
+ });
598
+ });
js/codemirror/codemirror.css ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* BASICS */
2
+
3
+ .CodeMirror {
4
+ /* Set height, width, borders, and global font properties here */
5
+ font-family: monospace;
6
+ height: 300px;
7
+ }
8
+ .CodeMirror-scroll {
9
+ /* Set scrolling behaviour here */
10
+ overflow: auto;
11
+ }
12
+
13
+ /* PADDING */
14
+
15
+ .CodeMirror-lines {
16
+ padding: 4px 0; /* Vertical padding around content */
17
+ }
18
+ .CodeMirror pre {
19
+ padding: 0 4px; /* Horizontal padding of content */
20
+ }
21
+
22
+ .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
23
+ background-color: white; /* The little square between H and V scrollbars */
24
+ }
25
+
26
+ /* GUTTER */
27
+
28
+ .CodeMirror-gutters {
29
+ border-right: 1px solid #ddd;
30
+ background-color: #f7f7f7;
31
+ white-space: nowrap;
32
+ }
33
+ .CodeMirror-linenumbers {}
34
+ .CodeMirror-linenumber {
35
+ padding: 0 3px 0 5px;
36
+ min-width: 20px;
37
+ text-align: right;
38
+ color: #999;
39
+ -moz-box-sizing: content-box;
40
+ box-sizing: content-box;
41
+ }
42
+
43
+ .CodeMirror-guttermarker { color: black; }
44
+ .CodeMirror-guttermarker-subtle { color: #999; }
45
+
46
+ /* CURSOR */
47
+
48
+ .CodeMirror div.CodeMirror-cursor {
49
+ border-left: 1px solid black;
50
+ }
51
+ /* Shown when moving in bi-directional text */
52
+ .CodeMirror div.CodeMirror-secondarycursor {
53
+ border-left: 1px solid silver;
54
+ }
55
+ .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
56
+ width: auto;
57
+ border: 0;
58
+ background: #7e7;
59
+ }
60
+ .cm-animate-fat-cursor {
61
+ width: auto;
62
+ border: 0;
63
+ -webkit-animation: blink 1.06s steps(1) infinite;
64
+ -moz-animation: blink 1.06s steps(1) infinite;
65
+ animation: blink 1.06s steps(1) infinite;
66
+ }
67
+ @-moz-keyframes blink {
68
+ 0% { background: #7e7; }
69
+ 50% { background: none; }
70
+ 100% { background: #7e7; }
71
+ }
72
+ @-webkit-keyframes blink {
73
+ 0% { background: #7e7; }
74
+ 50% { background: none; }
75
+ 100% { background: #7e7; }
76
+ }
77
+ @keyframes blink {
78
+ 0% { background: #7e7; }
79
+ 50% { background: none; }
80
+ 100% { background: #7e7; }
81
+ }
82
+
83
+ /* Can style cursor different in overwrite (non-insert) mode */
84
+ div.CodeMirror-overwrite div.CodeMirror-cursor {}
85
+
86
+ .cm-tab { display: inline-block; }
87
+
88
+ .CodeMirror-ruler {
89
+ border-left: 1px solid #ccc;
90
+ position: absolute;
91
+ }
92
+
93
+ /* DEFAULT THEME */
94
+
95
+ .cm-s-default .cm-keyword {color: #708;}
96
+ .cm-s-default .cm-atom {color: #219;}
97
+ .cm-s-default .cm-number {color: #164;}
98
+ .cm-s-default .cm-def {color: #00f;}
99
+ .cm-s-default .cm-variable,
100
+ .cm-s-default .cm-punctuation,
101
+ .cm-s-default .cm-property,
102
+ .cm-s-default .cm-operator {}
103
+ .cm-s-default .cm-variable-2 {color: #05a;}
104
+ .cm-s-default .cm-variable-3 {color: #085;}
105
+ .cm-s-default .cm-comment {color: #a50;}
106
+ .cm-s-default .cm-string {color: #a11;}
107
+ .cm-s-default .cm-string-2 {color: #f50;}
108
+ .cm-s-default .cm-meta {color: #555;}
109
+ .cm-s-default .cm-qualifier {color: #555;}
110
+ .cm-s-default .cm-builtin {color: #30a;}
111
+ .cm-s-default .cm-bracket {color: #997;}
112
+ .cm-s-default .cm-tag {color: #170;}
113
+ .cm-s-default .cm-attribute {color: #00c;}
114
+ .cm-s-default .cm-header {color: blue;}
115
+ .cm-s-default .cm-quote {color: #090;}
116
+ .cm-s-default .cm-hr {color: #999;}
117
+ .cm-s-default .cm-link {color: #00c;}
118
+
119
+ .cm-negative {color: #d44;}
120
+ .cm-positive {color: #292;}
121
+ .cm-header, .cm-strong {font-weight: bold;}
122
+ .cm-em {font-style: italic;}
123
+ .cm-link {text-decoration: underline;}
124
+
125
+ .cm-s-default .cm-error {color: #f00;}
126
+ .cm-invalidchar {color: #f00;}
127
+
128
+ /* Default styles for common addons */
129
+
130
+ div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
131
+ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
132
+ .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
133
+ .CodeMirror-activeline-background {background: #e8f2ff;}
134
+
135
+ /* STOP */
136
+
137
+ /* The rest of this file contains styles related to the mechanics of
138
+ the editor. You probably shouldn't touch them. */
139
+
140
+ .CodeMirror {
141
+ line-height: 1;
142
+ position: relative;
143
+ overflow: hidden;
144
+ background: white;
145
+ color: black;
146
+ }
147
+
148
+ .CodeMirror-scroll {
149
+ /* 30px is the magic margin used to hide the element's real scrollbars */
150
+ /* See overflow: hidden in .CodeMirror */
151
+ margin-bottom: -30px; margin-right: -30px;
152
+ padding-bottom: 30px;
153
+ height: 100%;
154
+ outline: none; /* Prevent dragging from highlighting the element */
155
+ position: relative;
156
+ -moz-box-sizing: content-box;
157
+ box-sizing: content-box;
158
+ }
159
+ .CodeMirror-sizer {
160
+ position: relative;
161
+ border-right: 30px solid transparent;
162
+ -moz-box-sizing: content-box;
163
+ box-sizing: content-box;
164
+ }
165
+
166
+ /* The fake, visible scrollbars. Used to force redraw during scrolling
167
+ before actuall scrolling happens, thus preventing shaking and
168
+ flickering artifacts. */
169
+ .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
170
+ position: absolute;
171
+ z-index: 6;
172
+ display: none;
173
+ }
174
+ .CodeMirror-vscrollbar {
175
+ right: 0; top: 0;
176
+ overflow-x: hidden;
177
+ overflow-y: scroll;
178
+ }
179
+ .CodeMirror-hscrollbar {
180
+ bottom: 0; left: 0;
181
+ overflow-y: hidden;
182
+ overflow-x: scroll;
183
+ }
184
+ .CodeMirror-scrollbar-filler {
185
+ right: 0; bottom: 0;
186
+ }
187
+ .CodeMirror-gutter-filler {
188
+ left: 0; bottom: 0;
189
+ }
190
+
191
+ .CodeMirror-gutters {
192
+ position: absolute; left: 0; top: 0;
193
+ padding-bottom: 30px;
194
+ z-index: 3;
195
+ }
196
+ .CodeMirror-gutter {
197
+ white-space: normal;
198
+ height: 100%;
199
+ -moz-box-sizing: content-box;
200
+ box-sizing: content-box;
201
+ padding-bottom: 30px;
202
+ margin-bottom: -32px;
203
+ display: inline-block;
204
+ /* Hack to make IE7 behave */
205
+ *zoom:1;
206
+ *display:inline;
207
+ }
208
+ .CodeMirror-gutter-elt {
209
+ position: absolute;
210
+ cursor: default;
211
+ z-index: 4;
212
+ }
213
+
214
+ .CodeMirror-lines {
215
+ cursor: text;
216
+ }
217
+ .CodeMirror pre {
218
+ /* Reset some styles that the rest of the page might have set */
219
+ -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
220
+ border-width: 0;
221
+ background: transparent;
222
+ font-family: inherit;
223
+ font-size: inherit;
224
+ margin: 0;
225
+ white-space: pre;
226
+ word-wrap: normal;
227
+ line-height: inherit;
228
+ color: inherit;
229
+ z-index: 2;
230
+ position: relative;
231
+ overflow: visible;
232
+ }
233
+ .CodeMirror-wrap pre {
234
+ word-wrap: break-word;
235
+ white-space: pre-wrap;
236
+ word-break: normal;
237
+ }
238
+
239
+ .CodeMirror-linebackground {
240
+ position: absolute;
241
+ left: 0; right: 0; top: 0; bottom: 0;
242
+ z-index: 0;
243
+ }
244
+
245
+ .CodeMirror-linewidget {
246
+ position: relative;
247
+ z-index: 2;
248
+ overflow: auto;
249
+ }
250
+
251
+ .CodeMirror-widget {}
252
+
253
+ .CodeMirror-wrap .CodeMirror-scroll {
254
+ overflow-x: hidden;
255
+ }
256
+
257
+ .CodeMirror-measure {
258
+ position: absolute;
259
+ width: 100%;
260
+ height: 0;
261
+ overflow: hidden;
262
+ visibility: hidden;
263
+ }
264
+ .CodeMirror-measure pre { position: static; }
265
+
266
+ .CodeMirror div.CodeMirror-cursor {
267
+ position: absolute;
268
+ border-right: none;
269
+ width: 0;
270
+ }
271
+
272
+ div.CodeMirror-cursors {
273
+ visibility: hidden;
274
+ position: relative;
275
+ z-index: 1;
276
+ }
277
+ .CodeMirror-focused div.CodeMirror-cursors {
278
+ visibility: visible;
279
+ }
280
+
281
+ .CodeMirror-selected { background: #d9d9d9; }
282
+ .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
283
+ .CodeMirror-crosshair { cursor: crosshair; }
284
+
285
+ .cm-searching {
286
+ background: #ffa;
287
+ background: rgba(255, 255, 0, .4);
288
+ }
289
+
290
+ /* IE7 hack to prevent it from returning funny offsetTops on the spans */
291
+ .CodeMirror span { *vertical-align: text-bottom; }
292
+
293
+ /* Used to force a border model for a node */
294
+ .cm-force-border { padding-right: .1px; }
295
+
296
+ @media print {
297
+ /* Hide the cursor when printing */
298
+ .CodeMirror div.CodeMirror-cursors {
299
+ visibility: hidden;
300
+ }
301
+ }
js/codemirror/codemirror.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CodeMirror - Minified & Bundled
2
+ Generated on 7/30/2014 with http://codemirror.net/doc/compress.html
3
+ Version: HEAD
4
+
5
+ CodeMirror Library:
6
+ - codemirror.js
7
+ */
8
+
9
+ !function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function w(a,b){if(!(this instanceof w))return new w(a,b);this.options=b=b||{},Pg(je,b,!1),K(b);var c=b.value;"string"==typeof c&&(c=new Kf(c,b.mode)),this.doc=c;var f=this.display=new x(a,c);f.wrapper.CodeMirror=this,G(this),E(this),b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),b.autofocus&&!o&&ad(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Fg},d&&11>e&&setTimeout(Qg(_c,this,!0),20),dd(this),hh();var g=this;Kc(this,function(){g.curOp.forceUpdate=!0,Of(g,c),b.autofocus&&!o||ah()==f.input?setTimeout(Qg(Hd,g),20):Id(g);for(var a in ke)ke.hasOwnProperty(a)&&ke[a](g,b[a],me);Q(g);for(var d=0;d<qe.length;++d)qe[d](g)})}function x(a,b){var c=this,g=c.input=Xg("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");f?g.style.width="1000px":g.setAttribute("wrap","off"),n&&(g.style.border="1px solid black"),g.setAttribute("autocorrect","off"),g.setAttribute("autocapitalize","off"),g.setAttribute("spellcheck","false"),c.inputDiv=Xg("div",[g],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),c.scrollbarH=Xg("div",[Xg("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),c.scrollbarV=Xg("div",[Xg("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),c.scrollbarFiller=Xg("div",null,"CodeMirror-scrollbar-filler"),c.gutterFiller=Xg("div",null,"CodeMirror-gutter-filler"),c.lineDiv=Xg("div",null,"CodeMirror-code"),c.selectionDiv=Xg("div",null,null,"position: relative; z-index: 1"),c.cursorDiv=Xg("div",null,"CodeMirror-cursors"),c.measure=Xg("div",null,"CodeMirror-measure"),c.lineMeasure=Xg("div",null,"CodeMirror-measure"),c.lineSpace=Xg("div",[c.measure,c.lineMeasure,c.selectionDiv,c.cursorDiv,c.lineDiv],null,"position: relative; outline: none"),c.mover=Xg("div",[Xg("div",[c.lineSpace],"CodeMirror-lines")],null,"position: relative"),c.sizer=Xg("div",[c.mover],"CodeMirror-sizer"),c.heightForcer=Xg("div",null,null,"position: absolute; height: "+Ag+"px; width: 1px;"),c.gutters=Xg("div",null,"CodeMirror-gutters"),c.lineGutter=null,c.scroller=Xg("div",[c.sizer,c.heightForcer,c.gutters],"CodeMirror-scroll"),c.scroller.setAttribute("tabIndex","-1"),c.wrapper=Xg("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.gutterFiller,c.scroller],"CodeMirror"),d&&8>e&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0),n&&(g.style.width="0px"),f||(c.scroller.draggable=!0),k&&(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"),d&&8>e&&(c.scrollbarH.style.minHeight=c.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(c.wrapper):a(c.wrapper),c.viewFrom=c.viewTo=b.first,c.view=[],c.externalMeasured=null,c.viewOffset=0,c.lastSizeC=0,c.updateLineNumbers=null,c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null,c.prevInput="",c.alignWidgets=!1,c.pollingFast=!1,c.poll=new Fg,c.cachedCharWidth=c.cachedTextHeight=c.cachedPaddingH=null,c.inaccurateSelection=!1,c.maxLine=null,c.maxLineLength=0,c.maxLineChanged=!1,c.wheelDX=c.wheelDY=c.wheelStartX=c.wheelStartY=null,c.shift=!1,c.selForContextMenu=null}function y(a){a.doc.mode=w.getMode(a.options,a.doc.modeOption),z(a)}function z(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Ub(a,100),a.state.modeGen++,a.curOp&&Qc(a)}function A(a){a.options.lineWrapping?(dh(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth=""):(ch(a.display.wrapper,"CodeMirror-wrap"),J(a)),C(a),Qc(a),lc(a),setTimeout(function(){N(a)},100)}function B(a){var b=xc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/yc(a.display)-3);return function(e){if(ef(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function C(a){var b=a.doc,c=B(a);b.iter(function(a){var b=c(a);b!=a.height&&Sf(a,b)})}function D(a){var b=ve[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}function E(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),lc(a)}function F(a){G(a),Qc(a),setTimeout(function(){P(a)},20)}function G(a){var b=a.display.gutters,c=a.options.gutters;Zg(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Xg("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none",H(a)}function H(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px",a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0}function I(a){if(0==a.height)return 0;for(var c,b=a.text.length,d=a;c=Ze(d);){var e=c.find(0,!0);d=e.from.line,b+=e.from.ch-e.to.ch}for(d=a;c=$e(d);){var e=c.find(0,!0);b-=d.text.length-e.from.ch,d=e.to.line,b+=d.text.length-e.to.ch}return b}function J(a){var b=a.display,c=a.doc;b.maxLine=Pf(c,c.first),b.maxLineLength=I(b.maxLine),b.maxLineChanged=!0,c.iter(function(a){var c=I(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function K(a){var b=Mg(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):b>-1&&!a.lineNumbers&&(a.gutters=a.gutters.slice(0),a.gutters.splice(b,1))}function L(a){return a.display.scroller.clientHeight-a.display.wrapper.clientHeight<Ag-3}function M(a){var b=a.display.scroller;return{clientHeight:b.clientHeight,barHeight:a.display.scrollbarV.clientHeight,scrollWidth:b.scrollWidth,clientWidth:b.clientWidth,hScrollbarTakesSpace:L(a),barWidth:a.display.scrollbarH.clientWidth,docHeight:Math.round(a.doc.height+Zb(a.display))}}function N(a,b){b||(b=M(a));var c=a.display,d=lh(c.measure),e=b.docHeight+Ag,f=b.scrollWidth>b.clientWidth;f&&b.scrollWidth<=b.clientWidth+1&&d>0&&!b.hScrollbarTakesSpace&&(f=!1);var g=e>b.clientHeight;if(g?(c.scrollbarV.style.display="block",c.scrollbarV.style.bottom=f?d+"px":"0",c.scrollbarV.firstChild.style.height=Math.max(0,e-b.clientHeight+(b.barHeight||c.scrollbarV.clientHeight))+"px"):(c.scrollbarV.style.display="",c.scrollbarV.firstChild.style.height="0"),f?(c.scrollbarH.style.display="block",c.scrollbarH.style.right=g?d+"px":"0",c.scrollbarH.firstChild.style.width=b.scrollWidth-b.clientWidth+(b.barWidth||c.scrollbarH.clientWidth)+"px"):(c.scrollbarH.style.display="",c.scrollbarH.firstChild.style.width="0"),f&&g?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=c.scrollbarFiller.style.width=d+"px"):c.scrollbarFiller.style.display="",f&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d+"px",c.gutterFiller.style.width=c.gutters.offsetWidth+"px"):c.gutterFiller.style.display="",!a.state.checkedOverlayScrollbar&&b.clientHeight>0){if(0===d){var h=p&&!l?"12px":"18px";c.scrollbarV.style.minWidth=c.scrollbarH.style.minHeight=h;var i=function(b){og(b)!=c.scrollbarV&&og(b)!=c.scrollbarH&&Lc(a,hd)(b)};qg(c.scrollbarV,"mousedown",i),qg(c.scrollbarH,"mousedown",i)}a.state.checkedOverlayScrollbar=!0}}function O(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-Yb(a));var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight,f=Uf(b,d),g=Uf(b,e);if(c&&c.ensure){var h=c.ensure.from.line,i=c.ensure.to.line;if(f>h)return{from:h,to:Uf(b,Vf(Pf(b,h))+a.wrapper.clientHeight)};if(Math.min(i,b.lastLine())>=g)return{from:Uf(b,Vf(Pf(b,i))-a.wrapper.clientHeight),to:i}}return{from:f,to:Math.max(g,f+1)}}function P(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=S(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",g=0;g<c.length;g++)if(!c[g].hidden){a.options.fixedGutter&&c[g].gutter&&(c[g].gutter.style.left=f);var h=c[g].alignable;if(h)for(var i=0;i<h.length;i++)h[i].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Q(a){if(!a.options.lineNumbers)return!1;var b=a.doc,c=R(a.options,b.first+b.size-1),d=a.display;if(c.length!=d.lineNumChars){var e=d.measure.appendChild(Xg("div",[Xg("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth,g=e.offsetWidth-f;return d.lineGutter.style.width="",d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-g),d.lineNumWidth=d.lineNumInnerWidth+g,d.lineNumChars=d.lineNumInnerWidth?c.length:-1,d.lineGutter.style.width=d.lineNumWidth+"px",H(a),!0}return!1}function R(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function S(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function T(a,b,c){var d=a.display;this.viewport=b,this.visible=O(d,a.doc,b),this.editorIsHidden=!d.wrapper.offsetWidth,this.wrapperHeight=d.wrapper.clientHeight,this.oldViewFrom=d.viewFrom,this.oldViewTo=d.viewTo,this.oldScrollerWidth=d.scroller.clientWidth,this.force=c,this.dims=_(a)}function U(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Sc(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&0==Wc(a))return!1;Q(a)&&(Sc(a),b.dims=_(a));var e=d.first+d.size,f=Math.max(b.visible.from-a.options.viewportMargin,d.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<f&&f-c.viewFrom<20&&(f=Math.max(d.first,c.viewFrom)),c.viewTo>g&&c.viewTo-g<20&&(g=Math.min(e,c.viewTo)),v&&(f=cf(a.doc,f),g=df(a.doc,g));var h=f!=c.viewFrom||g!=c.viewTo||c.lastSizeC!=b.wrapperHeight;Vc(a,f,g),c.viewOffset=Vf(Pf(a.doc,c.viewFrom)),a.display.mover.style.top=c.viewOffset+"px";var i=Wc(a);if(!h&&0==i&&!b.force&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo))return!1;var j=ah();return i>4&&(c.lineDiv.style.display="none"),ab(a,c.updateLineNumbers,b.dims),i>4&&(c.lineDiv.style.display=""),j&&ah()!=j&&j.offsetHeight&&j.focus(),Zg(c.cursorDiv),Zg(c.selectionDiv),h&&(c.lastSizeC=b.wrapperHeight,Ub(a,400)),c.updateLineNumbers=null,!0}function V(a,b){for(var c=b.force,d=b.viewport,e=!0;;e=!1){if(e&&a.options.lineWrapping&&b.oldScrollerWidth!=a.display.scroller.clientWidth)c=!0;else if(c=!1,d&&null!=d.top&&(d={top:Math.min(a.doc.height+Zb(a.display)-Ag-a.display.scroller.clientHeight,d.top)}),b.visible=O(a.display,a.doc,d),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!U(a,b))break;Z(a);var f=M(a);Qb(a),X(a,f),N(a,f)}ug(a,"update",a),(a.display.viewFrom!=b.oldViewFrom||a.display.viewTo!=b.oldViewTo)&&ug(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo)}function W(a,b){var c=new T(a,b);if(U(a,c)){Z(a),V(a,c);var d=M(a);Qb(a),X(a,d),N(a,d)}}function X(a,b){a.display.sizer.style.minHeight=a.display.heightForcer.style.top=b.docHeight+"px",a.display.gutters.style.height=Math.max(b.docHeight,b.clientHeight-Ag)+"px"}function Y(a,b){a.display.sizer.offsetWidth+a.display.gutters.offsetWidth<a.display.scroller.clientWidth-1&&(a.display.sizer.style.minHeight=a.display.heightForcer.style.top="0px",a.display.gutters.style.height=b.docHeight+"px")}function Z(a){for(var b=a.display,c=b.lineDiv.offsetTop,f=0;f<b.view.length;f++){var h,g=b.view[f];if(!g.hidden){if(d&&8>e){var i=g.node.offsetTop+g.node.offsetHeight;h=i-c,c=i}else{var j=g.node.getBoundingClientRect();h=j.bottom-j.top}var k=g.line.height-h;if(2>h&&(h=xc(b)),(k>.001||-.001>k)&&(Sf(g.line,h),$(g.line),g.rest))for(var l=0;l<g.rest.length;l++)$(g.rest[l])}}}function $(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.offsetHeight}function _(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:S(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function ab(a,b,c){function i(b){var c=b.nextSibling;return f&&p&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b),c}for(var d=a.display,e=a.options.lineNumbers,g=d.lineDiv,h=g.firstChild,j=d.view,k=d.viewFrom,l=0;l<j.length;l++){var m=j[l];if(m.hidden);else if(m.node){for(;h!=m.node;)h=i(h);var o=e&&null!=b&&k>=b&&m.lineNumber;m.changes&&(Mg(m.changes,"gutter")>-1&&(o=!1),bb(a,m,k,c)),o&&(Zg(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(R(a.options,k)))),h=m.node.nextSibling}else{var n=jb(a,m,k,c);g.insertBefore(n,h)}k+=m.size}for(;h;)h=i(h)}function bb(a,b,c,d){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];"text"==f?fb(a,b):"gutter"==f?hb(a,b,c,d):"class"==f?gb(b):"widget"==f&&ib(b,d)}b.changes=null}function cb(a){return a.node==a.text&&(a.node=Xg("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),d&&8>e&&(a.node.style.zIndex=2)),a.node}function db(a){var b=a.bgClass?a.bgClass+" "+(a.line.bgClass||""):a.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),a.background)b?a.background.className=b:(a.background.parentNode.removeChild(a.background),a.background=null);else if(b){var c=cb(a);a.background=c.insertBefore(Xg("div",null,b),c.firstChild)}}function eb(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):yf(a,b)}function fb(a,b){var c=b.text.className,d=eb(a,b);b.text==b.node&&(b.node=d.pre),b.text.parentNode.replaceChild(d.pre,b.text),b.text=d.pre,d.bgClass!=b.bgClass||d.textClass!=b.textClass?(b.bgClass=d.bgClass,b.textClass=d.textClass,gb(b)):c&&(b.text.className=c)}function gb(a){db(a),a.line.wrapClass?cb(a).className=a.line.wrapClass:a.node!=a.text&&(a.node.className="");var b=a.textClass?a.textClass+" "+(a.line.textClass||""):a.line.textClass;a.text.className=b||""}function hb(a,b,c,d){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);var e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=cb(b),g=b.gutter=f.insertBefore(Xg("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(a.options.fixedGutter?d.fixedPos:-d.gutterTotalWidth)+"px"),b.text);if(!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(Xg("div",R(a.options,c),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+d.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px"))),e)for(var h=0;h<a.options.gutters.length;++h){var i=a.options.gutters[h],j=e.hasOwnProperty(i)&&e[i];j&&g.appendChild(Xg("div",[j],"CodeMirror-gutter-elt","left: "+d.gutterLeft[i]+"px; width: "+d.gutterWidth[i]+"px"))}}}function ib(a,b){a.alignable&&(a.alignable=null);for(var d,c=a.node.firstChild;c;c=d){var d=c.nextSibling;"CodeMirror-linewidget"==c.className&&a.node.removeChild(c)}kb(a,b)}function jb(a,b,c,d){var e=eb(a,b);return b.text=b.node=e.pre,e.bgClass&&(b.bgClass=e.bgClass),e.textClass&&(b.textClass=e.textClass),gb(b),hb(a,b,c,d),kb(b,d),b.node}function kb(a,b){if(lb(a.line,a,b,!0),a.rest)for(var c=0;c<a.rest.length;c++)lb(a.rest[c],a,b,!1)}function lb(a,b,c,d){if(a.widgets)for(var e=cb(b),f=0,g=a.widgets;f<g.length;++f){var h=g[f],i=Xg("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||(i.ignoreEvents=!0),mb(h,i,b,c),d&&h.above?e.insertBefore(i,b.gutter||b.text):e.appendChild(i),ug(h,"redraw")}}function mb(a,b,c,d){if(a.noHScroll){(c.alignable||(c.alignable=[])).push(b);var e=d.wrapperWidth;b.style.left=d.fixedPos+"px",a.coverGutter||(e-=d.gutterTotalWidth,b.style.paddingLeft=d.gutterTotalWidth+"px"),b.style.width=e+"px"}a.coverGutter&&(b.style.zIndex=5,b.style.position="relative",a.noHScroll||(b.style.marginLeft=-d.gutterTotalWidth+"px"))}function pb(a){return nb(a.line,a.ch)}function qb(a,b){return ob(a,b)<0?b:a}function rb(a,b){return ob(a,b)<0?a:b}function sb(a,b){this.ranges=a,this.primIndex=b}function tb(a,b){this.anchor=a,this.head=b}function ub(a,b){var c=a[b];a.sort(function(a,b){return ob(a.from(),b.from())}),b=Mg(a,c);for(var d=1;d<a.length;d++){var e=a[d],f=a[d-1];if(ob(f.to(),e.from())>=0){var g=rb(f.from(),e.from()),h=qb(f.to(),e.to()),i=f.empty()?e.from()==e.head:f.from()==f.head;b>=d&&--b,a.splice(--d,2,new tb(i?h:g,i?g:h))}}return new sb(a,b)}function vb(a,b){return new sb([new tb(a,b||a)],0)}function wb(a,b){return Math.max(a.first,Math.min(b,a.first+a.size-1))}function xb(a,b){if(b.line<a.first)return nb(a.first,0);var c=a.first+a.size-1;return b.line>c?nb(c,Pf(a,c).text.length):yb(b,Pf(a,b.line).text.length)}function yb(a,b){var c=a.ch;return null==c||c>b?nb(a.line,b):0>c?nb(a.line,0):a}function zb(a,b){return b>=a.first&&b<a.first+a.size}function Ab(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=xb(a,b[d]);return c}function Bb(a,b,c,d){if(a.cm&&a.cm.display.shift||a.extend){var e=b.anchor;if(d){var f=ob(c,e)<0;f!=ob(d,e)<0?(e=c,c=d):f!=ob(c,d)<0&&(c=d)}return new tb(e,c)}return new tb(d||c,c)}function Cb(a,b,c,d){Ib(a,new sb([Bb(a,a.sel.primary(),b,c)],0),d)}function Db(a,b,c){for(var d=[],e=0;e<a.sel.ranges.length;e++)d[e]=Bb(a,a.sel.ranges[e],b[e],null);var f=ub(d,a.sel.primIndex);Ib(a,f,c)}function Eb(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c,Ib(a,ub(e,a.sel.primIndex),d)}function Fb(a,b,c,d){Ib(a,vb(b,c),d)}function Gb(a,b){var c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new tb(xb(a,b[c].anchor),xb(a,b[c].head))}};return sg(a,"beforeSelectionChange",a,c),a.cm&&sg(a.cm,"beforeSelectionChange",a.cm,c),c.ranges!=b.ranges?ub(c.ranges,c.ranges.length-1):b}function Hb(a,b,c){var d=a.history.done,e=Kg(d);e&&e.ranges?(d[d.length-1]=b,Jb(a,b,c)):Ib(a,b,c)}function Ib(a,b,c){Jb(a,b,c),bg(a,a.sel,a.cm?a.cm.curOp.id:0/0,c)}function Jb(a,b,c){(yg(a,"beforeSelectionChange")||a.cm&&yg(a.cm,"beforeSelectionChange"))&&(b=Gb(a,b));var d=c&&c.bias||(ob(b.primary().head,a.sel.primary().head)<0?-1:1);Kb(a,Mb(a,b,d,!0)),c&&c.scroll===!1||!a.cm||be(a.cm)}function Kb(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,xg(a.cm)),ug(a,"cursorActivity",a))}function Lb(a){Kb(a,Mb(a,a.sel,null,!1),Cg)}function Mb(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=Nb(a,g.anchor,c,d),i=Nb(a,g.head,c,d);(e||h!=g.anchor||i!=g.head)&&(e||(e=b.ranges.slice(0,f)),e[f]=new tb(h,i))}return e?ub(e,b.primIndex):b}function Nb(a,b,c,d){var e=!1,f=b,g=c||1;a.cantEdit=!1;a:for(;;){var h=Pf(a,f.line);if(h.markedSpans)for(var i=0;i<h.markedSpans.length;++i){var j=h.markedSpans[i],k=j.marker;if((null==j.from||(k.inclusiveLeft?j.from<=f.ch:j.from<f.ch))&&(null==j.to||(k.inclusiveRight?j.to>=f.ch:j.to>f.ch))){if(d&&(sg(k,"beforeCursorEnter"),k.explicitlyCleared)){if(h.markedSpans){--i;continue}break}if(!k.atomic)continue;var l=k.find(0>g?-1:1);if(0==ob(l,f)&&(l.ch+=g,l.ch<0?l=l.line>a.first?xb(a,nb(l.line-1)):null:l.ch>h.text.length&&(l=l.line<a.first+a.size-1?nb(l.line+1,0):null),!l)){if(e)return d?(a.cantEdit=!0,nb(a.first,0)):Nb(a,b,c,!0);e=!0,l=b,g=-g}f=l;continue a}}return f}}function Ob(a){for(var b=a.display,c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),g=0;g<c.sel.ranges.length;g++){var h=c.sel.ranges[g],i=h.empty();(i||a.options.showCursorWhenSelecting)&&Rb(a,h,e),i||Sb(a,h,f)}if(a.options.moveInputWithCursor){var j=rc(a,c.sel.primary().head,"div"),k=b.wrapper.getBoundingClientRect(),l=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,j.top+l.top-k.top)),d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,j.left+l.left-k.left))}return d}function Pb(a,b){$g(a.display.cursorDiv,b.cursors),$g(a.display.selectionDiv,b.selection),null!=b.teTop&&(a.display.inputDiv.style.top=b.teTop+"px",a.display.inputDiv.style.left=b.teLeft+"px")}function Qb(a){Pb(a,Ob(a))}function Rb(a,b,c){var d=rc(a,b.head,"div",null,null,!a.options.singleCursorHeightPerLine),e=c.appendChild(Xg("div","\xa0","CodeMirror-cursor"));if(e.style.left=d.left+"px",e.style.top=d.top+"px",e.style.height=Math.max(0,d.bottom-d.top)*a.options.cursorHeight+"px",d.other){var f=c.appendChild(Xg("div","\xa0","CodeMirror-cursor CodeMirror-secondarycursor"));f.style.display="",f.style.left=d.other.left+"px",f.style.top=d.other.top+"px",f.style.height=.85*(d.other.bottom-d.other.top)+"px"}}function Sb(a,b,c){function j(a,b,c,d){0>b&&(b=0),b=Math.round(b),d=Math.round(d),f.appendChild(Xg("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?i-a:c)+"px; height: "+(d-b)+"px"))}function k(b,c,d){function m(c,d){return qc(a,nb(b,c),"div",f,d)}var k,l,f=Pf(e,b),g=f.text.length;return wh(Wf(f),c||0,null==d?g:d,function(a,b,e){var n,o,p,f=m(a,"left");if(a==b)n=f,o=p=f.left;else{if(n=m(b-1,"right"),"rtl"==e){var q=f;f=n,n=q}o=f.left,p=n.right}null==c&&0==a&&(o=h),n.top-f.top>3&&(j(o,f.top,null,f.bottom),o=h,f.bottom<n.top&&j(o,f.bottom,null,n.top)),null==d&&b==g&&(p=i),(!k||f.top<k.top||f.top==k.top&&f.left<k.left)&&(k=f),(!l||n.bottom>l.bottom||n.bottom==l.bottom&&n.right>l.right)&&(l=n),h+1>o&&(o=h),j(o,n.top,p-o,n.bottom)}),{start:k,end:l}}var d=a.display,e=a.doc,f=document.createDocumentFragment(),g=$b(a.display),h=g.left,i=d.lineSpace.offsetWidth-g.right,l=b.from(),m=b.to();if(l.line==m.line)k(l.line,l.ch,m.ch);else{var n=Pf(e,l.line),o=Pf(e,m.line),p=af(n)==af(o),q=k(l.line,l.ch,p?n.text.length+1:null).end,r=k(m.line,p?0:null,m.ch).start;p&&(q.top<r.top-2?(j(q.right,q.top,null,q.bottom),j(h,r.top,r.left,r.bottom)):j(q.right,q.top,r.left-q.right,q.bottom)),q.bottom<r.top&&j(h,q.bottom,null,r.top)}c.appendChild(f)}function Tb(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility="",a.options.cursorBlinkRate>0?b.blinker=setInterval(function(){b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):a.options.cursorBlinkRate<0&&(b.cursorDiv.style.visibility="hidden")}}function Ub(a,b){a.doc.mode.startState&&a.doc.frontier<a.display.viewTo&&a.state.highlight.set(b,Qg(Vb,a))}function Vb(a){var b=a.doc;if(b.frontier<b.first&&(b.frontier=b.first),!(b.frontier>=a.display.viewTo)){var c=+new Date+a.options.workTime,d=se(b.mode,Xb(a,b.frontier)),e=[];b.iter(b.frontier,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(b.frontier>=a.display.viewFrom){var g=f.styles,h=sf(a,f,d,!0);f.styles=h.styles;var i=f.styleClasses,j=h.classes;j?f.styleClasses=j:i&&(f.styleClasses=null);for(var k=!g||g.length!=f.styles.length||i!=j&&(!i||!j||i.bgClass!=j.bgClass||i.textClass!=j.textClass),l=0;!k&&l<g.length;++l)k=g[l]!=f.styles[l];k&&e.push(b.frontier),f.stateAfter=se(b.mode,d)}else uf(a,f.text,d),f.stateAfter=0==b.frontier%5?se(b.mode,d):null;return++b.frontier,+new Date>c?(Ub(a,a.options.workDelay),!0):void 0}),e.length&&Kc(a,function(){for(var b=0;b<e.length;b++)Rc(a,e[b],"text")})}}function Wb(a,b,c){for(var d,e,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1e3:100),h=b;h>g;--h){if(h<=f.first)return f.first;var i=Pf(f,h-1);if(i.stateAfter&&(!c||h<=f.frontier))return h;var j=Gg(i.text,null,a.options.tabSize);(null==e||d>j)&&(e=h-1,d=j)}return e}function Xb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return!0;var f=Wb(a,b,c),g=f>d.first&&Pf(d,f-1).stateAfter;return g=g?se(d.mode,g):te(d.mode),d.iter(f,b,function(c){uf(a,c.text,g);var h=f==b-1||0==f%5||f>=e.viewFrom&&f<e.viewTo;c.stateAfter=h?se(d.mode,g):null,++f}),c&&(d.frontier=f),g}function Yb(a){return a.lineSpace.offsetTop}function Zb(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function $b(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=$g(a.measure,Xg("pre","x")),c=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle,d={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};return isNaN(d.left)||isNaN(d.right)||(a.cachedPaddingH=d),d}function _b(a,b,c){var d=a.options.lineWrapping,e=d&&a.display.scroller.clientWidth;if(!b.measure.heights||d&&b.measure.width!=e){var f=b.measure.heights=[];if(d){b.measure.width=e;for(var g=b.text.firstChild.getClientRects(),h=0;h<g.length-1;h++){var i=g[h],j=g[h+1];Math.abs(i.bottom-j.bottom)>2&&f.push((i.bottom+j.top)/2-c.top)}}f.push(c.bottom-c.top)}}function ac(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(var d=0;d<a.rest.length;d++)if(Tf(a.rest[d])>c)return{map:a.measure.maps[d],cache:a.measure.caches[d],before:!0}}function bc(a,b){b=af(b);var c=Tf(b),d=a.display.externalMeasured=new Oc(a.doc,b,c);d.lineN=c;var e=d.built=yf(a,d);return d.text=e.pre,$g(a.display.lineMeasure,e.pre),d}function cc(a,b,c,d){return fc(a,ec(a,b),c,d)}function dc(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[Tc(a,b)];var c=a.display.externalMeasured;return c&&b>=c.lineN&&b<c.lineN+c.size?c:void 0}function ec(a,b){var c=Tf(b),d=dc(a,c);d&&!d.text?d=null:d&&d.changes&&bb(a,d,c,_(a)),d||(d=bc(a,b));var e=ac(d,b,c);return{line:b,view:d,rect:null,map:e.map,cache:e.cache,before:e.before,hasHeights:!1}}function fc(a,b,c,d,e){b.before&&(c=-1);var g,f=c+(d||"");return b.cache.hasOwnProperty(f)?g=b.cache[f]:(b.rect||(b.rect=b.view.text.getBoundingClientRect()),b.hasHeights||(_b(a,b.view,b.rect),b.hasHeights=!0),g=hc(a,b,c,d),g.bogus||(b.cache[f]=g)),{left:g.left,right:g.right,top:e?g.rtop:g.top,bottom:e?g.rbottom:g.bottom}}function hc(a,b,c,f){for(var h,i,j,k,g=b.map,l=0;l<g.length;l+=3){var m=g[l],n=g[l+1];if(m>c?(i=0,j=1,k="left"):n>c?(i=c-m,j=i+1):(l==g.length-3||c==n&&g[l+3]>c)&&(j=n-m,i=j-1,c>=n&&(k="right")),null!=i){if(h=g[l+2],m==n&&f==(h.insertLeft?"left":"right")&&(k=f),"left"==f&&0==i)for(;l&&g[l-2]==g[l-3]&&g[l-1].insertLeft;)h=g[(l-=3)+2],k="left";if("right"==f&&i==n-m)for(;l<g.length-3&&g[l+3]==g[l+4]&&!g[l+5].insertLeft;)h=g[(l+=3)+2],k="right";break}}var o;if(3==h.nodeType){for(;i&&Wg(b.line.text.charAt(m+i));)--i;for(;n>m+j&&Wg(b.line.text.charAt(m+j));)++j;if(d&&9>e&&0==i&&j==n-m)o=h.parentNode.getBoundingClientRect();else if(d&&a.options.lineWrapping){var p=Yg(h,i,j).getClientRects();o=p.length?p["right"==f?p.length-1:0]:gc}else o=Yg(h,i,j).getBoundingClientRect()||gc}else{i>0&&(k=f="right");var p;o=a.options.lineWrapping&&(p=h.getClientRects()).length>1?p["right"==f?p.length-1:0]:h.getBoundingClientRect()}if(d&&9>e&&!i&&(!o||!o.left&&!o.right)){var q=h.parentNode.getClientRects()[0];o=q?{left:q.left,right:q.left+yc(a.display),top:q.top,bottom:q.bottom}:gc}d&&11>e&&(o=ic(a.display.measure,o));for(var r=o.top-b.rect.top,s=o.bottom-b.rect.top,t=(r+s)/2,u=b.view.measure.heights,l=0;l<u.length-1&&!(t<u[l]);l++);var v=l?u[l-1]:0,w=u[l],x={left:("right"==k?o.right:o.left)-b.rect.left,right:("left"==k?o.left:o.right)-b.rect.left,top:v,bottom:w};return o.left||o.right||(x.bogus=!0),a.options.singleCursorHeightPerLine||(x.rtop=r,x.rbottom=s),x}function ic(a,b){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!uh(a))return b;var c=screen.logicalXDPI/screen.deviceXDPI,d=screen.logicalYDPI/screen.deviceYDPI;return{left:b.left*c,right:b.right*c,top:b.top*d,bottom:b.bottom*d}}function jc(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function kc(a){a.display.externalMeasure=null,Zg(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)jc(a.display.view[b])}function lc(a){kc(a),a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null,a.options.lineWrapping||(a.display.maxLineChanged=!0),a.display.lineNumChars=null}function mc(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function nc(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function oc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=jf(b.widgets[e]);c.top+=f,c.bottom+=f}if("line"==d)return c;d||(d="local");var g=Vf(b);if("local"==d?g+=Yb(a.display):g-=a.display.viewOffset,"page"==d||"window"==d){var h=a.display.lineSpace.getBoundingClientRect();g+=h.top+("window"==d?0:nc());var i=h.left+("window"==d?0:mc());c.left+=i,c.right+=i}return c.top+=g,c.bottom+=g,c}function pc(a,b,c){if("div"==c)return b;var d=b.left,e=b.top;if("page"==c)d-=mc(),e-=nc();else if("local"==c||!c){var f=a.display.sizer.getBoundingClientRect();d+=f.left,e+=f.top}var g=a.display.lineSpace.getBoundingClientRect();return{left:d-g.left,top:e-g.top}}function qc(a,b,c,d,e){return d||(d=Pf(a.doc,b.line)),oc(a,d,cc(a,d,b.ch,e),c)}function rc(a,b,c,d,e,f){function g(b,g){var h=fc(a,e,b,g?"right":"left",f);return g?h.left=h.right:h.right=h.left,oc(a,d,h,c)}function h(a,b){var c=i[b],d=c.level%2;return a==xh(c)&&b&&c.level<i[b-1].level?(c=i[--b],a=yh(c)-(c.level%2?0:1),d=!0):a==yh(c)&&b<i.length-1&&c.level<i[b+1].level&&(c=i[++b],a=xh(c)-c.level%2,d=!1),d&&a==c.to&&a>c.from?g(a-1):g(a,d)}d=d||Pf(a.doc,b.line),e||(e=ec(a,d));var i=Wf(d),j=b.ch;if(!i)return g(j);var k=Gh(i,j),l=h(j,k);return null!=Fh&&(l.other=h(j,Fh)),l}function sc(a,b){var c=0,b=xb(a.doc,b);a.options.lineWrapping||(c=yc(a.display)*b.ch);var d=Pf(a.doc,b.line),e=Vf(d)+Yb(a.display);return{left:c,right:c,top:e,bottom:e+d.height}}function tc(a,b,c,d){var e=nb(a,b);return e.xRel=d,c&&(e.outside=!0),e}function uc(a,b,c){var d=a.doc;if(c+=a.display.viewOffset,0>c)return tc(d.first,0,!0,-1);var e=Uf(d,c),f=d.first+d.size-1;if(e>f)return tc(d.first+d.size-1,Pf(d,f).text.length,!0,1);0>b&&(b=0);for(var g=Pf(d,e);;){var h=vc(a,g,e,b,c),i=$e(g),j=i&&i.find(0,!0);if(!i||!(h.ch>j.from.ch||h.ch==j.from.ch&&h.xRel>0))return h;e=Tf(g=j.to.line)}}function vc(a,b,c,d,e){function j(d){var e=rc(a,nb(c,d),"line",b,i);return g=!0,f>e.bottom?e.left-h:f<e.top?e.left+h:(g=!1,e.left)}var f=e-Vf(b),g=!1,h=2*a.display.wrapper.clientWidth,i=ec(a,b),k=Wf(b),l=b.text.length,m=zh(b),n=Ah(b),o=j(m),p=g,q=j(n),r=g;if(d>q)return tc(c,n,r,1);for(;;){if(k?n==m||n==Ih(b,m,1):1>=n-m){for(var s=o>d||q-d>=d-o?m:n,t=d-(s==m?o:q);Wg(b.text.charAt(s));)++s;var u=tc(c,s,s==m?p:r,-1>t?-1:t>1?1:0);return u}var v=Math.ceil(l/2),w=m+v;if(k){w=m;for(var x=0;v>x;++x)w=Ih(b,w,1)}var y=j(w);y>d?(n=w,q=y,(r=g)&&(q+=1e3),l=v):(m=w,o=y,p=g,l-=v)}}function xc(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==wc){wc=Xg("pre");for(var b=0;49>b;++b)wc.appendChild(document.createTextNode("x")),wc.appendChild(Xg("br"));wc.appendChild(document.createTextNode("x"))}$g(a.measure,wc);var c=wc.offsetHeight/50;return c>3&&(a.cachedTextHeight=c),Zg(a.measure),c||1}function yc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=Xg("span","xxxxxxxxxx"),c=Xg("pre",[b]);$g(a.measure,c);var d=b.getBoundingClientRect(),e=(d.right-d.left)/10;return e>2&&(a.cachedCharWidth=e),e||10}function Bc(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Ac},zc?zc.ops.push(a.curOp):a.curOp.ownsGroup=zc={ops:[a.curOp],delayedCallbacks:[]}}function Cc(a){var b=a.delayedCallbacks,c=0;do{for(;c<b.length;c++)b[c]();for(var d=0;d<a.ops.length;d++){var e=a.ops[d];if(e.cursorActivityHandlers)for(;e.cursorActivityCalled<e.cursorActivityHandlers.length;)e.cursorActivityHandlers[e.cursorActivityCalled++](e.cm)}}while(c<b.length)}function Dc(a){var b=a.curOp,c=b.ownsGroup;if(c)try{Cc(c)}finally{zc=null;for(var d=0;d<c.ops.length;d++)c.ops[d].cm.curOp=null;Ec(c)}}function Ec(a){for(var b=a.ops,c=0;c<b.length;c++)Fc(b[c]);for(var c=0;c<b.length;c++)Gc(b[c]);for(var c=0;c<b.length;c++)Hc(b[c]);for(var c=0;c<b.length;c++)Ic(b[c]);for(var c=0;c<b.length;c++)Jc(b[c])}function Fc(a){var b=a.cm,c=b.display;a.updateMaxLine&&J(b),a.mustUpdate=a.viewChanged||a.forceUpdate||null!=a.scrollTop||a.scrollToPos&&(a.scrollToPos.from.line<c.viewFrom||a.scrollToPos.to.line>=c.viewTo)||c.maxLineChanged&&b.options.lineWrapping,a.update=a.mustUpdate&&new T(b,a.mustUpdate&&{top:a.scrollTop,ensure:a.scrollToPos},a.forceUpdate)
10
+ }function Gc(a){a.updatedDisplay=a.mustUpdate&&U(a.cm,a.update)}function Hc(a){var b=a.cm,c=b.display;if(a.updatedDisplay&&Z(b),a.barMeasure=M(b),c.maxLineChanged&&!b.options.lineWrapping){a.adjustWidthTo=cc(b,c.maxLine,c.maxLine.text.length).left+3,a.maxScrollLeft=Math.max(0,c.sizer.offsetLeft+a.adjustWidthTo+Ag-c.scroller.clientWidth);var d=c.sizer.style.minWidth;d&&a.barMeasure.scrollWidth>a.barMeasure.clientWidth&&(a.barMeasure.scrollWidth+=a.adjustWidthTo-parseInt(d))}(a.updatedDisplay||a.selectionChanged)&&(a.newSelectionNodes=Ob(b))}function Ic(a){var b=a.cm;null!=a.adjustWidthTo&&(b.display.sizer.style.minWidth=a.adjustWidthTo+"px",a.maxScrollLeft<b.doc.scrollLeft&&td(b,Math.min(b.display.scroller.scrollLeft,a.maxScrollLeft),!0),b.display.maxLineChanged=!1),a.newSelectionNodes&&Pb(b,a.newSelectionNodes),a.updatedDisplay&&X(b,a.barMeasure),(a.updatedDisplay||a.startHeight!=b.doc.height)&&N(b,a.barMeasure),a.selectionChanged&&Tb(b),b.state.focused&&a.updateInput&&_c(b,a.typing)}function Jc(a){var b=a.cm,c=b.display,d=b.doc;if(a.updatedDisplay&&V(b,a.update),null==c.wheelStartX||null==a.scrollTop&&null==a.scrollLeft&&!a.scrollToPos||(c.wheelStartX=c.wheelStartY=null),null!=a.scrollTop&&c.scroller.scrollTop!=a.scrollTop){var e=Math.max(0,Math.min(c.scroller.scrollHeight-c.scroller.clientHeight,a.scrollTop));c.scroller.scrollTop=c.scrollbarV.scrollTop=d.scrollTop=e}if(null!=a.scrollLeft&&c.scroller.scrollLeft!=a.scrollLeft){var g=Math.max(0,Math.min(c.scroller.scrollWidth-c.scroller.clientWidth,a.scrollLeft));c.scroller.scrollLeft=c.scrollbarH.scrollLeft=d.scrollLeft=g,P(b)}if(a.scrollToPos){var h=Zd(b,xb(d,a.scrollToPos.from),xb(d,a.scrollToPos.to),a.scrollToPos.margin);a.scrollToPos.isCursor&&b.state.focused&&Yd(b,h)}var i=a.maybeHiddenMarkers,j=a.maybeUnhiddenMarkers;if(i)for(var k=0;k<i.length;++k)i[k].lines.length||sg(i[k],"hide");if(j)for(var k=0;k<j.length;++k)j[k].lines.length&&sg(j[k],"unhide");c.wrapper.offsetHeight&&(d.scrollTop=b.display.scroller.scrollTop),a.updatedDisplay&&f&&(b.options.lineWrapping&&Y(b,a.barMeasure),a.barMeasure.scrollWidth>a.barMeasure.clientWidth&&a.barMeasure.scrollWidth<a.barMeasure.clientWidth+1&&!L(b)&&N(b)),a.changeObjs&&sg(b,"changes",b,a.changeObjs)}function Kc(a,b){if(a.curOp)return b();Bc(a);try{return b()}finally{Dc(a)}}function Lc(a,b){return function(){if(a.curOp)return b.apply(a,arguments);Bc(a);try{return b.apply(a,arguments)}finally{Dc(a)}}}function Mc(a){return function(){if(this.curOp)return a.apply(this,arguments);Bc(this);try{return a.apply(this,arguments)}finally{Dc(this)}}}function Nc(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);Bc(b);try{return a.apply(this,arguments)}finally{Dc(b)}}}function Oc(a,b,c){this.line=b,this.rest=bf(b),this.size=this.rest?Tf(Kg(this.rest))-c+1:1,this.node=this.text=null,this.hidden=ef(a,b)}function Pc(a,b,c){for(var e,d=[],f=b;c>f;f=e){var g=new Oc(a.doc,Pf(a.doc,f),f);e=f+g.size,d.push(g)}return d}function Qc(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)v&&cf(a.doc,b)<e.viewTo&&Sc(a);else if(c<=e.viewFrom)v&&df(a.doc,c+d)>e.viewFrom?Sc(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Sc(a);else if(b<=e.viewFrom){var f=Uc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Sc(a)}else if(c>=e.viewTo){var f=Uc(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Sc(a)}else{var g=Uc(a,b,b,-1),h=Uc(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Pc(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Sc(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Rc(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Tc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Mg(g,c)&&g.push(c)}}}function Sc(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Tc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Uc(a,b,c,d){var f,e=Tc(a,b),g=a.display.view;if(!v||c==a.doc.first+a.doc.size)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;e>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(e==g.length-1)return null;f=i+g[e].size-b,e++}else f=i-b;b+=f,c+=f}for(;cf(a.doc,c)!=c;){if(e==(0>d?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size,e+=d}return{index:e,lineN:c}}function Vc(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Pc(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Pc(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Tc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Pc(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Tc(a,c)))),d.viewTo=c}function Wc(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Xc(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){$c(a),a.state.focused&&Xc(a)})}function Yc(a){function c(){var d=$c(a);d||b?(a.display.pollingFast=!1,Xc(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function $c(a){var b=a.display.input,c=a.display.prevInput,f=a.doc;if(!a.state.focused||rh(b)&&!c||cd(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var g=b.value;if(g==c&&!a.somethingSelected())return!1;if(d&&e>=9&&a.display.inputHasSelection===g||p&&/[\uf700-\uf7ff]/.test(g))return _c(a),!1;var h=!a.curOp;h&&Bc(a),a.display.shift=!1,8203!=g.charCodeAt(0)||f.sel!=a.display.selForContextMenu||c||(c="\u200b");for(var i=0,j=Math.min(c.length,g.length);j>i&&c.charCodeAt(i)==g.charCodeAt(i);)++i;var k=g.slice(i),l=qh(k),m=null;a.state.pasteIncoming&&f.sel.ranges.length>1&&(Zc&&Zc.join("\n")==k?m=0==f.sel.ranges.length%Zc.length&&Ng(Zc,qh):l.length==f.sel.ranges.length&&(m=Ng(l,function(a){return[a]})));for(var n=f.sel.ranges.length-1;n>=0;n--){var o=f.sel.ranges[n],q=o.from(),r=o.to();i<c.length?q=nb(q.line,q.ch-(c.length-i)):a.state.overwrite&&o.empty()&&!a.state.pasteIncoming&&(r=nb(r.line,Math.min(Pf(f,r.line).text.length,r.ch+Kg(l).length)));var s=a.curOp.updateInput,t={from:q,to:r,text:m?m[n%m.length]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(Rd(a.doc,t),ug(a,"inputRead",a,t),k&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&o.head.ch<100&&(!n||f.sel.ranges[n-1].head.line!=o.head.line)){var u=a.getModeAt(o.head);if(u.electricChars){for(var v=0;v<u.electricChars.length;v++)if(k.indexOf(u.electricChars.charAt(v))>-1){de(a,o.head.line,"smart");break}}else if(u.electricInput){var w=Ld(t);u.electricInput.test(Pf(f,w.line).text.slice(0,w.ch))&&de(a,o.head.line,"smart")}}}return be(a),a.curOp.updateInput=s,a.curOp.typing=!0,g.length>1e3||g.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=g,h&&Dc(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function _c(a,b){var c,f,g=a.doc;if(a.somethingSelected()){a.display.prevInput="";var h=g.sel.primary();c=sh&&(h.to().line-h.from().line>100||(f=a.getSelection()).length>1e3);var i=c?"-":f||a.getSelection();a.display.input.value=i,a.state.focused&&Lg(a.display.input),d&&e>=9&&(a.display.inputHasSelection=i)}else b||(a.display.prevInput=a.display.input.value="",d&&e>=9&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function ad(a){"nocursor"==a.options.readOnly||o&&ah()==a.display.input||a.display.input.focus()}function bd(a){a.state.focused||(ad(a),Hd(a))}function cd(a){return a.options.readOnly||a.doc.cantEdit}function dd(a){function c(){a.state.focused&&setTimeout(Qg(ad,a),0)}function g(b){wg(a,b)||ng(b)}function h(c){if(a.somethingSelected())Zc=a.getSelections(),b.inaccurateSelection&&(b.prevInput="",b.inaccurateSelection=!1,b.input.value=Zc.join("\n"),Lg(b.input));else{for(var d=[],e=[],f=0;f<a.doc.sel.ranges.length;f++){var g=a.doc.sel.ranges[f].head.line,h={anchor:nb(g,0),head:nb(g+1,0)};e.push(h),d.push(a.getRange(h.anchor,h.head))}"cut"==c.type?a.setSelections(e,null,Cg):(b.prevInput="",b.input.value=d.join("\n"),Lg(b.input)),Zc=d}"cut"==c.type&&(a.state.cutIncoming=!0)}var b=a.display;qg(b.scroller,"mousedown",Lc(a,hd)),d&&11>e?qg(b.scroller,"dblclick",Lc(a,function(b){if(!wg(a,b)){var c=gd(a,b);if(c&&!od(a,b)&&!fd(a.display,b)){kg(b);var d=ie(a,c);Cb(a.doc,d.anchor,d.head)}}})):qg(b.scroller,"dblclick",function(b){wg(a,b)||kg(b)}),qg(b.lineSpace,"selectstart",function(a){fd(b,a)||kg(a)}),t||qg(b.scroller,"contextmenu",function(b){Jd(a,b)}),qg(b.scroller,"scroll",function(){b.scroller.clientHeight&&(sd(a,b.scroller.scrollTop),td(a,b.scroller.scrollLeft,!0),sg(a,"scroll",a))}),qg(b.scrollbarV,"scroll",function(){b.scroller.clientHeight&&sd(a,b.scrollbarV.scrollTop)}),qg(b.scrollbarH,"scroll",function(){b.scroller.clientHeight&&td(a,b.scrollbarH.scrollLeft)}),qg(b.scroller,"mousewheel",function(b){wd(a,b)}),qg(b.scroller,"DOMMouseScroll",function(b){wd(a,b)}),qg(b.scrollbarH,"mousedown",c),qg(b.scrollbarV,"mousedown",c),qg(b.wrapper,"scroll",function(){b.wrapper.scrollTop=b.wrapper.scrollLeft=0}),qg(b.input,"keyup",function(b){Fd.call(a,b)}),qg(b.input,"input",function(){d&&e>=9&&a.display.inputHasSelection&&(a.display.inputHasSelection=null),Yc(a)}),qg(b.input,"keydown",Lc(a,Dd)),qg(b.input,"keypress",Lc(a,Gd)),qg(b.input,"focus",Qg(Hd,a)),qg(b.input,"blur",Qg(Id,a)),a.options.dragDrop&&(qg(b.scroller,"dragstart",function(b){rd(a,b)}),qg(b.scroller,"dragenter",g),qg(b.scroller,"dragover",g),qg(b.scroller,"drop",Lc(a,qd))),qg(b.scroller,"paste",function(c){fd(b,c)||(a.state.pasteIncoming=!0,ad(a),Yc(a))}),qg(b.input,"paste",function(){if(f&&!a.state.fakedLastChar&&!(new Date-a.state.lastMiddleDown<200)){var c=b.input.selectionStart,d=b.input.selectionEnd;b.input.value+="$",b.input.selectionEnd=d,b.input.selectionStart=c,a.state.fakedLastChar=!0}a.state.pasteIncoming=!0,Yc(a)}),qg(b.input,"cut",h),qg(b.input,"copy",h),k&&qg(b.sizer,"mouseup",function(){ah()==b.input&&b.input.blur(),ad(a)})}function ed(a){var b=a.display;b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null,a.setSize()}function fd(a,b){for(var c=og(b);c!=a.wrapper;c=c.parentNode)if(!c||c.ignoreEvents||c.parentNode==a.sizer&&c!=a.mover)return!0}function gd(a,b,c,d){var e=a.display;if(!c){var f=og(b);if(f==e.scrollbarH||f==e.scrollbarV||f==e.scrollbarFiller||f==e.gutterFiller)return null}var g,h,i=e.lineSpace.getBoundingClientRect();try{g=b.clientX-i.left,h=b.clientY-i.top}catch(b){return null}var k,j=uc(a,g,h);if(d&&1==j.xRel&&(k=Pf(a.doc,j.line).text).length==j.ch){var l=Gg(k,k.length,a.options.tabSize)-k.length;j=nb(j.line,Math.max(0,Math.round((g-$b(a.display).left)/yc(a.display))-l))}return j}function hd(a){if(!wg(this,a)){var b=this,c=b.display;if(c.shift=a.shiftKey,fd(c,a))return f||(c.scroller.draggable=!1,setTimeout(function(){c.scroller.draggable=!0},100)),void 0;if(!od(b,a)){var d=gd(b,a);switch(window.focus(),pg(a)){case 1:d?kd(b,a,d):og(a)==c.scroller&&kg(a);break;case 2:f&&(b.state.lastMiddleDown=+new Date),d&&Cb(b.doc,d),setTimeout(Qg(ad,b),20),kg(a);break;case 3:t&&Jd(b,a)}}}}function kd(a,b,c){setTimeout(Qg(bd,a),0);var e,d=+new Date;jd&&jd.time>d-400&&0==ob(jd.pos,c)?e="triple":id&&id.time>d-400&&0==ob(id.pos,c)?(e="double",jd={time:d,pos:c}):(e="single",id={time:d,pos:c});var f=a.doc.sel,g=p?b.metaKey:b.ctrlKey;a.options.dragDrop&&jh&&!cd(a)&&"single"==e&&f.contains(c)>-1&&f.somethingSelected()?ld(a,b,c,g):md(a,b,c,e,g)}function ld(a,b,c,g){var h=a.display,i=Lc(a,function(j){f&&(h.scroller.draggable=!1),a.state.draggingText=!1,rg(document,"mouseup",i),rg(h.scroller,"drop",i),Math.abs(b.clientX-j.clientX)+Math.abs(b.clientY-j.clientY)<10&&(kg(j),g||Cb(a.doc,c),ad(a),d&&9==e&&setTimeout(function(){document.body.focus(),ad(a)},20))});f&&(h.scroller.draggable=!0),a.state.draggingText=i,h.scroller.dragDrop&&h.scroller.dragDrop(),qg(document,"mouseup",i),qg(h.scroller,"drop",i)}function md(a,b,c,d,e){function n(b){if(0!=ob(m,b))if(m=b,"rect"==d){for(var e=[],f=a.options.tabSize,k=Gg(Pf(g,c.line).text,c.ch,f),l=Gg(Pf(g,b.line).text,b.ch,f),n=Math.min(k,l),o=Math.max(k,l),p=Math.min(c.line,b.line),q=Math.min(a.lastLine(),Math.max(c.line,b.line));q>=p;p++){var r=Pf(g,p).text,s=Hg(r,n,f);n==o?e.push(new tb(nb(p,s),nb(p,s))):r.length>s&&e.push(new tb(nb(p,s),nb(p,Hg(r,o,f))))}e.length||e.push(new tb(c,c)),Ib(g,ub(j.ranges.slice(0,i).concat(e),i),{origin:"*mouse",scroll:!1}),a.scrollIntoView(b)}else{var t=h,u=t.anchor,v=b;if("single"!=d){if("double"==d)var w=ie(a,b);else var w=new tb(nb(b.line,0),xb(g,nb(b.line+1,0)));ob(w.anchor,u)>0?(v=w.head,u=rb(t.from(),w.anchor)):(v=w.anchor,u=qb(t.to(),w.head))}var e=j.ranges.slice(0);e[i]=new tb(xb(g,u),v),Ib(g,ub(e,i),Dg)}}function q(b){var c=++p,e=gd(a,b,!0,"rect"==d);if(e)if(0!=ob(e,m)){bd(a),n(e);var h=O(f,g);(e.line>=h.to||e.line<h.from)&&setTimeout(Lc(a,function(){p==c&&q(b)}),150)}else{var i=b.clientY<o.top?-20:b.clientY>o.bottom?20:0;i&&setTimeout(Lc(a,function(){p==c&&(f.scroller.scrollTop+=i,q(b))}),50)}}function r(b){p=1/0,kg(b),ad(a),rg(document,"mousemove",s),rg(document,"mouseup",t),g.history.lastSelOrigin=null}var f=a.display,g=a.doc;kg(b);var h,i,j=g.sel;if(e&&!b.shiftKey?(i=g.sel.contains(c),h=i>-1?g.sel.ranges[i]:new tb(c,c)):h=g.sel.primary(),b.altKey)d="rect",e||(h=new tb(c,c)),c=gd(a,b,!0,!0),i=-1;else if("double"==d){var k=ie(a,c);h=a.display.shift||g.extend?Bb(g,h,k.anchor,k.head):k}else if("triple"==d){var l=new tb(nb(c.line,0),xb(g,nb(c.line+1,0)));h=a.display.shift||g.extend?Bb(g,h,l.anchor,l.head):l}else h=Bb(g,h,c);e?i>-1?Eb(g,i,h,Dg):(i=g.sel.ranges.length,Ib(g,ub(g.sel.ranges.concat([h]),i),{scroll:!1,origin:"*mouse"})):(i=0,Ib(g,new sb([h],0),Dg),j=g.sel);var m=c,o=f.wrapper.getBoundingClientRect(),p=0,s=Lc(a,function(a){pg(a)?q(a):r(a)}),t=Lc(a,r);qg(document,"mousemove",s),qg(document,"mouseup",t)}function nd(a,b,c,d,e){try{var f=b.clientX,g=b.clientY}catch(b){return!1}if(f>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&kg(b);var h=a.display,i=h.lineDiv.getBoundingClientRect();if(g>i.bottom||!yg(a,c))return mg(b);g-=i.top-h.viewOffset;for(var j=0;j<a.options.gutters.length;++j){var k=h.gutters.childNodes[j];if(k&&k.getBoundingClientRect().right>=f){var l=Uf(a.doc,g),m=a.options.gutters[j];return e(a,c,a,l,m,b),mg(b)}}}function od(a,b){return nd(a,b,"gutterClick",!0,ug)}function qd(a){var b=this;if(!wg(b,a)&&!fd(b.display,a)){kg(a),d&&(pd=+new Date);var c=gd(b,a,!0),e=a.dataTransfer.files;if(c&&!cd(b))if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,i=function(a,d){var e=new FileReader;e.onload=Lc(b,function(){if(g[d]=e.result,++h==f){c=xb(b.doc,c);var a={from:c,to:c,text:qh(g.join("\n")),origin:"paste"};Rd(b.doc,a),Hb(b.doc,vb(c,Ld(a)))}}),e.readAsText(a)},j=0;f>j;++j)i(e[j],j);else{if(b.state.draggingText&&b.doc.sel.contains(c)>-1)return b.state.draggingText(a),setTimeout(Qg(ad,b),20),void 0;try{var g=a.dataTransfer.getData("Text");if(g){if(b.state.draggingText&&!(p?a.metaKey:a.ctrlKey))var k=b.listSelections();if(Jb(b.doc,vb(c,c)),k)for(var j=0;j<k.length;++j)Xd(b.doc,"",k[j].anchor,k[j].head,"drag");b.replaceSelection(g,"around","paste"),ad(b)}}catch(a){}}}}function rd(a,b){if(d&&(!a.state.draggingText||+new Date-pd<100))return ng(b),void 0;if(!wg(a,b)&&!fd(a.display,b)&&(b.dataTransfer.setData("Text",a.getSelection()),b.dataTransfer.setDragImage&&!j)){var c=Xg("img",null,null,"position: fixed; left: 0; top: 0;");c.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",i&&(c.width=c.height=1,a.display.wrapper.appendChild(c),c._top=c.offsetTop),b.dataTransfer.setDragImage(c,0,0),i&&c.parentNode.removeChild(c)}}function sd(b,c){Math.abs(b.doc.scrollTop-c)<2||(b.doc.scrollTop=c,a||W(b,{top:c}),b.display.scroller.scrollTop!=c&&(b.display.scroller.scrollTop=c),b.display.scrollbarV.scrollTop!=c&&(b.display.scrollbarV.scrollTop=c),a&&W(b),Ub(b,100))}function td(a,b,c){(c?b==a.doc.scrollLeft:Math.abs(a.doc.scrollLeft-b)<2)||(b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth),a.doc.scrollLeft=b,P(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b))}function wd(b,c){var d=c.wheelDeltaX,e=c.wheelDeltaY;null==d&&c.detail&&c.axis==c.HORIZONTAL_AXIS&&(d=c.detail),null==e&&c.detail&&c.axis==c.VERTICAL_AXIS?e=c.detail:null==e&&(e=c.wheelDelta);var g=b.display,h=g.scroller;if(d&&h.scrollWidth>h.clientWidth||e&&h.scrollHeight>h.clientHeight){if(e&&p&&f)a:for(var j=c.target,k=g.view;j!=h;j=j.parentNode)for(var l=0;l<k.length;l++)if(k[l].node==j){b.display.currentWheelTarget=j;break a}if(d&&!a&&!i&&null!=vd)return e&&sd(b,Math.max(0,Math.min(h.scrollTop+e*vd,h.scrollHeight-h.clientHeight))),td(b,Math.max(0,Math.min(h.scrollLeft+d*vd,h.scrollWidth-h.clientWidth))),kg(c),g.wheelStartX=null,void 0;if(e&&null!=vd){var m=e*vd,n=b.doc.scrollTop,o=n+g.wrapper.clientHeight;0>m?n=Math.max(0,n+m-50):o=Math.min(b.doc.height,o+m+50),W(b,{top:n,bottom:o})}20>ud&&(null==g.wheelStartX?(g.wheelStartX=h.scrollLeft,g.wheelStartY=h.scrollTop,g.wheelDX=d,g.wheelDY=e,setTimeout(function(){if(null!=g.wheelStartX){var a=h.scrollLeft-g.wheelStartX,b=h.scrollTop-g.wheelStartY,c=b&&g.wheelDY&&b/g.wheelDY||a&&g.wheelDX&&a/g.wheelDX;g.wheelStartX=g.wheelStartY=null,c&&(vd=(vd*ud+c)/(ud+1),++ud)}},200)):(g.wheelDX+=d,g.wheelDY+=e))}}function xd(a,b,c){if("string"==typeof b&&(b=ue[b],!b))return!1;a.display.pollingFast&&$c(a)&&(a.display.pollingFast=!1);var d=a.display.shift,e=!1;try{cd(a)&&(a.state.suppressEdits=!0),c&&(a.display.shift=!1),e=b(a)!=Bg}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function yd(a){var b=a.state.keyMaps.slice(0);return a.options.extraKeys&&b.push(a.options.extraKeys),b.push(a.options.keyMap),b}function Ad(a,b){var c=we(a.options.keyMap),d=c.auto;clearTimeout(zd),d&&!ye(b)&&(zd=setTimeout(function(){we(a.options.keyMap)==c&&(a.options.keyMap=d.call?d.call(null,a):d,D(a))},50));var e=ze(b,!0),f=!1;if(!e)return!1;var g=yd(a);return f=b.shiftKey?xe("Shift-"+e,g,function(b){return xd(a,b,!0)})||xe(e,g,function(b){return("string"==typeof b?/^go[A-Z]/.test(b):b.motion)?xd(a,b):void 0}):xe(e,g,function(b){return xd(a,b)}),f&&(kg(b),Tb(a),ug(a,"keyHandled",a,e,b)),f}function Bd(a,b,c){var d=xe("'"+c+"'",yd(a),function(b){return xd(a,b,!0)});return d&&(kg(b),Tb(a),ug(a,"keyHandled",a,"'"+c+"'",b)),d}function Dd(a){var b=this;if(bd(b),!wg(b,a)){d&&11>e&&27==a.keyCode&&(a.returnValue=!1);var c=a.keyCode;b.display.shift=16==c||a.shiftKey;var f=Ad(b,a);i&&(Cd=f?c:null,!f&&88==c&&!sh&&(p?a.metaKey:a.ctrlKey)&&b.replaceSelection("",null,"cut")),18!=c||/\bCodeMirror-crosshair\b/.test(b.display.lineDiv.className)||Ed(b)}}function Ed(a){function c(a){18!=a.keyCode&&a.altKey||(ch(b,"CodeMirror-crosshair"),rg(document,"keyup",c),rg(document,"mouseover",c))}var b=a.display.lineDiv;dh(b,"CodeMirror-crosshair"),qg(document,"keyup",c),qg(document,"mouseover",c)}function Fd(a){16==a.keyCode&&(this.doc.sel.shift=!1),wg(this,a)}function Gd(a){var b=this;if(!(wg(b,a)||a.ctrlKey&&!a.altKey||p&&a.metaKey)){var c=a.keyCode,f=a.charCode;if(i&&c==Cd)return Cd=null,kg(a),void 0;if(!(i&&(!a.which||a.which<10)||k)||!Ad(b,a)){var g=String.fromCharCode(null==f?c:f);Bd(b,a,g)||(d&&e>=9&&(b.display.inputHasSelection=null),Yc(b))}}}function Hd(a){"nocursor"!=a.options.readOnly&&(a.state.focused||(sg(a,"focus",a),a.state.focused=!0,dh(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(_c(a),f&&setTimeout(Qg(_c,a,!0),0))),Xc(a),Tb(a))}function Id(a){a.state.focused&&(sg(a,"blur",a),a.state.focused=!1,ch(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||(a.display.shift=!1)},150)}function Jd(a,b){function m(){if(null!=c.input.selectionStart){var b=a.somethingSelected(),d=c.input.value="\u200b"+(b?c.input.value:"");c.prevInput=b?"":"\u200b",c.input.selectionStart=1,c.input.selectionEnd=d.length,c.selForContextMenu=a.doc.sel}}function n(){if(c.inputDiv.style.position="relative",c.input.style.cssText=k,d&&9>e&&(c.scrollbarV.scrollTop=c.scroller.scrollTop=h),Xc(a),null!=c.input.selectionStart){(!d||d&&9>e)&&m();var b=0,f=function(){c.selForContextMenu==a.doc.sel&&0==c.input.selectionStart?Lc(a,ue.selectAll)(a):b++<10?c.detectingSelectAll=setTimeout(f,500):_c(a)};c.detectingSelectAll=setTimeout(f,200)}}if(!wg(a,b,"contextmenu")){var c=a.display;if(!fd(c,b)&&!Kd(a,b)){var g=gd(a,b),h=c.scroller.scrollTop;if(g&&!i){var j=a.options.resetSelectionOnContextMenu;j&&-1==a.doc.sel.contains(g)&&Lc(a,Ib)(a.doc,vb(g),Cg);var k=c.input.style.cssText;if(c.inputDiv.style.position="absolute",c.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: "+(d?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",f)var l=window.scrollY;if(ad(a),f&&window.scrollTo(null,l),_c(a),a.somethingSelected()||(c.input.value=c.prevInput=" "),c.selForContextMenu=a.doc.sel,clearTimeout(c.detectingSelectAll),d&&e>=9&&m(),t){ng(b);var o=function(){rg(window,"mouseup",o),setTimeout(n,20)};qg(window,"mouseup",o)}else setTimeout(n,50)}}}}function Kd(a,b){return yg(a,"gutterContextMenu")?nd(a,b,"gutterContextMenu",!1,sg):!1}function Md(a,b){if(ob(a,b.from)<0)return a;if(ob(a,b.to)<=0)return Ld(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;return a.line==b.to.line&&(d+=Ld(b).ch-b.to.ch),nb(c,d)}function Nd(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new tb(Md(e.anchor,b),Md(e.head,b)))}return ub(c,a.sel.primIndex)}function Od(a,b,c){return a.line==b.line?nb(c.line,a.ch-b.ch+c.ch):nb(c.line+(a.line-b.line),a.ch)}function Pd(a,b,c){for(var d=[],e=nb(a.first,0),f=e,g=0;g<b.length;g++){var h=b[g],i=Od(h.from,e,f),j=Od(Ld(h),e,f);if(e=h.to,f=j,"around"==c){var k=a.sel.ranges[g],l=ob(k.head,k.anchor)<0;d[g]=new tb(l?j:i,l?i:j)}else d[g]=new tb(i,i)}return new sb(d,a.sel.primIndex)}function Qd(a,b,c){var d={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){this.canceled=!0}};return c&&(d.update=function(b,c,d,e){b&&(this.from=xb(a,b)),c&&(this.to=xb(a,c)),d&&(this.text=d),void 0!==e&&(this.origin=e)}),sg(a,"beforeChange",a,d),a.cm&&sg(a.cm,"beforeChange",a.cm,d),d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Rd(a,b,c){if(a.cm){if(!a.cm.curOp)return Lc(a.cm,Rd)(a,b,c);if(a.cm.state.suppressEdits)return}if(!(yg(a,"beforeChange")||a.cm&&yg(a.cm,"beforeChange"))||(b=Qd(a,b,!0))){var d=u&&!c&&Se(a,b.from,b.to);if(d)for(var e=d.length-1;e>=0;--e)Sd(a,{from:d[e].from,to:d[e].to,text:e?[""]:b.text});else Sd(a,b)}}function Sd(a,b){if(1!=b.text.length||""!=b.text[0]||0!=ob(b.from,b.to)){var c=Nd(a,b);_f(a,b,c,a.cm?a.cm.curOp.id:0/0),Vd(a,b,c,Pe(a,b));var d=[];Nf(a,function(a,c){c||-1!=Mg(d,a.history)||(jg(a.history,b),d.push(a.history)),Vd(a,b,null,Pe(a,b))})}}function Td(a,b,c){if(!a.cm||!a.cm.state.suppressEdits){for(var e,d=a.history,f=a.sel,g="undo"==b?d.done:d.undone,h="undo"==b?d.undone:d.done,i=0;i<g.length&&(e=g[i],c?!e.ranges||e.equals(a.sel):e.ranges);i++);if(i!=g.length){for(d.lastOrigin=d.lastSelOrigin=null;e=g.pop(),e.ranges;){if(cg(e,h),c&&!e.equals(a.sel))return Ib(a,e,{clearRedo:!1}),void 0;f=e}var j=[];cg(f,h),h.push({changes:j,generation:d.generation}),d.generation=e.generation||++d.maxGeneration;for(var k=yg(a,"beforeChange")||a.cm&&yg(a.cm,"beforeChange"),i=e.changes.length-1;i>=0;--i){var l=e.changes[i];if(l.origin=b,k&&!Qd(a,l,!1))return g.length=0,void 0;j.push(Yf(a,l));var m=i?Nd(a,l):Kg(g);Vd(a,l,m,Re(a,l)),!i&&a.cm&&a.cm.scrollIntoView({from:l.from,to:Ld(l)});var n=[];Nf(a,function(a,b){b||-1!=Mg(n,a.history)||(jg(a.history,l),n.push(a.history)),Vd(a,l,null,Re(a,l))})}}}}function Ud(a,b){if(0!=b&&(a.first+=b,a.sel=new sb(Ng(a.sel.ranges,function(a){return new tb(nb(a.anchor.line+b,a.anchor.ch),nb(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){Qc(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<c.viewTo;d++)Rc(a.cm,d,"gutter")}}function Vd(a,b,c,d){if(a.cm&&!a.cm.curOp)return Lc(a.cm,Vd)(a,b,c,d);if(b.to.line<a.first)return Ud(a,b.text.length-1-(b.to.line-b.from.line)),void 0;if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Ud(a,e),b={from:nb(a.first,0),to:nb(b.to.line+e,b.to.ch),text:[Kg(b.text)],origin:b.origin}}var f=a.lastLine();b.to.line>f&&(b={from:b.from,to:nb(f,Pf(a,f).text.length),text:[b.text[0]],origin:b.origin}),b.removed=Qf(a,b.from,b.to),c||(c=Nd(a,b)),a.cm?Wd(a.cm,b,d):Gf(a,b,d),Jb(a,c,Cg)}}function Wd(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,i=f.line;a.options.lineWrapping||(i=Tf(af(Pf(d,f.line))),d.iter(i,g.line+1,function(a){return a==e.maxLine?(h=!0,!0):void 0})),d.sel.contains(b.from,b.to)>-1&&xg(a),Gf(d,b,c,B(a)),a.options.lineWrapping||(d.iter(i,f.line+b.text.length,function(a){var b=I(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0)),d.frontier=Math.min(d.frontier,f.line),Ub(a,400);var j=b.text.length-(g.line-f.line)-1;f.line!=g.line||1!=b.text.length||Ff(a.doc,b)?Qc(a,f.line,g.line+1,j):Rc(a,f.line,"text");var k=yg(a,"changes"),l=yg(a,"change");if(l||k){var m={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin};l&&ug(a,"change",a,m),k&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(m)}a.display.selForContextMenu=null}function Xd(a,b,c,d,e){if(d||(d=c),ob(d,c)<0){var f=d;d=c,c=f}"string"==typeof b&&(b=qh(b)),Rd(a,{from:c,to:d,text:b,origin:e})}function Yd(a,b){var c=a.display,d=c.sizer.getBoundingClientRect(),e=null;if(b.top+d.top<0?e=!0:b.bottom+d.top>(window.innerHeight||document.documentElement.clientHeight)&&(e=!1),null!=e&&!m){var f=Xg("div","\u200b",null,"position: absolute; top: "+(b.top-c.viewOffset-Yb(a.display))+"px; height: "+(b.bottom-b.top+Ag)+"px; left: "+b.left+"px; width: 2px;");a.display.lineSpace.appendChild(f),f.scrollIntoView(e),a.display.lineSpace.removeChild(f)}}function Zd(a,b,c,d){for(null==d&&(d=0);;){var e=!1,f=rc(a,b),g=c&&c!=b?rc(a,c):f,h=_d(a,Math.min(f.left,g.left),Math.min(f.top,g.top)-d,Math.max(f.left,g.left),Math.max(f.bottom,g.bottom)+d),i=a.doc.scrollTop,j=a.doc.scrollLeft;if(null!=h.scrollTop&&(sd(a,h.scrollTop),Math.abs(a.doc.scrollTop-i)>1&&(e=!0)),null!=h.scrollLeft&&(td(a,h.scrollLeft),Math.abs(a.doc.scrollLeft-j)>1&&(e=!0)),!e)return f}}function $d(a,b,c,d,e){var f=_d(a,b,c,d,e);null!=f.scrollTop&&sd(a,f.scrollTop),null!=f.scrollLeft&&td(a,f.scrollLeft)}function _d(a,b,c,d,e){var f=a.display,g=xc(a.display);0>c&&(c=0);var h=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:f.scroller.scrollTop,i=f.scroller.clientHeight-Ag,j={};e-c>i&&(e=c+i);var k=a.doc.height+Zb(f),l=g>c,m=e>k-g;if(h>c)j.scrollTop=l?0:c;else if(e>h+i){var n=Math.min(c,(m?k:e)-i);n!=h&&(j.scrollTop=n)}var o=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:f.scroller.scrollLeft,p=f.scroller.clientWidth-Ag,q=d-b>p;return q&&(d=c+i),b<f.gutters.offsetWidth+10?j.scrollLeft=0:o>b?j.scrollLeft=Math.max(0,b-(q?0:10)):d>p+o-3&&(j.scrollLeft=d+(q?0:10)-p),j}function ae(a,b,c){(null!=b||null!=c)&&ce(a),null!=b&&(a.curOp.scrollLeft=(null==a.curOp.scrollLeft?a.doc.scrollLeft:a.curOp.scrollLeft)+b),null!=c&&(a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+c)}function be(a){ce(a);var b=a.getCursor(),c=b,d=b;a.options.lineWrapping||(c=b.ch?nb(b.line,b.ch-1):b,d=nb(b.line,b.ch+1)),a.curOp.scrollToPos={from:c,to:d,margin:a.options.cursorScrollMargin,isCursor:!0}}function ce(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=sc(a,b.from),d=sc(a,b.to),e=_d(a,Math.min(c.left,d.left),Math.min(c.top,d.top)-b.margin,Math.max(c.right,d.right),Math.max(c.bottom,d.bottom)+b.margin);a.scrollTo(e.scrollLeft,e.scrollTop)}}function de(a,b,c,d){var f,e=a.doc;null==c&&(c="add"),"smart"==c&&(e.mode.indent?f=Xb(a,b):c="prev");var g=a.options.tabSize,h=Pf(e,b),i=Gg(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var k,j=h.text.match(/^\s*/)[0];if(d||/\S/.test(h.text)){if("smart"==c&&(k=e.mode.indent(f,h.text.slice(j.length),h.text),k==Bg||k>150)){if(!d)return;c="prev"}}else k=0,c="not";"prev"==c?k=b>e.first?Gg(Pf(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c?k=i-a.options.indentUnit:"number"==typeof c&&(k=i+c),k=Math.max(0,k);var l="",m=0;if(a.options.indentWithTabs)for(var n=Math.floor(k/g);n;--n)m+=g,l+=" ";if(k>m&&(l+=Jg(k-m)),l!=j)Xd(e,l,nb(b,0),nb(b,j.length),"+input");else for(var n=0;n<e.sel.ranges.length;n++){var o=e.sel.ranges[n];if(o.head.line==b&&o.head.ch<j.length){var m=nb(b,j.length);Eb(e,n,new tb(m,m));break}}h.stateAfter=null}function ee(a,b,c,d){var e=b,f=b;return"number"==typeof b?f=Pf(a,wb(a,b)):e=Tf(b),null==e?null:(d(f,e)&&a.cm&&Rc(a.cm,e,c),f)}function fe(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&ob(f.from,Kg(d).to)<=0;){var g=d.pop();if(ob(g.from,f.from)<0){f.from=g.from;break}}d.push(f)}Kc(a,function(){for(var b=d.length-1;b>=0;b--)Xd(a.doc,"",d[b].from,d[b].to,"+delete");be(a)})}function ge(a,b,c,d,e){function k(){var b=f+c;return b<a.first||b>=a.first+a.size?j=!1:(f=b,i=Pf(a,b))}function l(a){var b=(e?Ih:Jh)(i,g,c,!0);if(null==b){if(a||!k())return j=!1;g=e?(0>c?Ah:zh)(i):0>c?i.text.length:0}else g=b;return!0}var f=b.line,g=b.ch,h=c,i=Pf(a,f),j=!0;if("char"==d)l();else if("column"==d)l(!0);else if("word"==d||"group"==d)for(var m=null,n="group"==d,o=a.cm&&a.cm.getHelper(b,"wordChars"),p=!0;!(0>c)||l(!p);p=!1){var q=i.text.charAt(g)||"\n",r=Tg(q,o)?"w":n&&"\n"==q?"n":!n||/\s/.test(q)?null:"p";if(!n||p||r||(r="s"),m&&m!=r){0>c&&(c=1,l());break}if(r&&(m=r),c>0&&!l(!p))break}var s=Nb(a,nb(f,g),h,!0);return j||(s.hitSide=!0),s}function he(a,b,c,d){var g,e=a.doc,f=b.left;if("page"==d){var h=Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);g=b.top+c*(h-(0>c?1.5:.5)*xc(a.display))}else"line"==d&&(g=c>0?b.bottom+3:b.top-3);for(;;){var i=uc(a,f,g);if(!i.outside)break;if(0>c?0>=g:g>=e.height){i.hitSide=!0;break}g+=5*c}return i}function ie(a,b){var c=a.doc,d=Pf(c,b.line).text,e=b.ch,f=b.ch;if(d){var g=a.getHelper(b,"wordChars");(b.xRel<0||f==d.length)&&e?--e:++f;for(var h=d.charAt(e),i=Tg(h,g)?function(a){return Tg(a,g)}:/\s/.test(h)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!Tg(a)};e>0&&i(d.charAt(e-1));)--e;for(;f<d.length&&i(d.charAt(f));)++f}return new tb(nb(b.line,e),nb(b.line,f))}function le(a,b,c,d){w.defaults[a]=b,c&&(ke[a]=d?function(a,b,d){d!=me&&c(a,b,d)}:c)}function we(a){return"string"==typeof a?ve[a]:a}function De(a,b,c,d,e){if(d&&d.shared)return Fe(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return Lc(a.cm,De)(a,b,c,d,e);var f=new Be(a,e),g=ob(b,c);if(d&&Pg(d,f,!1),g>0||0==g&&f.clearWhenEmpty!==!1)return f;if(f.replacedWith&&(f.collapsed=!0,f.widgetNode=Xg("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||(f.widgetNode.ignoreEvents=!0),d.insertLeft&&(f.widgetNode.insertLeft=!0)),f.collapsed){if(_e(a,b.line,b,c,f)||b.line!=c.line&&_e(a,c.line,b,c,f))throw new Error("Inserting collapsed marker partially overlapping an existing one");v=!0}f.addToHistory&&_f(a,{from:b,to:c,origin:"markText"},a.sel,0/0);var j,h=b.line,i=a.cm;if(a.iter(h,c.line+1,function(a){i&&f.collapsed&&!i.options.lineWrapping&&af(a)==i.display.maxLine&&(j=!0),f.collapsed&&h!=b.line&&Sf(a,0),Me(a,new Je(f,h==b.line?b.ch:null,h==c.line?c.ch:null)),++h}),f.collapsed&&a.iter(b.line,c.line+1,function(b){ef(a,b)&&Sf(b,0)
11
+ }),f.clearOnEnter&&qg(f,"beforeCursorEnter",function(){f.clear()}),f.readOnly&&(u=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory()),f.collapsed&&(f.id=++Ce,f.atomic=!0),i){if(j&&(i.curOp.updateMaxLine=!0),f.collapsed)Qc(i,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle)for(var k=b.line;k<=c.line;k++)Rc(i,k,"text");f.atomic&&Lb(i.doc),ug(i,"markerAdded",i,f)}return f}function Fe(a,b,c,d,e){d=Pg(d),d.shared=!1;var f=[De(a,b,c,d,e)],g=f[0],h=d.widgetNode;return Nf(a,function(a){h&&(d.widgetNode=h.cloneNode(!0)),f.push(De(a,xb(a,b),xb(a,c),d,e));for(var i=0;i<a.linked.length;++i)if(a.linked[i].isParent)return;g=Kg(f)}),new Ee(f,g)}function Ge(a){return a.findMarks(nb(a.first,0),a.clipPos(nb(a.lastLine())),function(a){return a.parent})}function He(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d.find(),f=a.clipPos(e.from),g=a.clipPos(e.to);if(ob(f,g)){var h=De(a,f,g,d.primary,d.primary.type);d.markers.push(h),h.parent=d}}}function Ie(a){for(var b=0;b<a.length;b++){var c=a[b],d=[c.primary.doc];Nf(c.primary.doc,function(a){d.push(a)});for(var e=0;e<c.markers.length;e++){var f=c.markers[e];-1==Mg(d,f.doc)&&(f.parent=null,c.markers.splice(e--,1))}}}function Je(a,b,c){this.marker=a,this.from=b,this.to=c}function Ke(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Le(a,b){for(var c,d=0;d<a.length;++d)a[d]!=b&&(c||(c=[])).push(a[d]);return c}function Me(a,b){a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b],b.marker.attachLine(a)}function Ne(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);if(h||f.from==b&&"bookmark"==g.type&&(!c||!f.marker.insertLeft)){var i=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);(e||(e=[])).push(new Je(g,f.from,i?null:f.to))}}return e}function Oe(a,b,c){if(a)for(var e,d=0;d<a.length;++d){var f=a[d],g=f.marker,h=null==f.to||(g.inclusiveRight?f.to>=b:f.to>b);if(h||f.from==b&&"bookmark"==g.type&&(!c||f.marker.insertLeft)){var i=null==f.from||(g.inclusiveLeft?f.from<=b:f.from<b);(e||(e=[])).push(new Je(g,i?null:f.from-b,null==f.to?null:f.to-b))}}return e}function Pe(a,b){var c=zb(a,b.from.line)&&Pf(a,b.from.line).markedSpans,d=zb(a,b.to.line)&&Pf(a,b.to.line).markedSpans;if(!c&&!d)return null;var e=b.from.ch,f=b.to.ch,g=0==ob(b.from,b.to),h=Ne(c,e,g),i=Oe(d,f,g),j=1==b.text.length,k=Kg(b.text).length+(j?e:0);if(h)for(var l=0;l<h.length;++l){var m=h[l];if(null==m.to){var n=Ke(i,m.marker);n?j&&(m.to=null==n.to?null:n.to+k):m.to=e}}if(i)for(var l=0;l<i.length;++l){var m=i[l];if(null!=m.to&&(m.to+=k),null==m.from){var n=Ke(h,m.marker);n||(m.from=k,j&&(h||(h=[])).push(m))}else m.from+=k,j&&(h||(h=[])).push(m)}h&&(h=Qe(h)),i&&i!=h&&(i=Qe(i));var o=[h];if(!j){var q,p=b.text.length-2;if(p>0&&h)for(var l=0;l<h.length;++l)null==h[l].to&&(q||(q=[])).push(new Je(h[l].marker,null,null));for(var l=0;p>l;++l)o.push(q);o.push(i)}return o}function Qe(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&c.marker.clearWhenEmpty!==!1&&a.splice(b--,1)}return a.length?a:null}function Re(a,b){var c=fg(a,b),d=Pe(a,b);if(!c)return d;if(!d)return c;for(var e=0;e<c.length;++e){var f=c[e],g=d[e];if(f&&g)a:for(var h=0;h<g.length;++h){for(var i=g[h],j=0;j<f.length;++j)if(f[j].marker==i.marker)continue a;f.push(i)}else g&&(c[e]=g)}return c}function Se(a,b,c){var d=null;if(a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||d&&-1!=Mg(d,c)||(d||(d=[])).push(c)}}),!d)return null;for(var e=[{from:b,to:c}],f=0;f<d.length;++f)for(var g=d[f],h=g.find(0),i=0;i<e.length;++i){var j=e[i];if(!(ob(j.to,h.from)<0||ob(j.from,h.to)>0)){var k=[i,1],l=ob(j.from,h.from),m=ob(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Te(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Ue(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ve(a){return a.inclusiveLeft?-1:0}function We(a){return a.inclusiveRight?1:0}function Xe(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=ob(d.from,e.from)||Ve(a)-Ve(b);if(f)return-f;var g=ob(d.to,e.to)||We(a)-We(b);return g?g:b.id-a.id}function Ye(a,b){var d,c=v&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Xe(d,e.marker)<0)&&(d=e.marker);return d}function Ze(a){return Ye(a,!0)}function $e(a){return Ye(a,!1)}function _e(a,b,c,d,e){var f=Pf(a,b),g=v&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=ob(j.from,c)||Ve(i.marker)-Ve(e),l=ob(j.to,d)||We(i.marker)-We(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(ob(j.to,c)>0||i.marker.inclusiveRight&&e.inclusiveLeft)||k>=0&&(ob(j.from,d)<0||i.marker.inclusiveLeft&&e.inclusiveRight)))return!0}}}function af(a){for(var b;b=Ze(a);)a=b.find(-1,!0).line;return a}function bf(a){for(var b,c;b=$e(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function cf(a,b){var c=Pf(a,b),d=af(c);return c==d?b:Tf(d)}function df(a,b){if(b>a.lastLine())return b;var d,c=Pf(a,b);if(!ef(a,c))return b;for(;d=$e(c);)c=d.find(1,!0).line;return Tf(c)+1}function ef(a,b){var c=v&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&ff(a,b,d))return!0}}function ff(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return ff(a,d.line,Ke(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&ff(a,b,e))return!0}function hf(a,b,c){Vf(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&ae(a,null,c)}function jf(a){if(null!=a.height)return a.height;if(!_g(document.body,a.node)){var b="position: relative;";a.coverGutter&&(b+="margin-left: -"+a.cm.getGutterElement().offsetWidth+"px;"),$g(a.cm.display.measure,Xg("div",[a.node],null,b))}return a.height=a.node.offsetHeight}function kf(a,b,c,d){var e=new gf(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),ee(a.doc,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!ef(a.doc,b)){var d=Vf(b)<a.doc.scrollTop;Sf(b,b.height+jf(e)),d&&ae(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function mf(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Te(a),Ue(a,c);var e=d?d(a):1;e!=a.height&&Sf(a,e)}function nf(a){a.parent=null,Te(a)}function of(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function pf(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=w.innerMode(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function qf(a,b,c){for(var d=0;10>d;d++){var e=a.token(b,c);if(b.pos>b.start)return e}throw new Error("Mode "+a.name+" failed to advance stream.")}function rf(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var l,i=0,j=null,k=new Ae(b,a.options.tabSize);for(""==b&&of(pf(c,d),f);!k.eol();){if(k.pos>a.options.maxHighlightLength?(h=!1,g&&uf(a,b,d,k.pos),k.pos=b.length,l=null):l=of(qf(c,k,d),f),a.options.addModeClass){var m=w.innerMode(c,d).mode.name;m&&(l="m-"+(l?m+" "+l:m))}h&&j==l||(i<k.start&&e(k.start,j),i=k.start,j=l),k.start=k.pos}for(;i<k.pos;){var n=Math.min(k.pos,i+5e4);e(n,j),i=n}}function sf(a,b,c,d){var e=[a.state.modeGen],f={};rf(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;rf(a,b.text,h.mode,!0,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function tf(a,b){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=sf(a,b,b.stateAfter=Xb(a,Tf(b)));b.styles=c.styles,c.classes?b.styleClasses=c.classes:b.styleClasses&&(b.styleClasses=null)}return b.styles}function uf(a,b,c,d){var e=a.doc.mode,f=new Ae(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&pf(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)qf(e,f,c),f.start=f.pos}function xf(a,b){if(!a||/^\s*$/.test(a))return null;var c=b.addModeClass?wf:vf;return c[a]||(c[a]=a.replace(/\S+/g,"cm-$&"))}function yf(a,b){var c=Xg("span",null,null,f?"padding-right: .1px":null),e={pre:Xg("pre",[c]),content:c,col:0,pos:0,cm:a};b.measure={};for(var g=0;g<=(b.rest?b.rest.length:0);g++){var i,h=g?b.rest[g-1]:b.line;e.pos=0,e.addToken=Af,(d||f)&&a.getOption("lineWrapping")&&(e.addToken=Bf(e.addToken)),ph(a.display.measure)&&(i=Wf(h))&&(e.addToken=Cf(e.addToken,i)),e.map=[],Ef(h,e,tf(a,h)),h.styleClasses&&(h.styleClasses.bgClass&&(e.bgClass=eh(h.styleClasses.bgClass,e.bgClass||"")),h.styleClasses.textClass&&(e.textClass=eh(h.styleClasses.textClass,e.textClass||""))),0==e.map.length&&e.map.push(0,0,e.content.appendChild(nh(a.display.measure))),0==g?(b.measure.map=e.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(e.map),(b.measure.caches||(b.measure.caches=[])).push({}))}return sg(a,"renderLine",a,b.line,e.pre),e.pre.className&&(e.textClass=eh(e.pre.className,e.textClass||"")),e}function zf(a){var b=Xg("span","\u2022","cm-invalidchar");return b.title="\\u"+a.charCodeAt(0).toString(16),b}function Af(a,b,c,f,g,h){if(b){var i=a.cm.options.specialChars,j=!1;if(i.test(b))for(var k=document.createDocumentFragment(),l=0;;){i.lastIndex=l;var m=i.exec(b),n=m?m.index-l:b.length-l;if(n){var o=document.createTextNode(b.slice(l,l+n));d&&9>e?k.appendChild(Xg("span",[o])):k.appendChild(o),a.map.push(a.pos,a.pos+n,o),a.col+=n,a.pos+=n}if(!m)break;if(l+=n+1," "==m[0]){var p=a.cm.options.tabSize,q=p-a.col%p,o=k.appendChild(Xg("span",Jg(q),"cm-tab"));a.col+=q}else{var o=a.cm.options.specialCharPlaceholder(m[0]);d&&9>e?k.appendChild(Xg("span",[o])):k.appendChild(o),a.col+=1}a.map.push(a.pos,a.pos+1,o),a.pos++}else{a.col+=b.length;var k=document.createTextNode(b);a.map.push(a.pos,a.pos+b.length,k),d&&9>e&&(j=!0),a.pos+=b.length}if(c||f||g||j){var r=c||"";f&&(r+=f),g&&(r+=g);var s=Xg("span",[k],r);return h&&(s.title=h),a.content.appendChild(s)}a.content.appendChild(k)}}function Bf(a){function b(a){for(var b=" ",c=0;c<a.length-2;++c)b+=c%2?" ":"\xa0";return b+=" "}return function(c,d,e,f,g,h){a(c,d.replace(/ {3,}/g,b),e,f,g,h)}}function Cf(a,b){return function(c,d,e,f,g,h){e=e?e+" cm-force-border":"cm-force-border";for(var i=c.pos,j=i+d.length;;){for(var k=0;k<b.length;k++){var l=b[k];if(l.to>i&&l.from<=i)break}if(l.to>=j)return a(c,d,e,f,g,h);a(c,d.slice(0,l.to-i),e,f,null,h),f=null,d=d.slice(l.to-i),i=l.to}}}function Df(a,b,c,d){var e=!d&&c.widgetNode;e&&(a.map.push(a.pos,a.pos+b,e),a.content.appendChild(e)),a.pos+=b}function Ef(a,b,c){var d=a.markedSpans,e=a.text,f=0;if(d)for(var k,m,n,o,p,q,h=e.length,i=0,g=1,j="",l=0;;){if(l==i){m=n=o=p="",q=null,l=1/0;for(var r=[],s=0;s<d.length;++s){var t=d[s],u=t.marker;t.from<=i&&(null==t.to||t.to>i)?(null!=t.to&&l>t.to&&(l=t.to,n=""),u.className&&(m+=" "+u.className),u.startStyle&&t.from==i&&(o+=" "+u.startStyle),u.endStyle&&t.to==l&&(n+=" "+u.endStyle),u.title&&!p&&(p=u.title),u.collapsed&&(!q||Xe(q.marker,u)<0)&&(q=t)):t.from>i&&l>t.from&&(l=t.from),"bookmark"==u.type&&t.from==i&&u.widgetNode&&r.push(u)}if(q&&(q.from||0)==i&&(Df(b,(null==q.to?h+1:q.to)-i,q.marker,null==q.from),null==q.to))return;if(!q&&r.length)for(var s=0;s<r.length;++s)Df(b,0,r[s])}if(i>=h)break;for(var v=Math.min(h,l);;){if(j){var w=i+j.length;if(!q){var x=w>v?j.slice(0,v-i):j;b.addToken(b,x,k?k+m:m,o,i+x.length==l?n:"",p)}if(w>=v){j=j.slice(v-i),i=v;break}i=w,o=""}j=e.slice(f,f=c[g++]),k=xf(c[g++],b.cm.options)}}else for(var g=1;g<c.length;g+=2)b.addToken(b,e.slice(f,f=c[g]),xf(c[g+1],b.cm.options))}function Ff(a,b){return 0==b.from.ch&&0==b.to.ch&&""==Kg(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Gf(a,b,c,d){function e(a){return c?c[a]:null}function f(a,c,e){mf(a,c,e,d),ug(a,"change",a,b)}var g=b.from,h=b.to,i=b.text,j=Pf(a,g.line),k=Pf(a,h.line),l=Kg(i),m=e(i.length-1),n=h.line-g.line;if(Ff(a,b)){for(var o=0,p=[];o<i.length-1;++o)p.push(new lf(i[o],e(o),d));f(k,k.text,m),n&&a.remove(g.line,n),p.length&&a.insert(g.line,p)}else if(j==k)if(1==i.length)f(j,j.text.slice(0,g.ch)+l+j.text.slice(h.ch),m);else{for(var p=[],o=1;o<i.length-1;++o)p.push(new lf(i[o],e(o),d));p.push(new lf(l+j.text.slice(h.ch),m,d)),f(j,j.text.slice(0,g.ch)+i[0],e(0)),a.insert(g.line+1,p)}else if(1==i.length)f(j,j.text.slice(0,g.ch)+i[0]+k.text.slice(h.ch),e(0)),a.remove(g.line+1,n);else{f(j,j.text.slice(0,g.ch)+i[0],e(0)),f(k,l+k.text.slice(h.ch),m);for(var o=1,p=[];o<i.length-1;++o)p.push(new lf(i[o],e(o),d));n>1&&a.remove(g.line+1,n-1),a.insert(g.line+1,p)}ug(a,"change",a,b)}function Hf(a){this.lines=a,this.parent=null;for(var b=0,c=0;b<a.length;++b)a[b].parent=this,c+=a[b].height;this.height=c}function If(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize(),c+=e.height,e.parent=this}this.size=b,this.height=c,this.parent=null}function Nf(a,b,c){function d(a,e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var h=a.linked[g];if(h.doc!=e){var i=f&&h.sharedHist;(!c||i)&&(b(h.doc,i),d(h.doc,a,i))}}}d(a,null,!0)}function Of(a,b){if(b.cm)throw new Error("This document is already in use.");a.doc=b,b.cm=a,C(a),y(a),a.options.lineWrapping||J(a),a.options.mode=b.modeOption,Qc(a)}function Pf(a,b){if(b-=a.first,0>b||b>=a.size)throw new Error("There is no line "+(b+a.first)+" in the document.");for(var c=a;!c.lines;)for(var d=0;;++d){var e=c.children[d],f=e.chunkSize();if(f>b){c=e;break}b-=f}return c.lines[b]}function Qf(a,b,c){var d=[],e=b.line;return a.iter(b.line,c.line+1,function(a){var f=a.text;e==c.line&&(f=f.slice(0,c.ch)),e==b.line&&(f=f.slice(b.ch)),d.push(f),++e}),d}function Rf(a,b,c){var d=[];return a.iter(b,c,function(a){d.push(a.text)}),d}function Sf(a,b){var c=b-a.height;if(c)for(var d=a;d;d=d.parent)d.height+=c}function Tf(a){if(null==a.parent)return null;for(var b=a.parent,c=Mg(b.lines,a),d=b.parent;d;b=d,d=d.parent)for(var e=0;d.children[e]!=b;++e)c+=d.children[e].chunkSize();return c+b.first}function Uf(a,b){var c=a.first;a:do{for(var d=0;d<a.children.length;++d){var e=a.children[d],f=e.height;if(f>b){a=e;continue a}b-=f,c+=e.chunkSize()}return c}while(!a.lines);for(var d=0;d<a.lines.length;++d){var g=a.lines[d],h=g.height;if(h>b)break;b-=h}return c+d}function Vf(a){a=af(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=c.lines[d];if(e==a)break;b+=e.height}for(var f=c.parent;f;c=f,f=c.parent)for(var d=0;d<f.children.length;++d){var g=f.children[d];if(g==c)break;b+=g.height}return b}function Wf(a){var b=a.order;return null==b&&(b=a.order=Kh(a.text)),b}function Xf(a){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=a||1}function Yf(a,b){var c={from:pb(b.from),to:Ld(b),text:Qf(a,b.from,b.to)};return dg(a,c,b.from.line,b.to.line+1),Nf(a,function(a){dg(a,c,b.from.line,b.to.line+1)},!0),c}function Zf(a){for(;a.length;){var b=Kg(a);if(!b.ranges)break;a.pop()}}function $f(a,b){return b?(Zf(a.done),Kg(a.done)):a.done.length&&!Kg(a.done).ranges?Kg(a.done):a.done.length>1&&!a.done[a.done.length-2].ranges?(a.done.pop(),Kg(a.done)):void 0}function _f(a,b,c,d){var e=a.history;e.undone.length=0;var g,f=+new Date;if((e.lastOp==d||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0)))&&(g=$f(e,e.lastOp==d))){var h=Kg(g.changes);0==ob(b.from,b.to)&&0==ob(b.from,h.to)?h.to=Ld(b):g.changes.push(Yf(a,b))}else{var i=Kg(e.done);for(i&&i.ranges||cg(a.sel,e.done),g={changes:[Yf(a,b)],generation:e.generation},e.done.push(g);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift()}e.done.push(c),e.generation=++e.maxGeneration,e.lastModTime=e.lastSelTime=f,e.lastOp=e.lastSelOp=d,e.lastOrigin=e.lastSelOrigin=b.origin,h||sg(a,"historyAdded")}function ag(a,b,c,d){var e=b.charAt(0);return"*"==e||"+"==e&&c.ranges.length==d.ranges.length&&c.somethingSelected()==d.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}function bg(a,b,c,d){var e=a.history,f=d&&d.origin;c==e.lastSelOp||f&&e.lastSelOrigin==f&&(e.lastModTime==e.lastSelTime&&e.lastOrigin==f||ag(a,f,Kg(e.done),b))?e.done[e.done.length-1]=b:cg(b,e.done),e.lastSelTime=+new Date,e.lastSelOrigin=f,e.lastSelOp=c,d&&d.clearRedo!==!1&&Zf(e.undone)}function cg(a,b){var c=Kg(b);c&&c.ranges&&c.equals(a)||b.push(a)}function dg(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans),++f})}function eg(a){if(!a)return null;for(var c,b=0;b<a.length;++b)a[b].marker.explicitlyCleared?c||(c=a.slice(0,b)):c&&c.push(a[b]);return c?c.length?c:null:a}function fg(a,b){var c=b["spans_"+a.id];if(!c)return null;for(var d=0,e=[];d<b.text.length;++d)e.push(eg(c[d]));return e}function gg(a,b,c){for(var d=0,e=[];d<a.length;++d){var f=a[d];if(f.ranges)e.push(c?sb.prototype.deepCopy.call(f):f);else{var g=f.changes,h=[];e.push({changes:h});for(var i=0;i<g.length;++i){var k,j=g[i];if(h.push({from:j.from,to:j.to,text:j.text}),b)for(var l in j)(k=l.match(/^spans_(\d+)$/))&&Mg(b,Number(k[1]))>-1&&(Kg(h)[l]=j[l],delete j[l])}}}return e}function hg(a,b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function ig(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges){f.copied||(f=a[e]=f.deepCopy(),f.copied=!0);for(var h=0;h<f.ranges.length;h++)hg(f.ranges[h].anchor,b,c,d),hg(f.ranges[h].head,b,c,d)}else{for(var h=0;h<f.changes.length;++h){var i=f.changes[h];if(c<i.from.line)i.from=nb(i.from.line+d,i.from.ch),i.to=nb(i.to.line+d,i.to.ch);else if(b<=i.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function jg(a,b){var c=b.from.line,d=b.to.line,e=b.text.length-(d-c)-1;ig(a.done,c,d,e),ig(a.undone,c,d,e)}function mg(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function og(a){return a.target||a.srcElement}function pg(a){var b=a.which;return null==b&&(1&a.button?b=1:2&a.button?b=3:4&a.button&&(b=2)),p&&a.ctrlKey&&1==b&&(b=3),b}function ug(a,b){function f(a){return function(){a.apply(null,d)}}var c=a._handlers&&a._handlers[b];if(c){var e,d=Array.prototype.slice.call(arguments,2);zc?e=zc.delayedCallbacks:tg?e=tg:(e=tg=[],setTimeout(vg,0));for(var g=0;g<c.length;++g)e.push(f(c[g]))}}function vg(){var a=tg;tg=null;for(var b=0;b<a.length;++b)a[b]()}function wg(a,b,c){return sg(a,c||b.type,a,b),mg(b)||b.codemirrorIgnore}function xg(a){var b=a._handlers&&a._handlers.cursorActivity;if(b)for(var c=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]),d=0;d<b.length;++d)-1==Mg(c,b[d])&&c.push(b[d])}function yg(a,b){var c=a._handlers&&a._handlers[b];return c&&c.length>0}function zg(a){a.prototype.on=function(a,b){qg(this,a,b)},a.prototype.off=function(a,b){rg(this,a,b)}}function Fg(){this.id=null}function Hg(a,b,c){for(var d=0,e=0;;){var f=a.indexOf(" ",d);-1==f&&(f=a.length);var g=f-d;if(f==a.length||e+g>=b)return d+Math.min(g,b-e);if(e+=f-d,e+=c-e%c,d=f+1,e>=b)return d}}function Jg(a){for(;Ig.length<=a;)Ig.push(Kg(Ig)+" ");return Ig[a]}function Kg(a){return a[a.length-1]}function Mg(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function Ng(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function Og(a,b){var c;if(Object.create)c=Object.create(a);else{var d=function(){};d.prototype=a,c=new d}return b&&Pg(b,c),c}function Pg(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||c===!1&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}function Qg(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Tg(a,b){return b?b.source.indexOf("\\w")>-1&&Sg(a)?!0:b.test(a):Sg(a)}function Ug(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function Wg(a){return a.charCodeAt(0)>=768&&Vg.test(a)}function Xg(a,b,c,d){var e=document.createElement(a);if(c&&(e.className=c),d&&(e.style.cssText=d),"string"==typeof b)e.appendChild(document.createTextNode(b));else if(b)for(var f=0;f<b.length;++f)e.appendChild(b[f]);return e}function Zg(a){for(var b=a.childNodes.length;b>0;--b)a.removeChild(a.firstChild);return a}function $g(a,b){return Zg(a).appendChild(b)}function _g(a,b){if(a.contains)return a.contains(b);for(;b=b.parentNode;)if(b==a)return!0}function ah(){return document.activeElement}function bh(a){return new RegExp("\\b"+a+"\\b\\s*")}function ch(a,b){var c=bh(b);c.test(a.className)&&(a.className=a.className.replace(c,""))}function dh(a,b){bh(b).test(a.className)||(a.className+=" "+b)}function eh(a,b){for(var c=a.split(" "),d=0;d<c.length;d++)c[d]&&!bh(c[d]).test(b)&&(b+=" "+c[d]);return b}function fh(a){if(document.body.getElementsByClassName)for(var b=document.body.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function hh(){gh||(ih(),gh=!0)}function ih(){var a;qg(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null,kh=null,fh(ed)},100))}),qg(window,"blur",function(){fh(Id)})}function lh(a){if(null!=kh)return kh;var b=Xg("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return $g(a,b),b.offsetWidth&&(kh=b.offsetHeight-b.clientHeight),kh||0}function nh(a){if(null==mh){var b=Xg("span","\u200b");$g(a,Xg("span",[b,document.createTextNode("x")])),0!=a.firstChild.offsetHeight&&(mh=b.offsetWidth<=1&&b.offsetHeight>2&&!(d&&8>e))}return mh?Xg("span","\u200b"):Xg("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px")}function ph(a){if(null!=oh)return oh;var b=$g(a,document.createTextNode("A\u062eA")),c=Yg(b,0,1).getBoundingClientRect();if(c.left==c.right)return!1;var d=Yg(b,1,2).getBoundingClientRect();return oh=d.right-c.right<3}function uh(a){if(null!=th)return th;var b=$g(a,Xg("span","x")),c=b.getBoundingClientRect(),d=Yg(b,0,1).getBoundingClientRect();return th=Math.abs(c.left-d.left)>1}function wh(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=!1,f=0;f<a.length;++f){var g=a[f];(g.from<c&&g.to>b||b==c&&g.to==b)&&(d(Math.max(g.from,b),Math.min(g.to,c),1==g.level?"rtl":"ltr"),e=!0)}e||d(b,c,"ltr")}function xh(a){return a.level%2?a.to:a.from}function yh(a){return a.level%2?a.from:a.to}function zh(a){var b=Wf(a);return b?xh(b[0]):0}function Ah(a){var b=Wf(a);return b?yh(Kg(b)):a.text.length}function Bh(a,b){var c=Pf(a.doc,b),d=af(c);d!=c&&(b=Tf(d));var e=Wf(d),f=e?e[0].level%2?Ah(d):zh(d):0;return nb(b,f)}function Ch(a,b){for(var c,d=Pf(a.doc,b);c=$e(d);)d=c.find(1,!0).line,b=null;var e=Wf(d),f=e?e[0].level%2?zh(d):Ah(d):d.text.length;return nb(null==b?Tf(d):b,f)}function Dh(a,b){var c=Bh(a,b.line),d=Pf(a.doc,c.line),e=Wf(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.line==c.line&&b.ch<=f&&b.ch;return nb(c.line,g?0:f)}return c}function Eh(a,b,c){var d=a[0].level;return b==d?!0:c==d?!1:c>b}function Gh(a,b){Fh=null;for(var d,c=0;c<a.length;++c){var e=a[c];if(e.from<b&&e.to>b)return c;if(e.from==b||e.to==b){if(null!=d)return Eh(a,e.level,a[d].level)?(e.from!=e.to&&(Fh=d),c):(e.from!=e.to&&(Fh=c),d);d=c}}return d}function Hh(a,b,c,d){if(!d)return b+c;do b+=c;while(b>0&&Wg(a.text.charAt(b)));return b}function Ih(a,b,c,d){var e=Wf(a);if(!e)return Jh(a,b,c,d);for(var f=Gh(e,b),g=e[f],h=Hh(a,b,g.level%2?-c:c,d);;){if(h>g.from&&h<g.to)return h;if(h==g.from||h==g.to)return Gh(e,h)==f?h:(g=e[f+=c],c>0==g.level%2?g.to:g.from);if(g=e[f+=c],!g)return null;h=c>0==g.level%2?Hh(a,g.to,-1,d):Hh(a,g.from,1,d)}}function Jh(a,b,c,d){var e=b+c;if(d)for(;e>0&&Wg(a.text.charAt(e));)e+=c;return 0>e||e>a.text.length?null:e}var a=/gecko\/\d/i.test(navigator.userAgent),b=/MSIE \d/.test(navigator.userAgent),c=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),d=b||c,e=d&&(b?document.documentMode||6:c[1]),f=/WebKit\//.test(navigator.userAgent),g=f&&/Qt\/\d+\.\d+/.test(navigator.userAgent),h=/Chrome\//.test(navigator.userAgent),i=/Opera\//.test(navigator.userAgent),j=/Apple Computer/.test(navigator.vendor),k=/KHTML\//.test(navigator.userAgent),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),m=/PhantomJS/.test(navigator.userAgent),n=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),o=n||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),p=n||/Mac/.test(navigator.platform),q=/win/i.test(navigator.platform),r=i&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);r&&(r=Number(r[1])),r&&r>=15&&(i=!1,f=!0);var s=p&&(g||i&&(null==r||12.11>r)),t=a||d&&e>=9,u=!1,v=!1,nb=w.Pos=function(a,b){return this instanceof nb?(this.line=a,this.ch=b,void 0):new nb(a,b)},ob=w.cmpPos=function(a,b){return a.line-b.line||a.ch-b.ch};sb.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(0!=ob(c.anchor,d.anchor)||0!=ob(c.head,d.head))return!1}return!0},deepCopy:function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new tb(pb(this.ranges[b].anchor),pb(this.ranges[b].head));return new sb(a,this.primIndex)},somethingSelected:function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1},contains:function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(ob(b,d.from())>=0&&ob(a,d.to())<=0)return c}return-1}},tb.prototype={from:function(){return rb(this.anchor,this.head)},to:function(){return qb(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var wc,id,jd,gc={left:0,right:0,top:0,bottom:0},zc=null,Ac=0,Zc=null,pd=0,ud=0,vd=null;d?vd=-.53:a?vd=15:h?vd=-.7:j&&(vd=-1/3);var zd,Cd=null,Ld=w.changeEnd=function(a){return a.text?nb(a.from.line+a.text.length-1,Kg(a.text).length+(1==a.text.length?a.from.ch:0)):a.to};w.prototype={constructor:w,focus:function(){window.focus(),ad(this),Yc(this)},setOption:function(a,b){var c=this.options,d=c[a];(c[a]!=b||"mode"==a)&&(c[a]=b,ke.hasOwnProperty(a)&&Lc(this,ke[a])(this,b,d))},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](a)},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||"string"!=typeof b[c]&&b[c].name==a)return b.splice(c,1),!0},addOverlay:Mc(function(a,b){var c=a.token?a:w.getMode(this.options,a);if(c.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque}),this.state.modeGen++,Qc(this)}),removeOverlay:Mc(function(a){for(var b=this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a)return b.splice(c,1),this.state.modeGen++,Qc(this),void 0}}),indentLine:Mc(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract"),zb(this.doc,a)&&de(this,a,b,c)}),indentSelection:Mc(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(de(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&be(this));else{var f=e.from(),g=e.to(),h=Math.max(c,f.line);c=Math.min(this.lastLine(),g.line-(g.ch?0:1))+1;for(var i=h;c>i;++i)de(this,i,a);var j=this.doc.sel.ranges;0==f.ch&&b.length==j.length&&j[d].from().ch>0&&Eb(this.doc,d,new tb(f,j[d].to()))}}}),getTokenAt:function(a,b){var c=this.doc;a=xb(c,a);for(var d=Xb(this,a.line,b),e=this.doc.mode,f=Pf(c,a.line),g=new Ae(f.text,this.options.tabSize);g.pos<a.ch&&!g.eol();){g.start=g.pos;var h=qf(e,g,d)}return{start:g.start,end:g.pos,string:g.current(),type:h||null,state:d}},getTokenTypeAt:function(a){a=xb(this.doc,a);var f,b=tf(this,Pf(this.doc,a.line)),c=0,d=(b.length-1)/2,e=a.ch;if(0==e)f=b[2];else for(;;){var g=c+d>>1;if((g?b[2*g-1]:0)>=e)d=g;else{if(!(b[2*g+1]<e)){f=b[2*g+2];break}c=g+1}}var h=f?f.indexOf("cm-overlay "):-1;return 0>h?f:0==h?null:f.slice(0,h-1)},getModeAt:function(a){var b=this.doc.mode;return b.innerMode?w.innerMode(b,this.getTokenAt(a).state).mode:b},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var c=[];if(!re.hasOwnProperty(b))return re;var d=re[b],e=this.getModeAt(a);if("string"==typeof e[b])d[e[b]]&&c.push(d[e[b]]);else if(e[b])for(var f=0;f<e[b].length;f++){var g=d[e[b][f]];g&&c.push(g)}else e.helperType&&d[e.helperType]?c.push(d[e.helperType]):d[e.name]&&c.push(d[e.name]);for(var f=0;f<d._global.length;f++){var h=d._global[f];h.pred(e,this)&&-1==Mg(c,h.val)&&c.push(h.val)}return c},getStateAfter:function(a,b){var c=this.doc;return a=wb(c,null==a?c.first+c.size-1:a),Xb(this,a+1,b)},cursorCoords:function(a,b){var c,d=this.doc.sel.primary();return c=null==a?d.head:"object"==typeof a?xb(this.doc,a):a?d.from():d.to(),rc(this,c,b||"page")},charCoords:function(a,b){return qc(this,xb(this.doc,a),b||"page")},coordsChar:function(a,b){return a=pc(this,a,b||"page"),uc(this,a.left,a.top)},lineAtHeight:function(a,b){return a=pc(this,{top:a,left:0},b||"page").top,Uf(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b){var c=!1,d=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>d&&(a=d,c=!0);var e=Pf(this.doc,a);return oc(this,e,{top:0,left:0},b||"page").top+(c?this.doc.height-Vf(e):0)},defaultTextHeight:function(){return xc(this.display)},defaultCharWidth:function(){return yc(this.display)},setGutterMarker:Mc(function(a,b,c){return ee(this.doc,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});return d[b]=c,!c&&Ug(d)&&(a.gutterMarkers=null),!0})}),clearGutter:Mc(function(a){var b=this,c=b.doc,d=c.first;c.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&(c.gutterMarkers[a]=null,Rc(b,d,"gutter"),Ug(c.gutterMarkers)&&(c.gutterMarkers=null)),++d})}),addLineWidget:Mc(function(a,b,c){return kf(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!zb(this.doc,a))return null;var b=a;if(a=Pf(this.doc,a),!a)return null}else{var b=Tf(a);if(null==b)return null}return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=rc(this,xb(this.doc,a));var g=a.bottom,h=a.left;if(b.style.position="absolute",f.sizer.appendChild(b),"over"==d)g=a.top;else if("above"==d||"near"==d){var i=Math.max(f.wrapper.clientHeight,this.doc.height),j=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>i)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=i&&(g=a.bottom),h+b.offsetWidth>j&&(h=j-b.offsetWidth)}b.style.top=g+"px",b.style.left=b.style.right="","right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px"),c&&$d(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},triggerOnKeyDown:Mc(Dd),triggerOnKeyPress:Mc(Gd),triggerOnKeyUp:Fd,execCommand:function(a){return ue.hasOwnProperty(a)?ue[a](this):void 0},findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);
12
+ for(var f=0,g=xb(this.doc,a);b>f&&(g=ge(this.doc,g,e,c,d),!g.hitSide);++f);return g},moveH:Mc(function(a,b){var c=this;c.extendSelectionsBy(function(d){return c.display.shift||c.doc.extend||d.empty()?ge(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},Eg)}),deleteH:Mc(function(a,b){var c=this.doc.sel,d=this.doc;c.somethingSelected()?d.replaceSelection("",null,"+delete"):fe(this,function(c){var e=ge(d,c.head,a,b,!1);return 0>a?{from:e,to:c.head}:{from:c.head,to:e}})}),findPosV:function(a,b,c,d){var e=1,f=d;0>b&&(e=-1,b=-b);for(var g=0,h=xb(this.doc,a);b>g;++g){var i=rc(this,h,"div");if(null==f?f=i.left:i.left=f,h=he(this,i,e,c),h.hitSide)break}return h},moveV:Mc(function(a,b){var c=this,d=this.doc,e=[],f=!c.display.shift&&!d.extend&&d.sel.somethingSelected();if(d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=rc(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn),e.push(h.left);var i=he(c,h,a,b);return"page"==b&&g==d.sel.primary()&&ae(c,null,qc(c,i,"div").top-h.top),i},Eg),e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),toggleOverwrite:function(a){(null==a||a!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?dh(this.display.cursorDiv,"CodeMirror-overwrite"):ch(this.display.cursorDiv,"CodeMirror-overwrite"),sg(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return ah()==this.display.input},scrollTo:Mc(function(a,b){(null!=a||null!=b)&&ce(this),null!=a&&(this.curOp.scrollLeft=a),null!=b&&(this.curOp.scrollTop=b)}),getScrollInfo:function(){var a=this.display.scroller,b=Ag;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:Mc(function(a,b){if(null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:nb(a,0),to:null}:null==a.from&&(a={from:a,to:null}),a.to||(a.to=a.from),a.margin=b||0,null!=a.from.line)ce(this),this.curOp.scrollToPos=a;else{var c=_d(this,Math.min(a.from.left,a.to.left),Math.min(a.from.top,a.to.top)-a.margin,Math.max(a.from.right,a.to.right),Math.max(a.from.bottom,a.to.bottom)+a.margin);this.scrollTo(c.scrollLeft,c.scrollTop)}}),setSize:Mc(function(a,b){function d(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}var c=this;null!=a&&(c.display.wrapper.style.width=d(a)),null!=b&&(c.display.wrapper.style.height=d(b)),c.options.lineWrapping&&kc(this);var e=c.display.viewFrom;c.doc.iter(e,c.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Rc(c,e,"widget");break}++e}),c.curOp.forceUpdate=!0,sg(c,"refresh",this)}),operation:function(a){return Kc(this,a)},refresh:Mc(function(){var a=this.display.cachedTextHeight;Qc(this),this.curOp.forceUpdate=!0,lc(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),H(this),(null==a||Math.abs(a-xc(this.display))>.5)&&C(this),sg(this,"refresh",this)}),swapDoc:Mc(function(a){var b=this.doc;return b.cm=null,Of(this,a),lc(this),_c(this),this.scrollTo(a.scrollLeft,a.scrollTop),ug(this,"swapDoc",this,b),b}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},zg(w);var je=w.defaults={},ke=w.optionHandlers={},me=w.Init={toString:function(){return"CodeMirror.Init"}};le("value","",function(a,b){a.setValue(b)},!0),le("mode",null,function(a,b){a.doc.modeOption=b,y(a)},!0),le("indentUnit",2,y,!0),le("indentWithTabs",!1),le("smartIndent",!0),le("tabSize",4,function(a){z(a),lc(a),Qc(a)},!0),le("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(a,b){a.options.specialChars=new RegExp(b.source+(b.test(" ")?"":"| "),"g"),a.refresh()},!0),le("specialCharPlaceholder",zf,function(a){a.refresh()},!0),le("electricChars",!0),le("rtlMoveVisually",!q),le("wholeLineUpdateBefore",!0),le("theme","default",function(a){E(a),F(a)},!0),le("keyMap","default",D),le("extraKeys",null),le("lineWrapping",!1,A,!0),le("gutters",[],function(a){K(a.options),F(a)},!0),le("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?S(a.display)+"px":"0",a.refresh()},!0),le("coverGutterNextToScrollbar",!1,N,!0),le("lineNumbers",!1,function(a){K(a.options),F(a)},!0),le("firstLineNumber",1,F,!0),le("lineNumberFormatter",function(a){return a},F,!0),le("showCursorWhenSelecting",!1,Qb,!0),le("resetSelectionOnContextMenu",!0),le("readOnly",!1,function(a,b){"nocursor"==b?(Id(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||_c(a))}),le("disableInput",!1,function(a,b){b||_c(a)},!0),le("dragDrop",!0),le("cursorBlinkRate",530),le("cursorScrollMargin",0),le("cursorHeight",1,Qb,!0),le("singleCursorHeightPerLine",!0,Qb,!0),le("workTime",100),le("workDelay",100),le("flattenSpans",!0,z,!0),le("addModeClass",!1,z,!0),le("pollInterval",100),le("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),le("historyEventDelay",1250),le("viewportMargin",10,function(a){a.refresh()},!0),le("maxHighlightLength",1e4,z,!0),le("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),le("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),le("autofocus",null);var ne=w.modes={},oe=w.mimeModes={};w.defineMode=function(a,b){if(w.defaults.mode||"null"==a||(w.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}ne[a]=b},w.defineMIME=function(a,b){oe[a]=b},w.resolveMode=function(a){if("string"==typeof a&&oe.hasOwnProperty(a))a=oe[a];else if(a&&"string"==typeof a.name&&oe.hasOwnProperty(a.name)){var b=oe[a.name];"string"==typeof b&&(b={name:b}),a=Og(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return w.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},w.getMode=function(a,b){var b=w.resolveMode(b),c=ne[b.name];if(!c)return w.getMode(a,"text/plain");var d=c(a,b);if(pe.hasOwnProperty(b.name)){var e=pe[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},w.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),w.defineMIME("text/plain","null");var pe=w.modeExtensions={};w.extendMode=function(a,b){var c=pe.hasOwnProperty(a)?pe[a]:pe[a]={};Pg(b,c)},w.defineExtension=function(a,b){w.prototype[a]=b},w.defineDocExtension=function(a,b){Kf.prototype[a]=b},w.defineOption=le;var qe=[];w.defineInitHook=function(a){qe.push(a)};var re=w.helpers={};w.registerHelper=function(a,b,c){re.hasOwnProperty(a)||(re[a]=w[a]={_global:[]}),re[a][b]=c},w.registerGlobalHelper=function(a,b,c,d){w.registerHelper(a,b,d),re[a]._global.push({pred:c,val:d})};var se=w.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},te=w.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};w.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var ue=w.commands={selectAll:function(a){a.setSelection(nb(a.firstLine(),0),nb(a.lastLine()),Cg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Cg)},killLine:function(a){fe(a,function(b){if(b.empty()){var c=Pf(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:nb(b.head.line+1,0)}:{from:b.head,to:nb(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){fe(a,function(b){return{from:nb(b.from().line,0),to:xb(a.doc,nb(b.to().line+1,0))}})},delLineLeft:function(a){fe(a,function(a){return{from:nb(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){fe(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return{from:d,to:b.from()}})},delWrappedLineRight:function(a){fe(a,function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:d}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(nb(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(nb(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return Bh(a,b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){return Dh(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){a.extendSelectionsBy(function(b){return Ch(a,b.head.line)},{origin:"+move",bias:-1})},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},Eg)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},Eg)},goLineLeftSmart:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5,d=a.coordsChar({left:0,top:c},"div");return d.ch<a.getLine(d.line).search(/\S/)?Dh(a,b.head):d},Eg)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goGroupRight:function(a){a.moveH(1,"group")},goGroupLeft:function(a){a.moveH(-1,"group")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},delGroupBefore:function(a){a.deleteH(-1,"group")},delGroupAfter:function(a){a.deleteH(1,"group")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ")},insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,e=0;e<c.length;e++){var f=c[e].from(),g=Gg(a.getLine(f.line),f.ch,d);b.push(new Array(d-g%d+1).join(" "))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){Kc(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++){var e=b[d].head,f=Pf(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new nb(e.line,e.ch-1)),e.ch>0)e=new nb(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),nb(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=Pf(a.doc,e.line-1).text;g&&a.replaceRange(f.charAt(0)+"\n"+g.charAt(g.length-1),nb(e.line-1,g.length-1),nb(e.line,1),"+transpose")}c.push(new tb(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){Kc(a,function(){for(var b=a.listSelections().length,c=0;b>c;c++){var d=a.listSelections()[c];a.replaceRange("\n",d.anchor,d.head,"+input"),a.indentLine(d.from().line+1,null,!0),be(a)}})},toggleOverwrite:function(a){a.toggleOverwrite()}},ve=w.keyMap={};ve.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},ve.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},ve.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},ve.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},ve["default"]=p?ve.macDefault:ve.pcDefault;var xe=w.lookupKey=function(a,b,c){function d(b){b=we(b);var e=b[a];if(e===!1)return"stop";if(null!=e&&c(e))return!0;if(b.nofallthrough)return"stop";var f=b.fallthrough;if(null==f)return!1;if("[object Array]"!=Object.prototype.toString.call(f))return d(f);for(var g=0;g<f.length;++g){var h=d(f[g]);if(h)return h}return!1}for(var e=0;e<b.length;++e){var f=d(b[e]);if(f)return"stop"!=f}},ye=w.isModifierKey=function(a){var b=vh[a.keyCode];return"Ctrl"==b||"Alt"==b||"Shift"==b||"Mod"==b},ze=w.keyName=function(a,b){if(i&&34==a.keyCode&&a["char"])return!1;var c=vh[a.keyCode];return null==c||a.altGraphKey?!1:(a.altKey&&(c="Alt-"+c),(s?a.metaKey:a.ctrlKey)&&(c="Ctrl-"+c),(s?a.ctrlKey:a.metaKey)&&(c="Cmd-"+c),!b&&a.shiftKey&&(c="Shift-"+c),c)};w.fromTextArea=function(a,b){function d(){a.value=i.getValue()}if(b||(b={}),b.value=a.value,!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex),!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder),null==b.autofocus){var c=ah();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(qg(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form,f=e.submit;try{var g=e.submit=function(){d(),e.submit=f,e.submit(),e.submit=g}}catch(h){}}a.style.display="none";var i=w(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);return i.save=d,i.getTextArea=function(){return a},i.toTextArea=function(){d(),a.parentNode.removeChild(i.getWrapperElement()),a.style.display="",a.form&&(rg(a.form,"submit",d),"function"==typeof a.form.submit&&(a.form.submit=f))},i};var Ae=w.StringStream=function(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};Ae.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a)var c=b==a;else var c=b&&(a.test?a.test(b):a(b));return c?(++this.pos,b):void 0},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);return b>-1?(this.pos=b,!0):void 0},backUp:function(a){this.pos-=a},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Gg(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Gg(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return Gg(this.string,null,this.tabSize)-(this.lineStart?Gg(this.string,this.lineStart,this.tabSize):0)},match:function(a,b,c){if("string"!=typeof a){var f=this.string.slice(this.pos).match(a);return f&&f.index>0?null:(f&&b!==!1&&(this.pos+=f[0].length),f)}var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,a.length);return d(e)==d(a)?(b!==!1&&(this.pos+=a.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}}};var Be=w.TextMarker=function(a,b){this.lines=[],this.type=b,this.doc=a};zg(Be),Be.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;if(b&&Bc(a),yg(this,"clear")){var c=this.find();c&&ug(this,"clear",c.from,c.to)}for(var d=null,e=null,f=0;f<this.lines.length;++f){var g=this.lines[f],h=Ke(g.markedSpans,this);a&&!this.collapsed?Rc(a,Tf(g),"text"):a&&(null!=h.to&&(e=Tf(g)),null!=h.from&&(d=Tf(g))),g.markedSpans=Le(g.markedSpans,h),null==h.from&&this.collapsed&&!ef(this.doc,g)&&a&&Sf(g,xc(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(var f=0;f<this.lines.length;++f){var i=af(this.lines[f]),j=I(i);j>a.display.maxLineLength&&(a.display.maxLine=i,a.display.maxLineLength=j,a.display.maxLineChanged=!0)}null!=d&&a&&this.collapsed&&Qc(a,d,e+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Lb(a.doc)),a&&ug(a,"markerCleared",a,this),b&&Dc(a),this.parent&&this.parent.clear()}},Be.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Ke(f.markedSpans,this);if(null!=g.from&&(c=nb(b?f:Tf(f),g.from),-1==a))return c;if(null!=g.to&&(d=nb(b?f:Tf(f),g.to),1==a))return d}return c&&{from:c,to:d}},Be.prototype.changed=function(){var a=this.find(-1,!0),b=this,c=this.doc.cm;a&&c&&Kc(c,function(){var d=a.line,e=Tf(a.line),f=dc(c,e);if(f&&(jc(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0),c.curOp.updateMaxLine=!0,!ef(b.doc,d)&&null!=b.height){var g=b.height;b.height=null;var h=jf(b)-g;h&&Sf(d,d.height+h)}})},Be.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=Mg(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)},Be.prototype.detachLine=function(a){if(this.lines.splice(Mg(this.lines,a),1),!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;(b.maybeHiddenMarkers||(b.maybeHiddenMarkers=[])).push(this)}};var Ce=0,Ee=w.SharedTextMarker=function(a,b){this.markers=a,this.primary=b;for(var c=0;c<a.length;++c)a[c].parent=this};zg(Ee),Ee.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();ug(this,"clear")}},Ee.prototype.find=function(a,b){return this.primary.find(a,b)};var gf=w.LineWidget=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a,this.node=b};zg(gf),gf.prototype.clear=function(){var a=this.cm,b=this.line.widgets,c=this.line,d=Tf(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=jf(this);Kc(a,function(){hf(a,c,-f),Rc(a,d,"widget"),Sf(c,Math.max(0,c.height-f))})}},gf.prototype.changed=function(){var a=this.height,b=this.cm,c=this.line;this.height=null;var d=jf(this)-a;d&&Kc(b,function(){b.curOp.forceUpdate=!0,hf(b,c,d),Sf(c,c.height+d)})};var lf=w.Line=function(a,b,c){this.text=a,Ue(this,b),this.height=c?c(this):1};zg(lf),lf.prototype.lineNo=function(){return Tf(this)};var vf={},wf={};Hf.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;d>c;++c){var e=this.lines[c];this.height-=e.height,nf(e),ug(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c,this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(var d=0;d<b.length;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;d>a;++a)if(c(this.lines[a]))return!0}},If.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(e>a){var f=Math.min(b,e-a),g=d.height;if(d.removeInner(a,f),this.height-=g-d.height,e==f&&(this.children.splice(c--,1),d.parent=null),0==(b-=f))break;a=0}else a-=e}if(this.size-b<25&&(this.children.length>1||!(this.children[0]instanceof Hf))){var h=[];this.collapse(h),this.children=[new Hf(h)],this.children[0].parent=this}},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>=a){if(e.insertInner(a,b,c),e.lines&&e.lines.length>50){for(;e.lines.length>50;){var g=e.lines.splice(e.lines.length-25,25),h=new Hf(g);e.height-=h.height,this.children.splice(d+1,0,h),h.parent=this}this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(this.children.length<=10)){var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new If(b);if(a.parent){a.size-=c.size,a.height-=c.height;var e=Mg(a.parent.children,a);a.parent.children.splice(e+1,0,c)}else{var d=new If(a.children);d.parent=a,a.children=[d,c],a=d}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()}},iterN:function(a,b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(f>a){var g=Math.min(b,f-a);if(e.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=f}}};var Jf=0,Kf=w.Doc=function(a,b,c){if(!(this instanceof Kf))return new Kf(a,b,c);null==c&&(c=0),If.call(this,[new Hf([new lf("",null)])]),this.first=c,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=c;var d=nb(c,0);this.sel=vb(d),this.history=new Xf(null),this.id=++Jf,this.modeOption=b,"string"==typeof a&&(a=qh(a)),Gf(this,{from:d,to:d,text:a}),Ib(this,vb(d),Cg)};Kf.prototype=Og(If.prototype,{constructor:Kf,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=Rf(this,this.first,this.first+this.size);return a===!1?b:b.join(a||"\n")},setValue:Nc(function(a){var b=nb(this.first,0),c=this.first+this.size-1;Rd(this,{from:b,to:nb(c,Pf(this,c).text.length),text:qh(a),origin:"setValue"},!0),Ib(this,vb(b))}),replaceRange:function(a,b,c,d){b=xb(this,b),c=c?xb(this,c):b,Xd(this,a,b,c,d)},getRange:function(a,b,c){var d=Qf(this,xb(this,a),xb(this,b));return c===!1?d:d.join(c||"\n")},getLine:function(a){var b=this.getLineHandle(a);return b&&b.text},getLineHandle:function(a){return zb(this,a)?Pf(this,a):void 0},getLineNumber:function(a){return Tf(a)},getLineHandleVisualStart:function(a){return"number"==typeof a&&(a=Pf(this,a)),af(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return xb(this,a)},getCursor:function(a){var c,b=this.sel.primary();return c=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||a===!1?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nc(function(a,b,c){Fb(this,xb(this,"number"==typeof a?nb(a,b||0):a),null,c)}),setSelection:Nc(function(a,b,c){Fb(this,xb(this,a),xb(this,b||a),c)}),extendSelection:Nc(function(a,b,c){Cb(this,xb(this,a),b&&xb(this,b),c)}),extendSelections:Nc(function(a,b){Db(this,Ab(this,a,b))}),extendSelectionsBy:Nc(function(a,b){Db(this,Ng(this.sel.ranges,a),b)}),setSelections:Nc(function(a,b,c){if(a.length){for(var d=0,e=[];d<a.length;d++)e[d]=new tb(xb(this,a[d].anchor),xb(this,a[d].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex)),Ib(this,ub(e,b),c)}}),addSelection:Nc(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new tb(xb(this,a),xb(this,b||a))),Ib(this,ub(d,d.length-1),c)}),getSelection:function(a){for(var c,b=this.sel.ranges,d=0;d<b.length;d++){var e=Qf(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return a===!1?c:c.join(a||"\n")},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=Qf(this,c[d].from(),c[d].to());a!==!1&&(e=e.join(a||"\n")),b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:Nc(function(a,b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:qh(a[f]),origin:c}}for(var h=b&&"end"!=b&&Pd(this,d,b),f=d.length-1;f>=0;f--)Rd(this,d[f]);h?Hb(this,h):this.cm&&be(this.cm)}),undo:Nc(function(){Td(this,"undo")}),redo:Nc(function(){Td(this,"redo")}),undoSelection:Nc(function(){Td(this,"undo",!0)}),redoSelection:Nc(function(){Td(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(var d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Xf(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){return a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:gg(this.history.done),undone:gg(this.history.undone)}},setHistory:function(a){var b=this.history=new Xf(this.history.maxGeneration);b.done=gg(a.done.slice(0),null,!0),b.undone=gg(a.undone.slice(0),null,!0)},addLineClass:Nc(function(a,b,c){return ee(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[d]){if(new RegExp("(?:^|\\s)"+c+"(?:$|\\s)").test(a[d]))return!1;a[d]+=" "+c}else a[d]=c;return!0})}),removeLineClass:Nc(function(a,b,c){return ee(this,a,"class",function(a){var d="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",e=a[d];if(!e)return!1;if(null==c)a[d]=null;else{var f=e.match(new RegExp("(?:^|\\s+)"+c+"(?:$|\\s+)"));if(!f)return!1;var g=f.index+f[0].length;a[d]=e.slice(0,f.index)+(f.index&&g!=e.length?" ":"")+e.slice(g)||null}return!0})}),markText:function(a,b,c){return De(this,xb(this,a),xb(this,b),c,"range")},setBookmark:function(a,b){var c={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared};return a=xb(this,a),De(this,a,a,c,"bookmark")},findMarksAt:function(a){a=xb(this,a);var b=[],c=Pf(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=xb(this,a),b=xb(this,b);var d=[],e=a.line;return this.iter(a.line,b.line+1,function(f){var g=f.markedSpans;if(g)for(var h=0;h<g.length;h++){var i=g[h];e==a.line&&a.ch>i.to||null==i.from&&e!=a.line||e==b.line&&i.from>b.ch||c&&!c(i.marker)||d.push(i.marker.parent||i.marker)}++e}),d},getAllMarks:function(){var a=[];return this.iter(function(b){var c=b.markedSpans;if(c)for(var d=0;d<c.length;++d)null!=c[d].from&&a.push(c[d].marker)}),a},posFromIndex:function(a){var b,c=this.first;return this.iter(function(d){var e=d.text.length+1;return e>a?(b=a,!0):(a-=e,++c,void 0)}),xb(this,nb(c,b))},indexFromPos:function(a){a=xb(this,a);var b=a.ch;return a.line<this.first||a.ch<0?0:(this.iter(this.first,a.line,function(a){b+=a.text.length+1}),b)},copy:function(a){var b=new Kf(Rf(this,this.first,this.first+this.size),this.modeOption,this.first);return b.scrollTop=this.scrollTop,b.scrollLeft=this.scrollLeft,b.sel=this.sel,b.extend=!1,a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory())),b},linkedDoc:function(a){a||(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from),null!=a.to&&a.to<c&&(c=a.to);var d=new Kf(Rf(this,b,c),a.mode||this.modeOption,b);return a.sharedHist&&(d.history=this.history),(this.linked||(this.linked=[])).push({doc:d,sharedHist:a.sharedHist}),d.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}],He(d,Ge(this)),d},unlinkDoc:function(a){if(a instanceof w&&(a=a.doc),this.linked)for(var b=0;b<this.linked.length;++b){var c=this.linked[b];if(c.doc==a){this.linked.splice(b,1),a.unlinkDoc(this),Ie(Ge(this));break}}if(a.history==this.history){var d=[a.id];Nf(a,function(a){d.push(a.id)},!0),a.history=new Xf(null),a.history.done=gg(this.history.done,d),a.history.undone=gg(this.history.undone,d)}},iterLinkedDocs:function(a){Nf(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Kf.prototype.eachLine=Kf.prototype.iter;var Lf="iter insert remove copy getEditor".split(" ");for(var Mf in Kf.prototype)Kf.prototype.hasOwnProperty(Mf)&&Mg(Lf,Mf)<0&&(w.prototype[Mf]=function(a){return function(){return a.apply(this.doc,arguments)}}(Kf.prototype[Mf]));zg(Kf);var kg=w.e_preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},lg=w.e_stopPropagation=function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},ng=w.e_stop=function(a){kg(a),lg(a)},qg=w.on=function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var d=a._handlers||(a._handlers={}),e=d[b]||(d[b]=[]);e.push(c)}},rg=w.off=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var d=a._handlers&&a._handlers[b];if(!d)return;for(var e=0;e<d.length;++e)if(d[e]==c){d.splice(e,1);break}}},sg=w.signal=function(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)},tg=null,Ag=30,Bg=w.Pass={toString:function(){return"CodeMirror.Pass"}},Cg={scroll:!1},Dg={origin:"*mouse"},Eg={origin:"+move"};Fg.prototype.set=function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)};var Gg=w.countColumn=function(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var f=d||0,g=e||0;;){var h=a.indexOf(" ",f);if(0>h||h>=b)return g+(b-f);g+=h-f,g+=c-g%c,f=h+1}},Ig=[""],Lg=function(a){a.select()};n?Lg=function(a){a.selectionStart=0,a.selectionEnd=a.value.length}:d&&(Lg=function(a){try{a.select()}catch(b){}}),[].indexOf&&(Mg=function(a,b){return a.indexOf(b)}),[].map&&(Ng=function(a,b){return a.map(b)});var Yg,Rg=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Sg=w.isWordChar=function(a){return/\w/.test(a)||a>"\x80"&&(a.toUpperCase()!=a.toLowerCase()||Rg.test(a))},Vg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
13
+ Yg=document.createRange?function(a,b,c){var d=document.createRange();return d.setEnd(a,c),d.setStart(a,b),d}:function(a,b,c){var d=document.body.createTextRange();return d.moveToElementText(a.parentNode),d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d},d&&11>e&&(ah=function(){try{return document.activeElement}catch(a){return document.body}});var kh,mh,oh,gh=!1,jh=function(){if(d&&9>e)return!1;var a=Xg("div");return"draggable"in a||"dragDrop"in a}(),qh=w.splitLines=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;d>=b;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},rh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},sh=function(){var a=Xg("div");return"oncopy"in a?!0:(a.setAttribute("oncopy","return;"),"function"==typeof a.oncopy)}(),th=null,vh={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};w.keyNames=vh,function(){for(var a=0;10>a;a++)vh[a+48]=vh[a+96]=String(a);for(var a=65;90>=a;a++)vh[a]=String.fromCharCode(a);for(var a=1;12>=a;a++)vh[a+111]=vh[a+63235]="F"+a}();var Fh,Kh=function(){function c(c){return 247>=c?a.charAt(c):c>=1424&&1524>=c?"R":c>=1536&&1773>=c?b.charAt(c-1536):c>=1774&&2220>=c?"r":c>=8192&&8203>=c?"w":8204==c?"b":"L"}function j(a,b,c){this.level=a,this.from=b,this.to=c}var a="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",b="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/,i="L";return function(a){if(!d.test(a))return!1;for(var m,b=a.length,k=[],l=0;b>l;++l)k.push(m=c(a.charCodeAt(l)));for(var l=0,n=i;b>l;++l){var m=k[l];"m"==m?k[l]=n:n=m}for(var l=0,o=i;b>l;++l){var m=k[l];"1"==m&&"r"==o?k[l]="n":f.test(m)&&(o=m,"r"==m&&(k[l]="R"))}for(var l=1,n=k[0];b-1>l;++l){var m=k[l];"+"==m&&"1"==n&&"1"==k[l+1]?k[l]="1":","!=m||n!=k[l+1]||"1"!=n&&"n"!=n||(k[l]=n),n=m}for(var l=0;b>l;++l){var m=k[l];if(","==m)k[l]="N";else if("%"==m){for(var p=l+1;b>p&&"%"==k[p];++p);for(var q=l&&"!"==k[l-1]||b>p&&"1"==k[p]?"1":"N",r=l;p>r;++r)k[r]=q;l=p-1}}for(var l=0,o=i;b>l;++l){var m=k[l];"L"==o&&"1"==m?k[l]="L":f.test(m)&&(o=m)}for(var l=0;b>l;++l)if(e.test(k[l])){for(var p=l+1;b>p&&e.test(k[p]);++p);for(var s="L"==(l?k[l-1]:i),t="L"==(b>p?k[p]:i),q=s||t?"L":"R",r=l;p>r;++r)k[r]=q;l=p-1}for(var v,u=[],l=0;b>l;)if(g.test(k[l])){var w=l;for(++l;b>l&&g.test(k[l]);++l);u.push(new j(0,w,l))}else{var x=l,y=u.length;for(++l;b>l&&"L"!=k[l];++l);for(var r=x;l>r;)if(h.test(k[r])){r>x&&u.splice(y,0,new j(1,x,r));var z=r;for(++r;l>r&&h.test(k[r]);++r);u.splice(y,0,new j(2,z,r)),x=r}else++r;l>x&&u.splice(y,0,new j(1,x,l))}return 1==u[0].level&&(v=a.match(/^\s+/))&&(u[0].from=v[0].length,u.unshift(new j(0,0,v[0].length))),1==Kg(u).level&&(v=a.match(/\s+$/))&&(Kg(u).to-=v[0].length,u.push(new j(0,b-v[0].length,b))),u[0].level!=Kg(u).level&&u.push(new j(u[0].level,b,b)),u}}();return w.version="4.4.1",w});
js/colorbox/colorbox.css ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+ #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
16
+
17
+ /*
18
+ User Style:
19
+ Change the following styles to modify the appearance of ColorBox. They are
20
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
21
+ */
22
+ #cboxOverlay{background:#222;}
23
+ #colorbox{outline:0;}
24
+
25
+ #cboxContent{background:#fff; padding: 10px;}
26
+ .cboxIframe{background:#fff;}
27
+ #cboxError{padding:50px; border:1px solid #ccc;}
28
+ #cboxLoadedContent{margin-bottom:28px;}
29
+ #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
30
+ #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
31
+ #cboxLoadingOverlay{background:url(images/loading_background.png) no-repeat center center;}
32
+ #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
33
+
34
+ /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
35
+ #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
36
+
37
+ /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
38
+ #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
39
+
40
+ #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
41
+ #cboxPrevious{position:absolute; bottom:0; left:0; background:url(images/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
42
+ #cboxPrevious:hover{background-position:-75px -25px;}
43
+ #cboxNext{position:absolute; bottom:0; left:27px; background:url(images/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
44
+ #cboxNext:hover{background-position:-50px -25px;}
45
+ #cboxClose{position:absolute; top:12px; right:6px; background:url(images/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
46
+ #cboxClose:hover{background-position:-25px -25px;}
47
+
48
+ /*
49
+ The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
50
+ when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
51
+ See: http://jacklmoore.com/notes/ie-transparency-problems/
52
+ */
53
+ .cboxIE #cboxTopLeft,
54
+ .cboxIE #cboxTopCenter,
55
+ .cboxIE #cboxTopRight,
56
+ .cboxIE #cboxBottomLeft,
57
+ .cboxIE #cboxBottomCenter,
58
+ .cboxIE #cboxBottomRight,
59
+ .cboxIE #cboxMiddleLeft,
60
+ .cboxIE #cboxMiddleRight {
61
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
62
+ }
63
+
64
+ /*
65
+ The following provides PNG transparency support for IE6
66
+ Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
67
+ */
68
+ .cboxIE6 #cboxTopLeft{background:url(images/ie6/borderTopLeft.png);}
69
+ .cboxIE6 #cboxTopCenter{background:url(images/ie6/borderTopCenter.png);}
70
+ .cboxIE6 #cboxTopRight{background:url(images/ie6/borderTopRight.png);}
71
+ .cboxIE6 #cboxBottomLeft{background:url(images/ie6/borderBottomLeft.png);}
72
+ .cboxIE6 #cboxBottomCenter{background:url(images/ie6/borderBottomCenter.png);}
73
+ .cboxIE6 #cboxBottomRight{background:url(images/ie6/borderBottomRight.png);}
74
+ .cboxIE6 #cboxMiddleLeft{background:url(images/ie6/borderMiddleLeft.png);}
75
+ .cboxIE6 #cboxMiddleRight{background:url(images/ie6/borderMiddleRight.png);}
76
+
77
+ .cboxIE6 #cboxTopLeft,
78
+ .cboxIE6 #cboxTopCenter,
79
+ .cboxIE6 #cboxTopRight,
80
+ .cboxIE6 #cboxBottomLeft,
81
+ .cboxIE6 #cboxBottomCenter,
82
+ .cboxIE6 #cboxBottomRight,
83
+ .cboxIE6 #cboxMiddleLeft,
84
+ .cboxIE6 #cboxMiddleRight {
85
+ _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
86
+ }
js/colorbox/images/border.png ADDED
Binary file
js/colorbox/images/controls.png ADDED
Binary file
js/colorbox/images/ie6/borderBottomCenter.png ADDED
Binary file
js/colorbox/images/ie6/borderBottomLeft.png ADDED
Binary file
js/colorbox/images/ie6/borderBottomRight.png ADDED
Binary file
js/colorbox/images/ie6/borderMiddleLeft.png ADDED
Binary file
js/colorbox/images/ie6/borderMiddleRight.png ADDED
Binary file
js/colorbox/images/ie6/borderTopCenter.png ADDED
Binary file
js/colorbox/images/ie6/borderTopLeft.png ADDED
Binary file
js/colorbox/images/ie6/borderTopRight.png ADDED
Binary file
js/colorbox/images/loading.gif ADDED
Binary file
js/colorbox/images/loading_background.png ADDED
Binary file
js/colorbox/images/overlay.png ADDED
Binary file
js/colorbox/jquery.colorbox-min.js ADDED
@@ -0,0 +1,1061 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Colorbox v1.4.25 - 2013-06-28
3
+ jQuery lightbox and modal window plugin
4
+ (c) 2013 Jack Moore - http://www.jacklmoore.com/colorbox
5
+ license: http://www.opensource.org/licenses/mit-license.php
6
+ */
7
+ (function ($, document, window) {
8
+ var
9
+ // Default settings object.
10
+ // See http://jacklmoore.com/colorbox for details.
11
+ defaults = {
12
+ transition: "elastic",
13
+ speed: 300,
14
+ fadeOut: 300,
15
+ width: false,
16
+ initialWidth: "600",
17
+ innerWidth: false,
18
+ maxWidth: false,
19
+ height: false,
20
+ initialHeight: "450",
21
+ innerHeight: false,
22
+ maxHeight: false,
23
+ scalePhotos: true,
24
+ scrolling: true,
25
+ inline: false,
26
+ html: false,
27
+ iframe: false,
28
+ fastIframe: true,
29
+ photo: false,
30
+ href: false,
31
+ title: false,
32
+ rel: false,
33
+ opacity: 0.9,
34
+ preloading: true,
35
+ className: false,
36
+
37
+ // alternate image paths for high-res displays
38
+ retinaImage: false,
39
+ retinaUrl: false,
40
+ retinaSuffix: '@2x.$1',
41
+
42
+ // internationalization
43
+ current: "image {current} of {total}",
44
+ previous: "previous",
45
+ next: "next",
46
+ close: "close",
47
+ xhrError: "This content failed to load.",
48
+ imgError: "This image failed to load.",
49
+
50
+ open: false,
51
+ returnFocus: true,
52
+ trapFocus: false,
53
+ reposition: true,
54
+ loop: true,
55
+ slideshow: false,
56
+ slideshowAuto: true,
57
+ slideshowSpeed: 2500,
58
+ slideshowStart: "start slideshow",
59
+ slideshowStop: "stop slideshow",
60
+ photoRegex: /\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,
61
+
62
+ onOpen: false,
63
+ onLoad: false,
64
+ onComplete: false,
65
+ onCleanup: false,
66
+ onClosed: false,
67
+
68
+ overlayClose: true,
69
+ escKey: true,
70
+ arrowKey: true,
71
+ top: false,
72
+ bottom: false,
73
+ left: false,
74
+ right: false,
75
+ fixed: false,
76
+ data: undefined,
77
+ closeButton: true
78
+ },
79
+
80
+ // Abstracting the HTML and event identifiers for easy rebranding
81
+ colorbox = 'colorbox',
82
+ prefix = 'cbox',
83
+ boxElement = prefix + 'Element',
84
+
85
+ // Events
86
+ event_open = prefix + '_open',
87
+ event_load = prefix + '_load',
88
+ event_complete = prefix + '_complete',
89
+ event_cleanup = prefix + '_cleanup',
90
+ event_closed = prefix + '_closed',
91
+ event_purge = prefix + '_purge',
92
+
93
+ // Cached jQuery Object Variables
94
+ $overlay,
95
+ $box,
96
+ $wrap,
97
+ $content,
98
+ $topBorder,
99
+ $leftBorder,
100
+ $rightBorder,
101
+ $bottomBorder,
102
+ $related,
103
+ $window,
104
+ $loaded,
105
+ $loadingBay,
106
+ $loadingOverlay,
107
+ $title,
108
+ $current,
109
+ $slideshow,
110
+ $next,
111
+ $prev,
112
+ $close,
113
+ $groupControls,
114
+ $events = $('<a/>'),
115
+
116
+ // Variables for cached values or use across multiple functions
117
+ settings,
118
+ interfaceHeight,
119
+ interfaceWidth,
120
+ loadedHeight,
121
+ loadedWidth,
122
+ element,
123
+ index,
124
+ photo,
125
+ open,
126
+ active,
127
+ closing,
128
+ loadingTimer,
129
+ publicMethod,
130
+ div = "div",
131
+ className,
132
+ requests = 0,
133
+ previousCSS = {},
134
+ init;
135
+
136
+ // ****************
137
+ // HELPER FUNCTIONS
138
+ // ****************
139
+
140
+ // Convenience function for creating new jQuery objects
141
+ function $tag(tag, id, css) {
142
+ var element = document.createElement(tag);
143
+
144
+ if (id) {
145
+ element.id = prefix + id;
146
+ }
147
+
148
+ if (css) {
149
+ element.style.cssText = css;
150
+ }
151
+
152
+ return $(element);
153
+ }
154
+
155
+ // Get the window height using innerHeight when available to avoid an issue with iOS
156
+ // http://bugs.jquery.com/ticket/6724
157
+ function winheight() {
158
+ return window.innerHeight ? window.innerHeight : $(window).height();
159
+ }
160
+
161
+ // Determine the next and previous members in a group.
162
+ function getIndex(increment) {
163
+ var
164
+ max = $related.length,
165
+ newIndex = (index + increment) % max;
166
+
167
+ return (newIndex < 0) ? max + newIndex : newIndex;
168
+ }
169
+
170
+ // Convert '%' and 'px' values to integers
171
+ function setSize(size, dimension) {
172
+ return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10));
173
+ }
174
+
175
+ // Checks an href to see if it is a photo.
176
+ // There is a force photo option (photo: true) for hrefs that cannot be matched by the regex.
177
+ function isImage(settings, url) {
178
+ return settings.photo || settings.photoRegex.test(url);
179
+ }
180
+
181
+ function retinaUrl(settings, url) {
182
+ return settings.retinaUrl && window.devicePixelRatio > 1 ? url.replace(settings.photoRegex, settings.retinaSuffix) : url;
183
+ }
184
+
185
+ function trapFocus(e) {
186
+ if ('contains' in $box[0] && !$box[0].contains(e.target)) {
187
+ e.stopPropagation();
188
+ $box.focus();
189
+ }
190
+ }
191
+
192
+ // Assigns function results to their respective properties
193
+ function makeSettings() {
194
+ var i,
195
+ data = $.data(element, colorbox);
196
+
197
+ if (data == null) {
198
+ settings = $.extend({}, defaults);
199
+ if (console && console.log) {
200
+ console.log('Error: cboxElement missing settings object');
201
+ }
202
+ } else {
203
+ settings = $.extend({}, data);
204
+ }
205
+
206
+ for (i in settings) {
207
+ if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
208
+ settings[i] = settings[i].call(element);
209
+ }
210
+ }
211
+
212
+ settings.rel = settings.rel || element.rel || $(element).data('rel') || 'nofollow';
213
+ settings.href = settings.href || $(element).attr('href');
214
+ settings.title = settings.title || element.title;
215
+
216
+ if (typeof settings.href === "string") {
217
+ settings.href = $.trim(settings.href);
218
+ }
219
+ }
220
+
221
+ function trigger(event, callback) {
222
+ // for external use
223
+ $(document).trigger(event);
224
+
225
+ // for internal use
226
+ $events.trigger(event);
227
+
228
+ if ($.isFunction(callback)) {
229
+ callback.call(element);
230
+ }
231
+ }
232
+
233
+ // Slideshow functionality
234
+ function slideshow() {
235
+ var
236
+ timeOut,
237
+ className = prefix + "Slideshow_",
238
+ click = "click." + prefix,
239
+ clear,
240
+ set,
241
+ start,
242
+ stop;
243
+
244
+ if (settings.slideshow && $related[1]) {
245
+ clear = function () {
246
+ clearTimeout(timeOut);
247
+ };
248
+
249
+ set = function () {
250
+ if (settings.loop || $related[index + 1]) {
251
+ timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
252
+ }
253
+ };
254
+
255
+ start = function () {
256
+ $slideshow
257
+ .html(settings.slideshowStop)
258
+ .unbind(click)
259
+ .one(click, stop);
260
+
261
+ $events
262
+ .bind(event_complete, set)
263
+ .bind(event_load, clear)
264
+ .bind(event_cleanup, stop);
265
+
266
+ $box.removeClass(className + "off").addClass(className + "on");
267
+ };
268
+
269
+ stop = function () {
270
+ clear();
271
+
272
+ $events
273
+ .unbind(event_complete, set)
274
+ .unbind(event_load, clear)
275
+ .unbind(event_cleanup, stop);
276
+
277
+ $slideshow
278
+ .html(settings.slideshowStart)
279
+ .unbind(click)
280
+ .one(click, function () {
281
+ publicMethod.next();
282
+ start();
283
+ });
284
+
285
+ $box.removeClass(className + "on").addClass(className + "off");
286
+ };
287
+
288
+ if (settings.slideshowAuto) {
289
+ start();
290
+ } else {
291
+ stop();
292
+ }
293
+ } else {
294
+ $box.removeClass(className + "off " + className + "on");
295
+ }
296
+ }
297
+
298
+ function launch(target) {
299
+ if (!closing) {
300
+
301
+ element = target;
302
+
303
+ makeSettings();
304
+
305
+ $related = $(element);
306
+
307
+ index = 0;
308
+
309
+ if (settings.rel !== 'nofollow') {
310
+ $related = $('.' + boxElement).filter(function () {
311
+ var data = $.data(this, colorbox),
312
+ relRelated;
313
+
314
+ if (data) {
315
+ relRelated = $(this).data('rel') || data.rel || this.rel;
316
+ }
317
+
318
+ return (relRelated === settings.rel);
319
+ });
320
+ index = $related.index(element);
321
+
322
+ // Check direct calls to Colorbox.
323
+ if (index === -1) {
324
+ $related = $related.add(element);
325
+ index = $related.length - 1;
326
+ }
327
+ }
328
+
329
+ $overlay.css({
330
+ opacity: parseFloat(settings.opacity),
331
+ cursor: settings.overlayClose ? "pointer" : "auto",
332
+ visibility: 'visible'
333
+ }).show();
334
+
335
+
336
+ if (className) {
337
+ $box.add($overlay).removeClass(className);
338
+ }
339
+ if (settings.className) {
340
+ $box.add($overlay).addClass(settings.className);
341
+ }
342
+ className = settings.className;
343
+
344
+ if (settings.closeButton) {
345
+ $close.html(settings.close).appendTo($content);
346
+ } else {
347
+ $close.appendTo('<div/>');
348
+ }
349
+
350
+ if (!open) {
351
+ open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
352
+
353
+ // Show colorbox so the sizes can be calculated in older versions of jQuery
354
+ $box.css({visibility:'hidden', display:'block'});
355
+
356
+ $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden').appendTo($content);
357
+
358
+ // Cache values needed for size calculations
359
+ interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();
360
+ interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
361
+ loadedHeight = $loaded.outerHeight(true);
362
+ loadedWidth = $loaded.outerWidth(true);
363
+
364
+
365
+ // Opens inital empty Colorbox prior to content being loaded.
366
+ settings.w = setSize(settings.initialWidth, 'x');
367
+ settings.h = setSize(settings.initialHeight, 'y');
368
+ publicMethod.position();
369
+
370
+ slideshow();
371
+
372
+ trigger(event_open, settings.onOpen);
373
+
374
+ $groupControls.add($title).hide();
375
+
376
+ $box.focus();
377
+
378
+
379
+ if (settings.trapFocus) {
380
+ // Confine focus to the modal
381
+ // Uses event capturing that is not supported in IE8-
382
+ if (document.addEventListener) {
383
+
384
+ document.addEventListener('focus', trapFocus, true);
385
+
386
+ $events.one(event_closed, function () {
387
+ document.removeEventListener('focus', trapFocus, true);
388
+ });
389
+ }
390
+ }
391
+
392
+ // Return focus on closing
393
+ if (settings.returnFocus) {
394
+ $events.one(event_closed, function () {
395
+ $(element).focus();
396
+ });
397
+ }
398
+ }
399
+
400
+ load();
401
+ }
402
+ }
403
+
404
+ // Colorbox's markup needs to be added to the DOM prior to being called
405
+ // so that the browser will go ahead and load the CSS background images.
406
+ function appendHTML() {
407
+ if (!$box && document.body) {
408
+ init = false;
409
+ $window = $(window);
410
+ $box = $tag(div).attr({
411
+ id: colorbox,
412
+ 'class': $.support.opacity === false ? prefix + 'IE' : '', // class for optional IE8 & lower targeted CSS.
413
+ role: 'dialog',
414
+ tabindex: '-1'
415
+ }).hide();
416
+ $overlay = $tag(div, "Overlay").hide();
417
+ $loadingOverlay = $([$tag(div, "LoadingOverlay")[0],$tag(div, "LoadingGraphic")[0]]);
418
+ $wrap = $tag(div, "Wrapper");
419
+ $content = $tag(div, "Content").append(
420
+ $title = $tag(div, "Title"),
421
+ $current = $tag(div, "Current"),
422
+ $prev = $('<button type="button"/>').attr({id:prefix+'Previous'}),
423
+ $next = $('<button type="button"/>').attr({id:prefix+'Next'}),
424
+ $slideshow = $tag('button', "Slideshow"),
425
+ $loadingOverlay
426
+ );
427
+
428
+ $close = $('<button type="button"/>').attr({id:prefix+'Close'});
429
+
430
+ $wrap.append( // The 3x3 Grid that makes up Colorbox
431
+ $tag(div).append(
432
+ $tag(div, "TopLeft"),
433
+ $topBorder = $tag(div, "TopCenter"),
434
+ $tag(div, "TopRight")
435
+ ),
436
+ $tag(div, false, 'clear:left').append(
437
+ $leftBorder = $tag(div, "MiddleLeft"),
438
+ $content,
439
+ $rightBorder = $tag(div, "MiddleRight")
440
+ ),
441
+ $tag(div, false, 'clear:left').append(
442
+ $tag(div, "BottomLeft"),
443
+ $bottomBorder = $tag(div, "BottomCenter"),
444
+ $tag(div, "BottomRight")
445
+ )
446
+ ).find('div div').css({'float': 'left'});
447
+
448
+ $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none');
449
+
450
+ $groupControls = $next.add($prev).add($current).add($slideshow);
451
+
452
+ $(document.body).append($overlay, $box.append($wrap, $loadingBay));
453
+ }
454
+ }
455
+
456
+ // Add Colorbox's event bindings
457
+ function addBindings() {
458
+ function clickHandler(e) {
459
+ // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt.
460
+ // See: http://jacklmoore.com/notes/click-events/
461
+ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey || e.ctrlKey)) {
462
+ e.preventDefault();
463
+ launch(this);
464
+ }
465
+ }
466
+
467
+ if ($box) {
468
+ if (!init) {
469
+ init = true;
470
+
471
+ // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly.
472
+ $next.click(function () {
473
+ publicMethod.next();
474
+ });
475
+ $prev.click(function () {
476
+ publicMethod.prev();
477
+ });
478
+ $close.click(function () {
479
+ publicMethod.close();
480
+ });
481
+ $overlay.click(function () {
482
+ if (settings.overlayClose) {
483
+ publicMethod.close();
484
+ }
485
+ });
486
+
487
+ // Key Bindings
488
+ $(document).bind('keydown.' + prefix, function (e) {
489
+ var key = e.keyCode;
490
+ if (open && settings.escKey && key === 27) {
491
+ e.preventDefault();
492
+ publicMethod.close();
493
+ }
494
+ if (open && settings.arrowKey && $related[1] && !e.altKey) {
495
+ if (key === 37) {
496
+ e.preventDefault();
497
+ $prev.click();
498
+ } else if (key === 39) {
499
+ e.preventDefault();
500
+ $next.click();
501
+ }
502
+ }
503
+ });
504
+
505
+ if ($.isFunction($.fn.on)) {
506
+ // For jQuery 1.7+
507
+ $(document).on('click.'+prefix, '.'+boxElement, clickHandler);
508
+ } else {
509
+ // For jQuery 1.3.x -> 1.6.x
510
+ // This code is never reached in jQuery 1.9, so do not contact me about 'live' being removed.
511
+ // This is not here for jQuery 1.9, it's here for legacy users.
512
+ $('.'+boxElement).live('click.'+prefix, clickHandler);
513
+ }
514
+ }
515
+ return true;
516
+ }
517
+ return false;
518
+ }
519
+
520
+ // Don't do anything if Colorbox already exists.
521
+ if ($.colorbox) {
522
+ return;
523
+ }
524
+
525
+ // Append the HTML when the DOM loads
526
+ $(appendHTML);
527
+
528
+
529
+ // ****************
530
+ // PUBLIC FUNCTIONS
531
+ // Usage format: $.colorbox.close();
532
+ // Usage from within an iframe: parent.jQuery.colorbox.close();
533
+ // ****************
534
+
535
+ publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
536
+ var $this = this;
537
+
538
+ options = options || {};
539
+
540
+ appendHTML();
541
+
542
+ if (addBindings()) {
543
+ if ($.isFunction($this)) { // assume a call to $.colorbox
544
+ $this = $('<a/>');
545
+ options.open = true;
546
+ } else if (!$this[0]) { // colorbox being applied to empty collection
547
+ return $this;
548
+ }
549
+
550
+ if (callback) {
551
+ options.onComplete = callback;
552
+ }
553
+
554
+ $this.each(function () {
555
+ $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
556
+ }).addClass(boxElement);
557
+
558
+ if (($.isFunction(options.open) && options.open.call($this)) || options.open) {
559
+ launch($this[0]);
560
+ }
561
+ }
562
+
563
+ return $this;
564
+ };
565
+
566
+ publicMethod.position = function (speed, loadedCallback) {
567
+ var
568
+ css,
569
+ top = 0,
570
+ left = 0,
571
+ offset = $box.offset(),
572
+ scrollTop,
573
+ scrollLeft;
574
+
575
+ $window.unbind('cbResize.' + prefix);
576
+
577
+ // remove the modal so that it doesn't influence the document width/height
578
+ $box.css({top: -9e4, left: -9e4});
579
+
580
+ scrollTop = $window.scrollTop();
581
+ scrollLeft = $window.scrollLeft();
582
+
583
+ if (settings.fixed) {
584
+ offset.top -= scrollTop;
585
+ offset.left -= scrollLeft;
586
+ $box.css({position: 'fixed'});
587
+ } else {
588
+ top = scrollTop;
589
+ left = scrollLeft;
590
+ $box.css({position: 'absolute'});
591
+ }
592
+
593
+ // keeps the top and left positions within the browser's viewport.
594
+ if (settings.right !== false) {
595
+ left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0);
596
+ } else if (settings.left !== false) {
597
+ left += setSize(settings.left, 'x');
598
+ } else {
599
+ left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2);
600
+ }
601
+
602
+ if (settings.bottom !== false) {
603
+ top += Math.max(winheight() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0);
604
+ } else if (settings.top !== false) {
605
+ top += setSize(settings.top, 'y');
606
+ } else {
607
+ top += Math.round(Math.max(winheight() - settings.h - loadedHeight - interfaceHeight, 0) / 2);
608
+ }
609
+
610
+ $box.css({top: offset.top, left: offset.left, visibility:'visible'});
611
+
612
+ // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
613
+ // but it has to be shrank down around the size of div#colorbox when it's done. If not,
614
+ // it can invoke an obscure IE bug when using iframes.
615
+ $wrap[0].style.width = $wrap[0].style.height = "9999px";
616
+
617
+ function modalDimensions(that) {
618
+ $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = (parseInt(that.style.width,10) - interfaceWidth)+'px';
619
+ $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = (parseInt(that.style.height,10) - interfaceHeight)+'px';
620
+ }
621
+
622
+ css = {width: settings.w + loadedWidth + interfaceWidth, height: settings.h + loadedHeight + interfaceHeight, top: top, left: left};
623
+
624
+ // setting the speed to 0 if the content hasn't changed size or position
625
+ if (speed) {
626
+ var tempSpeed = 0;
627
+ $.each(css, function(i){
628
+ if (css[i] !== previousCSS[i]) {
629
+ tempSpeed = speed;
630
+ return;
631
+ }
632
+ });
633
+ speed = tempSpeed;
634
+ }
635
+
636
+ previousCSS = css;
637
+
638
+ $box.dequeue().animate(css, {
639
+ duration: speed || 0,
640
+ complete: function () {
641
+ modalDimensions(this);
642
+
643
+ active = false;
644
+
645
+ // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
646
+ $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
647
+ $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
648
+
649
+ if (settings.reposition) {
650
+ setTimeout(function () { // small delay before binding oncbResize due to an IE8 bug.
651
+ $window.bind('cbResize.' + prefix, publicMethod.position);
652
+ }, 1);
653
+ }
654
+
655
+ if (loadedCallback) {
656
+ loadedCallback();
657
+ }
658
+ },
659
+ step: function () {
660
+ modalDimensions(this);
661
+ }
662
+ });
663
+ };
664
+
665
+ publicMethod.cbResize = function (options) {
666
+ var scrolltop;
667
+
668
+ if (open) {
669
+ options = options || {};
670
+
671
+ if (options.width) {
672
+ settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
673
+ }
674
+
675
+ if (options.innerWidth) {
676
+ settings.w = setSize(options.innerWidth, 'x');
677
+ }
678
+
679
+ $loaded.css({width: settings.w});
680
+
681
+ if (options.height) {
682
+ settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
683
+ }
684
+
685
+ if (options.innerHeight) {
686
+ settings.h = setSize(options.innerHeight, 'y');
687
+ }
688
+
689
+ if (!options.innerHeight && !options.height) {
690
+ scrolltop = $loaded.scrollTop();
691
+ $loaded.css({height: "auto"});
692
+ settings.h = $loaded.height();
693
+ }
694
+
695
+ $loaded.css({height: settings.h});
696
+
697
+ if(scrolltop) {
698
+ $loaded.scrollTop(scrolltop);
699
+ }
700
+
701
+ publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
702
+ }
703
+ };
704
+
705
+ publicMethod.prep = function (object) {
706
+ if (!open) {
707
+ return;
708
+ }
709
+
710
+ var callback, speed = settings.transition === "none" ? 0 : settings.speed;
711
+
712
+ $loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
713
+
714
+ $loaded = $tag(div, 'LoadedContent').append(object);
715
+
716
+ function getWidth() {
717
+ settings.w = settings.w || $loaded.width();
718
+ settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
719
+ return settings.w;
720
+ }
721
+ function getHeight() {
722
+ settings.h = settings.h || $loaded.height();
723
+ settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
724
+ return settings.h;
725
+ }
726
+
727
+ $loaded.hide()
728
+ .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
729
+ .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
730
+ .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
731
+ .prependTo($content);
732
+
733
+ $loadingBay.hide();
734
+
735
+ // 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.
736
+
737
+ $(photo).css({'float': 'none'});
738
+
739
+ callback = function () {
740
+ var total = $related.length,
741
+ iframe,
742
+ frameBorder = 'frameBorder',
743
+ allowTransparency = 'allowTransparency',
744
+ complete;
745
+
746
+ if (!open) {
747
+ return;
748
+ }
749
+
750
+ function removeFilter() { // Needed for IE7 & IE8 in versions of jQuery prior to 1.7.2
751
+ if ($.support.opacity === false) {
752
+ $box[0].style.removeAttribute('filter');
753
+ }
754
+ }
755
+
756
+ complete = function () {
757
+ clearTimeout(loadingTimer);
758
+ $loadingOverlay.hide();
759
+ trigger(event_complete, settings.onComplete);
760
+ };
761
+
762
+
763
+ $title.html(settings.title).add($loaded).show();
764
+
765
+ if (total > 1) { // handle grouping
766
+ if (typeof settings.current === "string") {
767
+ $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show();
768
+ }
769
+
770
+ $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
771
+ $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
772
+
773
+ if (settings.slideshow) {
774
+ $slideshow.show();
775
+ }
776
+
777
+ // Preloads images within a rel group
778
+ if (settings.preloading) {
779
+ $.each([getIndex(-1), getIndex(1)], function(){
780
+ var src,
781
+ img,
782
+ i = $related[this],
783
+ data = $.data(i, colorbox);
784
+
785
+ if (data && data.href) {
786
+ src = data.href;
787
+ if ($.isFunction(src)) {
788
+ src = src.call(i);
789
+ }
790
+ } else {
791
+ src = $(i).attr('href');
792
+ }
793
+
794
+ if (src && isImage(data, src)) {
795
+ src = retinaUrl(data, src);
796
+ img = document.createElement('img');
797
+ img.src = src;
798
+ }
799
+ });
800
+ }
801
+ } else {
802
+ $groupControls.hide();
803
+ }
804
+
805
+ if (settings.iframe) {
806
+ iframe = $tag('iframe')[0];
807
+
808
+ if (frameBorder in iframe) {
809
+ iframe[frameBorder] = 0;
810
+ }
811
+
812
+ if (allowTransparency in iframe) {
813
+ iframe[allowTransparency] = "true";
814
+ }
815
+
816
+ if (!settings.scrolling) {
817
+ iframe.scrolling = "no";
818
+ }
819
+
820
+ $(iframe)
821
+ .attr({
822
+ src: settings.href,
823
+ name: (new Date()).getTime(), // give the iframe a unique name to prevent caching
824
+ 'class': prefix + 'Iframe',
825
+ allowFullScreen : true, // allow HTML5 video to go fullscreen
826
+ webkitAllowFullScreen : true,
827
+ mozallowfullscreen : true
828
+ })
829
+ .one('load', complete)
830
+ .appendTo($loaded);
831
+
832
+ $events.one(event_purge, function () {
833
+ iframe.src = "//about:blank";
834
+ });
835
+
836
+ if (settings.fastIframe) {
837
+ $(iframe).trigger('load');
838
+ }
839
+ } else {
840
+ complete();
841
+ }
842
+
843
+ if (settings.transition === 'fade') {
844
+ $box.fadeTo(speed, 1, removeFilter);
845
+ } else {
846
+ removeFilter();
847
+ }
848
+ };
849
+
850
+ if (settings.transition === 'fade') {
851
+ $box.fadeTo(speed, 0, function () {
852
+ publicMethod.position(0, callback);
853
+ });
854
+ } else {
855
+ publicMethod.position(speed, callback);
856
+ }
857
+ };
858
+
859
+ function load () {
860
+ var href, setResize, prep = publicMethod.prep, $inline, request = ++requests;
861
+
862
+ active = true;
863
+
864
+ photo = false;
865
+
866
+ element = $related[index];
867
+
868
+ makeSettings();
869
+
870
+ trigger(event_purge);
871
+
872
+ trigger(event_load, settings.onLoad);
873
+
874
+ settings.h = settings.height ?
875
+ setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
876
+ settings.innerHeight && setSize(settings.innerHeight, 'y');
877
+
878
+ settings.w = settings.width ?
879
+ setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
880
+ settings.innerWidth && setSize(settings.innerWidth, 'x');
881
+
882
+ // Sets the minimum dimensions for use in image scaling
883
+ settings.mw = settings.w;
884
+ settings.mh = settings.h;
885
+
886
+ // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
887
+ // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
888
+ if (settings.maxWidth) {
889
+ settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
890
+ settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
891
+ }
892
+ if (settings.maxHeight) {
893
+ settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
894
+ settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
895
+ }
896
+
897
+ href = settings.href;
898
+
899
+ loadingTimer = setTimeout(function () {
900
+ $loadingOverlay.show();
901
+ }, 100);
902
+
903
+ if (settings.inline) {
904
+ // Inserts an empty placeholder where inline content is being pulled from.
905
+ // An event is bound to put inline content back when Colorbox closes or loads new content.
906
+ $inline = $tag(div).hide().insertBefore($(href)[0]);
907
+
908
+ $events.one(event_purge, function () {
909
+ $inline.replaceWith($loaded.children());
910
+ });
911
+
912
+ prep($(href));
913
+ } else if (settings.iframe) {
914
+ // IFrame element won't be added to the DOM until it is ready to be displayed,
915
+ // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
916
+ prep(" ");
917
+ } else if (settings.html) {
918
+ prep(settings.html);
919
+ } else if (isImage(settings, href)) {
920
+
921
+ href = retinaUrl(settings, href);
922
+
923
+ photo = document.createElement('img');
924
+
925
+ $(photo)
926
+ .addClass(prefix + 'Photo')
927
+ .bind('error',function () {
928
+ settings.title = false;
929
+ prep($tag(div, 'Error').html(settings.imgError));
930
+ })
931
+ .one('load', function () {
932
+ var percent;
933
+
934
+ if (request !== requests) {
935
+ return;
936
+ }
937
+
938
+ photo.alt = $(element).attr('alt') || $(element).attr('data-alt') || '';
939
+
940
+ if (settings.retinaImage && window.devicePixelRatio > 1) {
941
+ photo.height = photo.height / window.devicePixelRatio;
942
+ photo.width = photo.width / window.devicePixelRatio;
943
+ }
944
+
945
+ if (settings.scalePhotos) {
946
+ setResize = function () {
947
+ photo.height -= photo.height * percent;
948
+ photo.width -= photo.width * percent;
949
+ };
950
+ if (settings.mw && photo.width > settings.mw) {
951
+ percent = (photo.width - settings.mw) / photo.width;
952
+ setResize();
953
+ }
954
+ if (settings.mh && photo.height > settings.mh) {
955
+ percent = (photo.height - settings.mh) / photo.height;
956
+ setResize();
957
+ }
958
+ }
959
+
960
+ if (settings.h) {
961
+ photo.style.marginTop = Math.max(settings.mh - photo.height, 0) / 2 + 'px';
962
+ }
963
+
964
+ if ($related[1] && (settings.loop || $related[index + 1])) {
965
+ photo.style.cursor = 'pointer';
966
+ photo.onclick = function () {
967
+ publicMethod.next();
968
+ };
969
+ }
970
+
971
+ photo.style.width = photo.width + 'px';
972
+ photo.style.height = photo.height + 'px';
973
+
974
+ setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
975
+ prep(photo);
976
+ }, 1);
977
+ });
978
+
979
+ setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
980
+ photo.src = href;
981
+ }, 1);
982
+ } else if (href) {
983
+ $loadingBay.load(href, settings.data, function (data, status) {
984
+ if (request === requests) {
985
+ prep(status === 'error' ? $tag(div, 'Error').html(settings.xhrError) : $(this).contents());
986
+ }
987
+ });
988
+ }
989
+ }
990
+
991
+ // Navigates to the next page/image in a set.
992
+ publicMethod.next = function () {
993
+ if (!active && $related[1] && (settings.loop || $related[index + 1])) {
994
+ index = getIndex(1);
995
+ launch($related[index]);
996
+ }
997
+ };
998
+
999
+ publicMethod.prev = function () {
1000
+ if (!active && $related[1] && (settings.loop || index)) {
1001
+ index = getIndex(-1);
1002
+ launch($related[index]);
1003
+ }
1004
+ };
1005
+
1006
+ // Note: to use this within an iframe use the following format: parent.jQuery.colorbox.close();
1007
+ publicMethod.close = function () {
1008
+ if (open && !closing) {
1009
+
1010
+ closing = true;
1011
+
1012
+ open = false;
1013
+
1014
+ trigger(event_cleanup, settings.onCleanup);
1015
+
1016
+ $window.unbind('.' + prefix);
1017
+
1018
+ $overlay.fadeTo(settings.fadeOut || 0, 0);
1019
+
1020
+ $box.stop().fadeTo(settings.fadeOut || 0, 0, function () {
1021
+
1022
+ $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
1023
+
1024
+ trigger(event_purge);
1025
+
1026
+ $loaded.empty().remove(); // Using empty first may prevent some IE7 issues.
1027
+
1028
+ setTimeout(function () {
1029
+ closing = false;
1030
+ trigger(event_closed, settings.onClosed);
1031
+ }, 1);
1032
+ });
1033
+ }
1034
+ };
1035
+
1036
+ // Removes changes Colorbox made to the document, but does not remove the plugin.
1037
+ publicMethod.remove = function () {
1038
+ if (!$box) { return; }
1039
+
1040
+ $box.stop();
1041
+ $.colorbox.close();
1042
+ $box.stop().remove();
1043
+ $overlay.remove();
1044
+ closing = false;
1045
+ $box = null;
1046
+ $('.' + boxElement)
1047
+ .removeData(colorbox)
1048
+ .removeClass(boxElement);
1049
+
1050
+ $(document).unbind('click.'+prefix);
1051
+ };
1052
+
1053
+ // A method for fetching the current element Colorbox is referencing.
1054
+ // returns a jQuery object.
1055
+ publicMethod.element = function () {
1056
+ return $(element);
1057
+ };
1058
+
1059
+ publicMethod.settings = defaults;
1060
+
1061
+ }(jQuery, document, window));
js/maxmegamenu.js ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint browser: true, white: true */
2
+ /*global console,jQuery,megamenu,window,navigator*/
3
+
4
+ /**
5
+ * Max Mega Menu jQuery Plugin
6
+ */
7
+ (function($) {
8
+
9
+ "use strict";
10
+
11
+ $.maxmegamenu = function(menu, options) {
12
+
13
+ var plugin = this;
14
+ var $menu = $(menu);
15
+
16
+ var defaults = {
17
+ event: $menu.attr('data-event'),
18
+ effect: $menu.attr('data-effect'),
19
+ panel_width: $menu.attr('data-panel-width'),
20
+ panel_inner_width: $menu.attr('data-panel-inner-width'),
21
+ second_click: $menu.attr('data-second-click'),
22
+ vertical_behaviour: $menu.attr('data-vertical-behaviour'),
23
+ reverse_mobile_items: $menu.attr('data-reverse-mobile-items'),
24
+ document_click: $menu.attr('data-document-click'),
25
+ breakpoint: $menu.attr('data-breakpoint')
26
+ };
27
+
28
+ plugin.settings = {};
29
+
30
+ var isTouchDevice = function() {
31
+ return (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
32
+ };
33
+
34
+
35
+ plugin.hidePanel = function(anchor, immediate) {
36
+
37
+ anchor.siblings('.mega-sub-menu').children('.mega-toggle-on').removeClass('mega-toggle-on');
38
+
39
+ if (immediate) {
40
+ anchor.siblings('.mega-sub-menu').removeClass('mega-toggle-on').css('display', '');
41
+ anchor.parent().removeClass('mega-toggle-on').triggerHandler("close_panel");
42
+ return;
43
+ }
44
+
45
+ if ( megamenu.effect[plugin.settings.effect] ) {
46
+ var effect = megamenu.effect[plugin.settings.effect]['out'];
47
+ var speed = megamenu.effect[plugin.settings.effect]['speed'] ? megamenu.effect[plugin.settings.effect]['speed'] : "fast";
48
+
49
+ if (effect.css) {
50
+ anchor.siblings('.mega-sub-menu').css(effect.css);
51
+ }
52
+
53
+ if (effect.animate) {
54
+ anchor.siblings('.mega-sub-menu').animate(effect.animate, speed, function() {
55
+ anchor.parent().removeClass('mega-toggle-on').triggerHandler("close_panel");
56
+ });
57
+ } else {
58
+ anchor.parent().removeClass('mega-toggle-on').triggerHandler("close_panel");
59
+ }
60
+ } else {
61
+ anchor.parent().removeClass('mega-toggle-on').triggerHandler("close_panel");
62
+ }
63
+
64
+ };
65
+
66
+
67
+ plugin.hideAllPanels = function() {
68
+ $('.mega-toggle-on > a', $menu).each(function() {
69
+ plugin.hidePanel($(this), true);
70
+ });
71
+ };
72
+
73
+
74
+ plugin.hideSiblingPanels = function(anchor, immediate) {
75
+ // all open children of open siblings
76
+ anchor.parent().siblings().find('.mega-toggle-on').andSelf().children('a').each(function() {
77
+ plugin.hidePanel($(this), immediate);
78
+ });
79
+ }
80
+
81
+
82
+ plugin.isDesktopView = function() {
83
+ return $(window).width() > plugin.settings.breakpoint;
84
+ }
85
+
86
+
87
+ plugin.hideOpenSiblings = function() {
88
+ // desktops, horizontal
89
+ if ( plugin.isDesktopView() && ( $menu.hasClass('mega-menu-horizontal') || $menu.hasClass('mega-menu-vertical') ) ) {
90
+ return 'immediately';
91
+ }
92
+
93
+ if ( plugin.settings.vertical_behaviour == 'accordion' ) {
94
+ return 'animated';
95
+ }
96
+
97
+ }
98
+
99
+
100
+ plugin.showPanel = function(anchor) {
101
+
102
+ if ( !plugin.isDesktopView() && anchor.parent().hasClass('mega-hide-sub-menu-on-mobile') ) {
103
+ return;
104
+ }
105
+
106
+ switch( plugin.hideOpenSiblings() ) {
107
+ case 'immediately':
108
+ plugin.hideSiblingPanels(anchor, true);
109
+ break;
110
+ case 'animated':
111
+ plugin.hideSiblingPanels(anchor, false);
112
+ break;
113
+ }
114
+
115
+ // apply dynamic width and sub menu position
116
+ if ( anchor.parent().hasClass('mega-menu-megamenu') && $(plugin.settings.panel_width).length ) {
117
+ var submenu_offset = $menu.offset();
118
+ var target_offset = $(plugin.settings.panel_width).offset();
119
+
120
+ anchor.siblings('.mega-sub-menu').css({
121
+ width: $(plugin.settings.panel_width).outerWidth(),
122
+ left: (target_offset.left - submenu_offset.left) + "px"
123
+ });
124
+ }
125
+
126
+
127
+ // apply inner width to sub menu by adding padding to the left and right of the mega menu
128
+ if ( anchor.parent().hasClass('mega-menu-megamenu') && plugin.settings.panel_inner_width && plugin.settings.panel_inner_width.length > 0 ) {
129
+
130
+ if ( $(plugin.settings.panel_inner_width).length ) {
131
+ // jQuery selector
132
+ var target_width = parseInt($(plugin.settings.panel_inner_width).width(), 10);
133
+ } else {
134
+ // we're using a pixel width
135
+ var target_width = parseInt(plugin.settings.panel_inner_width, 10);
136
+ }
137
+
138
+ var submenu_width = parseInt(anchor.siblings('.mega-sub-menu').innerWidth(), 10);
139
+
140
+ if ( (target_width > 0) && (target_width < submenu_width) ) {
141
+ anchor.siblings('.mega-sub-menu').css({
142
+ 'paddingLeft': (submenu_width - target_width) / 2 + 'px',
143
+ 'paddingRight': (submenu_width - target_width) / 2 + 'px'
144
+ });
145
+ }
146
+ }
147
+
148
+
149
+ if ( megamenu.effect[plugin.settings.effect] ) {
150
+ var effect = megamenu.effect[plugin.settings.effect]['in'];
151
+ var speed = megamenu.effect[plugin.settings.effect]['speed'] ? megamenu.effect[plugin.settings.effect]['speed'] : "fast";
152
+
153
+ if (effect.css) {
154
+ anchor.siblings('.mega-sub-menu').css(effect.css);
155
+ }
156
+
157
+ if (effect.animate) {
158
+ anchor.siblings('.mega-sub-menu').animate(effect.animate, speed, 'swing', function() {
159
+ $(this).css('visiblity', 'visible');
160
+ });
161
+ }
162
+ }
163
+
164
+ anchor.parent().addClass('mega-toggle-on').triggerHandler("open_panel");
165
+ };
166
+
167
+
168
+ var openOnClick = function() {
169
+ // hide menu when clicked away from
170
+ $(document).on('click touchstart', function(event) {
171
+ if ( ( plugin.settings.document_click == 'collapse' || ! plugin.isDesktopView() ) && ! $(event.target).closest(".mega-menu li").length ) {
172
+ plugin.hideAllPanels();
173
+ }
174
+ });
175
+
176
+ $('li.mega-menu-megamenu.mega-menu-item-has-children > a, li.mega-menu-flyout.mega-menu-item-has-children > a, li.mega-menu-flyout li.mega-menu-item-has-children > a', menu).on({
177
+ click: function(e) {
178
+
179
+ // all clicks on parent items when sub menu is hidden on mobile
180
+ if ( ! plugin.isDesktopView() && $(this).parent().hasClass('mega-hide-sub-menu-on-mobile') ) {
181
+ return;
182
+ }
183
+
184
+ // check for second click
185
+ if ( plugin.settings.second_click == 'go' || $(this).parent().hasClass("mega-click-click-go") ) {
186
+ if ( ! $(this).parent().hasClass("mega-toggle-on") ) {
187
+ e.preventDefault();
188
+ plugin.showPanel($(this));
189
+ }
190
+ } else {
191
+ e.preventDefault();
192
+
193
+ if ( $(this).parent().hasClass("mega-toggle-on") ) {
194
+ plugin.hidePanel($(this), false);
195
+ } else {
196
+ plugin.showPanel($(this));
197
+ }
198
+ }
199
+ }
200
+ });
201
+ };
202
+
203
+
204
+ var openOnHover = function() {
205
+
206
+ $('li.mega-menu-item-has-children', menu).not('li.mega-menu-megamenu li.mega-menu-item-has-children', menu).hoverIntent({
207
+ over: function () {
208
+ plugin.showPanel($(this).children('a'));
209
+ },
210
+ out: function () {
211
+ if ($(this).hasClass("mega-toggle-on")) {
212
+ plugin.hidePanel($(this).children('a'), false);
213
+ }
214
+ },
215
+ timeout: megamenu.timeout,
216
+ interval: megamenu.interval
217
+ });
218
+ };
219
+
220
+
221
+ plugin.init = function() {
222
+ plugin.settings = $.extend({}, defaults, options);
223
+
224
+ $menu.removeClass('mega-no-js');
225
+
226
+ $menu.siblings('.mega-menu-toggle').on('click', function() {
227
+ $(this).toggleClass('mega-menu-open');
228
+ });
229
+
230
+ $('li.mega-menu-item, ul.mega-sub-menu', menu).unbind();
231
+
232
+ if (isTouchDevice() || plugin.settings.event === 'click') {
233
+ openOnClick();
234
+ } else {
235
+ openOnHover();
236
+ }
237
+
238
+ if (!plugin.isDesktopView() && plugin.settings.reverse_mobile_items == 'true') {
239
+ $menu.append($menu.children('li.mega-item-align-right').get().reverse());
240
+ }
241
+
242
+ };
243
+
244
+ plugin.init();
245
+
246
+ };
247
+
248
+
249
+ $.fn.maxmegamenu = function(options) {
250
+ return this.each(function() {
251
+ if (undefined === $(this).data('maxmegamenu')) {
252
+ var plugin = new $.maxmegamenu(this, options);
253
+ $(this).data('maxmegamenu', plugin);
254
+ }
255
+ });
256
+ };
257
+
258
+
259
+ $(function() {
260
+ $(".mega-menu").maxmegamenu();
261
+ });
262
+
263
+
264
+ })(jQuery);
js/select2/select2.css ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Version: 3.5.4 Timestamp: Sun Aug 30 13:30:32 EDT 2015
3
+ */
4
+ .select2-container {
5
+ margin: 0;
6
+ position: relative;
7
+ display: inline-block;
8
+ vertical-align: middle;
9
+ }
10
+
11
+ .select2-container,
12
+ .select2-drop,
13
+ .select2-search,
14
+ .select2-search input {
15
+ /*
16
+ Force border-box so that % widths fit the parent
17
+ container without overlap because of margin/padding.
18
+ More Info : http://www.quirksmode.org/css/box.html
19
+ */
20
+ -webkit-box-sizing: border-box; /* webkit */
21
+ -moz-box-sizing: border-box; /* firefox */
22
+ box-sizing: border-box; /* css3 */
23
+ }
24
+
25
+ .select2-container .select2-choice {
26
+ display: block;
27
+ height: 26px;
28
+ padding: 0 0 0 8px;
29
+ overflow: hidden;
30
+ position: relative;
31
+
32
+ border: 1px solid #aaa;
33
+ white-space: nowrap;
34
+ line-height: 26px;
35
+ color: #444;
36
+ text-decoration: none;
37
+
38
+ border-radius: 4px;
39
+
40
+ background-clip: padding-box;
41
+
42
+ -webkit-touch-callout: none;
43
+ -webkit-user-select: none;
44
+ -moz-user-select: none;
45
+ -ms-user-select: none;
46
+ user-select: none;
47
+
48
+ background-color: #fff;
49
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
50
+ background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
51
+ background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
52
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
53
+ background-image: linear-gradient(to top, #eee 0%, #fff 50%);
54
+ }
55
+
56
+ html[dir="rtl"] .select2-container .select2-choice {
57
+ padding: 0 8px 0 0;
58
+ }
59
+
60
+ .select2-container.select2-drop-above .select2-choice {
61
+ border-bottom-color: #aaa;
62
+
63
+ border-radius: 0 0 4px 4px;
64
+
65
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
66
+ background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
67
+ background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
68
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
69
+ background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
70
+ }
71
+
72
+ .select2-container.select2-allowclear .select2-choice .select2-chosen {
73
+ margin-right: 42px;
74
+ }
75
+
76
+ .select2-container .select2-choice > .select2-chosen {
77
+ margin-right: 26px;
78
+ display: block;
79
+ overflow: hidden;
80
+
81
+ white-space: nowrap;
82
+
83
+ text-overflow: ellipsis;
84
+ float: none;
85
+ width: auto;
86
+ }
87
+
88
+ html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
89
+ margin-left: 26px;
90
+ margin-right: 0;
91
+ }
92
+
93
+ .select2-container .select2-choice abbr {
94
+ display: none;
95
+ width: 12px;
96
+ height: 12px;
97
+ position: absolute;
98
+ right: 24px;
99
+ top: 8px;
100
+
101
+ font-size: 1px;
102
+ text-decoration: none;
103
+
104
+ border: 0;
105
+ background: url('select2.png') right top no-repeat;
106
+ cursor: pointer;
107
+ outline: 0;
108
+ }
109
+
110
+ .select2-container.select2-allowclear .select2-choice abbr {
111
+ display: inline-block;
112
+ }
113
+
114
+ .select2-container .select2-choice abbr:hover {
115
+ background-position: right -11px;
116
+ cursor: pointer;
117
+ }
118
+
119
+ .select2-drop-mask {
120
+ border: 0;
121
+ margin: 0;
122
+ padding: 0;
123
+ position: fixed;
124
+ left: 0;
125
+ top: 0;
126
+ min-height: 100%;
127
+ min-width: 100%;
128
+ height: auto;
129
+ width: auto;
130
+ opacity: 0;
131
+ z-index: 9998;
132
+ /* styles required for IE to work */
133
+ background-color: #fff;
134
+ filter: alpha(opacity=0);
135
+ }
136
+
137
+ .select2-drop {
138
+ width: 100%;
139
+ margin-top: -1px;
140
+ position: absolute;
141
+ z-index: 9999;
142
+ top: 100%;
143
+
144
+ background: #fff;
145
+ color: #000;
146
+ border: 1px solid #aaa;
147
+ border-top: 0;
148
+
149
+ border-radius: 0 0 4px 4px;
150
+
151
+ -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
152
+ box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
153
+ }
154
+
155
+ .select2-drop.select2-drop-above {
156
+ margin-top: 1px;
157
+ border-top: 1px solid #aaa;
158
+ border-bottom: 0;
159
+
160
+ border-radius: 4px 4px 0 0;
161
+
162
+ -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
163
+ box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
164
+ }
165
+
166
+ .select2-drop-active {
167
+ border: 1px solid #5897fb;
168
+ border-top: none;
169
+ }
170
+
171
+ .select2-drop.select2-drop-above.select2-drop-active {
172
+ border-top: 1px solid #5897fb;
173
+ }
174
+
175
+ .select2-drop-auto-width {
176
+ border-top: 1px solid #aaa;
177
+ width: auto;
178
+ }
179
+
180
+ .select2-container .select2-choice .select2-arrow {
181
+ display: inline-block;
182
+ width: 18px;
183
+ height: 100%;
184
+ position: absolute;
185
+ right: 0;
186
+ top: 0;
187
+
188
+ border-left: 1px solid #aaa;
189
+ border-radius: 0 4px 4px 0;
190
+
191
+ background-clip: padding-box;
192
+
193
+ background: #ccc;
194
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
195
+ background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
196
+ background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
197
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
198
+ background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
199
+ }
200
+
201
+ html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
202
+ left: 0;
203
+ right: auto;
204
+
205
+ border-left: none;
206
+ border-right: 1px solid #aaa;
207
+ border-radius: 4px 0 0 4px;
208
+ }
209
+
210
+ .select2-container .select2-choice .select2-arrow b {
211
+ display: block;
212
+ width: 100%;
213
+ height: 100%;
214
+ background: url('select2.png') no-repeat 0 1px;
215
+ }
216
+
217
+ html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
218
+ background-position: 2px 1px;
219
+ }
220
+
221
+ .select2-search {
222
+ display: inline-block;
223
+ width: 100%;
224
+ min-height: 26px;
225
+ margin: 0;
226
+ padding: 4px 4px 0 4px;
227
+
228
+ position: relative;
229
+ z-index: 10000;
230
+
231
+ white-space: nowrap;
232
+ }
233
+
234
+ .select2-search input {
235
+ width: 100%;
236
+ height: auto !important;
237
+ min-height: 26px;
238
+ padding: 4px 20px 4px 5px;
239
+ margin: 0;
240
+
241
+ outline: 0;
242
+ font-family: sans-serif;
243
+ font-size: 1em;
244
+
245
+ border: 1px solid #aaa;
246
+ border-radius: 0;
247
+
248
+ -webkit-box-shadow: none;
249
+ box-shadow: none;
250
+
251
+ background: #fff url('select2.png') no-repeat 100% -22px;
252
+ background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
253
+ background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
254
+ background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
255
+ background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
256
+ }
257
+
258
+ html[dir="rtl"] .select2-search input {
259
+ padding: 4px 5px 4px 20px;
260
+
261
+ background: #fff url('select2.png') no-repeat -37px -22px;
262
+ background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
263
+ background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
264
+ background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
265
+ background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
266
+ }
267
+
268
+ .select2-search input.select2-active {
269
+ background: #fff url('select2-spinner.gif') no-repeat 100%;
270
+ background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
271
+ background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
272
+ background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
273
+ background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
274
+ }
275
+
276
+ .select2-container-active .select2-choice,
277
+ .select2-container-active .select2-choices {
278
+ border: 1px solid #5897fb;
279
+ outline: none;
280
+
281
+ -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
282
+ box-shadow: 0 0 5px rgba(0, 0, 0, .3);
283
+ }
284
+
285
+ .select2-dropdown-open .select2-choice {
286
+ border-bottom-color: transparent;
287
+ -webkit-box-shadow: 0 1px 0 #fff inset;
288
+ box-shadow: 0 1px 0 #fff inset;
289
+
290
+ border-bottom-left-radius: 0;
291
+ border-bottom-right-radius: 0;
292
+
293
+ background-color: #eee;
294
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
295
+ background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
296
+ background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
297
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
298
+ background-image: linear-gradient(to top, #fff 0%, #eee 50%);
299
+ }
300
+
301
+ .select2-dropdown-open.select2-drop-above .select2-choice,
302
+ .select2-dropdown-open.select2-drop-above .select2-choices {
303
+ border: 1px solid #5897fb;
304
+ border-top-color: transparent;
305
+
306
+ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
307
+ background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
308
+ background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
309
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
310
+ background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
311
+ }
312
+
313
+ .select2-dropdown-open .select2-choice .select2-arrow {
314
+ background: transparent;
315
+ border-left: none;
316
+ filter: none;
317
+ }
318
+ html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
319
+ border-right: none;
320
+ }
321
+
322
+ .select2-dropdown-open .select2-choice .select2-arrow b {
323
+ background-position: -18px 1px;
324
+ }
325
+
326
+ html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
327
+ background-position: -16px 1px;
328
+ }
329
+
330
+ .select2-hidden-accessible {
331
+ border: 0;
332
+ clip: rect(0 0 0 0);
333
+ height: 1px;
334
+ margin: -1px;
335
+ overflow: hidden;
336
+ padding: 0;
337
+ position: absolute;
338
+ width: 1px;
339
+ }
340
+
341
+ /* results */
342
+ .select2-results {
343
+ max-height: 200px;
344
+ padding: 0 0 0 4px;
345
+ margin: 4px 4px 4px 0;
346
+ position: relative;
347
+ overflow-x: hidden;
348
+ overflow-y: auto;
349
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
350
+ }
351
+
352
+ html[dir="rtl"] .select2-results {
353
+ padding: 0 4px 0 0;
354
+ margin: 4px 0 4px 4px;
355
+ }
356
+
357
+ .select2-results ul.select2-result-sub {
358
+ margin: 0;
359
+ padding-left: 0;
360
+ }
361
+
362
+ .select2-results li {
363
+ list-style: none;
364
+ display: list-item;
365
+ background-image: none;
366
+ }
367
+
368
+ .select2-results li.select2-result-with-children > .select2-result-label {
369
+ font-weight: bold;
370
+ }
371
+
372
+ .select2-results .select2-result-label {
373
+ padding: 3px 7px 4px;
374
+ margin: 0;
375
+ cursor: pointer;
376
+
377
+ min-height: 1em;
378
+
379
+ -webkit-touch-callout: none;
380
+ -webkit-user-select: none;
381
+ -moz-user-select: none;
382
+ -ms-user-select: none;
383
+ user-select: none;
384
+ }
385
+
386
+ .select2-results-dept-1 .select2-result-label { padding-left: 20px }
387
+ .select2-results-dept-2 .select2-result-label { padding-left: 40px }
388
+ .select2-results-dept-3 .select2-result-label { padding-left: 60px }
389
+ .select2-results-dept-4 .select2-result-label { padding-left: 80px }
390
+ .select2-results-dept-5 .select2-result-label { padding-left: 100px }
391
+ .select2-results-dept-6 .select2-result-label { padding-left: 110px }
392
+ .select2-results-dept-7 .select2-result-label { padding-left: 120px }
393
+
394
+ .select2-results .select2-highlighted {
395
+ background: #3875d7;
396
+ color: #fff;
397
+ }
398
+
399
+ .select2-results li em {
400
+ background: #feffde;
401
+ font-style: normal;
402
+ }
403
+
404
+ .select2-results .select2-highlighted em {
405
+ background: transparent;
406
+ }
407
+
408
+ .select2-results .select2-highlighted ul {
409
+ background: #fff;
410
+ color: #000;
411
+ }
412
+
413
+ .select2-results .select2-no-results,
414
+ .select2-results .select2-searching,
415
+ .select2-results .select2-ajax-error,
416
+ .select2-results .select2-selection-limit {
417
+ background: #f4f4f4;
418
+ display: list-item;
419
+ padding-left: 5px;
420
+ }
421
+
422
+ /*
423
+ disabled look for disabled choices in the results dropdown
424
+ */
425
+ .select2-results .select2-disabled.select2-highlighted {
426
+ color: #666;
427
+ background: #f4f4f4;
428
+ display: list-item;
429
+ cursor: default;
430
+ }
431
+ .select2-results .select2-disabled {
432
+ background: #f4f4f4;
433
+ display: list-item;
434
+ cursor: default;
435
+ }
436
+
437
+ .select2-results .select2-selected {
438
+ display: none;
439
+ }
440
+
441
+ .select2-more-results.select2-active {
442
+ background: #f4f4f4 url('select2-spinner.gif') no-repeat 100%;
443
+ }
444
+
445
+ .select2-results .select2-ajax-error {
446
+ background: rgba(255, 50, 50, .2);
447
+ }
448
+
449
+ .select2-more-results {
450
+ background: #f4f4f4;
451
+ display: list-item;
452
+ }
453
+
454
+ /* disabled styles */
455
+
456
+ .select2-container.select2-container-disabled .select2-choice {
457
+ background-color: #f4f4f4;
458
+ background-image: none;
459
+ border: 1px solid #ddd;
460
+ cursor: default;
461
+ }
462
+
463
+ .select2-container.select2-container-disabled .select2-choice .select2-arrow {
464
+ background-color: #f4f4f4;
465
+ background-image: none;
466
+ border-left: 0;
467
+ }
468
+
469
+ .select2-container.select2-container-disabled .select2-choice abbr {
470
+ display: none;
471
+ }
472
+
473
+
474
+ /* multiselect */
475
+
476
+ .select2-container-multi .select2-choices {
477
+ height: auto !important;
478
+ height: 1%;
479
+ margin: 0;
480
+ padding: 0 5px 0 0;
481
+ position: relative;
482
+
483
+ border: 1px solid #aaa;
484
+ cursor: text;
485
+ overflow: hidden;
486
+
487
+ background-color: #fff;
488
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
489
+ background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
490
+ background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
491
+ background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
492
+ }
493
+
494
+ html[dir="rtl"] .select2-container-multi .select2-choices {
495
+ padding: 0 0 0 5px;
496
+ }
497
+
498
+ .select2-locked {
499
+ padding: 3px 5px 3px 5px !important;
500
+ }
501
+
502
+ .select2-container-multi .select2-choices {
503
+ min-height: 26px;
504
+ }
505
+
506
+ .select2-container-multi.select2-container-active .select2-choices {
507
+ border: 1px solid #5897fb;
508
+ outline: none;
509
+
510
+ -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
511
+ box-shadow: 0 0 5px rgba(0, 0, 0, .3);
512
+ }
513
+ .select2-container-multi .select2-choices li {
514
+ float: left;
515
+ list-style: none;
516
+ }
517
+ html[dir="rtl"] .select2-container-multi .select2-choices li
518
+ {
519
+ float: right;
520
+ }
521
+ .select2-container-multi .select2-choices .select2-search-field {
522
+ margin: 0;
523
+ padding: 0;
524
+ white-space: nowrap;
525
+ }
526
+
527
+ .select2-container-multi .select2-choices .select2-search-field input {
528
+ padding: 5px;
529
+ margin: 1px 0;
530
+
531
+ font-family: sans-serif;
532
+ font-size: 100%;
533
+ color: #666;
534
+ outline: 0;
535
+ border: 0;
536
+ -webkit-box-shadow: none;
537
+ box-shadow: none;
538
+ background: transparent !important;
539
+ }
540
+
541
+ .select2-container-multi .select2-choices .select2-search-field input.select2-active {
542
+ background: #fff url('select2-spinner.gif') no-repeat 100% !important;
543
+ }
544
+
545
+ .select2-default {
546
+ color: #999 !important;
547
+ }
548
+
549
+ .select2-container-multi .select2-choices .select2-search-choice {
550
+ padding: 3px 5px 3px 18px;
551
+ margin: 3px 0 3px 5px;
552
+ position: relative;
553
+
554
+ line-height: 13px;
555
+ color: #333;
556
+ cursor: default;
557
+ border: 1px solid #aaaaaa;
558
+
559
+ border-radius: 3px;
560
+
561
+ -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
562
+ box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
563
+
564
+ background-clip: padding-box;
565
+
566
+ -webkit-touch-callout: none;
567
+ -webkit-user-select: none;
568
+ -moz-user-select: none;
569
+ -ms-user-select: none;
570
+ user-select: none;
571
+
572
+ background-color: #e4e4e4;
573
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
574
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
575
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
576
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
577
+ background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
578
+ }
579
+ html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
580
+ {
581
+ margin: 3px 5px 3px 0;
582
+ padding: 3px 18px 3px 5px;
583
+ }
584
+ .select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
585
+ cursor: default;
586
+ }
587
+ .select2-container-multi .select2-choices .select2-search-choice-focus {
588
+ background: #d4d4d4;
589
+ }
590
+
591
+ .select2-search-choice-close {
592
+ display: block;
593
+ width: 12px;
594
+ height: 13px;
595
+ position: absolute;
596
+ right: 3px;
597
+ top: 4px;
598
+
599
+ font-size: 1px;
600
+ outline: none;
601
+ background: url('select2.png') right top no-repeat;
602
+ }
603
+ html[dir="rtl"] .select2-search-choice-close {
604
+ right: auto;
605
+ left: 3px;
606
+ }
607
+
608
+ .select2-container-multi .select2-search-choice-close {
609
+ left: 3px;
610
+ }
611
+
612
+ html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
613
+ left: auto;
614
+ right: 2px;
615
+ }
616
+
617
+ .select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
618
+ background-position: right -11px;
619
+ }
620
+ .select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
621
+ background-position: right -11px;
622
+ }
623
+
624
+ /* disabled styles */
625
+ .select2-container-multi.select2-container-disabled .select2-choices {
626
+ background-color: #f4f4f4;
627
+ background-image: none;
628
+ border: 1px solid #ddd;
629
+ cursor: default;
630
+ }
631
+
632
+ .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
633
+ padding: 3px 5px 3px 5px;
634
+ border: 1px solid #ddd;
635
+ background-image: none;
636
+ background-color: #f4f4f4;
637
+ }
638
+
639
+ .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
640
+ background: none;
641
+ }
642
+ /* end multiselect */
643
+
644
+
645
+ .select2-result-selectable .select2-match,
646
+ .select2-result-unselectable .select2-match {
647
+ text-decoration: underline;
648
+ }
649
+
650
+ .select2-offscreen, .select2-offscreen:focus {
651
+ clip: rect(0 0 0 0) !important;
652
+ width: 1px !important;
653
+ height: 1px !important;
654
+ border: 0 !important;
655
+ margin: 0 !important;
656
+ padding: 0 !important;
657
+ overflow: hidden !important;
658
+ position: absolute !important;
659
+ outline: 0 !important;
660
+ left: 0px !important;
661
+ top: 0px !important;
662
+ }
663
+
664
+ .select2-display-none {
665
+ display: none;
666
+ }
667
+
668
+ .select2-measure-scrollbar {
669
+ position: absolute;
670
+ top: -10000px;
671
+ left: -10000px;
672
+ width: 100px;
673
+ height: 100px;
674
+ overflow: scroll;
675
+ }
676
+
677
+ /* Retina-ize icons */
678
+
679
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
680
+ .select2-search input,
681
+ .select2-search-choice-close,
682
+ .select2-container .select2-choice abbr,
683
+ .select2-container .select2-choice .select2-arrow b {
684
+ background-image: url('select2x2.png') !important;
685
+ background-repeat: no-repeat !important;
686
+ background-size: 60px 40px !important;
687
+ }
688
+
689
+ .select2-search input {
690
+ background-position: 100% -21px !important;
691
+ }
692
+ }
693
+
694
+
695
+ /*!
696
+ * select2-skins
697
+ * Released under MIT. Copyright 2014 Mienard Lumaad
698
+ * http://ui.themepixels.com/select2-skins
699
+ *
700
+ * Github Repository: https://github.com/themepixels/select2-skins
701
+ *
702
+ */.tpx-select2-container{font-family:'Helvetica Neue',Helvetica,sans-serif}.tpx-select2-container .select2-choice{height:34px;background-image:none;border-radius:3px;border-color:rgba(0,0,0,0.2)}.tpx-select2-container .select2-choice>.select2-chosen{line-height:30px;font-size:14px;margin-right:34px}.tpx-select2-container .select2-choice .select2-arrow{background-image:none;background-color:#fff;width:30px;border-left-color:rgba(0,0,0,0.2)}.tpx-select2-container .select2-choice .select2-arrow b{display:none}.tpx-select2-container .select2-choice .select2-arrow:before{position:absolute;width:28px;content:'\f078';font-family:'FontAwesome';font-size:12px;text-align:center;line-height:32px;opacity:.5}.tpx-select2-container.select2-dropdown-open .select2-choice{background-color:#fff;border-bottom-left-radius:0;border-bottom-right-radius:0}.tpx-select2-container.select2-dropdown-open .select2-choice .select2-arrow{border-left:1px solid rgba(0,0,0,0.2)}.tpx-select2-container.select2-dropdown-open .select2-choice .select2-arrow:before{content:'\f077';opacity:.7}.tpx-select2-container.select2-dropdown-open.select2-container-active .select2-choice{box-shadow:none}.tpx-select2-container.select2-dropdown-open.select2-drop-above .select2-choice{background-image:none;border-top:1px solid rgba(0,0,0,0.3);border-radius:0 0 3px 3px}.tpx-select2-container.select2-container-active .select2-choice{border-color:rgba(0,0,0,0.3);box-shadow:0 0 3px rgba(0,0,0,0.2)}.tpx-select2-container.select2-container-active .select2-choice .select2-arrow{border-left-color:rgba(0,0,0,0.3)}.tpx-select2-container .select2-drop-active{border-color:rgba(0,0,0,0.3)}.tpx-select2-container.select2-container-disabled .select2-choice .select2-arrow{border-left:1px solid rgba(0,0,0,0.1)}.tpx-select2-container.select2-container-multi .select2-choices{min-height:34px;background-image:none;border-color:rgba(0,0,0,0.2);border-radius:3px}.tpx-select2-container.select2-container-multi .select2-choices .select2-search-choice{position:relative;border-color:rgba(0,0,0,0.2);background-image:none;box-shadow:none;font-size:13px;background-color:#f7f7f7;border-radius:2px;padding-top:4px;padding-bottom:4px;line-height:16px;margin-left:3px;margin-bottom:0}.tpx-select2-container.select2-container-multi .select2-choices .select2-search-choice:before{position:absolute;top:4px;left:5px;font-family:'FontAwesome';content:'\f00d';z-index:5;font-size:11px}.tpx-select2-container.select2-container-multi .select2-choices .select2-search-field input{font-family:'Helvetica Neue',Helvetica,sans-serif;font-size:14px;margin:0;padding-left:8px;line-height:21px}.tpx-select2-container.select2-container-multi.select2-container-active .select2-choices{box-shadow:0 0 3px rgba(0,0,0,0.2);border-color:rgba(0,0,0,0.3)}.tpx-select2-container.select2-container-multi.select2-container-active.select2-dropdown-open .select2-choices{border-radius:3px 3px 0 0}.tpx-select2-container.select2-container-multi.select2-container-active.select2-drop-above .select2-choices{border-radius:0 0 3px 3px}.tpx-select2-container .select2-search-choice-close{top:5px;background:none;z-index:10}.tpx-select2-drop{font-family:'Helvetica Neue',Helvetica,sans-serif;border-color:rgba(0,0,0,0.3);box-shadow:0 3px 3px rgba(0,0,0,0.15);border-top:1px solid rgba(0,0,0,0.3);border-radius:0 0 3px 3px}.tpx-select2-drop .select2-search{padding-top:5px;position:relative}.tpx-select2-drop .select2-search input{background-color:#fff;background-image:none;border-color:rgba(0,0,0,0.3);font-size:14px;padding:7px 20px 7px 5px}.tpx-select2-drop .select2-search:after{position:absolute;font-family:'FontAwesome';content:'\f002';top:10px;right:12px;font-size:15px;opacity:.5}.tpx-select2-drop .select2-results{font-size:14px}.tpx-select2-drop .select2-results li{line-height:1.42857}.tpx-select2-drop .select2-results .select2-highlighted{background-color:#428bca;border-radius:2px}.tpx-select2-drop.select2-drop-above{border-radius:3px 3px 0 0;border-bottom:1px solid rgba(0,0,0,0.3)}.tpx-select2-drop.select2-drop-above .select2-search input{margin-top:0}.tpx-select2-drop.select2-drop-above.select2-drop-active{border-top-color:rgba(0,0,0,0.3)}.select2-container-lg .select2-choice{height:46px;padding-left:12px}.select2-container-lg .select2-choice .select2-arrow{width:40px}.select2-container-lg .select2-choice .select2-arrow:before{width:38px;font-size:17px;top:6px}.select2-container-lg .select2-choice>.select2-chosen{font-size:16px;line-height:44px}.select2-container-lg.select2-container-multi .select2-choices{min-height:46px}.select2-container-lg.select2-container-multi .select2-choices .select2-search-field input{font-size:16px;padding-top:11px;padding-bottom:11px;padding-left:10px}.select2-container-lg.select2-container-multi .select2-choices .select2-search-choice{padding-top:10px;padding-bottom:10px;padding-right:10px;padding-left:25px;font-size:15px}.select2-container-lg.select2-container-multi .select2-choices .select2-search-choice:before{top:10px;left:8px}.select2-container-lg.select2-container-multi .select2-search-choice-close{top:12px;left:8px}.select2-container-sm .select2-choice{height:30px}.select2-container-sm .select2-choice .select2-arrow{width:28px}.select2-container-sm .select2-choice .select2-arrow:before{line-height:26px;width:26px;font-size:10px}.select2-container-sm .select2-choice>.select2-chosen{font-size:12px;line-height:26px}.select2-container-sm.select2-container-multi .select2-choices{min-height:30px}.select2-container-sm.select2-container-multi .select2-choices .select2-search-field input{padding-bottom:3px;padding-top:3px;font-size:12px;padding-left:8px}.select2-container-sm.select2-container-multi .select2-choices .select2-search-choice{font-size:11px;line-height:12px}.select2-container-sm.select2-container-multi .select2-search-choice-close{top:3px}.select2-drop-sm .select2-search input{font-size:12px}.select2-drop-sm .select2-results{font-size:12px}.tpx-select2-container.select2-error .select2-choice{border-color:#c00;background-color:#fff;box-shadow:none;color:#333}.tpx-select2-container.select2-error .select2-choice .select2-arrow{border-left-color:#c00;background-color:#fff;color:#333}.tpx-select2-container.select2-error .select2-default .select2-chosen{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-error.select2-container-multi .select2-choices .select2-search-choice{border-color:#b30000;background-color:#fff;color:#333}.tpx-select2-container.select2-error.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-error.select2-container-active .select2-choice{border-color:#a80000}.tpx-select2-container.select2-error.select2-container-active .select2-choice .select2-arrow{border-left-color:#a80000}.tpx-select2-drop.select2-error{border-color:#a80000;background-color:#fff}.tpx-select2-drop.select2-error .select2-search input{border-color:#a80000}.tpx-select2-drop.select2-error .select2-results{color:#333}.tpx-select2-drop.select2-error .select2-highlighted{background-color:#ccc}.tpx-select2-container.select2-success .select2-choice{border-color:#3c763d;background-color:#fff;box-shadow:none;color:#333}.tpx-select2-container.select2-success .select2-choice .select2-arrow{border-left-color:#3c763d;background-color:#fff;color:#333}.tpx-select2-container.select2-success .select2-default .select2-chosen{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-success.select2-container-multi .select2-choices .select2-search-choice{border-color:#336534;background-color:#fff;color:#333}.tpx-select2-container.select2-success.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-success.select2-container-active .select2-choice{border-color:#305e31}.tpx-select2-container.select2-success.select2-container-active .select2-choice .select2-arrow{border-left-color:#305e31}.tpx-select2-drop.select2-success{border-color:#305e31;background-color:#fff}.tpx-select2-drop.select2-success .select2-search input{border-color:#305e31}.tpx-select2-drop.select2-success .select2-results{color:#333}.tpx-select2-drop.select2-success .select2-highlighted{background-color:#ccc}.tpx-select2-container.select2-warning .select2-choice{border-color:#c0753b;background-color:#fff;box-shadow:none;color:#333}.tpx-select2-container.select2-warning .select2-choice .select2-arrow{border-left-color:#c0753b;background-color:#fff;color:#333}.tpx-select2-container.select2-warning .select2-default .select2-chosen{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-warning.select2-container-multi .select2-choices .select2-search-choice{border-color:#ac6935;background-color:#fff;color:#333}.tpx-select2-container.select2-warning.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-warning.select2-container-active .select2-choice{border-color:#a56433}.tpx-select2-container.select2-warning.select2-container-active .select2-choice .select2-arrow{border-left-color:#a56433}.tpx-select2-drop.select2-warning{border-color:#a56433;background-color:#fff}.tpx-select2-drop.select2-warning .select2-search input{border-color:#a56433}.tpx-select2-drop.select2-warning .select2-results{color:#333}.tpx-select2-drop.select2-warning .select2-highlighted{background-color:#ccc}.tpx-select2-container.select2-grey .select2-choice{border-color:#ccc;background-color:#eee;box-shadow:none;color:#333}.tpx-select2-container.select2-grey .select2-choice .select2-arrow{border-left-color:#ccc;background-color:#eee;color:#333}.tpx-select2-container.select2-grey .select2-default .select2-chosen{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-grey.select2-container-multi .select2-choices .select2-search-choice{border-color:#bfbfbf;background-color:#eee;color:#333}.tpx-select2-container.select2-grey.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(51,51,51,0.5)}.tpx-select2-container.select2-grey.select2-container-active .select2-choice{border-color:#bababa}.tpx-select2-container.select2-grey.select2-container-active .select2-choice .select2-arrow{border-left-color:#bababa}.tpx-select2-drop.select2-grey{border-color:#bababa;background-color:#eee}.tpx-select2-drop.select2-grey .select2-search input{border-color:#bababa}.tpx-select2-drop.select2-grey .select2-results{color:#333}.tpx-select2-drop.select2-grey .select2-highlighted{background-color:#bbb}.tpx-select2-container.select2-darkgrey .select2-choice{border-color:#555;background-color:#666;box-shadow:none;color:#fff}.tpx-select2-container.select2-darkgrey .select2-choice .select2-arrow{border-left-color:#555;background-color:#666;color:#fff}.tpx-select2-container.select2-darkgrey .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-darkgrey.select2-container-multi .select2-choices .select2-search-choice{border-color:#484848;background-color:#666;color:#fff}.tpx-select2-container.select2-darkgrey.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-darkgrey.select2-container-active .select2-choice{border-color:#434343}.tpx-select2-container.select2-darkgrey.select2-container-active .select2-choice .select2-arrow{border-left-color:#434343}.tpx-select2-drop.select2-darkgrey{border-color:#434343;background-color:#666}.tpx-select2-drop.select2-darkgrey .select2-search input{border-color:#434343}.tpx-select2-drop.select2-darkgrey .select2-results{color:#fff}.tpx-select2-drop.select2-darkgrey .select2-highlighted{background-color:#333}.tpx-select2-container.select2-lightblue .select2-choice{border-color:#bce8f1;background-color:#ebf6fc;box-shadow:none;color:#31708f}.tpx-select2-container.select2-lightblue .select2-choice .select2-arrow{border-left-color:#bce8f1;background-color:#ebf6fc;color:#31708f}.tpx-select2-container.select2-lightblue .select2-default .select2-chosen{color:rgba(49,112,143,0.5)}.tpx-select2-container.select2-lightblue.select2-container-multi .select2-choices .select2-search-choice{border-color:#a7e1ed;background-color:#ebf6fc;color:#31708f}.tpx-select2-container.select2-lightblue.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(49,112,143,0.5)}.tpx-select2-container.select2-lightblue.select2-container-active .select2-choice{border-color:#9edeeb}.tpx-select2-container.select2-lightblue.select2-container-active .select2-choice .select2-arrow{border-left-color:#9edeeb}.tpx-select2-drop.select2-lightblue{border-color:#9edeeb;background-color:#ebf6fc}.tpx-select2-drop.select2-lightblue .select2-search input{border-color:#9edeeb}.tpx-select2-drop.select2-lightblue .select2-results{color:#31708f}.tpx-select2-drop.select2-lightblue .select2-highlighted{background-color:#92ceef}.tpx-select2-container.select2-blue .select2-choice{border-color:#2e83cf;background-color:#3f8cd3;box-shadow:none;color:#fff}.tpx-select2-container.select2-blue .select2-choice .select2-arrow{border-left-color:#2e83cf;background-color:#3f8cd3;color:#fff}.tpx-select2-container.select2-blue .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-blue.select2-container-multi .select2-choices .select2-search-choice{border-color:#2976ba;background-color:#3f8cd3;color:#fff}.tpx-select2-container.select2-blue.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-blue.select2-container-active .select2-choice{border-color:#2871b2}.tpx-select2-container.select2-blue.select2-container-active .select2-choice .select2-arrow{border-left-color:#2871b2}.tpx-select2-drop.select2-blue{border-color:#2871b2;background-color:#3f8cd3}.tpx-select2-drop.select2-blue .select2-search input{border-color:#2871b2}.tpx-select2-drop.select2-blue .select2-results{color:#fff}.tpx-select2-drop.select2-blue .select2-highlighted{background-color:#20588c}.tpx-select2-container.select2-lime .select2-choice{border-color:#8ec400;background-color:#9dd800;box-shadow:none;color:#fff}.tpx-select2-container.select2-lime .select2-choice .select2-arrow{border-left-color:#8ec400;background-color:#9dd800;color:#fff}.tpx-select2-container.select2-lime .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-lime.select2-container-multi .select2-choices .select2-search-choice{border-color:#7caa00;background-color:#9dd800;color:#fff}.tpx-select2-container.select2-lime.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-lime.select2-container-active .select2-choice{border-color:#74a000}.tpx-select2-container.select2-lime.select2-container-active .select2-choice .select2-arrow{border-left-color:#74a000}.tpx-select2-drop.select2-lime{border-color:#74a000;background-color:#9dd800}.tpx-select2-drop.select2-lime .select2-search input{border-color:#74a000}.tpx-select2-drop.select2-lime .select2-results{color:#fff}.tpx-select2-drop.select2-lime .select2-highlighted{background-color:#537200}.tpx-select2-container.select2-pomelo .select2-choice{border-color:#ff6034;background-color:#ff744e;box-shadow:none;color:#fff}.tpx-select2-container.select2-pomelo .select2-choice .select2-arrow{border-left-color:#ff6034;background-color:#ff744e;color:#fff}.tpx-select2-container.select2-pomelo .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-pomelo.select2-container-multi .select2-choices .select2-search-choice{border-color:#ff4c1b;background-color:#ff744e;color:#fff}.tpx-select2-container.select2-pomelo.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-pomelo.select2-container-active .select2-choice{border-color:#f41}.tpx-select2-container.select2-pomelo.select2-container-active .select2-choice .select2-arrow{border-left-color:#f41}.tpx-select2-drop.select2-pomelo{border-color:#f41;background-color:#ff744e}.tpx-select2-drop.select2-pomelo .select2-search input{border-color:#f41}.tpx-select2-drop.select2-pomelo .select2-results{color:#fff}.tpx-select2-drop.select2-pomelo .select2-highlighted{background-color:#e73200}.tpx-select2-container.select2-orange .select2-choice{border-color:#e69800;background-color:#ffa900;box-shadow:none;color:#fff}.tpx-select2-container.select2-orange .select2-choice .select2-arrow{border-left-color:#e69800;background-color:#ffa900;color:#fff}.tpx-select2-container.select2-orange .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-orange.select2-container-multi .select2-choices .select2-search-choice{border-color:#cc8700;background-color:#ffa900;color:#fff}.tpx-select2-container.select2-orange.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-orange.select2-container-active .select2-choice{border-color:#c28000}.tpx-select2-container.select2-orange.select2-container-active .select2-choice .select2-arrow{border-left-color:#c28000}.tpx-select2-drop.select2-orange{border-color:#c28000;background-color:#ffa900}.tpx-select2-drop.select2-orange .select2-search input{border-color:#c28000}.tpx-select2-drop.select2-orange .select2-results{color:#fff}.tpx-select2-drop.select2-orange .select2-highlighted{background-color:#996500}.tpx-select2-container.select2-bluegreen .select2-choice{border-color:#00b7b1;background-color:#00d0ca;box-shadow:none;color:#fff}.tpx-select2-container.select2-bluegreen .select2-choice .select2-arrow{border-left-color:#00b7b1;background-color:#00d0ca;color:#fff}.tpx-select2-container.select2-bluegreen .select2-default .select2-chosen{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-bluegreen.select2-container-multi .select2-choices .select2-search-choice{border-color:#009d98;background-color:#00d0ca;color:#fff}.tpx-select2-container.select2-bluegreen.select2-container-multi .select2-choices .select2-search-choice:before{color:rgba(255,255,255,0.5)}.tpx-select2-container.select2-bluegreen.select2-container-active .select2-choice{border-color:#00938f}.tpx-select2-container.select2-bluegreen.select2-container-active .select2-choice .select2-arrow{border-left-color:#00938f}.tpx-select2-drop.select2-bluegreen{border-color:#00938f;background-color:#00d0ca}.tpx-select2-drop.select2-bluegreen .select2-search input{border-color:#00938f}.tpx-select2-drop.select2-bluegreen .select2-results{color:#fff}.tpx-select2-drop.select2-bluegreen .select2-highlighted{background-color:#006a67}
js/select2/select2.min.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright 2014 Igor Vaynberg
3
+
4
+ Version: 3.5.4 Timestamp: Sun Aug 30 13:30:32 EDT 2015
5
+
6
+ This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
+ General Public License version 2 (the "GPL License"). You may choose either license to govern your
8
+ use of this software only upon the condition that you accept all of the terms of either the Apache
9
+ License or the GPL License.
10
+
11
+ You may obtain a copy of the Apache License and the GPL License at:
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+ http://www.gnu.org/licenses/gpl-2.0.html
15
+
16
+ Unless required by applicable law or agreed to in writing, software distributed under the Apache License
17
+ or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18
+ either express or implied. See the Apache License and the GPL License for the specific language governing
19
+ permissions and limitations under the Apache License and the GPL License.
20
+ */
21
+ !function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function o(a){function b(a){return m[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function p(a,b){for(var c=0,d=b.length;d>c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;f>e;e+=1)d[e]=c(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=h;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!g){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);g=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),g.attr("class","select2-sizer"),a(document.body).append(g)}return g.text(b.val()),g.width()}function D(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?void c.push(d(a)):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),void c.push(d(a.substring(e+f,a.length))))}function F(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?void b.callback(c()):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),void b.callback(e))}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,i,j,h={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038a":"\u0399","\u03aa":"\u0399","\u038c":"\u039f","\u038e":"\u03a5","\u03ab":"\u03a5","\u038f":"\u03a9","\u03ac":"\u03b1","\u03ad":"\u03b5","\u03ae":"\u03b7","\u03af":"\u03b9","\u03ca":"\u03b9","\u0390":"\u03b9","\u03cc":"\u03bf","\u03cd":"\u03c5","\u03cb":"\u03c5","\u03b0":"\u03c5","\u03c9":"\u03c9","\u03c2":"\u03c3"};i=a(document),f=function(){var a=1;return function(){return a++}}(),c=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+f()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss,this.opts.element)),this.container.addClass(K(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(a){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.lastSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),j=j||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.removeData("select2").off(".select2"),a.is("input[type='hidden']")?a.css("display",""):(a.show().prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,g,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c.debug=c.debug||a.fn.select2.defaults.debug,c.debug&&console&&console.warn&&(null!=c.id&&console.warn("Select2: The `id` option has been removed in Select2 4.0.0, consider renaming your `id` property or mapping the property before your data makes it to Select2. You can read more at https://select2.github.io/announcements-4.0.html#changed-id"),null!=c.text&&console.warn("Select2: The `text` option has been removed in Select2 4.0.0, consider renaming your `text` property or mapping the property before your data makes it to Select2. You can read more at https://select2.github.io/announcements-4.0.html#changed-id"),null!=c.sortResults&&console.warn("Select2: the `sortResults` option has been renamed to `sorter` in Select2 4.0.0. "),null!=c.selectOnBlur&&console.warn("Select2: The `selectOnBlur` option has been renamed to `selectOnClose` in Select2 4.0.0."),null!=c.ajax&&null!=c.ajax.results&&console.warn("Select2: The `ajax.results` option has been renamed to `ajax.processResults` in Select2 4.0.0."),null!=c.formatNoResults&&console.warn("Select2: The `formatNoResults` option has been renamed to `language.noResults` in Select2 4.0.0."),null!=c.formatSearching&&console.warn("Select2: The `formatSearching` option has been renamed to `language.searching` in Select2 4.0.0."),null!=c.formatInputTooShort&&console.warn("Select2: The `formatInputTooShort` option has been renamed to `language.inputTooShort` in Select2 4.0.0."),null!=c.formatInputTooLong&&console.warn("Select2: The `formatInputTooLong` option has been renamed to `language.inputTooLong` in Select2 4.0.0."),null!=c.formatLoading&&console.warn("Select2: The `formatLoading` option has been renamed to `language.loadingMore` in Select2 4.0.0."),null!=c.formatSelectionTooBig&&console.warn("Select2: The `formatSelectionTooBig` option has been renamed to `language.maximumSelected` in Select2 4.0.0."),c.element.data("select2Tags")&&console.warn("Select2: The `data-select2-tags` attribute has been renamed to `data-tags` in Select2 4.0.0.")),null!=c.element.data("tags")){var j=c.element.data("tags");a.isArray(j)||(j=[]),c.element.data("select2Tags",j)}if(null!=c.sorter&&(c.sortResults=c.sorter),null!=c.selectOnClose&&(c.selectOnBlur=c.selectOnClose),null!=c.ajax&&a.isFunction(c.ajax.processResults)&&(c.ajax.results=c.ajax.processResults),null!=c.language){var k=c.language;a.isFunction(k.noMatches)&&(c.formatNoMatches=k.noMatches),a.isFunction(k.searching)&&(c.formatSearching=k.searching),a.isFunction(k.inputTooShort)&&(c.formatInputTooShort=k.inputTooShort),a.isFunction(k.inputTooLong)&&(c.formatInputTooLong=k.inputTooLong),a.isFunction(k.loadingMore)&&(c.formatLoading=k.loadingMore),a.isFunction(k.maximumSelected)&&(c.formatSelectionTooBig=k.maximumSelected)}if(c=a.extend({},{populateResults:function(d,e,g){var h,j=this.opts.id,k=this.liveRegion;(h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;d=c.sortResults(d,e,g);var w=[];for(m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a("<li></li>"),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+f()),t.attr("role","option"),v=c.formatResult(o,t,g,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a("<ul></ul>"),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),w.push(s[0]);e.append(w),k.text(c.formatMatches(d.length))})(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(g=c.id,c.id=function(a){return a[g]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var d,c=this.opts.element,e=this;c.on("change.select2",this.bind(function(a){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=c.prop("disabled");a===b&&(a=!1),this.enable(!a);var d=c.prop("readonly");d===b&&(d=!1),this.readonly(d),this.container&&(D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass,this.opts.element)))}),c.length&&c[0].attachEvent&&c.each(function(){this.attachEvent("onpropertychange",e._sync)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(c.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var v,w,x,y,z,b=this.dropdown,c=this.container,d=c.offset(),e=c.outerHeight(!1),f=c.outerWidth(!1),g=b.outerHeight(!1),h=a(window),i=h.width(),k=h.height(),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,p=m>=n+g,q=d.top-g>=h.scrollTop(),r=b.outerWidth(!1),s=function(){return l>=o+r},t=function(){return d.left+l+c.outerWidth(!1)>r},u=b.hasClass("select2-drop-above");u?(w=!0,!q&&p&&(x=!0,w=!1)):(w=!1,!p&&q&&(x=!0,w=!0)),x&&(b.hide(),d=this.container.offset(),e=this.container.outerHeight(!1),f=this.container.outerWidth(!1),g=b.outerHeight(!1),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,r=b.outerWidth(!1),b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(z=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),r=b.outerWidth(!1)+(z.scrollHeight===z.clientHeight?0:j.width),r>f?f=r:r=f,g=b.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(v=this.body.offset(),n-=v.top,o-=v.left),!s()&&t()&&(o=d.left+this.container.outerWidth(!1)-r),y={left:o,width:f},w?(this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above"),g=b.outerHeight(!1),y.top=d.top-g,y.bottom="auto"):(y.top=n,y.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),y=a.extend(y,K(this.opts.dropdownCss,this.opts.element)),b.css(y)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),
22
+ this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),i.on("mousemove.select2Event",function(a){h.x=a.pageX,h.y=a.pageY}),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0===f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(a){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),i.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.search.removeAttr("aria-activedescendant"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},prefillNextSearchTerm:function(){if(""!==this.search.val())return!1;var a=this.opts.nextSearchTerm(this.data(),this.lastSearchTerm);return a!==b?(this.search.val(a),this.search.select(),!0):!1},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,j,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return void b.scrollTop(0);c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),j=(e.offset()||{}).top||0,f=j+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!1),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=j-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?p(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),void(e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).html(e.opts.escapeMarkup(K(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find('.select2-result-selectable:not(".select2-selected")').length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return void n("<li class='select2-selection-limit'>"+K(f.formatSelectionTooBig,f.element,o)+"</li>");if(d.val().length<f.minimumInputLength)return n(J(f.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+K(f.formatInputTooShort,f.element,d.val(),f.minimumInputLength)+"</li>":""),void(c&&this.showSearch&&this.showSearch(!0));if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return void n(J(f.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+K(f.formatInputTooLong,f.element,d.val(),f.maximumInputLength)+"</li>":"");f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+K(f.formatSearching,f.element)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(g.hasError!==b&&J(f.formatAjaxError,"formatAjaxError"))return void n("<li class='select2-ajax-error'>"+K(f.formatAjaxError,f.element,g.jqXHR,g.textStatus,g.errorThrown)+"</li>");if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+K(f.formatNoMatches,f.element,d.val())+"</li>"),void(this.showSearch&&this.showSearch(d.val()));e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+f.escapeMarkup(K(f.formatLoadMore,f.element,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return void this.clearTouchMoved();var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function b(){var b,c,d,e,f,g;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(b=this.opts.element.attr("style"),"string"==typeof b)for(c=b.split(";"),e=0,f=c.length;f>e;e+=1)if(g=c[e].replace(/\s/g,""),d=g.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==d&&d.length>=1)return d[1];return"resolve"===this.opts.width?(b=this.opts.element.css("width"),b.indexOf("%")>0?b:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var c=b.call(this);null!==c&&this.container.css("width",c)}}),d=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var b,c,d;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),b=this.search.get(0),b.createTextRange?(c=b.createTextRange(),c.collapse(!1),c.select()):b.setSelectionRange&&(d=this.search.val().length,b.setSelectionRange(d,d))),this.prefillNextSearchTerm(),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,g,c=this.container,d=this.dropdown,e=f();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=c.find(".select2-choice"),this.focusser=c.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+e),this.focusser.attr("aria-labelledby","select2-chosen-"+e),this.results.attr("id","select2-results-"+e),this.search.attr("aria-owns","select2-results-"+e),this.focusser.attr("id","s2id_autogen"+e),g=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.on("focus.select2",this.bind(function(){this.focus()})),this.focusser.prev().text(g.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||g.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)return void A(a);switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),void A(a);case k.ENTER:return this.selectHighlighted(),void A(a);case k.TAB:return void this.selectHighlighted({noFocus:!0});case k.ESC:return this.cancel(a),void A(a)}}})),this.search.on("blur",this.bind(function(a){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.results&&this.results.length>1&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.ESC){if(this.opts.openOnEnter===!1&&a.which===k.ENTER)return void A(a);if(a.which==k.DOWN||a.which==k.UP||a.which==k.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),void A(a)}return a.which==k.DELETE||a.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),void A(a)):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection&&this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),d.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.lastSearchTerm=c.search.val())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.lastSearchTerm=this.search.val(),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1],this.opts.debug&&console&&console.warn&&console.warn('Select2: The second option to `select2("val")` is not supported in Select2 4.0.0. The `change` event will always be triggered in 4.0.0.')),this.select)this.opts.debug&&console&&console.warn&&console.warn('Select2: Setting the value on a <select> using `select2("val")` is no longer supported in 4.0.0. You can use the `.val(newValue).trigger("change")` method provided by jQuery instead.'),this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return void this.clear(c);if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(this.opts.debug&&console&&console.warn&&console.warn('Select2: The `select2("data")` method can no longer set selected values in 4.0.0, consider using the `.val()` method instead.'),arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),e=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(r(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"searchContainer","selection")},initContainer:function(){var c,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=c=this.container.find(b);var d=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(b){d.search[0].focus(),d.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+f()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.on("focus.select2",this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=c.find(".select2-search-choice-focus"),d=b.prev(".select2-search-choice:not(.select2-locked)"),e=b.next(".select2-search-choice:not(.select2-locked)"),f=z(this.search);if(b.length&&(a.which==k.LEFT||a.which==k.RIGHT||a.which==k.BACKSPACE||a.which==k.DELETE||a.which==k.ENTER)){var g=b;return a.which==k.LEFT&&d.length?g=d:a.which==k.RIGHT?g=e.length?e:null:a.which===k.BACKSPACE?this.unselect(b.first())&&(this.search.width(10),g=d.length?d:e):a.which==k.DELETE?this.unselect(b.first())&&(this.search.width(10),g=e.length?e:null):a.which==k.ENTER&&(g=null),this.selectChoice(g),A(a),void(g&&g.length||this.open())}if((a.which===k.BACKSPACE&&1==this.keydowns||a.which==k.LEFT)&&0==f.offset&&!f.length)return this.selectChoice(c.find(".select2-search-choice:not(.select2-locked)").last()),void A(a);if(this.selectChoice(null),this.opened())switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),void A(a);case k.ENTER:return this.selectHighlighted(),void A(a);case k.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case k.ESC:return this.cancel(a),void A(a)}if(a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.BACKSPACE&&a.which!==k.ESC){if(a.which===k.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)&&A(a),a.which===k.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(a){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.prefillNextSearchTerm(),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c={},d=[],e=this;a(b).each(function(){e.id(this)in c||(c[e.id(this)]=0,d.push(this))}),this.selection.find(".select2-search-choice").remove(),this.addSelectedChoice(d),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.lastSearchTerm=this.search.val(),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.prefillNextSearchTerm()&&this.updateResults(),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(b){var c=this.getVal(),d=this;a(b).each(function(){c.push(d.createChoice(this))}),this.setVal(c)},createChoice:function(c){var i,j,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c);return i=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),i!=b&&g.find("div").replaceWith(a("<div></div>").html(i)),j=this.opts.formatSelectionCssClass(c,g.find("div")),j!=b&&g.addClass(j),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),h},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&this.opts.closeOnSelect===!0&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+K(g.opts.formatNoMatches,g.opts.element,g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){if(this.select)this.select.val(b);else{var c=[],d={};a(b).each(function(){this in d||(c.push(this),d[this]=0)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator))}},buildChangeDetails:function(a,b){
23
+ for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)if(r(this.opts.id(b[c]),this.opts.id(a[d]))){b.splice(c,1),c--,a.splice(d,1);break}return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(d&&this.triggerChange({added:this.data(),removed:e}));if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={debug:!1,width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a,b,c){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(a,c){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text},matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(a){return null},nextSearchTerm:function(a,c){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b&&a.opts.minimumResultsForSearch<0?!1:!0}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(a,b,c){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(a){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":c,single:d,multi:e}}}}(jQuery);
js/settings.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global console,ajaxurl,$,jQuery*/
2
+
3
+ /**
4
+ *
5
+ */
6
+ jQuery(function ($) {
7
+ "use strict";
8
+
9
+ if ($('#codemirror').length) {
10
+ var codeMirror = CodeMirror.fromTextArea(document.getElementById('codemirror'), {
11
+ tabMode: 'indent',
12
+ lineNumbers: true,
13
+ lineWrapping: true,
14
+ onChange: function(cm) {
15
+ cm.save();
16
+ }
17
+ });
18
+ }
19
+
20
+ $('.mega-custom_styling > h4').on('click', function() {
21
+ setTimeout( function() {
22
+ $('.mega-custom_styling').find('.CodeMirror').each(function(key, value) {
23
+ value.CodeMirror.refresh();
24
+ });
25
+ }, 160);
26
+ });
27
+
28
+ $(".mm_colorpicker").spectrum({
29
+ preferredFormat: "rgb",
30
+ showInput: true,
31
+ showAlpha: true,
32
+ clickoutFiresChange: true,
33
+ change: function(color) {
34
+ if (color.getAlpha() === 0) {
35
+ $(this).siblings('div.chosen-color').html('transparent');
36
+ } else {
37
+ $(this).siblings('div.chosen-color').html(color.toRgbString());
38
+ }
39
+ }
40
+ });
41
+
42
+ $(".confirm").on("click", function() {
43
+ return confirm(megamenu_settings.confirm);
44
+ });
45
+
46
+ $('#theme_selector').bind('change', function () {
47
+ var url = $(this).val();
48
+ if (url) {
49
+ window.location = url;
50
+ }
51
+ return false;
52
+ });
53
+
54
+ $('.mega-location-header').on("click", function(e) {
55
+ if (e.target.nodeName.toLowerCase() != 'a') {
56
+ $(this).parent().toggleClass('mega-closed').toggleClass('mega-open');
57
+ $(this).siblings('.mega-inner').slideToggle();
58
+ }
59
+ });
60
+
61
+ $('.icon_dropdown').select2({
62
+ containerCssClass: 'tpx-select2-container select2-container-sm',
63
+ dropdownCssClass: 'tpx-select2-drop',
64
+ minimumResultsForSearch: -1,
65
+ formatResult: function(icon) {
66
+ return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
67
+ },
68
+ formatSelection: function (icon) {
69
+ return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
70
+ }
71
+ });
72
+
73
+
74
+ $('select#mega_css').on("change", function() {
75
+ var select = $(this);
76
+ var selected = $(this).val();
77
+ select.next().children().hide();
78
+ select.next().children('.' + selected).show();
79
+ });
80
+
81
+ $('form.theme_editor label[data-validation]').each(function() {
82
+ var label = $(this);
83
+ var validation = label.attr('data-validation');
84
+ var error_message = label.siblings( '.mega-validation-message-' + label.attr('class') );
85
+ var input = $('input', label);
86
+
87
+ input.on('blur', function() {
88
+
89
+ var value = $(this).val();
90
+
91
+ if ( ( validation == 'int' && Math.floor(value) != value )
92
+ || ( validation == 'px' && ! ( value.substr(value.length - 2) == 'px' || value.substr(value.length - 2) == 'em' || value.substr(value.length - 2) == 'pt' || value.substr(value.length - 3) == 'rem' || value.substr(value.length - 1) == '%' ) && value != 0 )
93
+ || ( validation == 'float' && ! $.isNumeric(value) ) ) {
94
+ label.addClass('mega-error');
95
+ error_message.show();
96
+ } else {
97
+ label.removeClass('mega-error');
98
+ label.siblings( '.mega-validation-message-' + label.attr('class') ).hide();
99
+ }
100
+
101
+ });
102
+
103
+ });
104
+
105
+ });
js/spectrum/spectrum.css ADDED
@@ -0,0 +1,446 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***
2
+ Spectrum Colorpicker v1.1.0
3
+ https://github.com/bgrins/spectrum
4
+ Author: Brian Grinstead
5
+ License: MIT
6
+ ***/
7
+
8
+ .sp-container {
9
+ position:absolute;
10
+ top:0;
11
+ left:0;
12
+ display:inline-block;
13
+ *display: inline;
14
+ *zoom: 1;
15
+ z-index: 2147483647;
16
+ overflow: hidden;
17
+ }
18
+ .sp-container.sp-flat {
19
+ position: relative;
20
+ }
21
+
22
+ /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
23
+ .sp-top {
24
+ position:relative;
25
+ width: 100%;
26
+ display:inline-block;
27
+ }
28
+ .sp-top-inner {
29
+ position:absolute;
30
+ top:0;
31
+ left:0;
32
+ bottom:0;
33
+ right:0;
34
+ }
35
+ .sp-color {
36
+ position: absolute;
37
+ top:0;
38
+ left:0;
39
+ bottom:0;
40
+ right:20%;
41
+ }
42
+ .sp-hue {
43
+ position: absolute;
44
+ top:0;
45
+ right:0;
46
+ bottom:0;
47
+ left:84%;
48
+ height: 100%;
49
+ }
50
+ .sp-fill {
51
+ padding-top: 80%;
52
+ }
53
+ .sp-sat, .sp-val {
54
+ position: absolute;
55
+ top:0;
56
+ left:0;
57
+ right:0;
58
+ bottom:0;
59
+ }
60
+
61
+ .sp-alpha-enabled .sp-top
62
+ {
63
+ margin-bottom: 18px;
64
+ }
65
+ .sp-alpha-enabled .sp-alpha
66
+ {
67
+ display: block;
68
+ }
69
+
70
+ .sp-alpha-handle
71
+ {
72
+ position:absolute;
73
+ top:-4px;
74
+ bottom: -4px;
75
+ width: 6px;
76
+ left: 50%;
77
+ cursor: pointer;
78
+ border: 1px solid black;
79
+ background: white;
80
+ opacity: .8;
81
+ }
82
+
83
+ .sp-alpha
84
+ {
85
+ display: none;
86
+ position: absolute;
87
+ bottom: -14px;
88
+ right: 0;
89
+ left: 0;
90
+ height: 8px;
91
+ }
92
+ .sp-alpha-inner{
93
+ border: solid 1px #333;
94
+ }
95
+
96
+ /* Don't allow text selection */
97
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
98
+ -webkit-user-select:none;
99
+ -moz-user-select: -moz-none;
100
+ -o-user-select:none;
101
+ user-select: none;
102
+ }
103
+
104
+ .sp-container.sp-input-disabled .sp-input-container {
105
+ display: none;
106
+ }
107
+ .sp-container.sp-buttons-disabled .sp-button-container {
108
+ display: none;
109
+ }
110
+ .sp-palette-only .sp-picker-container {
111
+ display: none;
112
+ }
113
+ .sp-palette-disabled .sp-palette-container {
114
+ display: none;
115
+ }
116
+
117
+ .sp-initial-disabled .sp-initial {
118
+ display: none;
119
+ }
120
+
121
+
122
+ /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
123
+ .sp-sat {
124
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
125
+ background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
126
+ background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
127
+ background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
128
+ background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
129
+ background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
130
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
131
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
132
+ }
133
+ .sp-val {
134
+ background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
135
+ background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
136
+ background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
137
+ background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
138
+ background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
139
+ background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
140
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
141
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
142
+ }
143
+
144
+ .sp-hue {
145
+ background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
146
+ background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
147
+ background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
148
+ background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
149
+ background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
150
+ }
151
+
152
+ /* IE filters do not support multiple color stops.
153
+ Generate 6 divs, line them up, and do two color gradients for each.
154
+ Yes, really.
155
+ */
156
+
157
+ .sp-1 {
158
+ height:17%;
159
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
160
+ }
161
+ .sp-2 {
162
+ height:16%;
163
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
164
+ }
165
+ .sp-3 {
166
+ height:17%;
167
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
168
+ }
169
+ .sp-4 {
170
+ height:17%;
171
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
172
+ }
173
+ .sp-5 {
174
+ height:16%;
175
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
176
+ }
177
+ .sp-6 {
178
+ height:17%;
179
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
180
+ }
181
+
182
+ .sp-hidden {
183
+ display: none !important;
184
+ }
185
+
186
+ /* Clearfix hack */
187
+ .sp-cf:before, .sp-cf:after { content: ""; display: table; }
188
+ .sp-cf:after { clear: both; }
189
+ .sp-cf { *zoom: 1; }
190
+
191
+ /* Mobile devices, make hue slider bigger so it is easier to slide */
192
+ @media (max-device-width: 480px) {
193
+ .sp-color { right: 40%; }
194
+ .sp-hue { left: 63%; }
195
+ .sp-fill { padding-top: 60%; }
196
+ }
197
+
198
+ .sp-dragger {
199
+ border-radius: 5px;
200
+ height: 5px;
201
+ width: 5px;
202
+ border: 1px solid #fff;
203
+ background: #000;
204
+ cursor: pointer;
205
+ position:absolute;
206
+ top:0;
207
+ left: 0;
208
+ }
209
+ .sp-slider {
210
+ position: absolute;
211
+ top:0;
212
+ cursor:pointer;
213
+ height: 3px;
214
+ left: -1px;
215
+ right: -1px;
216
+ border: 1px solid #000;
217
+ background: white;
218
+ opacity: .8;
219
+ }
220
+
221
+ /* Basic display options (colors, fonts, global widths) */
222
+ .sp-container {
223
+ border-radius: 0;
224
+ background-color: #efefef;
225
+ border: solid 1px #ccc;
226
+ padding: 0;
227
+ }
228
+ .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue
229
+ {
230
+ -webkit-box-sizing: border-box;
231
+ -moz-box-sizing: border-box;
232
+ -ms-box-sizing: border-box;
233
+ box-sizing: border-box;
234
+ }
235
+ .sp-top
236
+ {
237
+ margin-bottom: 3px;
238
+ }
239
+ .sp-color, .sp-hue
240
+ {
241
+ border: solid 1px #666;
242
+ }
243
+
244
+ /* Input */
245
+ .sp-input-container {
246
+ float:right;
247
+ width: 100px;
248
+ margin-bottom: 4px;
249
+ }
250
+ .sp-initial-disabled .sp-input-container {
251
+ width: 100%;
252
+ }
253
+ .sp-input {
254
+ font-size: 12px !important;
255
+ border: 1px inset;
256
+ padding: 4px 5px;
257
+ margin: 0;
258
+ width: 100%;
259
+ background:transparent;
260
+ border-radius: 3px;
261
+ color: #222;
262
+ }
263
+ .sp-input:focus {
264
+ border: 1px solid orange;
265
+ }
266
+ .sp-input.sp-validation-error
267
+ {
268
+ border: 1px solid red;
269
+ background: #fdd;
270
+ }
271
+ .sp-picker-container , .sp-palette-container
272
+ {
273
+ float:left;
274
+ position: relative;
275
+ padding: 10px;
276
+ padding-bottom: 300px;
277
+ margin-bottom: -290px;
278
+ }
279
+ .sp-picker-container
280
+ {
281
+ width: 172px;
282
+ border-left: solid 1px #fff;
283
+ }
284
+
285
+ /* Palettes */
286
+ .sp-palette-container
287
+ {
288
+ border-right: solid 1px #ccc;
289
+ }
290
+
291
+ .sp-palette .sp-thumb-el {
292
+ display: block;
293
+ position:relative;
294
+ float:left;
295
+ width: 24px;
296
+ height: 15px;
297
+ margin: 3px;
298
+ cursor: pointer;
299
+ border:solid 2px transparent;
300
+ }
301
+ .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
302
+ border-color: orange;
303
+ }
304
+ .sp-thumb-el
305
+ {
306
+ position:relative;
307
+ }
308
+
309
+ /* Initial */
310
+ .sp-initial
311
+ {
312
+ float: left;
313
+ border: solid 1px #333;
314
+ }
315
+ .sp-initial span {
316
+ width: 30px;
317
+ height: 25px;
318
+ border:none;
319
+ display:block;
320
+ float:left;
321
+ margin:0;
322
+ }
323
+
324
+ /* Buttons */
325
+ .sp-button-container {
326
+ float: right;
327
+ }
328
+
329
+ /* Replacer (the little preview div that shows up instead of the <input>) */
330
+ .sp-replacer {
331
+ margin:0;
332
+ overflow:hidden;
333
+ cursor:pointer;
334
+ display:inline-block;
335
+ *zoom: 1;
336
+ *display: inline;
337
+ color: #333;
338
+ vertical-align: middle;
339
+ }
340
+ .sp-replacer:hover, .sp-replacer.sp-active {
341
+ border-color: #F0C49B;
342
+ color: #111;
343
+ }
344
+ .sp-replacer.sp-disabled {
345
+ cursor:default;
346
+ border-color: silver;
347
+ color: silver;
348
+ }
349
+ .sp-dd {
350
+ padding: 2px 0;
351
+ height: 16px;
352
+ line-height: 16px;
353
+ float:left;
354
+ font-size:10px;
355
+ display: none;
356
+ }
357
+ .sp-preview
358
+ {
359
+ position:relative;
360
+ width: 48px;
361
+ height: 18px;
362
+ border: solid 1px #222;
363
+ border-radius: 3px;
364
+ margin-right: 5px;
365
+ float:left;
366
+ z-index: 0;
367
+ }
368
+
369
+ .sp-palette
370
+ {
371
+ *width: 220px;
372
+ max-width: 220px;
373
+ }
374
+ .sp-palette .sp-thumb-el
375
+ {
376
+ width:16px;
377
+ height: 16px;
378
+ margin:2px 1px;
379
+ border: solid 1px #d0d0d0;
380
+ }
381
+
382
+ .sp-container
383
+ {
384
+ padding-bottom:0;
385
+ }
386
+
387
+
388
+ /* Buttons: http://hellohappy.org/css3-buttons/ */
389
+ .sp-container button {
390
+ text-transform: capitalize;
391
+ }
392
+ .sp-container button:hover {
393
+ }
394
+ .sp-container button:active {
395
+ }
396
+ .sp-cancel
397
+ {
398
+ display: none;
399
+ font-size: 11px;
400
+ color: #d93f3f !important;
401
+ margin:0;
402
+ padding:2px;
403
+ margin-right: 5px;
404
+ vertical-align: middle;
405
+ text-decoration:none;
406
+
407
+ }
408
+ .sp-cancel:hover
409
+ {
410
+ color: #d93f3f !important;
411
+ text-decoration: underline;
412
+ }
413
+
414
+
415
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active
416
+ {
417
+ border-color: #000;
418
+ }
419
+
420
+ .sp-preview, .sp-alpha, .sp-thumb-el
421
+ {
422
+ position:relative;
423
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
424
+ }
425
+ .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner
426
+ {
427
+ display:block;
428
+ position:absolute;
429
+ top:0;left:0;bottom:0;right:0;
430
+ }
431
+
432
+ .sp-palette .sp-thumb-inner
433
+ {
434
+ background-position: 50% 50%;
435
+ background-repeat: no-repeat;
436
+ }
437
+
438
+ .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner
439
+ {
440
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
441
+ }
442
+
443
+ .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner
444
+ {
445
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
446
+ }
js/spectrum/spectrum.js ADDED
@@ -0,0 +1,2109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Spectrum Colorpicker v1.3.4
2
+ // https://github.com/bgrins/spectrum
3
+ // Author: Brian Grinstead
4
+ // License: MIT
5
+
6
+ (function (window, $, undefined) {
7
+ "use strict";
8
+
9
+ var defaultOpts = {
10
+
11
+ // Callbacks
12
+ beforeShow: noop,
13
+ move: noop,
14
+ change: noop,
15
+ show: noop,
16
+ hide: noop,
17
+
18
+ // Options
19
+ color: false,
20
+ flat: false,
21
+ showInput: false,
22
+ allowEmpty: false,
23
+ showButtons: true,
24
+ clickoutFiresChange: false,
25
+ showInitial: false,
26
+ showPalette: false,
27
+ showPaletteOnly: false,
28
+ showSelectionPalette: true,
29
+ localStorageKey: false,
30
+ appendTo: "body",
31
+ maxSelectionSize: 7,
32
+ cancelText: "cancel",
33
+ chooseText: "choose",
34
+ clearText: "Clear Color Selection",
35
+ noColorSelectedText: "No Color Selected",
36
+ preferredFormat: false,
37
+ className: "", // Deprecated - use containerClassName and replacerClassName instead.
38
+ containerClassName: "",
39
+ replacerClassName: "",
40
+ showAlpha: false,
41
+ theme: "sp-light",
42
+ palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
43
+ selectionPalette: [],
44
+ disabled: false
45
+ },
46
+ spectrums = [],
47
+ IE = !!/msie/i.exec( window.navigator.userAgent ),
48
+ rgbaSupport = (function() {
49
+ function contains( str, substr ) {
50
+ return !!~('' + str).indexOf(substr);
51
+ }
52
+
53
+ var elem = document.createElement('div');
54
+ var style = elem.style;
55
+ style.cssText = 'background-color:rgba(0,0,0,.5)';
56
+ return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
57
+ })(),
58
+ inputTypeColorSupport = (function() {
59
+ var colorInput = $("<input type='color' value='!' />")[0];
60
+ return colorInput.type === "color" && colorInput.value !== "!";
61
+ })(),
62
+ replaceInput = [
63
+ "<div class='sp-replacer'>",
64
+ "<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
65
+ "<div class='sp-dd'>&#9660;</div>",
66
+ "</div>"
67
+ ].join(''),
68
+ markup = (function () {
69
+
70
+ // IE does not support gradients with multiple stops, so we need to simulate
71
+ // that for the rainbow slider with 8 divs that each have a single gradient
72
+ var gradientFix = "";
73
+ if (IE) {
74
+ for (var i = 1; i <= 6; i++) {
75
+ gradientFix += "<div class='sp-" + i + "'></div>";
76
+ }
77
+ }
78
+
79
+ return [
80
+ "<div class='sp-container sp-hidden'>",
81
+ "<div class='sp-palette-container'>",
82
+ "<div class='sp-palette sp-thumb sp-cf'></div>",
83
+ "</div>",
84
+ "<div class='sp-picker-container'>",
85
+ "<div class='sp-top sp-cf'>",
86
+ "<div class='sp-fill'></div>",
87
+ "<div class='sp-top-inner'>",
88
+ "<div class='sp-color'>",
89
+ "<div class='sp-sat'>",
90
+ "<div class='sp-val'>",
91
+ "<div class='sp-dragger'></div>",
92
+ "</div>",
93
+ "</div>",
94
+ "</div>",
95
+ "<div class='sp-clear sp-clear-display'>",
96
+ "</div>",
97
+ "<div class='sp-hue'>",
98
+ "<div class='sp-slider'></div>",
99
+ gradientFix,
100
+ "</div>",
101
+ "</div>",
102
+ "<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
103
+ "</div>",
104
+ "<div class='sp-input-container sp-cf'>",
105
+ "<input class='sp-input' type='text' spellcheck='false' />",
106
+ "</div>",
107
+ "<div class='sp-initial sp-thumb sp-cf'></div>",
108
+ "<div class='sp-button-container sp-cf'>",
109
+ "<a class='sp-cancel' href='#'></a>",
110
+ "<button type='button' class='sp-choose button-secondary'></button>",
111
+ "</div>",
112
+ "</div>",
113
+ "</div>"
114
+ ].join("");
115
+ })();
116
+
117
+ function paletteTemplate (p, color, className, opts) {
118
+ var html = [];
119
+ for (var i = 0; i < p.length; i++) {
120
+ var current = p[i];
121
+ if(current) {
122
+ var tiny = tinycolor(current);
123
+ var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
124
+ c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
125
+ var formattedString = tiny.toString(opts.preferredFormat || "rgb");
126
+ var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
127
+ html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
128
+ } else {
129
+ var cls = 'sp-clear-display';
130
+ html.push($('<div />')
131
+ .append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
132
+ .attr('title', opts.noColorSelectedText)
133
+ )
134
+ .html()
135
+ );
136
+ }
137
+ }
138
+ return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
139
+ }
140
+
141
+ function hideAll() {
142
+ for (var i = 0; i < spectrums.length; i++) {
143
+ if (spectrums[i]) {
144
+ spectrums[i].hide();
145
+ }
146
+ }
147
+ }
148
+
149
+ function instanceOptions(o, callbackContext) {
150
+ var opts = $.extend({}, defaultOpts, o);
151
+ opts.callbacks = {
152
+ 'move': bind(opts.move, callbackContext),
153
+ 'change': bind(opts.change, callbackContext),
154
+ 'show': bind(opts.show, callbackContext),
155
+ 'hide': bind(opts.hide, callbackContext),
156
+ 'beforeShow': bind(opts.beforeShow, callbackContext)
157
+ };
158
+
159
+ return opts;
160
+ }
161
+
162
+ function spectrum(element, o) {
163
+
164
+ var opts = instanceOptions(o, element),
165
+ flat = opts.flat,
166
+ showSelectionPalette = opts.showSelectionPalette,
167
+ localStorageKey = opts.localStorageKey,
168
+ theme = opts.theme,
169
+ callbacks = opts.callbacks,
170
+ resize = throttle(reflow, 10),
171
+ visible = false,
172
+ dragWidth = 0,
173
+ dragHeight = 0,
174
+ dragHelperHeight = 0,
175
+ slideHeight = 0,
176
+ slideWidth = 0,
177
+ alphaWidth = 0,
178
+ alphaSlideHelperWidth = 0,
179
+ slideHelperHeight = 0,
180
+ currentHue = 0,
181
+ currentSaturation = 0,
182
+ currentValue = 0,
183
+ currentAlpha = 1,
184
+ palette = [],
185
+ paletteArray = [],
186
+ paletteLookup = {},
187
+ selectionPalette = opts.selectionPalette.slice(0),
188
+ maxSelectionSize = opts.maxSelectionSize,
189
+ draggingClass = "sp-dragging",
190
+ shiftMovementDirection = null;
191
+
192
+ var doc = element.ownerDocument,
193
+ body = doc.body,
194
+ boundElement = $(element),
195
+ disabled = false,
196
+ container = $(markup, doc).addClass(theme),
197
+ dragger = container.find(".sp-color"),
198
+ dragHelper = container.find(".sp-dragger"),
199
+ slider = container.find(".sp-hue"),
200
+ slideHelper = container.find(".sp-slider"),
201
+ alphaSliderInner = container.find(".sp-alpha-inner"),
202
+ alphaSlider = container.find(".sp-alpha"),
203
+ alphaSlideHelper = container.find(".sp-alpha-handle"),
204
+ textInput = container.find(".sp-input"),
205
+ paletteContainer = container.find(".sp-palette"),
206
+ initialColorContainer = container.find(".sp-initial"),
207
+ cancelButton = container.find(".sp-cancel"),
208
+ clearButton = container.find(".sp-clear"),
209
+ chooseButton = container.find(".sp-choose"),
210
+ isInput = boundElement.is("input"),
211
+ isInputTypeColor = isInput && inputTypeColorSupport && boundElement.attr("type") === "color",
212
+ shouldReplace = isInput && !flat,
213
+ replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
214
+ offsetElement = (shouldReplace) ? replacer : boundElement,
215
+ previewElement = replacer.find(".sp-preview-inner"),
216
+ initialColor = opts.color || (isInput && boundElement.val()),
217
+ colorOnShow = false,
218
+ preferredFormat = opts.preferredFormat,
219
+ currentPreferredFormat = preferredFormat,
220
+ clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
221
+ isEmpty = !initialColor,
222
+ allowEmpty = opts.allowEmpty && !isInputTypeColor;
223
+
224
+ function applyOptions() {
225
+
226
+ if (opts.showPaletteOnly) {
227
+ opts.showPalette = true;
228
+ }
229
+
230
+ if (opts.palette) {
231
+ palette = opts.palette.slice(0);
232
+ paletteArray = $.isArray(palette[0]) ? palette : [palette];
233
+ paletteLookup = {};
234
+ for (var i = 0; i < paletteArray.length; i++) {
235
+ for (var j = 0; j < paletteArray[i].length; j++) {
236
+ var rgb = tinycolor(paletteArray[i][j]).toRgbString();
237
+ paletteLookup[rgb] = true;
238
+ }
239
+ }
240
+ }
241
+
242
+ container.toggleClass("sp-flat", flat);
243
+ container.toggleClass("sp-input-disabled", !opts.showInput);
244
+ container.toggleClass("sp-alpha-enabled", opts.showAlpha);
245
+ container.toggleClass("sp-clear-enabled", allowEmpty);
246
+ container.toggleClass("sp-buttons-disabled", !opts.showButtons);
247
+ container.toggleClass("sp-palette-disabled", !opts.showPalette);
248
+ container.toggleClass("sp-palette-only", opts.showPaletteOnly);
249
+ container.toggleClass("sp-initial-disabled", !opts.showInitial);
250
+ container.addClass(opts.className).addClass(opts.containerClassName);
251
+
252
+ reflow();
253
+ }
254
+
255
+ function initialize() {
256
+
257
+ if (IE) {
258
+ container.find("*:not(input)").attr("unselectable", "on");
259
+ }
260
+
261
+ applyOptions();
262
+
263
+ if (shouldReplace) {
264
+ boundElement.after(replacer).hide();
265
+ }
266
+
267
+ if (!allowEmpty) {
268
+ clearButton.hide();
269
+ }
270
+
271
+ if (flat) {
272
+ boundElement.after(container).hide();
273
+ }
274
+ else {
275
+
276
+ var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
277
+ if (appendTo.length !== 1) {
278
+ appendTo = $("body");
279
+ }
280
+
281
+ appendTo.append(container);
282
+ }
283
+
284
+ updateSelectionPaletteFromStorage();
285
+
286
+ offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
287
+ if (!disabled) {
288
+ toggle();
289
+ }
290
+
291
+ e.stopPropagation();
292
+
293
+ if (!$(e.target).is("input")) {
294
+ e.preventDefault();
295
+ }
296
+ });
297
+
298
+ if(boundElement.is(":disabled") || (opts.disabled === true)) {
299
+ disable();
300
+ }
301
+
302
+ // Prevent clicks from bubbling up to document. This would cause it to be hidden.
303
+ container.click(stopPropagation);
304
+
305
+ // Handle user typed input
306
+ textInput.change(setFromTextInput);
307
+ textInput.bind("paste", function () {
308
+ setTimeout(setFromTextInput, 1);
309
+ });
310
+ textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
311
+
312
+ cancelButton.text(opts.cancelText);
313
+ cancelButton.bind("click.spectrum", function (e) {
314
+ e.stopPropagation();
315
+ e.preventDefault();
316
+ hide("cancel");
317
+ });
318
+
319
+ clearButton.attr("title", opts.clearText);
320
+ clearButton.bind("click.spectrum", function (e) {
321
+ e.stopPropagation();
322
+ e.preventDefault();
323
+ isEmpty = true;
324
+ move();
325
+
326
+ if(flat) {
327
+ //for the flat style, this is a change event
328
+ updateOriginalInput(true);
329
+ }
330
+ });
331
+
332
+ chooseButton.text(opts.chooseText);
333
+ chooseButton.bind("click.spectrum", function (e) {
334
+ e.stopPropagation();
335
+ e.preventDefault();
336
+
337
+ if (isValid()) {
338
+ updateOriginalInput(true);
339
+ hide();
340
+ }
341
+ });
342
+
343
+ draggable(alphaSlider, function (dragX, dragY, e) {
344
+ currentAlpha = (dragX / alphaWidth);
345
+ isEmpty = false;
346
+ if (e.shiftKey) {
347
+ currentAlpha = Math.round(currentAlpha * 10) / 10;
348
+ }
349
+
350
+ move();
351
+ }, dragStart, dragStop);
352
+
353
+ draggable(slider, function (dragX, dragY) {
354
+ currentHue = parseFloat(dragY / slideHeight);
355
+ isEmpty = false;
356
+ if (!opts.showAlpha) {
357
+ currentAlpha = 1;
358
+ }
359
+ move();
360
+ }, dragStart, dragStop);
361
+
362
+ draggable(dragger, function (dragX, dragY, e) {
363
+
364
+ // shift+drag should snap the movement to either the x or y axis.
365
+ if (!e.shiftKey) {
366
+ shiftMovementDirection = null;
367
+ }
368
+ else if (!shiftMovementDirection) {
369
+ var oldDragX = currentSaturation * dragWidth;
370
+ var oldDragY = dragHeight - (currentValue * dragHeight);
371
+ var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
372
+
373
+ shiftMovementDirection = furtherFromX ? "x" : "y";
374
+ }
375
+
376
+ var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
377
+ var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
378
+
379
+ if (setSaturation) {
380
+ currentSaturation = parseFloat(dragX / dragWidth);
381
+ }
382
+ if (setValue) {
383
+ currentValue = parseFloat((dragHeight - dragY) / dragHeight);
384
+ }
385
+
386
+ isEmpty = false;
387
+ if (!opts.showAlpha) {
388
+ currentAlpha = 1;
389
+ }
390
+
391
+ move();
392
+
393
+ }, dragStart, dragStop);
394
+
395
+ if (!!initialColor) {
396
+ set(initialColor);
397
+
398
+ // In case color was black - update the preview UI and set the format
399
+ // since the set function will not run (default color is black).
400
+ updateUI();
401
+ currentPreferredFormat = preferredFormat || tinycolor(initialColor).format;
402
+
403
+ addColorToSelectionPalette(initialColor);
404
+ }
405
+ else {
406
+ updateUI();
407
+ }
408
+
409
+ if (flat) {
410
+ show();
411
+ }
412
+
413
+ function paletteElementClick(e) {
414
+ if (e.data && e.data.ignore) {
415
+ set($(e.target).closest(".sp-thumb-el").data("color"));
416
+ move();
417
+ }
418
+ else {
419
+ set($(e.target).closest(".sp-thumb-el").data("color"));
420
+ move();
421
+ updateOriginalInput(true);
422
+ hide();
423
+ }
424
+
425
+ return false;
426
+ }
427
+
428
+ var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
429
+ paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
430
+ initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
431
+ }
432
+
433
+ function updateSelectionPaletteFromStorage() {
434
+
435
+ if (localStorageKey && window.localStorage) {
436
+
437
+ // Migrate old palettes over to new format. May want to remove this eventually.
438
+ try {
439
+ var oldPalette = window.localStorage[localStorageKey].split(",#");
440
+ if (oldPalette.length > 1) {
441
+ delete window.localStorage[localStorageKey];
442
+ $.each(oldPalette, function(i, c) {
443
+ addColorToSelectionPalette(c);
444
+ });
445
+ }
446
+ }
447
+ catch(e) { }
448
+
449
+ try {
450
+ selectionPalette = window.localStorage[localStorageKey].split(";");
451
+ }
452
+ catch (e) { }
453
+ }
454
+ }
455
+
456
+ function addColorToSelectionPalette(color) {
457
+ if (showSelectionPalette) {
458
+ var rgb = tinycolor(color).toRgbString();
459
+ if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
460
+ selectionPalette.push(rgb);
461
+ while(selectionPalette.length > maxSelectionSize) {
462
+ selectionPalette.shift();
463
+ }
464
+ }
465
+
466
+ if (localStorageKey && window.localStorage) {
467
+ try {
468
+ window.localStorage[localStorageKey] = selectionPalette.join(";");
469
+ }
470
+ catch(e) { }
471
+ }
472
+ }
473
+ }
474
+
475
+ function getUniqueSelectionPalette() {
476
+ var unique = [];
477
+ if (opts.showPalette) {
478
+ for (var i = 0; i < selectionPalette.length; i++) {
479
+ var rgb = tinycolor(selectionPalette[i]).toRgbString();
480
+
481
+ if (!paletteLookup[rgb]) {
482
+ unique.push(selectionPalette[i]);
483
+ }
484
+ }
485
+ }
486
+
487
+ return unique.reverse().slice(0, opts.maxSelectionSize);
488
+ }
489
+
490
+ function drawPalette() {
491
+
492
+ var currentColor = get();
493
+
494
+ var html = $.map(paletteArray, function (palette, i) {
495
+ return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
496
+ });
497
+
498
+ updateSelectionPaletteFromStorage();
499
+
500
+ if (selectionPalette) {
501
+ html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
502
+ }
503
+
504
+ paletteContainer.html(html.join(""));
505
+ }
506
+
507
+ function drawInitial() {
508
+ if (opts.showInitial) {
509
+ var initial = colorOnShow;
510
+ var current = get();
511
+ initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
512
+ }
513
+ }
514
+
515
+ function dragStart() {
516
+ if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
517
+ reflow();
518
+ }
519
+ container.addClass(draggingClass);
520
+ shiftMovementDirection = null;
521
+ boundElement.trigger('dragstart.spectrum', [ get() ]);
522
+ }
523
+
524
+ function dragStop() {
525
+ container.removeClass(draggingClass);
526
+ boundElement.trigger('dragstop.spectrum', [ get() ]);
527
+ }
528
+
529
+ function setFromTextInput() {
530
+
531
+ var value = textInput.val();
532
+
533
+ if ((value === null || value === "") && allowEmpty) {
534
+ set(null);
535
+ updateOriginalInput(true);
536
+ }
537
+ else {
538
+ var tiny = tinycolor(value);
539
+ if (tiny.isValid()) {
540
+ set(tiny);
541
+ updateOriginalInput(true);
542
+ }
543
+ else {
544
+ textInput.addClass("sp-validation-error");
545
+ }
546
+ }
547
+ }
548
+
549
+ function toggle() {
550
+ if (visible) {
551
+ hide();
552
+ }
553
+ else {
554
+ show();
555
+ }
556
+ }
557
+
558
+ function show() {
559
+ var event = $.Event('beforeShow.spectrum');
560
+
561
+ if (visible) {
562
+ reflow();
563
+ return;
564
+ }
565
+
566
+ boundElement.trigger(event, [ get() ]);
567
+
568
+ if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
569
+ return;
570
+ }
571
+
572
+ hideAll();
573
+ visible = true;
574
+
575
+ $(doc).bind("click.spectrum", hide);
576
+ $(window).bind("resize.spectrum", resize);
577
+ replacer.addClass("sp-active");
578
+ container.removeClass("sp-hidden");
579
+
580
+ reflow();
581
+ updateUI();
582
+
583
+ colorOnShow = get();
584
+
585
+ drawInitial();
586
+ callbacks.show(colorOnShow);
587
+ boundElement.trigger('show.spectrum', [ colorOnShow ]);
588
+ }
589
+
590
+ function hide(e) {
591
+
592
+ // Return on right click
593
+ if (e && e.type == "click" && e.button == 2) { return; }
594
+
595
+ // Return if hiding is unnecessary
596
+ if (!visible || flat) { return; }
597
+ visible = false;
598
+
599
+ $(doc).unbind("click.spectrum", hide);
600
+ $(window).unbind("resize.spectrum", resize);
601
+
602
+ replacer.removeClass("sp-active");
603
+ container.addClass("sp-hidden");
604
+
605
+ var colorHasChanged = !tinycolor.equals(get(), colorOnShow);
606
+
607
+ if (colorHasChanged) {
608
+ if (clickoutFiresChange && e !== "cancel") {
609
+ updateOriginalInput(true);
610
+ }
611
+ else {
612
+ revert();
613
+ }
614
+ }
615
+
616
+ callbacks.hide(get());
617
+ boundElement.trigger('hide.spectrum', [ get() ]);
618
+ }
619
+
620
+ function revert() {
621
+ set(colorOnShow, true);
622
+ }
623
+
624
+ function set(color, ignoreFormatChange) {
625
+ if (tinycolor.equals(color, get())) {
626
+ // Update UI just in case a validation error needs
627
+ // to be cleared.
628
+ updateUI();
629
+ return;
630
+ }
631
+
632
+ var newColor, newHsv;
633
+ if (!color && allowEmpty) {
634
+ isEmpty = true;
635
+ } else {
636
+ isEmpty = false;
637
+ newColor = tinycolor(color);
638
+ newHsv = newColor.toHsv();
639
+
640
+ currentHue = (newHsv.h % 360) / 360;
641
+ currentSaturation = newHsv.s;
642
+ currentValue = newHsv.v;
643
+ currentAlpha = newHsv.a;
644
+ }
645
+ updateUI();
646
+
647
+ if (newColor && newColor.isValid() && !ignoreFormatChange) {
648
+ currentPreferredFormat = preferredFormat || newColor.getFormat();
649
+ }
650
+ }
651
+
652
+ function get(opts) {
653
+ opts = opts || { };
654
+
655
+ if (allowEmpty && isEmpty) {
656
+ return null;
657
+ }
658
+
659
+ return tinycolor.fromRatio({
660
+ h: currentHue,
661
+ s: currentSaturation,
662
+ v: currentValue,
663
+ a: Math.round(currentAlpha * 100) / 100
664
+ }, { format: opts.format || currentPreferredFormat });
665
+ }
666
+
667
+ function isValid() {
668
+ return !textInput.hasClass("sp-validation-error");
669
+ }
670
+
671
+ function move() {
672
+ updateUI();
673
+
674
+ callbacks.move(get());
675
+ boundElement.trigger('move.spectrum', [ get() ]);
676
+ }
677
+
678
+ function updateUI() {
679
+
680
+ textInput.removeClass("sp-validation-error");
681
+
682
+ updateHelperLocations();
683
+
684
+ // Update dragger background color (gradients take care of saturation and value).
685
+ var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
686
+ dragger.css("background-color", flatColor.toHexString());
687
+
688
+ // Get a format that alpha will be included in (hex and names ignore alpha)
689
+ var format = currentPreferredFormat;
690
+ if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
691
+ if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
692
+ format = "rgb";
693
+ }
694
+ }
695
+
696
+ var realColor = get({ format: format }),
697
+ displayColor = '';
698
+
699
+ //reset background info for preview element
700
+ previewElement.removeClass("sp-clear-display");
701
+ previewElement.css('background-color', 'transparent');
702
+
703
+ if (!realColor && allowEmpty) {
704
+ // Update the replaced elements background with icon indicating no color selection
705
+ previewElement.addClass("sp-clear-display");
706
+ }
707
+ else {
708
+ var realHex = realColor.toHexString(),
709
+ realRgb = realColor.toRgbString();
710
+
711
+ // Update the replaced elements background color (with actual selected color)
712
+ if (rgbaSupport || realColor.alpha === 1) {
713
+ previewElement.css("background-color", realRgb);
714
+ }
715
+ else {
716
+ previewElement.css("background-color", "transparent");
717
+ previewElement.css("filter", realColor.toFilter());
718
+ }
719
+
720
+ if (opts.showAlpha) {
721
+ var rgb = realColor.toRgb();
722
+ rgb.a = 0;
723
+ var realAlpha = tinycolor(rgb).toRgbString();
724
+ var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
725
+
726
+ if (IE) {
727
+ alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
728
+ }
729
+ else {
730
+ alphaSliderInner.css("background", "-webkit-" + gradient);
731
+ alphaSliderInner.css("background", "-moz-" + gradient);
732
+ alphaSliderInner.css("background", "-ms-" + gradient);
733
+ // Use current syntax gradient on unprefixed property.
734
+ alphaSliderInner.css("background",
735
+ "linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
736
+ }
737
+ }
738
+
739
+ displayColor = realColor.toString(format);
740
+ }
741
+
742
+ // Update the text entry input as it changes happen
743
+ if (opts.showInput) {
744
+ textInput.val(displayColor);
745
+ }
746
+
747
+ if (opts.showPalette) {
748
+ drawPalette();
749
+ }
750
+
751
+ drawInitial();
752
+ }
753
+
754
+ function updateHelperLocations() {
755
+ var s = currentSaturation;
756
+ var v = currentValue;
757
+
758
+ if(allowEmpty && isEmpty) {
759
+ //if selected color is empty, hide the helpers
760
+ alphaSlideHelper.hide();
761
+ slideHelper.hide();
762
+ dragHelper.hide();
763
+ }
764
+ else {
765
+ //make sure helpers are visible
766
+ alphaSlideHelper.show();
767
+ slideHelper.show();
768
+ dragHelper.show();
769
+
770
+ // Where to show the little circle in that displays your current selected color
771
+ var dragX = s * dragWidth;
772
+ var dragY = dragHeight - (v * dragHeight);
773
+ dragX = Math.max(
774
+ -dragHelperHeight,
775
+ Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
776
+ );
777
+ dragY = Math.max(
778
+ -dragHelperHeight,
779
+ Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
780
+ );
781
+ dragHelper.css({
782
+ "top": dragY + "px",
783
+ "left": dragX + "px"
784
+ });
785
+
786
+ var alphaX = currentAlpha * alphaWidth;
787
+ alphaSlideHelper.css({
788
+ "left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
789
+ });
790
+
791
+ // Where to show the bar that displays your current selected hue
792
+ var slideY = (currentHue) * slideHeight;
793
+ slideHelper.css({
794
+ "top": (slideY - slideHelperHeight) + "px"
795
+ });
796
+ }
797
+ }
798
+
799
+ function updateOriginalInput(fireCallback) {
800
+ var color = get(),
801
+ displayColor = '',
802
+ hasChanged = !tinycolor.equals(color, colorOnShow);
803
+
804
+ if (color) {
805
+ displayColor = color.toString(currentPreferredFormat);
806
+ // Update the selection palette with the current color
807
+ addColorToSelectionPalette(color);
808
+ }
809
+
810
+ if (isInput) {
811
+ boundElement.val(displayColor);
812
+ }
813
+
814
+ colorOnShow = color;
815
+
816
+ if (fireCallback && hasChanged) {
817
+ callbacks.change(color);
818
+ boundElement.trigger('change', [ color ]);
819
+ }
820
+ }
821
+
822
+ function reflow() {
823
+ dragWidth = dragger.width();
824
+ dragHeight = dragger.height();
825
+ dragHelperHeight = dragHelper.height();
826
+ slideWidth = slider.width();
827
+ slideHeight = slider.height();
828
+ slideHelperHeight = slideHelper.height();
829
+ alphaWidth = alphaSlider.width();
830
+ alphaSlideHelperWidth = alphaSlideHelper.width();
831
+
832
+ if (!flat) {
833
+ container.css("position", "absolute");
834
+ container.offset(getOffset(container, offsetElement));
835
+ }
836
+
837
+ updateHelperLocations();
838
+
839
+ if (opts.showPalette) {
840
+ drawPalette();
841
+ }
842
+
843
+ boundElement.trigger('reflow.spectrum');
844
+ }
845
+
846
+ function destroy() {
847
+ boundElement.show();
848
+ offsetElement.unbind("click.spectrum touchstart.spectrum");
849
+ container.remove();
850
+ replacer.remove();
851
+ spectrums[spect.id] = null;
852
+ }
853
+
854
+ function option(optionName, optionValue) {
855
+ if (optionName === undefined) {
856
+ return $.extend({}, opts);
857
+ }
858
+ if (optionValue === undefined) {
859
+ return opts[optionName];
860
+ }
861
+
862
+ opts[optionName] = optionValue;
863
+ applyOptions();
864
+ }
865
+
866
+ function enable() {
867
+ disabled = false;
868
+ boundElement.attr("disabled", false);
869
+ offsetElement.removeClass("sp-disabled");
870
+ }
871
+
872
+ function disable() {
873
+ hide();
874
+ disabled = true;
875
+ boundElement.attr("disabled", true);
876
+ offsetElement.addClass("sp-disabled");
877
+ }
878
+
879
+ initialize();
880
+
881
+ var spect = {
882
+ show: show,
883
+ hide: hide,
884
+ toggle: toggle,
885
+ reflow: reflow,
886
+ option: option,
887
+ enable: enable,
888
+ disable: disable,
889
+ set: function (c) {
890
+ set(c);
891
+ updateOriginalInput();
892
+ },
893
+ get: get,
894
+ destroy: destroy,
895
+ container: container
896
+ };
897
+
898
+ spect.id = spectrums.push(spect) - 1;
899
+
900
+ return spect;
901
+ }
902
+
903
+ /**
904
+ * checkOffset - get the offset below/above and left/right element depending on screen position
905
+ * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
906
+ */
907
+ function getOffset(picker, input) {
908
+ var extraY = 0;
909
+ var dpWidth = picker.outerWidth();
910
+ var dpHeight = picker.outerHeight();
911
+ var inputHeight = input.outerHeight();
912
+ var doc = picker[0].ownerDocument;
913
+ var docElem = doc.documentElement;
914
+ var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
915
+ var viewHeight = docElem.clientHeight + $(doc).scrollTop();
916
+ var offset = input.offset();
917
+ offset.top += inputHeight;
918
+
919
+ offset.left -=
920
+ Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
921
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
922
+
923
+ offset.top -=
924
+ Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
925
+ Math.abs(dpHeight + inputHeight - extraY) : extraY));
926
+
927
+ return offset;
928
+ }
929
+
930
+ /**
931
+ * noop - do nothing
932
+ */
933
+ function noop() {
934
+
935
+ }
936
+
937
+ /**
938
+ * stopPropagation - makes the code only doing this a little easier to read in line
939
+ */
940
+ function stopPropagation(e) {
941
+ e.stopPropagation();
942
+ }
943
+
944
+ /**
945
+ * Create a function bound to a given object
946
+ * Thanks to underscore.js
947
+ */
948
+ function bind(func, obj) {
949
+ var slice = Array.prototype.slice;
950
+ var args = slice.call(arguments, 2);
951
+ return function () {
952
+ return func.apply(obj, args.concat(slice.call(arguments)));
953
+ };
954
+ }
955
+
956
+ /**
957
+ * Lightweight drag helper. Handles containment within the element, so that
958
+ * when dragging, the x is within [0,element.width] and y is within [0,element.height]
959
+ */
960
+ function draggable(element, onmove, onstart, onstop) {
961
+ onmove = onmove || function () { };
962
+ onstart = onstart || function () { };
963
+ onstop = onstop || function () { };
964
+ var doc = element.ownerDocument || document;
965
+ var dragging = false;
966
+ var offset = {};
967
+ var maxHeight = 0;
968
+ var maxWidth = 0;
969
+ var hasTouch = ('ontouchstart' in window);
970
+
971
+ var duringDragEvents = {};
972
+ duringDragEvents["selectstart"] = prevent;
973
+ duringDragEvents["dragstart"] = prevent;
974
+ duringDragEvents["touchmove mousemove"] = move;
975
+ duringDragEvents["touchend mouseup"] = stop;
976
+
977
+ function prevent(e) {
978
+ if (e.stopPropagation) {
979
+ e.stopPropagation();
980
+ }
981
+ if (e.preventDefault) {
982
+ e.preventDefault();
983
+ }
984
+ e.returnValue = false;
985
+ }
986
+
987
+ function move(e) {
988
+ if (dragging) {
989
+ // Mouseup happened outside of window
990
+ if (IE && document.documentMode < 9 && !e.button) {
991
+ return stop();
992
+ }
993
+
994
+ var touches = e.originalEvent.touches;
995
+ var pageX = touches ? touches[0].pageX : e.pageX;
996
+ var pageY = touches ? touches[0].pageY : e.pageY;
997
+
998
+ var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
999
+ var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
1000
+
1001
+ if (hasTouch) {
1002
+ // Stop scrolling in iOS
1003
+ prevent(e);
1004
+ }
1005
+
1006
+ onmove.apply(element, [dragX, dragY, e]);
1007
+ }
1008
+ }
1009
+
1010
+ function start(e) {
1011
+ var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
1012
+ var touches = e.originalEvent.touches;
1013
+
1014
+ if (!rightclick && !dragging) {
1015
+ if (onstart.apply(element, arguments) !== false) {
1016
+ dragging = true;
1017
+ maxHeight = $(element).height();
1018
+ maxWidth = $(element).width();
1019
+ offset = $(element).offset();
1020
+
1021
+ $(doc).bind(duringDragEvents);
1022
+ $(doc.body).addClass("sp-dragging");
1023
+
1024
+ if (!hasTouch) {
1025
+ move(e);
1026
+ }
1027
+
1028
+ prevent(e);
1029
+ }
1030
+ }
1031
+ }
1032
+
1033
+ function stop() {
1034
+ if (dragging) {
1035
+ $(doc).unbind(duringDragEvents);
1036
+ $(doc.body).removeClass("sp-dragging");
1037
+ onstop.apply(element, arguments);
1038
+ }
1039
+ dragging = false;
1040
+ }
1041
+
1042
+ $(element).bind("touchstart mousedown", start);
1043
+ }
1044
+
1045
+ function throttle(func, wait, debounce) {
1046
+ var timeout;
1047
+ return function () {
1048
+ var context = this, args = arguments;
1049
+ var throttler = function () {
1050
+ timeout = null;
1051
+ func.apply(context, args);
1052
+ };
1053
+ if (debounce) clearTimeout(timeout);
1054
+ if (debounce || !timeout) timeout = setTimeout(throttler, wait);
1055
+ };
1056
+ }
1057
+
1058
+ /**
1059
+ * Define a jQuery plugin
1060
+ */
1061
+ var dataID = "spectrum.id";
1062
+ $.fn.spectrum = function (opts, extra) {
1063
+
1064
+ if (typeof opts == "string") {
1065
+
1066
+ var returnValue = this;
1067
+ var args = Array.prototype.slice.call( arguments, 1 );
1068
+
1069
+ this.each(function () {
1070
+ var spect = spectrums[$(this).data(dataID)];
1071
+ if (spect) {
1072
+ var method = spect[opts];
1073
+ if (!method) {
1074
+ throw new Error( "Spectrum: no such method: '" + opts + "'" );
1075
+ }
1076
+
1077
+ if (opts == "get") {
1078
+ returnValue = spect.get();
1079
+ }
1080
+ else if (opts == "container") {
1081
+ returnValue = spect.container;
1082
+ }
1083
+ else if (opts == "option") {
1084
+ returnValue = spect.option.apply(spect, args);
1085
+ }
1086
+ else if (opts == "destroy") {
1087
+ spect.destroy();
1088
+ $(this).removeData(dataID);
1089
+ }
1090
+ else {
1091
+ method.apply(spect, args);
1092
+ }
1093
+ }
1094
+ });
1095
+
1096
+ return returnValue;
1097
+ }
1098
+
1099
+ // Initializing a new instance of spectrum
1100
+ return this.spectrum("destroy").each(function () {
1101
+ var options = $.extend({}, opts, $(this).data());
1102
+ var spect = spectrum(this, options);
1103
+ $(this).data(dataID, spect.id);
1104
+ });
1105
+ };
1106
+
1107
+ $.fn.spectrum.load = true;
1108
+ $.fn.spectrum.loadOpts = {};
1109
+ $.fn.spectrum.draggable = draggable;
1110
+ $.fn.spectrum.defaults = defaultOpts;
1111
+
1112
+ $.spectrum = { };
1113
+ $.spectrum.localization = { };
1114
+ $.spectrum.palettes = { };
1115
+
1116
+ $.fn.spectrum.processNativeColorInputs = function () {
1117
+ if (!inputTypeColorSupport) {
1118
+ $("input[type=color]").spectrum({
1119
+ preferredFormat: "hex6"
1120
+ });
1121
+ }
1122
+ };
1123
+
1124
+ // TinyColor v0.10.0
1125
+ // https://github.com/bgrins/TinyColor
1126
+ // 2013-08-10, Brian Grinstead, MIT License
1127
+
1128
+ (function() {
1129
+
1130
+ var trimLeft = /^[\s,#]+/,
1131
+ trimRight = /\s+$/,
1132
+ tinyCounter = 0,
1133
+ math = Math,
1134
+ mathRound = math.round,
1135
+ mathMin = math.min,
1136
+ mathMax = math.max,
1137
+ mathRandom = math.random;
1138
+
1139
+ var tinycolor = function tinycolor (color, opts) {
1140
+
1141
+ color = (color) ? color : '';
1142
+ opts = opts || { };
1143
+
1144
+ // If input is already a tinycolor, return itself
1145
+ if (color instanceof tinycolor) {
1146
+ return color;
1147
+ }
1148
+ // If we are called as a function, call using new instead
1149
+ if (!(this instanceof tinycolor)) {
1150
+ return new tinycolor(color, opts);
1151
+ }
1152
+
1153
+ var rgb = inputToRGB(color);
1154
+ this._r = rgb.r,
1155
+ this._g = rgb.g,
1156
+ this._b = rgb.b,
1157
+ this._a = rgb.a,
1158
+ this._roundA = mathRound(100*this._a) / 100,
1159
+ this._format = opts.format || rgb.format;
1160
+ this._gradientType = opts.gradientType;
1161
+
1162
+ // Don't let the range of [0,255] come back in [0,1].
1163
+ // Potentially lose a little bit of precision here, but will fix issues where
1164
+ // .5 gets interpreted as half of the total, instead of half of 1
1165
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
1166
+ if (this._r < 1) { this._r = mathRound(this._r); }
1167
+ if (this._g < 1) { this._g = mathRound(this._g); }
1168
+ if (this._b < 1) { this._b = mathRound(this._b); }
1169
+
1170
+ this._ok = rgb.ok;
1171
+ this._tc_id = tinyCounter++;
1172
+ };
1173
+
1174
+ tinycolor.prototype = {
1175
+ isValid: function() {
1176
+ return this._ok;
1177
+ },
1178
+ getFormat: function() {
1179
+ return this._format;
1180
+ },
1181
+ getAlpha: function() {
1182
+ return this._a;
1183
+ },
1184
+ setAlpha: function(value) {
1185
+ this._a = boundAlpha(value);
1186
+ this._roundA = mathRound(100*this._a) / 100;
1187
+ },
1188
+ toHsv: function() {
1189
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1190
+ return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
1191
+ },
1192
+ toHsvString: function() {
1193
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1194
+ var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
1195
+ return (this._a == 1) ?
1196
+ "hsv(" + h + ", " + s + "%, " + v + "%)" :
1197
+ "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
1198
+ },
1199
+ toHsl: function() {
1200
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1201
+ return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
1202
+ },
1203
+ toHslString: function() {
1204
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1205
+ var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
1206
+ return (this._a == 1) ?
1207
+ "hsl(" + h + ", " + s + "%, " + l + "%)" :
1208
+ "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
1209
+ },
1210
+ toHex: function(allow3Char) {
1211
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
1212
+ },
1213
+ toHexString: function(allow3Char) {
1214
+ return '#' + this.toHex(allow3Char);
1215
+ },
1216
+ toHex8: function() {
1217
+ return rgbaToHex(this._r, this._g, this._b, this._a);
1218
+ },
1219
+ toHex8String: function() {
1220
+ return '#' + this.toHex8();
1221
+ },
1222
+ toRgb: function() {
1223
+ return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
1224
+ },
1225
+ toRgbString: function() {
1226
+ return (this._a == 1) ?
1227
+ "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
1228
+ "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
1229
+ },
1230
+ toPercentageRgb: function() {
1231
+ return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
1232
+ },
1233
+ toPercentageRgbString: function() {
1234
+ return (this._a == 1) ?
1235
+ "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
1236
+ "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
1237
+ },
1238
+ toName: function() {
1239
+ if (this._a === 0) {
1240
+ return "transparent";
1241
+ }
1242
+
1243
+ if (this._a < 1) {
1244
+ return false;
1245
+ }
1246
+
1247
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
1248
+ },
1249
+ toFilter: function(secondColor) {
1250
+ var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
1251
+ var secondHex8String = hex8String;
1252
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
1253
+
1254
+ if (secondColor) {
1255
+ var s = tinycolor(secondColor);
1256
+ secondHex8String = s.toHex8String();
1257
+ }
1258
+
1259
+ return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
1260
+ },
1261
+ toString: function(format) {
1262
+ var formatSet = !!format;
1263
+ format = format || this._format;
1264
+
1265
+ var formattedString = false;
1266
+ var hasAlpha = this._a < 1 && this._a >= 0;
1267
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
1268
+
1269
+ if (needsAlphaFormat) {
1270
+ // Special case for "transparent", all other non-alpha formats
1271
+ // will return rgba when there is transparency.
1272
+ if (format === "name" && this._a === 0) {
1273
+ return this.toName();
1274
+ }
1275
+ return this.toRgbString();
1276
+ }
1277
+ if (format === "rgb") {
1278
+ formattedString = this.toRgbString();
1279
+ }
1280
+ if (format === "prgb") {
1281
+ formattedString = this.toPercentageRgbString();
1282
+ }
1283
+ if (format === "hex" || format === "hex6") {
1284
+ formattedString = this.toHexString();
1285
+ }
1286
+ if (format === "hex3") {
1287
+ formattedString = this.toHexString(true);
1288
+ }
1289
+ if (format === "hex8") {
1290
+ formattedString = this.toHex8String();
1291
+ }
1292
+ if (format === "name") {
1293
+ formattedString = this.toName();
1294
+ }
1295
+ if (format === "hsl") {
1296
+ formattedString = this.toHslString();
1297
+ }
1298
+ if (format === "hsv") {
1299
+ formattedString = this.toHsvString();
1300
+ }
1301
+
1302
+ return formattedString || this.toHexString();
1303
+ }
1304
+ };
1305
+
1306
+ // If input is an object, force 1 into "1.0" to handle ratios properly
1307
+ // String input requires "1.0" as input, so 1 will be treated as 1
1308
+ tinycolor.fromRatio = function(color, opts) {
1309
+ if (typeof color == "object") {
1310
+ var newColor = {};
1311
+ for (var i in color) {
1312
+ if (color.hasOwnProperty(i)) {
1313
+ if (i === "a") {
1314
+ newColor[i] = color[i];
1315
+ }
1316
+ else {
1317
+ newColor[i] = convertToPercentage(color[i]);
1318
+ }
1319
+ }
1320
+ }
1321
+ color = newColor;
1322
+ }
1323
+
1324
+ return tinycolor(color, opts);
1325
+ };
1326
+
1327
+ // Given a string or object, convert that input to RGB
1328
+ // Possible string inputs:
1329
+ //
1330
+ // "red"
1331
+ // "#f00" or "f00"
1332
+ // "#ff0000" or "ff0000"
1333
+ // "#ff000000" or "ff000000"
1334
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
1335
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
1336
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
1337
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
1338
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
1339
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
1340
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
1341
+ //
1342
+ function inputToRGB(color) {
1343
+
1344
+ var rgb = { r: 0, g: 0, b: 0 };
1345
+ var a = 1;
1346
+ var ok = false;
1347
+ var format = false;
1348
+
1349
+ if (typeof color == "string") {
1350
+ color = stringInputToObject(color);
1351
+ }
1352
+
1353
+ if (typeof color == "object") {
1354
+ if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
1355
+ rgb = rgbToRgb(color.r, color.g, color.b);
1356
+ ok = true;
1357
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
1358
+ }
1359
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
1360
+ color.s = convertToPercentage(color.s);
1361
+ color.v = convertToPercentage(color.v);
1362
+ rgb = hsvToRgb(color.h, color.s, color.v);
1363
+ ok = true;
1364
+ format = "hsv";
1365
+ }
1366
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
1367
+ color.s = convertToPercentage(color.s);
1368
+ color.l = convertToPercentage(color.l);
1369
+ rgb = hslToRgb(color.h, color.s, color.l);
1370
+ ok = true;
1371
+ format = "hsl";
1372
+ }
1373
+
1374
+ if (color.hasOwnProperty("a")) {
1375
+ a = color.a;
1376
+ }
1377
+ }
1378
+
1379
+ a = boundAlpha(a);
1380
+
1381
+ return {
1382
+ ok: ok,
1383
+ format: color.format || format,
1384
+ r: mathMin(255, mathMax(rgb.r, 0)),
1385
+ g: mathMin(255, mathMax(rgb.g, 0)),
1386
+ b: mathMin(255, mathMax(rgb.b, 0)),
1387
+ a: a
1388
+ };
1389
+ }
1390
+
1391
+
1392
+ // Conversion Functions
1393
+ // --------------------
1394
+
1395
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
1396
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
1397
+
1398
+ // `rgbToRgb`
1399
+ // Handle bounds / percentage checking to conform to CSS color spec
1400
+ // <http://www.w3.org/TR/css3-color/>
1401
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
1402
+ // *Returns:* { r, g, b } in [0, 255]
1403
+ function rgbToRgb(r, g, b){
1404
+ return {
1405
+ r: bound01(r, 255) * 255,
1406
+ g: bound01(g, 255) * 255,
1407
+ b: bound01(b, 255) * 255
1408
+ };
1409
+ }
1410
+
1411
+ // `rgbToHsl`
1412
+ // Converts an RGB color value to HSL.
1413
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
1414
+ // *Returns:* { h, s, l } in [0,1]
1415
+ function rgbToHsl(r, g, b) {
1416
+
1417
+ r = bound01(r, 255);
1418
+ g = bound01(g, 255);
1419
+ b = bound01(b, 255);
1420
+
1421
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1422
+ var h, s, l = (max + min) / 2;
1423
+
1424
+ if(max == min) {
1425
+ h = s = 0; // achromatic
1426
+ }
1427
+ else {
1428
+ var d = max - min;
1429
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1430
+ switch(max) {
1431
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1432
+ case g: h = (b - r) / d + 2; break;
1433
+ case b: h = (r - g) / d + 4; break;
1434
+ }
1435
+
1436
+ h /= 6;
1437
+ }
1438
+
1439
+ return { h: h, s: s, l: l };
1440
+ }
1441
+
1442
+ // `hslToRgb`
1443
+ // Converts an HSL color value to RGB.
1444
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
1445
+ // *Returns:* { r, g, b } in the set [0, 255]
1446
+ function hslToRgb(h, s, l) {
1447
+ var r, g, b;
1448
+
1449
+ h = bound01(h, 360);
1450
+ s = bound01(s, 100);
1451
+ l = bound01(l, 100);
1452
+
1453
+ function hue2rgb(p, q, t) {
1454
+ if(t < 0) t += 1;
1455
+ if(t > 1) t -= 1;
1456
+ if(t < 1/6) return p + (q - p) * 6 * t;
1457
+ if(t < 1/2) return q;
1458
+ if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
1459
+ return p;
1460
+ }
1461
+
1462
+ if(s === 0) {
1463
+ r = g = b = l; // achromatic
1464
+ }
1465
+ else {
1466
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1467
+ var p = 2 * l - q;
1468
+ r = hue2rgb(p, q, h + 1/3);
1469
+ g = hue2rgb(p, q, h);
1470
+ b = hue2rgb(p, q, h - 1/3);
1471
+ }
1472
+
1473
+ return { r: r * 255, g: g * 255, b: b * 255 };
1474
+ }
1475
+
1476
+ // `rgbToHsv`
1477
+ // Converts an RGB color value to HSV
1478
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
1479
+ // *Returns:* { h, s, v } in [0,1]
1480
+ function rgbToHsv(r, g, b) {
1481
+
1482
+ r = bound01(r, 255);
1483
+ g = bound01(g, 255);
1484
+ b = bound01(b, 255);
1485
+
1486
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1487
+ var h, s, v = max;
1488
+
1489
+ var d = max - min;
1490
+ s = max === 0 ? 0 : d / max;
1491
+
1492
+ if(max == min) {
1493
+ h = 0; // achromatic
1494
+ }
1495
+ else {
1496
+ switch(max) {
1497
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1498
+ case g: h = (b - r) / d + 2; break;
1499
+ case b: h = (r - g) / d + 4; break;
1500
+ }
1501
+ h /= 6;
1502
+ }
1503
+ return { h: h, s: s, v: v };
1504
+ }
1505
+
1506
+ // `hsvToRgb`
1507
+ // Converts an HSV color value to RGB.
1508
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
1509
+ // *Returns:* { r, g, b } in the set [0, 255]
1510
+ function hsvToRgb(h, s, v) {
1511
+
1512
+ h = bound01(h, 360) * 6;
1513
+ s = bound01(s, 100);
1514
+ v = bound01(v, 100);
1515
+
1516
+ var i = math.floor(h),
1517
+ f = h - i,
1518
+ p = v * (1 - s),
1519
+ q = v * (1 - f * s),
1520
+ t = v * (1 - (1 - f) * s),
1521
+ mod = i % 6,
1522
+ r = [v, q, p, p, t, v][mod],
1523
+ g = [t, v, v, q, p, p][mod],
1524
+ b = [p, p, t, v, v, q][mod];
1525
+
1526
+ return { r: r * 255, g: g * 255, b: b * 255 };
1527
+ }
1528
+
1529
+ // `rgbToHex`
1530
+ // Converts an RGB color to hex
1531
+ // Assumes r, g, and b are contained in the set [0, 255]
1532
+ // Returns a 3 or 6 character hex
1533
+ function rgbToHex(r, g, b, allow3Char) {
1534
+
1535
+ var hex = [
1536
+ pad2(mathRound(r).toString(16)),
1537
+ pad2(mathRound(g).toString(16)),
1538
+ pad2(mathRound(b).toString(16))
1539
+ ];
1540
+
1541
+ // Return a 3 character hex if possible
1542
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
1543
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
1544
+ }
1545
+
1546
+ return hex.join("");
1547
+ }
1548
+ // `rgbaToHex`
1549
+ // Converts an RGBA color plus alpha transparency to hex
1550
+ // Assumes r, g, b and a are contained in the set [0, 255]
1551
+ // Returns an 8 character hex
1552
+ function rgbaToHex(r, g, b, a) {
1553
+
1554
+ var hex = [
1555
+ pad2(convertDecimalToHex(a)),
1556
+ pad2(mathRound(r).toString(16)),
1557
+ pad2(mathRound(g).toString(16)),
1558
+ pad2(mathRound(b).toString(16))
1559
+ ];
1560
+
1561
+ return hex.join("");
1562
+ }
1563
+
1564
+ // `equals`
1565
+ // Can be called with any tinycolor input
1566
+ tinycolor.equals = function (color1, color2) {
1567
+ if (!color1 || !color2) { return false; }
1568
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
1569
+ };
1570
+ tinycolor.random = function() {
1571
+ return tinycolor.fromRatio({
1572
+ r: mathRandom(),
1573
+ g: mathRandom(),
1574
+ b: mathRandom()
1575
+ });
1576
+ };
1577
+
1578
+
1579
+ // Modification Functions
1580
+ // ----------------------
1581
+ // Thanks to less.js for some of the basics here
1582
+ // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
1583
+
1584
+ tinycolor.desaturate = function (color, amount) {
1585
+ amount = (amount === 0) ? 0 : (amount || 10);
1586
+ var hsl = tinycolor(color).toHsl();
1587
+ hsl.s -= amount / 100;
1588
+ hsl.s = clamp01(hsl.s);
1589
+ return tinycolor(hsl);
1590
+ };
1591
+ tinycolor.saturate = function (color, amount) {
1592
+ amount = (amount === 0) ? 0 : (amount || 10);
1593
+ var hsl = tinycolor(color).toHsl();
1594
+ hsl.s += amount / 100;
1595
+ hsl.s = clamp01(hsl.s);
1596
+ return tinycolor(hsl);
1597
+ };
1598
+ tinycolor.greyscale = function(color) {
1599
+ return tinycolor.desaturate(color, 100);
1600
+ };
1601
+ tinycolor.lighten = function(color, amount) {
1602
+ amount = (amount === 0) ? 0 : (amount || 10);
1603
+ var hsl = tinycolor(color).toHsl();
1604
+ hsl.l += amount / 100;
1605
+ hsl.l = clamp01(hsl.l);
1606
+ return tinycolor(hsl);
1607
+ };
1608
+ tinycolor.brighten = function(color, amount) {
1609
+ amount = (amount === 0) ? 0 : (amount || 10);
1610
+ var rgb = tinycolor(color).toRgb();
1611
+ rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
1612
+ rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
1613
+ rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
1614
+ return tinycolor(rgb);
1615
+ };
1616
+ tinycolor.darken = function (color, amount) {
1617
+ amount = (amount === 0) ? 0 : (amount || 10);
1618
+ var hsl = tinycolor(color).toHsl();
1619
+ hsl.l -= amount / 100;
1620
+ hsl.l = clamp01(hsl.l);
1621
+ return tinycolor(hsl);
1622
+ };
1623
+ tinycolor.complement = function(color) {
1624
+ var hsl = tinycolor(color).toHsl();
1625
+ hsl.h = (hsl.h + 180) % 360;
1626
+ return tinycolor(hsl);
1627
+ };
1628
+
1629
+
1630
+ // Combination Functions
1631
+ // ---------------------
1632
+ // Thanks to jQuery xColor for some of the ideas behind these
1633
+ // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
1634
+
1635
+ tinycolor.triad = function(color) {
1636
+ var hsl = tinycolor(color).toHsl();
1637
+ var h = hsl.h;
1638
+ return [
1639
+ tinycolor(color),
1640
+ tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
1641
+ tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
1642
+ ];
1643
+ };
1644
+ tinycolor.tetrad = function(color) {
1645
+ var hsl = tinycolor(color).toHsl();
1646
+ var h = hsl.h;
1647
+ return [
1648
+ tinycolor(color),
1649
+ tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
1650
+ tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
1651
+ tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
1652
+ ];
1653
+ };
1654
+ tinycolor.splitcomplement = function(color) {
1655
+ var hsl = tinycolor(color).toHsl();
1656
+ var h = hsl.h;
1657
+ return [
1658
+ tinycolor(color),
1659
+ tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
1660
+ tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
1661
+ ];
1662
+ };
1663
+ tinycolor.analogous = function(color, results, slices) {
1664
+ results = results || 6;
1665
+ slices = slices || 30;
1666
+
1667
+ var hsl = tinycolor(color).toHsl();
1668
+ var part = 360 / slices;
1669
+ var ret = [tinycolor(color)];
1670
+
1671
+ for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
1672
+ hsl.h = (hsl.h + part) % 360;
1673
+ ret.push(tinycolor(hsl));
1674
+ }
1675
+ return ret;
1676
+ };
1677
+ tinycolor.monochromatic = function(color, results) {
1678
+ results = results || 6;
1679
+ var hsv = tinycolor(color).toHsv();
1680
+ var h = hsv.h, s = hsv.s, v = hsv.v;
1681
+ var ret = [];
1682
+ var modification = 1 / results;
1683
+
1684
+ while (results--) {
1685
+ ret.push(tinycolor({ h: h, s: s, v: v}));
1686
+ v = (v + modification) % 1;
1687
+ }
1688
+
1689
+ return ret;
1690
+ };
1691
+
1692
+
1693
+ // Readability Functions
1694
+ // ---------------------
1695
+ // <http://www.w3.org/TR/AERT#color-contrast>
1696
+
1697
+ // `readability`
1698
+ // Analyze the 2 colors and returns an object with the following properties:
1699
+ // `brightness`: difference in brightness between the two colors
1700
+ // `color`: difference in color/hue between the two colors
1701
+ tinycolor.readability = function(color1, color2) {
1702
+ var a = tinycolor(color1).toRgb();
1703
+ var b = tinycolor(color2).toRgb();
1704
+ var brightnessA = (a.r * 299 + a.g * 587 + a.b * 114) / 1000;
1705
+ var brightnessB = (b.r * 299 + b.g * 587 + b.b * 114) / 1000;
1706
+ var colorDiff = (
1707
+ Math.max(a.r, b.r) - Math.min(a.r, b.r) +
1708
+ Math.max(a.g, b.g) - Math.min(a.g, b.g) +
1709
+ Math.max(a.b, b.b) - Math.min(a.b, b.b)
1710
+ );
1711
+
1712
+ return {
1713
+ brightness: Math.abs(brightnessA - brightnessB),
1714
+ color: colorDiff
1715
+ };
1716
+ };
1717
+
1718
+ // `readable`
1719
+ // http://www.w3.org/TR/AERT#color-contrast
1720
+ // Ensure that foreground and background color combinations provide sufficient contrast.
1721
+ // *Example*
1722
+ // tinycolor.readable("#000", "#111") => false
1723
+ tinycolor.readable = function(color1, color2) {
1724
+ var readability = tinycolor.readability(color1, color2);
1725
+ return readability.brightness > 125 && readability.color > 500;
1726
+ };
1727
+
1728
+ // `mostReadable`
1729
+ // Given a base color and a list of possible foreground or background
1730
+ // colors for that base, returns the most readable color.
1731
+ // *Example*
1732
+ // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
1733
+ tinycolor.mostReadable = function(baseColor, colorList) {
1734
+ var bestColor = null;
1735
+ var bestScore = 0;
1736
+ var bestIsReadable = false;
1737
+ for (var i=0; i < colorList.length; i++) {
1738
+
1739
+ // We normalize both around the "acceptable" breaking point,
1740
+ // but rank brightness constrast higher than hue.
1741
+
1742
+ var readability = tinycolor.readability(baseColor, colorList[i]);
1743
+ var readable = readability.brightness > 125 && readability.color > 500;
1744
+ var score = 3 * (readability.brightness / 125) + (readability.color / 500);
1745
+
1746
+ if ((readable && ! bestIsReadable) ||
1747
+ (readable && bestIsReadable && score > bestScore) ||
1748
+ ((! readable) && (! bestIsReadable) && score > bestScore)) {
1749
+ bestIsReadable = readable;
1750
+ bestScore = score;
1751
+ bestColor = tinycolor(colorList[i]);
1752
+ }
1753
+ }
1754
+ return bestColor;
1755
+ };
1756
+
1757
+
1758
+ // Big List of Colors
1759
+ // ------------------
1760
+ // <http://www.w3.org/TR/css3-color/#svg-color>
1761
+ var names = tinycolor.names = {
1762
+ aliceblue: "f0f8ff",
1763
+ antiquewhite: "faebd7",
1764
+ aqua: "0ff",
1765
+ aquamarine: "7fffd4",
1766
+ azure: "f0ffff",
1767
+ beige: "f5f5dc",
1768
+ bisque: "ffe4c4",
1769
+ black: "000",
1770
+ blanchedalmond: "ffebcd",
1771
+ blue: "00f",
1772
+ blueviolet: "8a2be2",
1773
+ brown: "a52a2a",
1774
+ burlywood: "deb887",
1775
+ burntsienna: "ea7e5d",
1776
+ cadetblue: "5f9ea0",
1777
+ chartreuse: "7fff00",
1778
+ chocolate: "d2691e",
1779
+ coral: "ff7f50",
1780
+ cornflowerblue: "6495ed",
1781
+ cornsilk: "fff8dc",
1782
+ crimson: "dc143c",
1783
+ cyan: "0ff",
1784
+ darkblue: "00008b",
1785
+ darkcyan: "008b8b",
1786
+ darkgoldenrod: "b8860b",
1787
+ darkgray: "a9a9a9",
1788
+ darkgreen: "006400",
1789
+ darkgrey: "a9a9a9",
1790
+ darkkhaki: "bdb76b",
1791
+ darkmagenta: "8b008b",
1792
+ darkolivegreen: "556b2f",
1793
+ darkorange: "ff8c00",
1794
+ darkorchid: "9932cc",
1795
+ darkred: "8b0000",
1796
+ darksalmon: "e9967a",
1797
+ darkseagreen: "8fbc8f",
1798
+ darkslateblue: "483d8b",
1799
+ darkslategray: "2f4f4f",
1800
+ darkslategrey: "2f4f4f",
1801
+ darkturquoise: "00ced1",
1802
+ darkviolet: "9400d3",
1803
+ deeppink: "ff1493",
1804
+ deepskyblue: "00bfff",
1805
+ dimgray: "696969",
1806
+ dimgrey: "696969",
1807
+ dodgerblue: "1e90ff",
1808
+ firebrick: "b22222",
1809
+ floralwhite: "fffaf0",
1810
+ forestgreen: "228b22",
1811
+ fuchsia: "f0f",
1812
+ gainsboro: "dcdcdc",
1813
+ ghostwhite: "f8f8ff",
1814
+ gold: "ffd700",
1815
+ goldenrod: "daa520",
1816
+ gray: "808080",
1817
+ green: "008000",
1818
+ greenyellow: "adff2f",
1819
+ grey: "808080",
1820
+ honeydew: "f0fff0",
1821
+ hotpink: "ff69b4",
1822
+ indianred: "cd5c5c",
1823
+ indigo: "4b0082",
1824
+ ivory: "fffff0",
1825
+ khaki: "f0e68c",
1826
+ lavender: "e6e6fa",
1827
+ lavenderblush: "fff0f5",
1828
+ lawngreen: "7cfc00",
1829
+ lemonchiffon: "fffacd",
1830
+ lightblue: "add8e6",
1831
+ lightcoral: "f08080",
1832
+ lightcyan: "e0ffff",
1833
+ lightgoldenrodyellow: "fafad2",
1834
+ lightgray: "d3d3d3",
1835
+ lightgreen: "90ee90",
1836
+ lightgrey: "d3d3d3",
1837
+ lightpink: "ffb6c1",
1838
+ lightsalmon: "ffa07a",
1839
+ lightseagreen: "20b2aa",
1840
+ lightskyblue: "87cefa",
1841
+ lightslategray: "789",
1842
+ lightslategrey: "789",
1843
+ lightsteelblue: "b0c4de",
1844
+ lightyellow: "ffffe0",
1845
+ lime: "0f0",
1846
+ limegreen: "32cd32",
1847
+ linen: "faf0e6",
1848
+ magenta: "f0f",
1849
+ maroon: "800000",
1850
+ mediumaquamarine: "66cdaa",
1851
+ mediumblue: "0000cd",
1852
+ mediumorchid: "ba55d3",
1853
+ mediumpurple: "9370db",
1854
+ mediumseagreen: "3cb371",
1855
+ mediumslateblue: "7b68ee",
1856
+ mediumspringgreen: "00fa9a",
1857
+ mediumturquoise: "48d1cc",
1858
+ mediumvioletred: "c71585",
1859
+ midnightblue: "191970",
1860
+ mintcream: "f5fffa",
1861
+ mistyrose: "ffe4e1",
1862
+ moccasin: "ffe4b5",
1863
+ navajowhite: "ffdead",
1864
+ navy: "000080",
1865
+ oldlace: "fdf5e6",
1866
+ olive: "808000",
1867
+ olivedrab: "6b8e23",
1868
+ orange: "ffa500",
1869
+ orangered: "ff4500",
1870
+ orchid: "da70d6",
1871
+ palegoldenrod: "eee8aa",
1872
+ palegreen: "98fb98",
1873
+ paleturquoise: "afeeee",
1874
+ palevioletred: "db7093",
1875
+ papayawhip: "ffefd5",
1876
+ peachpuff: "ffdab9",
1877
+ peru: "cd853f",
1878
+ pink: "ffc0cb",
1879
+ plum: "dda0dd",
1880
+ powderblue: "b0e0e6",
1881
+ purple: "800080",
1882
+ red: "f00",
1883
+ rosybrown: "bc8f8f",
1884
+ royalblue: "4169e1",
1885
+ saddlebrown: "8b4513",
1886
+ salmon: "fa8072",
1887
+ sandybrown: "f4a460",
1888
+ seagreen: "2e8b57",
1889
+ seashell: "fff5ee",
1890
+ sienna: "a0522d",
1891
+ silver: "c0c0c0",
1892
+ skyblue: "87ceeb",
1893
+ slateblue: "6a5acd",
1894
+ slategray: "708090",
1895
+ slategrey: "708090",
1896
+ snow: "fffafa",
1897
+ springgreen: "00ff7f",
1898
+ steelblue: "4682b4",
1899
+ tan: "d2b48c",
1900
+ teal: "008080",
1901
+ thistle: "d8bfd8",
1902
+ tomato: "ff6347",
1903
+ turquoise: "40e0d0",
1904
+ violet: "ee82ee",
1905
+ wheat: "f5deb3",
1906
+ white: "fff",
1907
+ whitesmoke: "f5f5f5",
1908
+ yellow: "ff0",
1909
+ yellowgreen: "9acd32"
1910
+ };
1911
+
1912
+ // Make it easy to access colors via `hexNames[hex]`
1913
+ var hexNames = tinycolor.hexNames = flip(names);
1914
+
1915
+
1916
+ // Utilities
1917
+ // ---------
1918
+
1919
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
1920
+ function flip(o) {
1921
+ var flipped = { };
1922
+ for (var i in o) {
1923
+ if (o.hasOwnProperty(i)) {
1924
+ flipped[o[i]] = i;
1925
+ }
1926
+ }
1927
+ return flipped;
1928
+ }
1929
+
1930
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
1931
+ function boundAlpha(a) {
1932
+ a = parseFloat(a);
1933
+
1934
+ if (isNaN(a) || a < 0 || a > 1) {
1935
+ a = 1;
1936
+ }
1937
+
1938
+ return a;
1939
+ }
1940
+
1941
+ // Take input from [0, n] and return it as [0, 1]
1942
+ function bound01(n, max) {
1943
+ if (isOnePointZero(n)) { n = "100%"; }
1944
+
1945
+ var processPercent = isPercentage(n);
1946
+ n = mathMin(max, mathMax(0, parseFloat(n)));
1947
+
1948
+ // Automatically convert percentage into number
1949
+ if (processPercent) {
1950
+ n = parseInt(n * max, 10) / 100;
1951
+ }
1952
+
1953
+ // Handle floating point rounding errors
1954
+ if ((math.abs(n - max) < 0.000001)) {
1955
+ return 1;
1956
+ }
1957
+
1958
+ // Convert into [0, 1] range if it isn't already
1959
+ return (n % max) / parseFloat(max);
1960
+ }
1961
+
1962
+ // Force a number between 0 and 1
1963
+ function clamp01(val) {
1964
+ return mathMin(1, mathMax(0, val));
1965
+ }
1966
+
1967
+ // Parse a base-16 hex value into a base-10 integer
1968
+ function parseIntFromHex(val) {
1969
+ return parseInt(val, 16);
1970
+ }
1971
+
1972
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
1973
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
1974
+ function isOnePointZero(n) {
1975
+ return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
1976
+ }
1977
+
1978
+ // Check to see if string passed in is a percentage
1979
+ function isPercentage(n) {
1980
+ return typeof n === "string" && n.indexOf('%') != -1;
1981
+ }
1982
+
1983
+ // Force a hex value to have 2 characters
1984
+ function pad2(c) {
1985
+ return c.length == 1 ? '0' + c : '' + c;
1986
+ }
1987
+
1988
+ // Replace a decimal with it's percentage value
1989
+ function convertToPercentage(n) {
1990
+ if (n <= 1) {
1991
+ n = (n * 100) + "%";
1992
+ }
1993
+
1994
+ return n;
1995
+ }
1996
+
1997
+ // Converts a decimal to a hex value
1998
+ function convertDecimalToHex(d) {
1999
+ return Math.round(parseFloat(d) * 255).toString(16);
2000
+ }
2001
+ // Converts a hex value to a decimal
2002
+ function convertHexToDecimal(h) {
2003
+ return (parseIntFromHex(h) / 255);
2004
+ }
2005
+
2006
+ var matchers = (function() {
2007
+
2008
+ // <http://www.w3.org/TR/css3-values/#integers>
2009
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
2010
+
2011
+ // <http://www.w3.org/TR/css3-values/#number-value>
2012
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
2013
+
2014
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
2015
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
2016
+
2017
+ // Actual matching.
2018
+ // Parentheses and commas are optional, but not required.
2019
+ // Whitespace can take the place of commas or opening paren
2020
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2021
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2022
+
2023
+ return {
2024
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
2025
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
2026
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
2027
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
2028
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
2029
+ hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2030
+ hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
2031
+ hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
2032
+ };
2033
+ })();
2034
+
2035
+ // `stringInputToObject`
2036
+ // Permissive string parsing. Take in a number of formats, and output an object
2037
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
2038
+ function stringInputToObject(color) {
2039
+
2040
+ color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
2041
+ var named = false;
2042
+ if (names[color]) {
2043
+ color = names[color];
2044
+ named = true;
2045
+ }
2046
+ else if (color == 'transparent') {
2047
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
2048
+ }
2049
+
2050
+ // Try to match string input using regular expressions.
2051
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
2052
+ // Just return an object and let the conversion functions handle that.
2053
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
2054
+ var match;
2055
+ if ((match = matchers.rgb.exec(color))) {
2056
+ return { r: match[1], g: match[2], b: match[3] };
2057
+ }
2058
+ if ((match = matchers.rgba.exec(color))) {
2059
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
2060
+ }
2061
+ if ((match = matchers.hsl.exec(color))) {
2062
+ return { h: match[1], s: match[2], l: match[3] };
2063
+ }
2064
+ if ((match = matchers.hsla.exec(color))) {
2065
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
2066
+ }
2067
+ if ((match = matchers.hsv.exec(color))) {
2068
+ return { h: match[1], s: match[2], v: match[3] };
2069
+ }
2070
+ if ((match = matchers.hex8.exec(color))) {
2071
+ return {
2072
+ a: convertHexToDecimal(match[1]),
2073
+ r: parseIntFromHex(match[2]),
2074
+ g: parseIntFromHex(match[3]),
2075
+ b: parseIntFromHex(match[4]),
2076
+ format: named ? "name" : "hex8"
2077
+ };
2078
+ }
2079
+ if ((match = matchers.hex6.exec(color))) {
2080
+ return {
2081
+ r: parseIntFromHex(match[1]),
2082
+ g: parseIntFromHex(match[2]),
2083
+ b: parseIntFromHex(match[3]),
2084
+ format: named ? "name" : "hex"
2085
+ };
2086
+ }
2087
+ if ((match = matchers.hex3.exec(color))) {
2088
+ return {
2089
+ r: parseIntFromHex(match[1] + '' + match[1]),
2090
+ g: parseIntFromHex(match[2] + '' + match[2]),
2091
+ b: parseIntFromHex(match[3] + '' + match[3]),
2092
+ format: named ? "name" : "hex"
2093
+ };
2094
+ }
2095
+
2096
+ return false;
2097
+ }
2098
+
2099
+ window.tinycolor = tinycolor;
2100
+ })();
2101
+
2102
+
2103
+ $(function () {
2104
+ if ($.fn.spectrum.load) {
2105
+ $.fn.spectrum.processNativeColorInputs();
2106
+ }
2107
+ });
2108
+
2109
+ })(window, jQuery);
js/toggledesigner.js ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jslint browser: true, white: true */
2
+ /*global console,jQuery,megamenu,window,navigator*/
3
+
4
+ /**
5
+ * Max Mega Menu jQuery Plugin
6
+ */
7
+ jQuery(function($) {
8
+
9
+ // Make block areas sortable
10
+ $( ".mega-blocks .mega-left" ).sortable({
11
+ forcePlaceholderSize: false,
12
+ items : '.block',
13
+ stop: function() {
14
+ reindex_blocks();
15
+ },
16
+ connectWith: ".mega-blocks .mega-right, .mega-blocks .mega-center"
17
+ });
18
+
19
+ $( ".mega-blocks .mega-right" ).sortable({
20
+ forcePlaceholderSize: false,
21
+ items : '.block',
22
+ stop: function() {
23
+ reindex_blocks();
24
+ },
25
+ connectWith: ".mega-blocks .mega-left, .mega-blocks .mega-center"
26
+ });
27
+
28
+ $( ".mega-blocks .mega-center" ).sortable({
29
+ forcePlaceholderSize: false,
30
+ items : '.block',
31
+ stop: function() {
32
+ reindex_blocks();
33
+ },
34
+ connectWith: ".mega-blocks .mega-left, .mega-blocks .mega-right"
35
+ });
36
+
37
+
38
+ // Reindex blocks based on position
39
+ var reindex_blocks = function() {
40
+ var i = 0;
41
+
42
+ $(".mega-blocks .block").each(function() {
43
+ i++;
44
+
45
+ var block = $(this);
46
+
47
+ block.find('input, select').each(function() {
48
+ // account for inputs created by select2
49
+ if (typeof $(this).attr('name') !== 'undefined') {
50
+ $(this).attr('name', $(this).attr('name').replace(/\[\d+\]/g, "[" + i + "]"));
51
+ }
52
+ });
53
+
54
+ // update the align value based on block position
55
+ block.find('input.align').each(function() {
56
+ if (block.parent().hasClass('mega-right')) {
57
+ $(this).attr('value', 'right');
58
+ } else if (block.parent().hasClass('mega-center')) {
59
+ $(this).attr('value', 'center');
60
+ } else {
61
+ $(this).attr('value', 'left');
62
+ }
63
+ });
64
+ });
65
+ };
66
+
67
+
68
+ // Delete block
69
+ $( ".block-settings a.mega-delete").live('click', function(e) {
70
+ e.preventDefault();
71
+ $(this).parent(".block-settings").parent(".block").remove();
72
+ reindex_blocks();
73
+ });
74
+
75
+
76
+ // Show/hide block settings
77
+ $( ".block-title span").live('click', function() {
78
+ var settings = $(this).parent().parent().find(".block-settings");
79
+ $(".block").removeClass('mega-open');
80
+
81
+ if ( settings.is(":visible") ) {
82
+ settings.parent().removeClass('mega-open');
83
+ settings.hide();
84
+ } else {
85
+ settings.parent().addClass('mega-open');
86
+ $(".block-settings").hide();
87
+ settings.show();
88
+ }
89
+
90
+ });
91
+
92
+
93
+ // Add block to designer
94
+ $( "#toggle-block-selector").on('change', function() {
95
+ var selected_option = $("#toggle-block-selector").find(":selected");
96
+ var val = selected_option.attr('value');
97
+
98
+ if (val == 'title') {
99
+ return;
100
+ }
101
+
102
+ $.ajax({
103
+ type: 'POST',
104
+ url: ajaxurl,
105
+ data: {
106
+ action: "mm_get_toggle_block_" + val,
107
+ _wpnonce: megamenu.nonce
108
+ },
109
+ cache: false,
110
+ success: function(response) {
111
+
112
+ var $response = $(response);
113
+
114
+ // initiate color picker fields
115
+ $(".mm_colorpicker", $response).spectrum({
116
+ preferredFormat: "rgb",
117
+ showInput: true,
118
+ showAlpha: true,
119
+ clickoutFiresChange: true,
120
+ change: function(color) {
121
+ if (color.getAlpha() === 0) {
122
+ $(this).siblings('div.chosen-color').html('transparent');
123
+ } else {
124
+ $(this).siblings('div.chosen-color').html(color.toRgbString());
125
+ }
126
+ }
127
+ });
128
+
129
+ // initiate icon selector dropdowns
130
+ $('.icon_dropdown', $response).select2({
131
+ containerCssClass: 'tpx-select2-container select2-container-sm',
132
+ dropdownCssClass: 'tpx-select2-drop',
133
+ minimumResultsForSearch: -1,
134
+ formatResult: function(icon) {
135
+ return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
136
+ },
137
+ formatSelection: function (icon) {
138
+ return '<i class="dashicons ' + $(icon.element).attr('data-class') + '"></i>';
139
+ }
140
+ });
141
+
142
+ // add the block
143
+ $(".mega-blocks .mega-left").append($response);
144
+
145
+ // reinded blocks
146
+ reindex_blocks();
147
+
148
+ // reset the select dropdown
149
+ $("#toggle-block-selector").val("title");
150
+ }
151
+ });
152
+ });
153
+ });
languages/megamenu-de_DE.mo ADDED
Binary file
languages/megamenu-de_DE.po ADDED
@@ -0,0 +1,1122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: MaxMenu v1.2.2\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-03-28 18:52-0000\n"
6
+ "PO-Revision-Date: 2015-03-28 18:53-0000\n"
7
+ "Last-Translator: thomas <t.meyer@me.com>\n"
8
+ "Language-Team: \n"
9
+ "Language: de_DE\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 1.5.7\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n: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-Basepath: ../\n"
19
+ "X-Textdomain-Support: yes\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+
22
+ # @ megamenu
23
+ #: megamenu.php:456
24
+ #, fuzzy
25
+ msgid ""
26
+ "Max Mega Menu is not compatible with your version of WordPress. Please "
27
+ "upgrade WordPress to the latest version or disable Max Mega Menu."
28
+ msgstr ""
29
+ "Mega Menu ist nicht kompatibel mit dieser WordPress Version. Bitte WordPress "
30
+ "auf die aktuelle Version aktualisieren oder Mega Menu deaktivieren."
31
+
32
+ # @ megamenu
33
+ #: megamenu.php:467
34
+ #, fuzzy
35
+ msgid ""
36
+ "Max Mega Menu is not compatible with Uber Menu. Please disable Uber Menu."
37
+ msgstr ""
38
+ "Mega Menu ist nicht kompatibel mit Ãœber Menu. Bitte Ãœber Menu deaktivieren."
39
+
40
+ #: megamenu.php:480
41
+ msgid "click here"
42
+ msgstr ""
43
+
44
+ #: megamenu.php:483
45
+ #, php-format
46
+ msgid "Thanks for installing Max Mega Menu! Please %s to get started."
47
+ msgstr ""
48
+
49
+ # @ megamenu
50
+ #: classes/menu-item-manager.class.php:171
51
+ #: classes/menu-item-manager.class.php:264 classes/nav-menus.class.php:127
52
+ #, fuzzy
53
+ msgid "Mega Menu"
54
+ msgstr "Mega Menu Panel"
55
+
56
+ #: classes/menu-item-manager.class.php:172
57
+ msgid "Mega Menus can only be created on top level menu items."
58
+ msgstr ""
59
+
60
+ #: classes/menu-item-manager.class.php:183
61
+ msgid "Enable Mega Menu"
62
+ msgstr ""
63
+
64
+ #: classes/menu-item-manager.class.php:186
65
+ msgid "column"
66
+ msgstr ""
67
+
68
+ #: classes/menu-item-manager.class.php:187
69
+ #: classes/menu-item-manager.class.php:188
70
+ #: classes/menu-item-manager.class.php:189
71
+ #: classes/menu-item-manager.class.php:190
72
+ #: classes/menu-item-manager.class.php:191
73
+ #: classes/menu-item-manager.class.php:192
74
+ #: classes/menu-item-manager.class.php:193
75
+ msgid "columns"
76
+ msgstr ""
77
+
78
+ # @ megamenu
79
+ #: classes/menu-item-manager.class.php:197
80
+ #, fuzzy
81
+ msgid "Select a Widget to add to the panel"
82
+ msgstr "Widget für das Mega Panel auswählen"
83
+
84
+ # @ megamenu
85
+ #: classes/menu-item-manager.class.php:213
86
+ #, fuzzy
87
+ msgid "Sub menu items"
88
+ msgstr "Untermenü Typ"
89
+
90
+ #: classes/menu-item-manager.class.php:233
91
+ msgid "Widgets"
92
+ msgstr ""
93
+
94
+ #: classes/menu-item-manager.class.php:258
95
+ msgid ""
96
+ "No widgets found. Add a widget to this area using the Widget Selector (top "
97
+ "right)"
98
+ msgstr ""
99
+
100
+ # @ megamenu
101
+ #: classes/menu-item-manager.class.php:284
102
+ #, fuzzy
103
+ msgid "Menu Item Settings"
104
+ msgstr "Mega Menu Einstellungen"
105
+
106
+ #: classes/menu-item-manager.class.php:288
107
+ msgid "Hide Text"
108
+ msgstr ""
109
+
110
+ #: classes/menu-item-manager.class.php:295
111
+ #: classes/menu-item-manager.class.php:331
112
+ #: classes/menu-item-manager.class.php:356
113
+ msgid "Option only available for top level menu items"
114
+ msgstr ""
115
+
116
+ #: classes/menu-item-manager.class.php:302
117
+ msgid "Hide Arrow"
118
+ msgstr ""
119
+
120
+ # @ megamenu
121
+ #: classes/menu-item-manager.class.php:310
122
+ #, fuzzy
123
+ msgid "Disable Link"
124
+ msgstr "Deaktiviert"
125
+
126
+ #: classes/menu-item-manager.class.php:318
127
+ msgid "Menu Item Align"
128
+ msgstr ""
129
+
130
+ # @ megamenu
131
+ #: classes/menu-item-manager.class.php:324
132
+ #: classes/menu-item-manager.class.php:349 classes/settings.class.php:815
133
+ #: classes/settings.class.php:904 classes/settings.class.php:1086
134
+ #: classes/settings.class.php:1208 classes/settings.class.php:1234
135
+ #: classes/settings.class.php:1286 classes/settings.class.php:1368
136
+ #: classes/settings.class.php:1447 classes/settings.class.php:1488
137
+ #: classes/settings.class.php:1641
138
+ msgid "Left"
139
+ msgstr "Links"
140
+
141
+ # @ megamenu
142
+ #: classes/menu-item-manager.class.php:325
143
+ #: classes/menu-item-manager.class.php:350 classes/settings.class.php:819
144
+ #: classes/settings.class.php:896 classes/settings.class.php:1078
145
+ #: classes/settings.class.php:1200 classes/settings.class.php:1226
146
+ #: classes/settings.class.php:1278 classes/settings.class.php:1360
147
+ #: classes/settings.class.php:1439 classes/settings.class.php:1480
148
+ #: classes/settings.class.php:1643
149
+ msgid "Right"
150
+ msgstr "Rechts"
151
+
152
+ #: classes/menu-item-manager.class.php:328
153
+ msgid ""
154
+ "Right aligned items will appear in reverse order on the right hand side of "
155
+ "the menu bar"
156
+ msgstr ""
157
+
158
+ # @ megamenu
159
+ #: classes/menu-item-manager.class.php:338
160
+ #, fuzzy
161
+ msgid "Sub Menu Settings"
162
+ msgstr "Mega Menu Einstellungen"
163
+
164
+ # @ megamenu
165
+ #: classes/menu-item-manager.class.php:343
166
+ #, fuzzy
167
+ msgid "Sub Menu Align"
168
+ msgstr "Untermenü Position"
169
+
170
+ #: classes/menu-item-manager.class.php:353
171
+ msgid ""
172
+ "Right aligned sub menus will align to the right of the parent menu item and "
173
+ "expand to the left"
174
+ msgstr ""
175
+
176
+ # @ megamenu
177
+ #: classes/menu-item-manager.class.php:366 classes/settings.class.php:439
178
+ #: classes/settings.class.php:626
179
+ msgid "General Settings"
180
+ msgstr "Allgemeine Einstellungen"
181
+
182
+ #: classes/menu-item-manager.class.php:385
183
+ msgid "Dashicons"
184
+ msgstr ""
185
+
186
+ # @ megamenu
187
+ #: classes/menu-item-manager.class.php:422
188
+ msgid "Menu Icon"
189
+ msgstr "Menü Icon"
190
+
191
+ # @ megamenu
192
+ #: classes/nav-menus.class.php:84
193
+ msgid "Mega Menu Settings"
194
+ msgstr "Mega Menu Einstellungen"
195
+
196
+ # @ megamenu
197
+ #: classes/nav-menus.class.php:126
198
+ msgid "Launched for Menu ID"
199
+ msgstr "Für Menü-ID gestartet"
200
+
201
+ #: classes/nav-menus.class.php:128
202
+ msgid "Saving"
203
+ msgstr ""
204
+
205
+ # @ megamenu
206
+ #: classes/nav-menus.class.php:130
207
+ msgid "Oops. Something went wrong. Please reload the page."
208
+ msgstr "Oops. Irgendwas ist schief gelaufen. Bitte lade die Seite neu."
209
+
210
+ # @ megamenu
211
+ #: classes/nav-menus.class.php:201
212
+ msgid "This theme does not have any menu locations."
213
+ msgstr "Dieses Theme besitzt keine Menü Positionen."
214
+
215
+ # @ megamenu
216
+ #: classes/nav-menus.class.php:205
217
+ msgid ""
218
+ "This menu is not tagged to a location. Please tag a location to enable the "
219
+ "Mega Menu settings."
220
+ msgstr ""
221
+ "Dieses Menü ist keiner Position zugeordnet. Bitte weise dem Menü eine "
222
+ "Position zu, um die Mega Menü Einstellungen zu aktivieren. "
223
+
224
+ # @ default
225
+ #: classes/nav-menus.class.php:245 classes/widget-manager.class.php:456
226
+ msgid "Save"
227
+ msgstr ""
228
+
229
+ # @ megamenu
230
+ #: classes/nav-menus.class.php:260
231
+ msgid "Enable"
232
+ msgstr "Aktiv"
233
+
234
+ # @ megamenu
235
+ #: classes/nav-menus.class.php:266
236
+ msgid "Event"
237
+ msgstr "Auslöser"
238
+
239
+ # @ megamenu
240
+ #: classes/nav-menus.class.php:269
241
+ msgid "Hover"
242
+ msgstr "Hover"
243
+
244
+ # @ megamenu
245
+ #: classes/nav-menus.class.php:270
246
+ msgid "Click"
247
+ msgstr "Klick"
248
+
249
+ # @ megamenu
250
+ #: classes/nav-menus.class.php:275
251
+ msgid "Effect"
252
+ msgstr "Effekt"
253
+
254
+ # @ megamenu
255
+ #: classes/nav-menus.class.php:284 classes/settings.class.php:1663
256
+ msgid "None"
257
+ msgstr "Keiner"
258
+
259
+ # @ megamenu
260
+ #: classes/nav-menus.class.php:288
261
+ msgid "Fade"
262
+ msgstr "Einblenden"
263
+
264
+ # @ megamenu
265
+ #: classes/nav-menus.class.php:292
266
+ msgid "Slide"
267
+ msgstr "Herunterklappen"
268
+
269
+ # @ megamenu
270
+ #: classes/nav-menus.class.php:306
271
+ msgid "Theme"
272
+ msgstr "Vorlage"
273
+
274
+ # @ megamenu
275
+ #: classes/settings.class.php:239
276
+ #, fuzzy
277
+ msgid "Copy"
278
+ msgstr " Kopie"
279
+
280
+ # @ megamenu
281
+ #: classes/settings.class.php:416 classes/settings.class.php:584
282
+ #, fuzzy
283
+ msgid "Max Mega Menu"
284
+ msgstr "Mega Menu Panel"
285
+
286
+ #: classes/settings.class.php:444
287
+ msgid "CSS Output"
288
+ msgstr ""
289
+
290
+ #: classes/settings.class.php:450
291
+ msgid "Enqueue dynamically via admin-ajax.php"
292
+ msgstr ""
293
+
294
+ #: classes/settings.class.php:451
295
+ msgid "Save to filesystem"
296
+ msgstr ""
297
+
298
+ #: classes/settings.class.php:452
299
+ msgid "Output in &lt;head&gt;"
300
+ msgstr ""
301
+
302
+ #: classes/settings.class.php:453
303
+ msgid "Don't output CSS"
304
+ msgstr ""
305
+
306
+ #: classes/settings.class.php:456
307
+ msgid ""
308
+ "Default. CSS will be enqueued dynamically through admin-ajax.php and loaded "
309
+ "from the cache."
310
+ msgstr ""
311
+
312
+ #: classes/settings.class.php:457
313
+ msgid ""
314
+ "CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued "
315
+ "from there."
316
+ msgstr ""
317
+
318
+ #: classes/settings.class.php:458
319
+ msgid ""
320
+ "CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; "
321
+ "of the page."
322
+ msgstr ""
323
+
324
+ #: classes/settings.class.php:459
325
+ msgid "CSS will not be output, you must enqueue the CSS for the menu manually."
326
+ msgstr ""
327
+
328
+ #: classes/settings.class.php:465
329
+ msgid "Click Event Behaviour"
330
+ msgstr ""
331
+
332
+ #: classes/settings.class.php:467
333
+ msgid ""
334
+ "Define what should happen when the event is set to 'click'. This also "
335
+ "applies to mobiles."
336
+ msgstr ""
337
+
338
+ #: classes/settings.class.php:472
339
+ msgid "First click will open a sub menu, second click will close the sub menu."
340
+ msgstr ""
341
+
342
+ #: classes/settings.class.php:473
343
+ msgid "First click will open a sub menu, second click will follow the link."
344
+ msgstr ""
345
+
346
+ # @ megamenu
347
+ #: classes/settings.class.php:483
348
+ #, fuzzy
349
+ msgid "Menu Settings"
350
+ msgstr "Mega Menu Einstellungen"
351
+
352
+ #: classes/settings.class.php:485
353
+ msgid ""
354
+ "Menu specific settings (e.g, click or hover event, menu theme, transition "
355
+ "effect) can be found under"
356
+ msgstr ""
357
+
358
+ #: classes/settings.class.php:485
359
+ msgid "Appearance > Menus"
360
+ msgstr ""
361
+
362
+ #: classes/settings.class.php:515
363
+ msgid "Cache"
364
+ msgstr ""
365
+
366
+ #: classes/settings.class.php:517
367
+ msgid "Regenerate CSS"
368
+ msgstr ""
369
+
370
+ #: classes/settings.class.php:518
371
+ msgid "Regenerate the CSS."
372
+ msgstr ""
373
+
374
+ #: classes/settings.class.php:525
375
+ msgid "Plugin Data"
376
+ msgstr ""
377
+
378
+ # @ megamenu
379
+ #: classes/settings.class.php:527
380
+ #, fuzzy
381
+ msgid "Delete Data"
382
+ msgstr "%s gelöscht"
383
+
384
+ #: classes/settings.class.php:528
385
+ msgid ""
386
+ "Delete all saved Max Mega Menu plugin data from the database. Use with "
387
+ "caution!"
388
+ msgstr ""
389
+
390
+ #: classes/settings.class.php:548
391
+ msgid "Homepage"
392
+ msgstr ""
393
+
394
+ #: classes/settings.class.php:553
395
+ msgid "Documentation"
396
+ msgstr ""
397
+
398
+ #: classes/settings.class.php:558
399
+ msgid "Support"
400
+ msgstr ""
401
+
402
+ #: classes/settings.class.php:566
403
+ msgid "Core version"
404
+ msgstr ""
405
+
406
+ #: classes/settings.class.php:627
407
+ msgid "Tools"
408
+ msgstr ""
409
+
410
+ # @ megamenu
411
+ #: classes/settings.class.php:628
412
+ #, fuzzy
413
+ msgid "Theme Editor"
414
+ msgstr "Theme gelöscht"
415
+
416
+ # @ megamenu
417
+ #: classes/settings.class.php:685
418
+ msgid "Failed to delete theme. The theme is in use by a menu."
419
+ msgstr "Theme kann nicht gelöscht werden, da es von einem Menü benutzt wird."
420
+
421
+ #: classes/settings.class.php:689
422
+ msgid "CSS cache cleared and CSS regenerated"
423
+ msgstr ""
424
+
425
+ #: classes/settings.class.php:693
426
+ msgid "All plugin data removed"
427
+ msgstr ""
428
+
429
+ # @ megamenu
430
+ #: classes/settings.class.php:698
431
+ msgid "Theme Deleted"
432
+ msgstr "Theme gelöscht"
433
+
434
+ # @ megamenu
435
+ #: classes/settings.class.php:702
436
+ msgid "Theme Duplicated"
437
+ msgstr "Theme dupliziert"
438
+
439
+ # @ megamenu
440
+ #: classes/settings.class.php:706
441
+ msgid "Changes Saved"
442
+ msgstr "Änderungen gespeichert"
443
+
444
+ # @ megamenu
445
+ #: classes/settings.class.php:710
446
+ msgid "Theme Reverted"
447
+ msgstr "Theme wiederhergestellt"
448
+
449
+ # @ megamenu
450
+ #: classes/settings.class.php:714
451
+ msgid "New Theme Created"
452
+ msgstr "Neues Theme erstellt"
453
+
454
+ # @ megamenu
455
+ #: classes/settings.class.php:775
456
+ msgid "Select theme to edit"
457
+ msgstr "Theme zum Bearbeiten auswählen"
458
+
459
+ #: classes/settings.class.php:775 classes/settings.class.php:776
460
+ msgid "or"
461
+ msgstr ""
462
+
463
+ # @ megamenu
464
+ #: classes/settings.class.php:776
465
+ #, fuzzy
466
+ msgid "create a new theme"
467
+ msgstr "Neues Theme erstellen"
468
+
469
+ # @ megamenu
470
+ #: classes/settings.class.php:777
471
+ #, fuzzy
472
+ msgid "duplicate this theme"
473
+ msgstr "Theme kopieren"
474
+
475
+ # @ megamenu
476
+ #: classes/settings.class.php:786
477
+ #, fuzzy
478
+ msgid "Editing Theme:"
479
+ msgstr "Bearbeiten von Theme: "
480
+
481
+ # @ megamenu
482
+ #: classes/settings.class.php:787
483
+ #, fuzzy
484
+ msgid "General Theme Settings"
485
+ msgstr "Allgemeine Einstellungen"
486
+
487
+ # @ megamenu
488
+ #: classes/settings.class.php:792
489
+ #, fuzzy
490
+ msgid "Theme Title"
491
+ msgstr "Theme gelöscht"
492
+
493
+ # @ megamenu
494
+ #: classes/settings.class.php:800
495
+ #, fuzzy
496
+ msgid "Arrow"
497
+ msgstr "Rechts"
498
+
499
+ # @ megamenu
500
+ #: classes/settings.class.php:802
501
+ #, fuzzy
502
+ msgid "Select the arrow styles."
503
+ msgstr "Theme zum Bearbeiten auswählen"
504
+
505
+ #: classes/settings.class.php:807
506
+ msgid "Up"
507
+ msgstr ""
508
+
509
+ #: classes/settings.class.php:811
510
+ msgid "Down"
511
+ msgstr ""
512
+
513
+ #: classes/settings.class.php:826
514
+ msgid "Responsive Breakpoint"
515
+ msgstr ""
516
+
517
+ #: classes/settings.class.php:828
518
+ msgid ""
519
+ "Set the width at which the menu turns into a mobile menu. Set to 0 to "
520
+ "disable responsive menu."
521
+ msgstr ""
522
+
523
+ #: classes/settings.class.php:835
524
+ msgid "Responsive Menu Text"
525
+ msgstr ""
526
+
527
+ #: classes/settings.class.php:837
528
+ msgid "Text to display next to the mobile toggle icon."
529
+ msgstr ""
530
+
531
+ #: classes/settings.class.php:844
532
+ msgid "Line Height"
533
+ msgstr ""
534
+
535
+ #: classes/settings.class.php:846
536
+ msgid "Set the general line height to use in the panel contents."
537
+ msgstr ""
538
+
539
+ #: classes/settings.class.php:853
540
+ msgid "Z-Index"
541
+ msgstr ""
542
+
543
+ #: classes/settings.class.php:855
544
+ msgid "Set the z-index to ensure the panels appear ontop of other content."
545
+ msgstr ""
546
+
547
+ # @ megamenu
548
+ #: classes/settings.class.php:862
549
+ msgid "Menu Bar"
550
+ msgstr "Menü Leiste"
551
+
552
+ # @ megamenu
553
+ #: classes/settings.class.php:867
554
+ #, fuzzy
555
+ msgid "Menu Background"
556
+ msgstr "Menü Leiste"
557
+
558
+ #: classes/settings.class.php:869
559
+ msgid ""
560
+ "The background color for the main menu bar. Set each value to transparent "
561
+ "for a 'button' style menu."
562
+ msgstr ""
563
+
564
+ #: classes/settings.class.php:874 classes/settings.class.php:960
565
+ #: classes/settings.class.php:978 classes/settings.class.php:1163
566
+ #: classes/settings.class.php:1388 classes/settings.class.php:1406
567
+ msgid "From"
568
+ msgstr ""
569
+
570
+ #: classes/settings.class.php:878 classes/settings.class.php:964
571
+ #: classes/settings.class.php:982 classes/settings.class.php:1167
572
+ #: classes/settings.class.php:1392 classes/settings.class.php:1410
573
+ msgid "To"
574
+ msgstr ""
575
+
576
+ # @ megamenu
577
+ #: classes/settings.class.php:885
578
+ #, fuzzy
579
+ msgid "Menu Padding"
580
+ msgstr "Menü Leiste"
581
+
582
+ #: classes/settings.class.php:887
583
+ msgid "Padding for the main menu bar."
584
+ msgstr ""
585
+
586
+ #: classes/settings.class.php:892 classes/settings.class.php:1074
587
+ #: classes/settings.class.php:1196 classes/settings.class.php:1222
588
+ #: classes/settings.class.php:1274 classes/settings.class.php:1356
589
+ #: classes/settings.class.php:1435 classes/settings.class.php:1476
590
+ msgid "Top"
591
+ msgstr ""
592
+
593
+ #: classes/settings.class.php:900 classes/settings.class.php:1082
594
+ #: classes/settings.class.php:1204 classes/settings.class.php:1230
595
+ #: classes/settings.class.php:1282 classes/settings.class.php:1364
596
+ #: classes/settings.class.php:1443 classes/settings.class.php:1484
597
+ msgid "Bottom"
598
+ msgstr ""
599
+
600
+ #: classes/settings.class.php:911 classes/settings.class.php:1241
601
+ #: classes/settings.class.php:1495
602
+ msgid "Rounded Corners"
603
+ msgstr ""
604
+
605
+ #: classes/settings.class.php:913
606
+ msgid "Set a border radius on the main menu bar."
607
+ msgstr ""
608
+
609
+ # @ megamenu
610
+ #: classes/settings.class.php:918 classes/settings.class.php:1100
611
+ #: classes/settings.class.php:1248 classes/settings.class.php:1502
612
+ #, fuzzy
613
+ msgid "Top Left"
614
+ msgstr "Links"
615
+
616
+ # @ megamenu
617
+ #: classes/settings.class.php:922 classes/settings.class.php:1104
618
+ #: classes/settings.class.php:1252 classes/settings.class.php:1506
619
+ #, fuzzy
620
+ msgid "Top Right"
621
+ msgstr "Rechts"
622
+
623
+ #: classes/settings.class.php:926 classes/settings.class.php:1108
624
+ #: classes/settings.class.php:1256 classes/settings.class.php:1510
625
+ msgid "Bottom Right"
626
+ msgstr ""
627
+
628
+ #: classes/settings.class.php:930 classes/settings.class.php:1112
629
+ #: classes/settings.class.php:1260 classes/settings.class.php:1514
630
+ msgid "Bottom Left"
631
+ msgstr ""
632
+
633
+ # @ megamenu
634
+ #: classes/settings.class.php:937
635
+ #, fuzzy
636
+ msgid "Menu Items Align"
637
+ msgstr "Menü Icon"
638
+
639
+ #: classes/settings.class.php:939
640
+ msgid ""
641
+ "Align all menu items to the left (default), centrally or to the right. To "
642
+ "align a single menu item to the right, use the Mega Menu options for the "
643
+ "menu item."
644
+ msgstr ""
645
+
646
+ # @ megamenu
647
+ #: classes/settings.class.php:948
648
+ msgid "Top Level Menu Items"
649
+ msgstr "Hauptmenü Einträge"
650
+
651
+ # @ megamenu
652
+ #: classes/settings.class.php:953
653
+ #, fuzzy
654
+ msgid "Menu Item Background"
655
+ msgstr "Menü Icon"
656
+
657
+ #: classes/settings.class.php:955
658
+ msgid ""
659
+ "The background color for each top level menu item. Tip: Set these values to "
660
+ "transparent if you've already set a background color on the menu container."
661
+ msgstr ""
662
+
663
+ #: classes/settings.class.php:971
664
+ msgid "Menu Item Background (Hover)"
665
+ msgstr ""
666
+
667
+ #: classes/settings.class.php:973
668
+ msgid "The background color for a top level menu item (on hover)."
669
+ msgstr ""
670
+
671
+ # @ megamenu
672
+ #: classes/settings.class.php:989
673
+ #, fuzzy
674
+ msgid "Menu Item Spacing"
675
+ msgstr "Menü Icon"
676
+
677
+ #: classes/settings.class.php:991
678
+ msgid "Define the size of the gap between each top level menu item."
679
+ msgstr ""
680
+
681
+ #: classes/settings.class.php:1000
682
+ msgid "Menu Item Height"
683
+ msgstr ""
684
+
685
+ #: classes/settings.class.php:1002
686
+ msgid ""
687
+ "Define the height of each top level menu item. This value, plus the "
688
+ "container top and bottom padding values define the overall height of the "
689
+ "menu bar."
690
+ msgstr ""
691
+
692
+ #: classes/settings.class.php:1011 classes/settings.class.php:1521
693
+ msgid "Font"
694
+ msgstr ""
695
+
696
+ #: classes/settings.class.php:1013
697
+ msgid "The font to use for each top level menu item."
698
+ msgstr ""
699
+
700
+ #: classes/settings.class.php:1018 classes/settings.class.php:1052
701
+ #: classes/settings.class.php:1130 classes/settings.class.php:1192
702
+ #: classes/settings.class.php:1300 classes/settings.class.php:1334
703
+ #: classes/settings.class.php:1472 classes/settings.class.php:1528
704
+ #: classes/settings.class.php:1562
705
+ msgid "Color"
706
+ msgstr ""
707
+
708
+ #: classes/settings.class.php:1022 classes/settings.class.php:1304
709
+ #: classes/settings.class.php:1338 classes/settings.class.php:1532
710
+ msgid "Size"
711
+ msgstr ""
712
+
713
+ #: classes/settings.class.php:1026 classes/settings.class.php:1308
714
+ #: classes/settings.class.php:1342 classes/settings.class.php:1536
715
+ msgid "Family"
716
+ msgstr ""
717
+
718
+ #: classes/settings.class.php:1030 classes/settings.class.php:1316
719
+ #: classes/settings.class.php:1540
720
+ msgid "Transform"
721
+ msgstr ""
722
+
723
+ # @ megamenu
724
+ #: classes/settings.class.php:1034 classes/settings.class.php:1056
725
+ #: classes/settings.class.php:1312 classes/settings.class.php:1544
726
+ #: classes/settings.class.php:1566
727
+ #, fuzzy
728
+ msgid "Weight"
729
+ msgstr "Rechts"
730
+
731
+ #: classes/settings.class.php:1038 classes/settings.class.php:1060
732
+ #: classes/settings.class.php:1320 classes/settings.class.php:1548
733
+ #: classes/settings.class.php:1570
734
+ msgid "Decoration"
735
+ msgstr ""
736
+
737
+ #: classes/settings.class.php:1045 classes/settings.class.php:1555
738
+ msgid "Font (Hover)"
739
+ msgstr ""
740
+
741
+ #: classes/settings.class.php:1047
742
+ msgid "Set the font to use for each top level menu item (on hover)."
743
+ msgstr ""
744
+
745
+ #: classes/settings.class.php:1067
746
+ msgid "Menu Item Padding"
747
+ msgstr ""
748
+
749
+ #: classes/settings.class.php:1069
750
+ msgid "Set the padding for each top level menu item."
751
+ msgstr ""
752
+
753
+ #: classes/settings.class.php:1093
754
+ msgid "Menu Item Rounded Corners"
755
+ msgstr ""
756
+
757
+ #: classes/settings.class.php:1095
758
+ msgid "Set rounded corners for each top level menu item."
759
+ msgstr ""
760
+
761
+ # @ megamenu
762
+ #: classes/settings.class.php:1119
763
+ #, fuzzy
764
+ msgid "Menu Item Divider"
765
+ msgstr "Menü Icon"
766
+
767
+ #: classes/settings.class.php:1121
768
+ msgid "Show a small divider bar between each menu item."
769
+ msgstr ""
770
+
771
+ # @ megamenu
772
+ #: classes/settings.class.php:1126
773
+ #, fuzzy
774
+ msgid "Enabled"
775
+ msgstr "Aktiv"
776
+
777
+ #: classes/settings.class.php:1134
778
+ msgid "Glow Opacity"
779
+ msgstr ""
780
+
781
+ #: classes/settings.class.php:1142
782
+ msgid "Highlight Current Item"
783
+ msgstr ""
784
+
785
+ #: classes/settings.class.php:1144
786
+ msgid "Apply the 'hover' styling to current menu items."
787
+ msgstr ""
788
+
789
+ # @ megamenu
790
+ #: classes/settings.class.php:1151
791
+ msgid "Mega Panels"
792
+ msgstr "Mega Panels"
793
+
794
+ #: classes/settings.class.php:1156
795
+ msgid "Panel Background"
796
+ msgstr ""
797
+
798
+ #: classes/settings.class.php:1158
799
+ msgid "Set a background color for a whole panel."
800
+ msgstr ""
801
+
802
+ #: classes/settings.class.php:1174
803
+ msgid "Panel Width"
804
+ msgstr ""
805
+
806
+ #: classes/settings.class.php:1176
807
+ msgid ""
808
+ "Mega Panel width. Note: A 100% wide panel will only ever be as wide as the "
809
+ "menu itself. For a fixed panel width set this to a pixel value. Advanced: "
810
+ "enter a jQuery selector to align the sub menu to a page element."
811
+ msgstr ""
812
+
813
+ #: classes/settings.class.php:1185
814
+ msgid "Panel Border"
815
+ msgstr ""
816
+
817
+ # @ megamenu
818
+ #: classes/settings.class.php:1187
819
+ #, fuzzy
820
+ msgid "Set the border to display on the Mega Panel."
821
+ msgstr "Widget für das Mega Panel auswählen"
822
+
823
+ #: classes/settings.class.php:1215
824
+ msgid "Panel Padding"
825
+ msgstr ""
826
+
827
+ #: classes/settings.class.php:1217
828
+ msgid ""
829
+ "Set the padding for the whole panel. Set these values 0px if you wish your "
830
+ "panel content to go edge-to-edge."
831
+ msgstr ""
832
+
833
+ #: classes/settings.class.php:1243
834
+ msgid "Set rounded corners for the panel."
835
+ msgstr ""
836
+
837
+ #: classes/settings.class.php:1267
838
+ msgid "Widget Padding"
839
+ msgstr ""
840
+
841
+ #: classes/settings.class.php:1269
842
+ msgid ""
843
+ "Set the padding for each widget in the panel. Use this to define the spacing "
844
+ "between each widget in the panel."
845
+ msgstr ""
846
+
847
+ #: classes/settings.class.php:1293
848
+ msgid "Heading Font"
849
+ msgstr ""
850
+
851
+ #: classes/settings.class.php:1295
852
+ msgid ""
853
+ "Set the font to use for Widget Headers. This setting is also used for second "
854
+ "level menu items when they're displayed in a Mega Menu."
855
+ msgstr ""
856
+
857
+ #: classes/settings.class.php:1327
858
+ msgid "Content Font"
859
+ msgstr ""
860
+
861
+ #: classes/settings.class.php:1329
862
+ msgid "Set the font to use for panel contents."
863
+ msgstr ""
864
+
865
+ #: classes/settings.class.php:1349
866
+ msgid "Heading Padding"
867
+ msgstr ""
868
+
869
+ #: classes/settings.class.php:1351
870
+ msgid ""
871
+ "Set the padding for the headings. Use this to set the gap between the widget "
872
+ "heading and the widget content."
873
+ msgstr ""
874
+
875
+ # @ megamenu
876
+ #: classes/settings.class.php:1376
877
+ msgid "Flyout Menus"
878
+ msgstr "Flyout-Menü"
879
+
880
+ #: classes/settings.class.php:1381
881
+ msgid "Item Background"
882
+ msgstr ""
883
+
884
+ #: classes/settings.class.php:1383
885
+ msgid "Set the background color for a flyout menu item."
886
+ msgstr ""
887
+
888
+ #: classes/settings.class.php:1399
889
+ msgid "Item Background (Hover)"
890
+ msgstr ""
891
+
892
+ #: classes/settings.class.php:1401
893
+ msgid "Set the background color for a flyout menu item (on hover)."
894
+ msgstr ""
895
+
896
+ #: classes/settings.class.php:1417
897
+ msgid "Item Height"
898
+ msgstr ""
899
+
900
+ #: classes/settings.class.php:1419
901
+ msgid "The height of each flyout menu item."
902
+ msgstr ""
903
+
904
+ #: classes/settings.class.php:1428
905
+ msgid "Item Padding"
906
+ msgstr ""
907
+
908
+ #: classes/settings.class.php:1430
909
+ msgid "Set the padding for each flyout menu item."
910
+ msgstr ""
911
+
912
+ # @ megamenu
913
+ #: classes/settings.class.php:1454
914
+ #, fuzzy
915
+ msgid "Flyout Menu Width"
916
+ msgstr "Flyout-Menü"
917
+
918
+ #: classes/settings.class.php:1456
919
+ msgid "The width of each flyout menu."
920
+ msgstr ""
921
+
922
+ # @ megamenu
923
+ #: classes/settings.class.php:1465
924
+ #, fuzzy
925
+ msgid "Flyout Menu Border"
926
+ msgstr "Flyout-Menü"
927
+
928
+ #: classes/settings.class.php:1467
929
+ msgid "Set the border for the flyout menu."
930
+ msgstr ""
931
+
932
+ #: classes/settings.class.php:1497
933
+ msgid ""
934
+ "Set rounded corners for flyout menus. Rounded corners will be applied to all "
935
+ "flyout menu levels."
936
+ msgstr ""
937
+
938
+ #: classes/settings.class.php:1523
939
+ msgid "Set the font for the flyout menu items."
940
+ msgstr ""
941
+
942
+ #: classes/settings.class.php:1557
943
+ msgid "Set the font weight for the flyout menu items (on hover)."
944
+ msgstr ""
945
+
946
+ # @ megamenu
947
+ #: classes/settings.class.php:1577
948
+ #, fuzzy
949
+ msgid "Custom Styling"
950
+ msgstr "Eigenes CSS"
951
+
952
+ #: classes/settings.class.php:1582
953
+ msgid "CSS Editor"
954
+ msgstr ""
955
+
956
+ #: classes/settings.class.php:1584
957
+ msgid ""
958
+ "Define any custom CSS you wish to add to menus using this theme. You can use "
959
+ "standard CSS or SCSS."
960
+ msgstr ""
961
+
962
+ #: classes/settings.class.php:1590
963
+ msgid "Custom Styling Tips"
964
+ msgstr ""
965
+
966
+ #: classes/settings.class.php:1592
967
+ msgid ""
968
+ "converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-"
969
+ "primary"
970
+ msgstr ""
971
+
972
+ #: classes/settings.class.php:1593
973
+ msgid "converts to the ID selector of the menu, e.g. ul#mega-menu-primary"
974
+ msgstr ""
975
+
976
+ #: classes/settings.class.php:1594
977
+ msgid ""
978
+ "Use @import rules to import CSS from other plugins or your theme directory, "
979
+ "e.g:"
980
+ msgstr ""
981
+
982
+ # @ megamenu
983
+ #: classes/settings.class.php:1609
984
+ msgid "Delete Theme"
985
+ msgstr "Theme löschen"
986
+
987
+ # @ megamenu
988
+ #: classes/settings.class.php:1613
989
+ #, fuzzy
990
+ msgid "Revert Theme"
991
+ msgstr "Theme löschen"
992
+
993
+ #: classes/settings.class.php:1642
994
+ msgid "Center"
995
+ msgstr ""
996
+
997
+ #: classes/settings.class.php:1664
998
+ msgid "Underline"
999
+ msgstr ""
1000
+
1001
+ # @ megamenu
1002
+ #: classes/settings.class.php:1708
1003
+ msgid "Disabled"
1004
+ msgstr "Deaktiviert"
1005
+
1006
+ # @ megamenu
1007
+ #: classes/settings.class.php:1765 classes/settings.class.php:1784
1008
+ msgid "Normal"
1009
+ msgstr "Normal"
1010
+
1011
+ # @ megamenu
1012
+ #: classes/settings.class.php:1766
1013
+ msgid "Bold"
1014
+ msgstr "Fett"
1015
+
1016
+ # @ megamenu
1017
+ #: classes/settings.class.php:1785
1018
+ msgid "Capitalize"
1019
+ msgstr "Großschreibung"
1020
+
1021
+ # @ megamenu
1022
+ #: classes/settings.class.php:1786
1023
+ msgid "Uppercase"
1024
+ msgstr "GROSSBUCHSTABEN"
1025
+
1026
+ # @ megamenu
1027
+ #: classes/settings.class.php:1787
1028
+ msgid "Lowercase"
1029
+ msgstr "kleinschreibung"
1030
+
1031
+ # @ megamenu
1032
+ #: classes/settings.class.php:1822
1033
+ msgid "Theme Default"
1034
+ msgstr "Theme Vorgabe"
1035
+
1036
+ # @ megamenu
1037
+ #: classes/settings.class.php:1929
1038
+ msgid "Are you sure?"
1039
+ msgstr "Bist Du sicher?"
1040
+
1041
+ # @ megamenu
1042
+ #: classes/style-manager.class.php:67
1043
+ msgid "Default"
1044
+ msgstr "Standard"
1045
+
1046
+ # @ megamenu
1047
+ #: classes/style-manager.class.php:450
1048
+ msgid ""
1049
+ "Warning: CSS compilation failed. Please check your changes or revert the "
1050
+ "theme."
1051
+ msgstr ""
1052
+ "Achtung: CSS-Erstellung fehlgeschlagen. Bitte überprüfe die Änderungen oder "
1053
+ "setze das Theme zurück."
1054
+
1055
+ # @ megamenu
1056
+ #: classes/widget-manager.class.php:76
1057
+ msgid "Mega Menu Widgets"
1058
+ msgstr "Mega Menu Widgets"
1059
+
1060
+ # @ megamenu
1061
+ #: classes/widget-manager.class.php:77
1062
+ msgid "Do not manually edit this area."
1063
+ msgstr "Diesen Bereich bitte nicht manuell ändern."
1064
+
1065
+ # @ megamenu
1066
+ #: classes/widget-manager.class.php:114
1067
+ #, php-format
1068
+ msgid "Saved %s"
1069
+ msgstr "%s gesichert"
1070
+
1071
+ # @ megamenu
1072
+ #: classes/widget-manager.class.php:115
1073
+ #, php-format
1074
+ msgid "Failed to save %s"
1075
+ msgstr "Fehler beim Speichern von %s"
1076
+
1077
+ # @ megamenu
1078
+ #: classes/widget-manager.class.php:139
1079
+ #, php-format
1080
+ msgid "Updated %s (new columns: %d)"
1081
+ msgstr "%s aktualisiert (neue Spalten: %d)"
1082
+
1083
+ # @ megamenu
1084
+ #: classes/widget-manager.class.php:140
1085
+ #, php-format
1086
+ msgid "Failed to update %s"
1087
+ msgstr "Fehler beim Aktualisieren von %s"
1088
+
1089
+ # @ megamenu
1090
+ #: classes/widget-manager.class.php:166
1091
+ #, php-format
1092
+ msgid "Failed to add %s to %d"
1093
+ msgstr "Fehler beim Hinzufügen von %s zu %d"
1094
+
1095
+ # @ megamenu
1096
+ #: classes/widget-manager.class.php:189
1097
+ #, php-format
1098
+ msgid "Deleted %s"
1099
+ msgstr "%s gelöscht"
1100
+
1101
+ # @ megamenu
1102
+ #: classes/widget-manager.class.php:190
1103
+ #, php-format
1104
+ msgid "Failed to delete %s"
1105
+ msgstr "Fehler beim Löschen von %s"
1106
+
1107
+ # @ megamenu
1108
+ #: classes/widget-manager.class.php:215
1109
+ #, php-format
1110
+ msgid "Moved %s to %d (%s)"
1111
+ msgstr "%s verschoben zu %d (%s)"
1112
+
1113
+ # @ megamenu
1114
+ #: classes/widget-manager.class.php:216
1115
+ #, php-format
1116
+ msgid "Failed to move %s to %d"
1117
+ msgstr "Fehler beim Verschieben von %s zu %d"
1118
+
1119
+ # @ megamenu
1120
+ #, fuzzy
1121
+ #~ msgid "Global Settings"
1122
+ #~ msgstr "Allgemeine Einstellungen"
languages/megamenu-fr_FR.mo ADDED
Binary file
languages/megamenu-fr_FR.po ADDED
@@ -0,0 +1,1580 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: megamenu\n"
4
+ "POT-Creation-Date: 2015-09-28 17:08+0100\n"
5
+ "PO-Revision-Date: 2015-09-28 17:20+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: Pierre Sudarovich <translate@tips02.fr>\n"
8
+ "Language: French\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.5.7\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+ "X-Poedit-SearchPath-1: .\n"
18
+
19
+ #: ../megamenu.php:145
20
+ msgid "Go Pro"
21
+ msgstr "Passer à la version Pro"
22
+
23
+ #: ../megamenu.php:683
24
+ msgid ""
25
+ "Max Mega Menu is not compatible with your version of WordPress. Please "
26
+ "upgrade WordPress to the latest version or disable Max Mega Menu."
27
+ msgstr ""
28
+ "Max Mega Menu n'est pas compatible avec votre version de WordPress. Mettez à "
29
+ "jour WordPress à la dernière version, svp, ou désactivez Max Mega Menu."
30
+
31
+ #: ../megamenu.php:694
32
+ msgid ""
33
+ "Max Mega Menu is not compatible with Uber Menu. Please disable Uber Menu."
34
+ msgstr ""
35
+ "Max Mega Menu n'est pas compatible avec Uber Menu. Désactivez Uber Menu, svp."
36
+
37
+ #: ../megamenu.php:707
38
+ msgid "click here"
39
+ msgstr "cliquez ici"
40
+
41
+ #: ../megamenu.php:710
42
+ #, php-format
43
+ msgid "Thanks for installing Max Mega Menu! Please %s to get started."
44
+ msgstr "Merci d'avoir installé Max Mega Menu ! %s, svp pour commencer."
45
+
46
+ #: ../megamenu.php:725
47
+ msgid "clear the CSS cache"
48
+ msgstr "vider le cache CSS"
49
+
50
+ #: ../megamenu.php:728
51
+ #, php-format
52
+ msgid ""
53
+ "Max Mega Menu has been updated. Please %s to ensure maximum compatibility "
54
+ "with the latest version."
55
+ msgstr ""
56
+ "Max Mega Menu mis à jour. %s, svp pour vous assurer du maximum de "
57
+ "compatibilité avec la dernière version."
58
+
59
+ #: ../classes/menu-item-manager.class.php:175
60
+ #: ../classes/menu-item-manager.class.php:190
61
+ #: ../classes/menu-item-manager.class.php:273
62
+ #: ../classes/nav-menus.class.php:161 ../classes/settings.class.php:554
63
+ msgid "Mega Menu"
64
+ msgstr ""
65
+
66
+ #: ../classes/menu-item-manager.class.php:176
67
+ msgid "Mega Menus can only be created on top level menu items."
68
+ msgstr "Mega Menu peut seulement être créé pour les items de plus haut niveau."
69
+
70
+ #: ../classes/menu-item-manager.class.php:186
71
+ msgid "Sub menu display mode"
72
+ msgstr "Mode d'affichage du sous-menu"
73
+
74
+ #: ../classes/menu-item-manager.class.php:189
75
+ msgid "Flyout Menu"
76
+ msgstr "Menu volant"
77
+
78
+ #: ../classes/menu-item-manager.class.php:194
79
+ msgid "column"
80
+ msgstr "colonne"
81
+
82
+ #: ../classes/menu-item-manager.class.php:195
83
+ #: ../classes/menu-item-manager.class.php:196
84
+ #: ../classes/menu-item-manager.class.php:197
85
+ #: ../classes/menu-item-manager.class.php:198
86
+ #: ../classes/menu-item-manager.class.php:199
87
+ #: ../classes/menu-item-manager.class.php:200
88
+ #: ../classes/menu-item-manager.class.php:201
89
+ msgid "columns"
90
+ msgstr "colonnes"
91
+
92
+ #: ../classes/menu-item-manager.class.php:205
93
+ msgid "Select a Widget to add to the panel"
94
+ msgstr "Sélectionner un widget à ajouter au panneau"
95
+
96
+ #: ../classes/menu-item-manager.class.php:223
97
+ msgid "Sub menu items"
98
+ msgstr "Items de sous-menu"
99
+
100
+ #: ../classes/menu-item-manager.class.php:243
101
+ msgid "Widgets"
102
+ msgstr ""
103
+
104
+ #: ../classes/menu-item-manager.class.php:267
105
+ msgid ""
106
+ "No widgets found. Add a widget to this area using the Widget Selector (top "
107
+ "right)"
108
+ msgstr ""
109
+ "Aucun widget trouvé. Ajoutez un widget à cette zone en utilisant le "
110
+ "sélecteur de widget (en haut à droite)"
111
+
112
+ #: ../classes/menu-item-manager.class.php:294
113
+ msgid "Menu Item Settings"
114
+ msgstr "Paramètres des items du menu"
115
+
116
+ #: ../classes/menu-item-manager.class.php:298
117
+ msgid "Hide Text"
118
+ msgstr "Cacher le texte"
119
+
120
+ #: ../classes/menu-item-manager.class.php:305
121
+ #: ../classes/menu-item-manager.class.php:341
122
+ #: ../classes/menu-item-manager.class.php:366
123
+ msgid "Option only available for top level menu items"
124
+ msgstr "Option seulement disponible pour les items du plus haut niveau"
125
+
126
+ #: ../classes/menu-item-manager.class.php:312
127
+ msgid "Hide Arrow"
128
+ msgstr "Cacher la flèche"
129
+
130
+ #: ../classes/menu-item-manager.class.php:320
131
+ msgid "Disable Link"
132
+ msgstr "Désactiver le lien"
133
+
134
+ #: ../classes/menu-item-manager.class.php:328
135
+ msgid "Menu Item Align"
136
+ msgstr "Alignement de l'item du menu"
137
+
138
+ #: ../classes/menu-item-manager.class.php:334
139
+ #: ../classes/menu-item-manager.class.php:359
140
+ #: ../classes/settings.class.php:1309 ../classes/settings.class.php:1460
141
+ #: ../classes/settings.class.php:1643 ../classes/settings.class.php:1673
142
+ #: ../classes/settings.class.php:1806 ../classes/settings.class.php:1836
143
+ #: ../classes/settings.class.php:1888 ../classes/settings.class.php:1970
144
+ #: ../classes/settings.class.php:1996 ../classes/settings.class.php:2026
145
+ #: ../classes/settings.class.php:2132 ../classes/settings.class.php:2158
146
+ #: ../classes/settings.class.php:2188 ../classes/settings.class.php:2294
147
+ #: ../classes/settings.class.php:2356 ../classes/settings.class.php:2387
148
+ #: ../classes/settings.class.php:2486 ../classes/settings.class.php:2626
149
+ msgid "Left"
150
+ msgstr "Gauche"
151
+
152
+ #: ../classes/menu-item-manager.class.php:335
153
+ #: ../classes/menu-item-manager.class.php:360
154
+ #: ../classes/settings.class.php:1313 ../classes/settings.class.php:1452
155
+ #: ../classes/settings.class.php:1635 ../classes/settings.class.php:1665
156
+ #: ../classes/settings.class.php:1798 ../classes/settings.class.php:1828
157
+ #: ../classes/settings.class.php:1880 ../classes/settings.class.php:1962
158
+ #: ../classes/settings.class.php:1988 ../classes/settings.class.php:2018
159
+ #: ../classes/settings.class.php:2124 ../classes/settings.class.php:2150
160
+ #: ../classes/settings.class.php:2180 ../classes/settings.class.php:2286
161
+ #: ../classes/settings.class.php:2348 ../classes/settings.class.php:2379
162
+ #: ../classes/settings.class.php:2478 ../classes/settings.class.php:2628
163
+ msgid "Right"
164
+ msgstr "Droite"
165
+
166
+ #: ../classes/menu-item-manager.class.php:338
167
+ msgid ""
168
+ "Right aligned items will appear in reverse order on the right hand side of "
169
+ "the menu bar"
170
+ msgstr ""
171
+ "Les items alignés à droite apparaîtront dans un ordre inversé sur le côté "
172
+ "droit de la barre de menu"
173
+
174
+ #: ../classes/menu-item-manager.class.php:348
175
+ msgid "Sub Menu Settings"
176
+ msgstr "Paramètres du sous-menu"
177
+
178
+ #: ../classes/menu-item-manager.class.php:353
179
+ msgid "Sub Menu Align"
180
+ msgstr "Alignement du sous-menu"
181
+
182
+ #: ../classes/menu-item-manager.class.php:363
183
+ msgid ""
184
+ "Right aligned sub menus will align to the right of the parent menu item and "
185
+ "expand to the left"
186
+ msgstr ""
187
+ "Les sous-menus aligné à droite seront alignés à droite de l'item parent du "
188
+ "menu et étendu à gauche"
189
+
190
+ #: ../classes/menu-item-manager.class.php:376
191
+ #: ../classes/settings.class.php:600 ../classes/settings.class.php:1061
192
+ msgid "General Settings"
193
+ msgstr "Paramètres généraux"
194
+
195
+ #: ../classes/menu-item-manager.class.php:395
196
+ msgid "Dashicons"
197
+ msgstr ""
198
+
199
+ #: ../classes/menu-item-manager.class.php:400
200
+ msgid "Font Awesome"
201
+ msgstr ""
202
+
203
+ #: ../classes/menu-item-manager.class.php:402
204
+ #: ../classes/menu-item-manager.class.php:407
205
+ #: ../classes/menu-item-manager.class.php:412
206
+ msgid "Max Mega Menu Pro"
207
+ msgstr "Max Mega Menu Pro"
208
+
209
+ #: ../classes/menu-item-manager.class.php:402
210
+ msgid "Get access to over 400 Font Awesome Icons with {link}"
211
+ msgstr "Accédez à plus de 400 icones de Font Awesome avec {link}"
212
+
213
+ #: ../classes/menu-item-manager.class.php:405
214
+ msgid "Genericons"
215
+ msgstr ""
216
+
217
+ #: ../classes/menu-item-manager.class.php:407
218
+ msgid "Choose from over 100 genericons with {link}"
219
+ msgstr "Choisissez parmi plus de 100 genericons avec {link}"
220
+
221
+ #: ../classes/menu-item-manager.class.php:410
222
+ msgid "Custom Icon"
223
+ msgstr "Icone personnalisée"
224
+
225
+ #: ../classes/menu-item-manager.class.php:412
226
+ msgid "Select icons from your media library with {link}"
227
+ msgstr "Sélectionnez une icone depuis votre bibliothèque de médias avec {link}"
228
+
229
+ #: ../classes/menu-item-manager.class.php:448
230
+ msgid "Menu Icon"
231
+ msgstr "Icone du menu"
232
+
233
+ #: ../classes/nav-menus.class.php:110
234
+ msgid "Max Mega Menu Settings"
235
+ msgstr "Paramètres Max Mega Menu"
236
+
237
+ #: ../classes/nav-menus.class.php:160
238
+ msgid "Launched for Menu ID"
239
+ msgstr "Chargé pour l'ID du menu"
240
+
241
+ #: ../classes/nav-menus.class.php:162
242
+ msgid ""
243
+ "Please enable Max Mega Menu using the settings on the left of this page."
244
+ msgstr ""
245
+ "Activez Max Mega Menu en utilisant les paramètres sur la gauche de cette "
246
+ "page, svp."
247
+
248
+ #: ../classes/nav-menus.class.php:163
249
+ msgid "Saving"
250
+ msgstr "Sauvegarde"
251
+
252
+ #: ../classes/nav-menus.class.php:165
253
+ msgid "Oops. Something went wrong. Please reload the page."
254
+ msgstr "Oups... Quelque chose a cloché. Rechargez la page, svp."
255
+
256
+ #: ../classes/nav-menus.class.php:236
257
+ msgid "here"
258
+ msgstr "ici"
259
+
260
+ #: ../classes/nav-menus.class.php:238
261
+ msgid "This theme does not register any menu locations."
262
+ msgstr "Ce thème n'a aucun emplacement de menu."
263
+
264
+ #: ../classes/nav-menus.class.php:239
265
+ msgid ""
266
+ "You will need to create a new menu location and use the Max Mega Menu widget "
267
+ "or shortcode to display the menu on your site."
268
+ msgstr ""
269
+ "Vous aurez besoin de créer un nouvel emplacement de menu et d'utiliser le "
270
+ "widget Max Mega Menu ou un shortcode pour afficher le menu sur votre site."
271
+
272
+ #: ../classes/nav-menus.class.php:240
273
+ msgid "Click {link} for instructions."
274
+ msgstr "Cliquez sur {link pour les instructions."
275
+
276
+ #: ../classes/nav-menus.class.php:244
277
+ msgid ""
278
+ "Please assign this menu to a theme location to enable the Mega Menu settings."
279
+ msgstr ""
280
+ "Assignez ce menu à un emplacement de thème, svp, pour activer les paramètres "
281
+ "de Mega Menu."
282
+
283
+ #: ../classes/nav-menus.class.php:284 ../classes/widget-manager.class.php:463
284
+ msgid "Save"
285
+ msgstr "Sauver"
286
+
287
+ #: ../classes/nav-menus.class.php:299
288
+ msgid "Enable"
289
+ msgstr "Activer"
290
+
291
+ #: ../classes/nav-menus.class.php:305
292
+ msgid "Event"
293
+ msgstr "Evénement"
294
+
295
+ #: ../classes/nav-menus.class.php:308
296
+ msgid "Hover"
297
+ msgstr "Survol"
298
+
299
+ #: ../classes/nav-menus.class.php:309
300
+ msgid "Click"
301
+ msgstr "Clic"
302
+
303
+ #: ../classes/nav-menus.class.php:314
304
+ msgid "Effect"
305
+ msgstr "Effet"
306
+
307
+ #: ../classes/nav-menus.class.php:323 ../classes/settings.class.php:2648
308
+ msgid "None"
309
+ msgstr "Aucun"
310
+
311
+ #: ../classes/nav-menus.class.php:327
312
+ msgid "Fade"
313
+ msgstr "Fondu"
314
+
315
+ #: ../classes/nav-menus.class.php:331
316
+ msgid "Slide"
317
+ msgstr "Glissement"
318
+
319
+ #: ../classes/nav-menus.class.php:345
320
+ msgid "Theme"
321
+ msgstr "Thème"
322
+
323
+ #: ../classes/settings.class.php:291
324
+ msgid "(Imported)"
325
+ msgstr "(Importé)"
326
+
327
+ #: ../classes/settings.class.php:331
328
+ msgid "Copy"
329
+ msgstr "Copier"
330
+
331
+ #: ../classes/settings.class.php:554 ../classes/settings.class.php:1019
332
+ msgid "Max Mega Menu"
333
+ msgstr ""
334
+
335
+ #: ../classes/settings.class.php:605
336
+ msgid "CSS Output"
337
+ msgstr "Sortie CSS"
338
+
339
+ #: ../classes/settings.class.php:611
340
+ msgid "Save to filesystem"
341
+ msgstr "Sauver dans un fichier"
342
+
343
+ #: ../classes/settings.class.php:612
344
+ msgid "Output in &lt;head&gt;"
345
+ msgstr "Dans la section &lt;head&gt;"
346
+
347
+ #: ../classes/settings.class.php:613
348
+ msgid "Enqueue dynamically via admin-ajax.php"
349
+ msgstr "Mettre à la file dynamiquement via admin-ajax.php"
350
+
351
+ #: ../classes/settings.class.php:614
352
+ msgid "Don't output CSS"
353
+ msgstr "Ne pas générer de sortie CSS"
354
+
355
+ #: ../classes/settings.class.php:617
356
+ msgid ""
357
+ "CSS will be enqueued dynamically through admin-ajax.php and loaded from the "
358
+ "cache."
359
+ msgstr ""
360
+ "La CSS sera dynamiquement placé dans la file à travers admin-ajax.php et "
361
+ "chargé depuis le cache."
362
+
363
+ #: ../classes/settings.class.php:618
364
+ msgid ""
365
+ "CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued "
366
+ "from there."
367
+ msgstr ""
368
+ "Le CSS sera sauvegardé dans wp-content/uploads/maxmegamenu/style.css et mis "
369
+ "dans la file depuis cet emplacement."
370
+
371
+ #: ../classes/settings.class.php:619
372
+ msgid ""
373
+ "CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; "
374
+ "of the page."
375
+ msgstr ""
376
+ "Le CSS sera chargé depuis le cache dans une balise &lt;style&gt; dans la "
377
+ "section &lt;head&gt; de la page."
378
+
379
+ #: ../classes/settings.class.php:620
380
+ msgid "CSS will not be output, you must enqueue the CSS for the menu manually."
381
+ msgstr ""
382
+ "Le CSS ne sera pas généré, vous devez le placer dans la file manuellement "
383
+ "pour le menu."
384
+
385
+ #: ../classes/settings.class.php:626
386
+ msgid "Click Event Behaviour"
387
+ msgstr "Comportement de l'événement sur clic"
388
+
389
+ #: ../classes/settings.class.php:628
390
+ msgid ""
391
+ "Define what should happen when the event is set to 'click'. This also "
392
+ "applies to mobiles."
393
+ msgstr ""
394
+ "Définissez ce qu'il arrivera lorsque l'évènement est paramétré sur 'click'. "
395
+ "Cela s'applique aussi aux mobiles."
396
+
397
+ #: ../classes/settings.class.php:633
398
+ msgid "First click will open a sub menu, second click will close the sub menu."
399
+ msgstr "Le premier clic ouvrira un sous-menu, le second fermera le sous-menu."
400
+
401
+ #: ../classes/settings.class.php:634
402
+ msgid "First click will open a sub menu, second click will follow the link."
403
+ msgstr "Le premier clic ouvrira un sous-menu, le second suivra le lien."
404
+
405
+ #: ../classes/settings.class.php:642
406
+ msgid "Mobile Menu Behaviour"
407
+ msgstr "Comportement du Menu Mobile"
408
+
409
+ #: ../classes/settings.class.php:644
410
+ msgid "Define the sub menu toggle behaviour for the mobile menu."
411
+ msgstr "Définir le comportement du menu bascule sous le menu pour mobile."
412
+
413
+ #: ../classes/settings.class.php:649
414
+ msgid "Standard - Open sub menus will remain open until closed by the user."
415
+ msgstr ""
416
+ "Standard - Un sous menu restera ouvert tant qu'il n'est pas fermé par "
417
+ "l'utilisateur."
418
+
419
+ #: ../classes/settings.class.php:650
420
+ msgid ""
421
+ "Accordion - Open sub menus will automatically close when another one is "
422
+ "opened."
423
+ msgstr ""
424
+ "Accordéon - Un sous menu ouvert se fermera automatiquement quand un autre "
425
+ "s'ouvrira"
426
+
427
+ #: ../classes/settings.class.php:658
428
+ msgid "Menu Locations"
429
+ msgstr "Emplacement de menu"
430
+
431
+ #: ../classes/settings.class.php:663
432
+ msgid "Registered Menu Locations"
433
+ msgstr "Emplacements de menu enregistrés"
434
+
435
+ #: ../classes/settings.class.php:664
436
+ msgid ""
437
+ "An overview of the menu locations supported by your theme. You can enable "
438
+ "Max Mega Menu and adjust the settings for a specific menu location by going "
439
+ "to Appearance > Menus."
440
+ msgstr ""
441
+ "Un aperçu des emplacements supportés par votre thème. Vous pouvez activer "
442
+ "Max Mega Menu et ajuster les paramètres pour un emplacement spécifique de "
443
+ "menu en allant dans Apparence > Menus."
444
+
445
+ #: ../classes/settings.class.php:669
446
+ msgid ""
447
+ "Your theme does not natively support menus, but you can add a new menu "
448
+ "location using Max Mega Menu and display the menu using the Max Mega Menu "
449
+ "widget or shortcode."
450
+ msgstr ""
451
+ "Votre thème ne supporte pas nativement les menus, mais vous pouvez ajouter "
452
+ "un nouvel emplacement de menu en utilisant Max Mega Menu et afficher le menu "
453
+ "en utilisant le widget Max Mega Menu ou le shortcode."
454
+
455
+ #: ../classes/settings.class.php:670
456
+ msgid "Your theme supports one menu."
457
+ msgstr "Votre thème supporte un menu."
458
+
459
+ #: ../classes/settings.class.php:671
460
+ msgid "Your theme supports {number} menus."
461
+ msgstr "Votre thème supporte {number} menus."
462
+
463
+ #: ../classes/settings.class.php:687
464
+ msgid "Add another menu location."
465
+ msgstr "Ajouter un autre emplacement de menu."
466
+
467
+ #: ../classes/settings.class.php:713
468
+ msgid "Menu"
469
+ msgstr ""
470
+
471
+ #: ../classes/settings.class.php:718
472
+ msgid "Assign a menu"
473
+ msgstr "Assigner un menu"
474
+
475
+ #: ../classes/settings.class.php:732
476
+ msgid "Location Description"
477
+ msgstr "Description d'emplacement"
478
+
479
+ #: ../classes/settings.class.php:733
480
+ msgid "Change the name of the location."
481
+ msgstr "Changer le nom de l'emplacement."
482
+
483
+ #: ../classes/settings.class.php:742
484
+ msgid "Menu Display Options"
485
+ msgstr "Options d'affichage de menu"
486
+
487
+ #: ../classes/settings.class.php:745
488
+ msgid ""
489
+ "These options are for advanced users only. Your theme should already include "
490
+ "the code required to display this menu on your site."
491
+ msgstr ""
492
+ "Ces options sont pour les utilisateurs expérimentés seulement. Votre thème "
493
+ "devrait déjà inclure le code nécessaire pour afficher ce menu sur votre site."
494
+
495
+ #: ../classes/settings.class.php:751
496
+ msgid "PHP Function"
497
+ msgstr "fonction PHP"
498
+
499
+ #: ../classes/settings.class.php:752
500
+ msgid "For use in a theme template (usually header.php)"
501
+ msgstr "Pour l'utiliser dans un modèle du thème (habituellement header.php)"
502
+
503
+ #: ../classes/settings.class.php:760
504
+ msgid "Shortcode"
505
+ msgstr ""
506
+
507
+ #: ../classes/settings.class.php:761
508
+ msgid "For use in a post or page."
509
+ msgstr "Pour l'utiliser dans un article ou dans une page."
510
+
511
+ #: ../classes/settings.class.php:769
512
+ msgid "Widget"
513
+ msgstr ""
514
+
515
+ #: ../classes/settings.class.php:770
516
+ msgid "For use in a widget area."
517
+ msgstr "Pour l'utiliser dans une zone widget."
518
+
519
+ #: ../classes/settings.class.php:773
520
+ msgid "Add the 'Max Mega Menu' widget to a widget area."
521
+ msgstr "Ajouter le widget 'Max Mega Menu' à une zone de widget."
522
+
523
+ #: ../classes/settings.class.php:791
524
+ msgid "Delete location"
525
+ msgstr "Effacer l'emplacement"
526
+
527
+ #: ../classes/settings.class.php:872 ../classes/settings.class.php:1063
528
+ msgid "Tools"
529
+ msgstr "Outils"
530
+
531
+ #: ../classes/settings.class.php:877
532
+ msgid "Cache"
533
+ msgstr ""
534
+
535
+ #: ../classes/settings.class.php:878
536
+ msgid "Use this tool to clear the CSS cache."
537
+ msgstr "Utilisez cet outil pour nettoyer le cache."
538
+
539
+ #: ../classes/settings.class.php:885
540
+ msgid "Clear CSS Cache"
541
+ msgstr "Vider le cache CSS"
542
+
543
+ #: ../classes/settings.class.php:891
544
+ msgid "Plugin Data"
545
+ msgstr "Données du plugin"
546
+
547
+ #: ../classes/settings.class.php:892
548
+ msgid ""
549
+ "Delete all saved Max Mega Menu plugin data from the database. Use with "
550
+ "caution!"
551
+ msgstr ""
552
+ "Effacer toutes les données de Max Mega Menu de la base de données. A "
553
+ "utiliser avec précaution !"
554
+
555
+ #: ../classes/settings.class.php:899
556
+ msgid "Delete Data"
557
+ msgstr "Effacer les données"
558
+
559
+ #: ../classes/settings.class.php:905 ../classes/settings.class.php:930
560
+ msgid "Export Theme"
561
+ msgstr "Exporter thème"
562
+
563
+ #: ../classes/settings.class.php:906
564
+ msgid "Export a menu theme"
565
+ msgstr "Exporter un thème de menu"
566
+
567
+ #: ../classes/settings.class.php:940 ../classes/settings.class.php:948
568
+ msgid "Import Theme"
569
+ msgstr "Importer thème"
570
+
571
+ #: ../classes/settings.class.php:941
572
+ msgid "Import a menu theme"
573
+ msgstr "Importer un thème de menu"
574
+
575
+ #: ../classes/settings.class.php:972
576
+ msgid "Homepage"
577
+ msgstr "Page d'accueil"
578
+
579
+ #: ../classes/settings.class.php:977
580
+ msgid "Documentation"
581
+ msgstr ""
582
+
583
+ #: ../classes/settings.class.php:987
584
+ msgid "Upgrade to Pro - $19"
585
+ msgstr "Mettre à jour vers Pro - 19$"
586
+
587
+ #: ../classes/settings.class.php:995
588
+ msgid "Core version"
589
+ msgstr "version du noyau"
590
+
591
+ #: ../classes/settings.class.php:999
592
+ msgid "Pro extension"
593
+ msgstr "Extension Pro"
594
+
595
+ #: ../classes/settings.class.php:1062
596
+ msgid "Menu Themes"
597
+ msgstr "Thèmes de menu"
598
+
599
+ #: ../classes/settings.class.php:1129
600
+ msgid "Failed to delete theme. The theme is in use by a menu."
601
+ msgstr ""
602
+ "Echec lors de la suppression du thème. Le thème est utilisé par un menu."
603
+
604
+ #: ../classes/settings.class.php:1133
605
+ msgid "CSS cache cleared"
606
+ msgstr "Cache CSS vidé"
607
+
608
+ #: ../classes/settings.class.php:1137
609
+ msgid "All plugin data removed"
610
+ msgstr "Tous les plugins ont été enlevés"
611
+
612
+ #: ../classes/settings.class.php:1141
613
+ msgid "Theme Deleted"
614
+ msgstr "Thème effacé"
615
+
616
+ #: ../classes/settings.class.php:1145
617
+ msgid "Theme Duplicated"
618
+ msgstr "Thème dupliqué"
619
+
620
+ #: ../classes/settings.class.php:1149
621
+ msgid "Changes Saved"
622
+ msgstr "Changements sauvegardés"
623
+
624
+ #: ../classes/settings.class.php:1153
625
+ msgid "Theme Reverted"
626
+ msgstr "Thème rétabli"
627
+
628
+ #: ../classes/settings.class.php:1157
629
+ msgid "New Theme Created"
630
+ msgstr "Nouveau thème créé"
631
+
632
+ #: ../classes/settings.class.php:1161
633
+ msgid "New Menu Location Created"
634
+ msgstr "Nouvel emplacement de thème créé"
635
+
636
+ #: ../classes/settings.class.php:1165
637
+ msgid "Menu Location Deleted"
638
+ msgstr "Emplacement de menu effacé"
639
+
640
+ #: ../classes/settings.class.php:1169
641
+ msgid "Theme Imported"
642
+ msgstr "Thème Importé"
643
+
644
+ #: ../classes/settings.class.php:1173
645
+ msgid "Theme Import Failed"
646
+ msgstr "Echec d'importation du thème"
647
+
648
+ #: ../classes/settings.class.php:1177
649
+ msgid "Theme Exported"
650
+ msgstr "Thème Exporté"
651
+
652
+ #: ../classes/settings.class.php:1271
653
+ msgid "Select theme to edit"
654
+ msgstr "Sélectionner un thème à éditer"
655
+
656
+ #: ../classes/settings.class.php:1271 ../classes/settings.class.php:1272
657
+ msgid "or"
658
+ msgstr "ou"
659
+
660
+ #: ../classes/settings.class.php:1272
661
+ msgid "create a new theme"
662
+ msgstr "Créer un nouveau thème"
663
+
664
+ #: ../classes/settings.class.php:1273
665
+ msgid "duplicate this theme"
666
+ msgstr "Dupliquer ce thème"
667
+
668
+ #: ../classes/settings.class.php:1280
669
+ msgid "Editing Theme:"
670
+ msgstr "Edition du thème :"
671
+
672
+ #: ../classes/settings.class.php:1281
673
+ msgid "General Theme Settings"
674
+ msgstr "Paramètres généraux du thème"
675
+
676
+ #: ../classes/settings.class.php:1286
677
+ msgid "Theme Title"
678
+ msgstr "Titre du thème"
679
+
680
+ #: ../classes/settings.class.php:1294
681
+ msgid "Arrow"
682
+ msgstr "Flèche"
683
+
684
+ #: ../classes/settings.class.php:1296
685
+ msgid "Select the arrow styles."
686
+ msgstr "Choisissez le stle de flèche."
687
+
688
+ #: ../classes/settings.class.php:1301
689
+ msgid "Up"
690
+ msgstr "Haut"
691
+
692
+ #: ../classes/settings.class.php:1305
693
+ msgid "Down"
694
+ msgstr "Bas"
695
+
696
+ #: ../classes/settings.class.php:1320
697
+ msgid "Responsive Breakpoint"
698
+ msgstr "Point de bascule responsive."
699
+
700
+ #: ../classes/settings.class.php:1322
701
+ msgid ""
702
+ "Set the width at which the menu turns into a mobile menu. Set to 0 to "
703
+ "disable responsive menu."
704
+ msgstr ""
705
+ "Régler la largeur à laquelle le menu se transformera en version mobile. "
706
+ "Mettez 0 pour désactiver le menu responsive."
707
+
708
+ #: ../classes/settings.class.php:1329
709
+ msgid "Responsive Menu Text"
710
+ msgstr "Text du menu responsive"
711
+
712
+ #: ../classes/settings.class.php:1331
713
+ msgid "Text to display next to the mobile toggle icon."
714
+ msgstr "Texte à afficher à côté de l'icone pour les mobiles."
715
+
716
+ #: ../classes/settings.class.php:1338
717
+ msgid "Line Height"
718
+ msgstr "Hauteur de ligne"
719
+
720
+ #: ../classes/settings.class.php:1340
721
+ msgid "Set the general line height to use in the panel contents."
722
+ msgstr ""
723
+ "Régler la hauteur de ligne général à utiliser dans le contenu des panneaux."
724
+
725
+ #: ../classes/settings.class.php:1347
726
+ msgid "Z-Index"
727
+ msgstr ""
728
+
729
+ #: ../classes/settings.class.php:1349
730
+ msgid "Set the z-index to ensure the panels appear ontop of other content."
731
+ msgstr ""
732
+ "Régler le z-index pour être sûr que les panneaux apparaîtront au-dessus des "
733
+ "autres contenus."
734
+
735
+ #: ../classes/settings.class.php:1356
736
+ msgid "Shadow"
737
+ msgstr "Ombre"
738
+
739
+ #: ../classes/settings.class.php:1358
740
+ msgid "Apply a shadow to mega and flyout menus."
741
+ msgstr "Applique une ombre au menus Mega et volant"
742
+
743
+ #: ../classes/settings.class.php:1363 ../classes/settings.class.php:1397
744
+ #: ../classes/settings.class.php:1411 ../classes/settings.class.php:1727
745
+ #: ../classes/settings.class.php:2557
746
+ msgid "Enabled"
747
+ msgstr "Activé"
748
+
749
+ #: ../classes/settings.class.php:1367
750
+ msgid "Horizonal"
751
+ msgstr ""
752
+
753
+ #: ../classes/settings.class.php:1371
754
+ msgid "Vertical"
755
+ msgstr ""
756
+
757
+ #: ../classes/settings.class.php:1375
758
+ msgid "Blur"
759
+ msgstr "Flou"
760
+
761
+ #: ../classes/settings.class.php:1379
762
+ msgid "Spread"
763
+ msgstr "Propagation"
764
+
765
+ #: ../classes/settings.class.php:1383 ../classes/settings.class.php:1575
766
+ #: ../classes/settings.class.php:1609 ../classes/settings.class.php:1657
767
+ #: ../classes/settings.class.php:1687 ../classes/settings.class.php:1731
768
+ #: ../classes/settings.class.php:1820 ../classes/settings.class.php:1902
769
+ #: ../classes/settings.class.php:1936 ../classes/settings.class.php:2010
770
+ #: ../classes/settings.class.php:2046 ../classes/settings.class.php:2080
771
+ #: ../classes/settings.class.php:2172 ../classes/settings.class.php:2208
772
+ #: ../classes/settings.class.php:2242 ../classes/settings.class.php:2371
773
+ #: ../classes/settings.class.php:2501 ../classes/settings.class.php:2535
774
+ #: ../classes/settings.class.php:2561
775
+ msgid "Color"
776
+ msgstr "Couleur"
777
+
778
+ #: ../classes/settings.class.php:1390
779
+ msgid "Hover Transitions"
780
+ msgstr "Transitions au survol"
781
+
782
+ #: ../classes/settings.class.php:1392
783
+ msgid ""
784
+ "Apply hover transitions to menu items. Note: Transitions will not apply to "
785
+ "gradient backgrounds."
786
+ msgstr ""
787
+ "Applique la transition au survol de souris aux items de menu. Note : les "
788
+ "transitions ne seront pas appliquées au couleur de fond dégradées."
789
+
790
+ #: ../classes/settings.class.php:1404
791
+ msgid "Reset Widget Styling"
792
+ msgstr "Réinitialiser le style des widgets"
793
+
794
+ #: ../classes/settings.class.php:1406
795
+ msgid "Reset the styling of widgets within the mega menu?"
796
+ msgstr "Réinitialiser le style des widgets avec le mega menu ?"
797
+
798
+ #: ../classes/settings.class.php:1418
799
+ msgid "Menu Bar"
800
+ msgstr "Barre de menu"
801
+
802
+ #: ../classes/settings.class.php:1423 ../classes/settings.class.php:2306
803
+ msgid "Menu Background"
804
+ msgstr "Couleur de fond du menu"
805
+
806
+ #: ../classes/settings.class.php:1425
807
+ msgid ""
808
+ "The background color for the main menu bar. Set each value to transparent "
809
+ "for a 'button' style menu."
810
+ msgstr ""
811
+ "La couleur de fond pour la barre de menu principale. Réglez chaque valeur à "
812
+ "transparent pour un style de menu 'bouton'."
813
+
814
+ #: ../classes/settings.class.php:1430 ../classes/settings.class.php:1517
815
+ #: ../classes/settings.class.php:1535 ../classes/settings.class.php:1763
816
+ #: ../classes/settings.class.php:2102 ../classes/settings.class.php:2264
817
+ #: ../classes/settings.class.php:2313 ../classes/settings.class.php:2427
818
+ #: ../classes/settings.class.php:2445
819
+ msgid "From"
820
+ msgstr "De"
821
+
822
+ #: ../classes/settings.class.php:1434 ../classes/settings.class.php:1521
823
+ #: ../classes/settings.class.php:1539 ../classes/settings.class.php:1767
824
+ #: ../classes/settings.class.php:2106 ../classes/settings.class.php:2268
825
+ #: ../classes/settings.class.php:2317 ../classes/settings.class.php:2431
826
+ #: ../classes/settings.class.php:2449
827
+ msgid "To"
828
+ msgstr "à"
829
+
830
+ #: ../classes/settings.class.php:1441 ../classes/settings.class.php:2337
831
+ msgid "Menu Padding"
832
+ msgstr "Padding de menu"
833
+
834
+ #: ../classes/settings.class.php:1443
835
+ msgid "Padding for the main menu bar."
836
+ msgstr "Pas pour la barre de menu principale."
837
+
838
+ #: ../classes/settings.class.php:1448 ../classes/settings.class.php:1631
839
+ #: ../classes/settings.class.php:1661 ../classes/settings.class.php:1794
840
+ #: ../classes/settings.class.php:1824 ../classes/settings.class.php:1876
841
+ #: ../classes/settings.class.php:1958 ../classes/settings.class.php:1984
842
+ #: ../classes/settings.class.php:2014 ../classes/settings.class.php:2120
843
+ #: ../classes/settings.class.php:2146 ../classes/settings.class.php:2176
844
+ #: ../classes/settings.class.php:2282 ../classes/settings.class.php:2344
845
+ #: ../classes/settings.class.php:2375 ../classes/settings.class.php:2474
846
+ msgid "Top"
847
+ msgstr "Haut"
848
+
849
+ #: ../classes/settings.class.php:1456 ../classes/settings.class.php:1639
850
+ #: ../classes/settings.class.php:1669 ../classes/settings.class.php:1802
851
+ #: ../classes/settings.class.php:1832 ../classes/settings.class.php:1884
852
+ #: ../classes/settings.class.php:1966 ../classes/settings.class.php:1992
853
+ #: ../classes/settings.class.php:2022 ../classes/settings.class.php:2128
854
+ #: ../classes/settings.class.php:2154 ../classes/settings.class.php:2184
855
+ #: ../classes/settings.class.php:2290 ../classes/settings.class.php:2352
856
+ #: ../classes/settings.class.php:2383 ../classes/settings.class.php:2482
857
+ msgid "Bottom"
858
+ msgstr "Bas"
859
+
860
+ #: ../classes/settings.class.php:1467 ../classes/settings.class.php:2394
861
+ msgid "Menu Border Radius"
862
+ msgstr "Radius de la bordure de menu"
863
+
864
+ #: ../classes/settings.class.php:1469
865
+ msgid "Set a border radius on the main menu bar."
866
+ msgstr "Régler le radius de la bordure sur la barre de menu principale."
867
+
868
+ #: ../classes/settings.class.php:1474 ../classes/settings.class.php:1701
869
+ #: ../classes/settings.class.php:1850 ../classes/settings.class.php:2401
870
+ msgid "Top Left"
871
+ msgstr "En haut à gauche"
872
+
873
+ #: ../classes/settings.class.php:1478 ../classes/settings.class.php:1705
874
+ #: ../classes/settings.class.php:1854 ../classes/settings.class.php:2405
875
+ msgid "Top Right"
876
+ msgstr "En haut à droite"
877
+
878
+ #: ../classes/settings.class.php:1482 ../classes/settings.class.php:1709
879
+ #: ../classes/settings.class.php:1858 ../classes/settings.class.php:2409
880
+ msgid "Bottom Right"
881
+ msgstr "E n bas à droite"
882
+
883
+ #: ../classes/settings.class.php:1486 ../classes/settings.class.php:1713
884
+ #: ../classes/settings.class.php:1862 ../classes/settings.class.php:2413
885
+ msgid "Bottom Left"
886
+ msgstr "En bas à gauche"
887
+
888
+ #: ../classes/settings.class.php:1493
889
+ msgid "Menu Items Align"
890
+ msgstr "Alignement des items du menu"
891
+
892
+ #: ../classes/settings.class.php:1495
893
+ msgid ""
894
+ "Align <i>all</i> menu items to the left (default), centrally or to the right."
895
+ msgstr ""
896
+ "Aligner <i>tous</i> les items de menu (la barre de menu) à gauche (par "
897
+ "défaut), centré ou à droite."
898
+
899
+ #: ../classes/settings.class.php:1500
900
+ msgid ""
901
+ "This option will apply to all menu items. To align an individual menu item "
902
+ "to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'."
903
+ msgstr ""
904
+ "Cette option s'appliquera à tous les éléments du menu. Pour aligner un item "
905
+ "du menu spécifique à droite, éditez l'item de menu lui-même et définissez "
906
+ "'Alignement d'item de menu' à 'Droite'."
907
+
908
+ #: ../classes/settings.class.php:1505
909
+ msgid "Top Level Menu Items"
910
+ msgstr "Items de menu du plus haut niveau"
911
+
912
+ #: ../classes/settings.class.php:1510
913
+ msgid "Menu Item Background"
914
+ msgstr "Couleur de fond d'item de menu"
915
+
916
+ #: ../classes/settings.class.php:1512
917
+ msgid ""
918
+ "The background color for each top level menu item. Tip: Set these values to "
919
+ "transparent if you've already set a background color on the menu bar."
920
+ msgstr ""
921
+ "La couleur de fond pour chaque item de menu du niveau le plus haut. Astuce : "
922
+ "Définissez ces valeurs à transparent si vous avez déjà défini une couleur de "
923
+ "fond à la barre de menu."
924
+
925
+ #: ../classes/settings.class.php:1528
926
+ msgid "Menu Item Background (Hover)"
927
+ msgstr "Couleur de fond d'item de menu (au survol de la souris)"
928
+
929
+ #: ../classes/settings.class.php:1530
930
+ msgid "The background color for a top level menu item (on hover)."
931
+ msgstr ""
932
+ "Couleur de fond pour un item du menu du plus haut niveau (au survol de la "
933
+ "souris)."
934
+
935
+ #: ../classes/settings.class.php:1546
936
+ msgid "Menu Item Spacing"
937
+ msgstr "Espacement d'item du menu"
938
+
939
+ #: ../classes/settings.class.php:1548
940
+ msgid "Define the size of the gap between each top level menu item."
941
+ msgstr ""
942
+ "Définir la taille de l'écart entre chaque élément du niveau le plus haut."
943
+
944
+ #: ../classes/settings.class.php:1557
945
+ msgid "Menu Item Height"
946
+ msgstr "Hauteur d'item du menu"
947
+
948
+ #: ../classes/settings.class.php:1559
949
+ msgid ""
950
+ "Define the height of each top level menu item. This value, plus the "
951
+ "container top and bottom padding values define the overall height of the "
952
+ "menu bar."
953
+ msgstr ""
954
+ "Définir la hauteur de chaque item de menu du plus haut niveau. Cette valeur, "
955
+ "plus les valeurs de pas haut et bas du contenant définissent la hauteur "
956
+ "totale de la barre de menu."
957
+
958
+ #: ../classes/settings.class.php:1568 ../classes/settings.class.php:2039
959
+ #: ../classes/settings.class.php:2201
960
+ msgid "Font"
961
+ msgstr "Police"
962
+
963
+ #: ../classes/settings.class.php:1570
964
+ msgid "The font to use for each top level menu item."
965
+ msgstr "La police à utiliser pour chaque item de menu du plus haut niveau."
966
+
967
+ #: ../classes/settings.class.php:1579 ../classes/settings.class.php:1906
968
+ #: ../classes/settings.class.php:1940 ../classes/settings.class.php:2050
969
+ #: ../classes/settings.class.php:2212 ../classes/settings.class.php:2505
970
+ msgid "Size"
971
+ msgstr "Taille"
972
+
973
+ #: ../classes/settings.class.php:1583 ../classes/settings.class.php:1910
974
+ #: ../classes/settings.class.php:1944 ../classes/settings.class.php:2054
975
+ #: ../classes/settings.class.php:2216 ../classes/settings.class.php:2509
976
+ msgid "Family"
977
+ msgstr "Famille"
978
+
979
+ #: ../classes/settings.class.php:1587 ../classes/settings.class.php:1918
980
+ #: ../classes/settings.class.php:2062 ../classes/settings.class.php:2224
981
+ #: ../classes/settings.class.php:2513
982
+ msgid "Transform"
983
+ msgstr "Transformation"
984
+
985
+ #: ../classes/settings.class.php:1591 ../classes/settings.class.php:1613
986
+ #: ../classes/settings.class.php:1914 ../classes/settings.class.php:2058
987
+ #: ../classes/settings.class.php:2084 ../classes/settings.class.php:2220
988
+ #: ../classes/settings.class.php:2246 ../classes/settings.class.php:2517
989
+ #: ../classes/settings.class.php:2539
990
+ msgid "Weight"
991
+ msgstr "Poids"
992
+
993
+ #: ../classes/settings.class.php:1595 ../classes/settings.class.php:1617
994
+ #: ../classes/settings.class.php:1922 ../classes/settings.class.php:2066
995
+ #: ../classes/settings.class.php:2088 ../classes/settings.class.php:2228
996
+ #: ../classes/settings.class.php:2250 ../classes/settings.class.php:2521
997
+ #: ../classes/settings.class.php:2543
998
+ msgid "Decoration"
999
+ msgstr "Décoration"
1000
+
1001
+ #: ../classes/settings.class.php:1602 ../classes/settings.class.php:2073
1002
+ #: ../classes/settings.class.php:2235
1003
+ msgid "Font (Hover)"
1004
+ msgstr "Police (au survol de la souris)"
1005
+
1006
+ #: ../classes/settings.class.php:1604
1007
+ msgid "Set the font to use for each top level menu item (on hover)."
1008
+ msgstr ""
1009
+ "Régler la police à utiliser pour chaque item de menu du plus niveau (au "
1010
+ "survol de la souris)."
1011
+
1012
+ #: ../classes/settings.class.php:1624
1013
+ msgid "Menu Item Padding"
1014
+ msgstr "Padding d'item de menu"
1015
+
1016
+ #: ../classes/settings.class.php:1626
1017
+ msgid "Set the padding for each top level menu item."
1018
+ msgstr "Régler le pas pour chaque item du menu du plus haut niveau."
1019
+
1020
+ #: ../classes/settings.class.php:1650
1021
+ msgid "Menu Item Border"
1022
+ msgstr "Bordure d'item du menu"
1023
+
1024
+ #: ../classes/settings.class.php:1652
1025
+ msgid "Set the border to display on each top level menu item."
1026
+ msgstr ""
1027
+ "Régler la bordure à afficher sur chaque item de menu du plus haut niveau."
1028
+
1029
+ #: ../classes/settings.class.php:1680
1030
+ msgid "Menu Item Border (Hover)"
1031
+ msgstr "Bordure d'item de menu (au survol de la souris)"
1032
+
1033
+ #: ../classes/settings.class.php:1682
1034
+ msgid "Set the hover border color."
1035
+ msgstr "Régler la couleur de la bordure au survol de la souris."
1036
+
1037
+ #: ../classes/settings.class.php:1694
1038
+ msgid "Menu Item Border Radius"
1039
+ msgstr "Radius des bordures des items du menu"
1040
+
1041
+ #: ../classes/settings.class.php:1696
1042
+ msgid "Set rounded corners for each top level menu item."
1043
+ msgstr ""
1044
+ "Régler des bords arrondis pour chaque item de menu du plus haut niveau."
1045
+
1046
+ #: ../classes/settings.class.php:1720
1047
+ msgid "Menu Item Divider"
1048
+ msgstr "Séparateur d'item de menu"
1049
+
1050
+ #: ../classes/settings.class.php:1722
1051
+ msgid "Show a small divider bar between each menu item."
1052
+ msgstr "Afficher une petite barre de séparation entre chaque item de menu."
1053
+
1054
+ #: ../classes/settings.class.php:1735
1055
+ msgid "Glow Opacity"
1056
+ msgstr "Opacité de la lueur"
1057
+
1058
+ #: ../classes/settings.class.php:1742
1059
+ msgid "Highlight Current Item"
1060
+ msgstr "Item actuel en surbrillance"
1061
+
1062
+ #: ../classes/settings.class.php:1744
1063
+ msgid "Apply the 'hover' styling to current menu items."
1064
+ msgstr ""
1065
+ "Appliquer le style 'survol de la souris' (hover) aux items de menu actuels."
1066
+
1067
+ #: ../classes/settings.class.php:1751
1068
+ msgid "Mega Panels"
1069
+ msgstr "Mega Panneaux"
1070
+
1071
+ #: ../classes/settings.class.php:1756
1072
+ msgid "Panel Background"
1073
+ msgstr "Couleur de fond du panneau"
1074
+
1075
+ #: ../classes/settings.class.php:1758
1076
+ msgid "Set a background color for a whole panel."
1077
+ msgstr "Régler une couleur de fond pour tout le panneau."
1078
+
1079
+ #: ../classes/settings.class.php:1774
1080
+ msgid "Panel Width"
1081
+ msgstr "Largeur de panneau"
1082
+
1083
+ #: ../classes/settings.class.php:1776
1084
+ msgid "Mega Panel width"
1085
+ msgstr "Largeur de Mega Panneau"
1086
+
1087
+ #: ../classes/settings.class.php:1781
1088
+ msgid ""
1089
+ "A 100% wide panel will only ever be as wide as the menu itself. For a fixed "
1090
+ "panel width set this to a pixel value."
1091
+ msgstr ""
1092
+ "Un panneau large de 100% sera seulement aussi large que le menu lui-même. "
1093
+ "Pour une taille fixe de panneau, définissez celle-ci en pixel."
1094
+
1095
+ #: ../classes/settings.class.php:1782
1096
+ msgid ""
1097
+ "Advanced: Enter a jQuery selector to synchronize the width and position of "
1098
+ "the sub menu with existing page element (e.g. body, #container, .page)."
1099
+ msgstr ""
1100
+ "Avancé : Entrez un sélecteur jQuery pour synchroniser la largeur et la "
1101
+ "position du sous-menu avec un élement existant de la page (ex : body, "
1102
+ "#container, .page)."
1103
+
1104
+ #: ../classes/settings.class.php:1787
1105
+ msgid "Panel Padding"
1106
+ msgstr "Padding de panneau"
1107
+
1108
+ #: ../classes/settings.class.php:1789
1109
+ msgid ""
1110
+ "Set the padding for the whole panel. Set these values 0px if you wish your "
1111
+ "panel content to go edge-to-edge."
1112
+ msgstr ""
1113
+ "Régler le pas pour tout le panneau. Définissez cette valeur à 0px si vous "
1114
+ "souhaitez que le contenu de votre panneau soit bord-à-bord."
1115
+
1116
+ #: ../classes/settings.class.php:1813
1117
+ msgid "Panel Border"
1118
+ msgstr "Bordure du panneau"
1119
+
1120
+ #: ../classes/settings.class.php:1815
1121
+ msgid "Set the border to display on the Mega Panel."
1122
+ msgstr "Régler la bordure à afficher sur le Mega Panneau."
1123
+
1124
+ #: ../classes/settings.class.php:1843
1125
+ msgid "Panel Border Radius"
1126
+ msgstr "Radius de la bordure du panneau"
1127
+
1128
+ #: ../classes/settings.class.php:1845
1129
+ msgid "Set rounded corners for the panel."
1130
+ msgstr "Définir des bords arrondis pour le panneau."
1131
+
1132
+ #: ../classes/settings.class.php:1869
1133
+ msgid "Widget Padding"
1134
+ msgstr "Paddind de widget"
1135
+
1136
+ #: ../classes/settings.class.php:1871
1137
+ msgid ""
1138
+ "Set the padding for each widget in the panel. Use this to define the spacing "
1139
+ "between each widget in the panel."
1140
+ msgstr ""
1141
+ "Régler le pas pour chaque widget dans le panneau. Utilisez cela pour définir "
1142
+ "un espace entre chaque widget dans le panneau."
1143
+
1144
+ #: ../classes/settings.class.php:1895
1145
+ msgid "Widget Heading Font"
1146
+ msgstr "Police d'en-tête de widget"
1147
+
1148
+ #: ../classes/settings.class.php:1897
1149
+ msgid ""
1150
+ "Set the font to use Widget headers in the mega menu. Tip: set this to the "
1151
+ "same style as the Second Level Menu Item Header font to keep your styling "
1152
+ "consistent."
1153
+ msgstr ""
1154
+ "Définissez la police à utiliser en en-tête de widget dans un Mega Menu. "
1155
+ "Astuce : définissez le même style qu'avec la police des en-têtes des items "
1156
+ "de menu de 2ème niveau pour garder une cohérence de style."
1157
+
1158
+ #: ../classes/settings.class.php:1929
1159
+ msgid "Widget Content Font"
1160
+ msgstr "Police du contenu de widget"
1161
+
1162
+ #: ../classes/settings.class.php:1931
1163
+ msgid "Set the font to use for panel contents."
1164
+ msgstr "Définissez la police à utiliser pour le contenu du panneau."
1165
+
1166
+ #: ../classes/settings.class.php:1951
1167
+ msgid "Widget Heading Padding"
1168
+ msgstr "Padding des en-têtes de widget"
1169
+
1170
+ #: ../classes/settings.class.php:1953
1171
+ msgid "Set the padding for the widget headings."
1172
+ msgstr "Régler le pas pour les en-têtes de widget."
1173
+
1174
+ #: ../classes/settings.class.php:1977
1175
+ msgid "Widget Heading Margin"
1176
+ msgstr "Marge des en-têtes de widget"
1177
+
1178
+ #: ../classes/settings.class.php:1979
1179
+ msgid "Set the margin for the widget headings."
1180
+ msgstr "Régler la marge pour les en-têtes de widget."
1181
+
1182
+ #: ../classes/settings.class.php:2003 ../classes/settings.class.php:2165
1183
+ msgid "Border"
1184
+ msgstr "Bordure"
1185
+
1186
+ #: ../classes/settings.class.php:2005
1187
+ msgid "Set the border for the widget headings."
1188
+ msgstr "Régler la bordure pour les en-têtes du widget."
1189
+
1190
+ #: ../classes/settings.class.php:2033
1191
+ msgid "Second Level Menu Items"
1192
+ msgstr "Items du menu de 2ème niveau"
1193
+
1194
+ #: ../classes/settings.class.php:2041
1195
+ msgid ""
1196
+ "Set the font for second level menu items when they're displayed in a Mega "
1197
+ "Menu."
1198
+ msgstr ""
1199
+ "Régler la police pour les items du menu de 2ème niveau quand ils sont "
1200
+ "affichés dans un Mega Menu."
1201
+
1202
+ #: ../classes/settings.class.php:2075 ../classes/settings.class.php:2237
1203
+ msgid "Set the font style on hover."
1204
+ msgstr "Régler le style de police au survol de la souris."
1205
+
1206
+ #: ../classes/settings.class.php:2095 ../classes/settings.class.php:2257
1207
+ msgid "Background (Hover)"
1208
+ msgstr "Couleur de fond (au survol de la souris)"
1209
+
1210
+ #: ../classes/settings.class.php:2097
1211
+ msgid "Set the background hover color for second level menu items."
1212
+ msgstr ""
1213
+ "Régler la couleur de fond au survol de la souris pour les items de menus de "
1214
+ "2ème niveau."
1215
+
1216
+ #: ../classes/settings.class.php:2113 ../classes/settings.class.php:2275
1217
+ msgid "Padding"
1218
+ msgstr ""
1219
+
1220
+ #: ../classes/settings.class.php:2115
1221
+ msgid "Set the padding for the second level menu items."
1222
+ msgstr "Régler le pas pour les items du menu de 2ème niveau."
1223
+
1224
+ #: ../classes/settings.class.php:2139
1225
+ msgid "Margin"
1226
+ msgstr "Marge"
1227
+
1228
+ #: ../classes/settings.class.php:2141
1229
+ msgid "Set the margin for the second level menu items."
1230
+ msgstr "Régler la marge pour les items du menu de 2ème niveau."
1231
+
1232
+ #: ../classes/settings.class.php:2167
1233
+ msgid "Set the border for the second level menu items."
1234
+ msgstr "Régler la bordure pour les items du menu de 2ème niveau."
1235
+
1236
+ #: ../classes/settings.class.php:2195
1237
+ msgid "Third Level Menu Items"
1238
+ msgstr "Items de 3ème niveau du menu"
1239
+
1240
+ #: ../classes/settings.class.php:2203
1241
+ msgid ""
1242
+ "Set the font for third level menu items when they're displayed in a Mega "
1243
+ "Menu."
1244
+ msgstr ""
1245
+ "Régler la police pour les items du menu de 3ème niveau quand ils seront "
1246
+ "affichés dans un Mega Menu."
1247
+
1248
+ #: ../classes/settings.class.php:2259
1249
+ msgid "Set the background hover color for third level menu items."
1250
+ msgstr ""
1251
+ "Régler la couleur de fond au survol de la souris pour les items du menu de "
1252
+ "3ème niveau."
1253
+
1254
+ #: ../classes/settings.class.php:2277
1255
+ msgid "Set the padding for the third level menu items."
1256
+ msgstr "Régler le pas pour les items du menu de 3ème niveau."
1257
+
1258
+ #: ../classes/settings.class.php:2301
1259
+ msgid "Flyout Menus"
1260
+ msgstr "Menus volants"
1261
+
1262
+ #: ../classes/settings.class.php:2308
1263
+ msgid "Set the background color for the flyout menu."
1264
+ msgstr "Régler la couleur de fond du menu volant."
1265
+
1266
+ #: ../classes/settings.class.php:2325
1267
+ msgid "Menu Width"
1268
+ msgstr "Largeur du menu"
1269
+
1270
+ #: ../classes/settings.class.php:2327
1271
+ msgid "The width of each flyout menu. This must be a fixed pixel value."
1272
+ msgstr "La largeur de chaque menu volant. Ce doit être une valeur fixe."
1273
+
1274
+ #: ../classes/settings.class.php:2332
1275
+ msgid ""
1276
+ "Set this value to the width of your longest menu item title to stop menu "
1277
+ "items wrapping onto 2 lines."
1278
+ msgstr ""
1279
+ "Régler cette valeur à la largeur de votre titre d'item de menu le plus grand "
1280
+ "pour que votre menu ne se retrouve plus sur 2 lignes."
1281
+
1282
+ #: ../classes/settings.class.php:2339
1283
+ msgid "Set the padding for the whole flyout menu."
1284
+ msgstr "Régler le pas pour tout le menu volant."
1285
+
1286
+ #: ../classes/settings.class.php:2359
1287
+ msgid ""
1288
+ "Only suitable for single level flyout menus. If you're using multi level "
1289
+ "flyout menus set these values to 0px."
1290
+ msgstr ""
1291
+ "Applicable seulement au premier niveau des menus volants. Si vous utilisez "
1292
+ "plusieurs niveaux de menus volants réglez cette valeur à 0px."
1293
+
1294
+ #: ../classes/settings.class.php:2364
1295
+ msgid "Menu Border"
1296
+ msgstr "Bordure du menu"
1297
+
1298
+ #: ../classes/settings.class.php:2366
1299
+ msgid "Set the border for the flyout menu."
1300
+ msgstr "Régler la bordure pour les menus volants."
1301
+
1302
+ #: ../classes/settings.class.php:2396
1303
+ msgid ""
1304
+ "Set rounded corners for flyout menus. Rounded corners will be applied to all "
1305
+ "flyout menu levels."
1306
+ msgstr ""
1307
+ "Régler l'arrondi des angles pour les menus volants. Les angles arrondis "
1308
+ "seront appliqués à tous les niveaux des menus volants."
1309
+
1310
+ #: ../classes/settings.class.php:2420
1311
+ msgid "Item Background"
1312
+ msgstr "Couleur de fond de l'item"
1313
+
1314
+ #: ../classes/settings.class.php:2422
1315
+ msgid "Set the background color for a flyout menu item."
1316
+ msgstr "Régler la couleur de fond pour un item du menu volant."
1317
+
1318
+ #: ../classes/settings.class.php:2438
1319
+ msgid "Item Background (Hover)"
1320
+ msgstr "Couleur de fond de l'item (au survol de la souris)"
1321
+
1322
+ #: ../classes/settings.class.php:2440
1323
+ msgid "Set the background color for a flyout menu item (on hover)."
1324
+ msgstr ""
1325
+ "Régler la couleur de fond pour un item du menu volant (au survol de la "
1326
+ "souris)."
1327
+
1328
+ #: ../classes/settings.class.php:2456
1329
+ msgid "Item Height"
1330
+ msgstr "Hauteur de l'item"
1331
+
1332
+ #: ../classes/settings.class.php:2458
1333
+ msgid "The height of each flyout menu item."
1334
+ msgstr "La hauteur de chaque item du menu volant."
1335
+
1336
+ #: ../classes/settings.class.php:2467
1337
+ msgid "Item Padding"
1338
+ msgstr "Padding de l'item"
1339
+
1340
+ #: ../classes/settings.class.php:2469
1341
+ msgid "Set the padding for each flyout menu item."
1342
+ msgstr "Régler le pas pour chaque item du menu volant."
1343
+
1344
+ #: ../classes/settings.class.php:2494
1345
+ msgid "Item Font"
1346
+ msgstr "Police de l'item"
1347
+
1348
+ #: ../classes/settings.class.php:2496
1349
+ msgid "Set the font for the flyout menu items."
1350
+ msgstr "Régler la police pour les items du menu volant"
1351
+
1352
+ #: ../classes/settings.class.php:2528
1353
+ msgid "Item Font (Hover)"
1354
+ msgstr "Police de l'item (au survol de la souris)"
1355
+
1356
+ #: ../classes/settings.class.php:2530
1357
+ msgid "Set the font weight for the flyout menu items (on hover)."
1358
+ msgstr ""
1359
+ "Régler le poids de la police pour les items du menus volants (au survol de "
1360
+ "la souris)"
1361
+
1362
+ #: ../classes/settings.class.php:2550
1363
+ msgid "Item Divider"
1364
+ msgstr "Séparateur d'item"
1365
+
1366
+ #: ../classes/settings.class.php:2552
1367
+ msgid "Show a line divider below each menu item."
1368
+ msgstr "Afficher une ligne séparatrice entre chaque item du menu."
1369
+
1370
+ #: ../classes/settings.class.php:2568
1371
+ msgid "Custom Styling"
1372
+ msgstr "Style personnalisé"
1373
+
1374
+ #: ../classes/settings.class.php:2573
1375
+ msgid "CSS Editor"
1376
+ msgstr "Editeur CSS"
1377
+
1378
+ #: ../classes/settings.class.php:2575
1379
+ msgid ""
1380
+ "Define any custom CSS you wish to add to menus using this theme. You can use "
1381
+ "standard CSS or SCSS."
1382
+ msgstr ""
1383
+ "Définissez des règles CSS que vous souhaitez ajouter aux menus utilisant ce "
1384
+ "thème. Vous pouvez utiliser du CSS standard ou du SCSS."
1385
+
1386
+ #: ../classes/settings.class.php:2581
1387
+ msgid "Custom Styling Tips"
1388
+ msgstr "Astuce de style personnalisé"
1389
+
1390
+ #: ../classes/settings.class.php:2583
1391
+ msgid ""
1392
+ "converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-"
1393
+ "primary"
1394
+ msgstr ""
1395
+ "converti vers le sélecteur ID du menu wrapper, ex : ul#mega-menu-wrap-primary"
1396
+
1397
+ #: ../classes/settings.class.php:2584
1398
+ msgid "converts to the ID selector of the menu, e.g. ul#mega-menu-primary"
1399
+ msgstr "converti vers le sélecteur ID du menu, ex : ul#mega-menu-primary"
1400
+
1401
+ #: ../classes/settings.class.php:2585
1402
+ msgid ""
1403
+ "Use @import rules to import CSS from other plugins or your theme directory, "
1404
+ "e.g:"
1405
+ msgstr ""
1406
+ "Utilisez la règle @import pour importer une CSS d'un autre plugin ou du "
1407
+ "répertoire de votre thème, ex :"
1408
+
1409
+ #: ../classes/settings.class.php:2598
1410
+ msgid "Delete Theme"
1411
+ msgstr "Supprimer le thème"
1412
+
1413
+ #: ../classes/settings.class.php:2600
1414
+ msgid "Revert Theme"
1415
+ msgstr "Rétablir le thème"
1416
+
1417
+ #: ../classes/settings.class.php:2627
1418
+ msgid "Center"
1419
+ msgstr "Centré"
1420
+
1421
+ #: ../classes/settings.class.php:2649
1422
+ msgid "Underline"
1423
+ msgstr "Souligné"
1424
+
1425
+ #: ../classes/settings.class.php:2693
1426
+ msgid "Disabled"
1427
+ msgstr "Désactivé"
1428
+
1429
+ #: ../classes/settings.class.php:2750 ../classes/settings.class.php:2829
1430
+ msgid "Theme Default"
1431
+ msgstr "Thème par défaut"
1432
+
1433
+ #: ../classes/settings.class.php:2751
1434
+ msgid "Light (300)"
1435
+ msgstr "Léger (300)"
1436
+
1437
+ #: ../classes/settings.class.php:2752
1438
+ msgid "Normal (400)"
1439
+ msgstr ""
1440
+
1441
+ #: ../classes/settings.class.php:2753
1442
+ msgid "Bold (700)"
1443
+ msgstr "Gras (700)"
1444
+
1445
+ #: ../classes/settings.class.php:2791
1446
+ msgid "Normal"
1447
+ msgstr ""
1448
+
1449
+ #: ../classes/settings.class.php:2792
1450
+ msgid "Capitalize"
1451
+ msgstr "Capitalisation"
1452
+
1453
+ #: ../classes/settings.class.php:2793
1454
+ msgid "Uppercase"
1455
+ msgstr "Majuscule"
1456
+
1457
+ #: ../classes/settings.class.php:2794
1458
+ msgid "Lowercase"
1459
+ msgstr "minuscule"
1460
+
1461
+ #: ../classes/settings.class.php:2933
1462
+ msgid "Are you sure?"
1463
+ msgstr "Etes-vous sûr ?"
1464
+
1465
+ #: ../classes/style-manager.class.php:80
1466
+ msgid "Default"
1467
+ msgstr "Défaut"
1468
+
1469
+ #: ../classes/style-manager.class.php:543
1470
+ msgid ""
1471
+ "Warning: CSS compilation failed. Please check your changes or revert the "
1472
+ "theme."
1473
+ msgstr ""
1474
+ "Attention : Echec lors de la compilation de la CSS. Vérifiez vos changements "
1475
+ "ou rétablissez votre thème."
1476
+
1477
+ #: ../classes/widget-manager.class.php:76
1478
+ msgid "Mega Menu Widgets"
1479
+ msgstr "Widgets Mega Menu"
1480
+
1481
+ #: ../classes/widget-manager.class.php:77
1482
+ msgid "Do not manually edit this area."
1483
+ msgstr "N'éditez pas manuellement cet emplacement."
1484
+
1485
+ #: ../classes/widget-manager.class.php:116
1486
+ #, php-format
1487
+ msgid "Saved %s"
1488
+ msgstr "%s sauvegardé"
1489
+
1490
+ #: ../classes/widget-manager.class.php:118
1491
+ #, php-format
1492
+ msgid "Failed to save %s"
1493
+ msgstr "Echec lors de la sauvegarde de %s"
1494
+
1495
+ #: ../classes/widget-manager.class.php:139
1496
+ #, php-format
1497
+ msgid "Updated %s (new columns: %d)"
1498
+ msgstr "Mise à jour de %s (nouvelle colonne : %d)"
1499
+
1500
+ #: ../classes/widget-manager.class.php:141
1501
+ #, php-format
1502
+ msgid "Failed to update %s"
1503
+ msgstr "Echec lors de la mise à jour de %s"
1504
+
1505
+ #: ../classes/widget-manager.class.php:165
1506
+ #, php-format
1507
+ msgid "Failed to add %s to %d"
1508
+ msgstr "Echec lors de l'ajout de %s vers %d"
1509
+
1510
+ #: ../classes/widget-manager.class.php:185
1511
+ #, php-format
1512
+ msgid "Deleted %s"
1513
+ msgstr "%s supprimé"
1514
+
1515
+ #: ../classes/widget-manager.class.php:187
1516
+ #, php-format
1517
+ msgid "Failed to delete %s"
1518
+ msgstr "Echec lors de la suppresion de %s"
1519
+
1520
+ #: ../classes/widget-manager.class.php:209
1521
+ #, php-format
1522
+ msgid "Moved %s to %d (%s)"
1523
+ msgstr "Déplacement de %s vers %d (%s)"
1524
+
1525
+ #: ../classes/widget-manager.class.php:211
1526
+ #, php-format
1527
+ msgid "Failed to move %s to %d"
1528
+ msgstr "Echec lors du déplacement de %s vers %d"
1529
+
1530
+ #: ../classes/widget-manager.class.php:458
1531
+ msgid "Delete"
1532
+ msgstr "Supprimer"
1533
+
1534
+ #: ../classes/widget-manager.class.php:459
1535
+ msgid "Close"
1536
+ msgstr "Fermer"
1537
+
1538
+ #: ../classes/widget.class.php:21
1539
+ msgid "Outputs a menu for a selected theme location."
1540
+ msgstr "Sorties de menu pour un emplacement sélectionné de thème."
1541
+
1542
+ #: ../classes/widget.class.php:97
1543
+ msgid "Title:"
1544
+ msgstr "Titre :"
1545
+
1546
+ #: ../classes/widget.class.php:100
1547
+ msgid "Menu Location:"
1548
+ msgstr "Emplacement de menu"
1549
+
1550
+ #: ../classes/widget.class.php:109
1551
+ msgid "No menu locations found"
1552
+ msgstr "Aucun emplacement de menu trouvé"
1553
+
1554
+ #~ msgid "regenerate the CSS"
1555
+ #~ msgstr "Regénérer le CSS"
1556
+
1557
+ #~ msgid "Regenerate CSS"
1558
+ #~ msgstr "Regénération CSS"
1559
+
1560
+ #~ msgid "Bold"
1561
+ #~ msgstr "Gras"
1562
+
1563
+ #~ msgid "Menu Settings"
1564
+ #~ msgstr "Paramètres du menu"
1565
+
1566
+ #~ msgid ""
1567
+ #~ "Menu specific settings (e.g, click or hover event, menu theme, transition "
1568
+ #~ "effect) can be found under"
1569
+ #~ msgstr ""
1570
+ #~ "Paramètres spécifiques du menu (ex: clic ou survol, thème du menu, effet "
1571
+ #~ "de transition) peuvent être trouver sous"
1572
+
1573
+ #~ msgid "Appearance > Menus"
1574
+ #~ msgstr "Apparence > Menus"
1575
+
1576
+ #~ msgid "Regenerate the CSS."
1577
+ #~ msgstr "Regénérer le CSS"
1578
+
1579
+ #~ msgid "Theme Editor"
1580
+ #~ msgstr "Editeur de thème"
languages/megamenu-it_IT.mo ADDED
Binary file
languages/megamenu-it_IT.po ADDED
@@ -0,0 +1,1039 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: megamenu\n"
4
+ "POT-Creation-Date: 2015-03-28 18:52-0000\n"
5
+ "PO-Revision-Date: 2015-03-28 18:52-0000\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: en\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.5.7\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SearchPath-0: ..\n"
16
+ "X-Poedit-SearchPath-1: .\n"
17
+
18
+ #: ../megamenu.php:456
19
+ #, fuzzy
20
+ msgid ""
21
+ "Max Mega Menu is not compatible with your version of WordPress. Please "
22
+ "upgrade WordPress to the latest version or disable Max Mega Menu."
23
+ msgstr ""
24
+ "Mega Menu non è compatibile con la tua versione di WordPress. Si prega di "
25
+ "aggiornare WordPress alla versione più recente o disattivare Mega Menu."
26
+
27
+ #: ../megamenu.php:467
28
+ #, fuzzy
29
+ msgid ""
30
+ "Max Mega Menu is not compatible with Uber Menu. Please disable Uber Menu."
31
+ msgstr ""
32
+ "Mega Menu non è compatibile con Uber Menu. Si prega di disattivare Uber Menu."
33
+
34
+ #: ../megamenu.php:480
35
+ msgid "click here"
36
+ msgstr ""
37
+
38
+ #: ../megamenu.php:483
39
+ #, php-format
40
+ msgid "Thanks for installing Max Mega Menu! Please %s to get started."
41
+ msgstr ""
42
+
43
+ #: ../classes/menu-item-manager.class.php:171
44
+ #: ../classes/menu-item-manager.class.php:264
45
+ #: ../classes/nav-menus.class.php:127
46
+ #, fuzzy
47
+ msgid "Mega Menu"
48
+ msgstr "Pannello di Mega Menu"
49
+
50
+ #: ../classes/menu-item-manager.class.php:172
51
+ msgid "Mega Menus can only be created on top level menu items."
52
+ msgstr ""
53
+
54
+ #: ../classes/menu-item-manager.class.php:183
55
+ msgid "Enable Mega Menu"
56
+ msgstr ""
57
+
58
+ #: ../classes/menu-item-manager.class.php:186
59
+ msgid "column"
60
+ msgstr ""
61
+
62
+ #: ../classes/menu-item-manager.class.php:187
63
+ #: ../classes/menu-item-manager.class.php:188
64
+ #: ../classes/menu-item-manager.class.php:189
65
+ #: ../classes/menu-item-manager.class.php:190
66
+ #: ../classes/menu-item-manager.class.php:191
67
+ #: ../classes/menu-item-manager.class.php:192
68
+ #: ../classes/menu-item-manager.class.php:193
69
+ msgid "columns"
70
+ msgstr ""
71
+
72
+ #: ../classes/menu-item-manager.class.php:197
73
+ #, fuzzy
74
+ msgid "Select a Widget to add to the panel"
75
+ msgstr "Selezionate un widget da visualizzare nel Pannello Mega"
76
+
77
+ #: ../classes/menu-item-manager.class.php:213
78
+ #, fuzzy
79
+ msgid "Sub menu items"
80
+ msgstr "Tipo di sottomenu"
81
+
82
+ #: ../classes/menu-item-manager.class.php:233
83
+ msgid "Widgets"
84
+ msgstr ""
85
+
86
+ #: ../classes/menu-item-manager.class.php:258
87
+ msgid ""
88
+ "No widgets found. Add a widget to this area using the Widget Selector (top "
89
+ "right)"
90
+ msgstr ""
91
+
92
+ #: ../classes/menu-item-manager.class.php:284
93
+ #, fuzzy
94
+ msgid "Menu Item Settings"
95
+ msgstr "Impostazioni Mega Menu"
96
+
97
+ #: ../classes/menu-item-manager.class.php:288
98
+ msgid "Hide Text"
99
+ msgstr ""
100
+
101
+ #: ../classes/menu-item-manager.class.php:295
102
+ #: ../classes/menu-item-manager.class.php:331
103
+ #: ../classes/menu-item-manager.class.php:356
104
+ msgid "Option only available for top level menu items"
105
+ msgstr ""
106
+
107
+ #: ../classes/menu-item-manager.class.php:302
108
+ msgid "Hide Arrow"
109
+ msgstr ""
110
+
111
+ #: ../classes/menu-item-manager.class.php:310
112
+ #, fuzzy
113
+ msgid "Disable Link"
114
+ msgstr "Disabilitato"
115
+
116
+ #: ../classes/menu-item-manager.class.php:318
117
+ msgid "Menu Item Align"
118
+ msgstr ""
119
+
120
+ #: ../classes/menu-item-manager.class.php:324
121
+ #: ../classes/menu-item-manager.class.php:349
122
+ #: ../classes/settings.class.php:815 ../classes/settings.class.php:904
123
+ #: ../classes/settings.class.php:1086 ../classes/settings.class.php:1208
124
+ #: ../classes/settings.class.php:1234 ../classes/settings.class.php:1286
125
+ #: ../classes/settings.class.php:1368 ../classes/settings.class.php:1447
126
+ #: ../classes/settings.class.php:1488 ../classes/settings.class.php:1641
127
+ msgid "Left"
128
+ msgstr "Sinistra"
129
+
130
+ #: ../classes/menu-item-manager.class.php:325
131
+ #: ../classes/menu-item-manager.class.php:350
132
+ #: ../classes/settings.class.php:819 ../classes/settings.class.php:896
133
+ #: ../classes/settings.class.php:1078 ../classes/settings.class.php:1200
134
+ #: ../classes/settings.class.php:1226 ../classes/settings.class.php:1278
135
+ #: ../classes/settings.class.php:1360 ../classes/settings.class.php:1439
136
+ #: ../classes/settings.class.php:1480 ../classes/settings.class.php:1643
137
+ msgid "Right"
138
+ msgstr "Destra"
139
+
140
+ #: ../classes/menu-item-manager.class.php:328
141
+ msgid ""
142
+ "Right aligned items will appear in reverse order on the right hand side of "
143
+ "the menu bar"
144
+ msgstr ""
145
+
146
+ #: ../classes/menu-item-manager.class.php:338
147
+ #, fuzzy
148
+ msgid "Sub Menu Settings"
149
+ msgstr "Impostazioni Mega Menu"
150
+
151
+ #: ../classes/menu-item-manager.class.php:343
152
+ #, fuzzy
153
+ msgid "Sub Menu Align"
154
+ msgstr "Posizione sottomenu"
155
+
156
+ #: ../classes/menu-item-manager.class.php:353
157
+ msgid ""
158
+ "Right aligned sub menus will align to the right of the parent menu item and "
159
+ "expand to the left"
160
+ msgstr ""
161
+
162
+ #: ../classes/menu-item-manager.class.php:366
163
+ #: ../classes/settings.class.php:439 ../classes/settings.class.php:626
164
+ msgid "General Settings"
165
+ msgstr "Impostazioni generali"
166
+
167
+ #: ../classes/menu-item-manager.class.php:385
168
+ msgid "Dashicons"
169
+ msgstr ""
170
+
171
+ #: ../classes/menu-item-manager.class.php:422
172
+ msgid "Menu Icon"
173
+ msgstr "Icona Menu"
174
+
175
+ #: ../classes/nav-menus.class.php:84
176
+ msgid "Mega Menu Settings"
177
+ msgstr "Impostazioni Mega Menu"
178
+
179
+ #: ../classes/nav-menus.class.php:126
180
+ msgid "Launched for Menu ID"
181
+ msgstr "Avviato per Menu ID"
182
+
183
+ #: ../classes/nav-menus.class.php:128
184
+ msgid "Saving"
185
+ msgstr ""
186
+
187
+ #: ../classes/nav-menus.class.php:130
188
+ msgid "Oops. Something went wrong. Please reload the page."
189
+ msgstr "Oops. Qualcosa è andato storto. Si prega di ricaricare la pagina."
190
+
191
+ #: ../classes/nav-menus.class.php:201
192
+ msgid "This theme does not have any menu locations."
193
+ msgstr "Questo tema non ha posizioni per il menu."
194
+
195
+ #: ../classes/nav-menus.class.php:205
196
+ msgid ""
197
+ "This menu is not tagged to a location. Please tag a location to enable the "
198
+ "Mega Menu settings."
199
+ msgstr ""
200
+ "Questo menu non è collocato in una posizione. Si prega di contrassegnare una "
201
+ "posizione per attivare le impostazioni di Mega Menu."
202
+
203
+ #: ../classes/nav-menus.class.php:245 ../classes/widget-manager.class.php:456
204
+ msgid "Save"
205
+ msgstr "Salva"
206
+
207
+ #: ../classes/nav-menus.class.php:260
208
+ msgid "Enable"
209
+ msgstr "Attiva"
210
+
211
+ #: ../classes/nav-menus.class.php:266
212
+ msgid "Event"
213
+ msgstr "Evento"
214
+
215
+ #: ../classes/nav-menus.class.php:269
216
+ msgid "Hover"
217
+ msgstr "Svolazza"
218
+
219
+ #: ../classes/nav-menus.class.php:270
220
+ msgid "Click"
221
+ msgstr "Fare clic"
222
+
223
+ #: ../classes/nav-menus.class.php:275
224
+ msgid "Effect"
225
+ msgstr ""
226
+
227
+ #: ../classes/nav-menus.class.php:284 ../classes/settings.class.php:1663
228
+ msgid "None"
229
+ msgstr ""
230
+
231
+ #: ../classes/nav-menus.class.php:288
232
+ msgid "Fade"
233
+ msgstr ""
234
+
235
+ #: ../classes/nav-menus.class.php:292
236
+ msgid "Slide"
237
+ msgstr ""
238
+
239
+ #: ../classes/nav-menus.class.php:306
240
+ msgid "Theme"
241
+ msgstr "Tema"
242
+
243
+ #: ../classes/settings.class.php:239
244
+ msgid "Copy"
245
+ msgstr ""
246
+
247
+ #: ../classes/settings.class.php:416 ../classes/settings.class.php:584
248
+ #, fuzzy
249
+ msgid "Max Mega Menu"
250
+ msgstr "Pannello di Mega Menu"
251
+
252
+ #: ../classes/settings.class.php:444
253
+ msgid "CSS Output"
254
+ msgstr ""
255
+
256
+ #: ../classes/settings.class.php:450
257
+ msgid "Enqueue dynamically via admin-ajax.php"
258
+ msgstr ""
259
+
260
+ #: ../classes/settings.class.php:451
261
+ msgid "Save to filesystem"
262
+ msgstr ""
263
+
264
+ #: ../classes/settings.class.php:452
265
+ msgid "Output in &lt;head&gt;"
266
+ msgstr ""
267
+
268
+ #: ../classes/settings.class.php:453
269
+ msgid "Don't output CSS"
270
+ msgstr ""
271
+
272
+ #: ../classes/settings.class.php:456
273
+ msgid ""
274
+ "Default. CSS will be enqueued dynamically through admin-ajax.php and loaded "
275
+ "from the cache."
276
+ msgstr ""
277
+
278
+ #: ../classes/settings.class.php:457
279
+ msgid ""
280
+ "CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued "
281
+ "from there."
282
+ msgstr ""
283
+
284
+ #: ../classes/settings.class.php:458
285
+ msgid ""
286
+ "CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; "
287
+ "of the page."
288
+ msgstr ""
289
+
290
+ #: ../classes/settings.class.php:459
291
+ msgid "CSS will not be output, you must enqueue the CSS for the menu manually."
292
+ msgstr ""
293
+
294
+ #: ../classes/settings.class.php:465
295
+ msgid "Click Event Behaviour"
296
+ msgstr ""
297
+
298
+ #: ../classes/settings.class.php:467
299
+ msgid ""
300
+ "Define what should happen when the event is set to 'click'. This also "
301
+ "applies to mobiles."
302
+ msgstr ""
303
+
304
+ #: ../classes/settings.class.php:472
305
+ msgid "First click will open a sub menu, second click will close the sub menu."
306
+ msgstr ""
307
+
308
+ #: ../classes/settings.class.php:473
309
+ msgid "First click will open a sub menu, second click will follow the link."
310
+ msgstr ""
311
+
312
+ #: ../classes/settings.class.php:483
313
+ #, fuzzy
314
+ msgid "Menu Settings"
315
+ msgstr "Impostazioni Mega Menu"
316
+
317
+ #: ../classes/settings.class.php:485
318
+ msgid ""
319
+ "Menu specific settings (e.g, click or hover event, menu theme, transition "
320
+ "effect) can be found under"
321
+ msgstr ""
322
+
323
+ #: ../classes/settings.class.php:485
324
+ msgid "Appearance > Menus"
325
+ msgstr ""
326
+
327
+ #: ../classes/settings.class.php:515
328
+ msgid "Cache"
329
+ msgstr ""
330
+
331
+ #: ../classes/settings.class.php:517
332
+ msgid "Regenerate CSS"
333
+ msgstr ""
334
+
335
+ #: ../classes/settings.class.php:518
336
+ msgid "Regenerate the CSS."
337
+ msgstr ""
338
+
339
+ #: ../classes/settings.class.php:525
340
+ msgid "Plugin Data"
341
+ msgstr ""
342
+
343
+ #: ../classes/settings.class.php:527
344
+ #, fuzzy
345
+ msgid "Delete Data"
346
+ msgstr "%s eliminato"
347
+
348
+ #: ../classes/settings.class.php:528
349
+ msgid ""
350
+ "Delete all saved Max Mega Menu plugin data from the database. Use with "
351
+ "caution!"
352
+ msgstr ""
353
+
354
+ #: ../classes/settings.class.php:548
355
+ msgid "Homepage"
356
+ msgstr ""
357
+
358
+ #: ../classes/settings.class.php:553
359
+ msgid "Documentation"
360
+ msgstr ""
361
+
362
+ #: ../classes/settings.class.php:558
363
+ msgid "Support"
364
+ msgstr ""
365
+
366
+ #: ../classes/settings.class.php:566
367
+ msgid "Core version"
368
+ msgstr ""
369
+
370
+ #: ../classes/settings.class.php:627
371
+ msgid "Tools"
372
+ msgstr ""
373
+
374
+ #: ../classes/settings.class.php:628
375
+ msgid "Theme Editor"
376
+ msgstr ""
377
+
378
+ #: ../classes/settings.class.php:685
379
+ msgid "Failed to delete theme. The theme is in use by a menu."
380
+ msgstr "Impossibile eliminare tema. Il tema è in uso da un menu."
381
+
382
+ #: ../classes/settings.class.php:689
383
+ msgid "CSS cache cleared and CSS regenerated"
384
+ msgstr ""
385
+
386
+ #: ../classes/settings.class.php:693
387
+ msgid "All plugin data removed"
388
+ msgstr ""
389
+
390
+ #: ../classes/settings.class.php:698
391
+ msgid "Theme Deleted"
392
+ msgstr "Tema Eliminato"
393
+
394
+ #: ../classes/settings.class.php:702
395
+ msgid "Theme Duplicated"
396
+ msgstr "Tema duplicato"
397
+
398
+ #: ../classes/settings.class.php:706
399
+ msgid "Changes Saved"
400
+ msgstr "Modifiche salvate"
401
+
402
+ #: ../classes/settings.class.php:710
403
+ msgid "Theme Reverted"
404
+ msgstr "Tema convertito"
405
+
406
+ #: ../classes/settings.class.php:714
407
+ msgid "New Theme Created"
408
+ msgstr "Nuovo Tema Creato"
409
+
410
+ #: ../classes/settings.class.php:775
411
+ msgid "Select theme to edit"
412
+ msgstr "Seleziona tema da modificare"
413
+
414
+ #: ../classes/settings.class.php:775 ../classes/settings.class.php:776
415
+ msgid "or"
416
+ msgstr ""
417
+
418
+ #: ../classes/settings.class.php:776
419
+ #, fuzzy
420
+ msgid "create a new theme"
421
+ msgstr "Creare un nuovo tema"
422
+
423
+ #: ../classes/settings.class.php:777
424
+ #, fuzzy
425
+ msgid "duplicate this theme"
426
+ msgstr "Duplica Tema"
427
+
428
+ #: ../classes/settings.class.php:786
429
+ #, fuzzy
430
+ msgid "Editing Theme:"
431
+ msgstr "Modifica Tema: "
432
+
433
+ #: ../classes/settings.class.php:787
434
+ #, fuzzy
435
+ msgid "General Theme Settings"
436
+ msgstr "Impostazioni generali"
437
+
438
+ #: ../classes/settings.class.php:792
439
+ #, fuzzy
440
+ msgid "Theme Title"
441
+ msgstr "Tema Eliminato"
442
+
443
+ #: ../classes/settings.class.php:800
444
+ msgid "Arrow"
445
+ msgstr ""
446
+
447
+ #: ../classes/settings.class.php:802
448
+ #, fuzzy
449
+ msgid "Select the arrow styles."
450
+ msgstr "Seleziona tema da modificare"
451
+
452
+ #: ../classes/settings.class.php:807
453
+ msgid "Up"
454
+ msgstr ""
455
+
456
+ #: ../classes/settings.class.php:811
457
+ msgid "Down"
458
+ msgstr ""
459
+
460
+ #: ../classes/settings.class.php:826
461
+ msgid "Responsive Breakpoint"
462
+ msgstr ""
463
+
464
+ #: ../classes/settings.class.php:828
465
+ msgid ""
466
+ "Set the width at which the menu turns into a mobile menu. Set to 0 to "
467
+ "disable responsive menu."
468
+ msgstr ""
469
+
470
+ #: ../classes/settings.class.php:835
471
+ msgid "Responsive Menu Text"
472
+ msgstr ""
473
+
474
+ #: ../classes/settings.class.php:837
475
+ msgid "Text to display next to the mobile toggle icon."
476
+ msgstr ""
477
+
478
+ #: ../classes/settings.class.php:844
479
+ msgid "Line Height"
480
+ msgstr ""
481
+
482
+ #: ../classes/settings.class.php:846
483
+ msgid "Set the general line height to use in the panel contents."
484
+ msgstr ""
485
+
486
+ #: ../classes/settings.class.php:853
487
+ msgid "Z-Index"
488
+ msgstr ""
489
+
490
+ #: ../classes/settings.class.php:855
491
+ msgid "Set the z-index to ensure the panels appear ontop of other content."
492
+ msgstr ""
493
+
494
+ #: ../classes/settings.class.php:862
495
+ msgid "Menu Bar"
496
+ msgstr "Barra dei menu"
497
+
498
+ #: ../classes/settings.class.php:867
499
+ #, fuzzy
500
+ msgid "Menu Background"
501
+ msgstr "Barra dei menu"
502
+
503
+ #: ../classes/settings.class.php:869
504
+ msgid ""
505
+ "The background color for the main menu bar. Set each value to transparent "
506
+ "for a 'button' style menu."
507
+ msgstr ""
508
+
509
+ #: ../classes/settings.class.php:874 ../classes/settings.class.php:960
510
+ #: ../classes/settings.class.php:978 ../classes/settings.class.php:1163
511
+ #: ../classes/settings.class.php:1388 ../classes/settings.class.php:1406
512
+ msgid "From"
513
+ msgstr ""
514
+
515
+ #: ../classes/settings.class.php:878 ../classes/settings.class.php:964
516
+ #: ../classes/settings.class.php:982 ../classes/settings.class.php:1167
517
+ #: ../classes/settings.class.php:1392 ../classes/settings.class.php:1410
518
+ msgid "To"
519
+ msgstr ""
520
+
521
+ #: ../classes/settings.class.php:885
522
+ #, fuzzy
523
+ msgid "Menu Padding"
524
+ msgstr "Barra dei menu"
525
+
526
+ #: ../classes/settings.class.php:887
527
+ msgid "Padding for the main menu bar."
528
+ msgstr ""
529
+
530
+ #: ../classes/settings.class.php:892 ../classes/settings.class.php:1074
531
+ #: ../classes/settings.class.php:1196 ../classes/settings.class.php:1222
532
+ #: ../classes/settings.class.php:1274 ../classes/settings.class.php:1356
533
+ #: ../classes/settings.class.php:1435 ../classes/settings.class.php:1476
534
+ msgid "Top"
535
+ msgstr ""
536
+
537
+ #: ../classes/settings.class.php:900 ../classes/settings.class.php:1082
538
+ #: ../classes/settings.class.php:1204 ../classes/settings.class.php:1230
539
+ #: ../classes/settings.class.php:1282 ../classes/settings.class.php:1364
540
+ #: ../classes/settings.class.php:1443 ../classes/settings.class.php:1484
541
+ msgid "Bottom"
542
+ msgstr ""
543
+
544
+ #: ../classes/settings.class.php:911 ../classes/settings.class.php:1241
545
+ #: ../classes/settings.class.php:1495
546
+ msgid "Rounded Corners"
547
+ msgstr ""
548
+
549
+ #: ../classes/settings.class.php:913
550
+ msgid "Set a border radius on the main menu bar."
551
+ msgstr ""
552
+
553
+ #: ../classes/settings.class.php:918 ../classes/settings.class.php:1100
554
+ #: ../classes/settings.class.php:1248 ../classes/settings.class.php:1502
555
+ #, fuzzy
556
+ msgid "Top Left"
557
+ msgstr "Sinistra"
558
+
559
+ #: ../classes/settings.class.php:922 ../classes/settings.class.php:1104
560
+ #: ../classes/settings.class.php:1252 ../classes/settings.class.php:1506
561
+ #, fuzzy
562
+ msgid "Top Right"
563
+ msgstr "Destra"
564
+
565
+ #: ../classes/settings.class.php:926 ../classes/settings.class.php:1108
566
+ #: ../classes/settings.class.php:1256 ../classes/settings.class.php:1510
567
+ msgid "Bottom Right"
568
+ msgstr ""
569
+
570
+ #: ../classes/settings.class.php:930 ../classes/settings.class.php:1112
571
+ #: ../classes/settings.class.php:1260 ../classes/settings.class.php:1514
572
+ msgid "Bottom Left"
573
+ msgstr ""
574
+
575
+ #: ../classes/settings.class.php:937
576
+ msgid "Menu Items Align"
577
+ msgstr ""
578
+
579
+ #: ../classes/settings.class.php:939
580
+ msgid ""
581
+ "Align all menu items to the left (default), centrally or to the right. To "
582
+ "align a single menu item to the right, use the Mega Menu options for the "
583
+ "menu item."
584
+ msgstr ""
585
+
586
+ #: ../classes/settings.class.php:948
587
+ msgid "Top Level Menu Items"
588
+ msgstr "Voci nel menu"
589
+
590
+ #: ../classes/settings.class.php:953
591
+ #, fuzzy
592
+ msgid "Menu Item Background"
593
+ msgstr "Icona Menu"
594
+
595
+ #: ../classes/settings.class.php:955
596
+ msgid ""
597
+ "The background color for each top level menu item. Tip: Set these values to "
598
+ "transparent if you've already set a background color on the menu container."
599
+ msgstr ""
600
+
601
+ #: ../classes/settings.class.php:971
602
+ msgid "Menu Item Background (Hover)"
603
+ msgstr ""
604
+
605
+ #: ../classes/settings.class.php:973
606
+ msgid "The background color for a top level menu item (on hover)."
607
+ msgstr ""
608
+
609
+ #: ../classes/settings.class.php:989
610
+ #, fuzzy
611
+ msgid "Menu Item Spacing"
612
+ msgstr "Icona Menu"
613
+
614
+ #: ../classes/settings.class.php:991
615
+ msgid "Define the size of the gap between each top level menu item."
616
+ msgstr ""
617
+
618
+ #: ../classes/settings.class.php:1000
619
+ msgid "Menu Item Height"
620
+ msgstr ""
621
+
622
+ #: ../classes/settings.class.php:1002
623
+ msgid ""
624
+ "Define the height of each top level menu item. This value, plus the "
625
+ "container top and bottom padding values define the overall height of the "
626
+ "menu bar."
627
+ msgstr ""
628
+
629
+ #: ../classes/settings.class.php:1011 ../classes/settings.class.php:1521
630
+ msgid "Font"
631
+ msgstr ""
632
+
633
+ #: ../classes/settings.class.php:1013
634
+ msgid "The font to use for each top level menu item."
635
+ msgstr ""
636
+
637
+ #: ../classes/settings.class.php:1018 ../classes/settings.class.php:1052
638
+ #: ../classes/settings.class.php:1130 ../classes/settings.class.php:1192
639
+ #: ../classes/settings.class.php:1300 ../classes/settings.class.php:1334
640
+ #: ../classes/settings.class.php:1472 ../classes/settings.class.php:1528
641
+ #: ../classes/settings.class.php:1562
642
+ msgid "Color"
643
+ msgstr ""
644
+
645
+ #: ../classes/settings.class.php:1022 ../classes/settings.class.php:1304
646
+ #: ../classes/settings.class.php:1338 ../classes/settings.class.php:1532
647
+ msgid "Size"
648
+ msgstr ""
649
+
650
+ #: ../classes/settings.class.php:1026 ../classes/settings.class.php:1308
651
+ #: ../classes/settings.class.php:1342 ../classes/settings.class.php:1536
652
+ msgid "Family"
653
+ msgstr ""
654
+
655
+ #: ../classes/settings.class.php:1030 ../classes/settings.class.php:1316
656
+ #: ../classes/settings.class.php:1540
657
+ msgid "Transform"
658
+ msgstr ""
659
+
660
+ #: ../classes/settings.class.php:1034 ../classes/settings.class.php:1056
661
+ #: ../classes/settings.class.php:1312 ../classes/settings.class.php:1544
662
+ #: ../classes/settings.class.php:1566
663
+ #, fuzzy
664
+ msgid "Weight"
665
+ msgstr "Destra"
666
+
667
+ #: ../classes/settings.class.php:1038 ../classes/settings.class.php:1060
668
+ #: ../classes/settings.class.php:1320 ../classes/settings.class.php:1548
669
+ #: ../classes/settings.class.php:1570
670
+ msgid "Decoration"
671
+ msgstr ""
672
+
673
+ #: ../classes/settings.class.php:1045 ../classes/settings.class.php:1555
674
+ msgid "Font (Hover)"
675
+ msgstr ""
676
+
677
+ #: ../classes/settings.class.php:1047
678
+ msgid "Set the font to use for each top level menu item (on hover)."
679
+ msgstr ""
680
+
681
+ #: ../classes/settings.class.php:1067
682
+ msgid "Menu Item Padding"
683
+ msgstr ""
684
+
685
+ #: ../classes/settings.class.php:1069
686
+ msgid "Set the padding for each top level menu item."
687
+ msgstr ""
688
+
689
+ #: ../classes/settings.class.php:1093
690
+ msgid "Menu Item Rounded Corners"
691
+ msgstr ""
692
+
693
+ #: ../classes/settings.class.php:1095
694
+ msgid "Set rounded corners for each top level menu item."
695
+ msgstr ""
696
+
697
+ #: ../classes/settings.class.php:1119
698
+ msgid "Menu Item Divider"
699
+ msgstr ""
700
+
701
+ #: ../classes/settings.class.php:1121
702
+ msgid "Show a small divider bar between each menu item."
703
+ msgstr ""
704
+
705
+ #: ../classes/settings.class.php:1126
706
+ #, fuzzy
707
+ msgid "Enabled"
708
+ msgstr "Attiva"
709
+
710
+ #: ../classes/settings.class.php:1134
711
+ msgid "Glow Opacity"
712
+ msgstr ""
713
+
714
+ #: ../classes/settings.class.php:1142
715
+ msgid "Highlight Current Item"
716
+ msgstr ""
717
+
718
+ #: ../classes/settings.class.php:1144
719
+ msgid "Apply the 'hover' styling to current menu items."
720
+ msgstr ""
721
+
722
+ #: ../classes/settings.class.php:1151
723
+ msgid "Mega Panels"
724
+ msgstr "Pannelli Mega"
725
+
726
+ #: ../classes/settings.class.php:1156
727
+ msgid "Panel Background"
728
+ msgstr ""
729
+
730
+ #: ../classes/settings.class.php:1158
731
+ msgid "Set a background color for a whole panel."
732
+ msgstr ""
733
+
734
+ #: ../classes/settings.class.php:1174
735
+ msgid "Panel Width"
736
+ msgstr ""
737
+
738
+ #: ../classes/settings.class.php:1176
739
+ msgid ""
740
+ "Mega Panel width. Note: A 100% wide panel will only ever be as wide as the "
741
+ "menu itself. For a fixed panel width set this to a pixel value. Advanced: "
742
+ "enter a jQuery selector to align the sub menu to a page element."
743
+ msgstr ""
744
+
745
+ #: ../classes/settings.class.php:1185
746
+ msgid "Panel Border"
747
+ msgstr ""
748
+
749
+ #: ../classes/settings.class.php:1187
750
+ #, fuzzy
751
+ msgid "Set the border to display on the Mega Panel."
752
+ msgstr "Selezionate un widget da visualizzare nel Pannello Mega"
753
+
754
+ #: ../classes/settings.class.php:1215
755
+ msgid "Panel Padding"
756
+ msgstr ""
757
+
758
+ #: ../classes/settings.class.php:1217
759
+ msgid ""
760
+ "Set the padding for the whole panel. Set these values 0px if you wish your "
761
+ "panel content to go edge-to-edge."
762
+ msgstr ""
763
+
764
+ #: ../classes/settings.class.php:1243
765
+ msgid "Set rounded corners for the panel."
766
+ msgstr ""
767
+
768
+ #: ../classes/settings.class.php:1267
769
+ msgid "Widget Padding"
770
+ msgstr ""
771
+
772
+ #: ../classes/settings.class.php:1269
773
+ msgid ""
774
+ "Set the padding for each widget in the panel. Use this to define the spacing "
775
+ "between each widget in the panel."
776
+ msgstr ""
777
+
778
+ #: ../classes/settings.class.php:1293
779
+ msgid "Heading Font"
780
+ msgstr ""
781
+
782
+ #: ../classes/settings.class.php:1295
783
+ msgid ""
784
+ "Set the font to use for Widget Headers. This setting is also used for second "
785
+ "level menu items when they're displayed in a Mega Menu."
786
+ msgstr ""
787
+
788
+ #: ../classes/settings.class.php:1327
789
+ msgid "Content Font"
790
+ msgstr ""
791
+
792
+ #: ../classes/settings.class.php:1329
793
+ msgid "Set the font to use for panel contents."
794
+ msgstr ""
795
+
796
+ #: ../classes/settings.class.php:1349
797
+ msgid "Heading Padding"
798
+ msgstr ""
799
+
800
+ #: ../classes/settings.class.php:1351
801
+ msgid ""
802
+ "Set the padding for the headings. Use this to set the gap between the widget "
803
+ "heading and the widget content."
804
+ msgstr ""
805
+
806
+ #: ../classes/settings.class.php:1376
807
+ msgid "Flyout Menus"
808
+ msgstr "Menu Flyout"
809
+
810
+ #: ../classes/settings.class.php:1381
811
+ msgid "Item Background"
812
+ msgstr ""
813
+
814
+ #: ../classes/settings.class.php:1383
815
+ msgid "Set the background color for a flyout menu item."
816
+ msgstr ""
817
+
818
+ #: ../classes/settings.class.php:1399
819
+ msgid "Item Background (Hover)"
820
+ msgstr ""
821
+
822
+ #: ../classes/settings.class.php:1401
823
+ msgid "Set the background color for a flyout menu item (on hover)."
824
+ msgstr ""
825
+
826
+ #: ../classes/settings.class.php:1417
827
+ msgid "Item Height"
828
+ msgstr ""
829
+
830
+ #: ../classes/settings.class.php:1419
831
+ msgid "The height of each flyout menu item."
832
+ msgstr ""
833
+
834
+ #: ../classes/settings.class.php:1428
835
+ msgid "Item Padding"
836
+ msgstr ""
837
+
838
+ #: ../classes/settings.class.php:1430
839
+ msgid "Set the padding for each flyout menu item."
840
+ msgstr ""
841
+
842
+ #: ../classes/settings.class.php:1454
843
+ #, fuzzy
844
+ msgid "Flyout Menu Width"
845
+ msgstr "Menu Flyout"
846
+
847
+ #: ../classes/settings.class.php:1456
848
+ msgid "The width of each flyout menu."
849
+ msgstr ""
850
+
851
+ #: ../classes/settings.class.php:1465
852
+ #, fuzzy
853
+ msgid "Flyout Menu Border"
854
+ msgstr "Menu Flyout"
855
+
856
+ #: ../classes/settings.class.php:1467
857
+ msgid "Set the border for the flyout menu."
858
+ msgstr ""
859
+
860
+ #: ../classes/settings.class.php:1497
861
+ msgid ""
862
+ "Set rounded corners for flyout menus. Rounded corners will be applied to all "
863
+ "flyout menu levels."
864
+ msgstr ""
865
+
866
+ #: ../classes/settings.class.php:1523
867
+ msgid "Set the font for the flyout menu items."
868
+ msgstr ""
869
+
870
+ #: ../classes/settings.class.php:1557
871
+ msgid "Set the font weight for the flyout menu items (on hover)."
872
+ msgstr ""
873
+
874
+ #: ../classes/settings.class.php:1577
875
+ #, fuzzy
876
+ msgid "Custom Styling"
877
+ msgstr "SCSS Personalizzato"
878
+
879
+ #: ../classes/settings.class.php:1582
880
+ msgid "CSS Editor"
881
+ msgstr ""
882
+
883
+ #: ../classes/settings.class.php:1584
884
+ msgid ""
885
+ "Define any custom CSS you wish to add to menus using this theme. You can use "
886
+ "standard CSS or SCSS."
887
+ msgstr ""
888
+
889
+ #: ../classes/settings.class.php:1590
890
+ msgid "Custom Styling Tips"
891
+ msgstr ""
892
+
893
+ #: ../classes/settings.class.php:1592
894
+ msgid ""
895
+ "converts to the ID selector of the menu wrapper, e.g. div#mega-menu-wrap-"
896
+ "primary"
897
+ msgstr ""
898
+
899
+ #: ../classes/settings.class.php:1593
900
+ msgid "converts to the ID selector of the menu, e.g. ul#mega-menu-primary"
901
+ msgstr ""
902
+
903
+ #: ../classes/settings.class.php:1594
904
+ msgid ""
905
+ "Use @import rules to import CSS from other plugins or your theme directory, "
906
+ "e.g:"
907
+ msgstr ""
908
+
909
+ #: ../classes/settings.class.php:1609
910
+ msgid "Delete Theme"
911
+ msgstr "Elimina Tema"
912
+
913
+ #: ../classes/settings.class.php:1613
914
+ #, fuzzy
915
+ msgid "Revert Theme"
916
+ msgstr "Elimina Tema"
917
+
918
+ #: ../classes/settings.class.php:1642
919
+ msgid "Center"
920
+ msgstr ""
921
+
922
+ #: ../classes/settings.class.php:1664
923
+ msgid "Underline"
924
+ msgstr ""
925
+
926
+ #: ../classes/settings.class.php:1708
927
+ msgid "Disabled"
928
+ msgstr "Disabilitato"
929
+
930
+ #: ../classes/settings.class.php:1765 ../classes/settings.class.php:1784
931
+ msgid "Normal"
932
+ msgstr "Normale"
933
+
934
+ #: ../classes/settings.class.php:1766
935
+ msgid "Bold"
936
+ msgstr "Grassetto"
937
+
938
+ #: ../classes/settings.class.php:1785
939
+ msgid "Capitalize"
940
+ msgstr "Capitalizza"
941
+
942
+ #: ../classes/settings.class.php:1786
943
+ msgid "Uppercase"
944
+ msgstr "Maiuscolo"
945
+
946
+ #: ../classes/settings.class.php:1787
947
+ msgid "Lowercase"
948
+ msgstr "Minuscolo"
949
+
950
+ #: ../classes/settings.class.php:1822
951
+ msgid "Theme Default"
952
+ msgstr "Tema di Default"
953
+
954
+ #: ../classes/settings.class.php:1929
955
+ msgid "Are you sure?"
956
+ msgstr "Sei sicuro?"
957
+
958
+ #: ../classes/style-manager.class.php:67
959
+ msgid "Default"
960
+ msgstr "Default"
961
+
962
+ #: ../classes/style-manager.class.php:450
963
+ msgid ""
964
+ "Warning: CSS compilation failed. Please check your changes or revert the "
965
+ "theme."
966
+ msgstr ""
967
+ "Attenzione: compilazione CSS non riuscita. Si prega di verificare le "
968
+ "modifiche o ripristinare il tema."
969
+
970
+ #: ../classes/widget-manager.class.php:76
971
+ msgid "Mega Menu Widgets"
972
+ msgstr "Widgets di Mega Menu"
973
+
974
+ #: ../classes/widget-manager.class.php:77
975
+ msgid "Do not manually edit this area."
976
+ msgstr "Non modificare manualmente quest'area."
977
+
978
+ #: ../classes/widget-manager.class.php:114
979
+ #, php-format
980
+ msgid "Saved %s"
981
+ msgstr "Salvato %s"
982
+
983
+ #: ../classes/widget-manager.class.php:115
984
+ #, php-format
985
+ msgid "Failed to save %s"
986
+ msgstr "Salvataggio di %s fallito"
987
+
988
+ #: ../classes/widget-manager.class.php:139
989
+ #, php-format
990
+ msgid "Updated %s (new columns: %d)"
991
+ msgstr "Aggiornato %s (nuove colonne: %d )"
992
+
993
+ #: ../classes/widget-manager.class.php:140
994
+ #, php-format
995
+ msgid "Failed to update %s"
996
+ msgstr "Fallito nell'aggiornamento di %s"
997
+
998
+ #: ../classes/widget-manager.class.php:166
999
+ #, php-format
1000
+ msgid "Failed to add %s to %d"
1001
+ msgstr "Fallito nell'aggiungere %s a %d"
1002
+
1003
+ #: ../classes/widget-manager.class.php:189
1004
+ #, php-format
1005
+ msgid "Deleted %s"
1006
+ msgstr "%s eliminato"
1007
+
1008
+ #: ../classes/widget-manager.class.php:190
1009
+ #, php-format
1010
+ msgid "Failed to delete %s"
1011
+ msgstr "Impossibile eliminare %s"
1012
+
1013
+ #: ../classes/widget-manager.class.php:215
1014
+ #, php-format
1015
+ msgid "Moved %s to %d (%s)"
1016
+ msgstr "%s spostato a %d (%s)"
1017
+
1018
+ #: ../classes/widget-manager.class.php:216
1019
+ #, php-format
1020
+ msgid "Failed to move %s to %d"
1021
+ msgstr "Impossibile spostare %s a %d"
1022
+
1023
+ #~ msgid "Mega Menu Options"
1024
+ #~ msgstr "Opzioni Mega Menu"
1025
+
1026
+ #~ msgid "Configure Panel Widgets for"
1027
+ #~ msgstr "Configura il pannello Widgets per"
1028
+
1029
+ #~ msgid "Added to list"
1030
+ #~ msgstr "Aggiunto alla lista"
1031
+
1032
+ #~ msgid "Mega Menu Themes"
1033
+ #~ msgstr "Temi Mega Menu"
1034
+
1035
+ #~ msgid "Menu Themes"
1036
+ #~ msgstr "Temi menu"
1037
+
1038
+ #~ msgid "Revert Changes"
1039
+ #~ msgstr "Ripristina modifiche"
languages/megamenu.mo ADDED
Binary file
languages/megamenu.po ADDED
@@ -0,0 +1,1218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: megamenu\n"
4
+ "POT-Creation-Date: 2015-04-26 16:16-0000\n"
5
+ "PO-Revision-Date: 2015-04-26 16:16-0000\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: English\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.5.7\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SearchPath-0: ..\n"
16
+ "X-Poedit-SearchPath-1: .\n"
17
+
18
+ #: ../megamenu.php:455
19
+ msgid ""
20
+ "Max Mega Menu is not compatible with your version of WordPress. Please "
21
+ "upgrade WordPress to the latest version or disable Max Mega Menu."
22
+ msgstr ""
23
+
24
+ #: ../megamenu.php:466
25
+ msgid ""
26
+ "Max Mega Menu is not compatible with Uber Menu. Please disable Uber Menu."
27
+ msgstr ""
28
+
29
+ #: ../megamenu.php:479
30
+ msgid "click here"
31
+ msgstr ""
32
+
33
+ #: ../megamenu.php:482
34
+ #, php-format
35
+ msgid "Thanks for installing Max Mega Menu! Please %s to get started."
36
+ msgstr ""
37
+
38
+ #: ../megamenu.php:494
39
+ msgid "regenerate the CSS"
40
+ msgstr ""
41
+
42
+ #: ../megamenu.php:497
43
+ #, php-format
44
+ msgid ""
45
+ "Max Mega Menu Updated. Please %s to ensure maximum compatibility with the "
46
+ "latest version."
47
+ msgstr ""
48
+
49
+ #: ../classes/menu-item-manager.class.php:171
50
+ #: ../classes/menu-item-manager.class.php:264
51
+ #: ../classes/nav-menus.class.php:127
52
+ msgid "Mega Menu"
53
+ msgstr ""
54
+
55
+ #: ../classes/menu-item-manager.class.php:172
56
+ msgid "Mega Menus can only be created on top level menu items."
57
+ msgstr ""
58
+
59
+ #: ../classes/menu-item-manager.class.php:183
60
+ msgid "Enable Mega Menu"
61
+ msgstr ""
62
+
63
+ #: ../classes/menu-item-manager.class.php:186
64
+ msgid "column"
65
+ msgstr ""
66
+
67
+ #: ../classes/menu-item-manager.class.php:187
68
+ #: ../classes/menu-item-manager.class.php:188
69
+ #: ../classes/menu-item-manager.class.php:189
70
+ #: ../classes/menu-item-manager.class.php:190
71
+ #: ../classes/menu-item-manager.class.php:191
72
+ #: ../classes/menu-item-manager.class.php:192
73
+ #: ../classes/menu-item-manager.class.php:193
74
+ msgid "columns"
75
+ msgstr ""
76
+
77
+ #: ../classes/menu-item-manager.class.php:197
78
+ msgid "Select a Widget to add to the panel"
79
+ msgstr ""
80
+
81
+ #: ../classes/menu-item-manager.class.php:213
82
+ msgid "Sub menu items"
83
+ msgstr ""
84
+
85
+ #: ../classes/menu-item-manager.class.php:233
86
+ msgid "Widgets"
87
+ msgstr ""
88
+
89
+ #: ../classes/menu-item-manager.class.php:258
90
+ msgid ""
91
+ "No widgets found. Add a widget to this area using the Widget Selector (top "
92
+ "right)"
93
+ msgstr ""
94
+
95
+ #: ../classes/menu-item-manager.class.php:284
96
+ msgid "Menu Item Settings"
97
+ msgstr ""
98
+
99
+ #: ../classes/menu-item-manager.class.php:288
100
+ msgid "Hide Text"
101
+ msgstr ""
102
+
103
+ #: ../classes/menu-item-manager.class.php:295
104
+ #: ../classes/menu-item-manager.class.php:331
105
+ #: ../classes/menu-item-manager.class.php:356
106
+ msgid "Option only available for top level menu items"
107
+ msgstr ""
108
+
109
+ #: ../classes/menu-item-manager.class.php:302
110
+ msgid "Hide Arrow"
111
+ msgstr ""
112
+
113
+ #: ../classes/menu-item-manager.class.php:310
114
+ msgid "Disable Link"
115
+ msgstr ""
116
+
117
+ #: ../classes/menu-item-manager.class.php:318
118
+ msgid "Menu Item Align"
119
+ msgstr ""
120
+
121
+ #: ../classes/menu-item-manager.class.php:324
122
+ #: ../classes/menu-item-manager.class.php:349
123
+ #: ../classes/settings.class.php:847 ../classes/settings.class.php:984
124
+ #: ../classes/settings.class.php:1167 ../classes/settings.class.php:1197
125
+ #: ../classes/settings.class.php:1330 ../classes/settings.class.php:1360
126
+ #: ../classes/settings.class.php:1412 ../classes/settings.class.php:1494
127
+ #: ../classes/settings.class.php:1520 ../classes/settings.class.php:1550
128
+ #: ../classes/settings.class.php:1656 ../classes/settings.class.php:1682
129
+ #: ../classes/settings.class.php:1712 ../classes/settings.class.php:1818
130
+ #: ../classes/settings.class.php:1880 ../classes/settings.class.php:1911
131
+ #: ../classes/settings.class.php:2010 ../classes/settings.class.php:2150
132
+ msgid "Left"
133
+ msgstr ""
134
+
135
+ #: ../classes/menu-item-manager.class.php:325
136
+ #: ../classes/menu-item-manager.class.php:350
137
+ #: ../classes/settings.class.php:851 ../classes/settings.class.php:976
138
+ #: ../classes/settings.class.php:1159 ../classes/settings.class.php:1189
139
+ #: ../classes/settings.class.php:1322 ../classes/settings.class.php:1352
140
+ #: ../classes/settings.class.php:1404 ../classes/settings.class.php:1486
141
+ #: ../classes/settings.class.php:1512 ../classes/settings.class.php:1542
142
+ #: ../classes/settings.class.php:1648 ../classes/settings.class.php:1674
143
+ #: ../classes/settings.class.php:1704 ../classes/settings.class.php:1810
144
+ #: ../classes/settings.class.php:1872 ../classes/settings.class.php:1903
145
+ #: ../classes/settings.class.php:2002 ../classes/settings.class.php:2152
146
+ msgid "Right"
147
+ msgstr ""
148
+
149
+ #: ../classes/menu-item-manager.class.php:328
150
+ msgid ""
151
+ "Right aligned items will appear in reverse order on the right hand side of "
152
+ "the menu bar"
153
+ msgstr ""
154
+
155
+ #: ../classes/menu-item-manager.class.php:338
156
+ msgid "Sub Menu Settings"
157
+ msgstr ""
158
+
159
+ #: ../classes/menu-item-manager.class.php:343
160
+ msgid "Sub Menu Align"
161
+ msgstr ""
162
+
163
+ #: ../classes/menu-item-manager.class.php:353
164
+ msgid ""
165
+ "Right aligned sub menus will align to the right of the parent menu item and "
166
+ "expand to the left"
167
+ msgstr ""
168
+
169
+ #: ../classes/menu-item-manager.class.php:366
170
+ #: ../classes/settings.class.php:426 ../classes/settings.class.php:617
171
+ msgid "General Settings"
172
+ msgstr ""
173
+
174
+ #: ../classes/menu-item-manager.class.php:385
175
+ msgid "Dashicons"
176
+ msgstr ""
177
+
178
+ #: ../classes/menu-item-manager.class.php:423
179
+ msgid "Menu Icon"
180
+ msgstr ""
181
+
182
+ #: ../classes/nav-menus.class.php:84
183
+ msgid "Mega Menu Settings"
184
+ msgstr ""
185
+
186
+ #: ../classes/nav-menus.class.php:126
187
+ msgid "Launched for Menu ID"
188
+ msgstr ""
189
+
190
+ #: ../classes/nav-menus.class.php:128
191
+ msgid "Saving"
192
+ msgstr ""
193
+
194
+ #: ../classes/nav-menus.class.php:130
195
+ msgid "Oops. Something went wrong. Please reload the page."
196
+ msgstr ""
197
+
198
+ #: ../classes/nav-menus.class.php:201
199
+ msgid "This theme does not have any menu locations."
200
+ msgstr ""
201
+
202
+ #: ../classes/nav-menus.class.php:205
203
+ msgid ""
204
+ "This menu is not tagged to a location. Please tag a location to enable the "
205
+ "Mega Menu settings."
206
+ msgstr ""
207
+
208
+ #: ../classes/nav-menus.class.php:245 ../classes/widget-manager.class.php:446
209
+ msgid "Save"
210
+ msgstr ""
211
+
212
+ #: ../classes/nav-menus.class.php:260
213
+ msgid "Enable"
214
+ msgstr ""
215
+
216
+ #: ../classes/nav-menus.class.php:266
217
+ msgid "Event"
218
+ msgstr ""
219
+
220
+ #: ../classes/nav-menus.class.php:269
221
+ msgid "Hover"
222
+ msgstr ""
223
+
224
+ #: ../classes/nav-menus.class.php:270
225
+ msgid "Click"
226
+ msgstr ""
227
+
228
+ #: ../classes/nav-menus.class.php:275
229
+ msgid "Effect"
230
+ msgstr ""
231
+
232
+ #: ../classes/nav-menus.class.php:284 ../classes/settings.class.php:2172
233
+ msgid "None"
234
+ msgstr ""
235
+
236
+ #: ../classes/nav-menus.class.php:288
237
+ msgid "Fade"
238
+ msgstr ""
239
+
240
+ #: ../classes/nav-menus.class.php:292
241
+ msgid "Slide"
242
+ msgstr ""
243
+
244
+ #: ../classes/nav-menus.class.php:306
245
+ msgid "Theme"
246
+ msgstr ""
247
+
248
+ #: ../classes/settings.class.php:226
249
+ msgid "Copy"
250
+ msgstr ""
251
+
252
+ #: ../classes/settings.class.php:403 ../classes/settings.class.php:575
253
+ msgid "Max Mega Menu"
254
+ msgstr ""
255
+
256
+ #: ../classes/settings.class.php:431
257
+ msgid "CSS Output"
258
+ msgstr ""
259
+
260
+ #: ../classes/settings.class.php:437
261
+ msgid "Enqueue dynamically via admin-ajax.php"
262
+ msgstr ""
263
+
264
+ #: ../classes/settings.class.php:438
265
+ msgid "Save to filesystem"
266
+ msgstr ""
267
+
268
+ #: ../classes/settings.class.php:439
269
+ msgid "Output in &lt;head&gt;"
270
+ msgstr ""
271
+
272
+ #: ../classes/settings.class.php:440
273
+ msgid "Don't output CSS"
274
+ msgstr ""
275
+
276
+ #: ../classes/settings.class.php:443
277
+ msgid ""
278
+ "Default. CSS will be enqueued dynamically through admin-ajax.php and loaded "
279
+ "from the cache."
280
+ msgstr ""
281
+
282
+ #: ../classes/settings.class.php:444
283
+ msgid ""
284
+ "CSS will be saved to wp-content/uploads/maxmegamenu/style.css and enqueued "
285
+ "from there."
286
+ msgstr ""
287
+
288
+ #: ../classes/settings.class.php:445
289
+ msgid ""
290
+ "CSS will be loaded from the cache in a &lt;style&gt; tag in the &lt;head&gt; "
291
+ "of the page."
292
+ msgstr ""
293
+
294
+ #: ../classes/settings.class.php:446
295
+ msgid "CSS will not be output, you must enqueue the CSS for the menu manually."
296
+ msgstr ""
297
+
298
+ #: ../classes/settings.class.php:452
299
+ msgid "Click Event Behaviour"
300
+ msgstr ""
301
+
302
+ #: ../classes/settings.class.php:454
303
+ msgid ""
304
+ "Define what should happen when the event is set to 'click'. This also "
305
+ "applies to mobiles."
306
+ msgstr ""
307
+
308
+ #: ../classes/settings.class.php:459
309
+ msgid "First click will open a sub menu, second click will close the sub menu."
310
+ msgstr ""
311
+
312
+ #: ../classes/settings.class.php:460
313
+ msgid "First click will open a sub menu, second click will follow the link."
314
+ msgstr ""
315
+
316
+ #: ../classes/settings.class.php:470
317
+ msgid "Menu Settings"
318
+ msgstr ""
319
+
320
+ #: ../classes/settings.class.php:472
321
+ msgid ""
322
+ "Menu specific settings (e.g, click or hover event, menu theme, transition "
323
+ "effect) can be found under"
324
+ msgstr ""
325
+
326
+ #: ../classes/settings.class.php:472
327
+ msgid "Appearance > Menus"
328
+ msgstr ""
329
+
330
+ #: ../classes/settings.class.php:502
331
+ msgid "Cache"
332
+ msgstr ""
333
+
334
+ #: ../classes/settings.class.php:504
335
+ msgid "Regenerate CSS"
336
+ msgstr ""
337
+
338
+ #: ../classes/settings.class.php:505
339
+ msgid "Regenerate the CSS."
340
+ msgstr ""
341
+
342
+ #: ../classes/settings.class.php:512
343
+ msgid "Plugin Data"
344
+ msgstr ""
345
+
346
+ #: ../classes/settings.class.php:514
347
+ msgid "Delete Data"
348
+ msgstr ""
349
+
350
+ #: ../classes/settings.class.php:515
351
+ msgid ""
352
+ "Delete all saved Max Mega Menu plugin data from the database. Use with "
353
+ "caution!"
354
+ msgstr ""
355
+
356
+ #: ../classes/settings.class.php:535
357
+ msgid "Homepage"
358
+ msgstr ""
359
+
360
+ #: ../classes/settings.class.php:540
361
+ msgid "Documentation"
362
+ msgstr ""
363
+
364
+ #: ../classes/settings.class.php:545
365
+ msgid "Support"
366
+ msgstr ""
367
+
368
+ #: ../classes/settings.class.php:553
369
+ msgid "Core version"
370
+ msgstr ""
371
+
372
+ #: ../classes/settings.class.php:557
373
+ msgid "Pro extension"
374
+ msgstr ""
375
+
376
+ #: ../classes/settings.class.php:618
377
+ msgid "Tools"
378
+ msgstr ""
379
+
380
+ #: ../classes/settings.class.php:619
381
+ msgid "Theme Editor"
382
+ msgstr ""
383
+
384
+ #: ../classes/settings.class.php:685
385
+ msgid "Failed to delete theme. The theme is in use by a menu."
386
+ msgstr ""
387
+
388
+ #: ../classes/settings.class.php:689
389
+ msgid "CSS cache cleared and CSS regenerated"
390
+ msgstr ""
391
+
392
+ #: ../classes/settings.class.php:693
393
+ msgid "All plugin data removed"
394
+ msgstr ""
395
+
396
+ #: ../classes/settings.class.php:698
397
+ msgid "Theme Deleted"
398
+ msgstr ""
399
+
400
+ #: ../classes/settings.class.php:702
401
+ msgid "Theme Duplicated"
402
+ msgstr ""
403
+
404
+ #: ../classes/settings.class.php:706
405
+ msgid "Changes Saved"
406
+ msgstr ""
407
+
408
+ #: ../classes/settings.class.php:710
409
+ msgid "Theme Reverted"
410
+ msgstr ""
411
+
412
+ #: ../classes/settings.class.php:714
413
+ msgid "New Theme Created"
414
+ msgstr ""
415
+
416
+ #: ../classes/settings.class.php:808
417
+ msgid "Select theme to edit"
418
+ msgstr ""
419
+
420
+ #: ../classes/settings.class.php:808 ../classes/settings.class.php:809
421
+ msgid "or"
422
+ msgstr ""
423
+
424
+ #: ../classes/settings.class.php:809
425
+ msgid "create a new theme"
426
+ msgstr ""
427
+
428
+ #: ../classes/settings.class.php:810
429
+ msgid "duplicate this theme"
430
+ msgstr ""
431
+
432
+ #: ../classes/settings.class.php:818
433
+ msgid "Editing Theme:"
434
+ msgstr ""
435
+
436
+ #: ../classes/settings.class.php:819
437
+ msgid "General Theme Settings"
438
+ msgstr ""
439
+
440
+ #: ../classes/settings.class.php:824
441
+ msgid "Theme Title"
442
+ msgstr ""
443
+
444
+ #: ../classes/settings.class.php:832
445
+ msgid "Arrow"
446
+ msgstr ""
447
+
448
+ #: ../classes/settings.class.php:834
449
+ msgid "Select the arrow styles."
450
+ msgstr ""
451
+
452
+ #: ../classes/settings.class.php:839
453
+ msgid "Up"
454
+ msgstr ""
455
+
456
+ #: ../classes/settings.class.php:843
457
+ msgid "Down"
458
+ msgstr ""
459
+
460
+ #: ../classes/settings.class.php:858
461
+ msgid "Responsive Breakpoint"
462
+ msgstr ""
463
+
464
+ #: ../classes/settings.class.php:860
465
+ msgid ""
466
+ "Set the width at which the menu turns into a mobile menu. Set to 0 to "
467
+ "disable responsive menu."
468
+ msgstr ""
469
+
470
+ #: ../classes/settings.class.php:867
471
+ msgid "Responsive Menu Text"
472
+ msgstr ""
473
+
474
+ #: ../classes/settings.class.php:869
475
+ msgid "Text to display next to the mobile toggle icon."
476
+ msgstr ""
477
+
478
+ #: ../classes/settings.class.php:876
479
+ msgid "Line Height"
480
+ msgstr ""
481
+
482
+ #: ../classes/settings.class.php:878
483
+ msgid "Set the general line height to use in the panel contents."
484
+ msgstr ""
485
+
486
+ #: ../classes/settings.class.php:885
487
+ msgid "Z-Index"
488
+ msgstr ""
489
+
490
+ #: ../classes/settings.class.php:887
491
+ msgid "Set the z-index to ensure the panels appear ontop of other content."
492
+ msgstr ""
493
+
494
+ #: ../classes/settings.class.php:894
495
+ msgid "Shadow"
496
+ msgstr ""
497
+
498
+ #: ../classes/settings.class.php:896
499
+ msgid "Apply a shadow to mega and flyout menus."
500
+ msgstr ""
501
+
502
+ #: ../classes/settings.class.php:901 ../classes/settings.class.php:935
503
+ #: ../classes/settings.class.php:1251 ../classes/settings.class.php:2081
504
+ msgid "Enabled"
505
+ msgstr ""
506
+
507
+ #: ../classes/settings.class.php:905
508
+ msgid "Horizonal"
509
+ msgstr ""
510
+
511
+ #: ../classes/settings.class.php:909
512
+ msgid "Vertical"
513
+ msgstr ""
514
+
515
+ #: ../classes/settings.class.php:913
516
+ msgid "Blur"
517
+ msgstr ""
518
+
519
+ #: ../classes/settings.class.php:917
520
+ msgid "Spread"
521
+ msgstr ""
522
+
523
+ #: ../classes/settings.class.php:921 ../classes/settings.class.php:1099
524
+ #: ../classes/settings.class.php:1133 ../classes/settings.class.php:1181
525
+ #: ../classes/settings.class.php:1211 ../classes/settings.class.php:1255
526
+ #: ../classes/settings.class.php:1344 ../classes/settings.class.php:1426
527
+ #: ../classes/settings.class.php:1460 ../classes/settings.class.php:1534
528
+ #: ../classes/settings.class.php:1570 ../classes/settings.class.php:1604
529
+ #: ../classes/settings.class.php:1696 ../classes/settings.class.php:1732
530
+ #: ../classes/settings.class.php:1766 ../classes/settings.class.php:1895
531
+ #: ../classes/settings.class.php:2025 ../classes/settings.class.php:2059
532
+ #: ../classes/settings.class.php:2085
533
+ msgid "Color"
534
+ msgstr ""
535
+
536
+ #: ../classes/settings.class.php:928
537
+ msgid "Hover Transitions"
538
+ msgstr ""
539
+
540
+ #: ../classes/settings.class.php:930
541
+ msgid ""
542
+ "Apply hover transitions to menu items. Note: Transitions will not apply to "
543
+ "gradient backgrounds."
544
+ msgstr ""
545
+
546
+ #: ../classes/settings.class.php:942
547
+ msgid "Menu Bar"
548
+ msgstr ""
549
+
550
+ #: ../classes/settings.class.php:947 ../classes/settings.class.php:1830
551
+ msgid "Menu Background"
552
+ msgstr ""
553
+
554
+ #: ../classes/settings.class.php:949
555
+ msgid ""
556
+ "The background color for the main menu bar. Set each value to transparent "
557
+ "for a 'button' style menu."
558
+ msgstr ""
559
+
560
+ #: ../classes/settings.class.php:954 ../classes/settings.class.php:1041
561
+ #: ../classes/settings.class.php:1059 ../classes/settings.class.php:1287
562
+ #: ../classes/settings.class.php:1626 ../classes/settings.class.php:1788
563
+ #: ../classes/settings.class.php:1837 ../classes/settings.class.php:1951
564
+ #: ../classes/settings.class.php:1969
565
+ msgid "From"
566
+ msgstr ""
567
+
568
+ #: ../classes/settings.class.php:958 ../classes/settings.class.php:1045
569
+ #: ../classes/settings.class.php:1063 ../classes/settings.class.php:1291
570
+ #: ../classes/settings.class.php:1630 ../classes/settings.class.php:1792
571
+ #: ../classes/settings.class.php:1841 ../classes/settings.class.php:1955
572
+ #: ../classes/settings.class.php:1973
573
+ msgid "To"
574
+ msgstr ""
575
+
576
+ #: ../classes/settings.class.php:965 ../classes/settings.class.php:1861
577
+ msgid "Menu Padding"
578
+ msgstr ""
579
+
580
+ #: ../classes/settings.class.php:967
581
+ msgid "Padding for the main menu bar."
582
+ msgstr ""
583
+
584
+ #: ../classes/settings.class.php:972 ../classes/settings.class.php:1155
585
+ #: ../classes/settings.class.php:1185 ../classes/settings.class.php:1318
586
+ #: ../classes/settings.class.php:1348 ../classes/settings.class.php:1400
587
+ #: ../classes/settings.class.php:1482 ../classes/settings.class.php:1508
588
+ #: ../classes/settings.class.php:1538 ../classes/settings.class.php:1644
589
+ #: ../classes/settings.class.php:1670 ../classes/settings.class.php:1700
590
+ #: ../classes/settings.class.php:1806 ../classes/settings.class.php:1868
591
+ #: ../classes/settings.class.php:1899 ../classes/settings.class.php:1998
592
+ msgid "Top"
593
+ msgstr ""
594
+
595
+ #: ../classes/settings.class.php:980 ../classes/settings.class.php:1163
596
+ #: ../classes/settings.class.php:1193 ../classes/settings.class.php:1326
597
+ #: ../classes/settings.class.php:1356 ../classes/settings.class.php:1408
598
+ #: ../classes/settings.class.php:1490 ../classes/settings.class.php:1516
599
+ #: ../classes/settings.class.php:1546 ../classes/settings.class.php:1652
600
+ #: ../classes/settings.class.php:1678 ../classes/settings.class.php:1708
601
+ #: ../classes/settings.class.php:1814 ../classes/settings.class.php:1876
602
+ #: ../classes/settings.class.php:1907 ../classes/settings.class.php:2006
603
+ msgid "Bottom"
604
+ msgstr ""
605
+
606
+ #: ../classes/settings.class.php:991 ../classes/settings.class.php:1918
607
+ msgid "Menu Border Radius"
608
+ msgstr ""
609
+
610
+ #: ../classes/settings.class.php:993
611
+ msgid "Set a border radius on the main menu bar."
612
+ msgstr ""
613
+
614
+ #: ../classes/settings.class.php:998 ../classes/settings.class.php:1225
615
+ #: ../classes/settings.class.php:1374 ../classes/settings.class.php:1925
616
+ msgid "Top Left"
617
+ msgstr ""
618
+
619
+ #: ../classes/settings.class.php:1002 ../classes/settings.class.php:1229
620
+ #: ../classes/settings.class.php:1378 ../classes/settings.class.php:1929
621
+ msgid "Top Right"
622
+ msgstr ""
623
+
624
+ #: ../classes/settings.class.php:1006 ../classes/settings.class.php:1233
625
+ #: ../classes/settings.class.php:1382 ../classes/settings.class.php:1933
626
+ msgid "Bottom Right"
627
+ msgstr ""
628
+
629
+ #: ../classes/settings.class.php:1010 ../classes/settings.class.php:1237
630
+ #: ../classes/settings.class.php:1386 ../classes/settings.class.php:1937
631
+ msgid "Bottom Left"
632
+ msgstr ""
633
+
634
+ #: ../classes/settings.class.php:1017
635
+ msgid "Menu Items Align"
636
+ msgstr ""
637
+
638
+ #: ../classes/settings.class.php:1019
639
+ msgid ""
640
+ "Align <i>all</i> menu items to the left (default), centrally or to the right."
641
+ msgstr ""
642
+
643
+ #: ../classes/settings.class.php:1024
644
+ msgid ""
645
+ "This option will apply to all menu items. To align an individual menu item "
646
+ "to the right, edit the menu item itself and set 'Menu Item Align' to 'Right'."
647
+ msgstr ""
648
+
649
+ #: ../classes/settings.class.php:1029
650
+ msgid "Top Level Menu Items"
651
+ msgstr ""
652
+
653
+ #: ../classes/settings.class.php:1034
654
+ msgid "Menu Item Background"
655
+ msgstr ""
656
+
657
+ #: ../classes/settings.class.php:1036
658
+ msgid ""
659
+ "The background color for each top level menu item. Tip: Set these values to "
660
+ "transparent if you've already set a background color on the menu bar."
661
+ msgstr ""
662
+
663
+ #: ../classes/settings.class.php:1052
664
+ msgid "Menu Item Background (Hover)"
665
+ msgstr ""
666
+
667
+ #: ../classes/settings.class.php:1054
668
+ msgid "The background color for a top level menu item (on hover)."
669
+ msgstr ""
670
+
671
+ #: ../classes/settings.class.php:1070
672
+ msgid "Menu Item Spacing"
673
+ msgstr ""
674
+
675
+ #: ../classes/settings.class.php:1072
676
+ msgid "Define the size of the gap between each top level menu item."
677
+ msgstr ""
678
+
679
+ #: ../classes/settings.class.php:1081
680
+ msgid "Menu Item Height"
681
+ msgstr ""
682
+
683
+ #: ../classes/settings.class.php:1083
684
+ msgid ""
685
+ "Define the height of each top level menu item. This value, plus the "
686
+ "container top and bottom padding values define the overall height of the "
687
+ "menu bar."
688
+ msgstr ""
689
+
690
+ #: ../classes/settings.class.php:1092 ../classes/settings.class.php:1563
691
+ #: ../classes/settings.class.php:1725
692
+ msgid "Font"
693
+ msgstr ""
694
+
695
+ #: ../classes/settings.class.php:1094
696
+ msgid "The font to use for each top level menu item."
697
+ msgstr ""
698
+
699
+ #: ../classes/settings.class.php:1103 ../classes/settings.class.php:1430
700
+ #: ../classes/settings.class.php:1464 ../classes/settings.class.php:1574
701
+ #: ../classes/settings.class.php:1736 ../classes/settings.class.php:2029
702
+ msgid "Size"
703
+ msgstr ""
704
+
705
+ #: ../classes/settings.class.php:1107 ../classes/settings.class.php:1434
706
+ #: ../classes/settings.class.php:1468 ../classes/settings.class.php:1578
707
+ #: ../classes/settings.class.php:1740 ../classes/settings.class.php:2033
708
+ msgid "Family"
709
+ msgstr ""
710
+
711
+ #: ../classes/settings.class.php:1111 ../classes/settings.class.php:1442
712
+ #: ../classes/settings.class.php:1586 ../classes/settings.class.php:1748
713
+ #: ../classes/settings.class.php:2037
714
+ msgid "Transform"
715
+ msgstr ""
716
+
717
+ #: ../classes/settings.class.php:1115 ../classes/settings.class.php:1137
718
+ #: ../classes/settings.class.php:1438 ../classes/settings.class.php:1582
719
+ #: ../classes/settings.class.php:1608 ../classes/settings.class.php:1744
720
+ #: ../classes/settings.class.php:1770 ../classes/settings.class.php:2041
721
+ #: ../classes/settings.class.php:2063
722
+ msgid "Weight"
723
+ msgstr ""
724
+
725
+ #: ../classes/settings.class.php:1119 ../classes/settings.class.php:1141
726
+ #: ../classes/settings.class.php:1446 ../classes/settings.class.php:1590
727
+ #: ../classes/settings.class.php:1612 ../classes/settings.class.php:1752
728
+ #: ../classes/settings.class.php:1774 ../classes/settings.class.php:2045
729
+ #: ../classes/settings.class.php:2067
730
+ msgid "Decoration"
731
+ msgstr ""
732
+
733
+ #: ../classes/settings.class.php:1126 ../classes/settings.class.php:1597
734
+ #: ../classes/settings.class.php:1759
735
+ msgid "Font (Hover)"
736
+ msgstr ""
737
+
738
+ #: ../classes/settings.class.php:1128
739
+ msgid "Set the font to use for each top level menu item (on hover)."
740
+ msgstr ""
741
+
742
+ #: ../classes/settings.class.php:1148
743
+ msgid "Menu Item Padding"
744
+ msgstr ""
745
+
746
+ #: ../classes/settings.class.php:1150
747
+ msgid "Set the padding for each top level menu item."
748
+ msgstr ""
749
+
750
+ #: ../classes/settings.class.php:1174
751
+ msgid "Menu Item Border"
752
+ msgstr ""
753
+
754
+ #: ../classes/settings.class.php:1176
755
+ msgid "Set the border to display on each top level menu item."
756
+ msgstr ""
757
+
758
+ #: ../classes/settings.class.php:1204
759
+ msgid "Menu Item Border (Hover)"
760
+ msgstr ""
761
+
762
+ #: ../classes/settings.class.php:1206
763
+ msgid "Set the hover border color."
764
+ msgstr ""
765
+
766
+ #: ../classes/settings.class.php:1218
767
+ msgid "Menu Item Border Radius"
768
+ msgstr ""
769
+
770
+ #: ../classes/settings.class.php:1220
771
+ msgid "Set rounded corners for each top level menu item."
772
+ msgstr ""
773
+
774
+ #: ../classes/settings.class.php:1244
775
+ msgid "Menu Item Divider"
776
+ msgstr ""
777
+
778
+ #: ../classes/settings.class.php:1246
779
+ msgid "Show a small divider bar between each menu item."
780
+ msgstr ""
781
+
782
+ #: ../classes/settings.class.php:1259
783
+ msgid "Glow Opacity"
784
+ msgstr ""
785
+
786
+ #: ../classes/settings.class.php:1266
787
+ msgid "Highlight Current Item"
788
+ msgstr ""
789
+
790
+ #: ../classes/settings.class.php:1268
791
+ msgid "Apply the 'hover' styling to current menu items."
792
+ msgstr ""
793
+
794
+ #: ../classes/settings.class.php:1275
795
+ msgid "Mega Panels"
796
+ msgstr ""
797
+
798
+ #: ../classes/settings.class.php:1280
799
+ msgid "Panel Background"
800
+ msgstr ""
801
+
802
+ #: ../classes/settings.class.php:1282
803
+ msgid "Set a background color for a whole panel."
804
+ msgstr ""
805
+
806
+ #: ../classes/settings.class.php:1298
807
+ msgid "Panel Width"
808
+ msgstr ""
809
+
810
+ #: ../classes/settings.class.php:1300
811
+ msgid "Mega Panel width"
812
+ msgstr ""
813
+
814
+ #: ../classes/settings.class.php:1305
815
+ msgid ""
816
+ "A 100% wide panel will only ever be as wide as the menu itself. For a fixed "
817
+ "panel width set this to a pixel value."
818
+ msgstr ""
819
+
820
+ #: ../classes/settings.class.php:1306
821
+ msgid ""
822
+ "Advanced: Enter a jQuery selector to synchronize the width and position of "
823
+ "the sub menu with existing page element (e.g. body, #container, .page)."
824
+ msgstr ""
825
+
826
+ #: ../classes/settings.class.php:1311
827
+ msgid "Panel Padding"
828
+ msgstr ""
829
+
830
+ #: ../classes/settings.class.php:1313
831
+ msgid ""
832
+ "Set the padding for the whole panel. Set these values 0px if you wish your "
833
+ "panel content to go edge-to-edge."
834
+ msgstr ""
835
+
836
+ #: ../classes/settings.class.php:1337
837
+ msgid "Panel Border"
838
+ msgstr ""
839
+
840
+ #: ../classes/settings.class.php:1339
841
+ msgid "Set the border to display on the Mega Panel."
842
+ msgstr ""
843
+
844
+ #: ../classes/settings.class.php:1367
845
+ msgid "Panel Border Radius"
846
+ msgstr ""
847
+
848
+ #: ../classes/settings.class.php:1369
849
+ msgid "Set rounded corners for the panel."
850
+ msgstr ""
851
+
852
+ #: ../classes/settings.class.php:1393
853
+ msgid "Widget Padding"
854
+ msgstr ""
855
+
856
+ #: ../classes/settings.class.php:1395
857
+ msgid ""
858
+ "Set the padding for each widget in the panel. Use this to define the spacing "
859
+ "between each widget in the panel."
860
+ msgstr ""
861
+
862
+ #: ../classes/settings.class.php:1419
863
+ msgid "Widget Heading Font"
864
+ msgstr ""
865
+
866
+ #: ../classes/settings.class.php:1421
867
+ msgid ""
868
+ "Set the font to use Widget headers in the mega menu. Tip: set this to the "
869
+ "same style as the Second Level Menu Item Header font to keep your styling "
870
+ "consistent."
871
+ msgstr ""
872
+
873
+ #: ../classes/settings.class.php:1453
874
+ msgid "Widget Content Font"
875
+ msgstr ""
876
+
877
+ #: ../classes/settings.class.php:1455
878
+ msgid "Set the font to use for panel contents."
879
+ msgstr ""
880
+
881
+ #: ../classes/settings.class.php:1475
882
+ msgid "Widget Heading Padding"
883
+ msgstr ""
884
+
885
+ #: ../classes/settings.class.php:1477
886
+ msgid "Set the padding for the widget headings."
887
+ msgstr ""
888
+
889
+ #: ../classes/settings.class.php:1501
890
+ msgid "Widget Heading Margin"
891
+ msgstr ""
892
+
893
+ #: ../classes/settings.class.php:1503
894
+ msgid "Set the margin for the widget headings."
895
+ msgstr ""
896
+
897
+ #: ../classes/settings.class.php:1527 ../classes/settings.class.php:1689
898
+ msgid "Border"
899
+ msgstr ""
900
+
901
+ #: ../classes/settings.class.php:1529
902
+ msgid "Set the border for the widget headings."
903
+ msgstr ""
904
+
905
+ #: ../classes/settings.class.php:1557
906
+ msgid "Second Level Menu Items"
907
+ msgstr ""
908
+
909
+ #: ../classes/settings.class.php:1565
910
+ msgid ""
911
+ "Set the font for second level menu items when they're displayed in a Mega "
912
+ "Menu."
913
+ msgstr ""
914
+
915
+ #: ../classes/settings.class.php:1599 ../classes/settings.class.php:1761
916
+ msgid "Set the font style on hover."
917
+ msgstr ""
918
+
919
+ #: ../classes/settings.class.php:1619 ../classes/settings.class.php:1781
920
+ msgid "Background (Hover)"
921
+ msgstr ""
922
+
923
+ #: ../classes/settings.class.php:1621
924
+ msgid "Set the background hover color for second level menu items."
925
+ msgstr ""
926
+
927
+ #: ../classes/settings.class.php:1637 ../classes/settings.class.php:1799
928
+ msgid "Padding"
929
+ msgstr ""
930
+
931
+ #: ../classes/settings.class.php:1639
932
+ msgid "Set the padding for the second level menu items."
933
+ msgstr ""
934
+
935
+ #: ../classes/settings.class.php:1663
936
+ msgid "Margin"
937
+ msgstr ""
938
+
939
+ #: ../classes/settings.class.php:1665
940
+ msgid "Set the margin for the second level menu items."
941
+ msgstr ""
942
+
943
+ #: ../classes/settings.class.php:1691
944
+ msgid "Set the border for the second level menu items."
945
+ msgstr ""
946
+
947
+ #: ../classes/settings.class.php:1719
948
+ msgid "Third Level Menu Items"
949
+ msgstr ""
950
+
951
+ #: ../classes/settings.class.php:1727
952
+ msgid ""
953
+ "Set the font for third level menu items when they're displayed in a Mega "
954
+ "Menu."
955
+ msgstr ""
956
+
957
+ #: ../classes/settings.class.php:1783
958
+ msgid "Set the background hover color for third level menu items."
959
+ msgstr ""
960
+
961
+ #: ../classes/settings.class.php:1801
962
+ msgid "Set the padding for the third level menu items."
963
+ msgstr ""
964
+
965
+ #: ../classes/settings.class.php:1825
966
+ msgid "Flyout Menus"
967
+ msgstr ""
968
+
969
+ #: ../classes/settings.class.php:1832
970
+ msgid "Set the background color for the flyout menu."
971
+ msgstr ""
972
+
973
+ #: ../classes/settings.class.php:1849
974
+ msgid "Menu Width"
975
+ msgstr ""
976
+
977
+ #: ../classes/settings.class.php:1851
978
+ msgid "The width of each flyout menu. This must be a fixed pixel value."
979
+ msgstr ""
980
+
981
+ #: ../classes/settings.class.php:1856
982
+ msgid ""
983
+ "Set this value to the width of your longest menu item title to stop menu "
984
+ "items wrapping onto 2 lines."
985
+ msgstr ""
986
+
987
+ #: ../classes/settings.class.php:1863
988
+ msgid "Set the padding for the whole flyout menu."
989
+ msgstr ""
990
+
991
+ #: ../classes/settings.class.php:1883
992
+ msgid ""
993
+ "Only suitable for single level flyout menus. If you're using multi level "
994
+ "flyout menus set these values to 0px."
995
+ msgstr ""
996
+
997
+ #: ../classes/settings.class.php:1888
998
+ msgid "Menu Border"
999
+ msgstr ""
1000
+
1001
+ #: ../classes/settings.class.php:1890
1002
+ msgid "Set the border for the flyout menu."
1003
+ msgstr ""
1004
+
1005
+ #: ../classes/settings.class.php:1920
1006
+ msgid ""
1007
+ "Set rounded corners for flyout menus. Rounded corners will be applied to all "
1008
+ "flyout menu levels."
1009
+ msgstr ""
1010
+
1011
+ #: ../classes/settings.class.php:1944
1012
+ msgid "Item Background"
1013
+ msgstr ""
1014
+
1015
+ #: ../classes/settings.class.php:1946
1016
+ msgid "Set the background color for a flyout menu item."
1017
+ msgstr ""
1018
+
1019
+ #: ../classes/settings.class.php:1962
1020
+ msgid "Item Ba