PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.15
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.15
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / assets / wpuf / js / wpuf-form-builder-components.js

wpuf-form-builder-components.js in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.15, at assets/wpuf/js/wpuf-form-builder-components.js

1,725 lines 57.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 'use strict';
2
3 ;(function ($) {
4 'use strict';
5
6 Vue.component('builder-stage', {
7 template: '#tmpl-wpuf-builder-stage',
8
9 mixins: wpuf_form_builder_mixins(wpuf_mixins.builder_stage),
10
11 computed: {
12 form_fields: function form_fields() {
13 return this.$store.state.form_fields;
14 },
15
16 field_settings: function field_settings() {
17 return this.$store.state.field_settings;
18 },
19
20 hidden_fields: function hidden_fields() {
21 return this.$store.state.form_fields.filter(function (item) {
22 return 'custom_hidden_field' === item.template || 'humanpresence' === item.template;
23 });
24 },
25
26 editing_form_id: function editing_form_id() {
27 return this.$store.state.editing_field_id;
28 },
29
30 pro_link: function pro_link() {
31 return wpuf_form_builder.pro_link;
32 }
33 },
34
35 created: function created() {
36 var self = this,
37 humanpresence_field_id = 0,
38 i = 0;
39 for (i = 0; i < self.$store.state.form_fields.length; i++) {
40 if (self.$store.state.form_fields[i].template === 'humanpresence') {
41 humanpresence_field_id = self.$store.state.form_fields[i].id;
42 }
43 }
44
45 wpuf_form_builder.event_hub.$on('humanpresence-changed', this.humanpresence_changed);
46 wpuf_form_builder.event_hub.$on('humanpresence-disabled', this.delete_humanpresence_field);
47 },
48
49 mounted: function mounted() {
50 var self = this,
51 in_column_field = false;
52
53 // bind jquery ui sortable
54 $('#form-preview-stage .wpuf-form.sortable-list').sortable({
55 placeholder: 'form-preview-stage-dropzone',
56 items: '.field-items',
57 handle: '.control-buttons .move',
58 scroll: true,
59 over: function over() {
60 in_column_field = false;
61
62 // if the field drop in column field, then stop field rendering in the builder stage
63 $(".wpuf-column-inner-fields").on("drop", function (event) {
64 var targetColumn = event.currentTarget.classList,
65 isColumnExist = $.inArray(".wpuf-column-inner-fields", targetColumn);
66
67 if (isColumnExist) {
68 in_column_field = true;
69 }
70 });
71 },
72 update: function update(e, ui) {
73 var item = ui.item[0],
74 data = item.dataset,
75 source = data.source,
76 toIndex = parseInt($(ui.item).index()),
77 payload = {
78 toIndex: toIndex
79 };
80
81 if ('panel' === source) {
82 // prepare the payload to add new form element
83 var field_template = ui.item[0].dataset.formField,
84 field = $.extend(true, {}, self.field_settings[field_template].field_props);
85
86 // check if these are already inserted
87 if (self.isSingleInstance(field_template) && self.containsField(field_template)) {
88 swal({
89 title: "Oops...",
90 text: "You already have this field in the form"
91 });
92
93 $(this).find('.button.ui-draggable.ui-draggable-handle').remove();
94 return;
95 }
96
97 // add a random integer id
98 field.id = self.get_random_id();
99
100 // add meta key
101 if ('yes' === field.is_meta && !field.name) {
102 field.name = field.label.replace(/\W/g, '_').toLowerCase() + '_' + field.id;
103 }
104
105 payload.field = field;
106
107 // add new form element
108 if (!in_column_field) {
109 self.$store.commit('add_form_field_element', payload);
110 }
111
112 // remove button from stage
113 $(this).find('.button.ui-draggable.ui-draggable-handle').remove();
114 } else if ('stage' === source) {
115 payload.fromIndex = parseInt(data.index);
116
117 self.$store.commit('swap_form_field_elements', payload);
118 }
119 }
120 });
121 },
122
123 methods: {
124
125 open_field_settings: function open_field_settings(field_id) {
126 this.$store.commit('open_field_settings', field_id);
127 },
128
129 clone_field: function clone_field(field_id, index) {
130 var payload = {
131 field_id: field_id,
132 index: index,
133 new_id: this.get_random_id()
134 };
135
136 // single instance checking
137 var field = _.find(this.$store.state.form_fields, function (item) {
138 return parseInt(item.id) === parseInt(payload.field_id);
139 });
140
141 // check if these are already inserted
142 if (this.isSingleInstance(field.template) && this.containsField(field.template)) {
143 swal({
144 title: "Oops...",
145 text: "You already have this field in the form"
146 });
147 return;
148 }
149
150 this.$store.commit('clone_form_field_element', payload);
151 },
152
153 delete_field: function delete_field(index) {
154 var self = this;
155
156 swal({
157 text: self.i18n.delete_field_warn_msg,
158 type: 'warning',
159 showCancelButton: true,
160 confirmButtonColor: '#d54e21',
161 confirmButtonText: self.i18n.yes_delete_it,
162 cancelButtonText: self.i18n.no_cancel_it,
163 confirmButtonClass: 'btn btn-success',
164 cancelButtonClass: 'btn btn-danger'
165 }).then(function () {
166 self.$store.commit('delete_form_field_element', index);
167 }, function () {});
168 },
169
170 delete_field_no_confirm: function delete_field_no_confirm(index) {
171 this.$store.commit('delete_form_field_element', index);
172 },
173
174 delete_hidden_field: function delete_hidden_field(field_id) {
175 var i = 0;
176
177 for (i = 0; i < this.form_fields.length; i++) {
178 if (parseInt(field_id) === parseInt(this.form_fields[i].id)) {
179 if (this.form_fields[i].template === 'humanpresence') {
180 this.delete_field_no_confirm(i);
181 this.disable_humanpresence_setting();
182 } else {
183 this.delete_field(i);
184 }
185 }
186 }
187 },
188
189 delete_humanpresence_field: function delete_humanpresence_field(data) {
190 var i = 0;
191 if (data.$store.state.form_fields.length) {
192 for (i = 0; i < data.$store.state.form_fields.length; i++) {
193 if (data.$store.state.form_fields[i].template === 'humanpresence') {
194 this.delete_field_no_confirm(i);
195 this.disable_humanpresence_setting();
196 }
197 }
198 }
199 },
200
201 disable_humanpresence_setting: function disable_humanpresence_setting() {
202 var settings = this.$store.state.settings;
203 settings.humanpresence_enabled = false;
204 this.$store.commit('set_form_settings', settings);
205 },
206
207 humanpresence_changed: function humanpresence_changed(e, data) {
208 if (data.$store.state.settings.humanpresence_enabled === 'true') {
209 wpuf_form_builder.event_hub.$emit('humanpresence-enabled', data);
210 } else {
211 wpuf_form_builder.event_hub.$emit('humanpresence-disabled', data);
212 }
213 },
214
215 is_pro_feature: function is_pro_feature(template) {
216 return this.field_settings[template] && this.field_settings[template].pro_feature ? true : false;
217 },
218
219 is_template_available: function is_template_available(field) {
220 var template = field.template;
221
222 if (this.field_settings[template]) {
223 if (this.is_pro_feature(template)) {
224 return false;
225 }
226
227 return true;
228 }
229
230 // for example see 'mixin_builder_stage' mixin's 'is_taxonomy_template_available' method
231 if (_.isFunction(this['is_' + template + '_template_available'])) {
232 return this['is_' + template + '_template_available'].call(this, field);
233 }
234
235 return false;
236 },
237
238 is_full_width: function is_full_width(template) {
239 if (this.field_settings[template] && this.field_settings[template].is_full_width) {
240 return true;
241 }
242
243 return false;
244 },
245
246 is_invisible: function is_invisible(field) {
247 return field.recaptcha_type && 'invisible_recaptcha' === field.recaptcha_type ? true : false;
248 },
249
250 get_field_name: function get_field_name(template) {
251 return this.field_settings[template].title;
252 }
253 }
254 });
255
256 Vue.component('field-checkbox', {
257 template: '#tmpl-wpuf-field-checkbox',
258
259 mixins: [wpuf_mixins.option_field_mixin],
260
261 computed: {
262 value: {
263 get: function get() {
264 var value = this.editing_form_field[this.option_field.name];
265
266 if (this.option_field.is_single_opt) {
267 var option = Object.keys(this.option_field.options)[0];
268
269 if (value === option) {
270 return true;
271 } else {
272 return false;
273 }
274 }
275
276 return this.editing_form_field[this.option_field.name];
277 },
278
279 set: function set(value) {
280 if (this.option_field.is_single_opt) {
281 value = value ? Object.keys(this.option_field.options)[0] : '';
282 }
283
284 this.$store.commit('update_editing_form_field', {
285 editing_field_id: this.editing_form_field.id,
286 field_name: this.option_field.name,
287 value: value
288 });
289 }
290 }
291 }
292 });
293
294 Vue.component('field-html_help_text', {
295 template: '#tmpl-wpuf-field-html_help_text',
296
297 mixins: [wpuf_mixins.option_field_mixin]
298 });
299
300 Vue.component('field-multiselect', {
301 template: '#tmpl-wpuf-field-multiselect',
302
303 mixins: [wpuf_mixins.option_field_mixin],
304
305 computed: {
306 value: {
307 get: function get() {
308 return this.editing_form_field[this.option_field.name];
309 },
310
311 set: function set(value) {
312 this.$store.commit('update_editing_form_field', {
313 editing_field_id: this.editing_form_field.id,
314 field_name: this.option_field.name,
315 value: value
316 });
317 }
318 }
319 },
320
321 mounted: function mounted() {
322 this.bind_selectize();
323 },
324
325 methods: {
326 bind_selectize: function bind_selectize() {
327 var self = this;
328
329 $(this.$el).find('.term-list-selector').selectize({}).on('change', function () {
330 var data = $(this).val();
331
332 self.value = data;
333 });
334 }
335 }
336
337 });
338
339 /**
340 * Common settings component for option based fields
341 * like select, multiselect, checkbox, radio
342 */
343 Vue.component('field-option-data', {
344 template: '#tmpl-wpuf-field-option-data',
345
346 mixins: [wpuf_mixins.option_field_mixin],
347
348 data: function data() {
349 return {
350 show_value: false,
351 options: [],
352 selected: []
353 };
354 },
355
356 computed: {
357 field_options: function field_options() {
358 return this.editing_form_field.options;
359 },
360
361 field_selected: function field_selected() {
362 return this.editing_form_field.selected;
363 }
364 },
365
366 mounted: function mounted() {
367 var self = this;
368
369 this.set_options();
370
371 $(this.$el).find('.option-field-option-chooser').sortable({
372 items: '.option-field-option',
373 handle: '.sort-handler',
374 update: function update(e, ui) {
375 var item = ui.item[0],
376 data = item.dataset,
377 toIndex = parseInt($(ui.item).index()),
378 fromIndex = parseInt(data.index);
379
380 self.options.swap(fromIndex, toIndex);
381 }
382 });
383 },
384
385 methods: {
386 set_options: function set_options() {
387 var self = this;
388 var field_options = $.extend(true, {}, this.editing_form_field.options);
389
390 _.each(field_options, function (label, value) {
391 self.options.push({ label: label, value: value, id: self.get_random_id() });
392 });
393
394 if (this.option_field.is_multiple && !_.isArray(this.field_selected)) {
395 this.selected = [this.field_selected];
396 } else {
397 this.selected = this.field_selected;
398 }
399 },
400
401 // in case of select or radio buttons, user should deselect default value
402 clear_selection: function clear_selection() {
403 this.selected = null;
404 },
405
406 add_option: function add_option() {
407 var count = this.options.length,
408 new_opt = this.i18n.option + '-' + (count + 1);
409
410 this.options.push({
411 label: new_opt, value: new_opt, id: this.get_random_id()
412 });
413 },
414
415 delete_option: function delete_option(index) {
416 if (this.options.length === 1) {
417 this.warn({
418 text: this.i18n.last_choice_warn_msg,
419 showCancelButton: false,
420 confirmButtonColor: "#46b450"
421 });
422
423 return;
424 }
425
426 this.options.splice(index, 1);
427 },
428
429 set_option_label: function set_option_label(index, label) {
430 this.options[index].value = label.toLocaleLowerCase().replace(/\s/g, '_');
431 }
432 },
433
434 watch: {
435 options: {
436 deep: true,
437 handler: function handler(new_opts) {
438 var options = {},
439 i = 0;
440
441 for (i = 0; i < new_opts.length; i++) {
442 options[new_opts[i].value] = new_opts[i].label;
443 }
444
445 this.update_value('options', options);
446 }
447 },
448
449 selected: function selected(new_val) {
450 this.update_value('selected', new_val);
451 }
452 }
453 });
454
455 Vue.component('field-option-pro-feature-alert', {
456 template: '#tmpl-wpuf-field-option-pro-feature-alert',
457
458 mixins: [wpuf_mixins.option_field_mixin],
459
460 computed: {
461 pro_link: function pro_link() {
462 return wpuf_form_builder.pro_link;
463 }
464 }
465 });
466
467 /**
468 * Sidebar field options panel
469 */
470 Vue.component('field-options', {
471 template: '#tmpl-wpuf-field-options',
472
473 mixins: wpuf_form_builder_mixins(wpuf_mixins.field_options),
474
475 data: function data() {
476 return {
477 show_basic_settings: true,
478 show_advanced_settings: false,
479 show_quiz_settings: false,
480 show_humanpresence_settings: false
481 };
482 },
483
484 computed: {
485 editing_field_id: function editing_field_id() {
486 this.show_basic_settings = true;
487 this.show_advanced_settings = false;
488 this.show_quiz_settings = false;
489 this.show_humanpresence_settings = false;
490
491 return parseInt(this.$store.state.editing_field_id);
492 },
493
494 editing_form_field: function editing_form_field() {
495 var self = this,
496 i = 0;
497
498 for (i = 0; i < self.$store.state.form_fields.length; i++) {
499 // check if the editing field exist in normal fields
500 if (self.$store.state.form_fields[i].id === parseInt(self.editing_field_id)) {
501 return self.$store.state.form_fields[i];
502 }
503
504 // check if the editing field belong to column field
505 if (self.$store.state.form_fields[i].template === 'column_field') {
506 var innerColumnFields = self.$store.state.form_fields[i].inner_fields;
507
508 for (var columnFields in innerColumnFields) {
509 if (innerColumnFields.hasOwnProperty(columnFields)) {
510 var columnFieldIndex = 0;
511
512 while (columnFieldIndex < innerColumnFields[columnFields].length) {
513 if (innerColumnFields[columnFields][columnFieldIndex].id === self.editing_field_id) {
514 return innerColumnFields[columnFields][columnFieldIndex];
515 }
516 columnFieldIndex++;
517 }
518 }
519 }
520 }
521 }
522 },
523
524 settings: function settings() {
525 var settings = [],
526 template = this.editing_form_field.template;
527
528 if (_.isFunction(this['settings_' + template])) {
529 settings = this['settings_' + template].call(this, this.editing_form_field);
530 } else {
531 settings = this.$store.state.field_settings[template].settings;
532 }
533
534 return _.sortBy(settings, function (item) {
535 return parseInt(item.priority);
536 });
537 },
538
539 basic_settings: function basic_settings() {
540 return this.settings.filter(function (item) {
541 return 'basic' === item.section;
542 });
543 },
544
545 advanced_settings: function advanced_settings() {
546 return this.settings.filter(function (item) {
547 return 'advanced' === item.section;
548 });
549 },
550
551 quiz_settings: function quiz_settings() {
552 return this.settings.filter(function (item) {
553 return 'quiz' === item.section;
554 });
555 },
556
557 humanpresence_settings: function humanpresence_settings() {
558 return this.settings.filter(function (item) {
559 return 'humanpresence' === item.section;
560 });
561 },
562
563 form_field_type_title: function form_field_type_title() {
564 var template = this.editing_form_field.template;
565
566 if (_.isFunction(this['form_field_' + template + '_title'])) {
567 return this['form_field_' + template + '_title'].call(this, this.editing_form_field);
568 }
569
570 return this.$store.state.field_settings[template].title;
571 },
572
573 form_settings: function form_settings() {
574 return this.$store.state.settings;
575 }
576 },
577
578 watch: {
579 form_settings: function form_settings() {
580 return this.$store.state.settings;
581 }
582 }
583 });
584
585 Vue.component('field-radio', {
586 template: '#tmpl-wpuf-field-radio',
587
588 mixins: [wpuf_mixins.option_field_mixin],
589
590 computed: {
591 value: {
592 get: function get() {
593 return this.editing_form_field[this.option_field.name];
594 },
595
596 set: function set(value) {
597 this.$store.commit('update_editing_form_field', {
598 editing_field_id: this.editing_form_field.id,
599 field_name: this.option_field.name,
600 value: value
601 });
602 }
603 }
604 }
605 });
606
607 Vue.component('field-range', {
608 template: '#tmpl-wpuf-field-range',
609
610 mixins: [wpuf_mixins.option_field_mixin],
611
612 computed: {
613 value: {
614 get: function get() {
615 return this.editing_form_field[this.option_field.name];
616 },
617
618 set: function set(value) {
619 this.update_value(this.option_field.name, value);
620 }
621 },
622
623 minColumn: function minColumn() {
624 return this.editing_form_field.min_column;
625 },
626
627 maxColumn: function maxColumn() {
628 return this.editing_form_field.max_column;
629 }
630 },
631
632 methods: {}
633 });
634
635 Vue.component('field-select', {
636 template: '#tmpl-wpuf-field-select',
637
638 mixins: [wpuf_mixins.option_field_mixin],
639
640 computed: {
641 value: {
642 get: function get() {
643 return this.editing_form_field[this.option_field.name];
644 },
645
646 set: function set(value) {
647 this.$store.commit('update_editing_form_field', {
648 editing_field_id: this.editing_form_field.id,
649 field_name: this.option_field.name,
650 value: value
651 });
652 }
653 }
654 }
655 });
656
657 Vue.component('field-text', {
658 template: '#tmpl-wpuf-field-text',
659
660 mixins: [wpuf_mixins.option_field_mixin],
661
662 computed: {
663 value: {
664 get: function get() {
665 return this.editing_form_field[this.option_field.name];
666 },
667
668 set: function set(value) {
669 this.update_value(this.option_field.name, value);
670 }
671 }
672 },
673
674 methods: {
675 on_focusout: function on_focusout(e) {
676 wpuf_form_builder.event_hub.$emit('field-text-focusout', e, this);
677 },
678 on_keyup: function on_keyup(e) {
679 wpuf_form_builder.event_hub.$emit('field-text-keyup', e, this);
680 }
681 }
682 });
683
684 Vue.component('field-text-meta', {
685 template: '#tmpl-wpuf-field-text-meta',
686
687 mixins: [wpuf_mixins.option_field_mixin],
688
689 computed: {
690 value: {
691 get: function get() {
692 return this.editing_form_field[this.option_field.name];
693 },
694
695 set: function set(value) {
696 this.update_value(this.option_field.name, value);
697 }
698 }
699 },
700
701 created: function created() {
702 if ('yes' === this.editing_form_field.is_meta) {
703 if (!this.value) {
704 this.value = this.editing_form_field.label.replace(/\W/g, '_').toLowerCase();
705 }
706
707 wpuf_form_builder.event_hub.$on('field-text-keyup', this.meta_key_autocomplete);
708 }
709 },
710
711 methods: {
712 meta_key_autocomplete: function meta_key_autocomplete(e, label_vm) {
713 if ('label' === label_vm.option_field.name && parseInt(this.editing_form_field.id) === parseInt(label_vm.editing_form_field.id)) {
714 this.value = label_vm.value.replace(/\W/g, '_').toLowerCase();
715 }
716 }
717 }
718 });
719
720 Vue.component('field-textarea', {
721 template: '#tmpl-wpuf-field-textarea',
722
723 mixins: [wpuf_mixins.option_field_mixin],
724
725 computed: {
726 value: {
727 get: function get() {
728 return this.editing_form_field[this.option_field.name];
729 },
730
731 set: function set(value) {
732 this.update_value(this.option_field.name, value);
733 }
734 }
735 }
736 });
737
738 Vue.component('field-visibility', {
739 template: '#tmpl-wpuf-field-visibility',
740
741 mixins: [wpuf_mixins.option_field_mixin],
742
743 computed: {
744 selected: {
745 get: function get() {
746
747 return this.editing_form_field[this.option_field.name].selected;
748 },
749
750 set: function set(value) {
751
752 this.$store.commit('update_editing_form_field', {
753 editing_field_id: this.editing_form_field.id,
754 field_name: this.option_field.name,
755 value: {
756 selected: value,
757 choices: []
758 }
759 });
760 }
761 },
762
763 choices: {
764 get: function get() {
765 return this.editing_form_field[this.option_field.name].choices;
766 },
767
768 set: function set(value) {
769
770 this.$store.commit('update_editing_form_field', {
771 editing_field_id: this.editing_form_field.id,
772 field_name: this.option_field.name,
773 value: {
774 selected: this.selected,
775 choices: value
776 }
777 });
778 }
779 }
780
781 },
782
783 methods: {},
784
785 watch: {
786 selected: function selected(new_val) {
787 this.update_value('selected', new_val);
788 }
789 }
790 });
791 /**
792 * Field template: Checkbox
793 */
794 Vue.component('form-checkbox_field', {
795 template: '#tmpl-wpuf-form-checkbox_field',
796
797 mixins: [wpuf_mixins.form_field_mixin]
798 });
799
800 /**
801 * Field template: Column Field
802 */
803 var mixins = [wpuf_mixins.form_field_mixin];
804
805 if (window.wpuf_forms_mixin_builder_stage) {
806 mixins.push(window.wpuf_forms_mixin_builder_stage);
807 }
808
809 if (window.weforms_mixin_builder_stage) {
810 mixins.push(window.weforms_mixin_builder_stage);
811 }
812
813 Vue.component('form-column_field', {
814 template: '#tmpl-wpuf-form-column_field',
815
816 mixins: mixins,
817
818 data: function data() {
819 return {
820 columnClasses: ['column-1', 'column-2', 'column-3'] // don't edit class names
821 };
822 },
823 mounted: function mounted() {
824 this.resizeColumns(this.field.columns);
825
826 // bind jquery ui draggable
827 var self = this,
828 sortableFields = $(self.$el).find('.wpuf-column-inner-fields .wpuf-column-fields-sortable-list'),
829 sortableTriggered = 1,
830 columnFieldArea = $('.wpuf-field-columns'),
831 columnFields = $(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields");
832
833 columnFieldArea.mouseenter(function () {
834 self.resizeColumns(self.field.columns);
835 });
836
837 columnFieldArea.mouseleave(function () {
838 columnFields.unbind("mouseup");
839 columnFields.unbind("mousemove");
840 });
841
842 // bind jquery ui sortable
843 $(sortableFields).sortable({
844 placeholder: 'form-preview-stage-dropzone',
845 connectWith: sortableFields,
846 items: '.column-field-items',
847 handle: '.wpuf-column-field-control-buttons .move',
848 scroll: true,
849 stop: function stop(event, ui) {
850 var data_source = $(ui.item).attr('data-source');
851
852 if ('panel' === data_source) {
853 var payload = {
854 toIndex: parseInt($(ui.item).index()),
855 field_template: $(ui.item).attr('data-form-field'),
856 to_column: $(this).parent()[0].classList[0]
857 };
858
859 self.add_column_inner_field(payload);
860
861 // remove button from stage
862 $(this).find('.button.ui-draggable.ui-draggable-handle').remove();
863 }
864 },
865 update: function update(e, ui) {
866 var item = ui.item[0],
867 data = item.dataset,
868 source = data.source,
869 toIndex = parseInt($(item).index()),
870 payload = {
871 toIndex: toIndex
872 };
873
874 if ('column-field-stage' === source) {
875 payload.field_id = self.field.id;
876 payload.fromIndex = parseInt($(item).attr('column-field-index'));
877 payload.fromColumn = $(item).attr('in-column');
878 payload.toColumn = $(item).parent().parent()[0].classList[0];
879
880 // when drag field one column to another column, sortable event trigger twice and try to swap field twice.
881 // So the following conditions are needed to check and run swap_column_field_elements commit only once
882 if (payload.fromColumn !== payload.toColumn && sortableTriggered === 1) {
883 sortableTriggered = 0;
884 } else {
885 sortableTriggered++;
886 }
887
888 if (payload.fromColumn === payload.toColumn) {
889 sortableTriggered = 1;
890 }
891
892 if (sortableTriggered === 1) {
893 self.$store.commit('swap_column_field_elements', payload);
894 }
895 }
896 }
897 });
898 },
899
900 computed: {
901 column_fields: function column_fields() {
902 return this.field.inner_fields;
903 },
904
905 innerColumns: function innerColumns() {
906 return this.field.columns;
907 },
908
909 editing_form_id: function editing_form_id() {
910 return this.$store.state.editing_field_id;
911 },
912
913 field_settings: function field_settings() {
914 return this.$store.state.field_settings;
915 }
916 },
917
918 methods: {
919 is_template_available: function is_template_available(field) {
920 var template = field.template;
921
922 if (this.field_settings[template]) {
923 if (this.is_pro_feature(template)) {
924 return false;
925 }
926
927 return true;
928 }
929
930 // for example see 'mixin_builder_stage' mixin's 'is_taxonomy_template_available' method
931 if (_.isFunction(this['is_' + template + '_template_available'])) {
932 return this['is_' + template + '_template_available'].call(this, field);
933 }
934
935 return false;
936 },
937
938 is_pro_feature: function is_pro_feature(template) {
939 return this.field_settings[template] && this.field_settings[template].pro_feature ? true : false;
940 },
941
942 get_field_name: function get_field_name(template) {
943 return this.field_settings[template].title;
944 },
945
946 is_full_width: function is_full_width(template) {
947 if (this.field_settings[template] && this.field_settings[template].is_full_width) {
948 return true;
949 }
950
951 return false;
952 },
953
954 is_invisible: function is_invisible(field) {
955 return field.recaptcha_type && 'invisible_recaptcha' === field.recaptcha_type ? true : false;
956 },
957
958 isAllowedInClolumnField: function isAllowedInClolumnField(field_template) {
959 var restrictedFields = ['column_field', 'custom_hidden_field', 'step_start'];
960
961 if ($.inArray(field_template, restrictedFields) >= 0) {
962 return true;
963 }
964
965 return false;
966 },
967
968 add_column_inner_field: function add_column_inner_field(data) {
969 var payload = {
970 toWhichColumnField: this.field.id,
971 toWhichColumnFieldMeta: this.field.name,
972 toIndex: data.toIndex,
973 toWhichColumn: data.to_column
974 };
975
976 if (this.isAllowedInClolumnField(data.field_template)) {
977 swal({
978 title: "Oops...",
979 text: "You cannot add this field as inner column field"
980 });
981 return;
982 }
983
984 // check if these are already inserted
985 if (this.isSingleInstance(data.field_template) && this.containsField(data.field_template)) {
986 swal({
987 title: "Oops...",
988 text: "You already have this field in the form"
989 });
990 return;
991 }
992
993 var field = $.extend(true, {}, this.$store.state.field_settings[data.field_template].field_props),
994 form_fields = this.$store.state.form_fields;
995
996 field.id = this.get_random_id();
997
998 if ('yes' === field.is_meta && !field.name && field.label) {
999 field.name = field.label.replace(/\W/g, '_').toLowerCase();
1000
1001 var same_template_fields = form_fields.filter(function (form_field) {
1002 return form_field.template === field.template;
1003 });
1004
1005 if (same_template_fields) {
1006 field.name += '_' + this.get_random_id();
1007 }
1008 }
1009
1010 payload.field = field;
1011
1012 // add new form element
1013 this.$store.commit('add_column_inner_field_element', payload);
1014 },
1015 moveFieldsTo: function moveFieldsTo(column) {
1016 var payload = {
1017 field_id: this.field.id,
1018 move_to: column,
1019 inner_fields: this.getInnerFields()
1020 };
1021
1022 // clear inner fields & push mergedFields to column-1
1023 this.$store.commit('move_column_inner_fields', payload);
1024 },
1025 getInnerFields: function getInnerFields() {
1026 return this.field.inner_fields;
1027 },
1028
1029 open_column_field_settings: function open_column_field_settings(field, index, column) {
1030 var self = this,
1031 payload = {
1032 field_id: self.field.id,
1033 column_field: field,
1034 index: index,
1035 column: column
1036 };
1037 self.$store.commit('open_column_field_settings', payload);
1038 },
1039
1040 clone_column_field: function clone_column_field(field, index, column) {
1041 var self = this,
1042 payload = {
1043 field_id: self.field.id,
1044 column_field_id: field.id,
1045 index: index,
1046 toColumn: column,
1047 new_id: self.get_random_id()
1048 };
1049
1050 // check if the field is allowed to duplicate
1051 if (self.isSingleInstance(field.template)) {
1052 swal({
1053 title: "Oops...",
1054 text: "You already have this field in the form"
1055 });
1056 return;
1057 }
1058
1059 self.$store.commit('clone_column_field_element', payload);
1060 },
1061
1062 delete_column_field: function delete_column_field(index, fromColumn) {
1063 var self = this,
1064 payload = {
1065 field_id: self.field.id,
1066 index: index,
1067 fromColumn: fromColumn
1068 };
1069
1070 swal({
1071 text: self.i18n.delete_field_warn_msg,
1072 type: 'warning',
1073 showCancelButton: true,
1074 confirmButtonColor: '#d54e21',
1075 confirmButtonText: self.i18n.yes_delete_it,
1076 cancelButtonText: self.i18n.no_cancel_it,
1077 confirmButtonClass: 'btn btn-success',
1078 cancelButtonClass: 'btn btn-danger'
1079 }).then(function () {
1080 self.$store.commit('delete_column_field_element', payload);
1081 }, function () {});
1082 },
1083
1084 resizeColumns: function resizeColumns(columnsNumber) {
1085 var self = this;
1086 (function () {
1087 var columnElement;
1088 var startOffset;
1089 var columnField = $(self.$el).parent();
1090 var total_width = parseInt($(columnField).width());
1091
1092 Array.prototype.forEach.call($(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields"), function (column) {
1093 column.style.position = 'relative';
1094
1095 var grip = document.createElement('div');
1096 grip.innerHTML = "&nbsp;";
1097 grip.style.top = 0;
1098 grip.style.right = 0;
1099 grip.style.bottom = 0;
1100 grip.style.width = '5px';
1101 grip.style.position = 'absolute';
1102 grip.style.cursor = 'col-resize';
1103 grip.addEventListener('mousedown', function (e) {
1104 columnElement = column;
1105 startOffset = column.offsetWidth - e.pageX;
1106 });
1107
1108 column.appendChild(grip);
1109 });
1110
1111 $(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mousemove(function (e) {
1112 if (columnElement) {
1113 var currentColumnWidth = startOffset + e.pageX;
1114
1115 columnElement.style.width = 100 * currentColumnWidth / total_width + '%';
1116 }
1117 });
1118
1119 $(self.$el).find(".wpuf-column-field-inner-columns .wpuf-column-inner-fields").mouseup(function () {
1120 var colOneWidth = 0,
1121 colTwoWidth = 0,
1122 colThreeWidth = 0;
1123
1124 if (columnsNumber === 3) {
1125 colOneWidth = 100 / columnsNumber;
1126 colTwoWidth = 100 / columnsNumber;
1127 colThreeWidth = 100 / columnsNumber;
1128 } else if (columnsNumber === 2) {
1129 colOneWidth = 100 / columnsNumber;
1130 colTwoWidth = 100 / columnsNumber;
1131 colThreeWidth = 0;
1132 } else {
1133 colOneWidth = $(columnField).find(".column-1").width();
1134 colTwoWidth = $(columnField).find(".column-2").width();
1135 colThreeWidth = 0;
1136 }
1137
1138 self.field.inner_columns_size['column-1'] = colOneWidth + '%';
1139 self.field.inner_columns_size['column-2'] = colTwoWidth + '%';
1140 self.field.inner_columns_size['column-3'] = colThreeWidth + '%';
1141
1142 columnElement = undefined;
1143 });
1144 })();
1145 }
1146 },
1147
1148 watch: {
1149 innerColumns: function innerColumns(new_value) {
1150 var columns = parseInt(new_value),
1151 columns_size = this.field.inner_columns_size;
1152
1153 Object.keys(columns_size).forEach(function (column) {
1154 if (columns === 1) {
1155 columns_size[column] = '100%';
1156 }
1157
1158 if (columns === 2) {
1159 columns_size[column] = '50%';
1160 }
1161
1162 if (columns === 3) {
1163 columns_size[column] = '33.33%';
1164 }
1165 });
1166
1167 // if columns number reduce to 1 then move other column fields to the first column
1168 if (columns === 1) {
1169 this.moveFieldsTo("column-1");
1170 }
1171
1172 // if columns number reduce to 2 then move column-2 and column-3 fields to the column-2
1173 if (columns === 2) {
1174 this.moveFieldsTo("column-2");
1175 }
1176
1177 this.resizeColumns(columns);
1178 }
1179 }
1180 });
1181
1182 /**
1183 * Field template: Hidden
1184 */
1185 Vue.component('form-custom_hidden_field', {
1186 template: '#tmpl-wpuf-form-custom_hidden_field',
1187
1188 mixins: [wpuf_mixins.form_field_mixin]
1189 });
1190
1191 /**
1192 * Field template: Custom HTML
1193 */
1194 Vue.component('form-custom_html', {
1195 template: '#tmpl-wpuf-form-custom_html',
1196
1197 mixins: [wpuf_mixins.form_field_mixin],
1198
1199 data: function data() {
1200 return {
1201 raw_html: '<p>from data</p>'
1202 };
1203 }
1204 });
1205
1206 /**
1207 * Field template: Dropdown/Select
1208 */
1209 Vue.component('form-dropdown_field', {
1210 template: '#tmpl-wpuf-form-dropdown_field',
1211
1212 mixins: [wpuf_mixins.form_field_mixin]
1213 });
1214
1215 /**
1216 * Field template: Email
1217 */
1218 Vue.component('form-email_address', {
1219 template: '#tmpl-wpuf-form-email_address',
1220
1221 mixins: [wpuf_mixins.form_field_mixin]
1222 });
1223
1224 /**
1225 * Field template: Featured Image
1226 */
1227 Vue.component('form-featured_image', {
1228 template: '#tmpl-wpuf-form-featured_image',
1229
1230 mixins: [wpuf_mixins.form_field_mixin]
1231 });
1232
1233 /**
1234 * Sidebar form fields panel
1235 */
1236 Vue.component('form-fields', {
1237 template: '#tmpl-wpuf-form-fields',
1238
1239 mixins: wpuf_form_builder_mixins(wpuf_mixins.form_fields),
1240
1241 computed: {
1242 panel_sections: function panel_sections() {
1243 return this.$store.state.panel_sections;
1244 },
1245
1246 field_settings: function field_settings() {
1247 return this.$store.state.field_settings;
1248 },
1249
1250 form_fields: function form_fields() {
1251 return this.$store.state.form_fields;
1252 }
1253 },
1254
1255 created: function created() {
1256 wpuf_form_builder.event_hub.$on('humanpresence-enabled', this.add_humanpresence_field);
1257 },
1258
1259 mounted: function mounted() {
1260 // bind jquery ui draggable
1261 $(this.$el).find('.panel-form-field-buttons .button').not('[data-form-field="humanpresence"]').draggable({
1262 connectToSortable: '#form-preview-stage .wpuf-form, .wpuf-column-inner-fields .wpuf-column-fields-sortable-list',
1263 helper: 'clone',
1264 revert: 'invalid',
1265 cancel: '.button-faded'
1266 }).disableSelection();
1267 },
1268
1269 methods: {
1270 panel_toggle: function panel_toggle(index) {
1271 this.$store.commit('panel_toggle', index);
1272 },
1273
1274 add_form_field: function add_form_field(field_template) {
1275 var payload = {
1276 toIndex: this.$store.state.form_fields.length
1277 };
1278
1279 // check if these are already inserted
1280 if (this.isSingleInstance(field_template) && this.containsField(field_template)) {
1281 swal({
1282 title: "Oops...",
1283 text: "You already have this field in the form"
1284 });
1285 return;
1286 }
1287
1288 var field = $.extend(true, {}, this.$store.state.field_settings[field_template].field_props);
1289
1290 field.id = this.get_random_id();
1291
1292 if (!field.name && field.label) {
1293 field.name = field.label.replace(/\W/g, '_').toLowerCase();
1294
1295 var same_template_fields = this.form_fields.filter(function (form_field) {
1296 return form_field.template === field.template;
1297 });
1298
1299 if (same_template_fields.length) {
1300 field.name += '_' + same_template_fields.length;
1301 }
1302 }
1303
1304 if (field_template === 'humanpresence') {
1305 var settings = this.$store.state.settings;
1306 settings.humanpresence_enabled = true;
1307 this.$store.commit('set_form_settings', settings);
1308 }
1309
1310 payload.field = field;
1311
1312 // add new form element
1313 this.$store.commit('add_form_field_element', payload);
1314 },
1315
1316 add_humanpresence_field: function add_humanpresence_field(data) {
1317 if (!this.containsField('humanpresence')) {
1318 this.add_form_field('humanpresence');
1319 }
1320 },
1321
1322 is_pro_feature: function is_pro_feature(field) {
1323 return this.field_settings[field].pro_feature;
1324 },
1325
1326 alert_pro_feature: function alert_pro_feature(field) {
1327 var title = this.field_settings[field].title;
1328
1329 swal({
1330 title: '<i class="fa fa-lock"></i> ' + title + ' <br>' + this.i18n.is_a_pro_feature,
1331 text: this.i18n.pro_feature_msg,
1332 type: '',
1333 showCancelButton: true,
1334 cancelButtonText: this.i18n.close,
1335 confirmButtonColor: '#46b450',
1336 confirmButtonText: this.i18n.upgrade_to_pro
1337 }).then(function (is_confirm) {
1338 if (is_confirm) {
1339 window.open(wpuf_form_builder.pro_link, '_blank');
1340 }
1341 }, function () {});
1342 },
1343
1344 alert_invalidate_msg: function alert_invalidate_msg(field) {
1345 var validator = this.field_settings[field].validator;
1346
1347 if (validator && validator.msg) {
1348 this.warn({
1349 title: validator.msg_title || '',
1350 html: validator.msg,
1351 type: 'warning',
1352 showCancelButton: false,
1353 confirmButtonColor: '#46b450',
1354 confirmButtonText: this.i18n.ok
1355 });
1356 }
1357 },
1358
1359 get_invalidate_btn_class: function get_invalidate_btn_class(field) {
1360 return this.field_settings[field].validator.button_class;
1361 }
1362 }
1363 });
1364
1365 /**
1366 * Field template: Image Upload
1367 */
1368 Vue.component('form-image_upload', {
1369 template: '#tmpl-wpuf-form-image_upload',
1370
1371 mixins: [wpuf_mixins.form_field_mixin]
1372 });
1373
1374 /**
1375 * Field template: Multi-Select
1376 */
1377 Vue.component('form-multiple_select', {
1378 template: '#tmpl-wpuf-form-multiple_select',
1379
1380 mixins: [wpuf_mixins.form_field_mixin]
1381 });
1382
1383 /**
1384 * Field Template: Post Content
1385 */
1386 Vue.component('form-post_content', {
1387 template: '#tmpl-wpuf-form-post_content',
1388
1389 mixins: [wpuf_mixins.form_field_mixin]
1390 });
1391
1392 /**
1393 * Field Template: Post Excerpt
1394 */
1395 Vue.component('form-post_excerpt', {
1396 template: '#tmpl-wpuf-form-post_excerpt',
1397
1398 mixins: [wpuf_mixins.form_field_mixin]
1399 });
1400
1401 /**
1402 * Field template: post_tags
1403 */
1404 Vue.component('form-post_tags', {
1405 template: '#tmpl-wpuf-form-post_tags',
1406
1407 mixins: [wpuf_mixins.form_field_mixin]
1408 });
1409
1410 /**
1411 * Field template: Post Title
1412 */
1413 Vue.component('form-post_title', {
1414 template: '#tmpl-wpuf-form-post_title',
1415
1416 mixins: [wpuf_mixins.form_field_mixin]
1417 });
1418
1419 /**
1420 * Field template: Radio
1421 */
1422 Vue.component('form-radio_field', {
1423 template: '#tmpl-wpuf-form-radio_field',
1424
1425 mixins: [wpuf_mixins.form_field_mixin]
1426 });
1427
1428 /**
1429 * Field template: Recaptcha
1430 */
1431 Vue.component('form-recaptcha', {
1432 template: '#tmpl-wpuf-form-recaptcha',
1433
1434 mixins: [wpuf_mixins.form_field_mixin],
1435
1436 computed: {
1437 has_recaptcha_api_keys: function has_recaptcha_api_keys() {
1438 return wpuf_form_builder.recaptcha_site && wpuf_form_builder.recaptcha_secret ? true : false;
1439 },
1440
1441 no_api_keys_msg: function no_api_keys_msg() {
1442 return wpuf_form_builder.field_settings.recaptcha.validator.msg;
1443 }
1444 }
1445 });
1446
1447 /**
1448 * Field template: HumanPresence
1449 */
1450 Vue.component('form-humanpresence', {
1451 template: '#tmpl-wpuf-form-humanpresence',
1452
1453 mixins: [wpuf_mixins.form_field_mixin],
1454
1455 computed: {
1456 has_humanpresence_installed: function has_humanpresence_installed() {
1457 return wpuf_form_builder.humanpresence_installed;
1458 },
1459
1460 no_humanpresence_installed_msg: function no_humanpresence_installed_msg() {
1461 return wpuf_form_builder.field_settings.humanpresence.validator.msg;
1462 }
1463 }
1464
1465 });
1466
1467 /**
1468 * Field template: Section Break
1469 */
1470 Vue.component('form-section_break', {
1471 template: '#tmpl-wpuf-form-section_break',
1472
1473 mixins: [wpuf_mixins.form_field_mixin]
1474 });
1475
1476 /**
1477 * Field template: taxonomy
1478 */
1479 Vue.component('form-taxonomy', {
1480 template: '#tmpl-wpuf-form-taxonomy',
1481
1482 mixins: [wpuf_mixins.form_field_mixin],
1483
1484 computed: {
1485 terms: function terms() {
1486 var i;
1487
1488 for (i in wpuf_form_builder.wp_post_types) {
1489 var taxonomies = wpuf_form_builder.wp_post_types[i];
1490
1491 if (taxonomies.hasOwnProperty(this.field.name)) {
1492 var tax_field = taxonomies[this.field.name];
1493
1494 if (tax_field.terms) {
1495 return tax_field.terms;
1496 }
1497 }
1498 }
1499
1500 return [];
1501 },
1502
1503 sorted_terms: function sorted_terms() {
1504 var self = this;
1505 var terms = $.extend(true, [], this.terms);
1506
1507 // selection type and terms
1508 if (this.field.exclude_type && this.field.exclude) {
1509
1510 if (this.field.exclude.length > 1) {
1511 var filter_ids = this.field.exclude.split(',').map(function (id) {
1512 id = id.trim();
1513 id = parseInt(id);
1514 return id;
1515 }).filter(function (id) {
1516 return isFinite(id);
1517 });
1518 }
1519
1520 terms = terms.filter(function (term) {
1521
1522 switch (self.field.exclude_type) {
1523 case 'exclude':
1524 return _.indexOf(filter_ids, term.term_id) < 0;
1525
1526 case 'include':
1527 return _.indexOf(filter_ids, term.term_id) >= 0;
1528
1529 case 'child_of':
1530 return _.indexOf(filter_ids, parseInt(term.parent)) >= 0;
1531 }
1532 });
1533 }
1534
1535 // order
1536 terms = _.sortBy(terms, function (term) {
1537 return term[self.field.orderby];
1538 });
1539
1540 if ('DESC' === this.field.order) {
1541 terms = terms.reverse();
1542 }
1543
1544 var parent_terms = terms.filter(function (term) {
1545 return !term.parent;
1546 });
1547
1548 parent_terms.map(function (parent) {
1549 parent.children = self.get_child_terms(parent.term_id, terms);
1550 });
1551
1552 return parent_terms.length ? parent_terms : terms;
1553 }
1554 },
1555
1556 methods: {
1557 get_child_terms: function get_child_terms(parent_id, terms) {
1558 var self = this;
1559
1560 var child_terms = terms.filter(function (term) {
1561 return parseInt(term.parent) === parseInt(parent_id);
1562 });
1563
1564 child_terms.map(function (child) {
1565 child.children = self.get_child_terms(child.term_id, terms);
1566 });
1567
1568 return child_terms;
1569 },
1570
1571 get_term_dropdown_options: function get_term_dropdown_options() {
1572 var self = this,
1573 options = '';
1574
1575 if (this.field.type === 'select') {
1576 options = '<option value="">' + this.field.first + '</option>';
1577 }
1578
1579 _.each(self.sorted_terms, function (term) {
1580 options += self.get_term_dropdown_options_children(term, 0);
1581 });
1582
1583 return options;
1584 },
1585
1586 get_term_dropdown_options_children: function get_term_dropdown_options_children(term, level) {
1587 var self = this,
1588 option = '';
1589
1590 var indent = '',
1591 i = 0;
1592
1593 for (i = 0; i < level; i++) {
1594 indent += '&nbsp;&nbsp;';
1595 }
1596
1597 option += '<option value="' + term.id + '">' + indent + term.name + '</option>';
1598
1599 if (term.children.length) {
1600 _.each(term.children, function (child_term) {
1601 option += self.get_term_dropdown_options_children(child_term, level + 1);
1602 });
1603 }
1604
1605 return option;
1606 },
1607
1608 get_term_checklist: function get_term_checklist() {
1609 var self = this,
1610 checklist = '';
1611
1612 checklist += '<ul class="wpuf-category-checklist">';
1613
1614 _.each(this.sorted_terms, function (term) {
1615 checklist += self.get_term_checklist_li(term);
1616 });
1617
1618 checklist += '</ul>';
1619
1620 return checklist;
1621 },
1622
1623 get_term_checklist_li: function get_term_checklist_li(term) {
1624 var self = this,
1625 li = '';
1626
1627 li += '<li><label class="selectit"><input type="checkbox"> ' + term.name + '</label></li>';
1628
1629 if (term.children.length) {
1630 li += '<ul class="children">';
1631
1632 _.each(term.children, function (child_term) {
1633 li += self.get_term_checklist_li(child_term);
1634 });
1635
1636 li += '</ul>';
1637 }
1638
1639 return li;
1640 },
1641
1642 get_term_checklist_inline: function get_term_checklist_inline() {
1643 var self = this,
1644 checklist = '';
1645
1646 _.each(this.sorted_terms, function (term) {
1647 checklist += self.get_term_checklist_li_inline(term);
1648 });
1649
1650 return checklist;
1651 },
1652
1653 get_term_checklist_li_inline: function get_term_checklist_li_inline(term) {
1654 var self = this,
1655 li_inline = '';
1656
1657 li_inline += '<label class="wpuf-checkbox-inline"><input type="checkbox"> ' + term.name + '</label>';
1658
1659 if (term.children.length) {
1660 _.each(term.children, function (child_term) {
1661 li_inline += self.get_term_checklist_li_inline(child_term);
1662 });
1663 }
1664
1665 return li_inline;
1666 }
1667 }
1668 });
1669
1670 /**
1671 * Field template: Text
1672 */
1673 Vue.component('form-text_field', {
1674 template: '#tmpl-wpuf-form-text_field',
1675
1676 mixins: [wpuf_mixins.form_field_mixin]
1677 });
1678
1679 Vue.component('form-textarea_field', {
1680 template: '#tmpl-wpuf-form-textarea_field',
1681
1682 mixins: [wpuf_mixins.form_field_mixin]
1683 });
1684
1685 /**
1686 * Field template: Website URL
1687 */
1688 Vue.component('form-website_url', {
1689 template: '#tmpl-wpuf-form-website_url',
1690
1691 mixins: [wpuf_mixins.form_field_mixin]
1692 });
1693
1694 Vue.component('help-text', {
1695 template: '#tmpl-wpuf-help-text',
1696
1697 props: {
1698 text: {
1699 type: String,
1700 default: ''
1701 }
1702 },
1703
1704 mounted: function mounted() {
1705 $(".wpuf-tooltip").tooltip();
1706 }
1707 });
1708
1709 Vue.component('text-editor', {
1710 template: '#tmpl-wpuf-text-editor',
1711
1712 props: ['rich', 'default_text'],
1713
1714 computed: {
1715 site_url: function site_url() {
1716 return wpuf_form_builder.site_url;
1717 },
1718
1719 is_full: function is_full() {
1720 return 'yes' === this.rich;
1721 }
1722 }
1723 });
1724 })(jQuery);
1725