YITH WooCommerce Ajax Search - Version 1.7.9

Version Description

  • Released on 20 May 2020 =
  • New: Support for WooCommerce 4.2
  • Update: Plugin framework
Download this release

Release Info

Developer yithemes
Plugin Icon 128x128 YITH WooCommerce Ajax Search
Version 1.7.9
Comparing to
See all releases

Code changes from version 1.7.8 to 1.7.9

Files changed (159) hide show
  1. README.txt +5 -1
  2. assets/css/admin.css +0 -0
  3. assets/css/yith_wcas_ajax_search.css +0 -0
  4. assets/images/01.jpg +0 -0
  5. assets/images/02.png +0 -0
  6. assets/images/03.jpg +0 -0
  7. assets/images/ajax-loader.gif +0 -0
  8. assets/images/ajax-search-premium.jpg +0 -0
  9. assets/images/number-eight.png +0 -0
  10. assets/images/number-five.png +0 -0
  11. assets/images/number-fourth.png +0 -0
  12. assets/images/number-one.png +0 -0
  13. assets/images/number-seven.png +0 -0
  14. assets/images/number-six.png +0 -0
  15. assets/images/number-three.png +0 -0
  16. assets/images/number-two.png +0 -0
  17. assets/images/upgrade.png +0 -0
  18. assets/js/devbridge-jquery-autocomplete.js +0 -0
  19. assets/js/devbridge-jquery-autocomplete.min.js +0 -0
  20. assets/js/frontend.js +0 -0
  21. assets/js/frontend.min.js +0 -0
  22. assets/js/yith-autocomplete.js +0 -0
  23. assets/js/yith-autocomplete.min.js +0 -0
  24. class.yith-wcas-admin.php +204 -0
  25. class.yith-wcas-frontend.php +65 -0
  26. class.yith-wcas.php +227 -0
  27. compatibility/elementor/class.yith-wcas-elementor.php +85 -0
  28. compatibility/elementor/class.yith-wcas-search-form-elementor.php +115 -0
  29. functions.yith-wcas.php +23 -0
  30. init.php +3 -3
  31. languages/yith-woocommerce-ajax-search-it_IT.mo +0 -0
  32. languages/yith-woocommerce-ajax-search-it_IT.po +0 -0
  33. languages/yith-woocommerce-ajax-search-pt_PT.mo +0 -0
  34. languages/yith-woocommerce-ajax-search-pt_PT.po +0 -0
  35. languages/yith-woocommerce-ajax-search.pot +0 -0
  36. plugin-fw/.jshintrc +0 -0
  37. plugin-fw/Gruntfile.js +0 -0
  38. plugin-fw/assets/css/codemirror/codemirror.css +0 -0
  39. plugin-fw/assets/css/colorbox.css +0 -0
  40. plugin-fw/assets/css/metaboxes.css +0 -0
  41. plugin-fw/assets/css/yit-plugin-panel.css +0 -0
  42. plugin-fw/assets/css/yit-upgrade-to-pro.css +0 -0
  43. plugin-fw/assets/css/yit-upgrader.css +0 -0
  44. plugin-fw/assets/fonts/yith-icon.eot +0 -0
  45. plugin-fw/assets/fonts/yith-icon.svg +0 -0
  46. plugin-fw/assets/fonts/yith-icon.ttf +0 -0
  47. plugin-fw/assets/fonts/yith-icon.woff +0 -0
  48. plugin-fw/assets/images/arrow_down.svg +0 -0
  49. plugin-fw/assets/images/banner-premium.png +0 -0
  50. plugin-fw/assets/images/colorbox/border1.png +0 -0
  51. plugin-fw/assets/images/colorbox/border2.png +0 -0
  52. plugin-fw/assets/images/colorbox/loading.gif +0 -0
  53. plugin-fw/assets/images/double-sidebar.png +0 -0
  54. plugin-fw/assets/images/licence-error.png +0 -0
  55. plugin-fw/assets/images/no-sidebar.png +0 -0
  56. plugin-fw/assets/images/sidebar-left.png +0 -0
  57. plugin-fw/assets/images/sidebar-right.png +0 -0
  58. plugin-fw/assets/images/sleep.png +0 -0
  59. plugin-fw/assets/images/spinner.png +0 -0
  60. plugin-fw/assets/images/ui-icons_222222_256x240.png +0 -0
  61. plugin-fw/assets/images/ui-icons_2e83ff_256x240.png +0 -0
  62. plugin-fw/assets/images/ui-icons_454545_256x240.png +0 -0
  63. plugin-fw/assets/images/ui-icons_888888_256x240.png +0 -0
  64. plugin-fw/assets/images/x.png +0 -0
  65. plugin-fw/assets/images/yith-icon.svg +0 -0
  66. plugin-fw/assets/images/yithemes-icon.png +0 -0
  67. plugin-fw/assets/js/codemirror/codemirror.js +0 -0
  68. plugin-fw/assets/js/codemirror/javascript.js +0 -0
  69. plugin-fw/assets/js/how-to.js +0 -0
  70. plugin-fw/assets/js/javascript-md5/md5.min.js +0 -0
  71. plugin-fw/assets/js/jquery.colorbox.js +0 -0
  72. plugin-fw/assets/js/metabox.js +0 -0
  73. plugin-fw/assets/js/metabox.min.js +0 -0
  74. plugin-fw/assets/js/multisite-updater.js +0 -0
  75. plugin-fw/assets/js/multisite-updater.min.js +0 -0
  76. plugin-fw/assets/js/wp-pages.js +0 -0
  77. plugin-fw/assets/js/wp-pages.min.js +0 -0
  78. plugin-fw/assets/js/yit-cpt-unlimited.js +0 -0
  79. plugin-fw/assets/js/yit-cpt-unlimited.min.js +0 -0
  80. plugin-fw/assets/js/yit-plugin-panel.js +16 -4
  81. plugin-fw/assets/js/yit-plugin-panel.min.js +5 -1
  82. plugin-fw/assets/js/yit-wp-pointer.js +0 -0
  83. plugin-fw/assets/js/yit-wp-pointer.min.js +0 -0
  84. plugin-fw/assets/js/yith-colorpicker.min.js +1 -1
  85. plugin-fw/assets/js/yith-dashboard.js +0 -0
  86. plugin-fw/assets/js/yith-dashboard.min.js +0 -0
  87. plugin-fw/assets/js/yith-fields.js +727 -728
  88. plugin-fw/assets/js/yith-fields.min.js +30 -1
  89. plugin-fw/assets/js/yith-gutenberg.js +0 -0
  90. plugin-fw/assets/js/yith-gutenberg.min.js +0 -0
  91. plugin-fw/assets/js/yith-system-info.js +0 -0
  92. plugin-fw/assets/js/yith-system-info.min.js +0 -0
  93. plugin-fw/assets/js/yith-update-plugins.js +0 -0
  94. plugin-fw/assets/js/yith-update-plugins.min.js +0 -0
  95. plugin-fw/init.php +2 -2
  96. plugin-fw/languages/yith-plugin-fw-el.mo +0 -0
  97. plugin-fw/languages/yith-plugin-fw-el.po +0 -0
  98. plugin-fw/languages/yith-plugin-fw-es_ES.mo +0 -0
  99. plugin-fw/languages/yith-plugin-fw-es_ES.po +0 -0
  100. plugin-fw/languages/yith-plugin-fw-it_IT.mo +0 -0
  101. plugin-fw/languages/yith-plugin-fw-it_IT.po +0 -0
  102. plugin-fw/languages/yith-plugin-fw-nl_NL.mo +0 -0
  103. plugin-fw/languages/yith-plugin-fw-nl_NL.po +0 -0
  104. plugin-fw/languages/yith-plugin-fw.pot +0 -0
  105. plugin-fw/lib/promo/black.jpg +0 -0
  106. plugin-fw/lib/promo/cyber.jpg +0 -0
  107. plugin-fw/lib/promo/halloween.jpg +0 -0
  108. plugin-fw/lib/promo/yith-promo.php +0 -0
  109. plugin-fw/lib/promo/yith-promo.xml +0 -0
  110. plugin-fw/lib/yit-ajax.php +0 -0
  111. plugin-fw/lib/yit-cpt-unlimited.php +0 -0
  112. plugin-fw/lib/yit-metabox.php +0 -0
  113. plugin-fw/lib/yit-plugin-common.php +0 -0
  114. plugin-fw/lib/yit-plugin-gradients.php +0 -0
  115. plugin-fw/lib/yit-plugin-licence.php +0 -0
  116. plugin-fw/lib/yit-plugin-panel-wc.php +20 -19
  117. plugin-fw/lib/yit-plugin-panel.php +0 -0
  118. plugin-fw/lib/yit-plugin-subpanel.php +0 -0
  119. plugin-fw/lib/yit-pointers.php +0 -0
  120. plugin-fw/lib/yit-theme-licence.php +0 -0
  121. plugin-fw/lib/yit-upgrade.php +0 -0
  122. plugin-fw/lib/yit-video.php +0 -0
  123. plugin-fw/lib/yith-dashboard.php +0 -0
  124. plugin-fw/lib/yith-gutenberg.php +0 -0
  125. plugin-fw/lib/yith-system-status.php +0 -0
  126. plugin-fw/package.json +0 -0
  127. plugin-fw/templates/fields/ajax-customers.php +0 -0
  128. plugin-fw/templates/fields/checkbox-array.php +0 -0
  129. plugin-fw/templates/fields/country-select.php +0 -0
  130. plugin-fw/templates/fields/custom.php +0 -0
  131. plugin-fw/templates/fields/date-format.php +0 -0
  132. plugin-fw/templates/fields/list-table.php +0 -0
  133. plugin-fw/templates/fields/multi-colorpicker.php +0 -0
  134. plugin-fw/templates/fields/multi-select.php +0 -0
  135. plugin-fw/templates/fields/password.php +0 -0
  136. plugin-fw/templates/fields/select-images.php +3 -3
  137. plugin-fw/templates/fields/toggle-element-fixed.php +0 -0
  138. plugin-fw/templates/fields/toggle-element.php +0 -0
  139. plugin-fw/templates/metaboxes/tab.php +0 -0
  140. plugin-fw/templates/metaboxes/types/icon-list.php +0 -0
  141. plugin-fw/templates/panel/infobox.php +0 -0
  142. plugin-fw/templates/panel/sub-tabs-nav.php +0 -0
  143. plugin-fw/templates/panel/woocommerce/woocommerce-form.php +0 -0
  144. plugin-fw/templates/panel/woocommerce/woocommerce-panel.php +0 -0
  145. plugin-fw/templates/panel/woocommerce/woocommerce-upload.php +0 -0
  146. plugin-fw/templates/sysinfo/system-information-panel.php +0 -0
  147. plugin-fw/yit-deactive-plugin.php +0 -0
  148. plugin-fw/yit-functions.php +0 -0
  149. plugin-fw/yit-plugin-registration-hook.php +0 -0
  150. plugin-fw/yit-plugin.php +0 -0
  151. plugin-fw/yit-woocommerce-compatibility.php +0 -0
  152. plugin-options/gutenberg/blocks.php +0 -0
  153. plugin-options/premium-options.php +0 -0
  154. plugin-options/settings-options.php +0 -0
  155. templates/admin/premium.php +0 -0
  156. templates/yith-woocommerce-ajax-search.php +0 -0
  157. uninstall.php +0 -0
  158. widgets/class.yith-wcas-ajax-search.php +104 -0
  159. wpml-config.xml +0 -0
README.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: yithemes
4
  Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
5
  Requires at least: 4.0.0
6
  Tested up to: 5.4
7
- Stable tag: 1.7.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -138,6 +138,10 @@ If you have created your own language pack for YITH WooCommerce Ajax Search, or
138
  2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
139
 
140
  == Changelog ==
 
 
 
 
141
  = 1.7.8 - Released on 23 April 2020 =
142
  * Fix: Fixed issue with Elementor plugin
143
 
4
  Tags: woocommerce search by sku, woocommerce search results, woocommerce search shortcode, woocommerce search page, woocommerce search form, woocommerce search filter, woocommerce search products, woocommerce search content, woocommerce search autocomplete, woocommerce advanced search, woocommerce search category, woocommerce search product attributes, woocommerce search by tag, woocommerce search by brand, woocommerce predictive, woocommerce live search, woocommerce single product search, woocommerce site search, woocommerce search tex, tajax, search, woocommerce, products, themes, yit, e-commerce, shop, yith, ajax search, instant search, premium, yithemes, autocomplete, autosuggest, better search, category search, custom search, highlight terms, Live Search, Predictive Search, product search, relevant search, search highlight, search product, suggest, typeahead, WooCommerce Plugin, woocommerce product search, woocommerce search, wordpress ecommerce
5
  Requires at least: 4.0.0
6
  Tested up to: 5.4
7
+ Stable tag: 1.7.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
138
  2. YITH WooCommerce Ajax Search in operation displaying WooCommerce search results
139
 
140
  == Changelog ==
141
+ = 1.7.9 - Released on 20 May 2020 =
142
+ * New: Support for WooCommerce 4.2
143
+ * Update: Plugin framework
144
+
145
  = 1.7.8 - Released on 23 April 2020 =
146
  * Fix: Fixed issue with Elementor plugin
147
 
