PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 3.7.13
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v3.7.13
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / assets / js / select2-settings.js
widget-options / assets / js Last commit date
jquery.liveFilter.js 4 years ago jquery.liveFilter.min.js 4 years ago jquery.widgetopts.beaver.js 4 years ago jquery.widgetopts.beaver.min.js 4 years ago select2-settings.js 4 years ago select2-settings.min.js 4 years ago select2.min.js 4 years ago settings.js 4 years ago settings.min.js 4 years ago widgets.js 4 years ago widgets.min.js 4 years ago wpWidgetOpts.js 4 years ago wpWidgetOpts.min.js 4 years ago
select2-settings.js
62 lines
1 (function($){
2
3 WidgetOptsSelect2 = {
4 _init: function()
5 {
6 $('select.widgetopts-select2').each(function() {
7 $(this).select2({
8 width: '100%',
9 allowClear: true,
10 placeholder: ' '
11 }).on('change', $.proxy(WidgetOptsSelect2._maybePreview, this.context))
12 .on('select2:unselecting', function(e) {
13 $(this).data('unselecting', true);
14 }).on('select2:open', function(e) { // note the open event is important
15 if ($(this).data('unselecting')) {
16 $(this).removeData('unselecting'); // you need to unset this before close
17 $(this).select2('close');
18 }
19 }).on('select2:unselect', function(e) { // note the open event is important
20 if( !$(this).val() ){
21 $(this).val("").trigger('change');
22 }
23 });
24
25 if($(this).attr('multiple')) {
26 var ul = $(this).siblings('.select2-container').first('ul.select2-selection__rendered');
27 ul.sortable({
28 placeholder : 'ui-state-highlight',
29 forcePlaceholderSize: true,
30 items : 'li:not(.select2-search__field)',
31 tolerance : 'pointer',
32 stop: function() {
33 $($(ul).find('.select2-selection__choice').get().reverse()).each(function() {
34 var id = $(this).data('data').id;
35 var option = $(this).find('option[value="' + id + '"]')[0];
36 $(this).prepend(option);
37 });
38 }
39 });
40 }
41 });
42 },
43
44 _maybePreview: function() {
45 var e = {
46 target: this
47 };
48
49 var field = $(this).closest('.fl-field');
50 var previewType = field.data('preview');
51
52 if ('refresh' == previewType.type) {
53 FLBuilder.preview.delayPreview(e);
54 }
55 }
56 }
57
58 FLBuilder.addHook('settings-form-init', function() {
59 WidgetOptsSelect2._init();
60 });
61
62 })(jQuery);