PluginProbe
YeeMail — Email Template Builder & Customizer / trunk
YeeMail — Email Template Builder & Customizer vtrunk
3.0.1 2.2.1 3.0.0 2.2.0 trunk 2.0.0 2.0.3 2.0.5 2.0.8 2.1.6 2.1.7 2.1.8
yeemail / backend / src / builder.js

builder.js in YeeMail — Email Template Builder & Customizer trunk, at backend/src/builder.js

94 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($) {
2 "use strict";
3 $( document ).ready( function () {
4 $.fn.yeemail_row_droppable = function () {
5 $(this).draggable({
6 helper: function () {
7 var type = $(this).data("type");
8 var html = $.yeemail_load_type(type);
9 if(type == "row1"||type == "row2"||type == "row3" ||type == "row4" ||type == "row5" ||type == "row6" ||type == "row7" ||type == "row8" ||type == "row9" ||type == "row10" ){
10 html.find(".builder-row").addClass("builder-row-empty");
11 }
12 html.find(".builder-row").yeemail_element_sortable();
13 return html.removeAttr('style').css({width: 'auto',height: 'auto'});
14 },
15 start: function (e, ui) {
16 ui.helper.addClass('yeemailemail-temp');
17 },
18 stop: function (e, ui) {
19 ui.helper.removeClass('yeemailemail-temp');
20 },
21 cursorAt: {left: 40, top: 15},
22 connectToSortable: ".builder__list",
23 revert : 0,
24 });
25 }
26 $.fn.yeemail_row_sortable = function () {
27 $(this).sortable({
28 revert: "invalid",
29 connectWith: '.builder-row-tool',
30 placeholder: 'builder-row-insert',
31 start: function (ev, ui) {
32 ui.helper.addClass('wpbuider-email-dragging');
33 },
34 stop: function (ev, ui) {
35 ui.item.removeClass('wpbuider-email-dragging');
36 },
37 handle: ".momongaDragHandle",
38 revert : 0,
39 });
40 }
41 $.fn.yeemail_element_droppable = function () {
42 $(this).draggable({
43 helper: function () {
44 var type = $(this).data("type");
45 $( this ).removeClass('builder-row-empty');
46 var html = $.yeemail_load_type(type);
47 return html.removeAttr('style').css({width: 'auto',height: 'auto'});
48 },
49 cursor: "move",
50 cursorAt: {left: 40, top: 15},
51 start: function (e, ui) {
52 ui.helper.addClass('yeemailemail-temp');
53 },
54 stop: function (e, ui) {
55 ui.helper.removeClass('yeemailemail-temp');
56 },
57 connectToSortable: ".builder-row",
58 revert : 0,
59 });
60 }
61 $.fn.yeemail_element_sortable = function () {
62 $(this).sortable({
63 connectWith: '.builder-row',
64 revert: "invalid",
65 placeholder: 'builder-row-insert',
66 column: '',
67 tolerance: "pointer",
68 handle: ".momongaDragHandle",
69 revert : 0,
70 start: function (ev, ui) {
71 ui.helper.addClass('wpbuider-email-dragging');
72 this.column = ui.helper.closest('.builder-row');
73 },
74 stop: function (ev, ui) {
75 ui.item.removeClass('wpbuider-email-dragging');
76 if (ui.item.closest(".builder-row").find('.builder-elements').length) {
77 ui.item.closest(".builder-row").removeClass('builder-row-empty');
78 }
79 if (!(this.column.find('.builder-elements').length)) {
80 this.column.addClass('builder-row-empty');
81 }
82 },
83 });
84 }
85 if(!yeemail_script.disable_builder){
86 $( ".builder-row-tool li" ).yeemail_row_droppable();
87 $( ".builder__list--js" ).yeemail_row_sortable();
88 $( ".momongaPresets li>div" ).yeemail_element_droppable();
89 $( ".builder-row" ).yeemail_element_sortable();
90 $( ".builder-row-templates li" ).yeemail_row_droppable();
91 }
92
93 })
94 })(jQuery);