assets/css/admin.css CHANGED
File without changes
assets/css/yith_wcas_ajax_search.css CHANGED
File without changes
assets/images/01.jpg CHANGED
File without changes
assets/images/02.png CHANGED
File without changes
assets/images/03.jpg CHANGED
File without changes
assets/images/ajax-loader.gif CHANGED
File without changes
assets/images/ajax-search-premium.jpg CHANGED
File without changes
assets/images/number-eight.png CHANGED
File without changes
assets/images/number-five.png CHANGED
File without changes
assets/images/number-fourth.png CHANGED
File without changes
assets/images/number-one.png CHANGED
File without changes
assets/images/number-seven.png CHANGED
File without changes
assets/images/number-six.png CHANGED
File without changes
assets/images/number-three.png CHANGED
File without changes
assets/images/number-two.png CHANGED
File without changes
assets/images/upgrade.png CHANGED
File without changes
assets/js/devbridge-jquery-autocomplete.js CHANGED
File without changes
assets/js/devbridge-jquery-autocomplete.min.js CHANGED
File without changes
assets/js/frontend.js CHANGED
File without changes
assets/js/frontend.min.js CHANGED
File without changes
assets/js/yith-autocomplete.js CHANGED
File without changes
assets/js/yith-autocomplete.min.js CHANGED
File without changes
class.yith-wcas-admin.php ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Ajax Search
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAS' ) ) {
11
+ exit; } // Exit if accessed directly
12
+
13
+ if ( ! class_exists( 'YITH_WCAS_Admin' ) ) {
14
+ /**
15
+ * Admin class.
16
+ * The class manage all the admin behaviors.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCAS_Admin {
21
+ /**
22
+ * Plugin options
23
+ *
24
+ * @var array
25
+ * @access public
26
+ * @since 1.0.0
27
+ */
28
+ public $options = array();
29
+
30
+ /**
31
+ * Panel object
32
+ *
33
+ * @var Panel Object
34
+ */
35
+ protected $_panel;
36
+
37
+ /**
38
+ * Premium tab template file name.
39
+ *
40
+ * @var string
41
+ */
42
+ protected $_premium = 'premium.php';
43
+
44
+ /**
45
+ * Premium version landing link.
46
+ *
47
+ * @var string
48
+ */
49
+ protected $_premium_landing = 'https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/';
50
+
51
+ /**
52
+ * Ajax Search panel page.
53
+ *
54
+ * @var string
55
+ */
56
+ protected $_panel_page = 'yith_wcas_panel';
57
+
58
+
59
+ /**
60
+ * Constructor
61
+ *
62
+ * @access public
63
+ * @since 1.0.0
64
+ */
65
+ public function __construct() {
66
+
67
+ add_action( 'admin_menu', array( $this, 'register_panel' ), 5 );
68
+ add_action( 'init', array( $this, 'gutenberg_integration' ) );
69
+ // Add action links.
70
+ add_filter( 'plugin_action_links_' . plugin_basename( YITH_WCAS_DIR . '/' . basename( YITH_WCAS_FILE ) ), array( $this, 'action_links' ) );
71
+ add_filter( 'yith_show_plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 5 );
72
+
73
+ add_action( 'yith_ajax_search_premium', array( $this, 'premium_tab' ) );
74
+
75
+ // YITH WCAS Loaded.
76
+ do_action( 'yith_wcas_loaded' );
77
+ }
78
+
79
+
80
+ /**
81
+ * Gutenberg Integration
82
+ */
83
+ public function gutenberg_integration() {
84
+ if ( function_exists( 'yith_plugin_fw_gutenberg_add_blocks' ) ) {
85
+ $blocks = include_once YITH_WCAS_DIR . 'plugin-options/gutenberg/blocks.php';
86
+ yith_plugin_fw_gutenberg_add_blocks( $blocks );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Action Links
92
+ *
93
+ * Add the action links to plugin admin page
94
+ *
95
+ * @param string $links | links plugin array.
96
+ *
97
+ * @return mixed
98
+ * @since 1.0
99
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
100
+ * @use plugin_action_links_{$plugin_file_name}
101
+ */
102
+ public function action_links( $links ) {
103
+ $links = yith_add_action_links( $links, $this->_panel_page, false );
104
+ return $links;
105
+ }
106
+
107
+ /**
108
+ * Add a panel under YITH Plugins tab
109
+ *
110
+ * @return void
111
+ * @since 1.0
112
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
113
+ * @use /Yit_Plugin_Panel class
114
+ * @see plugin-fw/lib/yit-plugin-panel.php
115
+ */
116
+ public function register_panel() {
117
+
118
+ if ( ! empty( $this->_panel ) ) {
119
+ return;
120
+ }
121
+
122
+ $admin_tabs = array(
123
+ 'settings' => __( 'Settings', 'yith-woocommerce-ajax-search' ),
124
+ 'premium' => __( 'Premium Version', 'yith-woocommerce-ajax-search' ),
125
+ );
126
+
127
+ $args = array(
128
+ 'create_menu_page' => true,
129
+ 'parent_slug' => '',
130
+ 'plugin_slug' => YITH_WCAS_SLUG,
131
+ 'page_title' => __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
132
+ 'menu_title' => __( 'Ajax Search', 'yith-woocommerce-ajax-search' ),
133
+ 'capability' => 'manage_options',
134
+ 'parent' => '',
135
+ 'parent_page' => 'yith_plugin_panel',
136
+ 'page' => $this->_panel_page,
137
+ 'admin-tabs' => $admin_tabs,
138
+ 'class' => yith_set_wrapper_class(),
139
+ 'options-path' => YITH_WCAS_DIR . '/plugin-options',
140
+ );
141
+
142
+ /* === Fixed: not updated theme === */
143
+ if ( ! class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
144
+ require_once 'plugin-fw/lib/yit-plugin-panel-wc.php';
145
+ }
146
+
147
+ $this->_panel = new YIT_Plugin_Panel_WooCommerce( $args );
148
+ }
149
+
150
+ /**
151
+ * Premium Tab Template
152
+ *
153
+ * Load the premium tab template on admin page
154
+ *
155
+ * @return void
156
+ * @since 1.0
157
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
158
+ */
159
+ public function premium_tab() {
160
+ $premium_tab_template = YITH_WCAS_TEMPLATE_PATH . '/admin/' . $this->_premium;
161
+ if ( file_exists( $premium_tab_template ) ) {
162
+ include_once $premium_tab_template;
163
+ }
164
+
165
+ }
166
+
167
+ /**
168
+ * Add the action links to plugin admin page
169
+ *
170
+ * @param string $new_row_meta_args Plugin Meta New args.
171
+ * @param string $plugin_meta Plugin Meta.
172
+ * @param string $plugin_file Plugin file.
173
+ * @param array $plugin_data Plugin data.
174
+ * @param string $status Status.
175
+ * @param string $init_file Init file.
176
+ *
177
+ * @return array
178
+ * @since 1.0
179
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
180
+ * @use plugin_row_meta
181
+ */
182
+ public function plugin_row_meta( $new_row_meta_args, $plugin_meta, $plugin_file, $plugin_data, $status, $init_file = 'YITH_WCAS_FREE_INIT' ) {
183
+ if ( defined( $init_file ) && constant( $init_file ) === $plugin_file ) {
184
+ $new_row_meta_args['slug'] = YITH_WCAS_SLUG;
185
+ }
186
+
187
+ return $new_row_meta_args;
188
+ }
189
+
190
+
191
+
192
+ /**
193
+ * Get the premium landing uri
194
+ *
195
+ * @since 1.0.0
196
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
197
+ * @return string The premium landing link
198
+ */
199
+ public function get_premium_landing_uri() {
200
+ return $this->_premium_landing;
201
+ }
202
+
203
+ }
204
+ }
class.yith-wcas-frontend.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Frontend class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Ajax Search
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAS' ) ) {
11
+ exit; } // Exit if accessed directly
12
+
13
+ if ( ! class_exists( 'YITH_WCAS_Frontend' ) ) {
14
+ /**
15
+ * Admin class.
16
+ * The class manage all the Frontend behaviors.
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCAS_Frontend {
21
+
22
+ /**
23
+ * Constructor
24
+ *
25
+ * @access public
26
+ * @since 1.0.0
27
+ */
28
+ public function __construct( ) {
29
+
30
+ // custom styles and javascript.
31
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_scripts' ) );
32
+ }
33
+
34
+ /**
35
+ * Enqueue styles and scripts
36
+ *
37
+ * @access public
38
+ * @return void
39
+ * @since 1.0.0
40
+ */
41
+ public function enqueue_styles_scripts() {
42
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
43
+ wp_register_script( 'yith_autocomplete', YITH_WCAS_URL . 'assets/js/yith-autocomplete' . $suffix . '.js', array( 'jquery' ), '1.2.7', true );
44
+ wp_register_script( 'yith_wcas_jquery-autocomplete', YITH_WCAS_URL . 'assets/js/devbridge-jquery-autocomplete' . $suffix . '.js', array( 'jquery' ), '1.2.7', true );
45
+
46
+ wp_register_script( 'yith_wcas_frontend', YITH_WCAS_URL . 'assets/js/frontend' . $suffix . '.js', array( 'jquery' ), '1.0', true );
47
+
48
+ $css = file_exists( get_stylesheet_directory() . '/woocommerce/yith_ajax_search.css' ) ? get_stylesheet_directory_uri() . '/woocommerce/yith_ajax_search.css' : YITH_WCAS_URL . 'assets/css/yith_wcas_ajax_search.css';
49
+ wp_enqueue_style( 'yith_wcas_frontend', $css, array(), YITH_WCAS_VERSION );
50
+
51
+ wp_localize_script(
52
+ 'yith_wcas_frontend',
53
+ 'yith_wcas_params',
54
+ array(
55
+ 'loading' => YITH_WCAS_ASSETS_IMAGES_URL . 'ajax-loader.gif',
56
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
57
+
58
+ )
59
+ );
60
+
61
+ wp_enqueue_script( 'yith_autocomplete' );
62
+
63
+ }
64
+ }
65
+ }
class.yith-wcas.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Main class
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Ajax Search
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAS' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ if ( ! class_exists( 'YITH_WCAS' ) ) {
15
+ /**
16
+ * YITH WooCommerce Ajax Search
17
+ *
18
+ * @since 1.0.0
19
+ */
20
+ class YITH_WCAS {
21
+
22
+ /**
23
+ * Plugin object
24
+ *
25
+ * @var string
26
+ * @since 1.0.0
27
+ */
28
+ public $obj = null;
29
+
30
+ /**
31
+ * Constructor
32
+ *
33
+ * @return mixed|YITH_WCAS_Admin|YITH_WCAS_Frontend
34
+ * @since 1.0.0
35
+ */
36
+ public function __construct() {
37
+
38
+ $this->obj = false;
39
+
40
+ // Load Plugin Framework.
41
+ if ( ! isset( $_REQUEST['action'] ) || 'yith_ajax_search_products' !== $_REQUEST['action'] ) {
42
+ add_action( 'plugins_loaded', array( $this, 'plugin_fw_loader' ), 15 );
43
+
44
+ if ( is_admin() ) {
45
+ $this->obj = new YITH_WCAS_Admin();
46
+
47
+ } else {
48
+ $this->obj = new YITH_WCAS_Frontend();
49
+ }
50
+ } else {
51
+ if ( class_exists( 'YITH_JetPack' ) ) {
52
+ include_once YJP_DIR . 'plugin-fw/yit-woocommerce-compatibility.php';
53
+ } else {
54
+ include_once YITH_WCAS_DIR . 'plugin-fw/yit-woocommerce-compatibility.php';
55
+ }
56
+ }
57
+
58
+ // actions.
59
+ add_action( 'widgets_init', array( $this, 'registerWidgets' ) );
60
+
61
+ add_action( 'wp_ajax_yith_ajax_search_products', array( $this, 'ajax_search_products' ) );
62
+ add_action( 'wp_ajax_nopriv_yith_ajax_search_products', array( $this, 'ajax_search_products' ) );
63
+
64
+ // register shortcode.
65
+ add_shortcode( 'yith_woocommerce_ajax_search', array( $this, 'add_woo_ajax_search_shortcode' ) );
66
+
67
+ if ( defined('ELEMENTOR_VERSION') ) {
68
+ require_once( YITH_WCAS_DIR . 'compatibility/elementor/class.yith-wcas-elementor.php');
69
+ }
70
+
71
+ return $this->obj;
72
+ }
73
+
74
+
75
+ /**
76
+ * Load Plugin Framework
77
+ *
78
+ * @since 1.0
79
+ * @access public
80
+ * @return void
81
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
82
+ */
83
+ public function plugin_fw_loader() {
84
+ if ( ! defined( 'YIT_CORE_PLUGIN' ) ) {
85
+ global $plugin_fw_data;
86
+ if ( ! empty( $plugin_fw_data ) ) {
87
+ $plugin_fw_file = array_shift( $plugin_fw_data );
88
+ require_once $plugin_fw_file;
89
+ }
90
+ }
91
+ }
92
+
93
+
94
+
95
+ /**
96
+ * Load template for [yith_woocommerce_ajax_search] shortcode
97
+ *
98
+ * @access public
99
+ *
100
+ * @param array $args Array of arguments.
101
+ *
102
+ * @return mixed
103
+ * @since 1.0.0
104
+ */
105
+ public function add_woo_ajax_search_shortcode( $args = array() ) {
106
+ $args = shortcode_atts( array(), $args );
107
+ // for WC 3.6.0.
108
+ unset( $args['template'] );
109
+
110
+ ob_start();
111
+ $wc_get_template = function_exists( 'wc_get_template' ) ? 'wc_get_template' : 'woocommerce_get_template';
112
+ $wc_get_template( 'yith-woocommerce-ajax-search.php', $args, '', YITH_WCAS_DIR . 'templates/' );
113
+ return ob_get_clean();
114
+ }
115
+
116
+ /**
117
+ * Load and register widgets
118
+ *
119
+ * @access public
120
+ * @since 1.0.0
121
+ */
122
+ public function registerWidgets() {
123
+ register_widget( 'YITH_WCAS_Ajax_Search_Widget' );
124
+ }
125
+
126
+
127
+ /**
128
+ * Perform ajax search products
129
+ */
130
+ public function ajax_search_products() {
131
+ global $woocommerce;
132
+ $time_start = getmicrotime();
133
+ $transient_enabled = get_option( 'yith_wcas_enable_transient', 'no' );
134
+ $transient_duration = get_option( 'yith_wcas_transient_duration', 12 );
135
+
136
+ $search_keyword = sanitize_text_field( wp_unslash( $_REQUEST['query'] ) );
137
+
138
+ $ordering_args = $woocommerce->query->get_catalog_ordering_args( 'title', 'asc' );
139
+ $suggestions = array();
140
+
141
+ $transient_name = 'ywcas_' . $search_keyword;
142
+ $suggestions = get_transient( $transient_name );
143
+ if ( 'no' === $transient_enabled || false === $suggestions ) {
144
+ $args = array(
145
+ 's' => apply_filters( 'yith_wcas_ajax_search_products_search_query', $search_keyword ),
146
+ 'post_type' => 'product',
147
+ 'post_status' => 'publish',
148
+ 'ignore_sticky_posts' => 1,
149
+ 'orderby' => $ordering_args['orderby'],
150
+ 'order' => $ordering_args['order'],
151
+ 'posts_per_page' => apply_filters( 'yith_wcas_ajax_search_products_posts_per_page', get_option( 'yith_wcas_posts_per_page' ) ),
152
+ 'suppress_filters' => false,
153
+ );
154
+
155
+ if ( isset( $_REQUEST['product_cat'] ) ) {
156
+ $args['tax_query'] = array(
157
+ 'relation' => 'AND',
158
+ array(
159
+ 'taxonomy' => 'product_cat',
160
+ 'field' => 'slug',
161
+ 'terms' => sanitize_text_field( wp_unslash( $_REQUEST['product_cat'] ) ),
162
+ ),
163
+ );
164
+ }
165
+
166
+ if ( version_compare( WC()->version, '2.7.0', '<' ) ) {
167
+ $args['meta_query'] = array(
168
+ array(
169
+ 'key' => '_visibility',
170
+ 'value' => array( 'search', 'visible' ),
171
+ 'compare' => 'IN',
172
+ ),
173
+ );
174
+ } else {
175
+ $product_visibility_term_ids = wc_get_product_visibility_term_ids();
176
+ $args['tax_query'][] = array(
177
+ 'taxonomy' => 'product_visibility',
178
+ 'field' => 'term_taxonomy_id',
179
+ 'terms' => $product_visibility_term_ids['exclude-from-search'],
180
+ 'operator' => 'NOT IN',
181
+ );
182
+ }
183
+
184
+ $products = get_posts( $args );
185
+
186
+ if ( ! empty( $products ) ) {
187
+ foreach ( $products as $post ) {
188
+ $product = wc_get_product( $post );
189
+
190
+ $suggestions[] = apply_filters(
191
+ 'yith_wcas_suggestion',
192
+ array(
193
+ 'id' => $product->get_id(),
194
+ 'value' => wp_strip_all_tags( $product->get_title() ),
195
+ 'url' => $product->get_permalink(),
196
+ ),
197
+ $product
198
+ );
199
+ }
200
+ } else {
201
+ $suggestions[] = array(
202
+ 'id' => - 1,
203
+ 'value' => __( 'No results', 'yith-woocommerce-ajax-search' ),
204
+ 'url' => '',
205
+ );
206
+ }
207
+ wp_reset_postdata();
208
+
209
+ if ( 'yes' === $transient_enabled ) {
210
+ set_transient( $transient_name, $suggestions, $transient_duration * HOUR_IN_SECONDS );
211
+ }
212
+ }
213
+
214
+ $time_end = getmicrotime();
215
+ $time = $time_end - $time_start;
216
+ $suggestions = array(
217
+ 'suggestions' => $suggestions,
218
+ 'time' => $time,
219
+ );
220
+ echo wp_json_encode( $suggestions );
221
+ die();
222
+
223
+ }
224
+
225
+
226
+ }
227
+ }
compatibility/elementor/class.yith-wcas-elementor.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @package YITH WooCommerce Ajax Search Premium
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) || ! defined( 'YITH_WCAS_VERSION' ) ) {
14
+ exit; // Exit if accessed directly.
15
+ }
16
+
17
+ /**
18
+ * Implements the YITH_WCAS_Elementor class.
19
+ *
20
+ * @class YITH_WCAS_Elementor
21
+ * @package YITH
22
+ * @since 1.3.6
23
+ * @author YITH
24
+ */
25
+ if ( ! class_exists( 'YITH_WCAS_Elementor' ) ) {
26
+
27
+ /**
28
+ * Class YITH_WCAS_Elementor
29
+ */
30
+ class YITH_WCAS_Elementor {
31
+ /**
32
+ * Single instance of the class
33
+ *
34
+ * @var YITH_WCAS_Elementor
35
+ */
36
+
37
+ protected static $instance;
38
+
39
+ /**
40
+ * Returns single instance of the class
41
+ *
42
+ * @return YITH_WCAS_Elementor
43
+ */
44
+ public static function get_instance() {
45
+ if ( is_null( self::$instance ) ) {
46
+ self::$instance = new self();
47
+ }
48
+ return self::$instance;
49
+ }
50
+
51
+ /**
52
+ * YITH_WCAS_Elementor constructor.
53
+ */
54
+ public function __construct() {
55
+ if ( did_action( 'elementor/loaded' ) ) {
56
+ add_action( 'elementor/widgets/widgets_registered', array( $this, 'elementor_init_widgets' ) );
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Init widget
62
+ *
63
+ * @throws Exception To return Error.
64
+ */
65
+ public function elementor_init_widgets() {
66
+ // Include Widget files.
67
+ require_once YITH_WCAS_DIR . 'compatibility/elementor/class.yith-wcas-search-form-elementor.php';
68
+
69
+ // Register widget.
70
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \YITH_WCAS_Search_Form_Elementor_Widget() );
71
+ }
72
+ }
73
+
74
+ }
75
+
76
+ /**
77
+ * Unique access to instance of YITH_WCAS_Elementor class
78
+ *
79
+ * @return YITH_WCAS_Elementor
80
+ */
81
+ function YITH_WCAS_Elementor() {
82
+ return YITH_WCAS_Elementor::get_instance();
83
+ }
84
+
85
+ YITH_WCAS_Elementor();
compatibility/elementor/class.yith-wcas-search-form-elementor.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This file belongs to the YIT Plugin Framework.
4
+ *
5
+ * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://www.gnu.org/licenses/gpl-3.0.txt
9
+ *
10
+ * @package YITH WooCommerce Ajax Search Premium
11
+ */
12
+
13
+ if ( ! defined( 'ABSPATH' ) || ! defined( 'YITH_WCAS_VERSION' ) ) {
14
+ exit; // Exit if accessed directly.
15
+ }
16
+
17
+ use Elementor\Controls_Manager;
18
+
19
+ /**
20
+ * Class YITH_WCAS_Search_Form_Elementor_Widget
21
+ */
22
+ class YITH_WCAS_Search_Form_Elementor_Widget extends \Elementor\Widget_Base {
23
+
24
+
25
+ /**
26
+ * Return the name of widget.
27
+ *
28
+ * @return string
29
+ */
30
+ public function get_name() {
31
+ return 'yith-wcas-search-form';
32
+ }
33
+
34
+ /**
35
+ * Return the title.
36
+ *
37
+ * @return string|void
38
+ */
39
+ public function get_title() {
40
+ return __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' );
41
+ }
42
+
43
+ /**
44
+ * Return the icon.
45
+ *
46
+ * @return string
47
+ */
48
+ public function get_icon() {
49
+ return 'eicon-search';
50
+ }
51
+
52
+ /**
53
+ * Return the categories.
54
+ *
55
+ * @return array
56
+ */
57
+ public function get_categories() {
58
+ return array( 'yith', 'general' );
59
+ }
60
+
61
+ /**
62
+ * Return the keywords.
63
+ *
64
+ * @return array
65
+ */
66
+ public function get_keywords() {
67
+ return array( 'woocommerce', 'shop', 'store', 'search', 'ajax', 'yith' );
68
+ }
69
+
70
+ /**
71
+ * Register controls
72
+ */
73
+ protected function _register_controls() {
74
+ $this->start_controls_section(
75
+ 'section_button',
76
+ array(
77
+ 'label' => __( 'YITH WooCommerce Ajax Search', 'yith-woocommerce-ajax-search' ),
78
+ )
79
+ );
80
+
81
+ $this->add_control(
82
+ 'wc_style_warning',
83
+ array(
84
+ 'type' => Controls_Manager::RAW_HTML,
85
+ 'raw' => sprintf(
86
+ '%s [<a href="%s">%s</a>].',
87
+ __( 'This widget inherits the style from the settings of YITH WooCommerce Ajax Search plugin that you can edit', 'yith-woocommerce-ajax-search' ),
88
+ get_admin_url( null, 'admin.php?page=yith_wcas_panel&tab=output' ),
89
+ __( 'here', 'yith-woocommerce-ajax-search' )
90
+ ),
91
+ 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
92
+ )
93
+ );
94
+
95
+
96
+
97
+ $this->end_controls_section();
98
+
99
+ }
100
+
101
+ /**
102
+ * Render the form
103
+ */
104
+ protected function render() {
105
+
106
+ $settings = $this->get_settings_for_display();
107
+
108
+ $shortcode = do_shortcode( '[yith_woocommerce_ajax_search]' );
109
+ ?>
110
+ <div class="elementor-shortcode"><?php echo $shortcode; //phpcs:ignore ?></div>
111
+ <?php
112
+
113
+ }
114
+
115
+ }
functions.yith-wcas.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Ajax Search
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAS' ) ) {
11
+ exit;
12
+ } // Exit if accessed directly
13
+
14
+ /**
15
+ * Get microtime.
16
+ *
17
+ * @return float
18
+ */
19
+ function getmicrotime() {
20
+ list( $usec, $sec ) = explode( ' ', microtime() );
21
+
22
+ return ( (float) $usec + (float) $sec );
23
+ }
init.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: YITH WooCommerce Ajax Search
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
5
  * Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
- * Version: 1.7.8
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-search
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.0.0
12
- * WC tested up to: 4.1.0
13
  */
14
 
15
  /*
@@ -71,7 +71,7 @@ register_activation_hook( __FILE__, 'yith_plugin_registration_hook' );
71
  if ( defined( 'YITH_WCAS_VERSION' ) ) {
72
  return;
73
  } else {
74
- define( 'YITH_WCAS_VERSION', '1.7.8' );
75
  }
76
 
77
  if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
3
  * Plugin Name: YITH WooCommerce Ajax Search
4
  * Plugin URI: https://yithemes.com/themes/plugins/yith-woocommerce-ajax-search/
5
  * Description: <code><strong>YITH WooCommerce Ajax Search</strong></code> is the plugin that allows you to search for a specific product by inserting a few characters. Thanks to <strong>Ajax Search</strong>, users can quickly find the contents they are interested in without wasting time among site pages. <a href="https://yithemes.com/" target="_blank">Get more plugins for your e-commerce shop on <strong>YITH</strong></a>.
6
+ * Version: 1.7.9
7
  * Author: YITH
8
  * Author URI: https://yithemes.com/
9
  * Text Domain: yith-woocommerce-ajax-search
10
  * Domain Path: /languages/
11
  * WC requires at least: 3.0.0
12
+ * WC tested up to: 4.2.0
13
  */
14
 
