PluginProbe ʕ •ᴥ•ʔ
YITH WooCommerce Wishlist / 3.0.17
YITH WooCommerce Wishlist v3.0.17
4.16.0 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.17 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.18 3.0.19 3.0.2 3.0.20 3.0.21 3.0.22 3.0.23 3.0.25 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.10.0 3.11.0 3.12.0 3.13.0 3.14.0 3.15.0 3.16.0 3.17.0 3.18.0 3.19.0 3.2.0 3.20.0 3.21.0 3.22.0 3.23.0 3.24.0 3.25.0 3.26.0 3.27.0 3.28.0 3.29.0 3.3.0 3.30.0 3.31.0 3.32.0 3.33.0 3.34.0 3.35.0 3.36.0 3.37.0 3.38.0 3.4.0 3.5.0 3.6.0 3.7.0 3.8.0 3.9.0 4.0.0 4.0.1 4.1.0 4.10.0 4.10.1 4.10.2 4.11.0 4.12.0 4.13.0 4.14.0 4.15.0 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.8.0 4.9.0
yith-woocommerce-wishlist / plugin-fw / assets / js / yith-gutenberg.js
yith-woocommerce-wishlist / plugin-fw / assets / js Last commit date
codemirror 9 years ago javascript-md5 7 years ago how-to.js 8 years ago how-to.min.js 6 years ago jquery.colorbox.js 8 years ago jquery.colorbox.min.js 6 years ago metabox.js 5 years ago metabox.min.js 5 years ago multisite-updater.js 6 years ago multisite-updater.min.js 6 years ago wp-pages.js 6 years ago wp-pages.min.js 6 years ago yit-cpt-unlimited.js 6 years ago yit-cpt-unlimited.min.js 6 years ago yit-plugin-panel.js 5 years ago yit-plugin-panel.min.js 5 years ago yit-wp-pointer.js 5 years ago yit-wp-pointer.min.js 5 years ago yith-colorpicker.min.js 5 years ago yith-dashboard.js 7 years ago yith-dashboard.min.js 6 years ago yith-enhanced-select-wc-2.6.js 5 years ago yith-enhanced-select-wc-2.6.min.js 5 years ago yith-enhanced-select.js 5 years ago yith-enhanced-select.min.js 5 years ago yith-fields.js 5 years ago yith-fields.min.js 5 years ago yith-gutenberg.js 5 years ago yith-gutenberg.min.js 5 years ago yith-promo.js 7 years ago yith-promo.min.js 6 years ago yith-system-info.js 5 years ago yith-system-info.min.js 5 years ago yith-update-plugins.js 7 years ago yith-update-plugins.min.js 6 years ago
yith-gutenberg.js
212 lines
1 (function ($) {
2 // Get registerBlockType() from wp.blocks in the global scope
3 var __ = wp.i18n.__,
4 el = wp.element.createElement,
5 Fragment = wp.element.Fragment,
6 PanelBody = wp.components.PanelBody,
7 registerBlockType = wp.blocks.registerBlockType,
8 RichText = wp.editor.RichText,
9 BlockControls = wp.editor.BlockControls,
10 InspectorControls = wp.editor.InspectorControls,
11 AlignmentToolbar = wp.editor.AlignmentToolbar,
12 Components = wp.components,
13 RawHTML = wp.element.RawHTML,
14 SelectControl = wp.components.SelectControl,
15 ToggleControl = wp.components.ToggleControl,
16 CheckboxControl = wp.components.CheckboxControl,
17 RangeControl = wp.components.RangeControl,
18 ColorPicker = wp.components.ColorPicker,
19 RadioControl = wp.components.RadioControl,
20 TextControl = wp.components.TextControl,
21 TextareaControl = wp.components.TextareaControl;
22
23 const yith_icon = el('svg', {width: 22, height: 22},
24 el('path', {d: "M 18.24 7.628 C 17.291 8.284 16.076 8.971 14.587 9.688 C 15.344 7.186 15.765 4.851 15.849 2.684 C 15.912 0.939 15.133 0.045 13.514 0.003 C 11.558 -0.06 10.275 1.033 9.665 3.284 C 10.007 3.137 10.359 3.063 10.723 3.063 C 11.021 3.063 11.267 3.184 11.459 3.426 C 11.651 3.668 11.736 3.947 11.715 4.262 C 11.695 5.082 11.276 5.961 10.46 6.896 C 9.644 7.833 8.918 8.3 8.282 8.3 C 7.837 8.3 7.625 7.922 7.646 7.165 C 7.667 6.765 7.804 5.955 8.056 4.735 C 8.287 3.579 8.403 2.801 8.403 2.401 C 8.403 1.707 8.224 1.144 7.867 0.713 C 7.509 0.282 6.994 0.098 6.321 0.161 C 5.858 0.203 5.175 0.624 4.27 1.422 C 3.596 2.035 2.923 2.644 2.25 3.254 L 2.976 4.106 C 3.564 3.664 3.922 3.443 4.048 3.443 C 4.448 3.443 4.637 3.717 4.617 4.263 C 4.617 4.306 4.427 4.968 4.049 6.251 C 3.671 7.534 3.471 8.491 3.449 9.122 C 3.407 9.985 3.565 10.647 3.924 11.109 C 4.367 11.677 5.106 11.919 6.142 11.835 C 7.366 11.751 8.591 11.298 9.816 10.479 C 10.323 10.142 10.808 9.753 11.273 9.311 C 11.105 10.153 10.905 10.868 10.673 11.457 C 8.402 12.487 6.762 13.37 5.752 14.107 C 4.321 15.137 3.554 16.241 3.449 17.419 C 3.259 19.459 4.29 20.479 6.541 20.479 C 8.055 20.479 9.517 19.554 10.926 17.703 C 12.125 16.126 13.166 14.022 14.049 11.394 C 15.578 10.635 16.87 9.892 17.928 9.164 C 17.894 9.409 18.319 7.308 18.24 7.628 Z M 7.393 16.095 C 7.056 16.095 6.898 15.947 6.919 15.653 C 6.961 15.106 7.908 14.38 9.759 13.476 C 8.791 15.221 8.002 16.095 7.393 16.095 Z"})
25 );
26
27 function create_shortcode(sc_args, props, callback) {
28 var gt_block = '',
29 gutenberg_preview = '';
30
31 if (typeof props.callback != 'undefined' && typeof $[props.callback] == 'function') {
32 gt_block = $[props.callback](sc_args, props);
33 }
34
35 else {
36 var sc_name = props.shortcode_name,
37 sc = '[' + sc_name,
38 do_shortcode = null;
39
40
41 $.each(sc_args.attributes, function ($v, $k) {
42 if ( typeof props.attributes != 'undefined' && typeof props.attributes[$v] != 'undefined' ) {
43 sc += ' ' + $v + '=';
44 var arg = props.attributes[$v],
45 remove_quotes = arg.remove_quotes;
46
47 if( remove_quotes == true ){
48 sc += $k;
49 }
50
51 else {
52 sc += '"' + $k + '"';
53 }
54 }
55 });
56
57 sc += ']';
58
59 var block_id = md5(sc);
60
61 gutenberg_preview = '<span class="yith_block_' + block_id + '">' + sc + '</span>';
62
63 if (callback == 'edit' && props.do_shortcode != false) {
64 do_shortcode = (function (block_id) {
65 var ajax_call_date = null;
66 $(document).trigger( 'yith_plugin_fw_gutenberg_before_do_shortcode', [sc, block_id] );
67 $.ajax({
68 async: true,
69 url: yith_gutenberg_ajax.ajaxurl,
70 method: 'post',
71 data: {action: 'yith_plugin_fw_gutenberg_do_shortcode', shortcode: sc},
72 success: function (data) {
73 ajax_call_date = data;
74 if (ajax_call_date != '') {
75 $('.yith_block_' + block_id).html(ajax_call_date);
76 $(document).trigger( 'yith_plugin_fw_gutenberg_success_do_shortcode', [sc, block_id, ajax_call_date] );
77 }
78 }
79 });
80 $(document).trigger( 'yith_plugin_fw_gutenberg_after_do_shortcode', [sc, block_id, ajax_call_date] );
81 return ajax_call_date;
82 })(block_id);
83 }
84
85 gt_block = el(RawHTML, null, gutenberg_preview);
86 }
87
88 return gt_block;
89 }
90
91 function onChangeEvent(new_value, attribute_name, args, block_type) {
92 var attributes = {};
93
94 if (block_type == 'colorpicker' || block_type == 'color') {
95 new_value = new_value.hex;
96 }
97
98 attributes[attribute_name] = new_value;
99 args.setAttributes(attributes);
100 return args;
101 }
102
103 $.each(yith_gutenberg, function ($block, $props) {
104 registerBlockType("yith/" + $block, {
105 title: $props.title,
106 description: $props.description,
107 category: $props.category,
108 attributes: $props.attributes,
109 icon: typeof $props.icon != 'undefined' ? $props.icon : yith_icon,
110 keywords: $props.keywords,
111 edit: function edit(args) {
112 var elements = new Array();
113
114 $.each($props.attributes, function ($attribute_name, $attribute_args) {
115 var ComponentControl = null,
116 block_type = $attribute_args.blocktype;
117 if (typeof block_type != 'undefined') {
118 switch (block_type) {
119 case 'select':
120 ComponentControl = SelectControl;
121 break;
122
123 case 'text':
124 ComponentControl = TextControl;
125 break;
126
127 case 'textarea':
128 ComponentControl = TextareaControl;
129 break;
130
131 case 'toggle':
132 ComponentControl = ToggleControl;
133 break;
134
135 case 'checkbox':
136 ComponentControl = CheckboxControl;
137 break;
138
139 case 'number':
140 case 'range':
141 ComponentControl = RangeControl;
142 break;
143
144 case 'color':
145 case 'colorpicker':
146 ComponentControl = ColorPicker;
147 break;
148
149 case 'radio':
150 ComponentControl = RadioControl;
151 break;
152 }
153
154 if (ComponentControl != null) {
155 var helpMessageChecked = helpMessageUncheked = '';
156 if (typeof $attribute_args.helps != 'undefined' && typeof $attribute_args.helps.checked != 'undefined' && typeof $attribute_args.helps.unchecked != 'undefined') {
157 helpMessageChecked = $attribute_args.helps.checked;
158 helpMessageUncheked = $attribute_args.helps.unchecked;
159 }
160
161 else if (typeof $attribute_args.help != 'undefined') {
162 helpMessageChecked = helpMessageUncheked = $attribute_args.help;
163 }
164
165 elements.push(
166 el(
167 ComponentControl,
168 {
169 value: args.attributes[$attribute_name],
170 options: $attribute_args.options,
171 label: $attribute_args.label,
172 checked: args.attributes[$attribute_name],
173 selected: args.attributes[$attribute_name],
174 help: args.attributes[$attribute_name] ? helpMessageChecked : helpMessageUncheked,
175 disableAlpha: $attribute_args.disableAlpha,
176 min: $attribute_args.min,
177 max: $attribute_args.max,
178 multiple: $attribute_args.multiple,
179 onChange: function (new_value, attribute_name = $attribute_name) {
180 args = onChangeEvent(new_value, attribute_name, args, block_type);
181 },
182 onChangeComplete: function (new_value, attribute_name = $attribute_name) {
183 args = onChangeEvent(new_value, attribute_name, args, block_type);
184 },
185 },
186 )
187 );
188 }
189 }
190 });
191
192 sc = create_shortcode(args, $props, 'edit');
193
194 return [
195 el(
196 Fragment,
197 null,
198 el(
199 InspectorControls,
200 null,
201 elements,
202 ),
203 sc,
204 )];
205 },
206 save: function save(args) {
207 return create_shortcode(args, $props, 'save');
208 }
209 });
210 });
211 })(jQuery);
212