15
  /*
71
  if ( defined( 'YITH_WCAS_VERSION' ) ) {
72
  return;
73
  } else {
74
+ define( 'YITH_WCAS_VERSION', '1.7.9' );
75
  }
76
 
77
  if ( ! defined( 'YITH_WCAS_FREE_INIT' ) ) {
languages/yith-woocommerce-ajax-search-it_IT.mo CHANGED
File without changes
languages/yith-woocommerce-ajax-search-it_IT.po CHANGED
File without changes
languages/yith-woocommerce-ajax-search-pt_PT.mo CHANGED
File without changes
languages/yith-woocommerce-ajax-search-pt_PT.po CHANGED
File without changes
languages/yith-woocommerce-ajax-search.pot CHANGED
File without changes
plugin-fw/.jshintrc CHANGED
File without changes
plugin-fw/Gruntfile.js CHANGED
File without changes
plugin-fw/assets/css/codemirror/codemirror.css CHANGED
File without changes
plugin-fw/assets/css/colorbox.css CHANGED
File without changes
plugin-fw/assets/css/metaboxes.css CHANGED
File without changes
plugin-fw/assets/css/yit-plugin-panel.css CHANGED
File without changes
plugin-fw/assets/css/yit-upgrade-to-pro.css CHANGED
File without changes
plugin-fw/assets/css/yit-upgrader.css CHANGED
File without changes
plugin-fw/assets/fonts/yith-icon.eot CHANGED
File without changes
plugin-fw/assets/fonts/yith-icon.svg CHANGED
File without changes
plugin-fw/assets/fonts/yith-icon.ttf CHANGED
File without changes
plugin-fw/assets/fonts/yith-icon.woff CHANGED
File without changes
plugin-fw/assets/images/arrow_down.svg CHANGED
File without changes
plugin-fw/assets/images/banner-premium.png CHANGED
File without changes
plugin-fw/assets/images/colorbox/border1.png CHANGED
File without changes
plugin-fw/assets/images/colorbox/border2.png CHANGED
File without changes
plugin-fw/assets/images/colorbox/loading.gif CHANGED
File without changes
plugin-fw/assets/images/double-sidebar.png CHANGED
File without changes
plugin-fw/assets/images/licence-error.png CHANGED
File without changes
plugin-fw/assets/images/no-sidebar.png CHANGED
File without changes
plugin-fw/assets/images/sidebar-left.png CHANGED
File without changes
plugin-fw/assets/images/sidebar-right.png CHANGED
File without changes
plugin-fw/assets/images/sleep.png CHANGED
File without changes
plugin-fw/assets/images/spinner.png CHANGED
File without changes
plugin-fw/assets/images/ui-icons_222222_256x240.png CHANGED
File without changes
plugin-fw/assets/images/ui-icons_2e83ff_256x240.png CHANGED
File without changes
plugin-fw/assets/images/ui-icons_454545_256x240.png CHANGED
File without changes
plugin-fw/assets/images/ui-icons_888888_256x240.png CHANGED
File without changes
plugin-fw/assets/images/x.png CHANGED
File without changes
plugin-fw/assets/images/yith-icon.svg CHANGED
File without changes
plugin-fw/assets/images/yithemes-icon.png CHANGED
File without changes
plugin-fw/assets/js/codemirror/codemirror.js CHANGED
File without changes
plugin-fw/assets/js/codemirror/javascript.js CHANGED
File without changes
plugin-fw/assets/js/how-to.js CHANGED
File without changes
plugin-fw/assets/js/javascript-md5/md5.min.js CHANGED
File without changes
plugin-fw/assets/js/jquery.colorbox.js CHANGED
File without changes
plugin-fw/assets/js/metabox.js CHANGED
File without changes
plugin-fw/assets/js/metabox.min.js CHANGED
File without changes
plugin-fw/assets/js/multisite-updater.js CHANGED
File without changes
plugin-fw/assets/js/multisite-updater.min.js CHANGED
File without changes
plugin-fw/assets/js/wp-pages.js CHANGED
File without changes
plugin-fw/assets/js/wp-pages.min.js CHANGED
File without changes
plugin-fw/assets/js/yit-cpt-unlimited.js CHANGED
File without changes
plugin-fw/assets/js/yit-cpt-unlimited.min.js CHANGED
File without changes
plugin-fw/assets/js/yit-plugin-panel.js CHANGED
@@ -15,13 +15,21 @@ jQuery( function ( $ ) {
15
  var field = '#' + t.data( 'dep-target' ),
16
  dep = '#' + t.data( 'dep-id' ),
17
  value = t.data( 'dep-value' ),
18
- type = t.data( 'dep-type' );
 
 
 
 
 
 
 
19
 
20
  dependencies_handler( field, dep, value.toString(), type );
21
 
22
- $( dep ).on( 'change', function () {
23
  dependencies_handler( field, dep, value.toString(), type );
24
- } ).change();
 
25
  } );
26
 
27
  //Handle dependencies.
@@ -44,6 +52,10 @@ jQuery( function ( $ ) {
44
  }
45
  }
46
 
 
 
 
 
47
  values = values.split( ',' );
48
 
49
  for ( var i = 0; i < values.length; i++ ) {
@@ -178,4 +190,4 @@ jQuery( function ( $ ) {
178
  wrap.prepend( notices );
179
  }
180
 
181
- } );
15
  var field = '#' + t.data( 'dep-target' ),
16
  dep = '#' + t.data( 'dep-id' ),
17
  value = t.data( 'dep-value' ),
18
+ type = t.data( 'dep-type' ),
19
+ event = 'change',
20
+ wrapper = $( dep + '-wrapper' ),
21
+ field_type = wrapper.data( 'type' );
22
+
23
+ if( field_type === 'select-images' ){
24
+ event = 'yith_select_images_value_changed';
25
+ }
26
 
27
  dependencies_handler( field, dep, value.toString(), type );
28
 
29
+ $( dep ).on( event, function () {
30
  dependencies_handler( field, dep, value.toString(), type );
31
+ } ).trigger( event );
32
+
33
  } );
34
 
35
  //Handle dependencies.
52
  }
53
  }
54
 
55
+ if( $( deps + '-wrapper' ).data( 'type' ) === 'select-images' ){
56
+ val = $( deps + '-wrapper' ).find( 'select' ).first().val();
57
+ }
58
+
59
  values = values.split( ',' );
60
 
61
  for ( var i = 0; i < values.length; i++ ) {
190
  wrap.prepend( notices );
191
  }
192
 
193
+ } );
plugin-fw/assets/js/yit-plugin-panel.min.js CHANGED
@@ -1 +1,5 @@
1
- jQuery(function(a){function e(e,t,i,n){var s=!0;if("string"==typeof t){":radio"==t.substr(0,6)&&(t+=":checked");var r=a(t).val();if("checkbox"==a(t).attr("type"))r=a(t).is(":checked")?"yes":"no";i=i.split(",");for(var d=0;d<i.length;d++){if(r==i[d]){s=!0;break}s=!1}}var c=a(e),o=a(e+"-container").closest("tr");o.length<1&&(o=c.closest(".yith-plugin-fw-panel-wc-row"));var l,h=n.split("-");for(l in h){var f=h[l];if(s)switch(f){case"disable":o.removeClass("yith-disabled"),c.attr("disabled",!1);break;case"hideme":c.show();break;case"fadeInOut":case"fadeIn":o.show(500);break;case"fadeOut":o.show();break;default:o.show(),o.fadeTo("slow",1).addClass("fade-in")}else switch(f){case"disable":o.addClass("yith-disabled"),c.attr("disabled",!0);break;case"hideme":c.hide();break;case"fadeInOut":case"fadeOut":o.hide(500);break;case"fadeIn":o.hide();break;default:o.hasClass("fade-in")?o.fadeTo("slow",0,function(){a(this).hide().removeClass("fade-in")}):(o.hide(),o.css({opacity:"0"}))}}}a("[data-dep-target]").each(function(){var t=a(this),i="#"+t.data("dep-target"),n="#"+t.data("dep-id"),s=t.data("dep-value"),r=t.data("dep-type");e(i,n,s.toString(),r),a(n).on("change",function(){e(i,n,s.toString(),r)}).change()}),a(".rm_connectedlist").each(function(){var e=a(this).find("ul"),t=a(this).find(":hidden");e.sortable({connectWith:e,update:function(i,n){var s={};e.each(function(){var e={};a(this).children().each(function(){e[a(this).data("option")]=a(this).text()}),s[a(this).data("list")]=e}),t.val(JSON.stringify(s).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()}),a(document).ready(function(){a(".google-analytic-generate").click(function(){var e=a("#"+a(this).data("textarea")).data("codemirrorInstance"),t="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n";t+="(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\n",t+="m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",t+="})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n",t+="ga('create', '"+a("#"+a(this).data("input")).val()+"', '"+a(this).data("basename")+"');\n",t+="ga('send', 'pageview');\n",e.replaceRange(t,e.getCursor("start"),e.getCursor("end"))})}),a(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var t=a(".wrap.yith-plugin-ui").first(),i=a("div.updated, div.error, div.notice");i.addClass("inline"),t.length&&t.prepend(i)});
 
 
 
 
1
+ jQuery(function(b){function h(a,c,d,f){var e=!0;if("string"==typeof c){":radio"==c.substr(0,6)&&(c+=":checked");var g=b(c).val();"checkbox"==b(c).attr("type")&&(g=b(c).is(":checked")?"yes":"no");"select-images"===b(c+"-wrapper").data("type")&&(g=b(c+"-wrapper").find("select").first().val());d=d.split(",");for(c=0;c<d.length;c++)if(g!=d[c])e=!1;else{e=!0;break}}d=b(a);a=b(a+"-container").closest("tr");1>a.length&&(a=d.closest(".yith-plugin-fw-panel-wc-row"));f=f.split("-");for(var h in f)if(g=f[h],
2
+ e)switch(g){case "disable":a.removeClass("yith-disabled");d.attr("disabled",!1);break;case "hideme":d.show();break;case "fadeInOut":case "fadeIn":a.show(500);break;case "fadeOut":a.show();break;default:a.show(),a.fadeTo("slow",1).addClass("fade-in")}else switch(g){case "disable":a.addClass("yith-disabled");d.attr("disabled",!0);break;case "hideme":d.hide();break;case "fadeInOut":case "fadeOut":a.hide(500);break;case "fadeIn":a.hide();break;default:a.hasClass("fade-in")?a.fadeTo("slow",0,function(){b(this).hide().removeClass("fade-in")}):
3
+ (a.hide(),a.css({opacity:"0"}))}}b("[data-dep-target]").each(function(){var a=b(this),c="#"+a.data("dep-target"),d="#"+a.data("dep-id"),f=a.data("dep-value"),e=a.data("dep-type");a="change";"select-images"===b(d+"-wrapper").data("type")&&(a="yith_select_images_value_changed");h(c,d,f.toString(),e);b(d).on(a,function(){h(c,d,f.toString(),e)}).trigger(a)});b(".rm_connectedlist").each(function(){var a=b(this).find("ul"),c=b(this).find(":hidden");a.sortable({connectWith:a,update:function(d,f){var e={};
4
+ a.each(function(){var a={};b(this).children().each(function(){a[b(this).data("option")]=b(this).text()});e[b(this).data("list")]=a});c.val(JSON.stringify(e).replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0"))}}).disableSelection()});b(document).ready(function(){b(".google-analytic-generate").click(function(){var a=b("#"+b(this).data("textarea")).data("codemirrorInstance"),c=b("#"+b(this).data("input")).val(),d=b(this).data("basename");a.replaceRange("(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement( o ),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\nga('create', '"+
5
+ (c+"', '"+d+"');\nga('send', 'pageview');\n"),a.getCursor("start"),a.getCursor("end"))})});b(".yith-plugin-fw-panel .woo-nav-tab-wrapper").removeClass("woo-nav-tab-wrapper").addClass("yith-nav-tab-wrapper");var k=b(".wrap.yith-plugin-ui").first(),l=b("div.updated, div.error, div.notice");l.addClass("inline");k.length&&k.prepend(l)});
plugin-fw/assets/js/yit-wp-pointer.js CHANGED
File without changes
plugin-fw/assets/js/yit-wp-pointer.min.js CHANGED
File without changes
plugin-fw/assets/js/yith-colorpicker.min.js CHANGED
@@ -8,4 +8,4 @@
8
  * https://github.com/kallookoo/wp-color-picker-alpha
9
  * Licensed under the GPLv2 license or later.
10
  */
11
- !function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",r='<div class="wp-picker-holder" />',e='<div class="wp-picker-container" />',a='<input type="button" class="button button-small" />',i=void 0!==wpColorPickerL10n.current;if(i)var n='<a tabindex="0" class="wp-color-result" />';else{n='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';var l="<label></label>",s='<span class="screen-reader-text"></span>'}Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var p=this,c=p.element;if(t.extend(p.options,c.data()),"hue"===p.options.type)return p._createHueOnly();p.close=t.proxy(p.close,p),p.initialValue=c.val(),c.addClass("wp-color-picker"),i?(c.hide().wrap(e),p.wrap=c.parent(),p.toggler=t(n).insertBefore(c).css({backgroundColor:p.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),p.pickerContainer=t(r).insertAfter(c),p.button=t(a).addClass("hidden")):(c.parent("label").length||(c.wrap(l),p.wrappingLabelText=t(s).insertBefore(c).text(wpColorPickerL10n.defaultLabel)),p.wrappingLabel=c.parent(),p.wrappingLabel.wrap(e),p.wrap=p.wrappingLabel.parent(),p.toggler=t(n).insertBefore(p.wrappingLabel).css({backgroundColor:p.initialValue}),p.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),p.pickerContainer=t(r).insertAfter(p.wrappingLabel),p.button=t(a)),p.options.defaultColor?(p.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),i||p.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(p.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),i||p.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),i?c.wrap('<span class="wp-picker-input-wrap" />').after(p.button):(p.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(p.button),p.inputWrapper=c.closest(".wp-picker-input-wrap")),c.iris({target:p.pickerContainer,hide:p.options.hide,width:p.options.width,mode:p.options.mode,palettes:p.options.palettes,change:function(r,e){p.options.alpha?(p.toggler.css({"background-image":"url("+o+")"}),i?p.toggler.html('<span class="color-alpha" />'):(p.toggler.css({position:"relative"}),0==p.toggler.find("span.color-alpha").length&&p.toggler.append('<span class="color-alpha" />')),p.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:e.color.toString()})):p.toggler.css({backgroundColor:e.color.toString()}),t.isFunction(p.options.change)&&p.options.change.call(this,r,e)}}),c.val(p.initialValue),p._addListeners(),p.options.hide||p.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(r){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r))}),o.button.on("click",function(r){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?(i&&o.toggler.removeAttr("style"),o.toggler.find("span.color-alpha").css("backgroundColor","")):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,r),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,r=o.element,e=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),a={aContainer:e,aSlider:e.find(".iris-slider-offset-alpha")};void 0!==r.data("custom-width")?o.options.customWidth=parseInt(r.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=r.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&r.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(a,function(t,r){o.controls[t]=r}),o.controls.square.css({"margin-right":"0"});var i=o.picker.width()-o.controls.square.width()-20,n=i/6,l=i/2-n;t.each(["aContainer","strip"],function(t,r){o.controls[r].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,r){t._color._alpha=parseFloat(r.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,r=t.element;if(this.options.alpha){var e=t.controls,a=parseInt(100*t._color._alpha),i=t._color.toRgb(),n=["rgb("+i.r+","+i.g+","+i.b+") 0%","rgba("+i.r+","+i.g+","+i.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");e.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(e.aSlider.slider("value",a),t._color._alpha<1?(e.strip.attr("style",e.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),r.width(parseInt(l+s))):r.width(l))}(r.data("reset-alpha")||!1)&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),r.trigger("change")},_addInputListeners:function(t){var o=this,r=function(r){var e=new Color(t.val()),a=t.val();t.removeClass("iris-error"),e.error?""!==a&&t.addClass("iris-error"):e.toString()!==o._color.toString()&&("keyup"===r.type&&a.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",e.toString()))};t.on("change",r).on("keyup",o._debounce(r,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
8
  * https://github.com/kallookoo/wp-color-picker-alpha
9
  * Licensed under the GPLv2 license or later.
10
  */
11
+ !function(t){if(!t.wp.wpColorPicker.prototype._hasAlpha){var o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==",i='<div class="wp-picker-holder" />',a='<div class="wp-picker-container" />',e='<input type="button" class="button button-small" />',r='<button type="button" class="button wp-color-result" aria-expanded="false"><span class="wp-color-result-text"></span></button>';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var t=parseInt(this._color,10).toString(16);return this.error?"":(t.length<6&&(t=("00000"+t).substr(-6)),"#"+t)},t.widget("wp.wpColorPicker",t.wp.wpColorPicker,{_hasAlpha:!0,_create:function(){if(t.support.iris){var n=this,l=n.element;if(t.extend(n.options,l.data()),"hue"===n.options.type)return n._createHueOnly();n.close=t.proxy(n.close,n),n.initialValue=l.val(),l.addClass("wp-color-picker"),l.parent("label").length||(l.wrap("<label></label>"),n.wrappingLabelText=t('<span class="screen-reader-text"></span>').insertBefore(l).text(wpColorPickerL10n.defaultLabel)),n.wrappingLabel=l.parent(),n.wrappingLabel.wrap(a),n.wrap=n.wrappingLabel.parent(),n.toggler=t(r).insertBefore(n.wrappingLabel).css({backgroundColor:n.initialValue}),n.toggler.find(".wp-color-result-text").text(wpColorPickerL10n.pick),n.pickerContainer=t(i).insertAfter(n.wrappingLabel),n.button=t(e),n.options.defaultColor?(n.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString),n.button.attr("aria-label",wpColorPickerL10n.defaultAriaLabel)):(n.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),n.button.attr("aria-label",wpColorPickerL10n.clearAriaLabel)),n.wrappingLabel.wrap('<span class="wp-picker-input-wrap hidden" />').after(n.button),n.inputWrapper=l.closest(".wp-picker-input-wrap"),l.iris({target:n.pickerContainer,hide:n.options.hide,width:n.options.width,mode:n.options.mode,palettes:n.options.palettes,change:function(i,a){n.options.alpha?(n.toggler.css({"background-image":"url("+o+")"}),n.toggler.css({position:"relative"}),0==n.toggler.find("span.color-alpha").length&&n.toggler.append('<span class="color-alpha" />'),n.toggler.find("span.color-alpha").css({width:"30px",height:"24px",position:"absolute",top:0,left:0,"border-top-left-radius":"2px","border-bottom-left-radius":"2px",background:a.color.toString()})):n.toggler.css({backgroundColor:a.color.toString()}),t.isFunction(n.options.change)&&n.options.change.call(this,i,a)}}),l.val(n.initialValue),n._addListeners(),n.options.hide||n.toggler.click()}},_addListeners:function(){var o=this;o.wrap.on("click.wpcolorpicker",function(t){t.stopPropagation()}),o.toggler.click(function(){o.toggler.hasClass("wp-picker-open")?o.close():o.open()}),o.element.on("change",function(i){(""===t(this).val()||o.element.hasClass("iris-error"))&&(o.options.alpha?o.toggler.find("span.color-alpha").css("backgroundColor",""):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,i))}),o.button.on("click",function(i){t(this).hasClass("wp-picker-clear")?(o.element.val(""),o.options.alpha?o.toggler.find("span.color-alpha").css("backgroundColor",""):o.toggler.css("backgroundColor",""),t.isFunction(o.options.clear)&&o.options.clear.call(this,i),o.element.trigger("change")):t(this).hasClass("wp-picker-default")&&o.element.val(o.options.defaultColor).change()})}}),t.widget("a8c.iris",t.a8c.iris,{_create:function(){if(this._super(),this.options.alpha=this.element.data("alpha")||!1,this.element.is(":input")||(this.options.alpha=!1),void 0!==this.options.alpha&&this.options.alpha){var o=this,i=o.element,a=t('<div class="iris-strip iris-slider iris-alpha-slider"><div class="iris-slider-offset iris-slider-offset-alpha"></div></div>').appendTo(o.picker.find(".iris-picker-inner")),e={aContainer:a,aSlider:a.find(".iris-slider-offset-alpha")};void 0!==i.data("custom-width")?o.options.customWidth=parseInt(i.data("custom-width"))||0:o.options.customWidth=100,o.options.defaultWidth=i.width(),(o._color._alpha<1||-1!=o._color.toString().indexOf("rgb"))&&i.width(parseInt(o.options.defaultWidth+o.options.customWidth)),t.each(e,function(t,i){o.controls[t]=i}),o.controls.square.css({"margin-right":"0"});var r=o.picker.width()-o.controls.square.width()-20,n=r/6,l=r/2-n;t.each(["aContainer","strip"],function(t,i){o.controls[i].width(l).css({"margin-left":n+"px"})}),o._initControls(),o._change()}},_initControls:function(){if(this._super(),this.options.alpha){var t=this;t.controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,i){t._color._alpha=parseFloat(i.value/100),t._change.apply(t,arguments)}})}},_change:function(){this._super();var t=this,i=t.element;if(this.options.alpha){var a=t.controls,e=parseInt(100*t._color._alpha),r=t._color.toRgb(),n=["rgb("+r.r+","+r.g+","+r.b+") 0%","rgba("+r.r+","+r.g+","+r.b+", 0) 100%"],l=t.options.defaultWidth,s=t.options.customWidth,p=t.picker.closest(".wp-picker-container").find(".wp-color-result");a.aContainer.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+o+")"}),p.hasClass("wp-picker-open")&&(a.aSlider.slider("value",e),t._color._alpha<1?(a.strip.attr("style",a.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)")),i.width(parseInt(l+s))):i.width(l))}!!i.data("reset-alpha")&&t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){t._color._alpha=1,t.active="external",t._change()}),i.trigger("change")},_addInputListeners:function(t){var o=this,i=function(i){var a=new Color(t.val()),e=t.val();t.removeClass("iris-error"),a.error?""!==e&&t.addClass("iris-error"):a.toString()!==o._color.toString()&&("keyup"===i.type&&e.match(/^[0-9a-fA-F]{3}$/)||o._setOption("color",a.toString()))};t.on("change",i).on("keyup",o._debounce(i,100)),o.options.hide&&t.on("focus",function(){o.show()})}})}}(jQuery),jQuery(document).ready(function(t){t(".color-picker").wpColorPicker()});
plugin-fw/assets/js/yith-dashboard.js CHANGED
File without changes
plugin-fw/assets/js/yith-dashboard.min.js CHANGED
File without changes
plugin-fw/assets/js/yith-fields.js CHANGED
@@ -1,734 +1,733 @@
1
  ( function ( $ ) {
2
 
3
- /* global yith_framework_fw_fields*/
4
-
5
- var yith_fields_init = function () {
6
- var $datepicker = $( '.yith-plugin-fw-datepicker' ),
7
- $colorpicker = $( '.yith-plugin-fw-colorpicker' ),
8
- $upload = {
9
- imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
10
- uploadButtonHandler: '.yith-plugin-fw-upload-button',
11
- imgUrlHandler : '.yith-plugin-fw-upload-img-url',
12
- resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
13
- imgUrl : $( '.yith-plugin-fw-upload-img-url' )
14
- },
15
- $wpAddMedia = $( '.add_media' ),
16
- $imageGallery = {
17
- sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
18
- buttonHandler: '.yith-plugin-fw .image-gallery-button'
19
- },
20
- $sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
21
- $slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
22
- $codemirror = $( '.codemirror' ),
23
- $icons = $( '.yit-icons-manager-wrapper' ),
24
- $checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
25
-
26
- /* Datepicker */
27
- $datepicker.each( function () {
28
- var args = $( this ).data();
29
-
30
- // set animation to false to prevent style 'glitches' when removing class on closing
31
- args.showAnim = false;
32
- args.beforeShow = function ( input, instance ) {
33
- instance.dpDiv.addClass( 'yith-plugin-fw-datepicker-div' );
34
- };
35
- args.onClose = function ( selectedDate, instance ) {
36
- instance.dpDiv.removeClass( 'yith-plugin-fw-datepicker-div' );
37
- };
38
-
39
- $( this ).datepicker( args );
40
- } );
41
-
42
- /* Colorpicker */
43
- $colorpicker.wpColorPicker( {
44
- palettes: false,
45
- width : 200,
46
- mode : 'hsl',
47
- clear : function () {
48
- var input = $( this );
49
- input.val( input.data( 'default-color' ) );
50
- input.change();
51
- }
52
- } );
53
-
54
-
55
- $colorpicker.each( function () {
56
- var select_label = $( this ).data( 'variations-label' ),
57
- wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
58
- wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
59
- wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
60
- wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
61
-
62
- wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
63
- wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
64
-
65
- if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
66
- var button = $( '<span/>' ).attr( {
67
- class: "wp-picker-default-custom"
68
- } );
69
- wrap1.find( '.wp-picker-default' ).wrap( button );
70
- }
71
-
72
- if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
73
- var button = $( '<span/>' ).attr( {
74
- class: "wp-picker-default-custom"
75
- } );
76
- wrap2.find( '.wp-picker-default' ).wrap( button );
77
- }
78
- } );
79
-
80
-
81
- /* Upload */
82
- if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
83
- var _custom_media = true;
84
- // preview
85
- $upload.imgUrl.change( function () {
86
- var url = $( this ).val(),
87
  re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
88
- preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
89
-
90
- if ( preview.length < 1 ) {
91
- preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
92
- }
93
-
94
- if ( re.test( url ) ) {
95
- preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
96
- } else {
97
- preview.html( '' );
98
- }
99
- } ).trigger( 'change' );
100
-
101
- $( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
102
- e.preventDefault();
103
-
104
- var t = $( this ),
105
- custom_uploader,
106
- id = t.attr( 'id' ).replace( /-button$/, '' );
107
-
108
- //If the uploader object has already been created, reopen the dialog
109
- if ( custom_uploader ) {
110
- custom_uploader.open();
111
- return;
112
- }
113
-
114
- var custom_uploader_states = [
115
- // Main states.
116
- new wp.media.controller.Library( {
117
- library : wp.media.query(),
118
- multiple : false,
119
- title : 'Choose Image',
120
- priority : 20,
121
- filterable: 'uploaded'
122
- } )
123
- ];
124
-
125
- // Create the media frame.
126
- custom_uploader = wp.media.frames.downloadable_file = wp.media( {
127
- // Set the title of the modal.
128
- title : 'Choose Image',
129
- library : {
130
- type: ''
131
- },
132
- button : {
133
- text: 'Choose Image'
134
- },
135
- multiple: false,
136
- states : custom_uploader_states
137
- } );
138
-
139
- //When a file is selected, grab the URL and set it as the text field's value
140
- custom_uploader.on( 'select', function () {
141
- var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
142
-
143
- $( "#" + id ).val( attachment.url );
144
- // Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
145
- if ( $( "#" + id + "-yith-attachment-id" ) ) {
146
- $( "#" + id + "-yith-attachment-id" ).val( attachment.id );
147
- }
148
- $upload.imgUrl.trigger( 'change' );
149
- } );
150
-
151
- //Open the uploader dialog
152
- custom_uploader.open();
153
- } );
154
-
155
- $( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
156
- var t = $( this ),
157
- id = t.attr( 'id' ),
158
- input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
159
- default_value = $( '#' + id ).data( 'default' );
160
-
161
- $( "#" + input_id ).val( default_value );
162
- $upload.imgUrl.trigger( 'change' );
163
- } );
164
- }
165
-
166
- $wpAddMedia.on( 'click', function () {
167
- _custom_media = false;
168
- } );
169
-
170
- /* Image Gallery */
171
- if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
172
- $( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
173
- var $t = $( this ),
174
- $container = $t.closest( '.image-gallery' ),
175
- $image_gallery_ids = $container.find( '.image_gallery_ids' ),
176
- attachment_ids = $image_gallery_ids.val(),
177
- $gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
178
-
179
- // Create the media frame.
180
- var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
181
- // Set the title of the modal.
182
- title : $t.data( 'choose' ),
183
- button: {
184
- text: $t.data( 'update' )
185
- },
186
- states: [
187
- new wp.media.controller.Library( {
188
- title : $t.data( 'choose' ),
189
- filterable: 'all',
190
- multiple : true
191
- } )
192
- ]
193
- } );
194
-
195
- // When an image is selected, run a callback.
196
- image_gallery_frame.on( 'select', function () {
197
- var selection = image_gallery_frame.state().get( 'selection' );
198
- selection.map( function ( attachment ) {
199
- attachment = attachment.toJSON();
200
-
201
- if ( attachment.id ) {
202
- attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
203
- $gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
204
- }
205
- } );
206
-
207
- $image_gallery_ids.val( attachment_ids );
208
- } );
209
-
210
- image_gallery_frame.open();
211
-
212
- } );
213
-
214
- // Image ordering
215
- $imageGallery.sliderWrapper.each( function () {
216
- var $t = $( this );
217
- $t.sortable( {
218
- items : 'li.image',
219
- cursor : 'move',
220
- scrollSensitivity : 40,
221
- forcePlaceholderSize: true,
222
- forceHelperSize : false,
223
- helper : 'clone',
224
- opacity : 0.65,
225
- start : function ( event, ui ) {
226
- ui.item.css( 'background-color', '#f6f6f6' );
227
- },
228
- stop : function ( event, ui ) {
229
- ui.item.removeAttr( 'style' );
230
- },
231
- update : function ( event, ui ) {
232
- var attachment_ids = '';
233
-
234
- $t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
235
- var attachment_id = $( this ).attr( 'data-attachment_id' );
236
- attachment_ids = attachment_ids + attachment_id + ',';
237
- } );
238
-
239
- $t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
240
- }
241
- } );
242
- } );
243
-
244
- // Remove images
245
- $imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
246
- var $wrapper = $( this ).closest( '.image-gallery' ),
247
- $gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
248
- $image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
249
- attachment_ids = '';
250
-
251
- $( this ).closest( 'li.image' ).remove();
252
-
253
- $gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
254
- var attachment_id = $( this ).attr( 'data-attachment_id' );
255
- attachment_ids = attachment_ids + attachment_id + ',';
256
- } );
257
-
258
- $image_gallery_ids.val( attachment_ids );
259
- } );
260
- }
261
-
262
-
263
- /* Sidebars */
264
- $sidebars.each( function () {
265
- var $images = $( this ).find( 'img' );
266
- $images.on( 'click', function () {
267
- var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
268
- $left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
269
- $right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
270
- type = $( this ).data( 'type' );
271
-
272
- $( this ).parent().children( ':radio' ).attr( 'checked', false );
273
- $( this ).prev( ':radio' ).attr( 'checked', true );
274
-
275
- if ( typeof type != 'undefined' ) {
276
- switch ( type ) {
277
- case 'left':
278
- $left.show();
279
- $right.hide();
280
- break;
281
- case 'right':
282
- $right.show();
283
- $left.hide();
284
- break;
285
- case 'double':
286
- $left.show();
287
- $right.show();
288
- break;
289
- default:
290
- $left.hide();
291
- $right.hide();
292
- break;
293
- }
294
- }
295
- } );
296
- } );
297
-
298
- /* Slider */
299
- $slider.each( function () {
300
- var val = $( this ).data( 'val' ),
301
- minValue = $( this ).data( 'min' ),
302
- maxValue = $( this ).data( 'max' ),
303
- step = $( this ).data( 'step' ),
304
- labels = $( this ).data( 'labels' );
305
-
306
- $( this ).slider( {
307
- value: val,
308
- min : minValue,
309
- max : maxValue,
310
- range: 'min',
311
- step : step,
312
-
313
- create: function () {
314
- $( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
315
- },
316
-
317
-
318
- slide: function ( event, ui ) {
319
- $( this ).find( 'input' ).val( ui.value );
320
- $( this ).find( '.ui-slider-handle' ).text( ui.value );
321
- $( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
322
- }
323
- } );
324
- } );
325
-
326
- /* codemirror */
327
- $codemirror.each( function ( i, v ) {
328
- var editor = CodeMirror.fromTextArea( v, {
329
- lineNumbers : 1,
330
- mode : 'javascript',
331
- showCursorWhenSelecting: true
332
- } );
333
-
334
- $( v ).data( 'codemirrorInstance', editor );
335
- } );
336
-
337
- /* Select All - Deselect All */
338
- $( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
339
- var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
340
- $targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
341
- } );
342
-
343
- $( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
344
- var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
345
- $targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
346
- } );
347
-
348
-
349
- $icons.each( function () {
350
- var $container = $( this ),
351
- $preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
352
- $text = $container.find( '.yit-icons-manager-icon-text' );
353
-
354
- $container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
355
- var $target = $( event.target ).closest( 'li' ),
356
- font = $target.data( 'font' ),
357
- icon = $target.data( 'icon' ),
358
- key = $target.data( 'key' ),
359
- name = $target.data( 'name' );
360
-
361
- $preview.attr( 'data-font', font );
362
- $preview.attr( 'data-icon', icon );
363
- $preview.attr( 'data-key', key );
364
- $preview.attr( 'data-name', name );
365
-
366
- $text.val( font + ':' + name );
367
-
368
- $container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
369
- $target.addClass( 'active' );
370
- } );
371
-
372
- $container.on( 'click', '.yit-icons-manager-action-set-default', function () {
373
- $container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
374
- } );
375
- } );
376
-
377
- /** Select Images */
378
- $( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
379
- var item = $( this ),
380
- key = item.data( 'key' ),
381
- wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
382
- items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
383
- select = wrapper.find( 'select' ).first();
384
-
385
- if ( select.length ) {
386
- select.val( key );
387
- items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
388
- item.addClass( 'yith-plugin-fw-select-images__item--selected' );
389
- }
390
- } );
391
-
392
- $( document.body ).trigger( 'wc-enhanced-select-init' );
393
-
394
- $( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
395
- {
396
- cursor : 'move',
397
- axis : 'y',
398
- scrollSensitivity : 40,
399
- forcePlaceholderSize: true,
400
- helper : 'clone',
401
-
402
- stop: function ( event, ui ) {
403
- var keys = jQuery( '.ui-sortable-handle' ),
404
- i = 0,
405
- array_keys = new Array();
406
- for ( i = 0; i < keys.length; i++ ) {
407
- array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
408
- }
409
- if ( array_keys.length > 0 ) {
410
- var toggle = $( this ).closest( '.toggle-element' );
411
- toggle.saveToggleElement( null, array_keys );
412
- }
413
- }
414
- }
415
- );
416
-
417
- $( document.body ).trigger( 'yith-framework-enhanced-select-init' );
418
- };
419
-
420
- $( document ).on( 'yith_fields_init', yith_fields_init ).trigger( 'yith_fields_init' );
421
-
422
- /* on-off */
423
- $( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
424
- var input = $( this ).prev( 'input' ),
425
- checked = input.prop( 'checked' );
426
-
427
- if ( checked ) {
428
- input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
429
- } else {
430
- input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
431
- }
432
-
433
- input.change();
434
- } );
435
-
436
-
437
- /** Toggle **/
438
-
439
-
440
-
441
- //TOGGLE ELEMENT
442
- $.fn.saveToggleElement = function ( spinner, array_keys ) {
443
- var toggle = $( this ),
444
- action = 'yith_plugin_fw_save_toggle_element',
445
- formdata = toggle.serializeToggleElement(),
446
- wrapper = toggle.find( '.yith-toggle_wrapper' ),
447
- id = wrapper.attr( 'id' ),
448
- current_tab = $.urlParam( 'tab' );
449
-
450
- formdata.append( 'security', wrapper.data( 'nonce' ) );
451
-
452
- if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
453
- formdata.append( 'yith_toggle_elements_order_keys', array_keys );
454
- }
455
-
456
- if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
457
- action = 'yith_plugin_fw_save_toggle_element_metabox';
458
- post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
459
- yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
460
- metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
461
- url = yith_framework_fw_fields.ajax_url +
462
- '?action=' + action +
463
- "&post_ID=" + post_id +
464
- '&yit_metaboxes_nonce=' + yit_metaboxes_nonce +
465
- "&toggle_id=" + id +
466
- "&metabox_tab=" + metabox_tab;
467
- } else {
468
- url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
469
- }
470
-
471
- $.ajax( {
472
- type : "POST",
473
- url : url,
474
- data : formdata,
475
- contentType: false,
476
- processData: false,
477
- success : function ( result ) {
478
- if ( spinner ) {
479
- spinner.removeClass( 'show' );
480
- }
481
-
482
- $( document ).trigger( 'yith_save_toggle_element_done', [result, toggle] );
483
- }
484
- } );
485
- };
486
-
487
- $.fn.serializeToggleElement = function () {
488
- var obj = $( this );
489
- /* ADD FILE TO PARAM AJAX */
490
- var formData = new FormData();
491
- var params = $( obj ).find( ":input" ).serializeArray();
492
-
493
- $.each( params, function ( i, val ) {
494
- el_name = val.name;
495
- formData.append( val.name, val.value );
496
- } );
497
-
498
- return formData;
499
- };
500
-
501
- $.fn.formatToggleTitle = function () {
502
- var toggle_el = $( this ),
503
- fields = toggle_el.find( ':input' ),
504
- title = toggle_el.find( 'span.title' ).data( 'title_format' ),
505
- subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
506
- regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
507
-
508
- if ( typeof title != 'undefined' ) {
509
- var res = title.match( regExp );
510
- }
511
-
512
- if ( typeof subtitle != 'undefined' ) {
513
- var ressub = subtitle.match( regExp );
514
- }
515
-
516
- $.each( fields, function ( i, field ) {
517
- if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
518
- $field_id = $( field ).attr( 'id' );
519
- $field_array = $field_id.split( '_' );
520
- $field_array.pop();
521
- $field_id = $field_array.join( '_' );
522
- $field_val = $( field ).val();
523
-
524
- if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
525
- title = title.replace( '%%' + $field_id + '%%', $field_val );
526
- }
527
- if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
528
- subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
529
- }
530
- }
531
- } );
532
-
533
- if ( '' !== title ) {
534
- toggle_el.find( 'span.title' ).html( title );
535
- }
536
-
537
- if ( '' !== subtitle ) {
538
- toggle_el.find( '.subtitle' ).html( subtitle );
539
- }
540
-
541
- $( document ).trigger( 'yith-toggle-element-item-title', [toggle_el] );
542
- };
543
-
544
- $.urlParam = function ( name ) {
545
- var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
546
- .exec( window.location.search );
547
-
548
- return ( results !== null ) ? results[ 1 ] || 0 : false;
549
- };
550
-
551
- $( document ).on( 'click', '.yith-toggle-title', function ( event ) {
552
- var _toggle = $( event.target ),
553
- _section = _toggle.closest( '.yith-toggle-row' ),
554
- _content = _section.find( '.yith-toggle-content' );
555
-
556
- if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'yith-icon-drag' ) ) {
557
- return false;
558
- }
559
-
560
- if ( _section.is( '.yith-toggle-row-opened' ) ) {
561
- _content.slideUp( 400 );
562
- } else {
563
- _content.slideDown( 400 );
564
- }
565
- _section.toggleClass( 'yith-toggle-row-opened' );
566
- } );
567
-
568
- /**Add new box toggle**/
569
- $( document ).on( 'click', '.yith-add-box-button', function ( event ) {
570
- event.preventDefault();
571
- var $this = $( this ),
572
- target_id = $this.data( 'box_id' ),
573
- closed_label = $this.data( 'closed_label' ),
574
- label = $this.data( 'opened_label' ),
575
- id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' );
576
- template = wp.template( 'yith-toggle-element-add-box-content-' + id );
577
-
578
- if ( '' !== target_id ) {
579
- $( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
580
- if ( closed_label !== '' ) {
581
- if ( $this.html() === closed_label ) {
582
- $this.html( label ).removeClass( 'closed' );
583
- } else {
584
- $this.html( closed_label ).addClass( 'closed' );
585
- }
586
- }
587
-
588
- $( document ).trigger( 'yith_fields_init' );
589
- $( document ).trigger( 'yith-add-box-button-toggle', [$this] );
590
- }
591
- } );
592
-
593
- $( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
594
-
595
- event.preventDefault();
596
- var add_box = $( this ).parents( '.yith-add-box' ),
597
- id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
598
- spinner = add_box.find( '.spinner' ),
599
- toggle_element = $( this ).parents( '.toggle-element' ),
600
- fields = add_box.find( ':input' ),
601
- counter = toggle_element.find( '.yith-toggle-row' ).length,
602
- hidden_obj = $( '<input type="hidden">' );
603
-
604
- hidden_obj.val( counter );
605
-
606
- $( document ).trigger( 'yith-toggle-change-counter', [hidden_obj, add_box] );
607
-
608
- counter = hidden_obj.val();
609
- var template = wp.template( 'yith-toggle-element-item-' + id ),
610
- toggle_el = $( template( { index: counter } ) );
611
-
612
- spinner.addClass( 'show' );
613
-
614
- $.each( fields, function ( i, field ) {
615
- if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
616
-
617
- $field_id = $( field ).attr( 'id' );
618
- $field_val = $( field ).val();
619
-
620
- if ( 'radio' == $( field ).attr( 'type' ) ) {
621
- $field_id = $field_id.replace( 'new_', '' );
622
- $field_id = $field_id.replace( '-' + $field_val, '' );
623
- $field_id = $field_id + '_dataindex-' + $field_val;
624
- } else {
625
- $field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
626
- }
627
-
628
- if ( $( field ).is( ':checked' ) ) {
629
- $( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
630
- }
631
-
632
- if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
633
- $( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
634
- }
635
-
636
- $( toggle_el ).find( '#' + $field_id ).val( $field_val );
637
-
638
- }
639
-
640
- } );
641
-
642
- $( toggle_el ).formatToggleTitle();
643
- var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
644
- $( document ).trigger( 'yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid] );
645
-
646
- var delayInMilliseconds = 1000; //1 second
647
- setTimeout( function () {
648
- if ( form_is_valid.val() === 'yes' ) {
649
- $( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
650
- $( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
651
- $( add_box ).html( '' );
652
- $( add_box ).prev( '.yith-add-box-button' ).trigger( 'click' );
653
- toggle_element.saveToggleElement();
654
-
655
- var delayInMilliseconds = 2000; //1 second
656
- setTimeout( function () {
657
- $( toggle_element ).find( '.highlight' ).removeClass( 'highlight' );
658
- }, delayInMilliseconds );
659
-
660
-
661
- $( document ).trigger( 'yith_fields_init' );
662
- }
663
- }, delayInMilliseconds );
664
-
665
-
666
- } );
667
-
668
- $( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
669
- event.preventDefault();
670
- var toggle = $( this ).closest( '.toggle-element' ),
671
- toggle_row = $( this ).closest( '.yith-toggle-row' ),
672
- spinner = toggle_row.find( '.spinner' );
673
- toggle_row.formatToggleTitle();
674
-
675
- var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
676
- $( document ).trigger( 'yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid] );
677
- if ( form_is_valid.val() === 'yes' ) {
678
- spinner.addClass( 'show' );
679
- toggle.saveToggleElement( spinner );
680
- }
681
- } );
682
-
683
- //register remove the dome and save the toggle
684
- $( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
685
- event.preventDefault();
686
- var toggle = $( this ).closest( '.toggle-element' ),
687
- toggle_row = $( this ).closest( '.yith-toggle-row' );
688
- toggle_row.remove();
689
- toggle.saveToggleElement();
690
- } );
691
-
692
- //register onoff status
693
- $( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
694
- event.preventDefault();
695
- var toggle = $( this ).closest( '.toggle-element' );
696
- toggle.saveToggleElement();
697
- } );
698
-
699
- // Radio
700
- $( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
701
- $( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
702
- } );
703
-
704
- $( document ).on( 'click', '.yith-password-eye', function () {
705
- var $this = $( this ),
706
- inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
707
- if ( inp.attr( 'type' ) === "password" ) {
708
- inp.attr( 'type', 'text' );
709
- $this.addClass( 'yith-password-eye-closed' );
710
- } else {
711
- inp.attr( 'type', 'password' );
712
- $this.removeClass( 'yith-password-eye-closed' );
713
- }
714
- } );
715
-
716
- $( document.body ).on( 'yith-plugin-fw-init-radio', function () {
717
- $( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
718
- $( this ).val( $( this ).attr( 'value' ) );
719
- $( this ).addClass( 'yith-plugin-fw-radio--initialized' );
720
- } );
721
- } ).trigger( 'yith-plugin-fw-init-radio' );
722
-
723
- /**
724
- * Select2 - add class to stylize it with the new plugin-fw style
725
- */
726
- $( document ).on( 'select2:open', function ( e ) {
727
- if ( $( e.target ).closest( '.yith-plugin-ui' ).length ) {
728
- $( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
729
- }
730
- } );
731
-
732
  /**
733
  * Dimensions
734
  */
1
  ( function ( $ ) {
2
 
3
+ /* global yith_framework_fw_fields*/
4
+
5
+ var yith_fields_init = function () {
6
+ var $datepicker = $( '.yith-plugin-fw-datepicker' ),
7
+ $colorpicker = $( '.yith-plugin-fw-colorpicker' ),
8
+ $upload = {
9
+ imgPreviewHandler : '.yith-plugin-fw-upload-img-preview',
10
+ uploadButtonHandler: '.yith-plugin-fw-upload-button',
11
+ imgUrlHandler : '.yith-plugin-fw-upload-img-url',
12
+ resetButtonHandler : '.yith-plugin-fw-upload-button-reset',
13
+ imgUrl : $( '.yith-plugin-fw-upload-img-url' )
14
+ },
15
+ $wpAddMedia = $( '.add_media' ),
16
+ $imageGallery = {
17
+ sliderWrapper: $( '.yith-plugin-fw .image-gallery ul.slides-wrapper' ),
18
+ buttonHandler: '.yith-plugin-fw .image-gallery-button'
19
+ },
20
+ $sidebars = $( '.yith-plugin-fw-sidebar-layout' ),
21
+ $slider = $( '.yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal' ),
22
+ $codemirror = $( '.codemirror' ),
23
+ $icons = $( '.yit-icons-manager-wrapper' ),
24
+ $checkgroup = $( ".yith-plugin-ui td.forminp-checkbox" );
25
+
26
+ /* Datepicker */
27
+ $datepicker.each( function () {
28
+ var args = $( this ).data();
29
+
30
+ // set animation to false to prevent style 'glitches' when removing class on closing
31
+ args.showAnim = false;
32
+ args.beforeShow = function ( input, instance ) {
33
+ instance.dpDiv.addClass( 'yith-plugin-fw-datepicker-div' );
34
+ };
35
+ args.onClose = function ( selectedDate, instance ) {
36
+ instance.dpDiv.removeClass( 'yith-plugin-fw-datepicker-div' );
37
+ };
38
+
39
+ $( this ).datepicker( args );
40
+ } );
41
+
42
+ /* Colorpicker */
43
+ $colorpicker.wpColorPicker( {
44
+ palettes: false,
45
+ width : 200,
46
+ mode : 'hsl',
47
+ clear : function () {
48
+ var input = $( this );
49
+ input.val( input.data( 'default-color' ) );
50
+ input.change();
51
+ }
52
+ } );
53
+
54
+
55
+ $colorpicker.each( function () {
56
+ var select_label = $( this ).data( 'variations-label' ),
57
+ wrap_main1 = $( this ).closest( '.yith-plugin-fw-colorpicker-field-wrapper' ),
58
+ wrap_main2 = $( this ).closest( '.yith-single-colorpicker' ),
59
+ wrap1 = wrap_main1.find( '.wp-picker-input-wrap' ),
60
+ wrap2 = wrap_main2.find( '.wp-picker-input-wrap' );
61
+
62
+ wrap1.length && wrap_main1.find( 'a.wp-color-result' ).attr( 'title', select_label );
63
+ wrap_main2.length && wrap_main2.find( 'a.wp-color-result' ).attr( 'title', select_label );
64
+
65
+ if ( !wrap1.find( '.wp-picker-clear-custom' ).length ) {
66
+ var button = $( '<span/>' ).attr( {
67
+ class: "wp-picker-default-custom"
68
+ } );
69
+ wrap1.find( '.wp-picker-default' ).wrap( button );
70
+ }
71
+
72
+ if ( !wrap2.find( '.wp-picker-clear-custom' ).length ) {
73
+ var button = $( '<span/>' ).attr( {
74
+ class: "wp-picker-default-custom"
75
+ } );
76
+ wrap2.find( '.wp-picker-default' ).wrap( button );
77
+ }
78
+ } );
79
+
80
+
81
+ /* Upload */
82
+ if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
83
+ var _custom_media = true;
84
+ // preview
85
+ $upload.imgUrl.change( function () {
86
+ var url = $( this ).val(),
87
  re = new RegExp( "(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)" ),
88
+ preview = $( this ).parent().find( $upload.imgPreviewHandler ).first();
89
+
90
+ if ( preview.length < 1 ) {
91
+ preview = $( this ).parent().parent().find( $upload.imgPreviewHandler ).first();
92
+ }
93
+
94
+ if ( re.test( url ) ) {
95
+ preview.html( '<img src="' + url + '" style="max-width:100px; max-height:100px;" />' );
96
+ } else {
97
+ preview.html( '' );
98
+ }
99
+ } ).trigger( 'change' );
100
+
101
+ $( document ).on( 'click', $upload.uploadButtonHandler, function ( e ) {
102
+ e.preventDefault();
103
+
104
+ var t = $( this ),
105
+ custom_uploader,
106
+ id = t.attr( 'id' ).replace( /-button$/, '' );
107
+
108
+ //If the uploader object has already been created, reopen the dialog
109
+ if ( custom_uploader ) {
110
+ custom_uploader.open();
111
+ return;
112
+ }
113
+
114
+ var custom_uploader_states = [
115
+ // Main states.
116
+ new wp.media.controller.Library( {
117
+ library : wp.media.query(),
118
+ multiple : false,
119
+ title : 'Choose Image',
120
+ priority : 20,
121
+ filterable: 'uploaded'
122
+ } )
123
+ ];
124
+
125
+ // Create the media frame.
126
+ custom_uploader = wp.media.frames.downloadable_file = wp.media( {
127
+ // Set the title of the modal.
128
+ title : 'Choose Image',
129
+ library : {
130
+ type: ''
131
+ },
132
+ button : {
133
+ text: 'Choose Image'
134
+ },
135
+ multiple: false,
136
+ states : custom_uploader_states
137
+ } );
138
+
139
+ //When a file is selected, grab the URL and set it as the text field's value
140
+ custom_uploader.on( 'select', function () {
141
+ var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
142
+
143
+ $( "#" + id ).val( attachment.url );
144
+ // Save the id of the selected element to an element which name is the same with a suffix "-yith-attachment-id"
145
+ if ( $( "#" + id + "-yith-attachment-id" ) ) {
146
+ $( "#" + id + "-yith-attachment-id" ).val( attachment.id );
147
+ }
148
+ $upload.imgUrl.trigger( 'change' );
149
+ } );
150
+
151
+ //Open the uploader dialog
152
+ custom_uploader.open();
153
+ } );
154
+
155
+ $( document ).on( 'click', $upload.resetButtonHandler, function ( e ) {
156
+ var t = $( this ),
157
+ id = t.attr( 'id' ),
158
+ input_id = t.attr( 'id' ).replace( /-button-reset$/, '' ),
159
+ default_value = $( '#' + id ).data( 'default' );
160
+
161
+ $( "#" + input_id ).val( default_value );
162
+ $upload.imgUrl.trigger( 'change' );
163
+ } );
164
+ }
165
+
166
+ $wpAddMedia.on( 'click', function () {
167
+ _custom_media = false;
168
+ } );
169
+
170
+ /* Image Gallery */
171
+ if ( typeof wp !== 'undefined' && typeof wp.media !== 'undefined' ) {
172
+ $( document ).on( 'click', $imageGallery.buttonHandler, function ( e ) {
173
+ var $t = $( this ),
174
+ $container = $t.closest( '.image-gallery' ),
175
+ $image_gallery_ids = $container.find( '.image_gallery_ids' ),
176
+ attachment_ids = $image_gallery_ids.val(),
177
+ $gallery_images_wrapper = $container.find( 'ul.slides-wrapper' );
178
+
179
+ // Create the media frame.
180
+ var image_gallery_frame = wp.media.frames.image_gallery = wp.media( {
181
+ // Set the title of the modal.
182
+ title : $t.data( 'choose' ),
183
+ button: {
184
+ text: $t.data( 'update' )
185
+ },
186
+ states: [
187
+ new wp.media.controller.Library( {
188
+ title : $t.data( 'choose' ),
189
+ filterable: 'all',
190
+ multiple : true
191
+ } )
192
+ ]
193
+ } );
194
+
195
+ // When an image is selected, run a callback.
196
+ image_gallery_frame.on( 'select', function () {
197
+ var selection = image_gallery_frame.state().get( 'selection' );
198
+ selection.map( function ( attachment ) {
199
+ attachment = attachment.toJSON();
200
+
201
+ if ( attachment.id ) {
202
+ attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
203
+ $gallery_images_wrapper.append( '<li class="image" data-attachment_id="' + attachment.id + '"><img src="' + attachment.sizes.thumbnail.url + '"/><ul class="actions"><li><a href="#" class="delete" title="' + $t.data( 'delete' ) + '">x</a></li></ul></li>' );
204
+ }
205
+ } );
206
+
207
+ $image_gallery_ids.val( attachment_ids );
208
+ } );
209
+
210
+ image_gallery_frame.open();
211
+
212
+ } );
213
+
214
+ // Image ordering
215
+ $imageGallery.sliderWrapper.each( function () {
216
+ var $t = $( this );
217
+ $t.sortable( {
218
+ items : 'li.image',
219
+ cursor : 'move',
220
+ scrollSensitivity : 40,
221
+ forcePlaceholderSize: true,
222
+ forceHelperSize : false,
223
+ helper : 'clone',
224
+ opacity : 0.65,
225
+ start : function ( event, ui ) {
226
+ ui.item.css( 'background-color', '#f6f6f6' );
227
+ },
228
+ stop : function ( event, ui ) {
229
+ ui.item.removeAttr( 'style' );
230
+ },
231
+ update : function ( event, ui ) {
232
+ var attachment_ids = '';
233
+
234
+ $t.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
235
+ var attachment_id = $( this ).attr( 'data-attachment_id' );
236
+ attachment_ids = attachment_ids + attachment_id + ',';
237
+ } );
238
+
239
+ $t.closest( '.image-gallery' ).find( '.image_gallery_ids' ).val( attachment_ids );
240
+ }
241
+ } );
242
+ } );
243
+
244
+ // Remove images
245
+ $imageGallery.sliderWrapper.on( 'click', 'a.delete', function () {
246
+ var $wrapper = $( this ).closest( '.image-gallery' ),
247
+ $gallery = $( this ).closest( '.image-gallery ul.slides-wrapper' ),
248
+ $image_gallery_ids = $wrapper.find( '.image_gallery_ids' ),
249
+ attachment_ids = '';
250
+
251
+ $( this ).closest( 'li.image' ).remove();
252
+
253
+ $gallery.find( 'li.image' ).css( 'cursor', 'default' ).each( function () {
254
+ var attachment_id = $( this ).attr( 'data-attachment_id' );
255
+ attachment_ids = attachment_ids + attachment_id + ',';
256
+ } );
257
+
258
+ $image_gallery_ids.val( attachment_ids );
259
+ } );
260
+ }
261
+
262
+
263
+ /* Sidebars */
264
+ $sidebars.each( function () {
265
+ var $images = $( this ).find( 'img' );
266
+ $images.on( 'click', function () {
267
+ var $container = $( this ).closest( '.yith-plugin-fw-sidebar-layout' ),
268
+ $left = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-left-container' ),
269
+ $right = $container.find( '.yith-plugin-fw-sidebar-layout-sidebar-right-container' ),
270
+ type = $( this ).data( 'type' );
271
+
272
+ $( this ).parent().children( ':radio' ).attr( 'checked', false );
273
+ $( this ).prev( ':radio' ).attr( 'checked', true );
274
+
275
+ if ( typeof type != 'undefined' ) {
276
+ switch ( type ) {
277
+ case 'left':
278
+ $left.show();
279
+ $right.hide();
280
+ break;
281
+ case 'right':
282
+ $right.show();
283
+ $left.hide();
284
+ break;
285
+ case 'double':
286
+ $left.show();
287
+ $right.show();
288
+ break;
289
+ default:
290
+ $left.hide();
291
+ $right.hide();
292
+ break;
293
+ }
294
+ }
295
+ } );
296
+ } );
297
+
298
+ /* Slider */
299
+ $slider.each( function () {
300
+ var val = $( this ).data( 'val' ),
301
+ minValue = $( this ).data( 'min' ),
302
+ maxValue = $( this ).data( 'max' ),
303
+ step = $( this ).data( 'step' ),
304
+ labels = $( this ).data( 'labels' );
305
+
306
+ $( this ).slider( {
307
+ value: val,
308
+ min : minValue,
309
+ max : maxValue,
310
+ range: 'min',
311
+ step : step,
312
+
313
+ create: function () {
314
+ $( this ).find( '.ui-slider-handle' ).text( $( this ).slider( "value" ) );
315
+ },
316
+
317
+
318
+ slide: function ( event, ui ) {
319
+ $( this ).find( 'input' ).val( ui.value );
320
+ $( this ).find( '.ui-slider-handle' ).text( ui.value );
321
+ $( this ).siblings( '.feedback' ).find( 'strong' ).text( ui.value + labels );
322
+ }
323
+ } );
324
+ } );
325
+
326
+ /* codemirror */
327
+ $codemirror.each( function ( i, v ) {
328
+ var editor = CodeMirror.fromTextArea( v, {
329
+ lineNumbers : 1,
330
+ mode : 'javascript',
331
+ showCursorWhenSelecting: true
332
+ } );
333
+
334
+ $( v ).data( 'codemirrorInstance', editor );
335
+ } );
336
+
337
+ /* Select All - Deselect All */
338
+ $( document ).on( 'click', '.yith-plugin-fw-select-all', function () {
339
+ var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
340
+ $targetSelect.find( 'option' ).prop( 'selected', true ).trigger( 'change' );
341
+ } );
342
+
343
+ $( document ).on( 'click', '.yith-plugin-fw-deselect-all', function () {
344
+ var $targetSelect = $( '#' + $( this ).data( 'select-id' ) );
345
+ $targetSelect.find( 'option' ).prop( 'selected', false ).trigger( 'change' );
346
+ } );
347
+
348
+
349
+ $icons.each( function () {
350
+ var $container = $( this ),
351
+ $preview = $container.find( '.yit-icons-manager-icon-preview' ).first(),
352
+ $text = $container.find( '.yit-icons-manager-icon-text' );
353
+
354
+ $container.on( 'click', '.yit-icons-manager-list li', function ( event ) {
355
+ var $target = $( event.target ).closest( 'li' ),
356
+ font = $target.data( 'font' ),
357
+ icon = $target.data( 'icon' ),
358
+ key = $target.data( 'key' ),
359
+ name = $target.data( 'name' );
360
+
361
+ $preview.attr( 'data-font', font );
362
+ $preview.attr( 'data-icon', icon );
363
+ $preview.attr( 'data-key', key );
364
+ $preview.attr( 'data-name', name );
365
+
366
+ $text.val( font + ':' + name );
367
+
368
+ $container.find( '.yit-icons-manager-list li' ).removeClass( 'active' );
369
+ $target.addClass( 'active' );
370
+ } );
371
+
372
+ $container.on( 'click', '.yit-icons-manager-action-set-default', function () {
373
+ $container.find( '.yit-icons-manager-list li.default' ).trigger( 'click' );
374
+ } );
375
+ } );
376
+
377
+ /** Select Images */
378
+ $( document ).on( 'click', '.yith-plugin-fw-select-images__item', function () {
379
+ var item = $( this ),
380
+ key = item.data( 'key' ),
381
+ wrapper = item.closest( '.yith-plugin-fw-select-images__wrapper' ),
382
+ items = wrapper.find( '.yith-plugin-fw-select-images__item' ),
383
+ select = wrapper.find( 'select' ).first();
384
+
385
+ if ( select.length ) {
386
+ select.val( key ).trigger('yith_select_images_value_changed');
387
+ items.removeClass( 'yith-plugin-fw-select-images__item--selected' );
388
+ item.addClass( 'yith-plugin-fw-select-images__item--selected' );
389
+ }
390
+ } );
391
+
392
+ $( document.body ).trigger( 'wc-enhanced-select-init' );
393
+
394
+ $( document ).find( '.ui-sortable .yith-toggle-elements' ).sortable(
395
+ {
396
+ cursor : 'move',
397
+ axis : 'y',
398
+ scrollSensitivity : 40,
399
+ forcePlaceholderSize: true,
400
+ helper : 'clone',
401
+
402
+ stop: function ( event, ui ) {
403
+ var keys = jQuery( '.ui-sortable-handle' ),
404
+ i = 0,
405
+ array_keys = new Array();
406
+ for ( i = 0; i < keys.length; i++ ) {
407
+ array_keys[ i ] = $( keys[ i ] ).data( 'item_key' );
408
+ }
409
+ if ( array_keys.length > 0 ) {
410
+ var toggle = $( this ).closest( '.toggle-element' );
411
+ toggle.saveToggleElement( null, array_keys );
412
+ }
413
+ }
414
+ }
415
+ );
416
+
417
+ $( document.body ).trigger( 'yith-framework-enhanced-select-init' );
418
+ };
419
+
420
+ $( document ).on( 'yith_fields_init', yith_fields_init ).trigger( 'yith_fields_init' );
421
+
422
+ /* on-off */
423
+ $( document ).on( 'click', '.yith-plugin-fw-onoff-container span', function () {
424
+ var input = $( this ).prev( 'input' ),
425
+ checked = input.prop( 'checked' );
426
+
427
+ if ( checked ) {
428
+ input.prop( 'checked', false ).attr( 'value', 'no' ).removeClass( 'onoffchecked' );
429
+ } else {
430
+ input.prop( 'checked', true ).attr( 'value', 'yes' ).addClass( 'onoffchecked' );
431
+ }
432
+
433
+ input.change();
434
+ } );
435
+
436
+
437
+ /** Toggle **/
438
+
439
+
440
+
441
+ //TOGGLE ELEMENT
442
+ $.fn.saveToggleElement = function ( spinner, array_keys ) {
443
+ var toggle = $( this ),
444
+ action = 'yith_plugin_fw_save_toggle_element',
445
+ formdata = toggle.serializeToggleElement(),
446
+ wrapper = toggle.find( '.yith-toggle_wrapper' ),
447
+ id = wrapper.attr( 'id' ),
448
+ current_tab = $.urlParam( 'tab' );
449
+
450
+ formdata.append( 'security', wrapper.data( 'nonce' ) );
451
+
452
+ if ( typeof array_keys != 'undefined' && array_keys.length > 0 ) {
453
+ formdata.append( 'yith_toggle_elements_order_keys', array_keys );
454
+ }
455
+
456
+ if ( toggle.closest( '.metaboxes-tab.yith-plugin-ui' ).length ) {
457
+ action = 'yith_plugin_fw_save_toggle_element_metabox';
458
+ post_id = $( this ).closest( 'form#post' ).find( '#post_ID' ).val();
459
+ yit_metaboxes_nonce = $( this ).closest( 'form#post' ).find( '#yit_metaboxes_nonce' ).val();
460
+ metabox_tab = $( this ).closest( '.tabs-panel' ).attr( 'id' );
461
+ url = yith_framework_fw_fields.ajax_url +
462
+ '?action=' + action +
463
+ "&post_ID=" + post_id +
464
+ '&yit_metaboxes_nonce=' + yit_metaboxes_nonce +
465
+ "&toggle_id=" + id +
466
+ "&metabox_tab=" + metabox_tab;
467
+ } else {
468
+ url = yith_framework_fw_fields.admin_url + '?action=' + action + '&tab=' + current_tab + "&toggle_id=" + id;
469
+ }
470
+
471
+ $.ajax( {
472
+ type : "POST",
473
+ url : url,
474
+ data : formdata,
475
+ contentType: false,
476
+ processData: false,
477
+ success : function ( result ) {
478
+ if ( spinner ) {
479
+ spinner.removeClass( 'show' );
480
+ }
481
+
482
+ $( document ).trigger( 'yith_save_toggle_element_done', [result, toggle] );
483
+ }
484
+ } );
485
+ };
486
+
487
+ $.fn.serializeToggleElement = function () {
488
+ var obj = $( this );
489
+ /* ADD FILE TO PARAM AJAX */
490
+ var formData = new FormData();
491
+ var params = $( obj ).find( ":input" ).serializeArray();
492
+
493
+ $.each( params, function ( i, val ) {
494
+ el_name = val.name;
495
+ formData.append( val.name, val.value );
496
+ } );
497
+
498
+ return formData;
499
+ };
500
+
501
+ $.fn.formatToggleTitle = function () {
502
+ var toggle_el = $( this ),
503
+ fields = toggle_el.find( ':input' ),
504
+ title = toggle_el.find( 'span.title' ).data( 'title_format' ),
505
+ subtitle = toggle_el.find( '.subtitle' ).data( 'subtitle_format' ),
506
+ regExp = new RegExp( "[^%%]+(?=[%%])", 'g' );
507
+
508
+ if ( typeof title != 'undefined' ) {
509
+ var res = title.match( regExp );
510
+ }
511
+
512
+ if ( typeof subtitle != 'undefined' ) {
513
+ var ressub = subtitle.match( regExp );
514
+ }
515
+
516
+ $.each( fields, function ( i, field ) {
517
+ if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
518
+ $field_id = $( field ).attr( 'id' );
519
+ $field_array = $field_id.split( '_' );
520
+ $field_array.pop();
521
+ $field_id = $field_array.join( '_' );
522
+ $field_val = $( field ).val();
523
+
524
+ if ( res != null && typeof res != 'undefined' && res.indexOf( $field_id ) !== -1 ) {
525
+ title = title.replace( '%%' + $field_id + '%%', $field_val );
526
+ }
527
+ if ( ressub != null && typeof ressub != 'undefined' && ressub.indexOf( $field_id ) !== -1 ) {
528
+ subtitle = subtitle.replace( '%%' + $field_id + '%%', $field_val );
529
+ }
530
+ }
531
+ } );
532
+
533
+ if ( '' !== title ) {
534
+ toggle_el.find( 'span.title' ).html( title );
535
+ }
536
+
537
+ if ( '' !== subtitle ) {
538
+ toggle_el.find( '.subtitle' ).html( subtitle );
539
+ }
540
+
541
+ $( document ).trigger( 'yith-toggle-element-item-title', [toggle_el] );
542
+ };
543
+
544
+ $.urlParam = function ( name ) {
545
+ var results = new RegExp( '[\?&]' + name + '=([^&#]*)' )
546
+ .exec( window.location.search );
547
+
548
+ return ( results !== null ) ? results[ 1 ] || 0 : false;
549
+ };
550
+
551
+ $( document ).on( 'click', '.yith-toggle-title', function ( event ) {
552
+ var _toggle = $( event.target ),
553
+ _section = _toggle.closest( '.yith-toggle-row' ),
554
+ _content = _section.find( '.yith-toggle-content' );
555
+
556
+ if ( _toggle.hasClass( 'yith-plugin-fw-onoff' ) || _toggle.hasClass( 'yith-icon-drag' ) ) {
557
+ return false;
558
+ }
559
+
560
+ if ( _section.is( '.yith-toggle-row-opened' ) ) {
561
+ _content.slideUp( 400 );
562
+ } else {
563
+ _content.slideDown( 400 );
564
+ }
565
+ _section.toggleClass( 'yith-toggle-row-opened' );
566
+ } );
567
+
568
+ /**Add new box toggle**/
569
+ $( document ).on( 'click', '.yith-add-box-button', function ( event ) {
570
+ event.preventDefault();
571
+ var $this = $( this ),
572
+ target_id = $this.data( 'box_id' ),
573
+ closed_label = $this.data( 'closed_label' ),
574
+ label = $this.data( 'opened_label' ),
575
+ id = $this.closest( '.yith-toggle_wrapper' ).attr( 'id' );
576
+ template = wp.template( 'yith-toggle-element-add-box-content-' + id );
577
+
578
+ if ( '' !== target_id ) {
579
+ $( '#' + target_id ).html( template( { index: 'box_id' } ) ).slideToggle();
580
+ if ( closed_label !== '' ) {
581
+ if ( $this.html() === closed_label ) {
582
+ $this.html( label ).removeClass( 'closed' );
583
+ } else {
584
+ $this.html( closed_label ).addClass( 'closed' );
585
+ }
586
+ }
587
+
588
+ $( document ).trigger( 'yith_fields_init' );
589
+ $( document ).trigger( 'yith-add-box-button-toggle', [$this] );
590
+ }
591
+ } );
592
+
593
+ $( document ).on( 'click', '.yith-add-box-buttons .yith-save-button', function ( event ) {
594
+
595
+ event.preventDefault();
596
+ var add_box = $( this ).parents( '.yith-add-box' ),
597
+ id = $( this ).closest( '.yith-toggle_wrapper' ).attr( 'id' ),
598
+ spinner = add_box.find( '.spinner' ),
599
+ toggle_element = $( this ).parents( '.toggle-element' ),
600
+ fields = add_box.find( ':input' ),
601
+ counter = toggle_element.find( '.yith-toggle-row' ).length,
602
+ hidden_obj = $( '<input type="hidden">' );
603
+
604
+ hidden_obj.val( counter );
605
+
606
+ $( document ).trigger( 'yith-toggle-change-counter', [hidden_obj, add_box] );
607
+
608
+ counter = hidden_obj.val();
609
+ var template = wp.template( 'yith-toggle-element-item-' + id ),
610
+ toggle_el = $( template( { index: counter } ) );
611
+
612
+ spinner.addClass( 'show' );
613
+
614
+ $.each( fields, function ( i, field ) {
615
+ if ( typeof $( field ).attr( 'id' ) != 'undefined' ) {
616
+
617
+ $field_id = $( field ).attr( 'id' );
618
+ $field_val = $( field ).val();
619
+
620
+ if ( 'radio' == $( field ).attr( 'type' ) ) {
621
+ $field_id = $field_id.replace( 'new_', '' );
622
+ $field_id = $field_id.replace( '-' + $field_val, '' );
623
+ $field_id = $field_id + '_dataindex-' + $field_val;
624
+ } else {
625
+ $field_id = $field_id.replace( 'new_', '' ) + '_' + counter;
626
+ }
627
+
628
+ if ( $( field ).is( ':checked' ) ) {
629
+ $( toggle_el ).find( '#' + $field_id ).prop( 'checked', true );
630
+ }
631
+
632
+ if ( $( field ).hasClass( 'yith-post-search' ) || $( field ).hasClass( 'yith-term-search' ) ) {
633
+ $( toggle_el ).find( '#' + $field_id ).html( $( '#' + $( field ).attr( 'id' ) ).html() );
634
+ }
635
+
636
+ $( toggle_el ).find( '#' + $field_id ).val( $field_val );
637
+
638
+ }
639
+
640
+ } );
641
+
642
+ $( toggle_el ).formatToggleTitle();
643
+ var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
644
+ $( document ).trigger( 'yith-toggle-element-item-before-add', [add_box, toggle_el, form_is_valid] );
645
+
646
+ var delayInMilliseconds = 1000; //1 second
647
+ setTimeout( function () {
648
+ if ( form_is_valid.val() === 'yes' ) {
649
+ $( toggle_element ).find( '.yith-toggle-elements' ).append( toggle_el );
650
+ $( add_box ).find( '.yith-plugin-fw-datepicker' ).datepicker( 'destroy' );
651
+ $( add_box ).html( '' );
652
+ $( add_box ).prev( '.yith-add-box-button' ).trigger( 'click' );
653
+ toggle_element.saveToggleElement();
654
+
655
+ var delayInMilliseconds = 2000; //1 second
656
+ setTimeout( function () {
657
+ $( toggle_element ).find( '.highlight' ).removeClass( 'highlight' );
658
+ }, delayInMilliseconds );
659
+
660
+
661
+ $( document ).trigger( 'yith_fields_init' );
662
+ }
663
+ }, delayInMilliseconds );
664
+
665
+
666
+ } );
667
+
668
+ $( document ).on( 'click', '.yith-toggle-row .yith-save-button', function ( event ) {
669
+ event.preventDefault();
670
+ var toggle = $( this ).closest( '.toggle-element' ),
671
+ toggle_row = $( this ).closest( '.yith-toggle-row' ),
672
+ spinner = toggle_row.find( '.spinner' );
673
+ toggle_row.formatToggleTitle();
674
+
675
+ var form_is_valid = $( '<input type="hidden">' ).val( 'yes' );
676
+ $( document ).trigger( 'yith-toggle-element-item-before-update', [toggle, toggle_row, form_is_valid] );
677
+ if ( form_is_valid.val() === 'yes' ) {
678
+ spinner.addClass( 'show' );
679
+ toggle.saveToggleElement( spinner );
680
+ }
681
+ } );
682
+
683
+ //register remove the dome and save the toggle
684
+ $( document ).on( 'click', '.yith-toggle-row .yith-delete-button', function ( event ) {
685
+ event.preventDefault();
686
+ var toggle = $( this ).closest( '.toggle-element' ),
687
+ toggle_row = $( this ).closest( '.yith-toggle-row' );
688
+ toggle_row.remove();
689
+ toggle.saveToggleElement();
690
+ } );
691
+
692
+ //register onoff status
693
+ $( document ).on( 'click', '.yith-toggle-onoff', function ( event ) {
694
+ event.preventDefault();
695
+ var toggle = $( this ).closest( '.toggle-element' );
696
+ toggle.saveToggleElement();
697
+ } );
698
+
699
+ // Radio
700
+ $( document ).on( 'click', '.yith-plugin-fw-radio input[type=radio]', function () {
701
+ $( this ).closest( '.yith-plugin-fw-radio' ).val( $( this ).val() ).trigger( 'change' );
702
+ } );
703
+
704
+ $( document ).on( 'click', '.yith-password-eye', function () {
705
+ var $this = $( this ),
706
+ inp = $( this ).closest( '.yith-password-wrapper' ).find( 'input' );
707
+ if ( inp.attr( 'type' ) === "password" ) {
708
+ inp.attr( 'type', 'text' );
709
+ $this.addClass( 'yith-password-eye-closed' );
710
+ } else {
711
+ inp.attr( 'type', 'password' );
712
+ $this.removeClass( 'yith-password-eye-closed' );
713
+ }
714
+ } );
715
+
716
+ $( document.body ).on( 'yith-plugin-fw-init-radio', function () {
717
+ $( '.yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)' ).each( function () {
718
+ $( this ).val( $( this ).attr( 'value' ) );
719
+ $( this ).addClass( 'yith-plugin-fw-radio--initialized' );
720
+ } );
721
+ } ).trigger( 'yith-plugin-fw-init-radio' );
722
+
723
+ /**
724
+ * Select2 - add class to stylize it with the new plugin-fw style
725
+ */
726
+ $( document ).on( 'select2:open', function ( e ) {
727
+ if ( $( e.target ).closest( '.yith-plugin-ui' ).length ) {
728
+ $( '.select2-results' ).closest( '.select2-container' ).addClass( 'yith-plugin-fw-select2-container' );
729
+ }
730
+ } );
 
731
  /**
732
  * Dimensions
733
  */
plugin-fw/assets/js/yith-fields.min.js CHANGED
@@ -1 +1,30 @@
1
- !function(e){e(document).on("yith_fields_init",function(){var t=e(".yith-plugin-fw-datepicker"),i=e(".yith-plugin-fw-colorpicker"),a={imgPreviewHandler:".yith-plugin-fw-upload-img-preview",uploadButtonHandler:".yith-plugin-fw-upload-button",imgUrlHandler:".yith-plugin-fw-upload-img-url",resetButtonHandler:".yith-plugin-fw-upload-button-reset",imgUrl:e(".yith-plugin-fw-upload-img-url")},n=e(".add_media"),l={sliderWrapper:e(".yith-plugin-fw .image-gallery ul.slides-wrapper"),buttonHandler:".yith-plugin-fw .image-gallery-button"},s=e(".yith-plugin-fw-sidebar-layout"),o=e(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),r=e(".codemirror"),d=e(".yit-icons-manager-wrapper");e(".yith-plugin-ui td.forminp-checkbox");t.each(function(){var t=e(this).data();t.showAnim=!1,t.beforeShow=function(e,t){t.dpDiv.addClass("yith-plugin-fw-datepicker-div")},t.onClose=function(e,t){t.dpDiv.removeClass("yith-plugin-fw-datepicker-div")},e(this).datepicker(t)}),i.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var t=e(this);t.val(t.data("default-color")),t.change()}}),i.each(function(){var t=e(this).data("variations-label"),i=e(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),a=e(this).closest(".yith-single-colorpicker"),n=i.find(".wp-picker-input-wrap"),l=a.find(".wp-picker-input-wrap");if(n.length&&i.find("a.wp-color-result").attr("title",t),a.length&&a.find("a.wp-color-result").attr("title",t),!n.find(".wp-picker-clear-custom").length){var s=e("<span/>").attr({"class":"wp-picker-default-custom"});n.find(".wp-picker-default").wrap(s)}l.find(".wp-picker-clear-custom").length||(s=e("<span/>").attr({"class":"wp-picker-default-custom"}),l.find(".wp-picker-default").wrap(s))}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(a.imgUrl.change(function(){var t=e(this).val(),i=new RegExp("(http|ftp|https)://[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)"),n=e(this).parent().find(a.imgPreviewHandler).first();n.length<1&&(n=e(this).parent().parent().find(a.imgPreviewHandler).first()),i.test(t)?n.html('<img src="'+t+'" style="max-width:100px; max-height:100px;" />'):n.html("")}).trigger("change"),e(document).on("click",a.uploadButtonHandler,function(t){t.preventDefault();var i,n=e(this).attr("id").replace(/-button$/,"");if(i)i.open();else{var l=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];(i=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:l})).on("select",function(){var t=i.state().get("selection").first().toJSON();e("#"+n).val(t.url),e("#"+n+"-yith-attachment-id")&&e("#"+n+"-yith-attachment-id").val(t.id),a.imgUrl.trigger("change")}),i.open()}}),e(document).on("click",a.resetButtonHandler,function(t){var i=e(this),n=i.attr("id"),l=i.attr("id").replace(/-button-reset$/,""),s=e("#"+n).data("default");e("#"+l).val(s),a.imgUrl.trigger("change")}));n.on("click",function(){}),"undefined"!=typeof wp&&"undefined"!=typeof wp.media&&(e(document).on("click",l.buttonHandler,function(t){var i=e(this),a=i.closest(".image-gallery"),n=a.find(".image_gallery_ids"),l=n.val(),s=a.find("ul.slides-wrapper"),o=wp.media.frames.image_gallery=wp.media({title:i.data("choose"),button:{text:i.data("update")},states:[new wp.media.controller.Library({title:i.data("choose"),filterable:"all",multiple:!0})]});o.on("select",function(){o.state().get("selection").map(function(e){(e=e.toJSON()).id&&(l=l?l+","+e.id:e.id,s.append('<li class="image" data-attachment_id="'+e.id+'"><img src="'+e.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+i.data("delete")+'">x</a></li></ul></li>'))}),n.val(l)}),o.open()}),l.sliderWrapper.each(function(){var t=e(this);t.sortable({items:"li.image",cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")},update:function(i,a){var n="";t.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),t.closest(".image-gallery").find(".image_gallery_ids").val(n)}})}),l.sliderWrapper.on("click","a.delete",function(){var t=e(this).closest(".image-gallery"),i=e(this).closest(".image-gallery ul.slides-wrapper"),a=t.find(".image_gallery_ids"),n="";e(this).closest("li.image").remove(),i.find("li.image").css("cursor","default").each(function(){var t=e(this).attr("data-attachment_id");n=n+t+","}),a.val(n)})),s.each(function(){e(this).find("img").on("click",function(){var t=e(this).closest(".yith-plugin-fw-sidebar-layout"),i=t.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container"),a=t.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container"),n=e(this).data("type");if(e(this).parent().children(":radio").attr("checked",!1),e(this).prev(":radio").attr("checked",!0),void 0!==n)switch(n){case"left":i.show(),a.hide();break;case"right":a.show(),i.hide();break;case"double":i.show(),a.show();break;default:i.hide(),a.hide()}})}),o.each(function(){var t=e(this).data("val"),i=e(this).data("min"),a=e(this).data("max"),n=e(this).data("step"),l=e(this).data("labels");e(this).slider({value:t,min:i,max:a,range:"min",step:n,create:function(){e(this).find(".ui-slider-handle").text(e(this).slider("value"))},slide:function(t,i){e(this).find("input").val(i.value),e(this).find(".ui-slider-handle").text(i.value),e(this).siblings(".feedback").find("strong").text(i.value+l)}})}),r.each(function(t,i){var a=CodeMirror.fromTextArea(i,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});e(i).data("codemirrorInstance",a)}),e(document).on("click",".yith-plugin-fw-select-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!0).trigger("change")}),e(document).on("click",".yith-plugin-fw-deselect-all",function(){e("#"+e(this).data("select-id")).find("option").prop("selected",!1).trigger("change")}),d.each(function(){var t=e(this),i=t.find(".yit-icons-manager-icon-preview").first(),a=t.find(".yit-icons-manager-icon-text");t.on("click",".yit-icons-manager-list li",function(n){var l=e(n.target).closest("li"),s=l.data("font"),o=l.data("icon"),r=l.data("key"),d=l.data("name");i.attr("data-font",s),i.attr("data-icon",o),i.attr("data-key",r),i.attr("data-name",d),a.val(s+":"+d),t.find(".yit-icons-manager-list li").removeClass("active"),l.addClass("active")}),t.on("click",".yit-icons-manager-action-set-default",function(){t.find(".yit-icons-manager-list li.default").trigger("click")})}),e(document).on("click",".yith-plugin-fw-select-images__item",function(){var t=e(this),i=t.data("key"),a=t.closest(".yith-plugin-fw-select-images__wrapper"),n=a.find(".yith-plugin-fw-select-images__item"),l=a.find("select").first();l.length&&(l.val(i),n.removeClass("yith-plugin-fw-select-images__item--selected"),t.addClass("yith-plugin-fw-select-images__item--selected"))}),e(document.body).trigger("wc-enhanced-select-init"),e(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(t,i){var a=jQuery(".ui-sortable-handle"),n=0,l=new Array;for(n=0;n<a.length;n++)l[n]=e(a[n]).data("item_key");l.length>0&&e(this).closest(".toggle-element").saveToggleElement(null,l)}}),e(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init"),e(document).on("click",".yith-plugin-fw-onoff-container span",function(){var t=e(this).prev("input");t.prop("checked")?t.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):t.prop("checked",!0).attr("value","yes").addClass("onoffchecked"),t.change()}),e.fn.saveToggleElement=function(t,i){var a=e(this),n="yith_plugin_fw_save_toggle_element",l=a.serializeToggleElement(),s=a.find(".yith-toggle_wrapper"),o=s.attr("id"),r=e.urlParam("tab");l.append("security",s.data("nonce")),void 0!==i&&i.length>0&&l.append("yith_toggle_elements_order_keys",i),a.closest(".metaboxes-tab.yith-plugin-ui").length?(n="yith_plugin_fw_save_toggle_element_metabox",post_id=e(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=e(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=e(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+n+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+o+"&metabox_tab="+metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+n+"&tab="+r+"&toggle_id="+o,e.ajax({type:"POST",url:url,data:l,contentType:!1,processData:!1,success:function(i){t&&t.removeClass("show"),e(document).trigger("yith_save_toggle_element_done",[i,a])}})},e.fn.serializeToggleElement=function(){var t=e(this),i=new FormData,a=e(t).find(":input").serializeArray();return e.each(a,function(e,t){el_name=t.name,i.append(t.name,t.value)}),i},e.fn.formatToggleTitle=function(){var t=e(this),i=t.find(":input"),a=t.find("span.title").data("title_format"),n=t.find(".subtitle").data("subtitle_format"),l=new RegExp("[^%%]+(?=[%%])","g");if(void 0!==a)var s=a.match(l);if(void 0!==n)var o=n.match(l);e.each(i,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=e(i).val(),null!=s&&void 0!==s&&-1!==s.indexOf($field_id)&&(a=a.replace("%%"+$field_id+"%%",$field_val)),null!=o&&void 0!==o&&-1!==o.indexOf($field_id)&&(n=n.replace("%%"+$field_id+"%%",$field_val)))}),""!==a&&t.find("span.title").html(a),""!==n&&t.find(".subtitle").html(n),e(document).trigger("yith-toggle-element-item-title",[t])},e.urlParam=function(e){var t=new RegExp("[?&]"+e+"=([^&#]*)").exec(window.location.search);return null!==t&&(t[1]||0)},e(document).on("click",".yith-toggle-title",function(t){var i=e(t.target),a=i.closest(".yith-toggle-row"),n=a.find(".yith-toggle-content");if(i.hasClass("yith-plugin-fw-onoff")||i.hasClass("yith-icon-drag"))return!1;a.is(".yith-toggle-row-opened")?n.slideUp(400):n.slideDown(400),a.toggleClass("yith-toggle-row-opened")}),e(document).on("click",".yith-add-box-button",function(t){t.preventDefault();var i=e(this),a=i.data("box_id"),n=i.data("closed_label"),l=i.data("opened_label"),s=i.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+s),""!==a&&(e("#"+a).html(template({index:"box_id"})).slideToggle(),""!==n&&(i.html()===n?i.html(l).removeClass("closed"):i.html(n).addClass("closed")),e(document).trigger("yith_fields_init"),e(document).trigger("yith-add-box-button-toggle",[i]))}),e(document).on("click",".yith-add-box-buttons .yith-save-button",function(t){t.preventDefault();var i=e(this).parents(".yith-add-box"),a=e(this).closest(".yith-toggle_wrapper").attr("id"),n=i.find(".spinner"),l=e(this).parents(".toggle-element"),s=i.find(":input"),o=l.find(".yith-toggle-row").length,r=e('<input type="hidden">');r.val(o),e(document).trigger("yith-toggle-change-counter",[r,i]),o=r.val();var d=wp.template("yith-toggle-element-item-"+a),c=e(d({index:o}));n.addClass("show"),e.each(s,function(t,i){void 0!==e(i).attr("id")&&($field_id=e(i).attr("id"),$field_val=e(i).val(),"radio"==e(i).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+o,e(i).is(":checked")&&e(c).find("#"+$field_id).prop("checked",!0),(e(i).hasClass("yith-post-search")||e(i).hasClass("yith-term-search"))&&e(c).find("#"+$field_id).html(e("#"+e(i).attr("id")).html()),e(c).find("#"+$field_id).val($field_val))}),e(c).formatToggleTitle();var u=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-add",[i,c,u]);setTimeout(function(){if("yes"===u.val()){e(l).find(".yith-toggle-elements").append(c),e(i).find(".yith-plugin-fw-datepicker").datepicker("destroy"),e(i).html(""),e(i).prev(".yith-add-box-button").trigger("click"),l.saveToggleElement();setTimeout(function(){e(l).find(".highlight").removeClass("highlight")},2e3),e(document).trigger("yith_fields_init")}},1e3)}),e(document).on("click",".yith-toggle-row .yith-save-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element"),a=e(this).closest(".yith-toggle-row"),n=a.find(".spinner");a.formatToggleTitle();var l=e('<input type="hidden">').val("yes");e(document).trigger("yith-toggle-element-item-before-update",[i,a,l]),"yes"===l.val()&&(n.addClass("show"),i.saveToggleElement(n))}),e(document).on("click",".yith-toggle-row .yith-delete-button",function(t){t.preventDefault();var i=e(this).closest(".toggle-element");e(this).closest(".yith-toggle-row").remove(),i.saveToggleElement()}),e(document).on("click",".yith-toggle-onoff",function(t){t.preventDefault(),e(this).closest(".toggle-element").saveToggleElement()}),e(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){e(this).closest(".yith-plugin-fw-radio").val(e(this).val()).trigger("change")}),e(document).on("click",".yith-password-eye",function(){var t=e(this),i=e(this).closest(".yith-password-wrapper").find("input");"password"===i.attr("type")?(i.attr("type","text"),t.addClass("yith-password-eye-closed")):(i.attr("type","password"),t.removeClass("yith-password-eye-closed"))}),e(document.body).on("yith-plugin-fw-init-radio",function(){e(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){e(this).val(e(this).attr("value")),e(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio"),e(document).on("select2:open",function(t){e(t.target).closest(".yith-plugin-ui").length&&e(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var t={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var i=t;e(document).on("click",i.selectors.units.single,i.unitChange),e(document).on("click",i.selectors.linked.button,i.linkedChange),e(document).on("change keyup",i.selectors.dimensions.number,i.numberChange)},unitChange:function(i){var a=e(this).closest(t.selectors.units.single),n=a.closest(t.selectors.units.wrapper),l=n.find(t.selectors.units.single),s=n.find(t.selectors.units.value).first(),o=a.data("value");l.removeClass(t.selectors.units.selectedClass),a.addClass(t.selectors.units.selectedClass),s.val(o)},linkedChange:function(){var i=e(this).closest(t.selectors.linked.button),a=i.closest(t.selectors.wrapper),n=i.find(t.selectors.linked.value);"yes"===n.val()?(a.removeClass(t.selectors.linked.wrapperActiveClass),n.val("no")):(a.addClass(t.selectors.linked.wrapperActiveClass),n.val("yes"),a.find(t.selectors.dimensions.number).first().trigger("change"))},numberChange:function(i){var a=e(this).closest(t.selectors.dimensions.number),n=a.closest(t.selectors.wrapper);n.hasClass(t.selectors.linked.wrapperActiveClass)&&n.find(t.selectors.dimensions.number).val(a.val())}};t.init()}(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(a){a(document).on("yith_fields_init",function(){var b=a(".yith-plugin-fw-datepicker"),c=a(".yith-plugin-fw-colorpicker"),d=a(".yith-plugin-fw-upload-img-url"),e=a(".add_media"),f=a(".yith-plugin-fw .image-gallery ul.slides-wrapper"),h=a(".yith-plugin-fw-sidebar-layout"),k=a(".yith-plugin-fw .yith-plugin-fw-slider-container .ui-slider-horizontal"),l=a(".codemirror"),n=a(".yit-icons-manager-wrapper");a(".yith-plugin-ui td.forminp-checkbox");b.each(function(){var b=a(this).data();b.showAnim=
2
+ !1;b.beforeShow=function(a,b){b.dpDiv.addClass("yith-plugin-fw-datepicker-div")};b.onClose=function(a,b){b.dpDiv.removeClass("yith-plugin-fw-datepicker-div")};a(this).datepicker(b)});c.wpColorPicker({palettes:!1,width:200,mode:"hsl",clear:function(){var b=a(this);b.val(b.data("default-color"));b.change()}});c.each(function(){var b=a(this).data("variations-label"),g=a(this).closest(".yith-plugin-fw-colorpicker-field-wrapper"),c=a(this).closest(".yith-single-colorpicker"),m=g.find(".wp-picker-input-wrap"),
3
+ d=c.find(".wp-picker-input-wrap");m.length&&g.find("a.wp-color-result").attr("title",b);c.length&&c.find("a.wp-color-result").attr("title",b);m.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),m.find(".wp-picker-default").wrap(b));d.find(".wp-picker-clear-custom").length||(b=a("<span/>").attr({"class":"wp-picker-default-custom"}),d.find(".wp-picker-default").wrap(b))});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(d.change(function(){var b=
4
+ a(this).val(),g=a(this).parent().find(".yith-plugin-fw-upload-img-preview").first();1>g.length&&(g=a(this).parent().parent().find(".yith-plugin-fw-upload-img-preview").first());/(http|ftp|https):\/\/[a-zA-Z0-9@?^=%&amp;:/~+#-_.]*.(gif|jpg|jpeg|png|ico|svg)/.test(b)?g.html('<img src="'+b+'" style="max-width:100px; max-height:100px;" />'):g.html("")}).trigger("change"),a(document).on("click",".yith-plugin-fw-upload-button",function(b){b.preventDefault();var g=a(this).attr("id").replace(/-button$/,"");
5
+ if(!c){b=[new wp.media.controller.Library({library:wp.media.query(),multiple:!1,title:"Choose Image",priority:20,filterable:"uploaded"})];var c=wp.media.frames.downloadable_file=wp.media({title:"Choose Image",library:{type:""},button:{text:"Choose Image"},multiple:!1,states:b});c.on("select",function(){var b=c.state().get("selection").first().toJSON();a("#"+g).val(b.url);a("#"+g+"-yith-attachment-id")&&a("#"+g+"-yith-attachment-id").val(b.id);d.trigger("change")})}c.open()}),a(document).on("click",
6
+ ".yith-plugin-fw-upload-button-reset",function(b){var c=a(this);b=c.attr("id");c=c.attr("id").replace(/-button-reset$/,"");b=a("#"+b).data("default");a("#"+c).val(b);d.trigger("change")}));e.on("click",function(){});"undefined"!==typeof wp&&"undefined"!==typeof wp.media&&(a(document).on("click",".yith-plugin-fw .image-gallery-button",function(b){var c=a(this);b=c.closest(".image-gallery");var d=b.find(".image_gallery_ids"),m=d.val(),p=b.find("ul.slides-wrapper"),e=wp.media.frames.image_gallery=wp.media({title:c.data("choose"),
7
+ button:{text:c.data("update")},states:[new wp.media.controller.Library({title:c.data("choose"),filterable:"all",multiple:!0})]});e.on("select",function(){e.state().get("selection").map(function(a){a=a.toJSON();a.id&&(m=m?m+","+a.id:a.id,p.append('<li class="image" data-attachment_id="'+a.id+'"><img src="'+a.sizes.thumbnail.url+'"/><ul class="actions"><li><a href="#" class="delete" title="'+c.data("delete")+'">x</a></li></ul></li>'))});d.val(m)});e.open()}),f.each(function(){var b=a(this);b.sortable({items:"li.image",
8
+ cursor:"move",scrollSensitivity:40,forcePlaceholderSize:!0,forceHelperSize:!1,helper:"clone",opacity:.65,start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,b){b.item.removeAttr("style")},update:function(c,d){var g="";b.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");g=g+b+","});b.closest(".image-gallery").find(".image_gallery_ids").val(g)}})}),f.on("click","a.delete",function(){var b=a(this).closest(".image-gallery"),c=a(this).closest(".image-gallery ul.slides-wrapper");
9
+ b=b.find(".image_gallery_ids");var d="";a(this).closest("li.image").remove();c.find("li.image").css("cursor","default").each(function(){var b=a(this).attr("data-attachment_id");d=d+b+","});b.val(d)}));h.each(function(){a(this).find("img").on("click",function(){var b=a(this).closest(".yith-plugin-fw-sidebar-layout"),c=b.find(".yith-plugin-fw-sidebar-layout-sidebar-left-container");b=b.find(".yith-plugin-fw-sidebar-layout-sidebar-right-container");var d=a(this).data("type");a(this).parent().children(":radio").attr("checked",
10
+ !1);a(this).prev(":radio").attr("checked",!0);if("undefined"!=typeof d)switch(d){case "left":c.show();b.hide();break;case "right":b.show();c.hide();break;case "double":c.show();b.show();break;default:c.hide(),b.hide()}})});k.each(function(){var b=a(this).data("val"),c=a(this).data("min"),d=a(this).data("max"),e=a(this).data("step"),f=a(this).data("labels");a(this).slider({value:b,min:c,max:d,range:"min",step:e,create:function(){a(this).find(".ui-slider-handle").text(a(this).slider("value"))},slide:function(b,
11
+ c){a(this).find("input").val(c.value);a(this).find(".ui-slider-handle").text(c.value);a(this).siblings(".feedback").find("strong").text(c.value+f)}})});l.each(function(b,c){var d=CodeMirror.fromTextArea(c,{lineNumbers:1,mode:"javascript",showCursorWhenSelecting:!0});a(c).data("codemirrorInstance",d)});a(document).on("click",".yith-plugin-fw-select-all",function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!0).trigger("change")});a(document).on("click",".yith-plugin-fw-deselect-all",
12
+ function(){a("#"+a(this).data("select-id")).find("option").prop("selected",!1).trigger("change")});n.each(function(){var b=a(this),c=b.find(".yit-icons-manager-icon-preview").first(),d=b.find(".yit-icons-manager-icon-text");b.on("click",".yit-icons-manager-list li",function(e){e=a(e.target).closest("li");var g=e.data("font"),f=e.data("icon"),m=e.data("key"),h=e.data("name");c.attr("data-font",g);c.attr("data-icon",f);c.attr("data-key",m);c.attr("data-name",h);d.val(g+":"+h);b.find(".yit-icons-manager-list li").removeClass("active");
13
+ e.addClass("active")});b.on("click",".yit-icons-manager-action-set-default",function(){b.find(".yit-icons-manager-list li.default").trigger("click")})});a(document).on("click",".yith-plugin-fw-select-images__item",function(){var b=a(this),c=b.data("key"),d=b.closest(".yith-plugin-fw-select-images__wrapper"),e=d.find(".yith-plugin-fw-select-images__item");d=d.find("select").first();d.length&&(d.val(c).trigger("yith_select_images_value_changed"),e.removeClass("yith-plugin-fw-select-images__item--selected"),
14
+ b.addClass("yith-plugin-fw-select-images__item--selected"))});a(document.body).trigger("wc-enhanced-select-init");a(document).find(".ui-sortable .yith-toggle-elements").sortable({cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",stop:function(b,c){var d=jQuery(".ui-sortable-handle"),e,g=[];for(e=0;e<d.length;e++)g[e]=a(d[e]).data("item_key");0<g.length&&a(this).closest(".toggle-element").saveToggleElement(null,g)}});a(document.body).trigger("yith-framework-enhanced-select-init")}).trigger("yith_fields_init");
15
+ a(document).on("click",".yith-plugin-fw-onoff-container span",function(){var b=a(this).prev("input");b.prop("checked")?b.prop("checked",!1).attr("value","no").removeClass("onoffchecked"):b.prop("checked",!0).attr("value","yes").addClass("onoffchecked");b.change()});a.fn.saveToggleElement=function(b,c){var d=a(this),e="yith_plugin_fw_save_toggle_element",f=d.serializeToggleElement(),h=d.find(".yith-toggle_wrapper"),k=h.attr("id"),l=a.urlParam("tab");f.append("security",h.data("nonce"));"undefined"!=
16
+ typeof c&&0<c.length&&f.append("yith_toggle_elements_order_keys",c);d.closest(".metaboxes-tab.yith-plugin-ui").length?(e="yith_plugin_fw_save_toggle_element_metabox",post_id=a(this).closest("form#post").find("#post_ID").val(),yit_metaboxes_nonce=a(this).closest("form#post").find("#yit_metaboxes_nonce").val(),metabox_tab=a(this).closest(".tabs-panel").attr("id"),url=yith_framework_fw_fields.ajax_url+"?action="+e+"&post_ID="+post_id+"&yit_metaboxes_nonce="+yit_metaboxes_nonce+"&toggle_id="+k+"&metabox_tab="+
17
+ metabox_tab):url=yith_framework_fw_fields.admin_url+"?action="+e+"&tab="+l+"&toggle_id="+k;a.ajax({type:"POST",url:url,data:f,contentType:!1,processData:!1,success:function(c){b&&b.removeClass("show");a(document).trigger("yith_save_toggle_element_done",[c,d])}})};a.fn.serializeToggleElement=function(){var b=a(this),c=new FormData;b=a(b).find(":input").serializeArray();a.each(b,function(a,b){el_name=b.name;c.append(b.name,b.value)});return c};a.fn.formatToggleTitle=function(){var b=a(this),c=b.find(":input"),
18
+ d=b.find("span.title").data("title_format"),e=b.find(".subtitle").data("subtitle_format"),f=RegExp("[^%%]+(?=[%%])","g");if("undefined"!=typeof d)var h=d.match(f);if("undefined"!=typeof e)var k=e.match(f);a.each(c,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_array=$field_id.split("_"),$field_array.pop(),$field_id=$field_array.join("_"),$field_val=a(c).val(),null!=h&&"undefined"!=typeof h&&-1!==h.indexOf($field_id)&&(d=d.replace("%%"+$field_id+"%%",$field_val)),
19
+ null!=k&&"undefined"!=typeof k&&-1!==k.indexOf($field_id)&&(e=e.replace("%%"+$field_id+"%%",$field_val)))});""!==d&&b.find("span.title").html(d);""!==e&&b.find(".subtitle").html(e);a(document).trigger("yith-toggle-element-item-title",[b])};a.urlParam=function(a){a=(new RegExp("[?&]"+a+"=([^&#]*)")).exec(window.location.search);return null!==a?a[1]||0:!1};a(document).on("click",".yith-toggle-title",function(b){b=a(b.target);var c=b.closest(".yith-toggle-row"),d=c.find(".yith-toggle-content");if(b.hasClass("yith-plugin-fw-onoff")||
20
+ b.hasClass("yith-icon-drag"))return!1;c.is(".yith-toggle-row-opened")?d.slideUp(400):d.slideDown(400);c.toggleClass("yith-toggle-row-opened")});a(document).on("click",".yith-add-box-button",function(b){b.preventDefault();b=a(this);var c=b.data("box_id"),d=b.data("closed_label"),e=b.data("opened_label"),f=b.closest(".yith-toggle_wrapper").attr("id");template=wp.template("yith-toggle-element-add-box-content-"+f);""!==c&&(a("#"+c).html(template({index:"box_id"})).slideToggle(),""!==d&&(b.html()===d?
21
+ b.html(e).removeClass("closed"):b.html(d).addClass("closed")),a(document).trigger("yith_fields_init"),a(document).trigger("yith-add-box-button-toggle",[b]))});a(document).on("click",".yith-add-box-buttons .yith-save-button",function(b){b.preventDefault();var c=a(this).parents(".yith-add-box"),d=a(this).closest(".yith-toggle_wrapper").attr("id");b=c.find(".spinner");var e=a(this).parents(".toggle-element"),f=c.find(":input"),h=e.find(".yith-toggle-row").length,k=a('<input type="hidden">');k.val(h);
22
+ a(document).trigger("yith-toggle-change-counter",[k,c]);h=k.val();d=wp.template("yith-toggle-element-item-"+d);var l=a(d({index:h}));b.addClass("show");a.each(f,function(b,c){"undefined"!=typeof a(c).attr("id")&&($field_id=a(c).attr("id"),$field_val=a(c).val(),"radio"==a(c).attr("type")?($field_id=$field_id.replace("new_",""),$field_id=$field_id.replace("-"+$field_val,""),$field_id=$field_id+"_dataindex-"+$field_val):$field_id=$field_id.replace("new_","")+"_"+h,a(c).is(":checked")&&a(l).find("#"+
23
+ $field_id).prop("checked",!0),(a(c).hasClass("yith-post-search")||a(c).hasClass("yith-term-search"))&&a(l).find("#"+$field_id).html(a("#"+a(c).attr("id")).html()),a(l).find("#"+$field_id).val($field_val))});a(l).formatToggleTitle();var n=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-add",[c,l,n]);setTimeout(function(){"yes"===n.val()&&(a(e).find(".yith-toggle-elements").append(l),a(c).find(".yith-plugin-fw-datepicker").datepicker("destroy"),a(c).html(""),
24
+ a(c).prev(".yith-add-box-button").trigger("click"),e.saveToggleElement(),setTimeout(function(){a(e).find(".highlight").removeClass("highlight")},2E3),a(document).trigger("yith_fields_init"))},1E3)});a(document).on("click",".yith-toggle-row .yith-save-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");var c=a(this).closest(".yith-toggle-row"),d=c.find(".spinner");c.formatToggleTitle();var e=a('<input type="hidden">').val("yes");a(document).trigger("yith-toggle-element-item-before-update",
25
+ [b,c,e]);"yes"===e.val()&&(d.addClass("show"),b.saveToggleElement(d))});a(document).on("click",".yith-toggle-row .yith-delete-button",function(b){b.preventDefault();b=a(this).closest(".toggle-element");a(this).closest(".yith-toggle-row").remove();b.saveToggleElement()});a(document).on("click",".yith-toggle-onoff",function(b){b.preventDefault();a(this).closest(".toggle-element").saveToggleElement()});a(document).on("click",".yith-plugin-fw-radio input[type=radio]",function(){a(this).closest(".yith-plugin-fw-radio").val(a(this).val()).trigger("change")});
26
+ a(document).on("click",".yith-password-eye",function(){var b=a(this),c=a(this).closest(".yith-password-wrapper").find("input");"password"===c.attr("type")?(c.attr("type","text"),b.addClass("yith-password-eye-closed")):(c.attr("type","password"),b.removeClass("yith-password-eye-closed"))});a(document.body).on("yith-plugin-fw-init-radio",function(){a(".yith-plugin-fw-radio:not(.yith-plugin-fw-radio--initialized)").each(function(){a(this).val(a(this).attr("value"));a(this).addClass("yith-plugin-fw-radio--initialized")})}).trigger("yith-plugin-fw-init-radio");
27
+ a(document).on("select2:open",function(b){a(b.target).closest(".yith-plugin-ui").length&&a(".select2-results").closest(".select2-container").addClass("yith-plugin-fw-select2-container")});var f={selectors:{wrapper:".yith-plugin-fw-dimensions",units:{wrapper:".yith-plugin-fw-dimensions__units",single:".yith-plugin-fw-dimensions__unit",value:".yith-plugin-fw-dimensions__unit__value",selectedClass:"yith-plugin-fw-dimensions__unit--selected"},linked:{button:".yith-plugin-fw-dimensions__linked",value:".yith-plugin-fw-dimensions__linked__value",
28
+ wrapperActiveClass:"yith-plugin-fw-dimensions--linked-active"},dimensions:{number:".yith-plugin-fw-dimensions__dimension__number"}},init:function(){var b=f;a(document).on("click",b.selectors.units.single,b.unitChange);a(document).on("click",b.selectors.linked.button,b.linkedChange);a(document).on("change keyup",b.selectors.dimensions.number,b.numberChange)},unitChange:function(b){b=a(this).closest(f.selectors.units.single);var c=b.closest(f.selectors.units.wrapper),d=c.find(f.selectors.units.single);
29
+ c=c.find(f.selectors.units.value).first();var e=b.data("value");d.removeClass(f.selectors.units.selectedClass);b.addClass(f.selectors.units.selectedClass);c.val(e)},linkedChange:function(){var b=a(this).closest(f.selectors.linked.button),c=b.closest(f.selectors.wrapper);b=b.find(f.selectors.linked.value);"yes"===b.val()?(c.removeClass(f.selectors.linked.wrapperActiveClass),b.val("no")):(c.addClass(f.selectors.linked.wrapperActiveClass),b.val("yes"),c.find(f.selectors.dimensions.number).first().trigger("change"))},
30
+ numberChange:function(b){b=a(this).closest(f.selectors.dimensions.number);var c=b.closest(f.selectors.wrapper);c.hasClass(f.selectors.linked.wrapperActiveClass)&&c.find(f.selectors.dimensions.number).val(b.val())}};f.init()})(jQuery);
plugin-fw/assets/js/yith-gutenberg.js CHANGED
File without changes
plugin-fw/assets/js/yith-gutenberg.min.js CHANGED
File without changes
plugin-fw/assets/js/yith-system-info.js CHANGED
File without changes
plugin-fw/assets/js/yith-system-info.min.js CHANGED
File without changes
plugin-fw/assets/js/yith-update-plugins.js CHANGED
File without changes
plugin-fw/assets/js/yith-update-plugins.min.js CHANGED
File without changes
plugin-fw/init.php CHANGED
@@ -1,13 +1,13 @@
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
- * Version: 3.4.19
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
- * @version 3.4.19
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
1
  <?php
2
  /**
3
  * Framework Name: YIT Plugin Framework
4
+ * Version: 3.4.21
5
  * Author: YITH
6
  * Text Domain: yith-plugin-fw
7
  * Domain Path: /languages/
8
  *
9
  * @author Your Inspiration Themes
10
+ * @version 3.4.20
11
  */
12
  /**
13
  * This file belongs to the YIT Plugin Framework.
plugin-fw/languages/yith-plugin-fw-el.mo CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-el.po CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-es_ES.mo CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-es_ES.po CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-it_IT.mo CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-it_IT.po CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-nl_NL.mo CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw-nl_NL.po CHANGED
File without changes
plugin-fw/languages/yith-plugin-fw.pot CHANGED
File without changes
plugin-fw/lib/promo/black.jpg CHANGED
File without changes
plugin-fw/lib/promo/cyber.jpg CHANGED
File without changes
plugin-fw/lib/promo/halloween.jpg CHANGED
File without changes
plugin-fw/lib/promo/yith-promo.php CHANGED
File without changes
plugin-fw/lib/promo/yith-promo.xml CHANGED
File without changes
plugin-fw/lib/yit-ajax.php CHANGED
File without changes
plugin-fw/lib/yit-cpt-unlimited.php CHANGED
File without changes
plugin-fw/lib/yit-metabox.php CHANGED
File without changes
plugin-fw/lib/yit-plugin-common.php CHANGED
File without changes
plugin-fw/lib/yit-plugin-gradients.php CHANGED
File without changes
plugin-fw/lib/yit-plugin-licence.php CHANGED
File without changes
plugin-fw/lib/yit-plugin-panel-wc.php CHANGED
@@ -460,25 +460,26 @@ if ( !class_exists( 'YIT_Plugin_Panel_WooCommerce' ) ) {
460
  delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
461
  }
462
 
463
- /**
464
- * Add the WooCommerce body class in plugin panel page
465
- *
466
- * @param array $admin_body_classes The body classes
467
- * @return array Filtered body classes
468
- * @author Andrea Grillo <andrea.grillo@yithemes.com>
469
- * @since 2.0
470
- */
471
- public static function admin_body_class( $admin_body_classes ) {
472
- global $pagenow;
473
-
474
- $assets_screen_ids = (array) apply_filters( 'yith_plugin_fw_wc_panel_screen_ids_for_assets', array() );
475
-
476
-
477
- if ( ( 'admin.php' == $pagenow && ( strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false || in_array( get_current_screen()->id, $assets_screen_ids ) ) ) )
478
- $admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
479
-
480
- return 'admin.php' == $pagenow && substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes .= ' woocommerce ' : $admin_body_classes;
481
- }
 
482
 
483
  /**
484
  * Maybe unserialize panel data
460
  delete_option( 'yit_plugin_fw_panel_wc_default_options_set' );
461
  }
462
 
463
+ /**
464
+ * Add the WooCommerce body class in plugin panel page
465
+ *
466
+ * @param string $admin_body_classes The body classes.
467
+ * @return string Filtered body classes
468
+ * @author Andrea Grillo <andrea.grillo@yithemes.com>
469
+ * @since 2.0
470
+ */
471
+ public static function admin_body_class( $admin_body_classes ) {
472
+ global $pagenow;
473
+
474
+ $assets_screen_ids = (array) apply_filters( 'yith_plugin_fw_wc_panel_screen_ids_for_assets', array() );
475
+
476
+ if ( ( 'admin.php' == $pagenow && ( strpos( get_current_screen()->id, 'yith-plugins_page' ) !== false || in_array( get_current_screen()->id, $assets_screen_ids ) ) ) ) {
477
+ $admin_body_classes = substr_count( $admin_body_classes, self::$body_class ) == 0 ? $admin_body_classes . self::$body_class : $admin_body_classes;
478
+ $admin_body_classes = substr_count( $admin_body_classes, 'woocommerce' ) == 0 ? $admin_body_classes . ' woocommerce ' : $admin_body_classes;
479
+ }
480
+
481
+ return $admin_body_classes;
482
+ }
483
 
484
  /**
485
  * Maybe unserialize panel data
plugin-fw/lib/yit-plugin-panel.php CHANGED
File without changes
plugin-fw/lib/yit-plugin-subpanel.php CHANGED
File without changes
plugin-fw/lib/yit-pointers.php CHANGED
File without changes
plugin-fw/lib/yit-theme-licence.php CHANGED
File without changes
plugin-fw/lib/yit-upgrade.php CHANGED
File without changes
plugin-fw/lib/yit-video.php CHANGED
File without changes
plugin-fw/lib/yith-dashboard.php CHANGED
File without changes
plugin-fw/lib/yith-gutenberg.php CHANGED
File without changes
plugin-fw/lib/yith-system-status.php CHANGED
File without changes
plugin-fw/package.json CHANGED
File without changes
plugin-fw/templates/fields/ajax-customers.php CHANGED
File without changes
plugin-fw/templates/fields/checkbox-array.php CHANGED
File without changes
plugin-fw/templates/fields/country-select.php CHANGED
File without changes
plugin-fw/templates/fields/custom.php CHANGED
File without changes
plugin-fw/templates/fields/date-format.php CHANGED
File without changes
plugin-fw/templates/fields/list-table.php CHANGED
File without changes
plugin-fw/templates/fields/multi-colorpicker.php CHANGED
File without changes
plugin-fw/templates/fields/multi-select.php CHANGED
File without changes
plugin-fw/templates/fields/password.php CHANGED
File without changes
plugin-fw/templates/fields/select-images.php CHANGED
@@ -17,7 +17,7 @@ extract( $field );
17
  $class = isset( $class ) ? $class : 'yith-plugin-fw-select-images';
18
  $wrapper_id = $id . '-wrapper';
19
  ?>
20
- <div id="<?php echo $wrapper_id ?>" class="yith-plugin-fw-select-images__wrapper">
21
 
22
  <select id="<?php echo $id ?>"
23
  name="<?php echo $name ?>"
@@ -41,7 +41,7 @@ $wrapper_id = $id . '-wrapper';
41
  $selected_class = 'yith-plugin-fw-select-images__item--selected';
42
  $current_class = $key === $value ? $selected_class : '';
43
  ?>
44
- <li class="yith-plugin-fw-select-images__item <?php echo $current_class ?>" data-key="<?php echo $key ?>" <?php echo $img_data; ?>>
45
  <?php if ( $label ) : ?>
46
  <div class="yith-plugin-fw-select-images__item__label"><?php echo $label ?></div>
47
  <?php endif; ?>
@@ -50,4 +50,4 @@ $wrapper_id = $id . '-wrapper';
50
  <?php endif; ?>
51
  <?php endforeach; ?>
52
  </ul>
53
- </div>
17
  $class = isset( $class ) ? $class : 'yith-plugin-fw-select-images';
18
  $wrapper_id = $id . '-wrapper';
19
  ?>
20
+ <div id="<?php echo $wrapper_id ?>" class="yith-plugin-fw-select-images__wrapper" data-type="select-images">
21
 
22
  <select id="<?php echo $id ?>"
23
  name="<?php echo $name ?>"
41
  $selected_class = 'yith-plugin-fw-select-images__item--selected';
42
  $current_class = $key === $value ? $selected_class : '';
43
  ?>
44
+ <li class="yith-plugin-fw-select-images__item <?php echo $current_class ?>" data-type="select-images-item" data-key="<?php echo $key ?>" <?php echo $img_data; ?>>
45
  <?php if ( $label ) : ?>
46
  <div class="yith-plugin-fw-select-images__item__label"><?php echo $label ?></div>
47
  <?php endif; ?>
50
  <?php endif; ?>
51
  <?php endforeach; ?>
52
  </ul>
53
+ </div>
plugin-fw/templates/fields/toggle-element-fixed.php CHANGED
File without changes
plugin-fw/templates/fields/toggle-element.php CHANGED
File without changes
plugin-fw/templates/metaboxes/tab.php CHANGED
File without changes
plugin-fw/templates/metaboxes/types/icon-list.php CHANGED
File without changes
plugin-fw/templates/panel/infobox.php CHANGED
File without changes
plugin-fw/templates/panel/sub-tabs-nav.php CHANGED
File without changes
plugin-fw/templates/panel/woocommerce/woocommerce-form.php CHANGED
File without changes
plugin-fw/templates/panel/woocommerce/woocommerce-panel.php CHANGED
File without changes
plugin-fw/templates/panel/woocommerce/woocommerce-upload.php CHANGED
File without changes
plugin-fw/templates/sysinfo/system-information-panel.php CHANGED
File without changes
plugin-fw/yit-deactive-plugin.php CHANGED
File without changes
plugin-fw/yit-functions.php CHANGED
File without changes
plugin-fw/yit-plugin-registration-hook.php CHANGED
File without changes
plugin-fw/yit-plugin.php CHANGED
File without changes
plugin-fw/yit-woocommerce-compatibility.php CHANGED
File without changes
plugin-options/gutenberg/blocks.php CHANGED
File without changes
plugin-options/premium-options.php CHANGED
File without changes
plugin-options/settings-options.php CHANGED
File without changes
templates/admin/premium.php CHANGED
File without changes
templates/yith-woocommerce-ajax-search.php CHANGED
File without changes
uninstall.php CHANGED
File without changes
widgets/class.yith-wcas-ajax-search.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Ajax Search Widget
4
+ *
5
+ * @author YITH
6
+ * @package YITH WooCommerce Ajax Search
7
+ * @version 1.1.1
8
+ */
9
+
10
+ if ( ! defined( 'YITH_WCAS' ) ) {
11
+ exit; } // Exit if accessed directly
12
+
13
+ if ( ! class_exists( 'YITH_WCAS_Ajax_Search_Widget' ) ) {
14
+ /**
15
+ * YITH WooCommerce Ajax Navigation Widget
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ class YITH_WCAS_Ajax_Search_Widget extends WP_Widget {
20
+ /**
21
+ * Constructor.
22
+ *
23
+ * @access public
24
+ */
25
+ public function __construct() {
26
+
27
+ /* Widget variable settings. */
28
+ $this->woo_widget_cssclass = 'woocommerce widget_product_search yith_woocommerce_ajax_search';
29
+ $this->woo_widget_description = __( 'An Ajax Search box for products only.', 'yith-woocommerce-ajax-search' );
30
+ $this->woo_widget_idbase = 'yith_woocommerce_ajax_search';
31
+ $this->woo_widget_name = __( 'YITH WooCommerce Ajax Product Search', 'yith-woocommerce-ajax-search' );
32
+
33
+ /* Widget settings. */
34
+ $widget_ops = array(
35
+ 'classname' => $this->woo_widget_cssclass,
36
+ 'description' => $this->woo_widget_description,
37
+ );
38
+
39
+ /* Create the widget. */
40
+ parent::__construct( 'yith_woocommerce_ajax_search', $this->woo_widget_name, $widget_ops );
41
+ }
42
+
43
+
44
+ /**
45
+ * Widget function.
46
+ *
47
+ * @see WP_Widget
48
+ * @access public
49
+ * @param array $args Array of arguments.
50
+ * @param array $instance Array of instance.
51
+ * @return void
52
+ */
53
+ public function widget( $args, $instance ) {
54
+
55
+ $title = isset( $instance['title'] ) ? $instance['title'] : '';
56
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
57
+
58
+ echo $args['before_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
59
+
60
+ if ( $title ) {
61
+ echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
62
+ }
63
+
64
+ echo do_shortcode( '[yith_woocommerce_ajax_search]' );
65
+
66
+ echo $args['after_widget']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
67
+ }
68
+
69
+ /**
70
+ * Update function.
71
+ *
72
+ * @see WP_Widget->update
73
+ * @access public
74
+ * @param array $new_instance New instance.
75
+ * @param array $old_instance Old instance.
76
+ * @return array
77
+ */
78
+ public function update( $new_instance, $old_instance ) {
79
+ $instance['title'] = wp_strip_all_tags( stripslashes( $new_instance['title'] ) );
80
+ return $instance;
81
+ }
82
+
83
+ /**
84
+ * Form function.
85
+ *
86
+ * @see WP_Widget->form
87
+ * @access public
88
+ * @param array $instance Instance.
89
+ * @return void
90
+ */
91
+ public function form( $instance ) {
92
+ global $wpdb;
93
+ ?>
94
+ <p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'woocommerce' ); ?></label>
95
+ <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="
96
+ <?php
97
+ if ( isset( $instance['title'] ) ) {
98
+ echo esc_attr( $instance['title'] );}
99
+ ?>
100
+ " /></p>
101
+ <?php
102
+ }
103
+ }
104
+ }
wpml-config.xml CHANGED
File without changes